Skip to content

Commit

Permalink
improve typing in solidtime ui package
Browse files Browse the repository at this point in the history
  • Loading branch information
Onatcer committed Oct 28, 2024
1 parent 27b40d8 commit e54df74
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion resources/js/packages/ui/package-lock.json

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
Expand Up @@ -183,7 +183,8 @@ function onSelectChange(event: Event) {
:tasks="tasks"
:selected="
!!selectedTimeEntries.find(
(filterEntry) => filterEntry.id === subEntry.id
(filterEntry: TimeEntry) =>
filterEntry.id === subEntry.id
)
"
@selected="emit('selected', [subEntry])"
Expand Down
15 changes: 8 additions & 7 deletions resources/js/packages/ui/src/TimeEntry/TimeEntryGroupedTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function unselectAllTimeEntries(value: TimeEntriesGroupedByType[]) {
@select-all="selectAllTimeEntries(value)"
@unselect-all="unselectAllTimeEntries(value)"
:checked="
value.every((timeEntry) =>
value.every((timeEntry: TimeEntry) =>
selectedTimeEntries.includes(timeEntry)
)
"></TimeEntryRowHeading>
Expand All @@ -166,19 +166,20 @@ function unselectAllTimeEntries(value: TimeEntriesGroupedByType[]) {
:enableEstimatedTime
:selected-time-entries="selectedTimeEntries"
@selected="
(timeEntries) => {
(timeEntries: TimeEntry[]) => {
selectedTimeEntries = [
...selectedTimeEntries,
...timeEntries,
];
}
"
@unselected="
(timeEntriesToUnselect) => {
(timeEntriesToUnselect: TimeEntry[]) => {
selectedTimeEntries = selectedTimeEntries.filter(
(item) =>
(item: TimeEntry) =>
!timeEntriesToUnselect.find(
(filterEntry) => filterEntry.id === item.id
(filterEntry: TimeEntry) =>
filterEntry.id === item.id
)
);
}
Expand All @@ -204,13 +205,13 @@ function unselectAllTimeEntries(value: TimeEntriesGroupedByType[]) {
:projects="projects"
:selected="
!!selectedTimeEntries.find(
(filterEntry) => filterEntry.id === entry.id
(filterEntry: TimeEntry) => filterEntry.id === entry.id
)
"
@selected="selectedTimeEntries.push(entry)"
@unselected="
selectedTimeEntries = selectedTimeEntries.filter(
(item) => item.id !== entry.id
(item: TimeEntry) => item.id !== entry.id
)
"
:tasks="tasks"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ watch(removeAllTags, () => {
selectedTags.value = [];
}
});
type SelectOption = { label: string; value: string };
</script>

<template>
Expand Down Expand Up @@ -200,8 +201,12 @@ watch(removeAllTags, () => {
<div class="flex">
<SelectDropdown
v-model="timeEntryBillable"
:get-key-from-item="(item) => item.value"
:get-name-for-item="(item) => item.label"
:get-key-from-item="
(item: SelectOption) => item.value
"
:get-name-for-item="
(item: SelectOption) => item.label
"
:items="[
{
label: 'Keep current billable status',
Expand Down

0 comments on commit e54df74

Please sign in to comment.