@blocklet/pages-kit-block-studio 0.5.30 → 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.
@@ -1,4 +1,5 @@
1
1
  // 导入 Zod 工具集
2
+ import { getPageAllSections } from '@blocklet/pages-kit/utils/page-model';
2
3
  import { getComponentDependencies } from '@blocklet/pages-kit/utils/property';
3
4
  import { z } from 'zod';
4
5
  import { BASIC_COMPONENT_SECTION_TYPES, BASIC_COMPONENT_SECTION_JSON_SCHEMAS } from './block-props-utils';
@@ -306,8 +307,7 @@ export function generatePageDataJsonSchemasWithZod(state) {
306
307
  .replace(/[^a-zA-Z0-9]/g, '')}Data`;
307
308
  // 收集所有 section 的配置信息
308
309
  const sectionProperties = {};
309
- page.sectionIds.forEach((sectionId) => {
310
- const section = page.sections[sectionId];
310
+ getPageAllSections(page)?.forEach((section) => {
311
311
  if (!section)
312
312
  return;
313
313
  const sectionName = section.name || section.id;
@@ -392,9 +392,8 @@ export function generatePageDataTypesWithZod(state) {
392
392
  .join('')
393
393
  .replace(/[^a-zA-Z0-9]/g, '')}Data`;
394
394
  // 收集所有 section 的配置信息
395
- const sectionTypes = page.sectionIds
396
- .map((sectionId) => {
397
- const section = page.sections[sectionId];
395
+ const sectionTypes = getPageAllSections(page)
396
+ ?.map((section) => {
398
397
  if (!section)
399
398
  return null;
400
399
  // 嵌套组件
@@ -469,8 +468,7 @@ export function generatePageDataZodToAgent(state, pageId) {
469
468
  }
470
469
  const sectionSchemas = {};
471
470
  // 收集页面所有section的配置信息
472
- page.sectionIds.forEach((sectionId) => {
473
- const section = page.sections[sectionId];
471
+ getPageAllSections(page)?.forEach((section) => {
474
472
  if (!section)
475
473
  return;
476
474
  const sectionName = section.name || section.id;