@@ -3,14 +3,15 @@ import {createSortable} from '../modules/sortable.ts';
33import { POST , request } from '../modules/fetch.ts' ;
44import { fomanticQuery } from '../modules/fomantic/base.ts' ;
55import { queryElemChildren , queryElems } from '../utils/dom.ts' ;
6+ import type { SortableEvent } from 'sortablejs' ;
67
78function updateIssueCount ( card : HTMLElement ) : void {
89 const parent = card . parentElement ;
9- const cnt = parent . querySelectorAll ( '.issue-card' ) . length ;
10- parent . querySelector ( '.project-column-issue-count' ) . textContent = String ( cnt ) ;
10+ const count = parent . querySelectorAll ( '.issue-card' ) . length ;
11+ parent . querySelector ( '.project-column-issue-count' ) . textContent = String ( count ) ;
1112}
1213
13- async function moveIssue ( { item, from, to, oldIndex} : { item : HTMLElement , from : HTMLElement , to : HTMLElement , oldIndex : number } ) : Promise < void > {
14+ async function moveIssue ( { item, from, to, oldIndex} : SortableEvent ) : Promise < void > {
1415 const columnCards = to . querySelectorAll ( '.issue-card' ) ;
1516 updateIssueCount ( from ) ;
1617 updateIssueCount ( to ) ;
@@ -35,15 +36,15 @@ async function moveIssue({item, from, to, oldIndex}: {item: HTMLElement, from: H
3536async function initRepoProjectSortable ( ) : Promise < void > {
3637 // the HTML layout is: #project-board > .board > .project-column .cards > .issue-card
3738 const mainBoard = document . querySelector ( '#project-board > .board.sortable' ) ;
38- let boardColumns = mainBoard . querySelectorAll < HTMLDivElement > ( '.project-column' ) ;
39+ let boardColumns = mainBoard . querySelectorAll < HTMLElement > ( '.project-column' ) ;
3940 createSortable ( mainBoard , {
4041 group : 'project-column' ,
4142 draggable : '.project-column' ,
4243 handle : '.project-column-header' ,
4344 delayOnTouchOnly : true ,
4445 delay : 500 ,
4546 onSort : async ( ) => { // eslint-disable-line @typescript-eslint/no-misused-promises
46- boardColumns = mainBoard . querySelectorAll < HTMLDivElement > ( '.project-column' ) ;
47+ boardColumns = mainBoard . querySelectorAll < HTMLElement > ( '.project-column' ) ;
4748
4849 const columnSorting = {
4950 columns : Array . from ( boardColumns , ( column , i ) => ( {
@@ -87,7 +88,7 @@ function initRepoProjectColumnEdit(writableProjectBoard: Element): void {
8788 const attrDataColumnColor = 'data-modal-project-column-color-input' ;
8889
8990 // the "new" button is not in project board, so need to query from document
90- queryElems ( document , '.show-project-column-modal-edit' , ( el ) => {
91+ queryElems ( document , '.show-project-column-modal-edit' , ( el : Element ) => {
9192 el . addEventListener ( 'click' , ( ) => {
9293 elColumnId . value = el . getAttribute ( attrDataColumnId ) ;
9394 elColumnTitle . value = el . getAttribute ( attrDataColumnTitle ) ;
@@ -96,7 +97,7 @@ function initRepoProjectColumnEdit(writableProjectBoard: Element): void {
9697 } ) ;
9798 } ) ;
9899
99- elForm . addEventListener ( 'submit' , async ( e ) => {
100+ elForm . addEventListener ( 'submit' , async ( e : SubmitEvent ) => {
100101 e . preventDefault ( ) ;
101102 const columnId = elColumnId . value ;
102103 const actionBaseLink = elForm . getAttribute ( 'data-action-base-link' ) ;
0 commit comments