@blocklet/pages-kit-runtime 0.5.29 → 0.5.31

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/esm/client.js CHANGED
@@ -29,67 +29,6 @@ function convertPageData(state, page, locale) {
29
29
  description: pageLocaleData.description,
30
30
  sectionsData: {},
31
31
  };
32
- // 处理每个 section 的数据
33
- page.sectionIds.forEach((sectionId) => {
34
- const section = page.sections[sectionId];
35
- if (!section)
36
- return;
37
- // 获取 section 在指定语言下的配置,如果不存在则使用默认语言的配置
38
- const sectionConfig = section.config || {};
39
- const sectionData = section.locales?.[locale] || section.locales?.[defaultLocale];
40
- const sectionName = section.name || section.id;
41
- if (section.component === 'custom-component') {
42
- // 处理自定义组件
43
- const componentId = sectionConfig?.componentId || section.config?.componentId;
44
- const component = state.components[componentId]?.data || state.resources?.components?.[componentId]?.component;
45
- if (component) {
46
- result.sectionsData[sectionName] = {};
47
- // 遍历组件的属性定义
48
- Object.entries(component.properties || {}).forEach(([, prop]) => {
49
- const key = prop.data?.key || prop.data?.id;
50
- if (key) {
51
- result.sectionsData[sectionName][key] = sectionData?.properties?.[prop.data?.id]?.value;
52
- }
53
- });
54
- }
55
- }
56
- else if (section.component === 'iframe') {
57
- // 处理 iframe 组件
58
- result.sectionsData[sectionName] = {
59
- src: sectionData?.src,
60
- title: sectionData?.title,
61
- description: sectionData?.description,
62
- };
63
- }
64
- else if (section.component === 'section') {
65
- // 处理普通 section 组件
66
- result.sectionsData[sectionName] = {
67
- title: sectionData?.title,
68
- description: sectionData?.description,
69
- image: sectionData?.image,
70
- imageMeta: sectionData?.imageMeta,
71
- };
72
- }
73
- else if (section.component === 'section-card-list') {
74
- // 处理卡片列表组件
75
- result.sectionsData[sectionName] = {
76
- title: sectionData?.title,
77
- description: sectionData?.description,
78
- list: sectionData?.list || [],
79
- };
80
- }
81
- else if (section.component === 'toc') {
82
- // 处理目录组件
83
- result.sectionsData[sectionName] = {
84
- title: sectionData?.title,
85
- description: sectionData?.description,
86
- };
87
- }
88
- else {
89
- // 处理其他类型的组件
90
- result.sectionsData[sectionName] = sectionData;
91
- }
92
- });
93
32
  return result;
94
33
  }
95
34
  export const RuntimeComponent = (props) => {