Ajustes de usabilidade no Manage time

This commit is contained in:
Paulo Porto
2026-05-08 17:41:46 -03:00
parent f574ba936c
commit f196067b21
2 changed files with 52 additions and 11 deletions

View File

@@ -1053,18 +1053,14 @@
restoreModalScrollState(overlay, previousScrollState);
window.requestAnimationFrame(() => {
if (
!appState.detailModal &&
!appState.actionFormModal &&
!appState.rampComparisonModal &&
!appState.forecastUpdateConfirmModal &&
!appState.timeManagementModal &&
requestedFocusSelector
) {
if (requestedFocusSelector && shouldRestoreFocusAfterRender()) {
const focusTarget = overlay.querySelector(requestedFocusSelector);
if (focusTarget instanceof HTMLElement) {
focusTarget.focus({ preventScroll: true });
if (focusTarget instanceof HTMLInputElement) {
focusTarget.select();
}
}
}
@@ -1073,6 +1069,20 @@
});
}
function shouldRestoreFocusAfterRender() {
if (appState.pendingFocusSelector) {
return true;
}
return (
!appState.detailModal &&
!appState.actionFormModal &&
!appState.rampComparisonModal &&
!appState.forecastUpdateConfirmModal &&
!appState.timeManagementModal
);
}
function scrollPendingTimeManagementHighlightIntoView(overlay) {
const rowId = cleanString(appState.pendingTimeManagementHighlightRowId);
@@ -5934,9 +5944,10 @@
}
const srNumber = type === "non-service" ? "non-service-sr" : "";
const nextRow = createBlankTimeManagementEntryRow(srNumber, "manual");
const nextRows = [
...getTimeManagementRows(appState.timeManagementModal),
createBlankTimeManagementEntryRow(srNumber, "manual"),
nextRow,
];
appState.timeManagementModal = {
@@ -5945,6 +5956,10 @@
highlightRowId: "",
saveErrorMessage: "",
};
appState.pendingFocusSelector = getTimeManagementComboboxFocusSelector(
nextRow.id,
type === "non-service" ? "taskType" : "sr"
);
renderModal();
}
@@ -5980,9 +5995,34 @@
deletedTimeEntryIds,
saveErrorMessage: "",
};
appState.pendingFocusSelector = getTimeManagementPostDeleteFocusSelector(
nextRows,
rows,
normalizedRowId
);
renderModal();
}
function getTimeManagementComboboxFocusSelector(rowId, field) {
return `.arch-panel-extension-combobox input[data-row-id="${cssEscape(rowId)}"][data-combobox-field="${cssEscape(field)}"]`;
}
function getTimeManagementPostDeleteFocusSelector(nextRows, previousRows, removedRowId) {
if (!nextRows.length) {
return "";
}
const removedIndex = previousRows.findIndex(
(row) => cleanString(row?.id) === cleanString(removedRowId)
);
const focusIndex = Math.min(Math.max(removedIndex, 0), nextRows.length - 1);
const focusRow = nextRows[focusIndex];
return focusRow?.id
? `.arch-panel-extension-time-management-delete[data-row-id="${cssEscape(focusRow.id)}"]`
: "";
}
function getTimeManagementRowById(modal, rowId) {
const rows = getTimeManagementRows(modal);
const normalizedRowId = cleanString(rowId);
@@ -10308,7 +10348,7 @@
scrollbar-gutter: stable;
}
.arch-panel-extension-time-management-rows:focus-within {
.arch-panel-extension-time-management-rows:has(.arch-panel-extension-combobox:focus-within) {
overflow: visible;
}

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Arch Panel Injector",
"version": "1.0.3",
"version": "1.0.4",
"description": "Insere o botao Arch panel no header do Oracle Workload Workbench.",
"permissions": [
"cookies",
@@ -175,5 +175,6 @@