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