@steedos-widgets/antd 6.10.47 → 6.10.48
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 +94 -4
- package/dist/assets.json +5 -5
- package/dist/components/Inject.d.ts +17 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/meta.js +84 -26
- package/dist/metas/Inject.d.ts +2 -0
- package/dist/types/components/Inject.d.ts +17 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/metas/Inject.d.ts +2 -0
- package/package.json +2 -2
package/dist/antd.umd.js
CHANGED
|
@@ -578,16 +578,106 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
578
578
|
});
|
|
579
579
|
};
|
|
580
580
|
}, [html, dataFingerprint]);
|
|
581
|
-
return React__default["default"].createElement("div", {
|
|
582
|
-
className: "liquid-amis-container ".concat(className || ''),
|
|
583
|
-
ref: containerRef
|
|
584
|
-
}, React__default["default"].createElement("div", {
|
|
581
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", {
|
|
582
|
+
className: "liquid-amis-container flex flex-col h-full w-full overflow-hidden ".concat(className || ''),
|
|
583
|
+
ref: containerRef,
|
|
585
584
|
dangerouslySetInnerHTML: {
|
|
586
585
|
__html: html
|
|
587
586
|
}
|
|
588
587
|
}), portals);
|
|
589
588
|
};
|
|
589
|
+
var Inject = function Inject(props) {
|
|
590
|
+
var _a = props.assets,
|
|
591
|
+
assets = _a === void 0 ? [] : _a,
|
|
592
|
+
body = props.body,
|
|
593
|
+
render = props.render,
|
|
594
|
+
children = props.children;
|
|
595
|
+
// 排除不需要透传的属性
|
|
596
|
+
props.className;
|
|
597
|
+
props.classnames;
|
|
598
|
+
props.env;
|
|
599
|
+
props.scope;
|
|
600
|
+
__rest(props, ["assets", "body", "render", "children", "className", "classnames", "env", "scope"]);
|
|
601
|
+
React.useEffect(function () {
|
|
602
|
+
// 记录本次渲染创建的所有 tag ID,以便卸载时清理
|
|
603
|
+
// 如果用户没传 ID,我们生成临时的,但建议用户传 ID
|
|
604
|
+
var mountedIds = [];
|
|
605
|
+
var injectOne = function injectOne(item, index) {
|
|
606
|
+
var type = item.type,
|
|
607
|
+
src = item.src,
|
|
608
|
+
content = item.content,
|
|
609
|
+
_a = item.location,
|
|
610
|
+
location = _a === void 0 ? 'start' : _a;
|
|
611
|
+
// 如果没有 id,生成一个临时的(注意:这种临时 ID 在组件更新时可能会导致资源重新加载)
|
|
612
|
+
var id = item.id || "amis-inject-".concat(type, "-").concat(index, "-").concat(Date.now());
|
|
613
|
+
mountedIds.push(id);
|
|
614
|
+
// 1. 清理旧资源 (避免重复或更新内容)
|
|
615
|
+
var oldElement = document.getElementById(id);
|
|
616
|
+
if (oldElement) {
|
|
617
|
+
oldElement.remove();
|
|
618
|
+
}
|
|
619
|
+
// 2. 创建 DOM 节点
|
|
620
|
+
var newTag = null;
|
|
621
|
+
if (type === 'css') {
|
|
622
|
+
// --- CSS 处理 ---
|
|
623
|
+
if (src) {
|
|
624
|
+
var link = document.createElement('link');
|
|
625
|
+
link.id = id;
|
|
626
|
+
link.rel = 'stylesheet';
|
|
627
|
+
link.type = 'text/css';
|
|
628
|
+
link.href = src;
|
|
629
|
+
newTag = link;
|
|
630
|
+
} else if (content) {
|
|
631
|
+
var style = document.createElement('style');
|
|
632
|
+
style.id = id;
|
|
633
|
+
style.type = 'text/css';
|
|
634
|
+
style.appendChild(document.createTextNode(content));
|
|
635
|
+
newTag = style;
|
|
636
|
+
}
|
|
637
|
+
} else if (type === 'js') {
|
|
638
|
+
// --- JS 处理 ---
|
|
639
|
+
var script = document.createElement('script');
|
|
640
|
+
script.id = id;
|
|
641
|
+
script.type = 'text/javascript';
|
|
642
|
+
if (src) {
|
|
643
|
+
script.src = src;
|
|
644
|
+
script.async = false; // 保持按顺序执行
|
|
645
|
+
} else if (content) {
|
|
646
|
+
script.text = content;
|
|
647
|
+
}
|
|
648
|
+
newTag = script;
|
|
649
|
+
}
|
|
650
|
+
// 3. 挂载节点
|
|
651
|
+
// CSS 始终挂载到 head
|
|
652
|
+
// JS 通常也可以挂载到 head,或者 body (这里为了统一管理,默认操作 head,如需 body 可自行扩展逻辑)
|
|
653
|
+
if (newTag) {
|
|
654
|
+
if (location === 'end') {
|
|
655
|
+
document.head.appendChild(newTag);
|
|
656
|
+
} else {
|
|
657
|
+
document.head.prepend(newTag);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
// 批量执行注入
|
|
662
|
+
if (Array.isArray(assets)) {
|
|
663
|
+
assets.forEach(function (asset, index) {
|
|
664
|
+
return injectOne(asset, index);
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
// 4. 组件卸载时的清理函数
|
|
668
|
+
return function () {
|
|
669
|
+
mountedIds.forEach(function (id) {
|
|
670
|
+
var el = document.getElementById(id);
|
|
671
|
+
if (el) el.remove();
|
|
672
|
+
});
|
|
673
|
+
};
|
|
674
|
+
}, [JSON.stringify(assets)]); // 使用 JSON.stringify 深度监听数组变化
|
|
675
|
+
// --- 渲染子组件 (无外层 DIV) ---
|
|
676
|
+
if (!body) return null;
|
|
677
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, children, render('body', body, {}));
|
|
678
|
+
};
|
|
590
679
|
exports.AntdSelect = AntdSelect;
|
|
680
|
+
exports.Inject = Inject;
|
|
591
681
|
exports.LiquidComponent = LiquidComponent;
|
|
592
682
|
Object.defineProperty(exports, '__esModule', {
|
|
593
683
|
value: true
|
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.
|
|
35
|
-
"https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
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"
|
|
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.
|
|
46
|
+
"url": "https://unpkg.com/@steedos-widgets/antd@6.10.48/dist/meta.js",
|
|
47
47
|
"urls": {
|
|
48
|
-
"default": "https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
49
|
-
"design": "https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
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"
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type AssetType = 'css' | 'js';
|
|
3
|
+
export type AssetLocation = 'start' | 'end';
|
|
4
|
+
export interface AssetItem {
|
|
5
|
+
type: AssetType;
|
|
6
|
+
id?: string;
|
|
7
|
+
src?: string;
|
|
8
|
+
content?: string;
|
|
9
|
+
location?: AssetLocation;
|
|
10
|
+
}
|
|
11
|
+
interface InjectProps extends React.ComponentProps<any> {
|
|
12
|
+
assets?: AssetItem[];
|
|
13
|
+
body?: any;
|
|
14
|
+
render: (region: string, schema: any, props?: any) => React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare const Inject: React.FC<InjectProps>;
|
|
17
|
+
export { Inject };
|
package/dist/meta.js
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* @Description: Configuration definition for the Antd Select Amis Custom Component.
|
|
40
40
|
*/
|
|
41
41
|
// Removed i18next dependency (t function)
|
|
42
|
-
var config$
|
|
42
|
+
var config$2 = {
|
|
43
43
|
// 1. Base Configuration
|
|
44
44
|
group: 'General',
|
|
45
45
|
componentName: "AntdSelect",
|
|
@@ -69,44 +69,44 @@
|
|
|
69
69
|
icon: "fa-fw fas fa-caret-square-down"
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
var Select = __assign(__assign({}, config$
|
|
72
|
+
var Select = __assign(__assign({}, config$2), {
|
|
73
73
|
// 3. Snippets Configuration
|
|
74
74
|
snippets: [
|
|
75
75
|
{
|
|
76
|
-
title: config$
|
|
76
|
+
title: config$2.title,
|
|
77
77
|
screenshot: "",
|
|
78
78
|
schema: {
|
|
79
|
-
componentName: config$
|
|
80
|
-
props: config$
|
|
79
|
+
componentName: config$2.componentName,
|
|
80
|
+
props: config$2.preview
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
],
|
|
84
84
|
// 4. Amis Renderer and Editor Plugin Configuration
|
|
85
85
|
amis: {
|
|
86
86
|
render: {
|
|
87
|
-
type: config$
|
|
87
|
+
type: config$2.amis.name,
|
|
88
88
|
usage: "formitem",
|
|
89
89
|
weight: 1,
|
|
90
90
|
framework: "react"
|
|
91
91
|
},
|
|
92
92
|
plugin: {
|
|
93
|
-
rendererName: config$
|
|
93
|
+
rendererName: config$2.amis.name,
|
|
94
94
|
$schema: '/schemas/UnkownSchema.json',
|
|
95
|
-
name: config$
|
|
96
|
-
description: config$
|
|
97
|
-
tags: [config$
|
|
95
|
+
name: config$2.title,
|
|
96
|
+
description: config$2.title,
|
|
97
|
+
tags: [config$2.group],
|
|
98
98
|
order: -9999,
|
|
99
|
-
icon: config$
|
|
99
|
+
icon: config$2.amis.icon,
|
|
100
100
|
scaffold: {
|
|
101
|
-
type: config$
|
|
102
|
-
label: config$
|
|
101
|
+
type: config$2.amis.name,
|
|
102
|
+
label: config$2.title,
|
|
103
103
|
name: 'select_field',
|
|
104
104
|
options: [
|
|
105
105
|
{ label: 'Option One', value: 'one' },
|
|
106
106
|
{ label: 'Option Two', value: 'two' },
|
|
107
107
|
]
|
|
108
108
|
},
|
|
109
|
-
previewSchema: { type: config$
|
|
109
|
+
previewSchema: { type: config$2.amis.name, label: 'Preview', placeholder: 'Please select' },
|
|
110
110
|
panelTitle: 'Select Dropdown Settings',
|
|
111
111
|
// ====== OPTIMIZED PANEL CONTROLS (General & Advanced Tabs) START ======
|
|
112
112
|
panelControls: [
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
/*
|
|
230
230
|
* @Description: Configuration definition for the Liquid Template Amis Custom Component.
|
|
231
231
|
*/
|
|
232
|
-
var config = {
|
|
232
|
+
var config$1 = {
|
|
233
233
|
// 1. Base Configuration
|
|
234
234
|
group: 'General', // 或者 'Display'
|
|
235
235
|
componentName: "LiquidComponent",
|
|
@@ -256,14 +256,14 @@
|
|
|
256
256
|
icon: "fa-fw fas fa-code"
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
|
-
var Liquid = __assign(__assign({}, config), {
|
|
259
|
+
var Liquid = __assign(__assign({}, config$1), {
|
|
260
260
|
// 3. Snippets Configuration (拖拽组件时的默认代码片段)
|
|
261
261
|
snippets: [
|
|
262
262
|
{
|
|
263
|
-
title: config.title,
|
|
263
|
+
title: config$1.title,
|
|
264
264
|
screenshot: "",
|
|
265
265
|
schema: {
|
|
266
|
-
type: config.amis.name,
|
|
266
|
+
type: config$1.amis.name,
|
|
267
267
|
template: "<div>\n <h3>{{title}}</h3>\n <p>User: {{user.name}}</p>\n</div>",
|
|
268
268
|
data: {
|
|
269
269
|
title: "Demo",
|
|
@@ -275,19 +275,19 @@
|
|
|
275
275
|
// 4. Amis Renderer and Editor Plugin Configuration
|
|
276
276
|
amis: {
|
|
277
277
|
render: {
|
|
278
|
-
type: config.amis.name,
|
|
278
|
+
type: config$1.amis.name,
|
|
279
279
|
usage: "renderer", // 这是一个展示型组件,不是表单项,所以用 renderer
|
|
280
280
|
weight: 1,
|
|
281
281
|
framework: "react"
|
|
282
282
|
},
|
|
283
283
|
plugin: {
|
|
284
|
-
rendererName: config.amis.name,
|
|
284
|
+
rendererName: config$1.amis.name,
|
|
285
285
|
$schema: '/schemas/UnkownSchema.json',
|
|
286
|
-
name: config.title,
|
|
286
|
+
name: config$1.title,
|
|
287
287
|
description: "Render HTML using LiquidJS template engine",
|
|
288
|
-
tags: [config.group],
|
|
288
|
+
tags: [config$1.group],
|
|
289
289
|
order: 99,
|
|
290
|
-
icon: config.amis.icon,
|
|
290
|
+
icon: config$1.amis.icon,
|
|
291
291
|
// 容器类组件必需字段
|
|
292
292
|
regions: [
|
|
293
293
|
{
|
|
@@ -297,11 +297,11 @@
|
|
|
297
297
|
},
|
|
298
298
|
],
|
|
299
299
|
scaffold: {
|
|
300
|
-
type: config.amis.name,
|
|
300
|
+
type: config$1.amis.name,
|
|
301
301
|
template: "Hello {{name}}",
|
|
302
302
|
},
|
|
303
303
|
previewSchema: {
|
|
304
|
-
type: config.amis.name,
|
|
304
|
+
type: config$1.amis.name,
|
|
305
305
|
template: "Preview: {{text}}",
|
|
306
306
|
},
|
|
307
307
|
panelTitle: 'Liquid Settings',
|
|
@@ -356,6 +356,64 @@
|
|
|
356
356
|
}
|
|
357
357
|
} });
|
|
358
358
|
|
|
359
|
+
/*
|
|
360
|
+
* @Description: Configuration definition for the Antd Select Amis Custom Component.
|
|
361
|
+
*/
|
|
362
|
+
// Removed i18next dependency (t function)
|
|
363
|
+
var config = {
|
|
364
|
+
// 1. Base Configuration
|
|
365
|
+
group: 'General',
|
|
366
|
+
componentName: "Inject",
|
|
367
|
+
title: 'Inject',
|
|
368
|
+
docUrl: "",
|
|
369
|
+
screenshot: "",
|
|
370
|
+
npm: {
|
|
371
|
+
package: "@steedos-widgets/antd",
|
|
372
|
+
version: "{{version}}",
|
|
373
|
+
exportName: "Inject",
|
|
374
|
+
main: "",
|
|
375
|
+
destructuring: true,
|
|
376
|
+
subName: ""
|
|
377
|
+
},
|
|
378
|
+
targets: ["steedos__RecordPage", "steedos__AppPage", "steedos__HomePage"],
|
|
379
|
+
engines: ["amis"],
|
|
380
|
+
// 2. Amis Core Configuration
|
|
381
|
+
amis: {
|
|
382
|
+
name: 'inject',
|
|
383
|
+
icon: "fa-fw fas fa-caret-square-down"
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
var Inject = __assign(__assign({}, config), {
|
|
387
|
+
// 3. Snippets Configuration
|
|
388
|
+
snippets: [
|
|
389
|
+
{
|
|
390
|
+
title: config.title,
|
|
391
|
+
screenshot: "",
|
|
392
|
+
schema: {
|
|
393
|
+
componentName: config.componentName,
|
|
394
|
+
props: config.preview
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
],
|
|
398
|
+
// 4. Amis Renderer and Editor Plugin Configuration
|
|
399
|
+
amis: {
|
|
400
|
+
render: {
|
|
401
|
+
type: config.amis.name,
|
|
402
|
+
usage: "renderer",
|
|
403
|
+
weight: 1,
|
|
404
|
+
framework: "react"
|
|
405
|
+
},
|
|
406
|
+
plugin: {
|
|
407
|
+
rendererName: config.amis.name,
|
|
408
|
+
$schema: '/schemas/UnkownSchema.json',
|
|
409
|
+
name: config.title,
|
|
410
|
+
description: "Inject css or js into the page head",
|
|
411
|
+
tags: [config.group],
|
|
412
|
+
order: 99,
|
|
413
|
+
icon: config.amis.icon,
|
|
414
|
+
}
|
|
415
|
+
} });
|
|
416
|
+
|
|
359
417
|
/*
|
|
360
418
|
* @Author: baozhoutao@steedos.com
|
|
361
419
|
* @Date: 2022-08-31 16:32:35
|
|
@@ -363,7 +421,7 @@
|
|
|
363
421
|
* @LastEditTime: 2022-09-01 18:46:29
|
|
364
422
|
* @Description:
|
|
365
423
|
*/
|
|
366
|
-
var components = [Select, Liquid];
|
|
424
|
+
var components = [Select, Liquid, Inject];
|
|
367
425
|
var meta = {
|
|
368
426
|
components: components
|
|
369
427
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type AssetType = 'css' | 'js';
|
|
3
|
+
export type AssetLocation = 'start' | 'end';
|
|
4
|
+
export interface AssetItem {
|
|
5
|
+
type: AssetType;
|
|
6
|
+
id?: string;
|
|
7
|
+
src?: string;
|
|
8
|
+
content?: string;
|
|
9
|
+
location?: AssetLocation;
|
|
10
|
+
}
|
|
11
|
+
interface InjectProps extends React.ComponentProps<any> {
|
|
12
|
+
assets?: AssetItem[];
|
|
13
|
+
body?: any;
|
|
14
|
+
render: (region: string, schema: any, props?: any) => React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare const Inject: React.FC<InjectProps>;
|
|
17
|
+
export { Inject };
|
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.48",
|
|
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": "aa2766f89c4316272e87f25f405a570fe019fbb3",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"liquidjs": "^10.24.0"
|
|
53
53
|
}
|