pb-sxp-ui 1.20.15 → 1.20.16

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.js CHANGED
@@ -1979,15 +1979,27 @@ const RESOLVER$3 = {};
1979
1979
  try {
1980
1980
  // 尝试动态导入材料库
1981
1981
  const materialsModule = require('../../materials/sxp');
1982
- Object.values(materialsModule).forEach((v) => {
1983
- var _a;
1984
- if ((_a = v === null || v === void 0 ? void 0 : v.extend) === null || _a === void 0 ? void 0 : _a.type) {
1985
- RESOLVER$3[v.extend.type] = v;
1982
+ if (materialsModule && typeof materialsModule === 'object') {
1983
+ Object.values(materialsModule).forEach((v) => {
1984
+ var _a;
1985
+ if ((_a = v === null || v === void 0 ? void 0 : v.extend) === null || _a === void 0 ? void 0 : _a.type) {
1986
+ RESOLVER$3[v.extend.type] = v;
1987
+ }
1988
+ });
1989
+ // 调试信息:记录成功加载的组件数量
1990
+ if (Object.keys(RESOLVER$3).length > 0) {
1991
+ console.log('[StructurePage] Successfully loaded materials:', Object.keys(RESOLVER$3));
1986
1992
  }
1987
- });
1993
+ else {
1994
+ console.warn('[StructurePage] Materials module loaded but no valid components found');
1995
+ }
1996
+ }
1997
+ else {
1998
+ console.warn('[StructurePage] Materials module is not a valid object:', materialsModule);
1999
+ }
1988
2000
  }
1989
2001
  catch (error) {
1990
- console.warn('Failed to load materials for StructurePage:', error);
2002
+ console.error('[StructurePage] Failed to load materials for StructurePage:', error);
1991
2003
  }
1992
2004
  // 基础样式定义
1993
2005
  const baseStyles = {
@@ -2448,11 +2460,18 @@ const StructurePage = (_a) => {
2448
2460
  if (editorMode && templateType && RESOLVER$3[templateType]) {
2449
2461
  const TemplateComponent = RESOLVER$3[templateType];
2450
2462
  const templateExtend = TemplateComponent === null || TemplateComponent === void 0 ? void 0 : TemplateComponent.extend;
2451
- if (templateExtend) {
2452
- // 准备模版组件的 props
2453
- 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);
2454
- // 渲染模版组件
2455
- return React.createElement(TemplateComponent, templateProps);
2463
+ // 严格检查组件是否有效
2464
+ if (templateExtend && typeof TemplateComponent === 'function') {
2465
+ try {
2466
+ // 准备模版组件的 props
2467
+ 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);
2468
+ // 渲染模版组件
2469
+ return React.createElement(TemplateComponent, templateProps);
2470
+ }
2471
+ catch (error) {
2472
+ console.error(`[StructurePage] Failed to render template component ${templateType}:`, error);
2473
+ // 降级到默认按钮
2474
+ }
2456
2475
  }
2457
2476
  }
2458
2477
  // 默认渲染按钮