Skip to content

Commit

Permalink
Merge branch 'beta' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
AruSeito committed Mar 5, 2024
2 parents bb2c362 + 414c378 commit e5226f1
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 23 deletions.
2 changes: 1 addition & 1 deletion apps/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"author": "ILLA Cloud <[email protected]>",
"license": "Apache-2.0",
"version": "4.5.12",
"version": "4.5.13",
"scripts": {
"dev": "vite --strictPort --force",
"build-cloud": "NODE_OPTIONS=--max-old-space-size=12288 vite build --mode cloud",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export const BaseDataItem: FC<BaseDataItemProps> = (props) => {
>
{value.$childrenNode.map((item, index) => {
if (value.$widgetType === "CONTAINER_WIDGET") {
if (!(value.viewList as ViewItemShape[])[index]) return null
return (
<BaseDataItem
key={item.displayName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ILLA_MIXPANEL_BUILDER_PAGE_NAME,
MixpanelTrackProvider,
} from "@illa-public/mixpanel-utils"
import { getInitialContent } from "@illa-public/public-configs"
import { Resource } from "@illa-public/public-types"
import {
ACTION_MODAL_WIDTH,
Expand All @@ -13,7 +14,11 @@ import { FC, useState } from "react"
import { useTranslation } from "react-i18next"
import { useDispatch, useSelector } from "react-redux"
import { Modal, Space, TriggerProvider } from "@illa-design/react"
import { getCachedAction } from "@/redux/config/configSelector"
import {
getCachedAction,
getSelectedAction,
} from "@/redux/config/configSelector"
import { configActions } from "@/redux/config/configSlice"
import { getAllResources } from "@/redux/resource/resourceSelector"
import { resourceActions } from "@/redux/resource/resourceSlice"
import { track } from "@/utils/mixpanelHelper"
Expand All @@ -33,17 +38,31 @@ const PanelHeader: FC = () => {
const resourceList = useSelector(getAllResources)

const action = useSelector(getCachedAction)!!
const selectedAction = useSelector(getSelectedAction)!!

const dispatch = useDispatch()

const createOrUpdateResourceCallback = (
resource: Resource,
isUpdate: boolean,
) => {
setEditorVisible(false)
setGeneratorVisible(false)
if (isUpdate) {
dispatch(resourceActions.updateResourceItemReducer(resource))
} else {
dispatch(resourceActions.addResourceItemReducer(resource))
dispatch(
configActions.updateCachedAction({
...action,
actionType: resource.resourceType,
resourceID: resource.resourceID,
content:
selectedAction.actionType === resource.resourceType
? selectedAction.content
: getInitialContent(resource.resourceType),
}),
)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export const getCurrentDisplayName = (
sectionViewConfigs: any[],
viewSortedKey: string[],
defaultViewKey: string,
defaultViewPath: string,
isProduction: boolean,
viewPath: string | undefined,
currentViewIndex: number,
) => {
if (!Array.isArray(sectionViewConfigs) || !Array.isArray(viewSortedKey))
return "sub-page1"
const defaultedViewConfig = sectionViewConfigs.find(
(item) => item.key === defaultViewKey,
(item) => item.path === defaultViewPath,
)
const defaultedViewKey = viewSortedKey.includes(
defaultedViewConfig?.viewDisplayName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ const ListWidgetWithServerPagination: FC<ListWidgetPropsWithChildrenNodes> = (
const isClickOnContainer = !!(
e.target as HTMLElement
)?.getAttribute("data-list-widget-container")

handleUpdateSelectedItem(index, isClickOnContainer)
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ export const TransformWidgetWrapper: FC<TransformWidgetProps> = memo(
const realPath = isFunction(formatPath)
? formatPath(path)
: convertPathToString(toPath(path).slice(1))
try {
const dynamicString = get(needRunEvents, realPath, "")
if (dynamicString) {
const dynamicString = get(needRunEvents, realPath, "")
if (dynamicString) {
try {
const calcValue = evaluateDynamicString(
`events${realPath}`,
dynamicString,
Expand All @@ -294,8 +294,10 @@ export const TransformWidgetWrapper: FC<TransformWidgetProps> = memo(
} else {
set(needRunEvents, realPath, calcValue)
}
} catch {
set(needRunEvents, realPath, undefined)
}
} catch (_ignore) {}
}
})

needRunEvents.forEach((scriptObj: any) => {
Expand All @@ -322,10 +324,10 @@ export const TransformWidgetWrapper: FC<TransformWidgetProps> = memo(
? formatPath(path)
: convertPathToString(toPath(path).slice(2))

try {
const dynamicString = get(needRunEvents, realPath, "")
const dynamicString = get(needRunEvents, realPath, "")

if (dynamicString) {
if (dynamicString) {
try {
const calcValue = evaluateDynamicString(
`events${realPath}`,
dynamicString,
Expand All @@ -346,9 +348,9 @@ export const TransformWidgetWrapper: FC<TransformWidgetProps> = memo(
}
}
set(needRunEvents, realPath, valueToSet)
} catch {
set(needRunEvents, realPath, undefined)
}
} catch (e) {
console.log(e)
}
})
needRunEvents.forEach((scriptObj: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,18 @@ export const TransformWidgetWrapperWithJson: FC<TransformWidgetWrapperWithJsonPr
? formatPath(path)
: convertPathToString(toPath(path).slice(1))

try {
const dynamicString = get(needRunEvents, realPath, "")
if (dynamicString) {
const dynamicString = get(needRunEvents, realPath, "")
if (dynamicString) {
try {
const calcValue = evaluateDynamicString(
"",
dynamicString,
finalContext,
)
set(needRunEvents, realPath, calcValue)
} catch {
set(needRunEvents, realPath, undefined)
}
} catch (e) {
console.log(e)
}
})
needRunEvents.forEach((scriptObj: any) => {
Expand All @@ -184,9 +184,9 @@ export const TransformWidgetWrapperWithJson: FC<TransformWidgetWrapperWithJsonPr
)
dynamicPaths?.forEach((path: string) => {
const realPath = convertPathToString(toPath(path).slice(2))
try {
const dynamicString = get(needRunEvents, realPath, "")
if (dynamicString) {
const dynamicString = get(needRunEvents, realPath, "")
if (dynamicString) {
try {
const calcValue = evaluateDynamicString(
"",
dynamicString,
Expand All @@ -197,8 +197,10 @@ export const TransformWidgetWrapperWithJson: FC<TransformWidgetWrapperWithJsonPr
} else {
set(needRunEvents, realPath, calcValue)
}
} catch {
set(needRunEvents, realPath, undefined)
}
} catch (_ignore) {}
}
})
needRunEvents.forEach((scriptObj: any) => {
runEventHandler(scriptObj, finalContext)
Expand Down

0 comments on commit e5226f1

Please sign in to comment.