@steedos-widgets/amis-object 6.3.0-beta.15 → 6.3.0-beta.17
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/amis-object.cjs.css +3 -0
- package/dist/amis-object.cjs.js +149 -43
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +3 -0
- package/dist/amis-object.esm.js +149 -43
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +3 -0
- package/dist/amis-object.umd.js +258 -244
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/package.json +3 -3
package/dist/amis-object.cjs.css
CHANGED
package/dist/amis-object.cjs.js
CHANGED
|
@@ -4337,6 +4337,29 @@ function getAmisStaticFieldType$1(type, readonly, options){
|
|
|
4337
4337
|
}
|
|
4338
4338
|
}
|
|
4339
4339
|
|
|
4340
|
+
/*
|
|
4341
|
+
* @Author: baozhoutao@steedos.com
|
|
4342
|
+
* @Date: 2022-07-13 15:18:03
|
|
4343
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
4344
|
+
* @LastEditTime: 2023-04-11 10:34:26
|
|
4345
|
+
* @Description:
|
|
4346
|
+
*/
|
|
4347
|
+
|
|
4348
|
+
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
4349
|
+
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
4350
|
+
const page = await fetchAPI(api);
|
|
4351
|
+
if (page && page.schema) {
|
|
4352
|
+
page.schema = JSON.parse(page.schema);
|
|
4353
|
+
if(page.schema.data){
|
|
4354
|
+
delete page.schema.data.recordId;
|
|
4355
|
+
delete page.schema.data.objectName;
|
|
4356
|
+
delete page.schema.data.context;
|
|
4357
|
+
delete page.schema.data.global;
|
|
4358
|
+
}
|
|
4359
|
+
return page;
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
|
|
4340
4363
|
/*
|
|
4341
4364
|
* @Author: baozhoutao@steedos.com
|
|
4342
4365
|
* @Date: 2022-10-28 14:15:09
|
|
@@ -4360,9 +4383,74 @@ const getAmisFieldType$1 = (steedosField, readonly)=>{
|
|
|
4360
4383
|
return getAmisStaticFieldType$1(steedosField.type === 'avatar' ? 'image' : steedosField.type, readonly, {multiple: steedosField.multiple});
|
|
4361
4384
|
};
|
|
4362
4385
|
|
|
4363
|
-
|
|
4386
|
+
async function getLookupLinkOnClick$1(field, options) {
|
|
4387
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
4388
|
+
|
|
4389
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
4390
|
+
"recordId": "${value}",
|
|
4391
|
+
"data": {
|
|
4392
|
+
...recordPage.schema.data,
|
|
4393
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
4394
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
4395
|
+
"objectName": options.objectName,
|
|
4396
|
+
}
|
|
4397
|
+
}) : {
|
|
4398
|
+
"type": "steedos-record-detail",
|
|
4399
|
+
"objectApiName": options.objectName,
|
|
4400
|
+
"recordId": "${value}",
|
|
4401
|
+
"showBackButton": false,
|
|
4402
|
+
"showButtons": true,
|
|
4403
|
+
"data": {
|
|
4404
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
4405
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
4406
|
+
}
|
|
4407
|
+
};
|
|
4408
|
+
return {
|
|
4409
|
+
"click": {
|
|
4410
|
+
"actions": [
|
|
4411
|
+
// {
|
|
4412
|
+
// "type": "custom",
|
|
4413
|
+
// "script": `
|
|
4414
|
+
// let fileRecordId = url.match(${regFileRecordId})[2];
|
|
4415
|
+
// console.log('fileRecordId:',fileRecordId);
|
|
4416
|
+
// event.data.recordId = fileRecordId;
|
|
4417
|
+
// `,
|
|
4418
|
+
// },
|
|
4419
|
+
{
|
|
4420
|
+
"actionType": "drawer",
|
|
4421
|
+
"drawer": {
|
|
4422
|
+
"type": "drawer",
|
|
4423
|
+
"title": " ",
|
|
4424
|
+
"headerClassName": "hidden",
|
|
4425
|
+
"size": "lg",
|
|
4426
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
4427
|
+
"closeOnEsc": true,
|
|
4428
|
+
"closeOnOutside": true,
|
|
4429
|
+
"resizable": true,
|
|
4430
|
+
"actions": [],
|
|
4431
|
+
"body": [
|
|
4432
|
+
drawerRecordDetailSchema
|
|
4433
|
+
],
|
|
4434
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
4435
|
+
},
|
|
4436
|
+
"preventDefault": true
|
|
4437
|
+
}
|
|
4438
|
+
]
|
|
4439
|
+
}
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
|
|
4443
|
+
const getAmisFileReadonlySchema = async (steedosField,ctx)=>{
|
|
4364
4444
|
const type = steedosField.type;
|
|
4445
|
+
const { appId, formFactor } = ctx.amisData || {};
|
|
4365
4446
|
const amisFieldType = getAmisFieldType$1(steedosField, true);
|
|
4447
|
+
|
|
4448
|
+
let lookupATagClick = 'onclick="return false;"';
|
|
4449
|
+
|
|
4450
|
+
if(window.innerWidth < 768){
|
|
4451
|
+
lookupATagClick = "";
|
|
4452
|
+
}
|
|
4453
|
+
|
|
4366
4454
|
if(_.includes(['avatar','image'], type)){
|
|
4367
4455
|
return {
|
|
4368
4456
|
type: amisFieldType,
|
|
@@ -4397,13 +4485,34 @@ const getAmisFileReadonlySchema = (steedosField)=>{
|
|
|
4397
4485
|
}
|
|
4398
4486
|
}
|
|
4399
4487
|
} : {
|
|
4400
|
-
type: amisFieldType,
|
|
4401
|
-
tpl: `
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4488
|
+
// type: amisFieldType,
|
|
4489
|
+
// tpl: `
|
|
4490
|
+
// <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
|
|
4491
|
+
// <% if(!Array.isArray(fileData)){ fileData = [fileData]} %>
|
|
4492
|
+
// <% fileData.forEach(function(item) { %>
|
|
4493
|
+
// <a href='<%= item.url %>' target='_self' class='block'><%= item.name %></a>
|
|
4494
|
+
// <% });} %>`
|
|
4495
|
+
"type": "control",
|
|
4496
|
+
"body": {
|
|
4497
|
+
type: 'each',
|
|
4498
|
+
placeholder: "",
|
|
4499
|
+
// className: `steedos-field-lookup-each flex flex-wrap gap-2`,
|
|
4500
|
+
source: `\${_display.${steedosField.name}|asArray}`,
|
|
4501
|
+
items: {
|
|
4502
|
+
type: 'static',
|
|
4503
|
+
labelClassName: "hidden",
|
|
4504
|
+
label: false,
|
|
4505
|
+
className: 'm-0',
|
|
4506
|
+
tpl: `<a href="/app/-/cfs_files_filerecord/view/\${value}" ${lookupATagClick}>\${name}</a>`,
|
|
4507
|
+
// tpl: "<%= item.name >",
|
|
4508
|
+
// onEvent: window.innerWidth < 768 ? null : REFERENCE_VALUE_ITEM_ONCLICK
|
|
4509
|
+
onEvent: window.innerWidth < 768 ? null : await getLookupLinkOnClick$1(steedosField, {
|
|
4510
|
+
appId,
|
|
4511
|
+
objectName: "cfs_files_filerecord",
|
|
4512
|
+
formFactor
|
|
4513
|
+
})
|
|
4514
|
+
}
|
|
4515
|
+
}
|
|
4407
4516
|
}
|
|
4408
4517
|
}
|
|
4409
4518
|
};
|
|
@@ -4465,8 +4574,8 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
4465
4574
|
return convertData;
|
|
4466
4575
|
};
|
|
4467
4576
|
|
|
4468
|
-
const getAmisFileSchema = (steedosField, readonly)=>{
|
|
4469
|
-
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
4577
|
+
const getAmisFileSchema = async (steedosField, readonly, ctx)=>{
|
|
4578
|
+
return readonly ? await getAmisFileReadonlySchema(steedosField,ctx) : getAmisFileEditSchema(steedosField);
|
|
4470
4579
|
};
|
|
4471
4580
|
|
|
4472
4581
|
var frontend_field_group_generalization$1 = "General";
|
|
@@ -4861,29 +4970,6 @@ instance
|
|
|
4861
4970
|
}
|
|
4862
4971
|
});
|
|
4863
4972
|
|
|
4864
|
-
/*
|
|
4865
|
-
* @Author: baozhoutao@steedos.com
|
|
4866
|
-
* @Date: 2022-07-13 15:18:03
|
|
4867
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
4868
|
-
* @LastEditTime: 2023-04-11 10:34:26
|
|
4869
|
-
* @Description:
|
|
4870
|
-
*/
|
|
4871
|
-
|
|
4872
|
-
async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
|
|
4873
|
-
const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
|
|
4874
|
-
const page = await fetchAPI(api);
|
|
4875
|
-
if (page && page.schema) {
|
|
4876
|
-
page.schema = JSON.parse(page.schema);
|
|
4877
|
-
if(page.schema.data){
|
|
4878
|
-
delete page.schema.data.recordId;
|
|
4879
|
-
delete page.schema.data.objectName;
|
|
4880
|
-
delete page.schema.data.context;
|
|
4881
|
-
delete page.schema.data.global;
|
|
4882
|
-
}
|
|
4883
|
-
return page;
|
|
4884
|
-
}
|
|
4885
|
-
}
|
|
4886
|
-
|
|
4887
4973
|
async function getQuickEditSchema(object, columnField, options){
|
|
4888
4974
|
let field = object.fields[columnField.name];
|
|
4889
4975
|
//判断在amis3.2以上环境下,放开批量编辑与lookup的单元格编辑
|
|
@@ -14769,8 +14855,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
14769
14855
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
14770
14856
|
const isCreate = _$1__namespace.isBoolean(field.create) ? field.create : true;
|
|
14771
14857
|
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
14772
|
-
let
|
|
14773
|
-
if (isAllowCreate && isCreate && !
|
|
14858
|
+
let hasFilters = !_$1__namespace.isEmpty(field.filters) || !!field.filtersFunction || !!field._filtersFunction;
|
|
14859
|
+
if (isAllowCreate && isCreate && !hasFilters) {
|
|
14774
14860
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
14775
14861
|
new_button.align = "right";
|
|
14776
14862
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
@@ -16215,13 +16301,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
16215
16301
|
};
|
|
16216
16302
|
break;
|
|
16217
16303
|
case 'avatar':
|
|
16218
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16304
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16219
16305
|
break;
|
|
16220
16306
|
case 'image':
|
|
16221
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16307
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16222
16308
|
break;
|
|
16223
16309
|
case 'file':
|
|
16224
|
-
convertData = getAmisFileSchema(field, readonly);
|
|
16310
|
+
convertData = await getAmisFileSchema(field, readonly, ctx);
|
|
16225
16311
|
break;
|
|
16226
16312
|
case 'formula':
|
|
16227
16313
|
if(readonly){
|
|
@@ -21415,7 +21501,12 @@ var SteedosDropdownButton = function (props) {
|
|
|
21415
21501
|
}
|
|
21416
21502
|
}
|
|
21417
21503
|
};
|
|
21418
|
-
return (React__default["default"].createElement(antd.Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow
|
|
21504
|
+
return (React__default["default"].createElement(antd.Dropdown, { menu: { items: menu }, trigger: trigger, onOpenChange: onOpenChange, placement: placement, overlayClassName: overlayClassName, arrow: arrow, getPopupContainer: function (button) {
|
|
21505
|
+
// 未配置getPopupContainer属性时,默认container为body,这里判断到dropdown button是在drawer中时,统一把container配置为drawer本身
|
|
21506
|
+
// 这样就可以解决drawer内点击dropdown button组件下拉菜单中的按钮时不应该自动关闭drawer的问题
|
|
21507
|
+
var drawerBody = window.$(button).closest(".amis-dialog-widget .antd-Drawer-body")[0];
|
|
21508
|
+
return drawerBody || document.querySelector("body");
|
|
21509
|
+
} },
|
|
21419
21510
|
React__default["default"].createElement("button", { className: "slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small ".concat(className ? className : '') },
|
|
21420
21511
|
React__default["default"].createElement("svg", { className: "w-4 h-4 fill-gray-500" },
|
|
21421
21512
|
React__default["default"].createElement("use", { xlinkHref: "/assets/icons/utility-sprite/svg/symbols.svg#down" })))));
|
|
@@ -21994,7 +22085,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
21994
22085
|
return __generator(this, function (_d) {
|
|
21995
22086
|
switch (_d.label) {
|
|
21996
22087
|
case 0:
|
|
21997
|
-
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 p-0 bg-gray-50' : _a, schemaFilter = props.schemaFilter, showButtons = props.showButtons, showBackButton = props.showBackButton;
|
|
22088
|
+
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 sm:z-10 p-0 bg-gray-50' : _a, schemaFilter = props.schemaFilter, showButtons = props.showButtons, showBackButton = props.showBackButton;
|
|
21998
22089
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
21999
22090
|
case 1:
|
|
22000
22091
|
_d.sent();
|
|
@@ -22763,9 +22854,10 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
|
|
|
22763
22854
|
* @Author: baozhoutao@steedos.com
|
|
22764
22855
|
* @Date: 2022-09-01 14:44:57
|
|
22765
22856
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
22766
|
-
* @LastEditTime: 2024-05-
|
|
22857
|
+
* @LastEditTime: 2024-05-29 11:45:57
|
|
22767
22858
|
* @Description:
|
|
22768
22859
|
*/
|
|
22860
|
+
var beforeMarkReadAllScript = "\n var hasUnRead = !!db.notifications.find({'$or':[{'is_read': null},{'is_read': false}]}).count();\n // \u6CA1\u6709\u8BA2\u9605\u5230\u672A\u8BFB\u901A\u77E5\u65F6\u9700\u8981\u989D\u5916\u5355\u72EC\u89E6\u53D1\u91CD\u65B0\u8BF7\u6C42\u901A\u77E5\u5217\u8868\u53CA\u672A\u8BFB\u6570\u91CF\n // \u5982\u679C\u6709\u8BA2\u9605\u5230\u7684\u8BDD\uFF0C\u56E0\u4E3A\u76D1\u542C\u8BA2\u9605\u5230\u7684\u901A\u77E5\u8BB0\u5F55\u53D8\u5316\uFF0C\u6709\u53D8\u5316\u4F1A\u89E6\u53D1@data.changed.notifications\u4E8B\u4EF6\uFF0C\u4ECE\u800C\u4F1A\u81EA\u52A8\u89E6\u53D1\u91CD\u65B0\u8BF7\u6C42\u901A\u77E5\u5217\u8868\u53CA\u672A\u8BFB\u6570\u91CF\n event.data.needToReload = !hasUnRead;\n";
|
|
22769
22861
|
var getNotificationBadgeButton = function () {
|
|
22770
22862
|
var isMobile = window.innerWidth < 768;
|
|
22771
22863
|
var listContent = {
|
|
@@ -22849,6 +22941,10 @@ var getNotificationBadgeButton = function () {
|
|
|
22849
22941
|
"onEvent": {
|
|
22850
22942
|
"click": {
|
|
22851
22943
|
"actions": [
|
|
22944
|
+
{
|
|
22945
|
+
"actionType": "custom",
|
|
22946
|
+
"script": beforeMarkReadAllScript
|
|
22947
|
+
},
|
|
22852
22948
|
{
|
|
22853
22949
|
"componentId": "",
|
|
22854
22950
|
"args": {
|
|
@@ -22864,6 +22960,16 @@ var getNotificationBadgeButton = function () {
|
|
|
22864
22960
|
}
|
|
22865
22961
|
},
|
|
22866
22962
|
"actionType": "ajax"
|
|
22963
|
+
},
|
|
22964
|
+
{
|
|
22965
|
+
"componentId": "service_global_header_notifications_unread_count",
|
|
22966
|
+
"actionType": "reload",
|
|
22967
|
+
"expression": "${needToReload}"
|
|
22968
|
+
},
|
|
22969
|
+
{
|
|
22970
|
+
"componentId": "service_global_header_notifications_list",
|
|
22971
|
+
"actionType": "reload",
|
|
22972
|
+
"expression": "${needToReload}"
|
|
22867
22973
|
}
|
|
22868
22974
|
],
|
|
22869
22975
|
"weight": 0
|
|
@@ -22873,7 +22979,7 @@ var getNotificationBadgeButton = function () {
|
|
|
22873
22979
|
]
|
|
22874
22980
|
},
|
|
22875
22981
|
],
|
|
22876
|
-
"id": "
|
|
22982
|
+
"id": "service_global_header_notifications_list",
|
|
22877
22983
|
"onEvent": {
|
|
22878
22984
|
"@data.changed.notifications": {
|
|
22879
22985
|
"actions": [
|
|
@@ -22917,7 +23023,7 @@ var getNotificationBadgeButton = function () {
|
|
|
22917
23023
|
"count": "${unReadCount}"
|
|
22918
23024
|
},
|
|
22919
23025
|
],
|
|
22920
|
-
"id": "
|
|
23026
|
+
"id": "service_global_header_notifications_unread_count",
|
|
22921
23027
|
"messages": {},
|
|
22922
23028
|
"api": {
|
|
22923
23029
|
"method": "post",
|