@steedos-widgets/amis-lib 6.10.23 → 6.10.25
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +206 -57
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +206 -57
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +214 -203
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/calendar.d.ts +7 -1
- package/dist/types/workflow/approve.d.ts +2 -2
- package/dist/types/workflow/flow.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -3649,7 +3649,7 @@ function getBatchDelete(objectName){
|
|
|
3649
3649
|
const DEFAULT_CALENDAR_OPTIONS = {
|
|
3650
3650
|
startDateExpr: "start",
|
|
3651
3651
|
endDateExpr: "end",
|
|
3652
|
-
allDayExpr: "is_all_day",
|
|
3652
|
+
// allDayExpr: "is_all_day",
|
|
3653
3653
|
textExpr: "name"
|
|
3654
3654
|
};
|
|
3655
3655
|
|
|
@@ -3787,7 +3787,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
3787
3787
|
start: n["${calendarOptions.startDateExpr}"],
|
|
3788
3788
|
end: n["${calendarOptions.endDateExpr}"],
|
|
3789
3789
|
allDay: n["${calendarOptions.allDayExpr}"],
|
|
3790
|
-
extendedProps: n
|
|
3790
|
+
extendedProps: n,
|
|
3791
|
+
resourceId: n["${calendarOptions.groups?.[0]}"]
|
|
3791
3792
|
}
|
|
3792
3793
|
});
|
|
3793
3794
|
const successCallback = selfData.successCallback;
|
|
@@ -3834,7 +3835,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
|
|
|
3834
3835
|
};
|
|
3835
3836
|
const saveDataTpl = `
|
|
3836
3837
|
const formData = api.data.$;
|
|
3837
|
-
const objectName = ${object.name}
|
|
3838
|
+
const objectName = "${object.name}";
|
|
3838
3839
|
let query = \`mutation{record: \${objectName}__update(id: "\${formData.${idFieldName}}", doc: {__saveData}){${idFieldName}}}\`;
|
|
3839
3840
|
delete formData.${idFieldName};
|
|
3840
3841
|
let __saveData = JSON.stringify(JSON.stringify(formData));
|
|
@@ -3865,6 +3866,81 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
|
|
|
3865
3866
|
};
|
|
3866
3867
|
}
|
|
3867
3868
|
|
|
3869
|
+
|
|
3870
|
+
function getCalendarResourcesApi(objectSchema, calendarOptions) {
|
|
3871
|
+
const { groups, resources } = calendarOptions;
|
|
3872
|
+
const { color, filters } = resources || {};
|
|
3873
|
+
const groupFieldName = groups[0];
|
|
3874
|
+
const groupField = objectSchema.fields[groupFieldName];
|
|
3875
|
+
let groupObjectName = groupField?.reference_to;
|
|
3876
|
+
if (!groupObjectName){
|
|
3877
|
+
return {};
|
|
3878
|
+
}
|
|
3879
|
+
const fetchFields = [objectSchema.NAME_FIELD_KEY || 'name'];
|
|
3880
|
+
if (color) {
|
|
3881
|
+
fetchFields.push(color);
|
|
3882
|
+
}
|
|
3883
|
+
return {
|
|
3884
|
+
url: `/api/v1/${groupObjectName}?fields=${JSON.stringify(fetchFields)}&filters=${JSON.stringify(filters || [])}`,
|
|
3885
|
+
adaptor: function (payload, response, api, context) {
|
|
3886
|
+
const items = payload?.data?.items || [];
|
|
3887
|
+
const resources = items.map(item => ({
|
|
3888
|
+
id: item._id,
|
|
3889
|
+
title: item.name,
|
|
3890
|
+
eventColor: item.color
|
|
3891
|
+
}));
|
|
3892
|
+
context.successCallback(resources);
|
|
3893
|
+
return payload;
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3898
|
+
async function getEventClickActions(options) {
|
|
3899
|
+
const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
|
|
3900
|
+
let recordId = "${event.id}";
|
|
3901
|
+
const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
|
|
3902
|
+
"recordId": recordId,
|
|
3903
|
+
"data": {
|
|
3904
|
+
...recordPage.schema.data,
|
|
3905
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
3906
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
3907
|
+
"objectName": options.objectName,
|
|
3908
|
+
}
|
|
3909
|
+
}) : {
|
|
3910
|
+
"type": "steedos-record-detail",
|
|
3911
|
+
"objectApiName": options.objectName,
|
|
3912
|
+
"recordId": recordId,
|
|
3913
|
+
"showBackButton": false,
|
|
3914
|
+
"showButtons": true,
|
|
3915
|
+
"data": {
|
|
3916
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
3917
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
3918
|
+
}
|
|
3919
|
+
};
|
|
3920
|
+
return [
|
|
3921
|
+
{
|
|
3922
|
+
"actionType": "drawer",
|
|
3923
|
+
"drawer": {
|
|
3924
|
+
"type": "drawer",
|
|
3925
|
+
"title": " ",
|
|
3926
|
+
"headerClassName": "hidden",
|
|
3927
|
+
"size": "lg",
|
|
3928
|
+
"width": window.drawerWidth || "70%",
|
|
3929
|
+
"bodyClassName": "p-0 m-0 bg-gray-100",
|
|
3930
|
+
"closeOnEsc": true,
|
|
3931
|
+
"closeOnOutside": true,
|
|
3932
|
+
"resizable": true,
|
|
3933
|
+
"actions": [],
|
|
3934
|
+
"body": [
|
|
3935
|
+
drawerRecordDetailSchema
|
|
3936
|
+
],
|
|
3937
|
+
"className": "steedos-record-detail-drawer app-popover"
|
|
3938
|
+
},
|
|
3939
|
+
"preventDefault": true
|
|
3940
|
+
}
|
|
3941
|
+
]
|
|
3942
|
+
}
|
|
3943
|
+
|
|
3868
3944
|
/**
|
|
3869
3945
|
* 列表视图Calendar amisSchema
|
|
3870
3946
|
* @param {*} objectSchema 对象UISchema
|
|
@@ -3884,6 +3960,11 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
3884
3960
|
calendarOptions.allDayExpr,
|
|
3885
3961
|
calendarOptions.textExpr
|
|
3886
3962
|
];
|
|
3963
|
+
const groups = calendarOptions.groups;
|
|
3964
|
+
const groupFieldName = groups?.[0];
|
|
3965
|
+
if (groupFieldName) {
|
|
3966
|
+
titleFields.push(groupFieldName);
|
|
3967
|
+
}
|
|
3887
3968
|
let fields = [];
|
|
3888
3969
|
_$1.each(titleFields, function (n) {
|
|
3889
3970
|
if (objectSchema.fields[n]) {
|
|
@@ -3947,9 +4028,10 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
3947
4028
|
doc["${calendarOptions.endDateExpr}"] = data.end;
|
|
3948
4029
|
doc["${calendarOptions.allDayExpr}"] = data.allDay;
|
|
3949
4030
|
doc["${calendarOptions.textExpr}"] = data.title;
|
|
4031
|
+
if (data.resource) {
|
|
4032
|
+
doc["${groupFieldName}"] = data.resource.id;
|
|
4033
|
+
}
|
|
3950
4034
|
// ObjectForm会认作用域下的变量值
|
|
3951
|
-
// TODO: 待组件支持initValues属性后应该改掉,不应该通过data直接传值
|
|
3952
|
-
// TODO: 全天事件属性传入doc了但是没有生效,需要手动在ObjectForm中勾选全天事件
|
|
3953
4035
|
const title = "${i18next__default["default"].t('frontend_form_new')} ${objectSchema.label}";
|
|
3954
4036
|
doAction(
|
|
3955
4037
|
{
|
|
@@ -3986,39 +4068,6 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
3986
4068
|
});
|
|
3987
4069
|
`;
|
|
3988
4070
|
|
|
3989
|
-
const onEventClickScript = `
|
|
3990
|
-
const data = event.data;
|
|
3991
|
-
const eventData = data.event;
|
|
3992
|
-
const appId = data.appId;
|
|
3993
|
-
const objectName = data.objectName;
|
|
3994
|
-
const eventId = data.event && data.event.id;
|
|
3995
|
-
doAction({
|
|
3996
|
-
"actionType": "link",
|
|
3997
|
-
"args": {
|
|
3998
|
-
"link": "/app/" + appId + "/" + objectName + "/view/" + eventId
|
|
3999
|
-
}
|
|
4000
|
-
});
|
|
4001
|
-
// doAction({
|
|
4002
|
-
// "actionType": "dialog",
|
|
4003
|
-
// "dialog": {
|
|
4004
|
-
// "type": "dialog",
|
|
4005
|
-
// "title": "",
|
|
4006
|
-
// "body": [
|
|
4007
|
-
// {
|
|
4008
|
-
// "type": "steedos-record-detail",
|
|
4009
|
-
// "objectApiName": "\${objectName}",
|
|
4010
|
-
// "recordId": data.event && data.event.id
|
|
4011
|
-
// }
|
|
4012
|
-
// ],
|
|
4013
|
-
// "closeOnEsc": false,
|
|
4014
|
-
// "closeOnOutside": false,
|
|
4015
|
-
// "showCloseButton": true,
|
|
4016
|
-
// "size": "lg",
|
|
4017
|
-
// "actions": []
|
|
4018
|
-
// }
|
|
4019
|
-
// });
|
|
4020
|
-
`;
|
|
4021
|
-
|
|
4022
4071
|
const recordId = "${event.id}";
|
|
4023
4072
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
4024
4073
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
@@ -4035,6 +4084,21 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
4035
4084
|
businessHours.endTime = `${calendarOptions.endDayHour}:00`;
|
|
4036
4085
|
}
|
|
4037
4086
|
|
|
4087
|
+
const moreEvents = {};
|
|
4088
|
+
if (groupFieldName) {
|
|
4089
|
+
moreEvents.getRresources = {
|
|
4090
|
+
"weight": 0,
|
|
4091
|
+
"actions": [
|
|
4092
|
+
{
|
|
4093
|
+
"actionType": "ajax",
|
|
4094
|
+
"args": {
|
|
4095
|
+
"api": getCalendarResourcesApi(objectSchema, calendarOptions)
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
]
|
|
4099
|
+
};
|
|
4100
|
+
}
|
|
4101
|
+
|
|
4038
4102
|
// api.trackExpression="\\\${additionalFilters}";
|
|
4039
4103
|
const onEvent = {
|
|
4040
4104
|
"getEvents": {
|
|
@@ -4079,19 +4143,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
4079
4143
|
},
|
|
4080
4144
|
"eventClick": {
|
|
4081
4145
|
"weight": 0,
|
|
4082
|
-
"actions":
|
|
4083
|
-
{
|
|
4084
|
-
"actionType": "custom",
|
|
4085
|
-
"script": onEventClickScript
|
|
4086
|
-
},
|
|
4087
|
-
// amis 升级到 3.2后,以下的"actionType": "link"方式拿不到appId和objectName了
|
|
4088
|
-
// {
|
|
4089
|
-
// "actionType": "link",
|
|
4090
|
-
// "args": {
|
|
4091
|
-
// "link": "/app/${appId}/${objectName}/view/${event.id}"
|
|
4092
|
-
// }
|
|
4093
|
-
// }
|
|
4094
|
-
]
|
|
4146
|
+
"actions": await getEventClickActions({objectName: objectSchema.name, appId: options.appId, formFactor: options.formFactor})
|
|
4095
4147
|
},
|
|
4096
4148
|
"eventAdd": {
|
|
4097
4149
|
"weight": 0,
|
|
@@ -4130,7 +4182,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
4130
4182
|
"api": recordSaveApi,
|
|
4131
4183
|
"messages": {
|
|
4132
4184
|
"success": objectSchema.label + i18next__default["default"].t('frontend_message_modification_successful'),
|
|
4133
|
-
"failed": objectSchema.label +
|
|
4185
|
+
// "failed": objectSchema.label + i18next.t('frontend_message_modification_failed') //不可以设置请求失败错误信息,否则上面接收适配器中返回的错误信息不会显示
|
|
4134
4186
|
}
|
|
4135
4187
|
}
|
|
4136
4188
|
}
|
|
@@ -4173,7 +4225,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
4173
4225
|
"actionType": "setValue",
|
|
4174
4226
|
}
|
|
4175
4227
|
]
|
|
4176
|
-
}
|
|
4228
|
+
},
|
|
4229
|
+
...moreEvents
|
|
4177
4230
|
};
|
|
4178
4231
|
|
|
4179
4232
|
Object.assign(onEvent, options.onEvent);
|
|
@@ -4205,6 +4258,25 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
4205
4258
|
}
|
|
4206
4259
|
}
|
|
4207
4260
|
|
|
4261
|
+
if (!___default["default"].isEmpty(calendarOptions.groups)) {
|
|
4262
|
+
const headerToolbarViews = "prev,next today resourceTimelineMonth,resourceTimelineWeek,resourceTimelineDay,listWeek";
|
|
4263
|
+
const groupField = objectSchema.fields[groupFieldName];
|
|
4264
|
+
let groupObjectName = groupField?.reference_to;
|
|
4265
|
+
let groupHeaderTitle = "资源";
|
|
4266
|
+
if (groupObjectName){
|
|
4267
|
+
const groupObjectConfig = getUISchemaSync(groupObjectName);
|
|
4268
|
+
groupHeaderTitle = groupObjectConfig?.label || groupHeaderTitle;
|
|
4269
|
+
}
|
|
4270
|
+
Object.assign(config, {
|
|
4271
|
+
// "height": "auto",
|
|
4272
|
+
initialView: 'resourceTimelineWeek',
|
|
4273
|
+
resourceAreaHeaderContent: groupHeaderTitle,
|
|
4274
|
+
"headerToolbar": {
|
|
4275
|
+
"right": headerToolbarViews
|
|
4276
|
+
}
|
|
4277
|
+
});
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4208
4280
|
const amisSchema = {
|
|
4209
4281
|
"type": "steedos-fullcalendar",
|
|
4210
4282
|
"label": "",
|
|
@@ -7568,7 +7640,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
7568
7640
|
"actions": [
|
|
7569
7641
|
{
|
|
7570
7642
|
"actionType": "custom",
|
|
7571
|
-
"script": "const data = event.data; window.open(`/app/${data.app_id}/${data.objectName}/view/${data.recordId}?side_object=${data.side_object}&side_listview_id=${data.side_listview_id}`)"
|
|
7643
|
+
"script": "const data = event.data; window.open(`/app/${data.app_id || '-'}/${data.objectName}/view/${data.recordId}?side_object=${data.side_object}&side_listview_id=${data.side_listview_id}`)"
|
|
7572
7644
|
}
|
|
7573
7645
|
]
|
|
7574
7646
|
}
|
|
@@ -10357,7 +10429,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
10357
10429
|
* @Author: baozhoutao@steedos.com
|
|
10358
10430
|
* @Date: 2022-07-05 15:55:39
|
|
10359
10431
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
10360
|
-
* @LastEditTime: 2025-
|
|
10432
|
+
* @LastEditTime: 2025-12-02 15:56:17
|
|
10361
10433
|
* @Description:
|
|
10362
10434
|
*/
|
|
10363
10435
|
|
|
@@ -10556,6 +10628,80 @@ async function getFormSchema(objectName, ctx) {
|
|
|
10556
10628
|
};
|
|
10557
10629
|
}
|
|
10558
10630
|
|
|
10631
|
+
/**
|
|
10632
|
+
* 合并 calendar_ 开头的属性与 options 属性,以 options 属性为优先。
|
|
10633
|
+
* @param {object} listView 列表视图配置对象
|
|
10634
|
+
* @returns {object} 合并后的日历配置选项
|
|
10635
|
+
*/
|
|
10636
|
+
function getCalendarOptions(listView) {
|
|
10637
|
+
const calendarDefaults = {};
|
|
10638
|
+
|
|
10639
|
+
if (listView.calendar_start_field) {
|
|
10640
|
+
calendarDefaults.startDateExpr = listView.calendar_start_field;
|
|
10641
|
+
}
|
|
10642
|
+
if (listView.calendar_end_field) {
|
|
10643
|
+
calendarDefaults.endDateExpr = listView.calendar_end_field;
|
|
10644
|
+
}
|
|
10645
|
+
if (listView.calendar_all_day_field) {
|
|
10646
|
+
calendarDefaults.allDayExpr = listView.calendar_all_day_field;
|
|
10647
|
+
}
|
|
10648
|
+
if (listView.calendar_text_field) {
|
|
10649
|
+
calendarDefaults.textExpr = listView.calendar_text_field;
|
|
10650
|
+
}
|
|
10651
|
+
|
|
10652
|
+
if (listView.calendar_current_view) {
|
|
10653
|
+
calendarDefaults.currentView = listView.calendar_current_view;
|
|
10654
|
+
}
|
|
10655
|
+
// if (listView.calendar_views) {
|
|
10656
|
+
// calendarDefaults.views = listView.calendar_views;
|
|
10657
|
+
// }
|
|
10658
|
+
|
|
10659
|
+
if (listView.calendar_group_field) {
|
|
10660
|
+
calendarDefaults.groups = [listView.calendar_group_field];
|
|
10661
|
+
}
|
|
10662
|
+
|
|
10663
|
+
const resourceDefaults = {};
|
|
10664
|
+
if (listView.calendar_resource_color_field) {
|
|
10665
|
+
resourceDefaults.color = listView.calendar_resource_color_field;
|
|
10666
|
+
}
|
|
10667
|
+
if (listView.calendar_resource_filters) {
|
|
10668
|
+
resourceDefaults.filters = listView.calendar_resource_filters;
|
|
10669
|
+
}
|
|
10670
|
+
if (listView.calendar_resource_sort) {
|
|
10671
|
+
resourceDefaults.sort = listView.calendar_resource_sort;
|
|
10672
|
+
}
|
|
10673
|
+
|
|
10674
|
+
if (Object.keys(resourceDefaults).length > 0) {
|
|
10675
|
+
calendarDefaults.resources = resourceDefaults;
|
|
10676
|
+
}
|
|
10677
|
+
|
|
10678
|
+
// 第一次合并:将 calendarDefaults 作为默认值,listView.options 作为高优先级配置
|
|
10679
|
+
let mergedOptions = {
|
|
10680
|
+
...calendarDefaults,
|
|
10681
|
+
...listView.options
|
|
10682
|
+
};
|
|
10683
|
+
|
|
10684
|
+
// 第二次合并:深度合并 'resources' 属性(如果两者都有定义)
|
|
10685
|
+
// 确保 options 内部的 resources 属性优先于 calendar_resource_... 属性
|
|
10686
|
+
const defaultResources = calendarDefaults.resources;
|
|
10687
|
+
const optionResources = listView.options?.resources;
|
|
10688
|
+
|
|
10689
|
+
if (defaultResources && optionResources) {
|
|
10690
|
+
mergedOptions.resources = {
|
|
10691
|
+
...defaultResources, // 默认的资源属性(如 color)
|
|
10692
|
+
...optionResources // options中指定的资源属性(如 sort)
|
|
10693
|
+
};
|
|
10694
|
+
}
|
|
10695
|
+
|
|
10696
|
+
if (listView.type !== "timeline") {
|
|
10697
|
+
// 只有资源视图才显示分资源分组的模式
|
|
10698
|
+
delete mergedOptions.groups;
|
|
10699
|
+
delete mergedOptions.resources;
|
|
10700
|
+
}
|
|
10701
|
+
|
|
10702
|
+
return mergedOptions;
|
|
10703
|
+
}
|
|
10704
|
+
|
|
10559
10705
|
// 获取只读页面 recordId 已废弃, 函数签名保持不变, 但recordId变量不可再使用, 请使用运行时的${recordId}
|
|
10560
10706
|
async function getViewSchema(objectName, recordId, ctx) {
|
|
10561
10707
|
const uiSchema = await getUISchema(objectName);
|
|
@@ -10610,14 +10756,15 @@ async function getListSchema(
|
|
|
10610
10756
|
let listviewFilter = getListViewFilter(listView);
|
|
10611
10757
|
let listview_filters = listView && listView._filters;
|
|
10612
10758
|
// 返回 calendar 组件
|
|
10613
|
-
if(listView.type === "calendar"){
|
|
10759
|
+
if(listView.type === "calendar" || listView.type === "timeline"){
|
|
10760
|
+
const calendarOptions = getCalendarOptions(listView);
|
|
10614
10761
|
const amisSchema = {
|
|
10615
10762
|
"type": "steedos-object-calendar",
|
|
10616
10763
|
"objectApiName": objectName,
|
|
10617
10764
|
"filters": listviewFilter,
|
|
10618
10765
|
"filtersFunction": listview_filters,
|
|
10619
10766
|
"sort": sort,
|
|
10620
|
-
...
|
|
10767
|
+
...calendarOptions
|
|
10621
10768
|
};
|
|
10622
10769
|
return {
|
|
10623
10770
|
uiSchema,
|
|
@@ -17036,6 +17183,7 @@ const getNextStepUsersInput = async (instance, nextStepUserChangeEvents) => {
|
|
|
17036
17183
|
type: "steedos-select-user",
|
|
17037
17184
|
label: "",
|
|
17038
17185
|
name: "next_users",
|
|
17186
|
+
id: "u:next_users",
|
|
17039
17187
|
hiddenOn: "this.new_next_step.deal_type != 'pickupAtRuntime' || this.new_next_step.step_type == 'counterSign'",
|
|
17040
17188
|
required: true,
|
|
17041
17189
|
"onEvent": {
|
|
@@ -17051,6 +17199,7 @@ const getNextStepUsersInput = async (instance, nextStepUserChangeEvents) => {
|
|
|
17051
17199
|
type: "steedos-select-user",
|
|
17052
17200
|
label: "",
|
|
17053
17201
|
name: "next_users",
|
|
17202
|
+
id: "u:next_users",
|
|
17054
17203
|
hiddenOn: "this.new_next_step.deal_type != 'pickupAtRuntime' || this.new_next_step.step_type != 'counterSign'",
|
|
17055
17204
|
required: true,
|
|
17056
17205
|
multiple: true,
|