@steedos-widgets/antd 6.10.48 → 6.10.51-beta.2

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/antd.umd.js CHANGED
@@ -304,25 +304,65 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
304
304
  }
305
305
  }
306
306
  };
307
+ function extractObjectChain(value) {
308
+ var result = value ? [value] : [];
309
+ var visited = new Set(); // 用于存储已遍历的对象引用
310
+ if (value) visited.add(value);
311
+ var current = value;
312
+ while (current === null || current === void 0 ? void 0 : current.__super) {
313
+ var next = current.__super;
314
+ // 检查是否已经访问过该对象
315
+ if (visited.has(next)) {
316
+ console.warn("检测到循环引用,已自动截断链条", next);
317
+ break;
318
+ }
319
+ result.unshift(next);
320
+ visited.add(next);
321
+ current = next;
322
+ }
323
+ return result;
324
+ }
325
+ /**
326
+ * 安全地将链条属性合并到顶层
327
+ */
328
+ function flattenObjectChain(obj) {
329
+ if (!obj) return {};
330
+ // 1. 调用上方带 Set 检查的提取函数
331
+ var chain = extractObjectChain(obj);
332
+ // 2. 扁平化合并
333
+ // 遵循“就近原则”:数组后面的对象属性覆盖前面的
334
+ var flattened = chain.reduce(function (acc, current) {
335
+ // 建议:如果不需要合并原型链上的属性,仅合并自身属性
336
+ // 使用 Object.assign 仅拷贝可枚举的自有属性
337
+ return Object.assign(acc, current);
338
+ }, {});
339
+ // 3. 清理标记位,避免干扰结果
340
+ delete flattened.__super;
341
+ return flattened;
342
+ }
307
343
  // --- 组件实现 ---
