@@ -11,22 +11,25 @@ const dashboardStore = dashboardStoreWithOut()
1111const canvasLocked = ref (false ) // Is the canvas movement locked, Default false
1212const emits = defineEmits ([' parentAddItemBox' ])
1313const { curComponentId, curComponent } = storeToRefs (dashboardStore )
14- // @ts-ignore
14+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
1515let currentInstance
1616// Props
1717const props = defineProps ({
1818 canvasId: {
1919 type: String ,
2020 default: ' canvas-main' ,
2121 },
22+ // eslint-disable-next-line vue/require-default-prop
2223 parentConfigItem: {
2324 type: Object as PropType <CanvasItem >,
2425 required: false ,
2526 },
27+ // eslint-disable-next-line vue/require-default-prop
2628 dashboardInfo: {
2729 type: Object ,
2830 required: false ,
2931 },
32+ // eslint-disable-next-line vue/require-default-prop
3033 canvasStyleData: {
3134 type: Object ,
3235 required: false ,
@@ -191,7 +194,7 @@ function addItemToPositionBox(item: CanvasItem) {
191194 for (let j = item .y - 1 ; j < item .y - 1 + item .sizeY ; j ++ ) {
192195 if (pb [j ] && pb [j ][i ]) {
193196 // Ensure the target location is valid
194- // @ts-ignore
197+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
195198 pb [j ][i ].el = item // Place the item in the corresponding position
196199 }
197200 }
@@ -406,23 +409,21 @@ function removeItem(index: number) {
406409 moveItemUp (upItem , canGoUpRows )
407410 }
408411 })
409- // @ts-ignore
410412 canvasComponentData .value .splice (index , 1 )
411413}
412414
413415function getNextDragId() {
414416 if (! canvasComponentData .value || canvasComponentData .value .length === 0 ) {
415417 return 0
416418 }
417- // @ts-ignore
418419 const validIds = canvasComponentData .value
419420 .map ((item ) => item ._dragId )
420421 .filter ((id ) => id != null && id !== ' ' ) // 过滤 null、undefined 和空字符串
421422
422423 if (validIds .length === 0 ) {
423424 return 0
424425 }
425- // @ts-ignore
426+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
426427 const maxDragId = Math .max (... validIds )
427428 return maxDragId + 1
428429}
@@ -457,7 +458,7 @@ function changeToCoord(left: number, top: number, width: number, height: number)
457458 * Detect for collisions and take appropriate measures
458459 *
459460 * @param {CanvasItem} item comparison object
460- * @param {CanvasCoord} tCord compares the coordinates of the object
461+ * @param {CanvasCoord} tCoord compares the coordinates of the object
461462 */
462463function findClosetCoords(item : CanvasItem , tCoord : CanvasCoord ) {
463464 if (isOverlay ) return
@@ -501,7 +502,7 @@ function findClosetCoords(item: CanvasItem, tCoord: CanvasCoord) {
501502
502503/**
503504 * Generate coordinates
504- * @param {CanvasItem} item : The item object to generate coordinates for
505+ * @param item
505506 */
506507function makeCoordinate(item : CanvasItem ) {
507508 let width = cellWidth .value * item .sizeX - baseMarginLeft .value
@@ -524,7 +525,7 @@ function makeCoordinate(item: CanvasItem) {
524525
525526/**
526527 * Change the coordinates of the item
527- * @param {CanvasItem} item : The item object whose coordinates need to be changed
528+ * @param item
528529 */
529530function changeItemCoord(item : CanvasItem ) {
530531 let width = cellWidth .value * item .sizeX - baseMarginLeft .value
@@ -686,7 +687,7 @@ function findBelowItems(item: CanvasItem) {
686687 for (let row = item .y - 1 ; row < positionBox .value .length ; row ++ ) {
687688 const target = positionBox .value [row ][cell ]
688689 if (target && target .el ) {
689- // @ts-ignore
690+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
690691 belowItems [target .el ._dragId ] = target .el
691692 break
692693 }
@@ -696,7 +697,6 @@ function findBelowItems(item: CanvasItem) {
696697 return _ .sortBy (Object .values (belowItems ), ' y' )
697698}
698699
699- // @ts-ignore
700700function startResize(e : MouseEvent , point : string , item : CanvasItem , index : number ) {
701701 if (! resizable .value ) return
702702 dashboardStore .setCurComponent (item )
@@ -706,7 +706,6 @@ function startResize(e: MouseEvent, point: string, item: CanvasItem, index: numb
706706 if (! infoBox .value ) {
707707 infoBox .value = {} // Reinitialize
708708 }
709- // Get the parent element of. tem
710709 infoBox .value .resizeItem = item
711710 infoBox .value .resizeItemIndex = index
712711 // Drag and drop coordinate points
@@ -724,7 +723,7 @@ function containerMouseDown(e: MouseEvent) {
724723 }
725724 infoBox .value .startX = e .pageX
726725 infoBox .value .startY = e .pageY
727- // @ts-ignore
726+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
728727 if (curComponent .value ?.component !== ' SQText' ) {
729728 e .preventDefault ()
730729 e .stopPropagation ()
@@ -792,7 +791,7 @@ function startMove(e: MouseEvent, item: CanvasItem, index: number) {
792791 }
793792
794793 const target = e .target
795- // @ts-ignore
794+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
796795 let className = target .className || ' '
797796
798797 if (
@@ -813,13 +812,13 @@ function startMove(e: MouseEvent, item: CanvasItem, index: number) {
813812
814813 infoBox .value .cloneItem = null
815814 infoBox .value .nowItemNode = null
816- // @ts-ignore
815+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
817816 if (target .className .includes (' item' )) {
818817 infoBox .value .nowItemNode = target
819- // @ts-ignore
818+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
820819 infoBox .value .cloneItem = target .cloneNode (true )
821820 } else {
822- // @ts-ignore
821+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
823822 infoBox .value .nowItemNode = target .closest (' .item' )
824823 infoBox .value .cloneItem = infoBox .value .nowItemNode .cloneNode (true )
825824 }
@@ -936,7 +935,7 @@ function startMove(e: MouseEvent, item: CanvasItem, index: number) {
936935 if (curActiveMoveInSQTab ) {
937936 if (curActiveMoveInSQTab .moveInActive ) {
938937 const refTabInstance =
939- // @ts-ignore
938+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
940939 currentInstance .refs [' shape_component_' + curActiveMoveInSQTab .id ][0 ]
941940 refTabInstance .addTabItem (moveItem )
942941 removeItemById (moveItem .id )
@@ -949,6 +948,7 @@ function startMove(e: MouseEvent, item: CanvasItem, index: number) {
949948 if (props .parentConfigItem && props .parentConfigItem .moveOutActive ) {
950949 emits (' parentAddItemBox' , _ .cloneDeep (moveItem ))
951950 removeItemById (moveItem .id )
951+ // eslint-disable-next-line vue/no-mutating-props
952952 props .parentConfigItem .moveOutActive = false
953953 }
954954 }
@@ -991,18 +991,16 @@ function nowItemStyle(item: CanvasItem) {
991991
992992function getList() {
993993 let returnList = _ .sortBy (_ .cloneDeep (canvasComponentData .value ), ' y' )
994- // @ts-ignore
994+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
995995 let finalList = []
996- // @ts-ignore
997- _ .forEach (returnList , function (item , index ) {
996+ _ .forEach (returnList , function (item ) {
998997 if (_ .isEmpty (item )) return
999- // @ts-ignore
998+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
1000999 delete item [' _dragId' ]
1001- // @ts-ignore
10021000 delete item [' show' ]
10031001 finalList .push (item )
10041002 })
1005- // @ts-ignore
1003+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
10061004 return finalList
10071005}
10081006
@@ -1014,7 +1012,7 @@ function getRenderState() {
10141012 return moveAnimate .value
10151013}
10161014
1017- // @ts-ignore
1015+ // @ts-expect-error eslint-disable-next-line @typescript-eslint/ban-ts-comment
10181016function afterInitOk(func ) {
10191017 let timeId = setInterval (() => {
10201018 if (moveAnimate .value ) {
@@ -1064,30 +1062,14 @@ function getItemStylePosition(item: CanvasItem) {
10641062 }
10651063}
10661064
1067- // @ts-ignore
1068- function tabMoveInCheck(cloneRefItem ) {
1069- // 1. If the current cloneItem type is not a tab,
1070- // check if there are any tab components with overlapping boundaries (about to overlap) in the top left and right directions of the current Item
1071- // 2.If there is, the original item of the current cloneItem is not moving (the entire dashboard will not be rearranged)
1072- // 3. Activate this tab item. At this time, the tab item displays the activation status
1073- // 4. Release this cloneItem from the main canvas and remove the canvas with the added item
1074- const moveItem = infoBox .value .moveItem
1075- if (moveItem && moveItem !== ' SQTab' ) {
1076- canvasComponentData .value .forEach ((item ) => {
1077- // Determine the position of SQTab components around moveItem
1078- if (item .id !== moveItem .id && item .component === ' SQTab' ) {
1079- }
1080- })
1081- }
1082- }
1083-
10841065function tabMoveOutCheckSQ() {
10851066 const { cloneItem, moveItem } = infoBox .value
10861067 if (cloneItem && moveItem && props .canvasId .includes (' tab' ) && props .parentConfigItem ) {
10871068 const left = cloneItem .offsetLeft
10881069 const width = cloneItem .offsetWidth
10891070 const top = cloneItem .offsetTop
10901071 const { tw } = getItemStylePosition (props .parentConfigItem )
1072+ // eslint-disable-next-line vue/no-mutating-props
10911073 props .parentConfigItem .moveOutActive =
10921074 left < - tabMoveOutXOffset || top < - tabMoveOutYOffset || left + width - tw > tabMoveOutXOffset
10931075 canvasLocked .value = props .parentConfigItem .moveOutActive
0 commit comments