Skip to content

Commit

Permalink
fix: file path error
Browse files Browse the repository at this point in the history
  • Loading branch information
AruSeito committed Sep 8, 2022
1 parent 78e9b18 commit 941e4ed
Showing 1 changed file with 24 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {
getReflowResult,
getNearCompntNodes,
} from "@/page/App/components/DotPanel/calc"
import { componentsActions } from "../../../redux/currentApp/editor/components/componentsSlice"
import { componentsActions } from "@/redux/currentApp/editor/components/componentsSlice"

export const getEventScripts = (events: EventsInProps[], eventType: string) => {
return events.filter((event) => {
return events.filter(event => {
return event.eventType === eventType
})
}
Expand All @@ -35,21 +35,22 @@ export const TransformWidgetWrapper: FC<TransformWidgetProps> = memo(
const { displayName, type, w, h, unitW, unitH } = componentNode

const displayNameMapProps = useSelector(getExecutionResult)
const { handleUpdateGlobalData, handleDeleteGlobalData, globalData } =
useContext(GLOBAL_DATA_CONTEXT)
const {
handleUpdateGlobalData,
handleDeleteGlobalData,
globalData,
} = useContext(GLOBAL_DATA_CONTEXT)
const dispatch = useDispatch()

const allComponents = useSelector<RootState, ComponentNode[]>(
(rootState) => {
const rootNode = getCanvas(rootState)
const parentNodeDisplayName = componentNode.parentNode
const target = searchDsl(rootNode, parentNodeDisplayName)
if (target) {
return target.childrenNode || []
}
return []
},
)
const allComponents = useSelector<RootState, ComponentNode[]>(rootState => {
const rootNode = getCanvas(rootState)
const parentNodeDisplayName = componentNode.parentNode
const target = searchDsl(rootNode, parentNodeDisplayName)
if (target) {
return target.childrenNode || []
}
return []
})

const updateComponentHeight = useCallback(
(newHeight: number) => {
Expand All @@ -61,7 +62,7 @@ export const TransformWidgetWrapper: FC<TransformWidgetProps> = memo(
}
const cloneDeepAllComponents = cloneDeep(allComponents)
const findIndex = cloneDeepAllComponents.findIndex(
(node) => node.displayName === newItem.displayName,
node => node.displayName === newItem.displayName,
)
cloneDeepAllComponents.splice(findIndex, 1, newItem)
if (componentNode.h < newItem.h) {
Expand All @@ -80,7 +81,7 @@ export const TransformWidgetWrapper: FC<TransformWidgetProps> = memo(
cloneDeepAllComponents,
)
effectMap.set(newItem.displayName, newItem)
effectMap.forEach((node) => {
effectMap.forEach(node => {
if (node.displayName !== componentNode.displayName) {
node.y -= effectRows
}
Expand All @@ -100,10 +101,10 @@ export const TransformWidgetWrapper: FC<TransformWidgetProps> = memo(
[allComponents, componentNode, dispatch],
)

const realProps = useMemo(
() => displayNameMapProps[displayName] ?? {},
[displayName, displayNameMapProps],
)
const realProps = useMemo(() => displayNameMapProps[displayName] ?? {}, [
displayName,
displayNameMapProps,
])

const handleUpdateDsl = useCallback(
(value: Record<string, any>) => {
Expand Down Expand Up @@ -134,13 +135,13 @@ export const TransformWidgetWrapper: FC<TransformWidgetProps> = memo(
}, [realProps])

const handleOnChange = useCallback(() => {
getOnChangeEventScripts().forEach((scriptObj) => {
getOnChangeEventScripts().forEach(scriptObj => {
runEventHandler(scriptObj, globalData)
})
}, [getOnChangeEventScripts, globalData])

const handleOnClick = useCallback(() => {
getOnClickEventScripts().forEach((scriptObj) => {
getOnClickEventScripts().forEach(scriptObj => {
runEventHandler(scriptObj, globalData)
})
}, [getOnClickEventScripts, globalData])
Expand Down

0 comments on commit 941e4ed

Please sign in to comment.