pb-sxp-ui 1.20.15 → 1.20.17

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/dist/index.cjs CHANGED
@@ -2001,15 +2001,27 @@ const RESOLVER$3 = {};
2001
2001
  try {
2002
2002
  // 尝试动态导入材料库
2003
2003
  const materialsModule = require('../../materials/sxp');
2004
- Object.values(materialsModule).forEach((v) => {
2005
- var _a;
2006
- if ((_a = v === null || v === void 0 ? void 0 : v.extend) === null || _a === void 0 ? void 0 : _a.type) {
2007
- RESOLVER$3[v.extend.type] = v;
2004
+ if (materialsModule && typeof materialsModule === 'object') {
2005
+ Object.values(materialsModule).forEach((v) => {
2006
+ var _a;
2007
+ if ((_a = v === null || v === void 0 ? void 0 : v.extend) === null || _a === void 0 ? void 0 : _a.type) {
2008
+ RESOLVER$3[v.extend.type] = v;
2009
+ }
2010
+ });
2011
+ // 调试信息:记录成功加载的组件数量
2012
+ if (Object.keys(RESOLVER$3).length > 0) {
2013
+ console.log('[StructurePage] Successfully loaded materials:', Object.keys(RESOLVER$3));
2008
2014
  }
2009
- });
2015
+ else {
2016
+ console.warn('[StructurePage] Materials module loaded but no valid components found');
2017
+ }
2018
+ }
2019
+ else {
2020
+ console.warn('[StructurePage] Materials module is not a valid object:', materialsModule);
2021
+ }
2010
2022
  }
2011
2023
  catch (error) {
2012
- console.warn('Failed to load materials for StructurePage:', error);
2024
+ console.error('[StructurePage] Failed to load materials for StructurePage:', error);
2013
2025
  }
2014
2026
  // 基础样式定义
2015
2027
  const baseStyles = {
@@ -2470,11 +2482,18 @@ const StructurePage = (_a) => {
2470
2482
  if (editorMode && templateType && RESOLVER$3[templateType]) {
2471
2483
  const TemplateComponent = RESOLVER$3[templateType];
2472
2484
  const templateExtend = TemplateComponent === null || TemplateComponent === void 0 ? void 0 : TemplateComponent.extend;
2473
- if (templateExtend) {
2474
- // 准备模版组件的 props
2475
- const templateProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = templateExtend.defaulSetting) === null || _a === void 0 ? void 0 : _a.props), { style: Object.assign(Object.assign(Object.assign({}, (_b = templateExtend.defaulSetting) === null || _b === void 0 ? void 0 : _b.style), mergeStyles(fallbackStyle || {}, buttonKey)), { marginBottom: 0, width: '100%' }), textStyle: (_c = templateExtend.defaulSetting) === null || _c === void 0 ? void 0 : _c.textStyle }), (productData && { bindProduct: productData })), { isTel: true }), rest);
2476
- // 渲染模版组件
2477
- return React.createElement(TemplateComponent, templateProps);
2485
+ // 严格检查组件是否有效
2486
+ if (templateExtend && typeof TemplateComponent === 'function') {
2487
+ try {
2488
+ // 准备模版组件的 props
2489
+ const templateProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = templateExtend.defaulSetting) === null || _a === void 0 ? void 0 : _a.props), { style: Object.assign(Object.assign(Object.assign({}, (_b = templateExtend.defaulSetting) === null || _b === void 0 ? void 0 : _b.style), mergeStyles(fallbackStyle || {}, buttonKey)), { marginBottom: 0, width: '100%' }), textStyle: (_c = templateExtend.defaulSetting) === null || _c === void 0 ? void 0 : _c.textStyle }), (productData && { bindProduct: productData })), { isTel: true }), rest);
2490
+ // 渲染模版组件
2491
+ return React.createElement(TemplateComponent, templateProps);
2492
+ }
2493
+ catch (error) {
2494
+ console.error(`[StructurePage] Failed to render template component ${templateType}:`, error);
2495
+ // 降级到默认按钮
2496
+ }
2478
2497
  }
2479
2498
  }
2480
2499
  // 默认渲染按钮