@mybricks/to-code-taro 1.1.6 → 1.1.7

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.
@@ -312,6 +312,13 @@ function getFrameInputValueExpr(meta, config, event) {
312
312
  var pinProxy = scene === null || scene === void 0 || (_pinValueProxies = scene.pinValueProxies) === null || _pinValueProxies === void 0 ? void 0 : _pinValueProxies[proxyKey];
313
313
  var pinId = pinProxy === null || pinProxy === void 0 ? void 0 : pinProxy.pinId;
314
314
  if (typeof pinId === "string" && pinId) {
315
+ var _config$getParams;
316
+ // 优先使用 getParams 映射(场景级输入:回调参数名如 data)
317
+ var paramsMap = (_config$getParams = config.getParams) === null || _config$getParams === void 0 ? void 0 : _config$getParams.call(config);
318
+ if (paramsMap !== null && paramsMap !== void 0 && paramsMap[pinId]) {
319
+ return paramsMap[pinId];
320
+ }
321
+ // fallback:插槽场景使用 params.inputValues
315
322
  return "params?.inputValues?.[".concat(JSON.stringify(pinId), "]");
316
323
  }
317
324
  }
@@ -54,7 +54,7 @@ export var getUiComponentCode = function getUiComponentCode(params, config) {
54
54
  var ui = "".concat(indent, "<WithCom");
55
55
  ui += "\n".concat(indent2, "component={").concat(componentName, "}");
56
56
  ui += "\n".concat(indent2, "id='").concat(meta.id, "'");
57
- ui += "\n".concat(indent2, "className='").concat(meta.id, " mybricks_com'");
57
+ ui += "\n".concat(indent2, "className='mybricks_com ").concat(meta.id, "'");
58
58
  if (meta.name) {
59
59
  ui += "\n".concat(indent2, "name='").concat(meta.name, "'");
60
60
  }
@@ -114,11 +114,9 @@ export var RenderManager = /*#__PURE__*/function () {
114
114
  // 如果是容器协议插槽,直接调用 wrap
115
115
  code += "".concat(indent).concat(indent3, "params?.wrap?.(descriptors)\n");
116
116
  } else {
117
- code += "".concat(indent).concat(indent3, "<>\n");
118
117
  code += modifiedRenderCode.split("\n").map(function (line) {
119
118
  return "".concat(indent).concat(indent2).concat(line);
120
119
  }).join("\n") + "\n";
121
- code += "".concat(indent).concat(indent3, "</>\n");
122
120
  }
123
121
  code += "".concat(indent).concat(indent2, ");\n");
124
122
  code += "".concat(indent, "}\n\n");
@@ -48,9 +48,9 @@ export var genComponentTemplate = function genComponentTemplate(_ref) {
48
48
  var pageScopeCode = "const PageScopeContext = createContext<any>(null);\n" + "function usePageScope<T = any>() {\n" + " return useContext(PageScopeContext) as T;\n" + "}\n\n";
49
49
 
50
50
  // 渲染定义放在组件外部,保持引用稳定
51
- var code = "".concat(pageScopeCode).concat(renderDefinitions, "\n") + "function ".concat(componentName, "() {\n") + " // \u9875\u9762\u7EA7 scope\uFF1A\u4F60\u53EF\u4EE5\u628A useState/useMemo \u7684\u7ED3\u679C\u653E\u5230\u8FD9\u4E2A ref \u4E0A\uFF0C\u8BA9\u63D2\u69FD\u8BFB\u53D6\n" + " const pageScopeRef = useRef<any>({});\n" + "".concat(combinedJsCode, "\n") + " return (\n" + " <PageScopeContext.Provider value={pageScopeRef}>\n" + " <>\n" + "".concat(uiResult.split('\n').map(function (line) {
51
+ var code = "".concat(pageScopeCode).concat(renderDefinitions, "\n") + "function ".concat(componentName, "() {\n") + " // \u9875\u9762\u7EA7 scope\uFF1A\u4F60\u53EF\u4EE5\u628A useState/useMemo \u7684\u7ED3\u679C\u653E\u5230\u8FD9\u4E2A ref \u4E0A\uFF0C\u8BA9\u63D2\u69FD\u8BFB\u53D6\n" + " const pageScopeRef = useRef<any>({});\n" + "".concat(combinedJsCode, "\n") + " return (\n" + " <PageScopeContext.Provider value={pageScopeRef}>\n" + (hasPopups ? " <>\n" : "") + "".concat(uiResult.split('\n').map(function (line) {
52
52
  return " ".concat(line);
53
- }).join('\n'), "\n") + (hasPopups ? " <PopupRenderer popupMap={POPUP_MAP} />\n" : "") + " </>\n" + " </PageScopeContext.Provider>\n" + " );\n" + "}\n\n";
53
+ }).join('\n'), "\n") + (hasPopups ? " <PopupRenderer popupMap={POPUP_MAP} />\n" : "") + (hasPopups ? " </>\n" : "") + " </PageScopeContext.Provider>\n" + " );\n" + "}\n\n";
54
54
  if (isPopup) {
55
55
  code += "(".concat(componentName, " as any).isPopup = true;\n\n");
56
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mybricks/to-code-taro",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "To code for Taro",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",