@steedos-widgets/amis-lib 1.1.3-beta.7 → 1.1.3-beta.9
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.esm.js
CHANGED
|
@@ -1363,8 +1363,8 @@ var config = {
|
|
|
1363
1363
|
/*
|
|
1364
1364
|
* @Author: baozhoutao@steedos.com
|
|
1365
1365
|
* @Date: 2022-11-01 15:51:00
|
|
1366
|
-
* @LastEditors:
|
|
1367
|
-
* @LastEditTime: 2023-03-
|
|
1366
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1367
|
+
* @LastEditTime: 2023-03-27 15:42:24
|
|
1368
1368
|
* @Description:
|
|
1369
1369
|
*/
|
|
1370
1370
|
|
|
@@ -1404,6 +1404,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1404
1404
|
"type": "dialog",
|
|
1405
1405
|
"data": {
|
|
1406
1406
|
"$master": "$$",
|
|
1407
|
+
"_master": "${_master}",
|
|
1407
1408
|
"defaultData": "${defaultData}",
|
|
1408
1409
|
"appId": "${appId}",
|
|
1409
1410
|
"objectName": "${objectName}",
|
|
@@ -1475,8 +1476,8 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
|
|
|
1475
1476
|
/*
|
|
1476
1477
|
* @Author: baozhoutao@steedos.com
|
|
1477
1478
|
* @Date: 2022-11-01 15:49:58
|
|
1478
|
-
* @LastEditors:
|
|
1479
|
-
* @LastEditTime:
|
|
1479
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1480
|
+
* @LastEditTime: 2023-03-27 11:36:49
|
|
1480
1481
|
* @Description:
|
|
1481
1482
|
*/
|
|
1482
1483
|
|
|
@@ -1542,6 +1543,12 @@ const getSchema$3 = async (uiSchema, ctx) => {
|
|
|
1542
1543
|
};
|
|
1543
1544
|
};
|
|
1544
1545
|
|
|
1546
|
+
/*
|
|
1547
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
1548
|
+
* @Date: 2023-03-22 09:31:21
|
|
1549
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1550
|
+
* @LastEditTime: 2023-03-27 16:03:34
|
|
1551
|
+
*/
|
|
1545
1552
|
const getSchema$2 = (uiSchema)=>{
|
|
1546
1553
|
return {
|
|
1547
1554
|
"type": "service",
|
|
@@ -1592,6 +1599,16 @@ const getSchema$2 = (uiSchema)=>{
|
|
|
1592
1599
|
"objectName": `${uiSchema.name}`,
|
|
1593
1600
|
"__deletedRecord": true
|
|
1594
1601
|
}
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
"actionType": "broadcast",
|
|
1605
|
+
"args": {
|
|
1606
|
+
"eventName": "@data.changed.${_master.objectName}"
|
|
1607
|
+
},
|
|
1608
|
+
"data": {
|
|
1609
|
+
"objectName": "${_master.objectName}"
|
|
1610
|
+
},
|
|
1611
|
+
"expression": "${_master.objectName}"
|
|
1595
1612
|
}
|
|
1596
1613
|
]
|
|
1597
1614
|
}
|
|
@@ -3941,6 +3958,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
3941
3958
|
`;
|
|
3942
3959
|
source.adaptor = `
|
|
3943
3960
|
const enable_tree = ${refObjectConfig.enable_tree};
|
|
3961
|
+
const op = api.data.$self.op;
|
|
3962
|
+
if(!_.isEmpty(op)){
|
|
3963
|
+
// op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
|
|
3964
|
+
const rows = _.map(payload.data.rows, (item)=>{
|
|
3965
|
+
return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
|
|
3966
|
+
})
|
|
3967
|
+
payload.data.rows = rows;
|
|
3968
|
+
return payload;
|
|
3969
|
+
}
|
|
3944
3970
|
if(enable_tree){
|
|
3945
3971
|
const records = payload.data.rows;
|
|
3946
3972
|
const treeRecords = [];
|
|
@@ -5817,6 +5843,16 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
5817
5843
|
"data": {
|
|
5818
5844
|
"objectName": `${objectSchema.name}`
|
|
5819
5845
|
}
|
|
5846
|
+
},
|
|
5847
|
+
{
|
|
5848
|
+
"actionType": "broadcast",
|
|
5849
|
+
"args": {
|
|
5850
|
+
"eventName": "@data.changed.${_master.objectName}"
|
|
5851
|
+
},
|
|
5852
|
+
"data": {
|
|
5853
|
+
"objectName": "${_master.objectName}"
|
|
5854
|
+
},
|
|
5855
|
+
"expression": "${_master.objectName}"
|
|
5820
5856
|
}
|
|
5821
5857
|
]
|
|
5822
5858
|
}
|
|
@@ -6608,7 +6644,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6608
6644
|
const searchableFields = [];
|
|
6609
6645
|
let { filter, sort, top, setDataToComponentId = '' } = options;
|
|
6610
6646
|
|
|
6611
|
-
if(!top){
|
|
6647
|
+
if (!top) {
|
|
6612
6648
|
// 日历请求不翻页
|
|
6613
6649
|
top = 200;
|
|
6614
6650
|
}
|
|
@@ -6734,7 +6770,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6734
6770
|
title: n["${calendarOptions.textExpr}"],
|
|
6735
6771
|
start: n["${calendarOptions.startDateExpr}"],
|
|
6736
6772
|
end: n["${calendarOptions.endDateExpr}"],
|
|
6737
|
-
allDay: n["${calendarOptions.allDayExpr}"]
|
|
6773
|
+
allDay: n["${calendarOptions.allDayExpr}"],
|
|
6774
|
+
extendedProps: n
|
|
6738
6775
|
}
|
|
6739
6776
|
});
|
|
6740
6777
|
const successCallback = selfData.successCallback;
|
|
@@ -6807,7 +6844,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
|
|
|
6807
6844
|
return payload;
|
|
6808
6845
|
`,
|
|
6809
6846
|
headers: {
|
|
6810
|
-
|
|
6847
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
6811
6848
|
}
|
|
6812
6849
|
};
|
|
6813
6850
|
}
|
|
@@ -6826,9 +6863,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6826
6863
|
calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, omitBy(calendarOptions, isNil));
|
|
6827
6864
|
|
|
6828
6865
|
const titleFields = calendarOptions.title || [
|
|
6829
|
-
calendarOptions.startDateExpr,
|
|
6830
|
-
calendarOptions.endDateExpr,
|
|
6831
|
-
calendarOptions.allDayExpr,
|
|
6866
|
+
calendarOptions.startDateExpr,
|
|
6867
|
+
calendarOptions.endDateExpr,
|
|
6868
|
+
calendarOptions.allDayExpr,
|
|
6832
6869
|
calendarOptions.textExpr
|
|
6833
6870
|
];
|
|
6834
6871
|
let fields = [];
|
|
@@ -6852,9 +6889,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6852
6889
|
}
|
|
6853
6890
|
}
|
|
6854
6891
|
let initialView = calendarOptions.currentView;
|
|
6855
|
-
if(initialView){
|
|
6892
|
+
if (initialView) {
|
|
6856
6893
|
// day, week, month, agenda
|
|
6857
|
-
switch(initialView){
|
|
6894
|
+
switch (initialView) {
|
|
6858
6895
|
case "day":
|
|
6859
6896
|
initialView = "timeGridDay";
|
|
6860
6897
|
break;
|
|
@@ -6961,19 +6998,154 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6961
6998
|
const recordId = "${event.id}";
|
|
6962
6999
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
6963
7000
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
6964
|
-
|
|
7001
|
+
|
|
6965
7002
|
const businessHours = {
|
|
6966
|
-
daysOfWeek: [
|
|
7003
|
+
daysOfWeek: [1, 2, 3, 4, 5],
|
|
6967
7004
|
startTime: '08:00',
|
|
6968
7005
|
endTime: '18:00',
|
|
6969
7006
|
};
|
|
6970
|
-
if(!isEmpty(calendarOptions.startDayHour)){
|
|
7007
|
+
if (!isEmpty(calendarOptions.startDayHour)) {
|
|
6971
7008
|
businessHours.startTime = `${calendarOptions.startDayHour}:00`;
|
|
6972
7009
|
}
|
|
6973
|
-
if(!isEmpty(calendarOptions.endDayHour)){
|
|
7010
|
+
if (!isEmpty(calendarOptions.endDayHour)) {
|
|
6974
7011
|
businessHours.endTime = `${calendarOptions.endDayHour}:00`;
|
|
6975
7012
|
}
|
|
6976
|
-
|
|
7013
|
+
|
|
7014
|
+
const onEvent = {
|
|
7015
|
+
"getEvents": {
|
|
7016
|
+
"weight": 0,
|
|
7017
|
+
"actions": [
|
|
7018
|
+
{
|
|
7019
|
+
"componentId": "",
|
|
7020
|
+
"args": {
|
|
7021
|
+
},
|
|
7022
|
+
"actionType": "custom",
|
|
7023
|
+
"script": onGetEventsScript
|
|
7024
|
+
}
|
|
7025
|
+
]
|
|
7026
|
+
},
|
|
7027
|
+
"select": {
|
|
7028
|
+
"weight": 0,
|
|
7029
|
+
"actions": [
|
|
7030
|
+
{
|
|
7031
|
+
"componentId": "",
|
|
7032
|
+
"args": {
|
|
7033
|
+
},
|
|
7034
|
+
"actionType": "custom",
|
|
7035
|
+
"script": onSelectScript
|
|
7036
|
+
}
|
|
7037
|
+
]
|
|
7038
|
+
},
|
|
7039
|
+
"eventClick": {
|
|
7040
|
+
"weight": 0,
|
|
7041
|
+
"actions": [
|
|
7042
|
+
{
|
|
7043
|
+
"componentId": "",
|
|
7044
|
+
"args": {
|
|
7045
|
+
},
|
|
7046
|
+
"actionType": "custom",
|
|
7047
|
+
"script": onEventClickScript
|
|
7048
|
+
}
|
|
7049
|
+
]
|
|
7050
|
+
},
|
|
7051
|
+
"eventAdd": {
|
|
7052
|
+
"weight": 0,
|
|
7053
|
+
"actions": [
|
|
7054
|
+
{
|
|
7055
|
+
"componentId": "",
|
|
7056
|
+
"args": {
|
|
7057
|
+
},
|
|
7058
|
+
"actionType": "custom",
|
|
7059
|
+
"script": "console.log('eventAdd'); console.log(event);"
|
|
7060
|
+
}
|
|
7061
|
+
]
|
|
7062
|
+
},
|
|
7063
|
+
"eventChange": {
|
|
7064
|
+
"weight": 0,
|
|
7065
|
+
"actions": [
|
|
7066
|
+
{
|
|
7067
|
+
"actionType": 'ajax',
|
|
7068
|
+
"args": {
|
|
7069
|
+
"api": recordPermissionsApi
|
|
7070
|
+
}
|
|
7071
|
+
},
|
|
7072
|
+
{
|
|
7073
|
+
"actionType": "toast",
|
|
7074
|
+
"expression": "!event.data.editable",
|
|
7075
|
+
"args": {
|
|
7076
|
+
"msgType": "error",
|
|
7077
|
+
"msg": "您没有编辑该记录的权限!",
|
|
7078
|
+
"position": "top-center"
|
|
7079
|
+
}
|
|
7080
|
+
},
|
|
7081
|
+
{
|
|
7082
|
+
"actionType": 'ajax',
|
|
7083
|
+
"expression": "event.data.editable",
|
|
7084
|
+
"args": {
|
|
7085
|
+
"api": recordSaveApi,
|
|
7086
|
+
"messages": {
|
|
7087
|
+
"success": objectSchema.label + "修改成功",
|
|
7088
|
+
"failed": objectSchema.label + "修改失败!"
|
|
7089
|
+
}
|
|
7090
|
+
}
|
|
7091
|
+
}
|
|
7092
|
+
]
|
|
7093
|
+
},
|
|
7094
|
+
"eventRemove": {
|
|
7095
|
+
"weight": 0,
|
|
7096
|
+
"actions": [
|
|
7097
|
+
{
|
|
7098
|
+
"componentId": "",
|
|
7099
|
+
"args": {
|
|
7100
|
+
},
|
|
7101
|
+
"actionType": "custom",
|
|
7102
|
+
"script": "console.log('eventRemove'); console.log(event);"
|
|
7103
|
+
}
|
|
7104
|
+
]
|
|
7105
|
+
},
|
|
7106
|
+
"eventsSet": {
|
|
7107
|
+
"weight": 0,
|
|
7108
|
+
"actions": [
|
|
7109
|
+
{
|
|
7110
|
+
"componentId": "",
|
|
7111
|
+
"args": {
|
|
7112
|
+
},
|
|
7113
|
+
"actionType": "custom",
|
|
7114
|
+
"script": "console.log('eventsSet'); console.log(event);"
|
|
7115
|
+
}
|
|
7116
|
+
]
|
|
7117
|
+
}
|
|
7118
|
+
};
|
|
7119
|
+
|
|
7120
|
+
Object.assign(onEvent, options.onEvent);
|
|
7121
|
+
|
|
7122
|
+
const config = options.config || {};
|
|
7123
|
+
if(config.eventContent && typeof config.eventContent === "string"){
|
|
7124
|
+
const hasReturn = /\breturn\b/.test(config.eventContent);
|
|
7125
|
+
if(hasReturn){
|
|
7126
|
+
try {
|
|
7127
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7128
|
+
let fn = new Function("arg", config.eventContent);
|
|
7129
|
+
config.eventContent = fn;
|
|
7130
|
+
} catch (e) {
|
|
7131
|
+
console.warn(e);
|
|
7132
|
+
}
|
|
7133
|
+
}
|
|
7134
|
+
}
|
|
7135
|
+
|
|
7136
|
+
if(config.noEventsContent && typeof config.noEventsContent === "string"){
|
|
7137
|
+
const hasReturn = /\breturn\b/.test(config.noEventsContent);
|
|
7138
|
+
if(hasReturn){
|
|
7139
|
+
try {
|
|
7140
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7141
|
+
let fn = new Function("arg", config.noEventsContent);
|
|
7142
|
+
config.noEventsContent = fn;
|
|
7143
|
+
} catch (e) {
|
|
7144
|
+
console.warn(e);
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
7147
|
+
}
|
|
7148
|
+
|
|
6977
7149
|
const amisSchema = {
|
|
6978
7150
|
"type": "steedos-fullcalendar",
|
|
6979
7151
|
"label": "",
|
|
@@ -6983,135 +7155,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6983
7155
|
"selectMirror": permissions.allowCreate,
|
|
6984
7156
|
"initialView": initialView,
|
|
6985
7157
|
"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
|
-
}
|
|
7158
|
+
...config,
|
|
7159
|
+
"onEvent": onEvent
|
|
7115
7160
|
};
|
|
7116
7161
|
return amisSchema;
|
|
7117
7162
|
}
|