diff --git a/apps/builder/package.json b/apps/builder/package.json index fe69419846..89cf307f84 100644 --- a/apps/builder/package.json +++ b/apps/builder/package.json @@ -5,7 +5,7 @@ "private": true, "author": "ILLA Cloud ", "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", diff --git a/apps/builder/src/page/App/Module/DataWorkspace/components/BaseDataItem/index.tsx b/apps/builder/src/page/App/Module/DataWorkspace/components/BaseDataItem/index.tsx index d10637efa5..3801e70a29 100644 --- a/apps/builder/src/page/App/Module/DataWorkspace/components/BaseDataItem/index.tsx +++ b/apps/builder/src/page/App/Module/DataWorkspace/components/BaseDataItem/index.tsx @@ -125,6 +125,7 @@ export const BaseDataItem: FC = (props) => { > {value.$childrenNode.map((item, index) => { if (value.$widgetType === "CONTAINER_WIDGET") { + if (!(value.viewList as ViewItemShape[])[index]) return null return ( { const resourceList = useSelector(getAllResources) const action = useSelector(getCachedAction)!! + const selectedAction = useSelector(getSelectedAction)!! + const dispatch = useDispatch() const createOrUpdateResourceCallback = ( @@ -40,10 +47,22 @@ const PanelHeader: FC = () => { 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), + }), + ) } } diff --git a/apps/builder/src/page/App/components/DotPanel/hooks/sectionUtils.ts b/apps/builder/src/page/App/components/DotPanel/hooks/sectionUtils.ts index 5c732f7052..4d93c127ba 100644 --- a/apps/builder/src/page/App/components/DotPanel/hooks/sectionUtils.ts +++ b/apps/builder/src/page/App/components/DotPanel/hooks/sectionUtils.ts @@ -1,7 +1,7 @@ export const getCurrentDisplayName = ( sectionViewConfigs: any[], viewSortedKey: string[], - defaultViewKey: string, + defaultViewPath: string, isProduction: boolean, viewPath: string | undefined, currentViewIndex: number, @@ -9,7 +9,7 @@ export const getCurrentDisplayName = ( 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, diff --git a/apps/builder/src/widgetLibrary/PC/GridListWidget/components/ListWidgetWithServerPagination/index.tsx b/apps/builder/src/widgetLibrary/PC/GridListWidget/components/ListWidgetWithServerPagination/index.tsx index 14e5dc3482..72fab687ba 100644 --- a/apps/builder/src/widgetLibrary/PC/GridListWidget/components/ListWidgetWithServerPagination/index.tsx +++ b/apps/builder/src/widgetLibrary/PC/GridListWidget/components/ListWidgetWithServerPagination/index.tsx @@ -354,7 +354,6 @@ const ListWidgetWithServerPagination: FC = ( const isClickOnContainer = !!( e.target as HTMLElement )?.getAttribute("data-list-widget-container") - handleUpdateSelectedItem(index, isClickOnContainer) }} > diff --git a/apps/builder/src/widgetLibrary/PC/PublicSector/TransformWidgetWrapper/index.tsx b/apps/builder/src/widgetLibrary/PC/PublicSector/TransformWidgetWrapper/index.tsx index d7a68564b3..212af2bd94 100644 --- a/apps/builder/src/widgetLibrary/PC/PublicSector/TransformWidgetWrapper/index.tsx +++ b/apps/builder/src/widgetLibrary/PC/PublicSector/TransformWidgetWrapper/index.tsx @@ -277,9 +277,9 @@ export const TransformWidgetWrapper: FC = 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, @@ -294,8 +294,10 @@ export const TransformWidgetWrapper: FC = memo( } else { set(needRunEvents, realPath, calcValue) } + } catch { + set(needRunEvents, realPath, undefined) } - } catch (_ignore) {} + } }) needRunEvents.forEach((scriptObj: any) => { @@ -322,10 +324,10 @@ export const TransformWidgetWrapper: FC = 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, @@ -346,9 +348,9 @@ export const TransformWidgetWrapper: FC = memo( } } set(needRunEvents, realPath, valueToSet) + } catch { + set(needRunEvents, realPath, undefined) } - } catch (e) { - console.log(e) } }) needRunEvents.forEach((scriptObj: any) => { diff --git a/apps/builder/src/widgetLibrary/PC/PublicSector/TransformWidgetWrapper/renderWithJSON.tsx b/apps/builder/src/widgetLibrary/PC/PublicSector/TransformWidgetWrapper/renderWithJSON.tsx index 5a14ae66a8..216917664a 100644 --- a/apps/builder/src/widgetLibrary/PC/PublicSector/TransformWidgetWrapper/renderWithJSON.tsx +++ b/apps/builder/src/widgetLibrary/PC/PublicSector/TransformWidgetWrapper/renderWithJSON.tsx @@ -155,18 +155,18 @@ export const TransformWidgetWrapperWithJson: FC { @@ -184,9 +184,9 @@ export const TransformWidgetWrapperWithJson: FC { 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, @@ -197,8 +197,10 @@ export const TransformWidgetWrapperWithJson: FC { runEventHandler(scriptObj, finalContext)