@steedos-widgets/amis-lib 1.1.3-beta.7 → 1.1.3
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 +191 -146
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +191 -146
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +191 -146
- 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/dist/types/schema/standard_delete.amis.d.ts +14 -0
- package/dist/types/schema/standard_new.amis.d.ts +1 -0
- package/dist/types/standard/button.d.ts +15 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1390,8 +1390,8 @@ var config = {
|
|
|
1390
1390
|
/*
|
|
1391
1391
|
* @Author: baozhoutao@steedos.com
|
|
1392
1392
|
* @Date: 2022-11-01 15:51:00
|
|
1393
|
-
* @LastEditors:
|
|
1394
|
-
* @LastEditTime: 2023-03-
|
|
1393
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1394
|
+
* @LastEditTime: 2023-03-27 15:42:24
|
|
1395
1395
|
* @Description:
|
|
1396
1396
|
*/
|
|
1397
1397
|
|
|
@@ -1431,6 +1431,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1431
1431
|
"type": "dialog",
|
|
1432
1432
|
"data": {
|
|
1433
1433
|
"$master": "$$",
|
|
1434
|
+
"_master": "${_master}",
|
|
1434
1435
|
"defaultData": "${defaultData}",
|
|
1435
1436
|
"appId": "${appId}",
|
|
1436
1437
|
"objectName": "${objectName}",
|
|
@@ -1502,8 +1503,8 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
1502
1503
|
/*
|
|
1503
1504
|
* @Author: baozhoutao@steedos.com
|
|
1504
1505
|
* @Date: 2022-11-01 15:49:58
|
|
1505
|
-
* @LastEditors:
|
|
1506
|
-
* @LastEditTime:
|
|
1506
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1507
|
+
* @LastEditTime: 2023-03-27 11:36:49
|
|
1507
1508
|
* @Description:
|
|
1508
1509
|
*/
|
|
1509
1510
|
|
|
@@ -1569,6 +1570,12 @@ const getSchema$3 = async (uiSchema, ctx) => {
|
|
|
1569
1570
|
};
|
|
1570
1571
|
};
|
|
1571
1572
|
|
|
1573
|
+
/*
|
|
1574
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
1575
|
+
* @Date: 2023-03-22 09:31:21
|
|
1576
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1577
|
+
* @LastEditTime: 2023-03-27 16:03:34
|
|
1578
|
+
*/
|
|
1572
1579
|
const getSchema$2 = (uiSchema)=>{
|
|
1573
1580
|
return {
|
|
1574
1581
|
"type": "service",
|
|
@@ -1619,6 +1626,16 @@ const getSchema$2 = (uiSchema)=>{
|
|
|
1619
1626
|
"objectName": `${uiSchema.name}`,
|
|
1620
1627
|
"__deletedRecord": true
|
|
1621
1628
|
}
|
|
1629
|
+
},
|
|
1630
|
+
{
|
|
1631
|
+
"actionType": "broadcast",
|
|
1632
|
+
"args": {
|
|
1633
|
+
"eventName": "@data.changed.${_master.objectName}"
|
|
1634
|
+
},
|
|
1635
|
+
"data": {
|
|
1636
|
+
"objectName": "${_master.objectName}"
|
|
1637
|
+
},
|
|
1638
|
+
"expression": "${_master.objectName}"
|
|
1622
1639
|
}
|
|
1623
1640
|
]
|
|
1624
1641
|
}
|
|
@@ -3968,6 +3985,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
3968
3985
|
`;
|
|
3969
3986
|
source.adaptor = `
|
|
3970
3987
|
const enable_tree = ${refObjectConfig.enable_tree};
|
|
3988
|
+
const op = api.data.$self.op;
|
|
3989
|
+
if(!_.isEmpty(op)){
|
|
3990
|
+
// op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
|
|
3991
|
+
const rows = _.map(payload.data.rows, (item)=>{
|
|
3992
|
+
return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
|
|
3993
|
+
})
|
|
3994
|
+
payload.data.rows = rows;
|
|
3995
|
+
return payload;
|
|
3996
|
+
}
|
|
3971
3997
|
if(enable_tree){
|
|
3972
3998
|
const records = payload.data.rows;
|
|
3973
3999
|
const treeRecords = [];
|
|
@@ -5844,6 +5870,16 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
5844
5870
|
"data": {
|
|
5845
5871
|
"objectName": `${objectSchema.name}`
|
|
5846
5872
|
}
|
|
5873
|
+
},
|
|
5874
|
+
{
|
|
5875
|
+
"actionType": "broadcast",
|
|
5876
|
+
"args": {
|
|
5877
|
+
"eventName": "@data.changed.${_master.objectName}"
|
|
5878
|
+
},
|
|
5879
|
+
"data": {
|
|
5880
|
+
"objectName": "${_master.objectName}"
|
|
5881
|
+
},
|
|
5882
|
+
"expression": "${_master.objectName}"
|
|
5847
5883
|
}
|
|
5848
5884
|
]
|
|
5849
5885
|
}
|
|
@@ -6635,7 +6671,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6635
6671
|
const searchableFields = [];
|
|
6636
6672
|
let { filter, sort, top, setDataToComponentId = '' } = options;
|
|
6637
6673
|
|
|
6638
|
-
if(!top){
|
|
6674
|
+
if (!top) {
|
|
6639
6675
|
// 日历请求不翻页
|
|
6640
6676
|
top = 200;
|
|
6641
6677
|
}
|
|
@@ -6761,7 +6797,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6761
6797
|
title: n["${calendarOptions.textExpr}"],
|
|
6762
6798
|
start: n["${calendarOptions.startDateExpr}"],
|
|
6763
6799
|
end: n["${calendarOptions.endDateExpr}"],
|
|
6764
|
-
allDay: n["${calendarOptions.allDayExpr}"]
|
|
6800
|
+
allDay: n["${calendarOptions.allDayExpr}"],
|
|
6801
|
+
extendedProps: n
|
|
6765
6802
|
}
|
|
6766
6803
|
});
|
|
6767
6804
|
const successCallback = selfData.successCallback;
|
|
@@ -6834,7 +6871,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
|
|
|
6834
6871
|
return payload;
|
|
6835
6872
|
`,
|
|
6836
6873
|
headers: {
|
|
6837
|
-
|
|
6874
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
6838
6875
|
}
|
|
6839
6876
|
};
|
|
6840
6877
|
}
|
|
@@ -6853,9 +6890,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6853
6890
|
calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, _$1.omitBy(calendarOptions, _$1.isNil));
|
|
6854
6891
|
|
|
6855
6892
|
const titleFields = calendarOptions.title || [
|
|
6856
|
-
calendarOptions.startDateExpr,
|
|
6857
|
-
calendarOptions.endDateExpr,
|
|
6858
|
-
calendarOptions.allDayExpr,
|
|
6893
|
+
calendarOptions.startDateExpr,
|
|
6894
|
+
calendarOptions.endDateExpr,
|
|
6895
|
+
calendarOptions.allDayExpr,
|
|
6859
6896
|
calendarOptions.textExpr
|
|
6860
6897
|
];
|
|
6861
6898
|
let fields = [];
|
|
@@ -6879,9 +6916,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6879
6916
|
}
|
|
6880
6917
|
}
|
|
6881
6918
|
let initialView = calendarOptions.currentView;
|
|
6882
|
-
if(initialView){
|
|
6919
|
+
if (initialView) {
|
|
6883
6920
|
// day, week, month, agenda
|
|
6884
|
-
switch(initialView){
|
|
6921
|
+
switch (initialView) {
|
|
6885
6922
|
case "day":
|
|
6886
6923
|
initialView = "timeGridDay";
|
|
6887
6924
|
break;
|
|
@@ -6988,19 +7025,154 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6988
7025
|
const recordId = "${event.id}";
|
|
6989
7026
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
6990
7027
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
6991
|
-
|
|
7028
|
+
|
|
6992
7029
|
const businessHours = {
|
|
6993
|
-
daysOfWeek: [
|
|
7030
|
+
daysOfWeek: [1, 2, 3, 4, 5],
|
|
6994
7031
|
startTime: '08:00',
|
|
6995
7032
|
endTime: '18:00',
|
|
6996
7033
|
};
|
|
6997
|
-
if(!_$1.isEmpty(calendarOptions.startDayHour)){
|
|
7034
|
+
if (!_$1.isEmpty(calendarOptions.startDayHour)) {
|
|
6998
7035
|
businessHours.startTime = `${calendarOptions.startDayHour}:00`;
|
|
6999
7036
|
}
|
|
7000
|
-
if(!_$1.isEmpty(calendarOptions.endDayHour)){
|
|
7037
|
+
if (!_$1.isEmpty(calendarOptions.endDayHour)) {
|
|
7001
7038
|
businessHours.endTime = `${calendarOptions.endDayHour}:00`;
|
|
7002
7039
|
}
|
|
7003
|
-
|
|
7040
|
+
|
|
7041
|
+
const onEvent = {
|
|
7042
|
+
"getEvents": {
|
|
7043
|
+
"weight": 0,
|
|
7044
|
+
"actions": [
|
|
7045
|
+
{
|
|
7046
|
+
"componentId": "",
|
|
7047
|
+
"args": {
|
|
7048
|
+
},
|
|
7049
|
+
"actionType": "custom",
|
|
7050
|
+
"script": onGetEventsScript
|
|
7051
|
+
}
|
|
7052
|
+
]
|
|
7053
|
+
},
|
|
7054
|
+
"select": {
|
|
7055
|
+
"weight": 0,
|
|
7056
|
+
"actions": [
|
|
7057
|
+
{
|
|
7058
|
+
"componentId": "",
|
|
7059
|
+
"args": {
|
|
7060
|
+
},
|
|
7061
|
+
"actionType": "custom",
|
|
7062
|
+
"script": onSelectScript
|
|
7063
|
+
}
|
|
7064
|
+
]
|
|
7065
|
+
},
|
|
7066
|
+
"eventClick": {
|
|
7067
|
+
"weight": 0,
|
|
7068
|
+
"actions": [
|
|
7069
|
+
{
|
|
7070
|
+
"componentId": "",
|
|
7071
|
+
"args": {
|
|
7072
|
+
},
|
|
7073
|
+
"actionType": "custom",
|
|
7074
|
+
"script": onEventClickScript
|
|
7075
|
+
}
|
|
7076
|
+
]
|
|
7077
|
+
},
|
|
7078
|
+
"eventAdd": {
|
|
7079
|
+
"weight": 0,
|
|
7080
|
+
"actions": [
|
|
7081
|
+
{
|
|
7082
|
+
"componentId": "",
|
|
7083
|
+
"args": {
|
|
7084
|
+
},
|
|
7085
|
+
"actionType": "custom",
|
|
7086
|
+
"script": "console.log('eventAdd'); console.log(event);"
|
|
7087
|
+
}
|
|
7088
|
+
]
|
|
7089
|
+
},
|
|
7090
|
+
"eventChange": {
|
|
7091
|
+
"weight": 0,
|
|
7092
|
+
"actions": [
|
|
7093
|
+
{
|
|
7094
|
+
"actionType": 'ajax',
|
|
7095
|
+
"args": {
|
|
7096
|
+
"api": recordPermissionsApi
|
|
7097
|
+
}
|
|
7098
|
+
},
|
|
7099
|
+
{
|
|
7100
|
+
"actionType": "toast",
|
|
7101
|
+
"expression": "!event.data.editable",
|
|
7102
|
+
"args": {
|
|
7103
|
+
"msgType": "error",
|
|
7104
|
+
"msg": "您没有编辑该记录的权限!",
|
|
7105
|
+
"position": "top-center"
|
|
7106
|
+
}
|
|
7107
|
+
},
|
|
7108
|
+
{
|
|
7109
|
+
"actionType": 'ajax',
|
|
7110
|
+
"expression": "event.data.editable",
|
|
7111
|
+
"args": {
|
|
7112
|
+
"api": recordSaveApi,
|
|
7113
|
+
"messages": {
|
|
7114
|
+
"success": objectSchema.label + "修改成功",
|
|
7115
|
+
"failed": objectSchema.label + "修改失败!"
|
|
7116
|
+
}
|
|
7117
|
+
}
|
|
7118
|
+
}
|
|
7119
|
+
]
|
|
7120
|
+
},
|
|
7121
|
+
"eventRemove": {
|
|
7122
|
+
"weight": 0,
|
|
7123
|
+
"actions": [
|
|
7124
|
+
{
|
|
7125
|
+
"componentId": "",
|
|
7126
|
+
"args": {
|
|
7127
|
+
},
|
|
7128
|
+
"actionType": "custom",
|
|
7129
|
+
"script": "console.log('eventRemove'); console.log(event);"
|
|
7130
|
+
}
|
|
7131
|
+
]
|
|
7132
|
+
},
|
|
7133
|
+
"eventsSet": {
|
|
7134
|
+
"weight": 0,
|
|
7135
|
+
"actions": [
|
|
7136
|
+
{
|
|
7137
|
+
"componentId": "",
|
|
7138
|
+
"args": {
|
|
7139
|
+
},
|
|
7140
|
+
"actionType": "custom",
|
|
7141
|
+
"script": "console.log('eventsSet'); console.log(event);"
|
|
7142
|
+
}
|
|
7143
|
+
]
|
|
7144
|
+
}
|
|
7145
|
+
};
|
|
7146
|
+
|
|
7147
|
+
Object.assign(onEvent, options.onEvent);
|
|
7148
|
+
|
|
7149
|
+
const config = options.config || {};
|
|
7150
|
+
if(config.eventContent && typeof config.eventContent === "string"){
|
|
7151
|
+
const hasReturn = /\breturn\b/.test(config.eventContent);
|
|
7152
|
+
if(hasReturn){
|
|
7153
|
+
try {
|
|
7154
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7155
|
+
let fn = new Function("arg", config.eventContent);
|
|
7156
|
+
config.eventContent = fn;
|
|
7157
|
+
} catch (e) {
|
|
7158
|
+
console.warn(e);
|
|
7159
|
+
}
|
|
7160
|
+
}
|
|
7161
|
+
}
|
|
7162
|
+
|
|
7163
|
+
if(config.noEventsContent && typeof config.noEventsContent === "string"){
|
|
7164
|
+
const hasReturn = /\breturn\b/.test(config.noEventsContent);
|
|
7165
|
+
if(hasReturn){
|
|
7166
|
+
try {
|
|
7167
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7168
|
+
let fn = new Function("arg", config.noEventsContent);
|
|
7169
|
+
config.noEventsContent = fn;
|
|
7170
|
+
} catch (e) {
|
|
7171
|
+
console.warn(e);
|
|
7172
|
+
}
|
|
7173
|
+
}
|
|
7174
|
+
}
|
|
7175
|
+
|
|
7004
7176
|
const amisSchema = {
|
|
7005
7177
|
"type": "steedos-fullcalendar",
|
|
7006
7178
|
"label": "",
|
|
@@ -7010,135 +7182,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7010
7182
|
"selectMirror": permissions.allowCreate,
|
|
7011
7183
|
"initialView": initialView,
|
|
7012
7184
|
"businessHours": businessHours,
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
"weight": 0,
|
|
7016
|
-
"actions": [
|
|
7017
|
-
{
|
|
7018
|
-
"componentId": "",
|
|
7019
|
-
"args": {
|
|
7020
|
-
},
|
|
7021
|
-
"actionType": "custom",
|
|
7022
|
-
"script": onGetEventsScript
|
|
7023
|
-
}
|
|
7024
|
-
]
|
|
7025
|
-
},
|
|
7026
|
-
"select": {
|
|
7027
|
-
"weight": 0,
|
|
7028
|
-
"actions": [
|
|
7029
|
-
{
|
|
7030
|
-
"componentId": "",
|
|
7031
|
-
"args": {
|
|
7032
|
-
},
|
|
7033
|
-
"actionType": "custom",
|
|
7034
|
-
"script": onSelectScript
|
|
7035
|
-
}
|
|
7036
|
-
]
|
|
7037
|
-
},
|
|
7038
|
-
"eventClick": {
|
|
7039
|
-
"weight": 0,
|
|
7040
|
-
"actions": [
|
|
7041
|
-
{
|
|
7042
|
-
"componentId": "",
|
|
7043
|
-
"args": {
|
|
7044
|
-
},
|
|
7045
|
-
"actionType": "custom",
|
|
7046
|
-
"script": onEventClickScript
|
|
7047
|
-
}
|
|
7048
|
-
]
|
|
7049
|
-
},
|
|
7050
|
-
"eventAdd": {
|
|
7051
|
-
"weight": 0,
|
|
7052
|
-
"actions": [
|
|
7053
|
-
{
|
|
7054
|
-
"componentId": "",
|
|
7055
|
-
"args": {
|
|
7056
|
-
},
|
|
7057
|
-
"actionType": "custom",
|
|
7058
|
-
"script": "console.log('eventAdd'); console.log(event);"
|
|
7059
|
-
}
|
|
7060
|
-
]
|
|
7061
|
-
},
|
|
7062
|
-
"eventChange": {
|
|
7063
|
-
"weight": 0,
|
|
7064
|
-
"actions": [
|
|
7065
|
-
{
|
|
7066
|
-
"actionType": 'ajax',
|
|
7067
|
-
"args": {
|
|
7068
|
-
"api": recordPermissionsApi
|
|
7069
|
-
}
|
|
7070
|
-
},
|
|
7071
|
-
{
|
|
7072
|
-
"actionType": "toast",
|
|
7073
|
-
"expression": "!event.data.editable",
|
|
7074
|
-
"args": {
|
|
7075
|
-
"msgType": "error",
|
|
7076
|
-
"msg": "您没有编辑该记录的权限!",
|
|
7077
|
-
"position": "top-center"
|
|
7078
|
-
}
|
|
7079
|
-
},
|
|
7080
|
-
{
|
|
7081
|
-
"actionType": 'ajax',
|
|
7082
|
-
"expression": "event.data.editable",
|
|
7083
|
-
"args": {
|
|
7084
|
-
"api": recordSaveApi,
|
|
7085
|
-
"messages": {
|
|
7086
|
-
"success": objectSchema.label + "修改成功",
|
|
7087
|
-
"failed": objectSchema.label + "修改失败!"
|
|
7088
|
-
}
|
|
7089
|
-
}
|
|
7090
|
-
}
|
|
7091
|
-
]
|
|
7092
|
-
},
|
|
7093
|
-
"eventRemove": {
|
|
7094
|
-
"weight": 0,
|
|
7095
|
-
"actions": [
|
|
7096
|
-
{
|
|
7097
|
-
"componentId": "",
|
|
7098
|
-
"args": {
|
|
7099
|
-
},
|
|
7100
|
-
"actionType": "custom",
|
|
7101
|
-
"script": "console.log('eventRemove'); console.log(event);"
|
|
7102
|
-
}
|
|
7103
|
-
]
|
|
7104
|
-
},
|
|
7105
|
-
"eventsSet": {
|
|
7106
|
-
"weight": 0,
|
|
7107
|
-
"actions": [
|
|
7108
|
-
{
|
|
7109
|
-
"componentId": "",
|
|
7110
|
-
"args": {
|
|
7111
|
-
},
|
|
7112
|
-
"actionType": "custom",
|
|
7113
|
-
"script": "console.log('eventsSet'); console.log(event);"
|
|
7114
|
-
}
|
|
7115
|
-
]
|
|
7116
|
-
},
|
|
7117
|
-
"eventDidMount": {
|
|
7118
|
-
"weight": 0,
|
|
7119
|
-
"actions": [
|
|
7120
|
-
{
|
|
7121
|
-
"componentId": "",
|
|
7122
|
-
"args": {
|
|
7123
|
-
},
|
|
7124
|
-
"actionType": "custom",
|
|
7125
|
-
"script": "console.log('eventDidMount'); console.log(event);"
|
|
7126
|
-
}
|
|
7127
|
-
]
|
|
7128
|
-
},
|
|
7129
|
-
"eventWillUnmount": {
|
|
7130
|
-
"weight": 0,
|
|
7131
|
-
"actions": [
|
|
7132
|
-
{
|
|
7133
|
-
"componentId": "",
|
|
7134
|
-
"args": {
|
|
7135
|
-
},
|
|
7136
|
-
"actionType": "custom",
|
|
7137
|
-
"script": "console.log('eventWillUnmount'); console.log(event);"
|
|
7138
|
-
}
|
|
7139
|
-
]
|
|
7140
|
-
},
|
|
7141
|
-
}
|
|
7185
|
+
...config,
|
|
7186
|
+
"onEvent": onEvent
|
|
7142
7187
|
};
|
|
7143
7188
|
return amisSchema;
|
|
7144
7189
|
}
|