@steedos-widgets/antd 6.10.37 → 6.10.38
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 +366 -2
- package/dist/assets-dev.json +7 -0
- package/dist/assets.json +12 -5
- package/dist/components/Liquid.d.ts +12 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/meta.js +139 -17
- package/dist/metas/Liquid.d.ts +102 -0
- package/dist/types/components/Liquid.d.ts +12 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/metas/Liquid.d.ts +102 -0
- package/package.json +5 -2
package/dist/antd.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
(function (global, factory) {
|
|
3
|
-
(typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('antd')) : typeof define === 'function' && define.amd ? define(['exports', 'react', 'antd'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BuilderAntd = {}, global.React, global.antd));
|
|
4
|
-
})(this, function (exports, React, antd) {
|
|
3
|
+
(typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('antd'), require('react-dom'), require('liquidjs')) : typeof define === 'function' && define.amd ? define(['exports', 'react', 'antd', 'react-dom', 'liquidjs'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BuilderAntd = {}, global.React, global.antd, global.ReactDOM, global.liquidjs));
|
|
4
|
+
})(this, function (exports, React, antd, reactDom, liquidjs) {
|
|
5
5
|
var global = window;
|
|
6
6
|
function _interopDefaultLegacy(e) {
|
|
7
7
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
@@ -41,6 +41,139 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
41
41
|
}
|
|
42
42
|
return t;
|
|
43
43
|
}
|
|
44
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
45
|
+
function adopt(value) {
|
|
46
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
47
|
+
resolve(value);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
51
|
+
function fulfilled(value) {
|
|
52
|
+
try {
|
|
53
|
+
step(generator.next(value));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
reject(e);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function rejected(value) {
|
|
59
|
+
try {
|
|
60
|
+
step(generator["throw"](value));
|
|
61
|
+
} catch (e) {
|
|
62
|
+
reject(e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function step(result) {
|
|
66
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
67
|
+
}
|
|
68
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function __generator(thisArg, body) {
|
|
72
|
+
var _ = {
|
|
73
|
+
label: 0,
|
|
74
|
+
sent: function sent() {
|
|
75
|
+
if (t[0] & 1) throw t[1];
|
|
76
|
+
return t[1];
|
|
77
|
+
},
|
|
78
|
+
trys: [],
|
|
79
|
+
ops: []
|
|
80
|
+
},
|
|
81
|
+
f,
|
|
82
|
+
y,
|
|
83
|
+
t,
|
|
84
|
+
g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
85
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
86
|
+
return this;
|
|
87
|
+
}), g;
|
|
88
|
+
function verb(n) {
|
|
89
|
+
return function (v) {
|
|
90
|
+
return step([n, v]);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function step(op) {
|
|
94
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
95
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
96
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
97
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
98
|
+
switch (op[0]) {
|
|
99
|
+
case 0:
|
|
100
|
+
case 1:
|
|
101
|
+
t = op;
|
|
102
|
+
break;
|
|
103
|
+
case 4:
|
|
104
|
+
_.label++;
|
|
105
|
+
return {
|
|
106
|
+
value: op[1],
|
|
107
|
+
done: false
|
|
108
|
+
};
|
|
109
|
+
case 5:
|
|
110
|
+
_.label++;
|
|
111
|
+
y = op[1];
|
|
112
|
+
op = [0];
|
|
113
|
+
continue;
|
|
114
|
+
case 7:
|
|
115
|
+
op = _.ops.pop();
|
|
116
|
+
_.trys.pop();
|
|
117
|
+
continue;
|
|
118
|
+
default:
|
|
119
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
120
|
+
_ = 0;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
124
|
+
_.label = op[1];
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
128
|
+
_.label = t[1];
|
|
129
|
+
t = op;
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
if (t && _.label < t[2]) {
|
|
133
|
+
_.label = t[2];
|
|
134
|
+
_.ops.push(op);
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
if (t[2]) _.ops.pop();
|
|
138
|
+
_.trys.pop();
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
op = body.call(thisArg, _);
|
|
142
|
+
} catch (e) {
|
|
143
|
+
op = [6, e];
|
|
144
|
+
y = 0;
|
|
145
|
+
} finally {
|
|
146
|
+
f = t = 0;
|
|
147
|
+
}
|
|
148
|
+
if (op[0] & 5) throw op[1];
|
|
149
|
+
return {
|
|
150
|
+
value: op[0] ? op[1] : void 0,
|
|
151
|
+
done: true
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function __read(o, n) {
|
|
156
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
157
|
+
if (!m) return o;
|
|
158
|
+
var i = m.call(o),
|
|
159
|
+
r,
|
|
160
|
+
ar = [],
|
|
161
|
+
e;
|
|
162
|
+
try {
|
|
163
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
164
|
+
} catch (error) {
|
|
165
|
+
e = {
|
|
166
|
+
error: error
|
|
167
|
+
};
|
|
168
|
+
} finally {
|
|
169
|
+
try {
|
|
170
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
171
|
+
} finally {
|
|
172
|
+
if (e) throw e.error;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return ar;
|
|
176
|
+
}
|
|
44
177
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
45
178
|
var e = new Error(message);
|
|
46
179
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -152,7 +285,238 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
152
285
|
labelRender: customLabelRender
|
|
153
286
|
}, restSelectProps)));
|
|
154
287
|
};
|
|
288
|
+
|
|
289
|
+
// --- 工具函数 ---
|
|
290
|
+
var generateId = function generateId() {
|
|
291
|
+
return "amis-inline-".concat(Math.random().toString(36).substr(2, 9));
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* 宽松 JSON 解析器
|
|
295
|
+
* 允许无引号 Key、单引号 String,并自动修复 HTML 转义字符。
|
|
296
|
+
* 注意:使用 new Function 有安全风险,仅适用于受信任的模板来源。
|
|
297
|
+
*/
|
|
298
|
+
var looseJsonParse = function looseJsonParse(str) {
|
|
299
|
+
if (!str) return null;
|
|
300
|
+
// 1. 基础清洗:修复 HTML 转义
|
|
301
|
+
var cleanStr = str.replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
302
|
+
// 2. 清洗隐形字符 (Web 复制粘贴常见问题)
|
|
303
|
+
cleanStr = cleanStr.replace(/[\u00A0\u1680\u180e\u2000-\u2009\u200a\u2028\u2029\u202f\u205f\u3000]/g, ' ');
|
|
304
|
+
try {
|
|
305
|
+
// 优先尝试标准 JSON 解析 (性能最好)
|
|
306
|
+
return JSON.parse(cleanStr);
|
|
307
|
+
} catch (e) {
|
|
308
|
+
try {
|
|
309
|
+
// 降级策略: 使用 Function 解析 (支持 {key: 'value'} 写法)
|
|
310
|
+
// 如果你的环境支持,推荐替换为 'json5' 库以获得更安全的解析
|
|
311
|
+
return new Function("return " + cleanStr)();
|
|
312
|
+
} catch (e2) {
|
|
313
|
+
// 抛出原始错误以便上层捕获显示
|
|
314
|
+
throw new Error("JSON Parse Error: ".concat(e.message));
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
// --- 组件实现 ---
|
|
319
|
+
var LiquidComponent = function LiquidComponent(_a) {
|
|
320
|
+
var template = _a.template,
|
|
321
|
+
data = _a.data,
|
|
322
|
+
className = _a.className,
|
|
323
|
+
$schema = _a.$schema,
|
|
324
|
+
amisRender = _a.render,
|
|
325
|
+
propsPartials = _a.partials;
|
|
326
|
+
var _b = __read(React.useState(''), 2),
|
|
327
|
+
html = _b[0],
|
|
328
|
+
setHtml = _b[1];
|
|
329
|
+
var _c = __read(React.useState({}), 2),
|
|
330
|
+
mountNodes = _c[0],
|
|
331
|
+
setMountNodes = _c[1];
|
|
332
|
+
var containerRef = React.useRef(null);
|
|
333
|
+
// 1. 合并 Partials (优先 props 传入的,其次是 schema 定义的)
|
|
334
|
+
var finalPartials = React.useMemo(function () {
|
|
335
|
+
return _assign(_assign({}, $schema || {}), propsPartials);
|
|
336
|
+
}, [$schema, propsPartials]);
|
|
337
|
+
// 使用 Ref 保持 Partials 最新引用,避免 engine 重建
|
|
338
|
+
var partialsRef = React.useRef(finalPartials);
|
|
339
|
+
partialsRef.current = finalPartials;
|
|
340
|
+
// 存储内联解析出来的 Schema,用于 Portal 渲染
|
|
341
|
+
var inlineSchemasRef = React.useRef({});
|
|
342
|
+
// 2. 初始化 Liquid Engine (单次初始化)
|
|
343
|
+
var engine = React.useMemo(function () {
|
|
344
|
+
var liq = new liquidjs.Liquid({
|
|
345
|
+
// 自定义文件系统以支持内存 Partials
|
|
346
|
+
fs: {
|
|
347
|
+
readFileSync: function readFileSync(file) {
|
|
348
|
+
var content = partialsRef.current[file];
|
|
349
|
+
if (_typeof(content) === 'object' && content !== null) {
|
|
350
|
+
// 如果 Partial 是对象,说明是 AMIS Schema,直接占位
|
|
351
|
+
return "<div data-amis-partial=\"".concat(file, "\"></div>");
|
|
352
|
+
}
|
|
353
|
+
return typeof content === 'string' ? content : "[Template '".concat(file, "' not found]");
|
|
354
|
+
},
|
|
355
|
+
existsSync: function existsSync(file) {
|
|
356
|
+
return Object.prototype.hasOwnProperty.call(partialsRef.current, file);
|
|
357
|
+
},
|
|
358
|
+
exists: function exists(file) {
|
|
359
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
360
|
+
return __generator(this, function (_a) {
|
|
361
|
+
return [2 /*return*/, Object.prototype.hasOwnProperty.call(partialsRef.current, file)];
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
},
|
|
365
|
+
resolve: function resolve(root, file) {
|
|
366
|
+
return file;
|
|
367
|
+
},
|
|
368
|
+
sep: '/',
|
|
369
|
+
readFile: function readFile(file) {
|
|
370
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
371
|
+
var content;
|
|
372
|
+
return __generator(this, function (_a) {
|
|
373
|
+
content = partialsRef.current[file];
|
|
374
|
+
if (_typeof(content) === 'object' && content !== null) {
|
|
375
|
+
return [2 /*return*/, "<div data-amis-partial=\"".concat(file, "\"></div>")];
|
|
376
|
+
}
|
|
377
|
+
return [2 /*return*/, typeof content === 'string' ? content : ''];
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
// 注册自定义标签 {% amis %}
|
|
384
|
+
liq.registerTag('amis', {
|
|
385
|
+
parse: function parse(tagToken, remainTokens) {
|
|
386
|
+
var _this = this;
|
|
387
|
+
this.templates = [];
|
|
388
|
+
var stream = liq.parser.parseStream(remainTokens);
|
|
389
|
+
stream.on('tag:endamis', function () {
|
|
390
|
+
return stream.stop();
|
|
391
|
+
}).on('template', function (tpl) {
|
|
392
|
+
return _this.templates.push(tpl);
|
|
393
|
+
}).on('text', function (tpl) {
|
|
394
|
+
return _this.templates.push(tpl);
|
|
395
|
+
}).start();
|
|
396
|
+
},
|
|
397
|
+
render: function render(ctx) {
|
|
398
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
399
|
+
var chunks, rawStr, schema, id, register;
|
|
400
|
+
return __generator(this, function (_a) {
|
|
401
|
+
chunks = this.templates.map(function (tpl) {
|
|
402
|
+
return tpl.str;
|
|
403
|
+
});
|
|
404
|
+
rawStr = chunks.join('').trim();
|
|
405
|
+
if (!rawStr) return [2 /*return*/, ''];
|
|
406
|
+
// 开发者体验优化:检测 [object Object]
|
|
407
|
+
if (rawStr.includes('[object Object]')) {
|
|
408
|
+
return [2 /*return*/, "<div class=\"text-red-500 border border-red-500 p-2 text-sm bg-red-50\">\n <strong>Error:</strong> Detected \"[object Object]\" in schema. \n Did you forget to use the <code>| json</code> filter?\n </div>"];
|
|
409
|
+
}
|
|
410
|
+
try {
|
|
411
|
+
schema = looseJsonParse(rawStr);
|
|
412
|
+
id = generateId();
|
|
413
|
+
register = ctx.get(['__registerInlineSchema']);
|
|
414
|
+
// 兼容性处理:防止 Liquid 版本差异导致 get 获取不到
|
|
415
|
+
if (!register && ctx.environments) {
|
|
416
|
+
register = ctx.environments['__registerInlineSchema'];
|
|
417
|
+
}
|
|
418
|
+
if (typeof register === 'function') {
|
|
419
|
+
register(id, schema);
|
|
420
|
+
// 返回占位符 DIV
|
|
421
|
+
return [2 /*return*/, "<div data-amis-partial=\"".concat(id, "\" style=\"display: contents;\"></div>")];
|
|
422
|
+
} else {
|
|
423
|
+
console.warn('LiquidAMIS: __registerInlineSchema hook not found in context.');
|
|
424
|
+
return [2 /*return*/, ""];
|
|
425
|
+
}
|
|
426
|
+
} catch (e) {
|
|
427
|
+
console.error("Liquid Inline AMIS Parse Error:", e, "\nSource:", rawStr);
|
|
428
|
+
// 错误 UI
|
|
429
|
+
return [2 /*return*/, "<div style=\"border:2px solid red; background:#fff0f0; padding:8px; font-family:monospace; border-radius: 4px; font-size: 12px;\">\n <strong style=\"color:#d32f2f;\">JSON Parse Failed</strong>\n <div style=\"margin-top:4px; white-space:pre-wrap; background:white; border:1px solid #ddd; padding:4px; color:#333;\">".concat(rawStr.replace(/</g, '<'), "</div>\n <div style=\"color:#d32f2f; margin-top:4px;\">").concat(e.message, "</div>\n </div>")];
|
|
430
|
+
}
|
|
431
|
+
return [2 /*return*/];
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
return liq;
|
|
437
|
+
}, []); // 依赖为空,确保 Engine 只初始化一次
|
|
438
|
+
// 用于触发重渲染的指纹
|
|
439
|
+
var dataFingerprint = JSON.stringify(data);
|
|
440
|
+
var partialsFingerprint = JSON.stringify(finalPartials);
|
|
441
|
+
// 3. 执行 Liquid 渲染
|
|
442
|
+
React.useEffect(function () {
|
|
443
|
+
var isMounted = true;
|
|
444
|
+
inlineSchemasRef.current = {}; // 重置内联 Schema 缓存
|
|
445
|
+
var contextData = _assign(_assign({}, data), {
|
|
446
|
+
// 注入回调函数,允许 Liquid 标签内部向 React 组件回传数据
|
|
447
|
+
__registerInlineSchema: function __registerInlineSchema(id, schema) {
|
|
448
|
+
inlineSchemasRef.current[id] = schema;
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
engine.parseAndRender(template, contextData).then(function (result) {
|
|
452
|
+
if (isMounted) {
|
|
453
|
+
setHtml(function (prev) {
|
|
454
|
+
return prev !== result ? result : prev;
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
})["catch"](function (err) {
|
|
458
|
+
if (isMounted) {
|
|
459
|
+
console.error("Liquid Render Error:", err);
|
|
460
|
+
setHtml("<div style=\"color:red; padding:10px; border:1px solid red;\">Global Render Error: ".concat(err.message, "</div>"));
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
return function () {
|
|
464
|
+
isMounted = false;
|
|
465
|
+
};
|
|
466
|
+
}, [engine, template, dataFingerprint, partialsFingerprint]);
|
|
467
|
+
// 4. DOM 挂载检测 (查找占位符)
|
|
468
|
+
React.useEffect(function () {
|
|
469
|
+
if (!containerRef.current) return;
|
|
470
|
+
var nodes = {};
|
|
471
|
+
var elements = containerRef.current.querySelectorAll('[data-amis-partial]');
|
|
472
|
+
var hasChanges = false;
|
|
473
|
+
elements.forEach(function (el) {
|
|
474
|
+
var key = el.getAttribute('data-amis-partial');
|
|
475
|
+
if (key) {
|
|
476
|
+
// 确保我们有这个 key 对应的 Schema (不管是内联的还是 props 传入的)
|
|
477
|
+
var hasSchema = inlineSchemasRef.current[key] || partialsRef.current[key];
|
|
478
|
+
if (hasSchema) {
|
|
479
|
+
nodes[key] = el;
|
|
480
|
+
hasChanges = true;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
// 只有当节点数量或引用变化时才更新状态,避免无限渲染
|
|
485
|
+
// 这里简化处理,只要检测到有效节点就更新。React 的 diff 算法会处理多余的 render
|
|
486
|
+
if (hasChanges) {
|
|
487
|
+
setMountNodes(nodes);
|
|
488
|
+
}
|
|
489
|
+
}, [html]); // 当 HTML 字符串变化后,重新扫描 DOM
|
|
490
|
+
// 5. 创建 React Portals
|
|
491
|
+
var portals = React.useMemo(function () {
|
|
492
|
+
return Object.keys(mountNodes).map(function (key) {
|
|
493
|
+
var domNode = mountNodes[key];
|
|
494
|
+
// 优先取内联 Schema,其次取 Partials 定义的 Schema
|
|
495
|
+
var schema = inlineSchemasRef.current[key] || partialsRef.current[key];
|
|
496
|
+
if (!schema || !domNode) return null;
|
|
497
|
+
try {
|
|
498
|
+
// 使用 createPortal 将 AMIS 组件挂载到 Liquid 生成的 div 中
|
|
499
|
+
// 传递 data 作为 props,确保 AMIS 能获取到数据
|
|
500
|
+
return reactDom.createPortal(amisRender("partial-".concat(key), schema, {
|
|
501
|
+
data: data
|
|
502
|
+
}), domNode);
|
|
503
|
+
} catch (e) {
|
|
504
|
+
console.error("Portal Render Error for key ".concat(key, ":"), e);
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
}, [mountNodes, partialsFingerprint, dataFingerprint, amisRender, data]);
|
|
509
|
+
return React__default["default"].createElement("div", {
|
|
510
|
+
className: "liquid-amis-container ".concat(className || ''),
|
|
511
|
+
ref: containerRef
|
|
512
|
+
}, React__default["default"].createElement("div", {
|
|
513
|
+
dangerouslySetInnerHTML: {
|
|
514
|
+
__html: html
|
|
515
|
+
}
|
|
516
|
+
}), portals);
|
|
517
|
+
};
|
|
155
518
|
exports.AntdSelect = AntdSelect;
|
|
519
|
+
exports.LiquidComponent = LiquidComponent;
|
|
156
520
|
Object.defineProperty(exports, '__esModule', {
|
|
157
521
|
value: true
|
|
158
522
|
});
|
package/dist/assets-dev.json
CHANGED
package/dist/assets.json
CHANGED
|
@@ -14,11 +14,18 @@
|
|
|
14
14
|
],
|
|
15
15
|
"library": "antd"
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
"package": "liquidjs",
|
|
19
|
+
"urls": [
|
|
20
|
+
"https://unpkg.com/liquidjs@10.24.0/dist/liquid.browser.min.js"
|
|
21
|
+
],
|
|
22
|
+
"library": "liquidjs"
|
|
23
|
+
},
|
|
17
24
|
{
|
|
18
25
|
"package": "@steedos-widgets/antd",
|
|
19
26
|
"urls": [
|
|
20
|
-
"https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
21
|
-
"https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
27
|
+
"https://unpkg.com/@steedos-widgets/antd@6.10.38/dist/antd.umd.js",
|
|
28
|
+
"https://unpkg.com/@steedos-widgets/antd@6.10.38/dist/antd.umd.css"
|
|
22
29
|
],
|
|
23
30
|
"library": "BuilderAntd"
|
|
24
31
|
}
|
|
@@ -29,10 +36,10 @@
|
|
|
29
36
|
"npm": {
|
|
30
37
|
"package": "@steedos-widgets/antd"
|
|
31
38
|
},
|
|
32
|
-
"url": "https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
39
|
+
"url": "https://unpkg.com/@steedos-widgets/antd@6.10.38/dist/meta.js",
|
|
33
40
|
"urls": {
|
|
34
|
-
"default": "https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
35
|
-
"design": "https://unpkg.com/@steedos-widgets/antd@6.10.
|
|
41
|
+
"default": "https://unpkg.com/@steedos-widgets/antd@6.10.38/dist/meta.js",
|
|
42
|
+
"design": "https://unpkg.com/@steedos-widgets/antd@6.10.38/dist/meta.js"
|
|
36
43
|
}
|
|
37
44
|
}
|
|
38
45
|
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type SchemaObject = Record<string, any>;
|
|
3
|
+
interface LiquidTemplateProps {
|
|
4
|
+
template: string;
|
|
5
|
+
data: Record<string, any>;
|
|
6
|
+
$schema?: Record<string, string | object>;
|
|
7
|
+
partials?: Record<string, string | object>;
|
|
8
|
+
className?: string;
|
|
9
|
+
render: (region: string, schema: SchemaObject, props?: any) => React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const LiquidComponent: React.FC<LiquidTemplateProps>;
|
|
12
|
+
export {};
|
package/dist/meta.js
CHANGED
|
@@ -39,9 +39,9 @@
|
|
|
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$1 = {
|
|
43
43
|
// 1. Base Configuration
|
|
44
|
-
group: '
|
|
44
|
+
group: 'General',
|
|
45
45
|
componentName: "AntdSelect",
|
|
46
46
|
title: 'Select',
|
|
47
47
|
docUrl: "",
|
|
@@ -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$1), {
|
|
73
73
|
// 3. Snippets Configuration
|
|
74
74
|
snippets: [
|
|
75
75
|
{
|
|
76
|
-
title: config.title,
|
|
76
|
+
title: config$1.title,
|
|
77
77
|
screenshot: "",
|
|
78
78
|
schema: {
|
|
79
|
-
componentName: config.componentName,
|
|
80
|
-
props: config.preview
|
|
79
|
+
componentName: config$1.componentName,
|
|
80
|
+
props: config$1.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.amis.name,
|
|
87
|
+
type: config$1.amis.name,
|
|
88
88
|
usage: "formitem",
|
|
89
89
|
weight: 1,
|
|
90
90
|
framework: "react"
|
|
91
91
|
},
|
|
92
92
|
plugin: {
|
|
93
|
-
rendererName: config.amis.name,
|
|
94
|
-
$schema: '/schemas/
|
|
95
|
-
name: config.title,
|
|
96
|
-
description: config.title,
|
|
97
|
-
tags: [config.group],
|
|
93
|
+
rendererName: config$1.amis.name,
|
|
94
|
+
$schema: '/schemas/UnkownSchema.json',
|
|
95
|
+
name: config$1.title,
|
|
96
|
+
description: config$1.title,
|
|
97
|
+
tags: [config$1.group],
|
|
98
98
|
order: -9999,
|
|
99
|
-
icon: config.amis.icon,
|
|
99
|
+
icon: config$1.amis.icon,
|
|
100
100
|
scaffold: {
|
|
101
|
-
type: config.amis.name,
|
|
102
|
-
label: config.title,
|
|
101
|
+
type: config$1.amis.name,
|
|
102
|
+
label: config$1.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.amis.name, label: 'Preview', placeholder: 'Please select' },
|
|
109
|
+
previewSchema: { type: config$1.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: [
|
|
@@ -226,6 +226,128 @@
|
|
|
226
226
|
}
|
|
227
227
|
} });
|
|
228
228
|
|
|
229
|
+
/*
|
|
230
|
+
* @Description: Configuration definition for the Liquid Template Amis Custom Component.
|
|
231
|
+
*/
|
|
232
|
+
var config = {
|
|
233
|
+
// 1. Base Configuration
|
|
234
|
+
group: 'General', // 或者 'Display'
|
|
235
|
+
componentName: "LiquidComponent",
|
|
236
|
+
title: 'Liquid Template',
|
|
237
|
+
docUrl: "", // 可以填入 LiquidJS 的官方文档链接
|
|
238
|
+
screenshot: "",
|
|
239
|
+
npm: {
|
|
240
|
+
package: "@steedos-widgets/antd", // 请修改为你实际发布的包名
|
|
241
|
+
version: "{{version}}",
|
|
242
|
+
exportName: "LiquidComponent",
|
|
243
|
+
main: "",
|
|
244
|
+
destructuring: true,
|
|
245
|
+
subName: ""
|
|
246
|
+
},
|
|
247
|
+
preview: {
|
|
248
|
+
template: "Hello {{name}}!",
|
|
249
|
+
data: { name: "World" }
|
|
250
|
+
},
|
|
251
|
+
targets: ["steedos__RecordPage", "steedos__AppPage", "steedos__HomePage"],
|
|
252
|
+
engines: ["amis"],
|
|
253
|
+
// 2. Amis Core Configuration
|
|
254
|
+
amis: {
|
|
255
|
+
name: 'liquid', // 对应 React 组件 @Renderer 中的 name
|
|
256
|
+
icon: "fa-fw fas fa-code"
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
var Liquid = __assign(__assign({}, config), {
|
|
260
|
+
// 3. Snippets Configuration (拖拽组件时的默认代码片段)
|
|
261
|
+
snippets: [
|
|
262
|
+
{
|
|
263
|
+
title: config.title,
|
|
264
|
+
screenshot: "",
|
|
265
|
+
schema: {
|
|
266
|
+
type: config.amis.name,
|
|
267
|
+
template: "<div>\n <h3>{{title}}</h3>\n <p>User: {{user.name}}</p>\n</div>",
|
|
268
|
+
data: {
|
|
269
|
+
title: "Demo",
|
|
270
|
+
user: { name: "Steedos User" }
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
// 4. Amis Renderer and Editor Plugin Configuration
|
|
276
|
+
amis: {
|
|
277
|
+
render: {
|
|
278
|
+
type: config.amis.name,
|
|
279
|
+
usage: "renderer", // 这是一个展示型组件,不是表单项,所以用 renderer
|
|
280
|
+
weight: 1,
|
|
281
|
+
framework: "react"
|
|
282
|
+
},
|
|
283
|
+
plugin: {
|
|
284
|
+
rendererName: config.amis.name,
|
|
285
|
+
$schema: '/schemas/UnkownSchema.json',
|
|
286
|
+
name: config.title,
|
|
287
|
+
description: "Render HTML using LiquidJS template engine",
|
|
288
|
+
tags: [config.group],
|
|
289
|
+
order: 99,
|
|
290
|
+
icon: config.amis.icon,
|
|
291
|
+
scaffold: {
|
|
292
|
+
type: config.amis.name,
|
|
293
|
+
template: "Hello {{name}}",
|
|
294
|
+
},
|
|
295
|
+
previewSchema: {
|
|
296
|
+
type: config.amis.name,
|
|
297
|
+
template: "Preview: {{text}}",
|
|
298
|
+
},
|
|
299
|
+
panelTitle: 'Liquid Settings',
|
|
300
|
+
// ====== DESIGNER PANEL CONTROLS ======
|
|
301
|
+
panelControls: [
|
|
302
|
+
{
|
|
303
|
+
type: 'tabs',
|
|
304
|
+
tabs: [
|
|
305
|
+
// =================================== 标签页 1: General (核心设置) ===================================
|
|
306
|
+
{
|
|
307
|
+
title: 'General',
|
|
308
|
+
body: [
|
|
309
|
+
{
|
|
310
|
+
type: 'editor', // 使用代码编辑器,方便写多行模板
|
|
311
|
+
language: 'html', // Liquid 语法接近 HTML
|
|
312
|
+
name: 'template',
|
|
313
|
+
label: 'Template String',
|
|
314
|
+
description: 'Support LiquidJS syntax (e.g., {{variable}}, {% if condition %}). HTML is allowed.',
|
|
315
|
+
options: {
|
|
316
|
+
lineNumbers: true
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
type: 'input-text',
|
|
321
|
+
name: 'visibleOn',
|
|
322
|
+
label: 'Visible Expression',
|
|
323
|
+
description: 'Amis expression to control visibility.'
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
// =================================== 标签页 2: Appearance (外观) ===================================
|
|
328
|
+
{
|
|
329
|
+
title: 'Appearance',
|
|
330
|
+
body: [
|
|
331
|
+
{
|
|
332
|
+
type: 'input-text',
|
|
333
|
+
name: 'className',
|
|
334
|
+
label: 'CSS Class Name',
|
|
335
|
+
description: 'Custom class for the container div.'
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
type: 'input-text',
|
|
339
|
+
name: 'style',
|
|
340
|
+
label: 'Inline Style',
|
|
341
|
+
placeholder: 'e.g. color: red; margin: 10px;'
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
} });
|
|
350
|
+
|
|
229
351
|
/*
|
|
230
352
|
* @Author: baozhoutao@steedos.com
|
|
231
353
|
* @Date: 2022-08-31 16:32:35
|
|
@@ -233,7 +355,7 @@
|
|
|
233
355
|
* @LastEditTime: 2022-09-01 18:46:29
|
|
234
356
|
* @Description:
|
|
235
357
|
*/
|
|
236
|
-
var components = [Select];
|
|
358
|
+
var components = [Select, Liquid];
|
|
237
359
|
var meta = {
|
|
238
360
|
components: components
|
|
239
361
|
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
snippets: {
|
|
3
|
+
title: string;
|
|
4
|
+
screenshot: string;
|
|
5
|
+
schema: {
|
|
6
|
+
type: string;
|
|
7
|
+
template: string;
|
|
8
|
+
data: {
|
|
9
|
+
title: string;
|
|
10
|
+
user: {
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}[];
|
|
16
|
+
amis: {
|
|
17
|
+
render: {
|
|
18
|
+
type: string;
|
|
19
|
+
usage: string;
|
|
20
|
+
weight: number;
|
|
21
|
+
framework: string;
|
|
22
|
+
};
|
|
23
|
+
plugin: {
|
|
24
|
+
rendererName: string;
|
|
25
|
+
$schema: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
tags: string[];
|
|
29
|
+
order: number;
|
|
30
|
+
icon: string;
|
|
31
|
+
scaffold: {
|
|
32
|
+
type: string;
|
|
33
|
+
template: string;
|
|
34
|
+
};
|
|
35
|
+
previewSchema: {
|
|
36
|
+
type: string;
|
|
37
|
+
template: string;
|
|
38
|
+
};
|
|
39
|
+
panelTitle: string;
|
|
40
|
+
panelControls: {
|
|
41
|
+
type: string;
|
|
42
|
+
tabs: ({
|
|
43
|
+
title: string;
|
|
44
|
+
body: ({
|
|
45
|
+
type: string;
|
|
46
|
+
language: string;
|
|
47
|
+
name: string;
|
|
48
|
+
label: string;
|
|
49
|
+
description: string;
|
|
50
|
+
options: {
|
|
51
|
+
lineNumbers: boolean;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
type: string;
|
|
55
|
+
name: string;
|
|
56
|
+
label: string;
|
|
57
|
+
description: string;
|
|
58
|
+
language?: undefined;
|
|
59
|
+
options?: undefined;
|
|
60
|
+
})[];
|
|
61
|
+
} | {
|
|
62
|
+
title: string;
|
|
63
|
+
body: ({
|
|
64
|
+
type: string;
|
|
65
|
+
name: string;
|
|
66
|
+
label: string;
|
|
67
|
+
description: string;
|
|
68
|
+
placeholder?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
type: string;
|
|
71
|
+
name: string;
|
|
72
|
+
label: string;
|
|
73
|
+
placeholder: string;
|
|
74
|
+
description?: undefined;
|
|
75
|
+
})[];
|
|
76
|
+
})[];
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
group: string;
|
|
81
|
+
componentName: string;
|
|
82
|
+
title: string;
|
|
83
|
+
docUrl: string;
|
|
84
|
+
screenshot: string;
|
|
85
|
+
npm: {
|
|
86
|
+
package: string;
|
|
87
|
+
version: string;
|
|
88
|
+
exportName: string;
|
|
89
|
+
main: string;
|
|
90
|
+
destructuring: boolean;
|
|
91
|
+
subName: string;
|
|
92
|
+
};
|
|
93
|
+
preview: {
|
|
94
|
+
template: string;
|
|
95
|
+
data: {
|
|
96
|
+
name: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
targets: string[];
|
|
100
|
+
engines: string[];
|
|
101
|
+
};
|
|
102
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type SchemaObject = Record<string, any>;
|
|
3
|
+
interface LiquidTemplateProps {
|
|
4
|
+
template: string;
|
|
5
|
+
data: Record<string, any>;
|
|
6
|
+
$schema?: Record<string, string | object>;
|
|
7
|
+
partials?: Record<string, string | object>;
|
|
8
|
+
className?: string;
|
|
9
|
+
render: (region: string, schema: SchemaObject, props?: any) => React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const LiquidComponent: React.FC<LiquidTemplateProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
snippets: {
|
|
3
|
+
title: string;
|
|
4
|
+
screenshot: string;
|
|
5
|
+
schema: {
|
|
6
|
+
type: string;
|
|
7
|
+
template: string;
|
|
8
|
+
data: {
|
|
9
|
+
title: string;
|
|
10
|
+
user: {
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}[];
|
|
16
|
+
amis: {
|
|
17
|
+
render: {
|
|
18
|
+
type: string;
|
|
19
|
+
usage: string;
|
|
20
|
+
weight: number;
|
|
21
|
+
framework: string;
|
|
22
|
+
};
|
|
23
|
+
plugin: {
|
|
24
|
+
rendererName: string;
|
|
25
|
+
$schema: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
tags: string[];
|
|
29
|
+
order: number;
|
|
30
|
+
icon: string;
|
|
31
|
+
scaffold: {
|
|
32
|
+
type: string;
|
|
33
|
+
template: string;
|
|
34
|
+
};
|
|
35
|
+
previewSchema: {
|
|
36
|
+
type: string;
|
|
37
|
+
template: string;
|
|
38
|
+
};
|
|
39
|
+
panelTitle: string;
|
|
40
|
+
panelControls: {
|
|
41
|
+
type: string;
|
|
42
|
+
tabs: ({
|
|
43
|
+
title: string;
|
|
44
|
+
body: ({
|
|
45
|
+
type: string;
|
|
46
|
+
language: string;
|
|
47
|
+
name: string;
|
|
48
|
+
label: string;
|
|
49
|
+
description: string;
|
|
50
|
+
options: {
|
|
51
|
+
lineNumbers: boolean;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
type: string;
|
|
55
|
+
name: string;
|
|
56
|
+
label: string;
|
|
57
|
+
description: string;
|
|
58
|
+
language?: undefined;
|
|
59
|
+
options?: undefined;
|
|
60
|
+
})[];
|
|
61
|
+
} | {
|
|
62
|
+
title: string;
|
|
63
|
+
body: ({
|
|
64
|
+
type: string;
|
|
65
|
+
name: string;
|
|
66
|
+
label: string;
|
|
67
|
+
description: string;
|
|
68
|
+
placeholder?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
type: string;
|
|
71
|
+
name: string;
|
|
72
|
+
label: string;
|
|
73
|
+
placeholder: string;
|
|
74
|
+
description?: undefined;
|
|
75
|
+
})[];
|
|
76
|
+
})[];
|
|
77
|
+
}[];
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
group: string;
|
|
81
|
+
componentName: string;
|
|
82
|
+
title: string;
|
|
83
|
+
docUrl: string;
|
|
84
|
+
screenshot: string;
|
|
85
|
+
npm: {
|
|
86
|
+
package: string;
|
|
87
|
+
version: string;
|
|
88
|
+
exportName: string;
|
|
89
|
+
main: string;
|
|
90
|
+
destructuring: boolean;
|
|
91
|
+
subName: string;
|
|
92
|
+
};
|
|
93
|
+
preview: {
|
|
94
|
+
template: string;
|
|
95
|
+
data: {
|
|
96
|
+
name: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
targets: string[];
|
|
100
|
+
engines: string[];
|
|
101
|
+
};
|
|
102
|
+
export default _default;
|
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.38",
|
|
5
5
|
"main": "dist/antd.cjs.js",
|
|
6
6
|
"module": "dist/antd.esm.js",
|
|
7
7
|
"unpkg": "dist/antd.umd.js",
|
|
@@ -47,5 +47,8 @@
|
|
|
47
47
|
"rollup-plugin-tslib-resolve-id": "^0.0.0",
|
|
48
48
|
"rollup-plugin-visualizer": "^5.8.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "2d8d143abafd3a597c08cfec210f2110c5b0c52d",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"liquidjs": "^10.24.0"
|
|
53
|
+
}
|
|
51
54
|
}
|