-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from uvarov-frontend/fix/344_navigation_by_month
Fix navigation by month
- Loading branch information
Showing
6 changed files
with
55 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Calendar } from '@src/index'; | ||
|
||
const getColumnID = (self: Calendar, type: string) => { | ||
if (self.type !== 'multiple') return { currentValue: null, columnID: 0 }; | ||
|
||
const columnEls = self.context.mainElement.querySelectorAll<HTMLElement>('[data-vc="column"]'); | ||
const columnID = Array.from(columnEls).findIndex((col) => col.closest(`[data-vc-column="${type}"]`)); | ||
|
||
return { | ||
currentValue: columnID >= 0 ? Number(columnEls[columnID].querySelector<HTMLElement>(`[data-vc="${type}"]`)?.getAttribute(`data-vc-${type}`)) : null, | ||
columnID: Math.max(columnID, 0), | ||
}; | ||
}; | ||
|
||
export default getColumnID; |