@blocklet/pages-kit 0.4.106 → 0.4.108
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.
- package/lib/cjs/components/CustomComponentRenderer/index.js +8 -4
- package/lib/cjs/components/CustomComponentRenderer/state.js +9 -3
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/property.js +7 -7
- package/lib/esm/components/CustomComponentRenderer/index.js +8 -4
- package/lib/esm/components/CustomComponentRenderer/state.js +9 -3
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/property.js +7 -4
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -65,10 +65,14 @@ function ComponentRenderer({ renderCount = 0, blockletId, blockletTitle, compone
|
|
|
65
65
|
}
|
|
66
66
|
function Renderer({ renderCount, Component, locale, props, }) {
|
|
67
67
|
const componentProps = Object.fromEntries(Object.entries(props).map(([key, val]) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
// if is NestedComponent, render it
|
|
69
|
+
if (val?.type === property_1.RenderNestedComponent) {
|
|
70
|
+
return [
|
|
71
|
+
key,
|
|
72
|
+
(0, jsx_runtime_1.jsx)(ComponentRenderer, { locale: locale, renderCount: renderCount, componentId: val.componentId, properties: val.properties }),
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
return [key, val];
|
|
72
76
|
}));
|
|
73
77
|
return (0, jsx_runtime_1.jsx)(Component, { locale: locale, ...componentProps });
|
|
74
78
|
}
|
|
@@ -108,7 +108,10 @@ function importCustomComponent(m, { componentId }) {
|
|
|
108
108
|
}
|
|
109
109
|
return null;
|
|
110
110
|
}, [loading, error, ResolvedComponent, props]);
|
|
111
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Fade, { in: !loading, timeout: 500, children: (0, jsx_runtime_1.jsx)(material_1.Box, { className: "CustomComponent-root",
|
|
111
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Fade, { in: !loading, timeout: 500, children: (0, jsx_runtime_1.jsx)(material_1.Box, { className: "CustomComponent-root", sx: {
|
|
112
|
+
// 使用 display: contents 避免外层包裹的 div 样式影响组件内部样式
|
|
113
|
+
display: 'contents',
|
|
114
|
+
}, children: content }) }));
|
|
112
115
|
};
|
|
113
116
|
}
|
|
114
117
|
// non-Promise case
|
|
@@ -281,8 +284,11 @@ function useComponent({ instanceId, componentId, properties, locale, dev }) {
|
|
|
281
284
|
const property = componentProperties?.[key]?.data;
|
|
282
285
|
if (!property)
|
|
283
286
|
return undefined;
|
|
287
|
+
// 如果提供了 key 优先使用 key
|
|
288
|
+
const propKey = property.key ?? property.id;
|
|
289
|
+
const propValue = value;
|
|
284
290
|
// keep preload props
|
|
285
|
-
let v = (0, property_1.parsePropertyValue)(property,
|
|
291
|
+
let v = (0, property_1.parsePropertyValue)(property, propValue, {
|
|
286
292
|
locale,
|
|
287
293
|
defaultLocale: dev?.defaultLocale,
|
|
288
294
|
});
|
|
@@ -296,7 +302,7 @@ function useComponent({ instanceId, componentId, properties, locale, dev }) {
|
|
|
296
302
|
};
|
|
297
303
|
}
|
|
298
304
|
// if key is undefined, use id
|
|
299
|
-
return [
|
|
305
|
+
return [propKey, v];
|
|
300
306
|
})
|
|
301
307
|
.filter((i) => !!i)),
|
|
302
308
|
},
|