@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.
@@ -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
- return [
69
- key,
70
- val?.type === property_1.RenderNestedComponent ? ((0, jsx_runtime_1.jsx)(ComponentRenderer, { locale: locale, renderCount: renderCount, componentId: val.componentId, properties: val.properties, props: val.props })) : (val),
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", children: content }) }));
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, value, {
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 [property.key || property.id, v];
305
+ return [propKey, v];
300
306
  })
301
307
  .filter((i) => !!i)),
302
308
  },