308
344
  var LiquidComponent = function LiquidComponent(_a) {
345
+ var _b;
309
346
  var template = _a.template,
310
347
  tpl = _a.tpl,
311
348
  data = _a.data,
312
349
  className = _a.className,
313
350
  $schema = _a.$schema,
314
351
  amisRender = _a.render,
352
+ dispatchEvent = _a.dispatchEvent,
315
353
  propsPartials = _a.partials;
354
+ __rest(_a, ["template", "tpl", "data", "className", "$schema", "render", "dispatchEvent", "partials"]);
355
+ var doAction = (_b = data._scoped) === null || _b === void 0 ? void 0 : _b.doAction;
316
356
  // 支持 tpl 作为 template 的别名
317
357
  if (tpl && !template) {
318
358
  template = tpl;
319
359
  }
320
- var _b = __read(React.useState(''), 2),
321
- html = _b[0],
322
- setHtml = _b[1];
323
- var _c = __read(React.useState({}), 2),
324
- mountNodes = _c[0],
325
- setMountNodes = _c[1];
360
+ var _c = __read(React.useState(''), 2),
361
+ html = _c[0],
362
+ setHtml = _c[1];
363
+ var _d = __read(React.useState({}), 2),
364
+ mountNodes = _d[0],
365
+ setMountNodes = _d[1];
326
366
  var containerRef = React.useRef(null);
327
367
  // 用于存储脚本清理函数的引用,以便在组件卸载或更新时清理副作用
328
368
  var scriptCleanupsRef = React.useRef([]);
@@ -424,7 +464,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
424
464
  React.useEffect(function () {
425
465
  var isMounted = true;
426
466
  inlineSchemasRef.current = {};
427
- var contextData = _assign(_assign({}, data), {
467
+ var contextData = _assign(_assign({}, flattenObjectChain(data)), {
428
468
  __registerInlineSchema: function __registerInlineSchema(id, schema) {
429
469
  inlineSchemasRef.current[id] = schema;
430
470
  }
@@ -554,8 +594,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
554
594
  try {
555
595
  var debugName = "steedos-liquid-".concat(Math.random().toString(36).slice(2), ".js");
556
596
  var debuggableCode = code + "\n//# sourceURL=".concat(debugName);
557
- var func = new Function('data', 'dom', debuggableCode);
558
- var cleanupResult = func(data, scriptNode.parentElement);
597
+ var func = new Function('data', 'dom', 'doAction', 'dispatchEvent', debuggableCode);
598
+ var cleanupResult = func(data, scriptNode.parentElement, doAction, dispatchEvent);
559
599
  if (typeof cleanupResult === 'function') {
560
600
  scriptCleanupsRef.current.push(cleanupResult);
561
601
  }
package/dist/assets.json CHANGED
@@ -31,8 +31,8 @@
31
31
  {
32
32
  "package": "@steedos-widgets/antd",
33
33
  "urls": [
34
- "https://unpkg.com/@steedos-widgets/antd@6.10.48/dist/antd.umd.js",
35
- "https://unpkg.com/@steedos-widgets/antd@6.10.48/dist/antd.umd.css"
34
+ "https://unpkg.com/@steedos-widgets/antd@6.10.51-beta.2/dist/antd.umd.js",
35
+ "https://unpkg.com/@steedos-widgets/antd@6.10.51-beta.2/dist/antd.umd.css"
36
36
  ],
37
37
  "library": "BuilderAntd"
38
38
  }
@@ -43,10 +43,10 @@
43
43
  "npm": {
44
44
  "package": "@steedos-widgets/antd"
45
45
  },
46
- "url": "https://unpkg.com/@steedos-widgets/antd@6.10.48/dist/meta.js",
46
+ "url": "https://unpkg.com/@steedos-widgets/antd@6.10.51-beta.2/dist/meta.js",
47
47
  "urls": {
48
- "default": "https://unpkg.com/@steedos-widgets/antd@6.10.48/dist/meta.js",
49
- "design": "https://unpkg.com/@steedos-widgets/antd@6.10.48/dist/meta.js"
48
+ "default": "https://unpkg.com/@steedos-widgets/antd@6.10.51-beta.2/dist/meta.js",
49
+ "design": "https://unpkg.com/@steedos-widgets/antd@6.10.51-beta.2/dist/meta.js"
50
50
  }
51
51
  }
52
52
  ]
@@ -7,6 +7,7 @@ interface LiquidTemplateProps {
7
7
  $schema?: Record<string, string | object>;
8
8
  partials?: Record<string, string | object>;
9
9
  className?: string;
10
+ dispatchEvent: any;
10
11
  render: (region: string, schema: SchemaObject, props?: any) => React.ReactNode;
11
12
  }
12
13
  export declare const LiquidComponent: React.FC<LiquidTemplateProps>;
@@ -7,6 +7,7 @@ interface LiquidTemplateProps {
7
7
  $schema?: Record<string, string | object>;
8
8
  partials?: Record<string, string | object>;
9
9
  className?: string;
10
+ dispatchEvent: any;
10
11
  render: (region: string, schema: SchemaObject, props?: any) => React.ReactNode;
11
12
  }
12
13
  export declare const LiquidComponent: React.FC<LiquidTemplateProps>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@steedos-widgets/antd",
3
3
  "private": false,
4
- "version": "6.10.48",
4
+ "version": "6.10.51-beta.2",
5
5
  "main": "dist/antd.cjs.js",
6
6
  "module": "dist/antd.esm.js",
7
7
  "unpkg": "dist/antd.umd.js",
@@ -47,7 +47,7 @@
47
47
  "rollup-plugin-tslib-resolve-id": "^0.0.0",
48
48
  "rollup-plugin-visualizer": "^5.8.0"
49
49
  },
50
- "gitHead": "aa2766f89c4316272e87f25f405a570fe019fbb3",
50
+ "gitHead": "bb1e8cf00f6fa06a8bf91f38ad88bcb21e0605fb",
51
51
  "dependencies": {
52
52
  "liquidjs": "^10.24.0"
53
53
  }