@blocklet/pages-kit-block-studio 0.6.104 → 0.6.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,6 +46,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
46
46
|
const Session_1 = require("@arcblock/did-connect-react/lib/Session");
|
|
47
47
|
const Config_1 = require("@arcblock/ux/lib/Config");
|
|
48
48
|
const context_1 = require("@arcblock/ux/lib/Locale/context");
|
|
49
|
+
const use_deep_compare_memo_1 = require("@blocklet/pages-kit/hooks/use-deep-compare-memo");
|
|
49
50
|
const Toast_1 = __importStar(require("@arcblock/ux/lib/Toast"));
|
|
50
51
|
const js_sdk_1 = require("@blocklet/js-sdk");
|
|
51
52
|
const theme_1 = require("@blocklet/pages-kit-inner-components/theme");
|
|
@@ -70,7 +71,6 @@ const Settings_1 = __importDefault(require("@mui/icons-material/Settings"));
|
|
|
70
71
|
const SortByAlpha_1 = __importDefault(require("@mui/icons-material/SortByAlpha"));
|
|
71
72
|
const material_1 = require("@mui/material");
|
|
72
73
|
const ahooks_1 = require("ahooks");
|
|
73
|
-
const ahooks_2 = require("ahooks");
|
|
74
74
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
75
75
|
const get_1 = __importDefault(require("lodash/get"));
|
|
76
76
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -260,7 +260,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
260
260
|
const staticData = (0, client_1.useStaticData)();
|
|
261
261
|
// 获取当前URL参数判断是否是在iframe内
|
|
262
262
|
const isInsideIframe = useIsInsideIframe();
|
|
263
|
-
(0,
|
|
263
|
+
(0, ahooks_1.useUpdateEffect)(() => {
|
|
264
264
|
const iframe = document.querySelector('#preview-iframe');
|
|
265
265
|
if (iframe && iframe.contentWindow) {
|
|
266
266
|
// 创建精简版数据,只包含必要信息,并避免循环引用
|
|
@@ -413,7 +413,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
413
413
|
description: '',
|
|
414
414
|
};
|
|
415
415
|
};
|
|
416
|
-
let mergedPropertiesValues = (0,
|
|
416
|
+
let mergedPropertiesValues = (0, use_deep_compare_memo_1.useDeepCompareMemo)(() => {
|
|
417
417
|
return Object.fromEntries(Object.values(state.metadata.properties ?? {}).map(({ data }) => {
|
|
418
418
|
return [
|
|
419
419
|
data.id,
|
|
@@ -426,7 +426,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
426
426
|
},
|
|
427
427
|
];
|
|
428
428
|
}));
|
|
429
|
-
}, [
|
|
429
|
+
}, [state.metadata.properties, state.propertiesValue]);
|
|
430
430
|
// 添加防抖函数,延迟渲染
|
|
431
431
|
const { run: triggerRerender } = (0, ahooks_1.useDebounceFn)(() => {
|
|
432
432
|
// 发送消息到 iframe
|
|
@@ -459,9 +459,9 @@ function Layout({ loadState, loadedData }) {
|
|
|
459
459
|
}
|
|
460
460
|
}, { wait: 50 });
|
|
461
461
|
// 当属性变化时触发重新渲染
|
|
462
|
-
(0,
|
|
462
|
+
(0, ahooks_1.useDeepCompareEffect)(() => {
|
|
463
463
|
triggerRerender();
|
|
464
|
-
}, [
|
|
464
|
+
}, [mergedPropertiesValues, mergedAllBlocks, state.metadata.id, locale]);
|
|
465
465
|
const DraggingSplitPlaceholder = (0, react_1.useMemo)(() => {
|
|
466
466
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
467
467
|
p: 1.5,
|
|
@@ -666,7 +666,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
666
666
|
handleDeleteBlock,
|
|
667
667
|
]);
|
|
668
668
|
// 修改 middlePanelContent - iframe 内部监听消息
|
|
669
|
-
const middlePanelContent = (0,
|
|
669
|
+
const middlePanelContent = (0, use_deep_compare_memo_1.useDeepCompareMemo)(() => {
|
|
670
670
|
// 如果在iframe内部,添加消息接收逻辑
|
|
671
671
|
if (isInsideIframe) {
|
|
672
672
|
if (loadState.type === '404' || loadState.type === 'loading') {
|
|
@@ -859,12 +859,12 @@ function Layout({ loadState, loadedData }) {
|
|
|
859
859
|
locale,
|
|
860
860
|
mode,
|
|
861
861
|
theme,
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
862
|
+
state.metadata || {},
|
|
863
|
+
mergedAllBlocks || [],
|
|
864
|
+
mergedPropertiesValues || {},
|
|
865
865
|
handleDeleteBlock,
|
|
866
866
|
]);
|
|
867
|
-
const rightPanelContent = (0,
|
|
867
|
+
const rightPanelContent = (0, use_deep_compare_memo_1.useDeepCompareMemo)(() => {
|
|
868
868
|
if (state.draggingSplitPane) {
|
|
869
869
|
return DraggingSplitPlaceholder;
|
|
870
870
|
}
|
|
@@ -1028,11 +1028,11 @@ function Layout({ loadState, loadedData }) {
|
|
|
1028
1028
|
};
|
|
1029
1029
|
} }) }) }))] }));
|
|
1030
1030
|
}, [
|
|
1031
|
-
|
|
1031
|
+
state.metadata || {},
|
|
1032
1032
|
locale,
|
|
1033
1033
|
defaultLocale,
|
|
1034
|
-
|
|
1035
|
-
|
|
1034
|
+
mergedAllBlocks || [],
|
|
1035
|
+
mergedPropertiesValues || {},
|
|
1036
1036
|
getStaticData,
|
|
1037
1037
|
state.draggingSplitPane,
|
|
1038
1038
|
mode,
|