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