@steedos-widgets/amis-object 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/amis-object.cjs.js +160 -145
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.js +160 -145
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.js +160 -145
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +10 -10
- package/package.json +3 -3
package/dist/amis-object.esm.js
CHANGED
|
@@ -4300,6 +4300,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
4300
4300
|
`;
|
|
4301
4301
|
source.adaptor = `
|
|
4302
4302
|
const enable_tree = ${refObjectConfig.enable_tree};
|
|
4303
|
+
const value = api.data.$self.value;
|
|
4304
|
+
if(!_.isEmpty(value)){
|
|
4305
|
+
// value 不为空值,表示返回当前选中节点信息
|
|
4306
|
+
return payload;
|
|
4307
|
+
}
|
|
4303
4308
|
if(enable_tree){
|
|
4304
4309
|
const records = payload.data.rows;
|
|
4305
4310
|
const treeRecords = [];
|
|
@@ -6967,7 +6972,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6967
6972
|
const searchableFields = [];
|
|
6968
6973
|
let { filter, sort, top, setDataToComponentId = '' } = options;
|
|
6969
6974
|
|
|
6970
|
-
if(!top){
|
|
6975
|
+
if (!top) {
|
|
6971
6976
|
// 日历请求不翻页
|
|
6972
6977
|
top = 200;
|
|
6973
6978
|
}
|
|
@@ -7093,7 +7098,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
7093
7098
|
title: n["${calendarOptions.textExpr}"],
|
|
7094
7099
|
start: n["${calendarOptions.startDateExpr}"],
|
|
7095
7100
|
end: n["${calendarOptions.endDateExpr}"],
|
|
7096
|
-
allDay: n["${calendarOptions.allDayExpr}"]
|
|
7101
|
+
allDay: n["${calendarOptions.allDayExpr}"],
|
|
7102
|
+
extendedProps: n
|
|
7097
7103
|
}
|
|
7098
7104
|
});
|
|
7099
7105
|
const successCallback = selfData.successCallback;
|
|
@@ -7166,7 +7172,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
|
|
|
7166
7172
|
return payload;
|
|
7167
7173
|
`,
|
|
7168
7174
|
headers: {
|
|
7169
|
-
|
|
7175
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
7170
7176
|
}
|
|
7171
7177
|
};
|
|
7172
7178
|
}
|
|
@@ -7185,9 +7191,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7185
7191
|
calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, omitBy(calendarOptions, isNil));
|
|
7186
7192
|
|
|
7187
7193
|
const titleFields = calendarOptions.title || [
|
|
7188
|
-
calendarOptions.startDateExpr,
|
|
7189
|
-
calendarOptions.endDateExpr,
|
|
7190
|
-
calendarOptions.allDayExpr,
|
|
7194
|
+
calendarOptions.startDateExpr,
|
|
7195
|
+
calendarOptions.endDateExpr,
|
|
7196
|
+
calendarOptions.allDayExpr,
|
|
7191
7197
|
calendarOptions.textExpr
|
|
7192
7198
|
];
|
|
7193
7199
|
let fields = [];
|
|
@@ -7211,9 +7217,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7211
7217
|
}
|
|
7212
7218
|
}
|
|
7213
7219
|
let initialView = calendarOptions.currentView;
|
|
7214
|
-
if(initialView){
|
|
7220
|
+
if (initialView) {
|
|
7215
7221
|
// day, week, month, agenda
|
|
7216
|
-
switch(initialView){
|
|
7222
|
+
switch (initialView) {
|
|
7217
7223
|
case "day":
|
|
7218
7224
|
initialView = "timeGridDay";
|
|
7219
7225
|
break;
|
|
@@ -7320,19 +7326,154 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7320
7326
|
const recordId = "${event.id}";
|
|
7321
7327
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
7322
7328
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
7323
|
-
|
|
7329
|
+
|
|
7324
7330
|
const businessHours = {
|
|
7325
|
-
daysOfWeek: [
|
|
7331
|
+
daysOfWeek: [1, 2, 3, 4, 5],
|
|
7326
7332
|
startTime: '08:00',
|
|
7327
7333
|
endTime: '18:00',
|
|
7328
7334
|
};
|
|
7329
|
-
if(!isEmpty(calendarOptions.startDayHour)){
|
|
7335
|
+
if (!isEmpty(calendarOptions.startDayHour)) {
|
|
7330
7336
|
businessHours.startTime = `${calendarOptions.startDayHour}:00`;
|
|
7331
7337
|
}
|
|
7332
|
-
if(!isEmpty(calendarOptions.endDayHour)){
|
|
7338
|
+
if (!isEmpty(calendarOptions.endDayHour)) {
|
|
7333
7339
|
businessHours.endTime = `${calendarOptions.endDayHour}:00`;
|
|
7334
7340
|
}
|
|
7335
|
-
|
|
7341
|
+
|
|
7342
|
+
const onEvent = {
|
|
7343
|
+
"getEvents": {
|
|
7344
|
+
"weight": 0,
|
|
7345
|
+
"actions": [
|
|
7346
|
+
{
|
|
7347
|
+
"componentId": "",
|
|
7348
|
+
"args": {
|
|
7349
|
+
},
|
|
7350
|
+
"actionType": "custom",
|
|
7351
|
+
"script": onGetEventsScript
|
|
7352
|
+
}
|
|
7353
|
+
]
|
|
7354
|
+
},
|
|
7355
|
+
"select": {
|
|
7356
|
+
"weight": 0,
|
|
7357
|
+
"actions": [
|
|
7358
|
+
{
|
|
7359
|
+
"componentId": "",
|
|
7360
|
+
"args": {
|
|
7361
|
+
},
|
|
7362
|
+
"actionType": "custom",
|
|
7363
|
+
"script": onSelectScript
|
|
7364
|
+
}
|
|
7365
|
+
]
|
|
7366
|
+
},
|
|
7367
|
+
"eventClick": {
|
|
7368
|
+
"weight": 0,
|
|
7369
|
+
"actions": [
|
|
7370
|
+
{
|
|
7371
|
+
"componentId": "",
|
|
7372
|
+
"args": {
|
|
7373
|
+
},
|
|
7374
|
+
"actionType": "custom",
|
|
7375
|
+
"script": onEventClickScript
|
|
7376
|
+
}
|
|
7377
|
+
]
|
|
7378
|
+
},
|
|
7379
|
+
"eventAdd": {
|
|
7380
|
+
"weight": 0,
|
|
7381
|
+
"actions": [
|
|
7382
|
+
{
|
|
7383
|
+
"componentId": "",
|
|
7384
|
+
"args": {
|
|
7385
|
+
},
|
|
7386
|
+
"actionType": "custom",
|
|
7387
|
+
"script": "console.log('eventAdd'); console.log(event);"
|
|
7388
|
+
}
|
|
7389
|
+
]
|
|
7390
|
+
},
|
|
7391
|
+
"eventChange": {
|
|
7392
|
+
"weight": 0,
|
|
7393
|
+
"actions": [
|
|
7394
|
+
{
|
|
7395
|
+
"actionType": 'ajax',
|
|
7396
|
+
"args": {
|
|
7397
|
+
"api": recordPermissionsApi
|
|
7398
|
+
}
|
|
7399
|
+
},
|
|
7400
|
+
{
|
|
7401
|
+
"actionType": "toast",
|
|
7402
|
+
"expression": "!event.data.editable",
|
|
7403
|
+
"args": {
|
|
7404
|
+
"msgType": "error",
|
|
7405
|
+
"msg": "您没有编辑该记录的权限!",
|
|
7406
|
+
"position": "top-center"
|
|
7407
|
+
}
|
|
7408
|
+
},
|
|
7409
|
+
{
|
|
7410
|
+
"actionType": 'ajax',
|
|
7411
|
+
"expression": "event.data.editable",
|
|
7412
|
+
"args": {
|
|
7413
|
+
"api": recordSaveApi,
|
|
7414
|
+
"messages": {
|
|
7415
|
+
"success": objectSchema.label + "修改成功",
|
|
7416
|
+
"failed": objectSchema.label + "修改失败!"
|
|
7417
|
+
}
|
|
7418
|
+
}
|
|
7419
|
+
}
|
|
7420
|
+
]
|
|
7421
|
+
},
|
|
7422
|
+
"eventRemove": {
|
|
7423
|
+
"weight": 0,
|
|
7424
|
+
"actions": [
|
|
7425
|
+
{
|
|
7426
|
+
"componentId": "",
|
|
7427
|
+
"args": {
|
|
7428
|
+
},
|
|
7429
|
+
"actionType": "custom",
|
|
7430
|
+
"script": "console.log('eventRemove'); console.log(event);"
|
|
7431
|
+
}
|
|
7432
|
+
]
|
|
7433
|
+
},
|
|
7434
|
+
"eventsSet": {
|
|
7435
|
+
"weight": 0,
|
|
7436
|
+
"actions": [
|
|
7437
|
+
{
|
|
7438
|
+
"componentId": "",
|
|
7439
|
+
"args": {
|
|
7440
|
+
},
|
|
7441
|
+
"actionType": "custom",
|
|
7442
|
+
"script": "console.log('eventsSet'); console.log(event);"
|
|
7443
|
+
}
|
|
7444
|
+
]
|
|
7445
|
+
}
|
|
7446
|
+
};
|
|
7447
|
+
|
|
7448
|
+
Object.assign(onEvent, options.onEvent);
|
|
7449
|
+
|
|
7450
|
+
const config = options.config || {};
|
|
7451
|
+
if(config.eventContent && typeof config.eventContent === "string"){
|
|
7452
|
+
const hasReturn = /\breturn\b/.test(config.eventContent);
|
|
7453
|
+
if(hasReturn){
|
|
7454
|
+
try {
|
|
7455
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7456
|
+
let fn = new Function("arg", config.eventContent);
|
|
7457
|
+
config.eventContent = fn;
|
|
7458
|
+
} catch (e) {
|
|
7459
|
+
console.warn(e);
|
|
7460
|
+
}
|
|
7461
|
+
}
|
|
7462
|
+
}
|
|
7463
|
+
|
|
7464
|
+
if(config.noEventsContent && typeof config.noEventsContent === "string"){
|
|
7465
|
+
const hasReturn = /\breturn\b/.test(config.noEventsContent);
|
|
7466
|
+
if(hasReturn){
|
|
7467
|
+
try {
|
|
7468
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7469
|
+
let fn = new Function("arg", config.noEventsContent);
|
|
7470
|
+
config.noEventsContent = fn;
|
|
7471
|
+
} catch (e) {
|
|
7472
|
+
console.warn(e);
|
|
7473
|
+
}
|
|
7474
|
+
}
|
|
7475
|
+
}
|
|
7476
|
+
|
|
7336
7477
|
const amisSchema = {
|
|
7337
7478
|
"type": "steedos-fullcalendar",
|
|
7338
7479
|
"label": "",
|
|
@@ -7342,135 +7483,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7342
7483
|
"selectMirror": permissions.allowCreate,
|
|
7343
7484
|
"initialView": initialView,
|
|
7344
7485
|
"businessHours": businessHours,
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
"weight": 0,
|
|
7348
|
-
"actions": [
|
|
7349
|
-
{
|
|
7350
|
-
"componentId": "",
|
|
7351
|
-
"args": {
|
|
7352
|
-
},
|
|
7353
|
-
"actionType": "custom",
|
|
7354
|
-
"script": onGetEventsScript
|
|
7355
|
-
}
|
|
7356
|
-
]
|
|
7357
|
-
},
|
|
7358
|
-
"select": {
|
|
7359
|
-
"weight": 0,
|
|
7360
|
-
"actions": [
|
|
7361
|
-
{
|
|
7362
|
-
"componentId": "",
|
|
7363
|
-
"args": {
|
|
7364
|
-
},
|
|
7365
|
-
"actionType": "custom",
|
|
7366
|
-
"script": onSelectScript
|
|
7367
|
-
}
|
|
7368
|
-
]
|
|
7369
|
-
},
|
|
7370
|
-
"eventClick": {
|
|
7371
|
-
"weight": 0,
|
|
7372
|
-
"actions": [
|
|
7373
|
-
{
|
|
7374
|
-
"componentId": "",
|
|
7375
|
-
"args": {
|
|
7376
|
-
},
|
|
7377
|
-
"actionType": "custom",
|
|
7378
|
-
"script": onEventClickScript
|
|
7379
|
-
}
|
|
7380
|
-
]
|
|
7381
|
-
},
|
|
7382
|
-
"eventAdd": {
|
|
7383
|
-
"weight": 0,
|
|
7384
|
-
"actions": [
|
|
7385
|
-
{
|
|
7386
|
-
"componentId": "",
|
|
7387
|
-
"args": {
|
|
7388
|
-
},
|
|
7389
|
-
"actionType": "custom",
|
|
7390
|
-
"script": "console.log('eventAdd'); console.log(event);"
|
|
7391
|
-
}
|
|
7392
|
-
]
|
|
7393
|
-
},
|
|
7394
|
-
"eventChange": {
|
|
7395
|
-
"weight": 0,
|
|
7396
|
-
"actions": [
|
|
7397
|
-
{
|
|
7398
|
-
"actionType": 'ajax',
|
|
7399
|
-
"args": {
|
|
7400
|
-
"api": recordPermissionsApi
|
|
7401
|
-
}
|
|
7402
|
-
},
|
|
7403
|
-
{
|
|
7404
|
-
"actionType": "toast",
|
|
7405
|
-
"expression": "!event.data.editable",
|
|
7406
|
-
"args": {
|
|
7407
|
-
"msgType": "error",
|
|
7408
|
-
"msg": "您没有编辑该记录的权限!",
|
|
7409
|
-
"position": "top-center"
|
|
7410
|
-
}
|
|
7411
|
-
},
|
|
7412
|
-
{
|
|
7413
|
-
"actionType": 'ajax',
|
|
7414
|
-
"expression": "event.data.editable",
|
|
7415
|
-
"args": {
|
|
7416
|
-
"api": recordSaveApi,
|
|
7417
|
-
"messages": {
|
|
7418
|
-
"success": objectSchema.label + "修改成功",
|
|
7419
|
-
"failed": objectSchema.label + "修改失败!"
|
|
7420
|
-
}
|
|
7421
|
-
}
|
|
7422
|
-
}
|
|
7423
|
-
]
|
|
7424
|
-
},
|
|
7425
|
-
"eventRemove": {
|
|
7426
|
-
"weight": 0,
|
|
7427
|
-
"actions": [
|
|
7428
|
-
{
|
|
7429
|
-
"componentId": "",
|
|
7430
|
-
"args": {
|
|
7431
|
-
},
|
|
7432
|
-
"actionType": "custom",
|
|
7433
|
-
"script": "console.log('eventRemove'); console.log(event);"
|
|
7434
|
-
}
|
|
7435
|
-
]
|
|
7436
|
-
},
|
|
7437
|
-
"eventsSet": {
|
|
7438
|
-
"weight": 0,
|
|
7439
|
-
"actions": [
|
|
7440
|
-
{
|
|
7441
|
-
"componentId": "",
|
|
7442
|
-
"args": {
|
|
7443
|
-
},
|
|
7444
|
-
"actionType": "custom",
|
|
7445
|
-
"script": "console.log('eventsSet'); console.log(event);"
|
|
7446
|
-
}
|
|
7447
|
-
]
|
|
7448
|
-
},
|
|
7449
|
-
"eventDidMount": {
|
|
7450
|
-
"weight": 0,
|
|
7451
|
-
"actions": [
|
|
7452
|
-
{
|
|
7453
|
-
"componentId": "",
|
|
7454
|
-
"args": {
|
|
7455
|
-
},
|
|
7456
|
-
"actionType": "custom",
|
|
7457
|
-
"script": "console.log('eventDidMount'); console.log(event);"
|
|
7458
|
-
}
|
|
7459
|
-
]
|
|
7460
|
-
},
|
|
7461
|
-
"eventWillUnmount": {
|
|
7462
|
-
"weight": 0,
|
|
7463
|
-
"actions": [
|
|
7464
|
-
{
|
|
7465
|
-
"componentId": "",
|
|
7466
|
-
"args": {
|
|
7467
|
-
},
|
|
7468
|
-
"actionType": "custom",
|
|
7469
|
-
"script": "console.log('eventWillUnmount'); console.log(event);"
|
|
7470
|
-
}
|
|
7471
|
-
]
|
|
7472
|
-
},
|
|
7473
|
-
}
|
|
7486
|
+
...config,
|
|
7487
|
+
"onEvent": onEvent
|
|
7474
7488
|
};
|
|
7475
7489
|
return amisSchema;
|
|
7476
7490
|
}
|
|
@@ -12034,11 +12048,12 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
12034
12048
|
}); };
|
|
12035
12049
|
|
|
12036
12050
|
var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12037
|
-
var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
|
|
12051
|
+
var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, onEvent, config, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
|
|
12038
12052
|
return __generator(this, function (_b) {
|
|
12039
12053
|
switch (_b.label) {
|
|
12040
12054
|
case 0:
|
|
12041
|
-
|
|
12055
|
+
console.log("AmisObjectCalendar props", props);
|
|
12056
|
+
props.$schema, top = props.top, sort = props.sort, filters = props.filters, filtersFunction = props.filtersFunction, title = props.title, currentView = props.currentView, startDateExpr = props.startDateExpr, endDateExpr = props.endDateExpr, allDayExpr = props.allDayExpr, textExpr = props.textExpr, data = props.data, defaultData = props.defaultData, _a = props.className, className = _a === void 0 ? "" : _a, onEvent = props.onEvent, config = props.config;
|
|
12042
12057
|
objectApiName = props.objectApiName || "events";
|
|
12043
12058
|
amisSchemaData = Object.assign({}, data, defaultData);
|
|
12044
12059
|
return [4 /*yield*/, getCalendarSchema(amisSchemaData.appId, objectApiName, {
|
|
@@ -12048,7 +12063,7 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12048
12063
|
endDateExpr: endDateExpr,
|
|
12049
12064
|
allDayExpr: allDayExpr,
|
|
12050
12065
|
textExpr: textExpr
|
|
12051
|
-
}, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction })];
|
|
12066
|
+
}, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction, onEvent: onEvent, config: config })];
|
|
12052
12067
|
case 1:
|
|
12053
12068
|
schema = (_b.sent());
|
|
12054
12069
|
uiSchema = schema.uiSchema;
|