@blocklet/pages-kit-runtime 0.5.30 → 0.5.32

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/client.js CHANGED
@@ -68,67 +68,6 @@ function convertPageData(state, page, locale) {
68
68
  description: pageLocaleData.description,
69
69
  sectionsData: {},
70
70
  };
71
- // 处理每个 section 的数据
72
- page.sectionIds.forEach((sectionId) => {
73
- const section = page.sections[sectionId];
74
- if (!section)
75
- return;
76
- // 获取 section 在指定语言下的配置,如果不存在则使用默认语言的配置
77
- const sectionConfig = section.config || {};
78
- const sectionData = section.locales?.[locale] || section.locales?.[defaultLocale];
79
- const sectionName = section.name || section.id;
80
- if (section.component === 'custom-component') {
81
- // 处理自定义组件
82
- const componentId = sectionConfig?.componentId || section.config?.componentId;
83
- const component = state.components[componentId]?.data || state.resources?.components?.[componentId]?.component;
84
- if (component) {
85
- result.sectionsData[sectionName] = {};
86
- // 遍历组件的属性定义
87
- Object.entries(component.properties || {}).forEach(([, prop]) => {
88
- const key = prop.data?.key || prop.data?.id;
89
- if (key) {
90
- result.sectionsData[sectionName][key] = sectionData?.properties?.[prop.data?.id]?.value;
91
- }
92
- });
93
- }
94
- }
95
- else if (section.component === 'iframe') {
96
- // 处理 iframe 组件
97
- result.sectionsData[sectionName] = {
98
- src: sectionData?.src,
99
- title: sectionData?.title,
100
- description: sectionData?.description,
101
- };
102
- }
103
- else if (section.component === 'section') {
104
- // 处理普通 section 组件
105
- result.sectionsData[sectionName] = {
106
- title: sectionData?.title,
107
- description: sectionData?.description,
108
- image: sectionData?.image,
109
- imageMeta: sectionData?.imageMeta,
110
- };
111
- }
112
- else if (section.component === 'section-card-list') {
113
- // 处理卡片列表组件
114
- result.sectionsData[sectionName] = {
115
- title: sectionData?.title,
116
- description: sectionData?.description,
117
- list: sectionData?.list || [],
118
- };
119
- }
120
- else if (section.component === 'toc') {
121
- // 处理目录组件
122
- result.sectionsData[sectionName] = {
123
- title: sectionData?.title,
124
- description: sectionData?.description,
125
- };
126
- }
127
- else {
128
- // 处理其他类型的组件
129
- result.sectionsData[sectionName] = sectionData;
130
- }
131
- });
132
71
  return result;
133
72
  }
134
73
  const RuntimeComponent = (props) => {