Skip to content

Commit

Permalink
#470: Change behavior on table row hover.
Browse files Browse the repository at this point in the history
* Do not highlight row on hover, when row is not clickable.
  • Loading branch information
benitsch committed Jun 27, 2024
1 parent 30e44a6 commit 7a5f4ce
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/components/InterventionsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Licensed under the Elastic License 2.0. */
MoreTableRowActionResult,
MoreTableChoice,
MoreTableSortOptions,
RowSelectionMode,
} from '../models/MoreTableModel';
import ConfirmDialog from 'primevue/confirmdialog';
import DynamicDialog from 'primevue/dynamicdialog';
Expand Down Expand Up @@ -462,6 +463,7 @@ Licensed under the Elastic License 2.0. */
:sort-options="sortOptions"
:loading="loader.isLoading.value"
:editable-access="actionsVisible"
:enable-row-selection="RowSelectionMode.Single"
:editable-user-roles="[StudyRole.Admin, StudyRole.Operator]"
:empty-message="$t('intervention.interventionList.emptyListMsg')"
class="table-title-width table-btn-min-height"
Expand Down
2 changes: 2 additions & 0 deletions src/components/ObservationList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Licensed under the Elastic License 2.0. */
MoreTableFieldType,
MoreTableRowActionResult,
MoreTableSortOptions,
RowSelectionMode,
} from '../models/MoreTableModel';
import ConfirmDialog from 'primevue/confirmdialog';
import DynamicDialog from 'primevue/dynamicdialog';
Expand Down Expand Up @@ -471,6 +472,7 @@ Licensed under the Elastic License 2.0. */
:editable-user-roles="[StudyRole.Admin, StudyRole.Operator]"
:empty-message="$t('observation.observationList.emptyListMsg')"
:component-factory="factories"
:enable-row-selection="RowSelectionMode.Single"
class="table-title-width"
@on-select="openEditObservation($event)"
@on-action="executeAction($event)"
Expand Down
2 changes: 2 additions & 0 deletions src/components/StudyList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Licensed under the Elastic License 2.0. */
MoreTableFieldType,
MoreTableRowActionResult,
MoreTableSortOptions,
RowSelectionMode,
} from '../models/MoreTableModel';
import { Study, StudyRole, StudyStatus } from '../generated-sources/openapi';
import MoreTable from './shared/MoreTable.vue';
Expand Down Expand Up @@ -299,6 +300,7 @@ Licensed under the Elastic License 2.0. */
:end-row-actions="endRowActions"
:front-row-actions="frontRowActions"
:sort-options="sortOptions"
:enable-row-selection="RowSelectionMode.Single"
:editable="
(data: Study) => {
return (
Expand Down
4 changes: 1 addition & 3 deletions src/components/forms/InterventionTriggerConditionTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ Licensed under the Elastic License 2.0. */
<div class="trigger-condition-row">
<DataTable
v-model:editingRows="editingRows"
selection-mode="single"
:value="rows"
edit-mode="row"
table-class="editable-cells-table"
Expand All @@ -320,7 +319,6 @@ Licensed under the Elastic License 2.0. */
:key="column.field"
:field="column.field"
:header="column.header"
:row-hover="true"
>
<template #body="{ data, field }">
<span v-if="field === 'observationId'">
Expand Down Expand Up @@ -385,7 +383,7 @@ Licensed under the Elastic License 2.0. */
/>
</template>
</Column>
<Column key="action" row-hover="true" class="row-action text-end">
<Column key="action" class="row-action text-end">
<template #body="slotProps">
<div v-if="!slotProps.data.editMode" class="text-end">
<span class="mr-1.5"></span>
Expand Down
18 changes: 9 additions & 9 deletions src/components/shared/MoreTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Licensed under the Elastic License 2.0. */
MoreTableFieldType,
MoreTableRowActionResult,
MoreTableSortOptions,
RowSelectionMode,
} from '../../models/MoreTableModel';
import DataTable, {
DataTableFilterMeta,
Expand Down Expand Up @@ -57,6 +58,7 @@ Licensed under the Elastic License 2.0. */
editAccessRoles?: StudyRole[];
paginatorRows?: number;
componentFactory?: ComponentFactory[];
enableRowSelection?: RowSelectionMode;
}
const props = withDefaults(defineProps<MoreTableProps>(), {
Expand All @@ -75,6 +77,7 @@ Licensed under the Elastic License 2.0. */
editAccessRoles: (): StudyRole[] => [],
paginatorRows: undefined,
componentFactory: undefined,
enableRowSelection: undefined,
});
const emit = defineEmits<{
Expand Down Expand Up @@ -289,7 +292,7 @@ Licensed under the Elastic License 2.0. */
:edit-mode="enableEditMode ? 'row' : undefined"
:loading="loading"
filter-display="menu"
selection-mode="single"
:selection-mode="enableRowSelection"
:scrolable="false"
:frozen-columns="2"
:paginator="!!paginatorRows && rows.length > paginatorRows"
Expand All @@ -299,7 +302,6 @@ Licensed under the Elastic License 2.0. */
<Column
v-if="frontRowActions.length"
key="actions"
:row-hover="true"
class="row-actions"
:frozen="true"
>
Expand All @@ -322,7 +324,6 @@ Licensed under the Elastic License 2.0. */
:field="column.field"
:header="column.header"
:data-key="column.field"
:row-hover="true"
:sortable="column.sortable"
:filter="tableFilter"
:show-filter-match-modes="false"
Expand Down Expand Up @@ -539,12 +540,7 @@ Licensed under the Elastic License 2.0. */
</template>
</Column>

<Column
key="actions"
:row-hover="true"
class="row-actions"
:frozen="true"
>
<Column key="actions" class="row-actions" :frozen="true">
<template #body="slotProps">
<div v-if="!isRowInEditMode(slotProps.data)">
<div v-for="action in rowActions" :key="action.id">
Expand Down Expand Up @@ -634,6 +630,10 @@ Licensed under the Elastic License 2.0. */
background-color: #ffffff99;
}
:deep(.p-datatable .p-datatable-tbody > tr:focus) {
outline: none;
}
:deep(.pi-exclamation-circle.big:before) {
font-size: 30px;
}
Expand Down
5 changes: 5 additions & 0 deletions src/models/MoreTableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,8 @@ export interface MoreStudyGroupTableMap {
created?: string;
modified?: string;
}

export enum RowSelectionMode {
Single = 'single',
Multiple = 'multiple',
}

0 comments on commit 7a5f4ce

Please sign in to comment.