@steedos-widgets/amis-lib 1.1.0 → 1.1.1
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 +156 -142
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +156 -142
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +156 -142
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/calendar.d.ts +1 -147
- package/dist/types/lib/objects.d.ts +1 -147
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -3941,6 +3941,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
3941
3941
|
`;
|
|
3942
3942
|
source.adaptor = `
|
|
3943
3943
|
const enable_tree = ${refObjectConfig.enable_tree};
|
|
3944
|
+
const value = api.data.$self.value;
|
|
3945
|
+
if(!_.isEmpty(value)){
|
|
3946
|
+
// value 不为空值,表示返回当前选中节点信息
|
|
3947
|
+
return payload;
|
|
3948
|
+
}
|
|
3944
3949
|
if(enable_tree){
|
|
3945
3950
|
const records = payload.data.rows;
|
|
3946
3951
|
const treeRecords = [];
|
|
@@ -6608,7 +6613,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6608
6613
|
const searchableFields = [];
|
|
6609
6614
|
let { filter, sort, top, setDataToComponentId = '' } = options;
|
|
6610
6615
|
|
|
6611
|
-
if(!top){
|
|
6616
|
+
if (!top) {
|
|
6612
6617
|
// 日历请求不翻页
|
|
6613
6618
|
top = 200;
|
|
6614
6619
|
}
|
|
@@ -6734,7 +6739,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6734
6739
|
title: n["${calendarOptions.textExpr}"],
|
|
6735
6740
|
start: n["${calendarOptions.startDateExpr}"],
|
|
6736
6741
|
end: n["${calendarOptions.endDateExpr}"],
|
|
6737
|
-
allDay: n["${calendarOptions.allDayExpr}"]
|
|
6742
|
+
allDay: n["${calendarOptions.allDayExpr}"],
|
|
6743
|
+
extendedProps: n
|
|
6738
6744
|
}
|
|
6739
6745
|
});
|
|
6740
6746
|
const successCallback = selfData.successCallback;
|
|
@@ -6807,7 +6813,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
|
|
|
6807
6813
|
return payload;
|
|
6808
6814
|
`,
|
|
6809
6815
|
headers: {
|
|
6810
|
-
|
|
6816
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
6811
6817
|
}
|
|
6812
6818
|
};
|
|
6813
6819
|
}
|
|
@@ -6826,9 +6832,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6826
6832
|
calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, omitBy(calendarOptions, isNil));
|
|
6827
6833
|
|
|
6828
6834
|
const titleFields = calendarOptions.title || [
|
|
6829
|
-
calendarOptions.startDateExpr,
|
|
6830
|
-
calendarOptions.endDateExpr,
|
|
6831
|
-
calendarOptions.allDayExpr,
|
|
6835
|
+
calendarOptions.startDateExpr,
|
|
6836
|
+
calendarOptions.endDateExpr,
|
|
6837
|
+
calendarOptions.allDayExpr,
|
|
6832
6838
|
calendarOptions.textExpr
|
|
6833
6839
|
];
|
|
6834
6840
|
let fields = [];
|
|
@@ -6852,9 +6858,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6852
6858
|
}
|
|
6853
6859
|
}
|
|
6854
6860
|
let initialView = calendarOptions.currentView;
|
|
6855
|
-
if(initialView){
|
|
6861
|
+
if (initialView) {
|
|
6856
6862
|
// day, week, month, agenda
|
|
6857
|
-
switch(initialView){
|
|
6863
|
+
switch (initialView) {
|
|
6858
6864
|
case "day":
|
|
6859
6865
|
initialView = "timeGridDay";
|
|
6860
6866
|
break;
|
|
@@ -6961,19 +6967,154 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6961
6967
|
const recordId = "${event.id}";
|
|
6962
6968
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
6963
6969
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
6964
|
-
|
|
6970
|
+
|
|
6965
6971
|
const businessHours = {
|
|
6966
|
-
daysOfWeek: [
|
|
6972
|
+
daysOfWeek: [1, 2, 3, 4, 5],
|
|
6967
6973
|
startTime: '08:00',
|
|
6968
6974
|
endTime: '18:00',
|
|
6969
6975
|
};
|
|
6970
|
-
if(!isEmpty(calendarOptions.startDayHour)){
|
|
6976
|
+
if (!isEmpty(calendarOptions.startDayHour)) {
|
|
6971
6977
|
businessHours.startTime = `${calendarOptions.startDayHour}:00`;
|
|
6972
6978
|
}
|
|
6973
|
-
if(!isEmpty(calendarOptions.endDayHour)){
|
|
6979
|
+
if (!isEmpty(calendarOptions.endDayHour)) {
|
|
6974
6980
|
businessHours.endTime = `${calendarOptions.endDayHour}:00`;
|
|
6975
6981
|
}
|
|
6976
|
-
|
|
6982
|
+
|
|
6983
|
+
const onEvent = {
|
|
6984
|
+
"getEvents": {
|
|
6985
|
+
"weight": 0,
|
|
6986
|
+
"actions": [
|
|
6987
|
+
{
|
|
6988
|
+
"componentId": "",
|
|
6989
|
+
"args": {
|
|
6990
|
+
},
|
|
6991
|
+
"actionType": "custom",
|
|
6992
|
+
"script": onGetEventsScript
|
|
6993
|
+
}
|
|
6994
|
+
]
|
|
6995
|
+
},
|
|
6996
|
+
"select": {
|
|
6997
|
+
"weight": 0,
|
|
6998
|
+
"actions": [
|
|
6999
|
+
{
|
|
7000
|
+
"componentId": "",
|
|
7001
|
+
"args": {
|
|
7002
|
+
},
|
|
7003
|
+
"actionType": "custom",
|
|
7004
|
+
"script": onSelectScript
|
|
7005
|
+
}
|
|
7006
|
+
]
|
|
7007
|
+
},
|
|
7008
|
+
"eventClick": {
|
|
7009
|
+
"weight": 0,
|
|
7010
|
+
"actions": [
|
|
7011
|
+
{
|
|
7012
|
+
"componentId": "",
|
|
7013
|
+
"args": {
|
|
7014
|
+
},
|
|
7015
|
+
"actionType": "custom",
|
|
7016
|
+
"script": onEventClickScript
|
|
7017
|
+
}
|
|
7018
|
+
]
|
|
7019
|
+
},
|
|
7020
|
+
"eventAdd": {
|
|
7021
|
+
"weight": 0,
|
|
7022
|
+
"actions": [
|
|
7023
|
+
{
|
|
7024
|
+
"componentId": "",
|
|
7025
|
+
"args": {
|
|
7026
|
+
},
|
|
7027
|
+
"actionType": "custom",
|
|
7028
|
+
"script": "console.log('eventAdd'); console.log(event);"
|
|
7029
|
+
}
|
|
7030
|
+
]
|
|
7031
|
+
},
|
|
7032
|
+
"eventChange": {
|
|
7033
|
+
"weight": 0,
|
|
7034
|
+
"actions": [
|
|
7035
|
+
{
|
|
7036
|
+
"actionType": 'ajax',
|
|
7037
|
+
"args": {
|
|
7038
|
+
"api": recordPermissionsApi
|
|
7039
|
+
}
|
|
7040
|
+
},
|
|
7041
|
+
{
|
|
7042
|
+
"actionType": "toast",
|
|
7043
|
+
"expression": "!event.data.editable",
|
|
7044
|
+
"args": {
|
|
7045
|
+
"msgType": "error",
|
|
7046
|
+
"msg": "您没有编辑该记录的权限!",
|
|
7047
|
+
"position": "top-center"
|
|
7048
|
+
}
|
|
7049
|
+
},
|
|
7050
|
+
{
|
|
7051
|
+
"actionType": 'ajax',
|
|
7052
|
+
"expression": "event.data.editable",
|
|
7053
|
+
"args": {
|
|
7054
|
+
"api": recordSaveApi,
|
|
7055
|
+
"messages": {
|
|
7056
|
+
"success": objectSchema.label + "修改成功",
|
|
7057
|
+
"failed": objectSchema.label + "修改失败!"
|
|
7058
|
+
}
|
|
7059
|
+
}
|
|
7060
|
+
}
|
|
7061
|
+
]
|
|
7062
|
+
},
|
|
7063
|
+
"eventRemove": {
|
|
7064
|
+
"weight": 0,
|
|
7065
|
+
"actions": [
|
|
7066
|
+
{
|
|
7067
|
+
"componentId": "",
|
|
7068
|
+
"args": {
|
|
7069
|
+
},
|
|
7070
|
+
"actionType": "custom",
|
|
7071
|
+
"script": "console.log('eventRemove'); console.log(event);"
|
|
7072
|
+
}
|
|
7073
|
+
]
|
|
7074
|
+
},
|
|
7075
|
+
"eventsSet": {
|
|
7076
|
+
"weight": 0,
|
|
7077
|
+
"actions": [
|
|
7078
|
+
{
|
|
7079
|
+
"componentId": "",
|
|
7080
|
+
"args": {
|
|
7081
|
+
},
|
|
7082
|
+
"actionType": "custom",
|
|
7083
|
+
"script": "console.log('eventsSet'); console.log(event);"
|
|
7084
|
+
}
|
|
7085
|
+
]
|
|
7086
|
+
}
|
|
7087
|
+
};
|
|
7088
|
+
|
|
7089
|
+
Object.assign(onEvent, options.onEvent);
|
|
7090
|
+
|
|
7091
|
+
const config = options.config || {};
|
|
7092
|
+
if(config.eventContent && typeof config.eventContent === "string"){
|
|
7093
|
+
const hasReturn = /\breturn\b/.test(config.eventContent);
|
|
7094
|
+
if(hasReturn){
|
|
7095
|
+
try {
|
|
7096
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7097
|
+
let fn = new Function("arg", config.eventContent);
|
|
7098
|
+
config.eventContent = fn;
|
|
7099
|
+
} catch (e) {
|
|
7100
|
+
console.warn(e);
|
|
7101
|
+
}
|
|
7102
|
+
}
|
|
7103
|
+
}
|
|
7104
|
+
|
|
7105
|
+
if(config.noEventsContent && typeof config.noEventsContent === "string"){
|
|
7106
|
+
const hasReturn = /\breturn\b/.test(config.noEventsContent);
|
|
7107
|
+
if(hasReturn){
|
|
7108
|
+
try {
|
|
7109
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7110
|
+
let fn = new Function("arg", config.noEventsContent);
|
|
7111
|
+
config.noEventsContent = fn;
|
|
7112
|
+
} catch (e) {
|
|
7113
|
+
console.warn(e);
|
|
7114
|
+
}
|
|
7115
|
+
}
|
|
7116
|
+
}
|
|
7117
|
+
|
|
6977
7118
|
const amisSchema = {
|
|
6978
7119
|
"type": "steedos-fullcalendar",
|
|
6979
7120
|
"label": "",
|
|
@@ -6983,135 +7124,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6983
7124
|
"selectMirror": permissions.allowCreate,
|
|
6984
7125
|
"initialView": initialView,
|
|
6985
7126
|
"businessHours": businessHours,
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
"weight": 0,
|
|
6989
|
-
"actions": [
|
|
6990
|
-
{
|
|
6991
|
-
"componentId": "",
|
|
6992
|
-
"args": {
|
|
6993
|
-
},
|
|
6994
|
-
"actionType": "custom",
|
|
6995
|
-
"script": onGetEventsScript
|
|
6996
|
-
}
|
|
6997
|
-
]
|
|
6998
|
-
},
|
|
6999
|
-
"select": {
|
|
7000
|
-
"weight": 0,
|
|
7001
|
-
"actions": [
|
|
7002
|
-
{
|
|
7003
|
-
"componentId": "",
|
|
7004
|
-
"args": {
|
|
7005
|
-
},
|
|
7006
|
-
"actionType": "custom",
|
|
7007
|
-
"script": onSelectScript
|
|
7008
|
-
}
|
|
7009
|
-
]
|
|
7010
|
-
},
|
|
7011
|
-
"eventClick": {
|
|
7012
|
-
"weight": 0,
|
|
7013
|
-
"actions": [
|
|
7014
|
-
{
|
|
7015
|
-
"componentId": "",
|
|
7016
|
-
"args": {
|
|
7017
|
-
},
|
|
7018
|
-
"actionType": "custom",
|
|
7019
|
-
"script": onEventClickScript
|
|
7020
|
-
}
|
|
7021
|
-
]
|
|
7022
|
-
},
|
|
7023
|
-
"eventAdd": {
|
|
7024
|
-
"weight": 0,
|
|
7025
|
-
"actions": [
|
|
7026
|
-
{
|
|
7027
|
-
"componentId": "",
|
|
7028
|
-
"args": {
|
|
7029
|
-
},
|
|
7030
|
-
"actionType": "custom",
|
|
7031
|
-
"script": "console.log('eventAdd'); console.log(event);"
|
|
7032
|
-
}
|
|
7033
|
-
]
|
|
7034
|
-
},
|
|
7035
|
-
"eventChange": {
|
|
7036
|
-
"weight": 0,
|
|
7037
|
-
"actions": [
|
|
7038
|
-
{
|
|
7039
|
-
"actionType": 'ajax',
|
|
7040
|
-
"args": {
|
|
7041
|
-
"api": recordPermissionsApi
|
|
7042
|
-
}
|
|
7043
|
-
},
|
|
7044
|
-
{
|
|
7045
|
-
"actionType": "toast",
|
|
7046
|
-
"expression": "!event.data.editable",
|
|
7047
|
-
"args": {
|
|
7048
|
-
"msgType": "error",
|
|
7049
|
-
"msg": "您没有编辑该记录的权限!",
|
|
7050
|
-
"position": "top-center"
|
|
7051
|
-
}
|
|
7052
|
-
},
|
|
7053
|
-
{
|
|
7054
|
-
"actionType": 'ajax',
|
|
7055
|
-
"expression": "event.data.editable",
|
|
7056
|
-
"args": {
|
|
7057
|
-
"api": recordSaveApi,
|
|
7058
|
-
"messages": {
|
|
7059
|
-
"success": objectSchema.label + "修改成功",
|
|
7060
|
-
"failed": objectSchema.label + "修改失败!"
|
|
7061
|
-
}
|
|
7062
|
-
}
|
|
7063
|
-
}
|
|
7064
|
-
]
|
|
7065
|
-
},
|
|
7066
|
-
"eventRemove": {
|
|
7067
|
-
"weight": 0,
|
|
7068
|
-
"actions": [
|
|
7069
|
-
{
|
|
7070
|
-
"componentId": "",
|
|
7071
|
-
"args": {
|
|
7072
|
-
},
|
|
7073
|
-
"actionType": "custom",
|
|
7074
|
-
"script": "console.log('eventRemove'); console.log(event);"
|
|
7075
|
-
}
|
|
7076
|
-
]
|
|
7077
|
-
},
|
|
7078
|
-
"eventsSet": {
|
|
7079
|
-
"weight": 0,
|
|
7080
|
-
"actions": [
|
|
7081
|
-
{
|
|
7082
|
-
"componentId": "",
|
|
7083
|
-
"args": {
|
|
7084
|
-
},
|
|
7085
|
-
"actionType": "custom",
|
|
7086
|
-
"script": "console.log('eventsSet'); console.log(event);"
|
|
7087
|
-
}
|
|
7088
|
-
]
|
|
7089
|
-
},
|
|
7090
|
-
"eventDidMount": {
|
|
7091
|
-
"weight": 0,
|
|
7092
|
-
"actions": [
|
|
7093
|
-
{
|
|
7094
|
-
"componentId": "",
|
|
7095
|
-
"args": {
|
|
7096
|
-
},
|
|
7097
|
-
"actionType": "custom",
|
|
7098
|
-
"script": "console.log('eventDidMount'); console.log(event);"
|
|
7099
|
-
}
|
|
7100
|
-
]
|
|
7101
|
-
},
|
|
7102
|
-
"eventWillUnmount": {
|
|
7103
|
-
"weight": 0,
|
|
7104
|
-
"actions": [
|
|
7105
|
-
{
|
|
7106
|
-
"componentId": "",
|
|
7107
|
-
"args": {
|
|
7108
|
-
},
|
|
7109
|
-
"actionType": "custom",
|
|
7110
|
-
"script": "console.log('eventWillUnmount'); console.log(event);"
|
|
7111
|
-
}
|
|
7112
|
-
]
|
|
7113
|
-
},
|
|
7114
|
-
}
|
|
7127
|
+
...config,
|
|
7128
|
+
"onEvent": onEvent
|
|
7115
7129
|
};
|
|
7116
7130
|
return amisSchema;
|
|
7117
7131
|
}
|