@steedos-widgets/antd 6.10.52-beta.3 → 6.10.52-beta.5

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
@@ -360,9 +360,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
360
360
  var _c = __read(React.useState(''), 2),
361
361
  html = _c[0],
362
362
  setHtml = _c[1];
363
- var _d = __read(React.useState({}), 2),
364
- mountNodes = _d[0],
365
- setMountNodes = _d[1];
363
+ var _d = __read(React.useState([]), 2),
364
+ parsedTemplates = _d[0],
365
+ setParsedTemplates = _d[1];
366
+ var _e = __read(React.useState({}), 2),
367
+ mountNodes = _e[0],
368
+ setMountNodes = _e[1];
366
369
  var containerRef = React.useRef(null);
367
370
  // 用于存储脚本清理函数的引用,以便在组件卸载或更新时清理副作用
368
371
  var scriptCleanupsRef = React.useRef([]);
@@ -414,6 +417,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
414
417
  parse: function parse(tagToken, remainTokens) {
415
418
  var _this = this;
416
419
  this.templates = [];
420
+ this.id = generateId();
417
421
  var stream = liq.parser.parseStream(remainTokens);
418
422
  stream.on('tag:endamis', function () {
419
423
  return stream.stop();
@@ -437,7 +441,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
437
441
  }
438
442
  try {
439
443
  schema = looseJsonParse(rawStr);
440
- id = generateId();
444
+ id = this.id;
441
445
  register = ctx.get(['__registerInlineSchema']);
442
446
  if (!register && ctx.environments) {
443
447
  register = ctx.environments['__registerInlineSchema'];
@@ -460,8 +464,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
460
464
  }, []);
461
465
  var dataFingerprint = JSON.stringify(data);
462
466
  var partialsFingerprint = JSON.stringify(finalPartials);
467
+ React.useEffect(function () {
468
+ var isMounted = true;
469
+ try {
470
+ var tpl_1 = engine.parse(template);
471
+ if (isMounted) {
472
+ setParsedTemplates(tpl_1);
473
+ }
474
+ } catch (e) {
475
+ console.error("Liquid Parse Error:", e);
476
+ }
477
+ return function () {
478
+ isMounted = false;
479
+ };
480
+ }, [engine, template]);
463
481
  // 2. Liquid 渲染 HTML
464
482
  React.useEffect(function () {
483
+ if (!parsedTemplates) return;
465
484
  var isMounted = true;
466
485
  inlineSchemasRef.current = {};
467
486
  var contextData = _assign(_assign({}, flattenObjectChain(data)), {
@@ -469,19 +488,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
469
488
  inlineSchemasRef.current[id] = schema;
470
489
  }
471
490
  });
472
- engine.parseAndRender(template, contextData).then(function (result) {
491
+ engine.render(parsedTemplates, contextData).then(function (result) {
473
492
  if (isMounted) {
474
493
  setHtml(function (prev) {
475
494
  return prev !== result ? result : prev;
476
495
  });
477
496
  }
478
497
  })["catch"](function (err) {
498
+ console.log("render error: ", template, contextData);
479
499
  if (isMounted) console.error("Liquid Render Error:", err);
480
500
  });
481
501
  return function () {
482
502
  isMounted = false;
483
503
  };
484
- }, [engine, template, dataFingerprint, partialsFingerprint]);
504
+ }, [engine, parsedTemplates, dataFingerprint, partialsFingerprint]);
485
505
  // 3. Portals 挂载检测
486
506
  React.useEffect(function () {
487
507
  if (!containerRef.current) return;
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.52-beta.3/dist/antd.umd.js",
35
- "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.3/dist/antd.umd.css"
34
+ "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.5/dist/antd.umd.js",
35
+ "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.5/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.52-beta.3/dist/meta.js",
46
+ "url": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.5/dist/meta.js",
47
47
  "urls": {
48
- "default": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.3/dist/meta.js",
49
- "design": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.3/dist/meta.js"
48
+ "default": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.5/dist/meta.js",
49
+ "design": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.5/dist/meta.js"
50
50
  }
51
51
  }
52
52
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@steedos-widgets/antd",
3
3
  "private": false,
4
- "version": "6.10.52-beta.3",
4
+ "version": "6.10.52-beta.5",
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": "47fe298cc8f512c9181a93f94ecd8ca6ba41fd9f",
50
+ "gitHead": "116a8006080ed1c4eb6e79f3e59c19a4cb20d7cf",
51
51
  "dependencies": {
52
52
  "liquidjs": "^10.24.0"
53
53
  }