@steedos-widgets/antd 6.10.52-beta.34 → 6.10.52-beta.36
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 +327 -1
- package/dist/assets.json +5 -5
- package/dist/components/RelatedInstances.d.ts +19 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/meta.js +102 -36
- package/dist/metas/RelatedInstances.d.ts +2 -0
- package/dist/types/components/RelatedInstances.d.ts +19 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/metas/RelatedInstances.d.ts +2 -0
- package/package.json +2 -2
package/dist/antd.umd.js
CHANGED
|
@@ -193,6 +193,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
193
193
|
}
|
|
194
194
|
return ar;
|
|
195
195
|
}
|
|
196
|
+
function __spreadArray(to, from, pack) {
|
|
197
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
198
|
+
if (ar || !(i in from)) {
|
|
199
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
200
|
+
ar[i] = from[i];
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
204
|
+
}
|
|
196
205
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
197
206
|
var e = new Error(message);
|
|
198
207
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -928,7 +937,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
928
937
|
}, [html]);
|
|
929
938
|
var containerElement = React.useMemo(function () {
|
|
930
939
|
return React__default["default"].createElement("div", {
|
|
931
|
-
className: "liquid-amis-container flex flex-col
|
|
940
|
+
className: "liquid-amis-container flex flex-col w-full overflow-hidden ".concat(className || ''),
|
|
932
941
|
ref: containerRef,
|
|
933
942
|
dangerouslySetInnerHTML: innerHtml
|
|
934
943
|
});
|
|
@@ -1032,6 +1041,323 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1032
1041
|
if (!body) return null;
|
|
1033
1042
|
return React__default["default"].createElement(React__default["default"].Fragment, null, children, render('body', body, {}));
|
|
1034
1043
|
};
|
|
1044
|
+
var AntdRelatedInstances = function AntdRelatedInstances(props) {
|
|
1045
|
+
var value = props.value,
|
|
1046
|
+
onChange = props.onChange,
|
|
1047
|
+
rootUrl = props.rootUrl,
|
|
1048
|
+
tenantId = props.tenantId,
|
|
1049
|
+
authToken = props.authToken,
|
|
1050
|
+
_a = props.placeholder,
|
|
1051
|
+
placeholder = _a === void 0 ? '搜索申请单' : _a,
|
|
1052
|
+
disabled = props.disabled,
|
|
1053
|
+
cx = props.classnames,
|
|
1054
|
+
env = props.env,
|
|
1055
|
+
amisData = props.data,
|
|
1056
|
+
_b = props.pageSize,
|
|
1057
|
+
pageSize = _b === void 0 ? 20 : _b,
|
|
1058
|
+
_c = props.filterMonths,
|
|
1059
|
+
filterMonths = _c === void 0 ? 6 : _c;
|
|
1060
|
+
// 归一化 value:可能是 string[] 或 {_id, name}[] 对象数组
|
|
1061
|
+
var normalizeValue = React.useCallback(function (val) {
|
|
1062
|
+
if (!val || !Array.isArray(val)) return [];
|
|
1063
|
+
return val.map(function (item) {
|
|
1064
|
+
if (typeof item === 'string') return item;
|
|
1065
|
+
if (_typeof(item) === 'object' && item._id) return item._id;
|
|
1066
|
+
return String(item);
|
|
1067
|
+
});
|
|
1068
|
+
}, []);
|
|
1069
|
+
// 从对象数组中提取名称映射
|
|
1070
|
+
var extractNamesFromValue = React.useCallback(function (val) {
|
|
1071
|
+
if (!val || !Array.isArray(val)) return {};
|
|
1072
|
+
var map = {};
|
|
1073
|
+
val.forEach(function (item) {
|
|
1074
|
+
if (_typeof(item) === 'object' && item._id && item.name) {
|
|
1075
|
+
map[item._id] = item.name;
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
return map;
|
|
1079
|
+
}, []);
|
|
1080
|
+
var _d = __read(React.useState([]), 2),
|
|
1081
|
+
items = _d[0],
|
|
1082
|
+
setItems = _d[1];
|
|
1083
|
+
var _e = __read(React.useState(0), 2),
|
|
1084
|
+
total = _e[0],
|
|
1085
|
+
setTotal = _e[1];
|
|
1086
|
+
var _f = __read(React.useState(false), 2),
|
|
1087
|
+
loading = _f[0],
|
|
1088
|
+
setLoading = _f[1];
|
|
1089
|
+
var _g = __read(React.useState(''), 2),
|
|
1090
|
+
keywords = _g[0],
|
|
1091
|
+
setKeywords = _g[1];
|
|
1092
|
+
var _h = __read(React.useState(1), 2),
|
|
1093
|
+
currentPage = _h[0],
|
|
1094
|
+
setCurrentPage = _h[1];
|
|
1095
|
+
var debounceTimer = React.useRef(null);
|
|
1096
|
+
// 缓存已选项信息,翻页后仍可展示
|
|
1097
|
+
var _j = __read(React.useState(function () {
|
|
1098
|
+
return extractNamesFromValue(value);
|
|
1099
|
+
}), 2),
|
|
1100
|
+
selectedItemsMap = _j[0],
|
|
1101
|
+
setSelectedItemsMap = _j[1];
|
|
1102
|
+
// 内部管理选中状态,不完全依赖外部 value
|
|
1103
|
+
var _k = __read(React.useState(function () {
|
|
1104
|
+
return normalizeValue(value);
|
|
1105
|
+
}), 2),
|
|
1106
|
+
selectedKeys = _k[0],
|
|
1107
|
+
setSelectedKeys = _k[1];
|
|
1108
|
+
var getAuthHeader = React.useCallback(function () {
|
|
1109
|
+
var tid = tenantId || amisData && amisData.context && amisData.context.tenantId || env && env.session && env.session.tenantId || '';
|
|
1110
|
+
var token = authToken || amisData && amisData.context && amisData.context.authToken || env && env.session && env.session.authToken || '';
|
|
1111
|
+
return "Bearer ".concat(tid, ",").concat(token);
|
|
1112
|
+
}, [tenantId, authToken, amisData, env]);
|
|
1113
|
+
var getGraphqlUrl = React.useCallback(function () {
|
|
1114
|
+
var root = rootUrl || amisData && amisData.context && amisData.context.rootUrl || env && env.session && env.session.rootUrl || '';
|
|
1115
|
+
return "".concat(root, "/graphql");
|
|
1116
|
+
}, [rootUrl, amisData, env]);
|
|
1117
|
+
var buildDateFilters = React.useCallback(function () {
|
|
1118
|
+
var now = new Date();
|
|
1119
|
+
var start = new Date(now);
|
|
1120
|
+
start.setMonth(start.getMonth() - filterMonths);
|
|
1121
|
+
start.setHours(0, 0, 0, 0);
|
|
1122
|
+
var end = new Date(now);
|
|
1123
|
+
end.setHours(23, 59, 59, 999);
|
|
1124
|
+
var startStr = start.toISOString();
|
|
1125
|
+
var endStr = end.toISOString();
|
|
1126
|
+
return "[[\"submit_date\",\"between\",[\"".concat(startStr, "\",\"").concat(endStr, "\"]]]");
|
|
1127
|
+
}, [filterMonths]);
|
|
1128
|
+
var fetchInstances = React.useCallback(function (searchKeywords, page) {
|
|
1129
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
1130
|
+
var skip, filters, query, response, result, rows_1, count;
|
|
1131
|
+
return __generator(this, function (_a) {
|
|
1132
|
+
switch (_a.label) {
|
|
1133
|
+
case 0:
|
|
1134
|
+
setLoading(true);
|
|
1135
|
+
_a.label = 1;
|
|
1136
|
+
case 1:
|
|
1137
|
+
_a.trys.push([1, 4, 5, 6]);
|
|
1138
|
+
skip = (page - 1) * pageSize;
|
|
1139
|
+
filters = buildDateFilters();
|
|
1140
|
+
query = "\n query{\n rows: instances__getRelatedInstances(keywords: ".concat(JSON.stringify(searchKeywords), ", top: ").concat(pageSize, ", skip: ").concat(skip, ", filters: ").concat(filters, "){\n _id,\n name,\n flow_name,\n submit_date,\n submitter\n _display:_ui{\n submit_date,\n submitter\n }\n },\n count: instances__getRelatedInstances__count(filters: ").concat(filters, ", keywords: ").concat(JSON.stringify(searchKeywords), ")\n }\n ");
|
|
1141
|
+
return [4 /*yield*/, fetch(getGraphqlUrl(), {
|
|
1142
|
+
method: 'POST',
|
|
1143
|
+
headers: {
|
|
1144
|
+
'Content-Type': 'application/json',
|
|
1145
|
+
'Authorization': getAuthHeader()
|
|
1146
|
+
},
|
|
1147
|
+
body: JSON.stringify({
|
|
1148
|
+
query: query
|
|
1149
|
+
})
|
|
1150
|
+
})];
|
|
1151
|
+
case 2:
|
|
1152
|
+
response = _a.sent();
|
|
1153
|
+
return [4 /*yield*/, response.json()];
|
|
1154
|
+
case 3:
|
|
1155
|
+
result = _a.sent();
|
|
1156
|
+
rows_1 = result && result.data && result.data.rows || [];
|
|
1157
|
+
count = result && result.data && result.data.count || 0;
|
|
1158
|
+
setItems(rows_1);
|
|
1159
|
+
setTotal(count);
|
|
1160
|
+
// 缓存当前页项的名称
|
|
1161
|
+
setSelectedItemsMap(function (prev) {
|
|
1162
|
+
var next = _assign({}, prev);
|
|
1163
|
+
rows_1.forEach(function (r) {
|
|
1164
|
+
next[r._id] = r.name;
|
|
1165
|
+
});
|
|
1166
|
+
return next;
|
|
1167
|
+
});
|
|
1168
|
+
return [3 /*break*/, 6];
|
|
1169
|
+
case 4:
|
|
1170
|
+
_a.sent();
|
|
1171
|
+
setItems([]);
|
|
1172
|
+
setTotal(0);
|
|
1173
|
+
return [3 /*break*/, 6];
|
|
1174
|
+
case 5:
|
|
1175
|
+
setLoading(false);
|
|
1176
|
+
return [7 /*endfinally*/];
|
|
1177
|
+
case 6:
|
|
1178
|
+
return [2 /*return*/];
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
});
|
|
1182
|
+
}, [getGraphqlUrl, getAuthHeader, pageSize, buildDateFilters]);
|
|
1183
|
+
React.useEffect(function () {
|
|
1184
|
+
fetchInstances(keywords, currentPage);
|
|
1185
|
+
}, [currentPage]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
1186
|
+
React.useEffect(function () {
|
|
1187
|
+
fetchInstances('', 1);
|
|
1188
|
+
}, [fetchInstances]);
|
|
1189
|
+
var handleSearch = React.useCallback(function (searchValue) {
|
|
1190
|
+
setKeywords(searchValue);
|
|
1191
|
+
if (debounceTimer.current) {
|
|
1192
|
+
clearTimeout(debounceTimer.current);
|
|
1193
|
+
}
|
|
1194
|
+
debounceTimer.current = setTimeout(function () {
|
|
1195
|
+
setCurrentPage(1);
|
|
1196
|
+
fetchInstances(searchValue, 1);
|
|
1197
|
+
}, 300);
|
|
1198
|
+
}, [fetchInstances]);
|
|
1199
|
+
var handlePageChange = React.useCallback(function (page) {
|
|
1200
|
+
setCurrentPage(page);
|
|
1201
|
+
fetchInstances(keywords, page);
|
|
1202
|
+
}, [fetchInstances, keywords]);
|
|
1203
|
+
// 外部 value 变化时同步到内部
|
|
1204
|
+
React.useEffect(function () {
|
|
1205
|
+
if (value !== undefined) {
|
|
1206
|
+
var keys = normalizeValue(value);
|
|
1207
|
+
setSelectedKeys(keys);
|
|
1208
|
+
var names_1 = extractNamesFromValue(value);
|
|
1209
|
+
if (Object.keys(names_1).length > 0) {
|
|
1210
|
+
setSelectedItemsMap(function (prev) {
|
|
1211
|
+
return _assign(_assign({}, prev), names_1);
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
}, [value, normalizeValue, extractNamesFromValue]);
|
|
1216
|
+
var selectedSet = React.useMemo(function () {
|
|
1217
|
+
return new Set(selectedKeys);
|
|
1218
|
+
}, [selectedKeys]);
|
|
1219
|
+
var updateSelection = React.useCallback(function (next) {
|
|
1220
|
+
setSelectedKeys(next);
|
|
1221
|
+
if (onChange) {
|
|
1222
|
+
onChange(next);
|
|
1223
|
+
}
|
|
1224
|
+
}, [onChange]);
|
|
1225
|
+
var handleToggle = React.useCallback(function (id) {
|
|
1226
|
+
if (disabled) return;
|
|
1227
|
+
var next = selectedSet.has(id) ? selectedKeys.filter(function (v) {
|
|
1228
|
+
return v !== id;
|
|
1229
|
+
}) : __spreadArray(__spreadArray([], __read(selectedKeys), false), [id], false);
|
|
1230
|
+
updateSelection(next);
|
|
1231
|
+
}, [selectedKeys, disabled, selectedSet, updateSelection]);
|
|
1232
|
+
var handleRemoveSelected = React.useCallback(function (id) {
|
|
1233
|
+
if (disabled) return;
|
|
1234
|
+
var next = selectedKeys.filter(function (v) {
|
|
1235
|
+
return v !== id;
|
|
1236
|
+
});
|
|
1237
|
+
updateSelection(next);
|
|
1238
|
+
}, [selectedKeys, disabled, updateSelection]);
|
|
1239
|
+
var getDisplayValue = function getDisplayValue(field) {
|
|
1240
|
+
if (!field) return '';
|
|
1241
|
+
if (_typeof(field) === 'object') {
|
|
1242
|
+
if (field.label) return field.label;
|
|
1243
|
+
if (field.name) return field.name;
|
|
1244
|
+
return '';
|
|
1245
|
+
}
|
|
1246
|
+
return String(field);
|
|
1247
|
+
};
|
|
1248
|
+
var columns = [{
|
|
1249
|
+
title: '申请单',
|
|
1250
|
+
dataIndex: 'name',
|
|
1251
|
+
key: 'name',
|
|
1252
|
+
ellipsis: true
|
|
1253
|
+
}, {
|
|
1254
|
+
title: '流程',
|
|
1255
|
+
dataIndex: 'flow_name',
|
|
1256
|
+
key: 'flow_name',
|
|
1257
|
+
width: 150,
|
|
1258
|
+
ellipsis: true
|
|
1259
|
+
}, {
|
|
1260
|
+
title: '提交人',
|
|
1261
|
+
key: 'submitter',
|
|
1262
|
+
width: 100,
|
|
1263
|
+
render: function render(_, record) {
|
|
1264
|
+
var _a;
|
|
1265
|
+
return getDisplayValue((_a = record._display) === null || _a === void 0 ? void 0 : _a.submitter) || getDisplayValue(record.submitter);
|
|
1266
|
+
}
|
|
1267
|
+
}, {
|
|
1268
|
+
title: '提交日期',
|
|
1269
|
+
key: 'submit_date',
|
|
1270
|
+
width: 160,
|
|
1271
|
+
render: function render(_, record) {
|
|
1272
|
+
var _a;
|
|
1273
|
+
return getDisplayValue((_a = record._display) === null || _a === void 0 ? void 0 : _a.submit_date) || getDisplayValue(record.submit_date);
|
|
1274
|
+
}
|
|
1275
|
+
}];
|
|
1276
|
+
var selectedTags = selectedKeys.map(function (id) {
|
|
1277
|
+
return {
|
|
1278
|
+
id: id,
|
|
1279
|
+
name: selectedItemsMap[id] || id
|
|
1280
|
+
};
|
|
1281
|
+
});
|
|
1282
|
+
return React__default["default"].createElement("div", {
|
|
1283
|
+
className: cx ? cx('AntdRelatedInstances-Wrapper') : undefined
|
|
1284
|
+
}, selectedTags.length > 0 && React__default["default"].createElement("div", {
|
|
1285
|
+
style: {
|
|
1286
|
+
marginBottom: 8,
|
|
1287
|
+
lineHeight: '28px'
|
|
1288
|
+
}
|
|
1289
|
+
}, React__default["default"].createElement("span", {
|
|
1290
|
+
style: {
|
|
1291
|
+
marginRight: 8,
|
|
1292
|
+
color: '#666',
|
|
1293
|
+
fontSize: 13
|
|
1294
|
+
}
|
|
1295
|
+
}, "\u5DF2\u9009 ", selectedTags.length, " \u9879:"), selectedTags.map(function (item) {
|
|
1296
|
+
return React__default["default"].createElement(antd.Tag, {
|
|
1297
|
+
key: item.id,
|
|
1298
|
+
closable: !disabled,
|
|
1299
|
+
onClose: function onClose() {
|
|
1300
|
+
return handleRemoveSelected(item.id);
|
|
1301
|
+
},
|
|
1302
|
+
style: {
|
|
1303
|
+
marginBottom: 4
|
|
1304
|
+
}
|
|
1305
|
+
}, item.name);
|
|
1306
|
+
})), React__default["default"].createElement(antd.Input.Search, {
|
|
1307
|
+
placeholder: placeholder,
|
|
1308
|
+
allowClear: true,
|
|
1309
|
+
onSearch: handleSearch,
|
|
1310
|
+
onChange: function onChange(e) {
|
|
1311
|
+
return handleSearch(e.target.value);
|
|
1312
|
+
},
|
|
1313
|
+
style: {
|
|
1314
|
+
marginBottom: 8
|
|
1315
|
+
},
|
|
1316
|
+
disabled: disabled
|
|
1317
|
+
}), React__default["default"].createElement(antd.Table, {
|
|
1318
|
+
rowKey: "_id",
|
|
1319
|
+
columns: columns,
|
|
1320
|
+
dataSource: items,
|
|
1321
|
+
loading: loading,
|
|
1322
|
+
size: "small",
|
|
1323
|
+
scroll: {
|
|
1324
|
+
y: 350
|
|
1325
|
+
},
|
|
1326
|
+
locale: {
|
|
1327
|
+
emptyText: '暂无数据'
|
|
1328
|
+
},
|
|
1329
|
+
rowSelection: {
|
|
1330
|
+
selectedRowKeys: selectedKeys,
|
|
1331
|
+
onChange: function onChange(keys) {
|
|
1332
|
+
updateSelection(keys);
|
|
1333
|
+
},
|
|
1334
|
+
getCheckboxProps: function getCheckboxProps() {
|
|
1335
|
+
return {
|
|
1336
|
+
disabled: disabled
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
},
|
|
1340
|
+
onRow: function onRow(record) {
|
|
1341
|
+
return {
|
|
1342
|
+
onClick: function onClick() {
|
|
1343
|
+
return handleToggle(record._id);
|
|
1344
|
+
},
|
|
1345
|
+
style: {
|
|
1346
|
+
cursor: disabled ? 'default' : 'pointer'
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
},
|
|
1350
|
+
pagination: total > pageSize ? {
|
|
1351
|
+
size: 'small',
|
|
1352
|
+
current: currentPage,
|
|
1353
|
+
pageSize: pageSize,
|
|
1354
|
+
total: total,
|
|
1355
|
+
onChange: handlePageChange,
|
|
1356
|
+
showSizeChanger: false
|
|
1357
|
+
} : false
|
|
1358
|
+
}));
|
|
1359
|
+
};
|
|
1360
|
+
exports.AntdRelatedInstances = AntdRelatedInstances;
|
|
1035
1361
|
exports.AntdSelect = AntdSelect;
|
|
1036
1362
|
exports.Inject = Inject;
|
|
1037
1363
|
exports.LiquidComponent = LiquidComponent;
|
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.
|
|
35
|
-
"https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.
|
|
34
|
+
"https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.36/dist/antd.umd.js",
|
|
35
|
+
"https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.36/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.
|
|
46
|
+
"url": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.36/dist/meta.js",
|
|
47
47
|
"urls": {
|
|
48
|
-
"default": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.
|
|
49
|
-
"design": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.
|
|
48
|
+
"default": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.36/dist/meta.js",
|
|
49
|
+
"design": "https://unpkg.com/@steedos-widgets/antd@6.10.52-beta.36/dist/meta.js"
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AntdRelatedInstancesProps {
|
|
3
|
+
instanceId?: string;
|
|
4
|
+
value?: any[];
|
|
5
|
+
onChange?: (value: string[]) => void;
|
|
6
|
+
rootUrl?: string;
|
|
7
|
+
tenantId?: string;
|
|
8
|
+
authToken?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
classnames?: (...args: (string | false | null | undefined)[]) => string;
|
|
12
|
+
env?: any;
|
|
13
|
+
data?: any;
|
|
14
|
+
pageSize?: number;
|
|
15
|
+
/** 默认过滤月数,默认6个月 */
|
|
16
|
+
filterMonths?: number;
|
|
17
|
+
}
|
|
18
|
+
declare const AntdRelatedInstances: React.FC<AntdRelatedInstancesProps>;
|
|
19
|
+
export { AntdRelatedInstances };
|
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$3 = {
|
|
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$3), {
|
|
73
73
|
// 3. Snippets Configuration
|
|
74
74
|
snippets: [
|
|
75
75
|
{
|
|
76
|
-
title: config$
|
|
76
|
+
title: config$3.title,
|
|
77
77
|
screenshot: "",
|
|
78
78
|
schema: {
|
|
79
|
-
componentName: config$
|
|
80
|
-
props: config$
|
|
79
|
+
componentName: config$3.componentName,
|
|
80
|
+
props: config$3.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$3.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$3.amis.name,
|
|
94
94
|
$schema: '/schemas/UnkownSchema.json',
|
|
95
|
-
name: config$
|
|
96
|
-
description: config$
|
|
97
|
-
tags: [config$
|
|
95
|
+
name: config$3.title,
|
|
96
|
+
description: config$3.title,
|
|
97
|
+
tags: [config$3.group],
|
|
98
98
|
order: -9999,
|
|
99
|
-
icon: config$
|
|
99
|
+
icon: config$3.amis.icon,
|
|
100
100
|
scaffold: {
|
|
101
|
-
type: config$
|
|
102
|
-
label: config$
|
|
101
|
+
type: config$3.amis.name,
|
|
102
|
+
label: config$3.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$3.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$2 = {
|
|
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$2), {
|
|
260
260
|
// 3. Snippets Configuration (拖拽组件时的默认代码片段)
|
|
261
261
|
snippets: [
|
|
262
262
|
{
|
|
263
|
-
title: config$
|
|
263
|
+
title: config$2.title,
|
|
264
264
|
screenshot: "",
|
|
265
265
|
schema: {
|
|
266
|
-
type: config$
|
|
266
|
+
type: config$2.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$
|
|
278
|
+
type: config$2.amis.name,
|
|
279
279
|
usage: "renderer", // 这是一个展示型组件,不是表单项,所以用 renderer
|
|
280
280
|
weight: 1,
|
|
281
281
|
framework: "react"
|
|
282
282
|
},
|
|
283
283
|
plugin: {
|
|
284
|
-
rendererName: config$
|
|
284
|
+
rendererName: config$2.amis.name,
|
|
285
285
|
$schema: '/schemas/UnkownSchema.json',
|
|
286
|
-
name: config$
|
|
286
|
+
name: config$2.title,
|
|
287
287
|
description: "Render HTML using LiquidJS template engine",
|
|
288
|
-
tags: [config$
|
|
288
|
+
tags: [config$2.group],
|
|
289
289
|
order: 99,
|
|
290
|
-
icon: config$
|
|
290
|
+
icon: config$2.amis.icon,
|
|
291
291
|
// 容器类组件必需字段
|
|
292
292
|
regions: [
|
|
293
293
|
{
|
|
@@ -297,11 +297,11 @@
|
|
|
297
297
|
},
|
|
298
298
|
],
|
|
299
299
|
scaffold: {
|
|
300
|
-
type: config$
|
|
300
|
+
type: config$2.amis.name,
|
|
301
301
|
template: "Hello {{name}}",
|
|
302
302
|
},
|
|
303
303
|
previewSchema: {
|
|
304
|
-
type: config$
|
|
304
|
+
type: config$2.amis.name,
|
|
305
305
|
template: "Preview: {{text}}",
|
|
306
306
|
},
|
|
307
307
|
panelTitle: 'Liquid Settings',
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
* @Description: Configuration definition for the Antd Select Amis Custom Component.
|
|
361
361
|
*/
|
|
362
362
|
// Removed i18next dependency (t function)
|
|
363
|
-
var config = {
|
|
363
|
+
var config$1 = {
|
|
364
364
|
// 1. Base Configuration
|
|
365
365
|
group: 'General',
|
|
366
366
|
componentName: "Inject",
|
|
@@ -383,38 +383,104 @@
|
|
|
383
383
|
icon: "fa-fw fas fa-caret-square-down"
|
|
384
384
|
}
|
|
385
385
|
};
|
|
386
|
-
var Inject = __assign(__assign({}, config), {
|
|
386
|
+
var Inject = __assign(__assign({}, config$1), {
|
|
387
387
|
// 3. Snippets Configuration
|
|
388
388
|
snippets: [
|
|
389
389
|
{
|
|
390
|
-
title: config.title,
|
|
390
|
+
title: config$1.title,
|
|
391
391
|
screenshot: "",
|
|
392
392
|
schema: {
|
|
393
|
-
componentName: config.componentName,
|
|
394
|
-
props: config.preview
|
|
393
|
+
componentName: config$1.componentName,
|
|
394
|
+
props: config$1.preview
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
],
|
|
398
398
|
// 4. Amis Renderer and Editor Plugin Configuration
|
|
399
399
|
amis: {
|
|
400
400
|
render: {
|
|
401
|
-
type: config.amis.name,
|
|
401
|
+
type: config$1.amis.name,
|
|
402
402
|
usage: "renderer",
|
|
403
403
|
weight: 1,
|
|
404
404
|
framework: "react"
|
|
405
405
|
},
|
|
406
406
|
plugin: {
|
|
407
|
-
rendererName: config.amis.name,
|
|
407
|
+
rendererName: config$1.amis.name,
|
|
408
408
|
$schema: '/schemas/UnkownSchema.json',
|
|
409
|
-
name: config.title,
|
|
409
|
+
name: config$1.title,
|
|
410
410
|
description: "Inject css or js into the page head",
|
|
411
|
-
tags: [config.group],
|
|
411
|
+
tags: [config$1.group],
|
|
412
412
|
order: 99,
|
|
413
|
-
icon: config.amis.icon,
|
|
413
|
+
icon: config$1.amis.icon,
|
|
414
414
|
panelTitle: 'Inject Settings',
|
|
415
415
|
}
|
|
416
416
|
} });
|
|
417
417
|
|
|
418
|
+
var config = {
|
|
419
|
+
group: 'General',
|
|
420
|
+
componentName: 'AntdRelatedInstances',
|
|
421
|
+
title: 'Related Instances',
|
|
422
|
+
docUrl: '',
|
|
423
|
+
screenshot: '',
|
|
424
|
+
npm: {
|
|
425
|
+
package: '@steedos-widgets/antd',
|
|
426
|
+
version: '{{version}}',
|
|
427
|
+
exportName: 'AntdRelatedInstances',
|
|
428
|
+
main: '',
|
|
429
|
+
destructuring: true,
|
|
430
|
+
subName: '',
|
|
431
|
+
},
|
|
432
|
+
preview: {
|
|
433
|
+
placeholder: 'Please select',
|
|
434
|
+
},
|
|
435
|
+
targets: ['steedos__RecordPage', 'steedos__AppPage', 'steedos__HomePage'],
|
|
436
|
+
engines: ['amis'],
|
|
437
|
+
amis: {
|
|
438
|
+
name: 'antd-related-instances',
|
|
439
|
+
icon: 'fa-fw fas fa-sitemap',
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
var RelatedInstances = __assign(__assign({}, config), { snippets: [
|
|
443
|
+
{
|
|
444
|
+
title: config.title,
|
|
445
|
+
screenshot: '',
|
|
446
|
+
schema: {
|
|
447
|
+
componentName: config.componentName,
|
|
448
|
+
props: config.preview,
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
], amis: {
|
|
452
|
+
render: {
|
|
453
|
+
type: config.amis.name,
|
|
454
|
+
usage: 'formitem',
|
|
455
|
+
weight: 1,
|
|
456
|
+
framework: 'react',
|
|
457
|
+
},
|
|
458
|
+
plugin: {
|
|
459
|
+
rendererName: config.amis.name,
|
|
460
|
+
$schema: '/schemas/UnkownSchema.json',
|
|
461
|
+
name: config.title,
|
|
462
|
+
description: config.title,
|
|
463
|
+
tags: [config.group],
|
|
464
|
+
order: -9999,
|
|
465
|
+
icon: config.amis.icon,
|
|
466
|
+
scaffold: {
|
|
467
|
+
type: config.amis.name,
|
|
468
|
+
label: config.title,
|
|
469
|
+
name: 'related_instances',
|
|
470
|
+
},
|
|
471
|
+
previewSchema: { type: config.amis.name, label: 'Preview', placeholder: 'Please select' },
|
|
472
|
+
panelTitle: 'Related Instances Settings',
|
|
473
|
+
panelControls: [
|
|
474
|
+
{
|
|
475
|
+
type: 'input-text',
|
|
476
|
+
name: 'placeholder',
|
|
477
|
+
label: 'Placeholder',
|
|
478
|
+
value: 'Please select',
|
|
479
|
+
},
|
|
480
|
+
],
|
|
481
|
+
},
|
|
482
|
+
} });
|
|
483
|
+
|
|
418
484
|
/*
|
|
419
485
|
* @Author: baozhoutao@steedos.com
|
|
420
486
|
* @Date: 2022-08-31 16:32:35
|
|
@@ -422,7 +488,7 @@
|
|
|
422
488
|
* @LastEditTime: 2022-09-01 18:46:29
|
|
423
489
|
* @Description:
|
|
424
490
|
*/
|
|
425
|
-
var components = [Select, Liquid, Inject];
|
|
491
|
+
var components = [Select, Liquid, Inject, RelatedInstances];
|
|
426
492
|
var meta = {
|
|
427
493
|
components: components
|
|
428
494
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AntdRelatedInstancesProps {
|
|
3
|
+
instanceId?: string;
|
|
4
|
+
value?: any[];
|
|
5
|
+
onChange?: (value: string[]) => void;
|
|
6
|
+
rootUrl?: string;
|
|
7
|
+
tenantId?: string;
|
|
8
|
+
authToken?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
classnames?: (...args: (string | false | null | undefined)[]) => string;
|
|
12
|
+
env?: any;
|
|
13
|
+
data?: any;
|
|
14
|
+
pageSize?: number;
|
|
15
|
+
/** 默认过滤月数,默认6个月 */
|
|
16
|
+
filterMonths?: number;
|
|
17
|
+
}
|
|
18
|
+
declare const AntdRelatedInstances: React.FC<AntdRelatedInstancesProps>;
|
|
19
|
+
export { AntdRelatedInstances };
|
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.
|
|
4
|
+
"version": "6.10.52-beta.36",
|
|
5
5
|
"main": "dist/antd.cjs.js",
|
|
6
6
|
"module": "dist/antd.esm.js",
|
|
7
7
|
"unpkg": "dist/antd.umd.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"rollup-plugin-visualizer": "^5.8.0",
|
|
51
51
|
"typescript": "^5.9.3"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "f648d2cfdebf8575c04330eab017097b7cf61382",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"liquidjs": "^10.24.0",
|
|
56
56
|
"lodash": "^4.17.23"
|