@steedos-widgets/antd 6.10.45 → 6.10.46
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 +95 -41
- package/dist/assets-dev.json +7 -0
- package/dist/assets.json +12 -5
- package/dist/components/Liquid.d.ts +1 -0
- package/dist/types/components/Liquid.d.ts +1 -0
- package/package.json +2 -2
package/dist/antd.umd.js
CHANGED
|
@@ -307,11 +307,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
307
307
|
// --- 组件实现 ---
|
|
308
308
|
var LiquidComponent = function LiquidComponent(_a) {
|
|
309
309
|
var template = _a.template,
|
|
310
|
+
tpl = _a.tpl,
|
|
310
311
|
data = _a.data,
|
|
311
312
|
className = _a.className,
|
|
312
313
|
$schema = _a.$schema,
|
|
313
314
|
amisRender = _a.render,
|
|
314
315
|
propsPartials = _a.partials;
|
|
316
|
+
// 支持 tpl 作为 template 的别名
|
|
317
|
+
if (tpl && !template) {
|
|
318
|
+
template = tpl;
|
|
319
|
+
}
|
|
315
320
|
var _b = __read(React.useState(''), 2),
|
|
316
321
|
html = _b[0],
|
|
317
322
|
setHtml = _b[1];
|
|
@@ -468,62 +473,111 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
468
473
|
});
|
|
469
474
|
}, [mountNodes, partialsFingerprint, dataFingerprint, amisRender, data]);
|
|
470
475
|
// ==================================================================================
|
|
471
|
-
// 5.
|
|
476
|
+
// 5. 核心逻辑:顺序加载器 (等待外部脚本加载完再执行内联脚本)
|
|
472
477
|
// ==================================================================================
|
|
473
478
|
React.useEffect(function () {
|
|
474
479
|
if (!containerRef.current) return;
|
|
475
|
-
//
|
|
480
|
+
// 清理旧副作用
|
|
476
481
|
scriptCleanupsRef.current.forEach(function (cleanup) {
|
|
477
482
|
return cleanup && cleanup();
|
|
478
483
|
});
|
|
479
484
|
scriptCleanupsRef.current = [];
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
if (
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
var
|
|
503
|
-
//
|
|
504
|
-
|
|
505
|
-
|
|
485
|
+
var allScriptNodes = Array.from(containerRef.current.querySelectorAll('script'));
|
|
486
|
+
// 如果没有脚本,直接返回
|
|
487
|
+
if (allScriptNodes.length === 0) return;
|
|
488
|
+
// 1. 分类:找出需要加载的外部脚本 和 需要执行的内联脚本
|
|
489
|
+
var externalNodes = [];
|
|
490
|
+
var inlineNodes = [];
|
|
491
|
+
allScriptNodes.forEach(function (node) {
|
|
492
|
+
if (node.dataset.executed) return; // 跳过已处理的
|
|
493
|
+
if (node.src) {
|
|
494
|
+
externalNodes.push(node);
|
|
495
|
+
} else {
|
|
496
|
+
inlineNodes.push(node);
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
// 2. 定义加载外部脚本的函数(返回 Promise)
|
|
500
|
+
var loadExternalScript = function loadExternalScript(scriptNode) {
|
|
501
|
+
return new Promise(function (resolve) {
|
|
502
|
+
var src = scriptNode.getAttribute('src');
|
|
503
|
+
if (!src) {
|
|
504
|
+
resolve();
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
var newScriptUrl = new URL(src, window.location.href).href;
|
|
508
|
+
// --- 查重逻辑:检查全局是否已存在该脚本(排除自身) ---
|
|
509
|
+
var isGlobalLoaded = false;
|
|
510
|
+
var allDocScripts = document.getElementsByTagName('script');
|
|
511
|
+
for (var i = 0; i < allDocScripts.length; i++) {
|
|
512
|
+
var s = allDocScripts[i];
|
|
513
|
+
if (s.src === newScriptUrl && s !== scriptNode) {
|
|
514
|
+
isGlobalLoaded = true;
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
506
517
|
}
|
|
507
|
-
//
|
|
518
|
+
// 标记当前节点已处理,防止下次 render 重复
|
|
508
519
|
scriptNode.dataset.executed = "true";
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
520
|
+
if (isGlobalLoaded) {
|
|
521
|
+
console.log("[Liquid] Script already loaded: ".concat(src));
|
|
522
|
+
resolve(); // 已存在,直接视为成功
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
// --- 创建新脚本加载 ---
|
|
526
|
+
var newScript = document.createElement('script');
|
|
527
|
+
newScript.src = src;
|
|
528
|
+
newScript.async = false; // 尝试保持顺序,虽然动态插入通常默认 async
|
|
529
|
+
// 复制属性
|
|
530
|
+
Array.from(scriptNode.attributes).forEach(function (attr) {
|
|
531
|
+
if (attr.name !== 'src' && attr.name !== 'data-executed') {
|
|
532
|
+
newScript.setAttribute(attr.name, attr.value);
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
newScript.onload = function () {
|
|
536
|
+
console.log("[Liquid] Loaded: ".concat(src));
|
|
537
|
+
resolve();
|
|
538
|
+
};
|
|
539
|
+
newScript.onerror = function () {
|
|
540
|
+
console.error("[Liquid] Failed to load: ".concat(src));
|
|
541
|
+
// 即使失败也 resolve,避免阻塞后续内联脚本执行(或者你可以选择 reject 来阻断)
|
|
542
|
+
resolve();
|
|
543
|
+
};
|
|
544
|
+
document.body.appendChild(newScript);
|
|
545
|
+
});
|
|
546
|
+
};
|
|
547
|
+
// 3. 定义执行内联脚本的函数
|
|
548
|
+
var runInlineScripts = function runInlineScripts() {
|
|
549
|
+
inlineNodes.forEach(function (scriptNode) {
|
|
550
|
+
// 双重检查,防止重入
|
|
551
|
+
if (scriptNode.dataset.executed) return;
|
|
552
|
+
var code = scriptNode.innerHTML;
|
|
553
|
+
if (code) {
|
|
554
|
+
try {
|
|
555
|
+
var debugName = "steedos-liquid-".concat(Math.random().toString(36).slice(2), ".js");
|
|
556
|
+
var debuggableCode = code + "\n//# sourceURL=".concat(debugName);
|
|
557
|
+
var func = new Function('data', 'dom', debuggableCode);
|
|
558
|
+
var cleanupResult = func(data, scriptNode.parentElement);
|
|
559
|
+
if (typeof cleanupResult === 'function') {
|
|
560
|
+
scriptCleanupsRef.current.push(cleanupResult);
|
|
561
|
+
}
|
|
562
|
+
} catch (err) {
|
|
563
|
+
console.error("[Liquid] Inline Script Error:", err);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
scriptNode.dataset.executed = "true";
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
// 4. 执行流程:先并行加载所有外部脚本 -> 全部完成后 -> 执行内联脚本
|
|
570
|
+
var loadingPromises = externalNodes.map(loadExternalScript);
|
|
571
|
+
Promise.all(loadingPromises).then(function () {
|
|
572
|
+
// 所有外部脚本(src)都已加载完毕(或失败),现在执行内联代码
|
|
573
|
+
runInlineScripts();
|
|
519
574
|
});
|
|
520
|
-
// 组件卸载时清理
|
|
521
575
|
return function () {
|
|
522
576
|
scriptCleanupsRef.current.forEach(function (cleanup) {
|
|
523
577
|
return cleanup && cleanup();
|
|
524
578
|
});
|
|
525
579
|
};
|
|
526
|
-
}, [html, dataFingerprint]);
|
|
580
|
+
}, [html, dataFingerprint]);
|
|
527
581
|
return React__default["default"].createElement("div", {
|
|
528
582
|
className: "liquid-amis-container ".concat(className || ''),
|
|
529
583
|
ref: containerRef
|
package/dist/assets-dev.json
CHANGED
package/dist/assets.json
CHANGED
|
@@ -21,11 +21,18 @@
|
|
|
21
21
|
],
|
|
22
22
|
"library": "liquidjs"
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
"package": "sortablejs",
|
|
26
|
+
"urls": [
|
|
27
|
+
"https://unpkg.com/sortablejs@1.15.6/Sortable.min.js"
|
|
28
|
+
],
|
|
29
|
+
"library": "Sortable"
|
|
30
|
+
},
|
|
24
31
|
{
|
|
25
32
|
"package": "@steedos-widgets/antd",
|
|
26
33
|
"urls": [
|
|
27
|
-
"https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
28
|
-
"https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
34
|
+
"https://unpkg.com/@steedos-widgets/antd@6.10.46/dist/antd.umd.js",
|
|
35
|
+
"https://unpkg.com/@steedos-widgets/antd@6.10.46/dist/antd.umd.css"
|
|
29
36
|
],
|
|
30
37
|
"library": "BuilderAntd"
|
|
31
38
|
}
|
|
@@ -36,10 +43,10 @@
|
|
|
36
43
|
"npm": {
|
|
37
44
|
"package": "@steedos-widgets/antd"
|
|
38
45
|
},
|
|
39
|
-
"url": "https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
46
|
+
"url": "https://unpkg.com/@steedos-widgets/antd@6.10.46/dist/meta.js",
|
|
40
47
|
"urls": {
|
|
41
|
-
"default": "https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
42
|
-
"design": "https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
48
|
+
"default": "https://unpkg.com/@steedos-widgets/antd@6.10.46/dist/meta.js",
|
|
49
|
+
"design": "https://unpkg.com/@steedos-widgets/antd@6.10.46/dist/meta.js"
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
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.
|
|
4
|
+
"version": "6.10.46",
|
|
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": "
|
|
50
|
+
"gitHead": "2ebefd488865d813809c593a41728873eebe6d51",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"liquidjs": "^10.24.0"
|
|
53
53
|
}
|