CTLE-214: dot menu bug fixes and updates

This commit is contained in:
Tim Chamberlain
2023-07-03 16:43:18 -05:00
parent 283c3c7413
commit e9f8684b82
5 changed files with 21 additions and 60 deletions

View File

@ -77,7 +77,7 @@
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.7.1</version>
<version>4.10.0</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -53,7 +53,7 @@ const CommandMenu = ({metaData}: Props) =>
// if a dot pressed, not from a "text" element, then toggle command menu //
///////////////////////////////////////////////////////////////////////////
const type = (e.target as any).type;
if (e.key === "." && type !== "text")
if (e.key === "." && type !== "text" && type !== "textarea" && type !== "input" && type !== "search")
{
e.preventDefault();
setDotMenuOpen(!dotMenuOpen);
@ -173,6 +173,7 @@ const CommandMenu = ({metaData}: Props) =>
))
)
}
<Command.Separator />
</Command.Group>
);
}
@ -201,6 +202,7 @@ const CommandMenu = ({metaData}: Props) =>
)
)
}
<Command.Separator />
</Command.Group>
);
}
@ -231,6 +233,7 @@ const CommandMenu = ({metaData}: Props) =>
)
)
}
<Command.Separator />
</Command.Group>
);
}
@ -281,11 +284,8 @@ const CommandMenu = ({metaData}: Props) =>
<Command.List>
<Command.Empty>No results found.</Command.Empty>
<ActionsSection />
<Command.Separator />
<TablesSection />
<Command.Separator />
<AppsSection />
<Command.Separator />
<RecentlyViewedSection />
</Command.List>
</Command.Dialog>

View File

@ -150,31 +150,34 @@ function RecordView({table, launchProcess}: Props): JSX.Element
})();
}
const down = (e: { key: string; metaKey: any; ctrlKey: any; preventDefault: () => void; }) =>
const down = (e: KeyboardEvent) =>
{
if(!dotMenuOpen)
const type = (e.target as any).type;
const validType = (type !== "text" && type !== "textarea" && type !== "input" && type !== "search");
if(validType && !dotMenuOpen && !showAudit && !showEditChildForm)
{
if (e.key === "n" && table.capabilities.has(Capability.TABLE_INSERT) && table.insertPermission)
if (! e.metaKey && e.key === "n" && table.capabilities.has(Capability.TABLE_INSERT) && table.insertPermission)
{
e.preventDefault()
gotoCreate();
}
else if (e.key === "e" && table.capabilities.has(Capability.TABLE_UPDATE) && table.editPermission)
else if (! e.metaKey && e.key === "e" && table.capabilities.has(Capability.TABLE_UPDATE) && table.editPermission)
{
e.preventDefault()
navigate("edit");
}
else if (e.key === "c" && table.capabilities.has(Capability.TABLE_INSERT) && table.insertPermission)
else if (! e.metaKey && e.key === "c" && table.capabilities.has(Capability.TABLE_INSERT) && table.insertPermission)
{
e.preventDefault()
navigate("copy");
}
else if (e.key === "d" && table.capabilities.has(Capability.TABLE_DELETE) && table.deletePermission)
else if (! e.metaKey && e.key === "d" && table.capabilities.has(Capability.TABLE_DELETE) && table.deletePermission)
{
e.preventDefault()
handleClickDeleteButton();
}
else if (e.key === "a" && metaData && metaData.tables.has("audit"))
else if (! e.metaKey && e.key === "a" && metaData && metaData.tables.has("audit"))
{
e.preventDefault()
navigate("#audit");
@ -187,7 +190,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element
{
document.removeEventListener("keydown", down)
}
}, [dotMenuOpen])
}, [dotMenuOpen, showEditChildForm, showAudit])
const gotoCreate = () =>
{

View File

@ -1,45 +1,3 @@
html,
body {
padding: 0;
margin: 0;
font-family: var(--font-sans);
}
body {
background: var(--app-bg);
overflow-x: hidden;
}
button {
background: none;
font-family: var(--font-sans);
padding: 0;
border: 0;
}
h1,
h2,
h3,
h4,
h5,
h6,
p {
margin: 0;
}
a {
color: inherit;
text-decoration: none;
}
*,
*::after,
*::before {
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
:root {
--font-sans: 'Inter', --apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans,
Droid Sans, Helvetica Neue, sans-serif;

View File

@ -281,15 +281,15 @@
[cmdk-group-heading] {
user-select: none;
font-size: 12px;
font-weight: bold;
font-size: 14px;
color: var(--gray11);
padding: 0 8px;
display: flex;
align-items: center;
position:sticky;
top: -1;
padding-bottom: 4px;
position: sticky;
top: 0px;
padding-bottom: 7px;
border-bottom: var(--gray6) 1px solid;
background: white;
z-index: 1;
}