@steedos-widgets/amis-object 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.
@@ -1862,8 +1862,8 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
1862
1862
  /*
1863
1863
  * @Author: baozhoutao@steedos.com
1864
1864
  * @Date: 2022-11-01 15:49:58
1865
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1866
- * @LastEditTime: 2023-03-25 17:22:00
1865
+ * @LastEditors: baozhoutao@steedos.com
1866
+ * @LastEditTime: 2022-11-08 16:39:40
1867
1867
  * @Description:
1868
1868
  */
1869
1869
 
@@ -1907,10 +1907,6 @@ const getSchema$3 = async (uiSchema, ctx) => {
1907
1907
  actionType: "dialog",
1908
1908
  dialog: {
1909
1909
  type: "dialog",
1910
- "data": {
1911
- "&": "$$",
1912
- "$master": "$$"
1913
- },
1914
1910
  title: title,
1915
1911
  bodyClassName: "",
1916
1912
  body: [formSchema],
@@ -1933,12 +1929,6 @@ const getSchema$3 = async (uiSchema, ctx) => {
1933
1929
  };
1934
1930
  };
1935
1931
 
1936
- /*
1937
- * @Author: 殷亮辉 yinlianghui@hotoa.com
1938
- * @Date: 2023-03-22 09:31:21
1939
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1940
- * @LastEditTime: 2023-03-25 22:41:27
1941
- */
1942
1932
  const getSchema$2 = (uiSchema)=>{
1943
1933
  return {
1944
1934
  "type": "service",
@@ -1989,16 +1979,6 @@ const getSchema$2 = (uiSchema)=>{
1989
1979
  "objectName": `${uiSchema.name}`,
1990
1980
  "__deletedRecord": true
1991
1981
  }
1992
- },
1993
- {
1994
- "actionType": "broadcast",
1995
- "args": {
1996
- "eventName": "@data.changed.${masterObjectName}"
1997
- },
1998
- "data": {
1999
- "objectName": "${masterObjectName}"
2000
- },
2001
- "expression": "${masterObjectName}"
2002
1982
  }
2003
1983
  ]
2004
1984
  }
@@ -4348,15 +4328,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
4348
4328
  `;
4349
4329
  source.adaptor = `
4350
4330
  const enable_tree = ${refObjectConfig.enable_tree};
4351
- const op = api.data.$self.op;
4352
- if(!_.isEmpty(op)){
4353
- // op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
4354
- const rows = _.map(payload.data.rows, (item)=>{
4355
- return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
4356
- })
4357
- payload.data.rows = rows;
4358
- return payload;
4359
- }
4360
4331
  if(enable_tree){
4361
4332
  const records = payload.data.rows;
4362
4333
  const treeRecords = [];
@@ -6233,16 +6204,6 @@ async function getObjectForm(objectSchema, ctx){
6233
6204
  "data": {
6234
6205
  "objectName": `${objectSchema.name}`
6235
6206
  }
6236
- },
6237
- {
6238
- "actionType": "broadcast",
6239
- "args": {
6240
- "eventName": "@data.changed.${$master.masterObjectName}"
6241
- },
6242
- "data": {
6243
- "objectName": "${$master.masterObjectName}"
6244
- },
6245
- "expression": "${$master.masterObjectName}"
6246
6207
  }
6247
6208
  ]
6248
6209
  }
@@ -7034,7 +6995,7 @@ async function getCalendarApi(mainObject, fields, options) {
7034
6995
  const searchableFields = [];
7035
6996
  let { filter, sort, top, setDataToComponentId = '' } = options;
7036
6997
 
7037
- if (!top) {
6998
+ if(!top){
7038
6999
  // 日历请求不翻页
7039
7000
  top = 200;
7040
7001
  }
@@ -7160,8 +7121,7 @@ async function getCalendarApi(mainObject, fields, options) {
7160
7121
  title: n["${calendarOptions.textExpr}"],
7161
7122
  start: n["${calendarOptions.startDateExpr}"],
7162
7123
  end: n["${calendarOptions.endDateExpr}"],
7163
- allDay: n["${calendarOptions.allDayExpr}"],
7164
- extendedProps: n
7124
+ allDay: n["${calendarOptions.allDayExpr}"]
7165
7125
  }
7166
7126
  });
7167
7127
  const successCallback = selfData.successCallback;
@@ -7234,7 +7194,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
7234
7194
  return payload;
7235
7195
  `,
7236
7196
  headers: {
7237
- Authorization: "Bearer ${context.tenantId},${context.authToken}"
7197
+ Authorization: "Bearer ${context.tenantId},${context.authToken}"
7238
7198
  }
7239
7199
  };
7240
7200
  }
@@ -7253,9 +7213,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7253
7213
  calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, ___default.omitBy(calendarOptions, ___default.isNil));
7254
7214
 
7255
7215
  const titleFields = calendarOptions.title || [
7256
- calendarOptions.startDateExpr,
7257
- calendarOptions.endDateExpr,
7258
- calendarOptions.allDayExpr,
7216
+ calendarOptions.startDateExpr,
7217
+ calendarOptions.endDateExpr,
7218
+ calendarOptions.allDayExpr,
7259
7219
  calendarOptions.textExpr
7260
7220
  ];
7261
7221
  let fields = [];
@@ -7279,9 +7239,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7279
7239
  }
7280
7240
  }
7281
7241
  let initialView = calendarOptions.currentView;
7282
- if (initialView) {
7242
+ if(initialView){
7283
7243
  // day, week, month, agenda
7284
- switch (initialView) {
7244
+ switch(initialView){
7285
7245
  case "day":
7286
7246
  initialView = "timeGridDay";
7287
7247
  break;
@@ -7388,154 +7348,19 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7388
7348
  const recordId = "${event.id}";
7389
7349
  const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
7390
7350
  const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
7391
-
7351
+
7392
7352
  const businessHours = {
7393
- daysOfWeek: [1, 2, 3, 4, 5],
7353
+ daysOfWeek: [ 1, 2, 3, 4, 5 ],
7394
7354
  startTime: '08:00',
7395
7355
  endTime: '18:00',
7396
7356
  };
7397
- if (!___default.isEmpty(calendarOptions.startDayHour)) {
7357
+ if(!___default.isEmpty(calendarOptions.startDayHour)){
7398
7358
  businessHours.startTime = `${calendarOptions.startDayHour}:00`;
7399
7359
  }
7400
- if (!___default.isEmpty(calendarOptions.endDayHour)) {
7360
+ if(!___default.isEmpty(calendarOptions.endDayHour)){
7401
7361
  businessHours.endTime = `${calendarOptions.endDayHour}:00`;
7402
7362
  }
7403
-
7404
- const onEvent = {
7405
- "getEvents": {
7406
- "weight": 0,
7407
- "actions": [
7408
- {
7409
- "componentId": "",
7410
- "args": {
7411
- },
7412
- "actionType": "custom",
7413
- "script": onGetEventsScript
7414
- }
7415
- ]
7416
- },
7417
- "select": {
7418
- "weight": 0,
7419
- "actions": [
7420
- {
7421
- "componentId": "",
7422
- "args": {
7423
- },
7424
- "actionType": "custom",
7425
- "script": onSelectScript
7426
- }
7427
- ]
7428
- },
7429
- "eventClick": {
7430
- "weight": 0,
7431
- "actions": [
7432
- {
7433
- "componentId": "",
7434
- "args": {
7435
- },
7436
- "actionType": "custom",
7437
- "script": onEventClickScript
7438
- }
7439
- ]
7440
- },
7441
- "eventAdd": {
7442
- "weight": 0,
7443
- "actions": [
7444
- {
7445
- "componentId": "",
7446
- "args": {
7447
- },
7448
- "actionType": "custom",
7449
- "script": "console.log('eventAdd'); console.log(event);"
7450
- }
7451
- ]
7452
- },
7453
- "eventChange": {
7454
- "weight": 0,
7455
- "actions": [
7456
- {
7457
- "actionType": 'ajax',
7458
- "args": {
7459
- "api": recordPermissionsApi
7460
- }
7461
- },
7462
- {
7463
- "actionType": "toast",
7464
- "expression": "!event.data.editable",
7465
- "args": {
7466
- "msgType": "error",
7467
- "msg": "您没有编辑该记录的权限!",
7468
- "position": "top-center"
7469
- }
7470
- },
7471
- {
7472
- "actionType": 'ajax',
7473
- "expression": "event.data.editable",
7474
- "args": {
7475
- "api": recordSaveApi,
7476
- "messages": {
7477
- "success": objectSchema.label + "修改成功",
7478
- "failed": objectSchema.label + "修改失败!"
7479
- }
7480
- }
7481
- }
7482
- ]
7483
- },
7484
- "eventRemove": {
7485
- "weight": 0,
7486
- "actions": [
7487
- {
7488
- "componentId": "",
7489
- "args": {
7490
- },
7491
- "actionType": "custom",
7492
- "script": "console.log('eventRemove'); console.log(event);"
7493
- }
7494
- ]
7495
- },
7496
- "eventsSet": {
7497
- "weight": 0,
7498
- "actions": [
7499
- {
7500
- "componentId": "",
7501
- "args": {
7502
- },
7503
- "actionType": "custom",
7504
- "script": "console.log('eventsSet'); console.log(event);"
7505
- }
7506
- ]
7507
- }
7508
- };
7509
-
7510
- Object.assign(onEvent, options.onEvent);
7511
-
7512
- const config = options.config || {};
7513
- if(config.eventContent && typeof config.eventContent === "string"){
7514
- const hasReturn = /\breturn\b/.test(config.eventContent);
7515
- if(hasReturn){
7516
- try {
7517
- // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7518
- let fn = new Function("arg", config.eventContent);
7519
- config.eventContent = fn;
7520
- } catch (e) {
7521
- console.warn(e);
7522
- }
7523
- }
7524
- }
7525
-
7526
- if(config.noEventsContent && typeof config.noEventsContent === "string"){
7527
- const hasReturn = /\breturn\b/.test(config.noEventsContent);
7528
- if(hasReturn){
7529
- try {
7530
- // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7531
- let fn = new Function("arg", config.noEventsContent);
7532
- config.noEventsContent = fn;
7533
- } catch (e) {
7534
- console.warn(e);
7535
- }
7536
- }
7537
- }
7538
-
7363
+
7539
7364
  const amisSchema = {
7540
7365
  "type": "steedos-fullcalendar",
7541
7366
  "label": "",
@@ -7545,8 +7370,135 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7545
7370
  "selectMirror": permissions.allowCreate,
7546
7371
  "initialView": initialView,
7547
7372
  "businessHours": businessHours,
7548
- ...config,
7549
- "onEvent": onEvent
7373
+ "onEvent": {
7374
+ "getEvents": {
7375
+ "weight": 0,
7376
+ "actions": [
7377
+ {
7378
+ "componentId": "",
7379
+ "args": {
7380
+ },
7381
+ "actionType": "custom",
7382
+ "script": onGetEventsScript
7383
+ }
7384
+ ]
7385
+ },
7386
+ "select": {
7387
+ "weight": 0,
7388
+ "actions": [
7389
+ {
7390
+ "componentId": "",
7391
+ "args": {
7392
+ },
7393
+ "actionType": "custom",
7394
+ "script": onSelectScript
7395
+ }
7396
+ ]
7397
+ },
7398
+ "eventClick": {
7399
+ "weight": 0,
7400
+ "actions": [
7401
+ {
7402
+ "componentId": "",
7403
+ "args": {
7404
+ },
7405
+ "actionType": "custom",
7406
+ "script": onEventClickScript
7407
+ }
7408
+ ]
7409
+ },
7410
+ "eventAdd": {
7411
+ "weight": 0,
7412
+ "actions": [
7413
+ {
7414
+ "componentId": "",
7415
+ "args": {
7416
+ },
7417
+ "actionType": "custom",
7418
+ "script": "console.log('eventAdd'); console.log(event);"
7419
+ }
7420
+ ]
7421
+ },
7422
+ "eventChange": {
7423
+ "weight": 0,
7424
+ "actions": [
7425
+ {
7426
+ "actionType": 'ajax',
7427
+ "args": {
7428
+ "api": recordPermissionsApi
7429
+ }
7430
+ },
7431
+ {
7432
+ "actionType": "toast",
7433
+ "expression": "!event.data.editable",
7434
+ "args": {
7435
+ "msgType": "error",
7436
+ "msg": "您没有编辑该记录的权限!",
7437
+ "position": "top-center"
7438
+ }
7439
+ },
7440
+ {
7441
+ "actionType": 'ajax',
7442
+ "expression": "event.data.editable",
7443
+ "args": {
7444
+ "api": recordSaveApi,
7445
+ "messages": {
7446
+ "success": objectSchema.label + "修改成功",
7447
+ "failed": objectSchema.label + "修改失败!"
7448
+ }
7449
+ }
7450
+ }
7451
+ ]
7452
+ },
7453
+ "eventRemove": {
7454
+ "weight": 0,
7455
+ "actions": [
7456
+ {
7457
+ "componentId": "",
7458
+ "args": {
7459
+ },
7460
+ "actionType": "custom",
7461
+ "script": "console.log('eventRemove'); console.log(event);"
7462
+ }
7463
+ ]
7464
+ },
7465
+ "eventsSet": {
7466
+ "weight": 0,
7467
+ "actions": [
7468
+ {
7469
+ "componentId": "",
7470
+ "args": {
7471
+ },
7472
+ "actionType": "custom",
7473
+ "script": "console.log('eventsSet'); console.log(event);"
7474
+ }
7475
+ ]
7476
+ },
7477
+ "eventDidMount": {
7478
+ "weight": 0,
7479
+ "actions": [
7480
+ {
7481
+ "componentId": "",
7482
+ "args": {
7483
+ },
7484
+ "actionType": "custom",
7485
+ "script": "console.log('eventDidMount'); console.log(event);"
7486
+ }
7487
+ ]
7488
+ },
7489
+ "eventWillUnmount": {
7490
+ "weight": 0,
7491
+ "actions": [
7492
+ {
7493
+ "componentId": "",
7494
+ "args": {
7495
+ },
7496
+ "actionType": "custom",
7497
+ "script": "console.log('eventWillUnmount'); console.log(event);"
7498
+ }
7499
+ ]
7500
+ },
7501
+ }
7550
7502
  };
7551
7503
  return amisSchema;
7552
7504
  }
@@ -12110,12 +12062,11 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
12110
12062
  }); };
12111
12063
 
12112
12064
  var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
12113
- var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, onEvent, config, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
12065
+ var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
12114
12066
  return __generator(this, function (_b) {
12115
12067
  switch (_b.label) {
12116
12068
  case 0:
12117
- console.log("AmisObjectCalendar props", props);
12118
- 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;
12069
+ 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;
12119
12070
  objectApiName = props.objectApiName || "events";
12120
12071
  amisSchemaData = Object.assign({}, data, defaultData);
12121
12072
  return [4 /*yield*/, getCalendarSchema(amisSchemaData.appId, objectApiName, {
@@ -12125,7 +12076,7 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
12125
12076
  endDateExpr: endDateExpr,
12126
12077
  allDayExpr: allDayExpr,
12127
12078
  textExpr: textExpr
12128
- }, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction, onEvent: onEvent, config: config })];
12079
+ }, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction })];
12129
12080
  case 1:
12130
12081
  schema = (_b.sent());
12131
12082
  uiSchema = schema.uiSchema;
@@ -13215,7 +13166,7 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
13215
13166
  "showHeader": true,
13216
13167
  "showDisplayAs": (defaultFormFactor !== 'SMALL'),
13217
13168
  "formFactor": formFactor,
13218
- "className": (displayAs === 'split') ? 'w-full' : 'p-0 flex-1 sm:m-3 sm:mb-0 sm:border sm:shadow sm:rounded border-slate-300 border-solid bg-gray-100'
13169
+ "className": (displayAs === 'split') ? 'w-full' : 'p-0 flex-1 overflow-hidden h-full sm:m-3 sm:mb-0 sm:border sm:shadow sm:rounded border-slate-300 border-solid bg-gray-100'
13219
13170
  };
13220
13171
  defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: listViewId, listName: listviewId, appId: appId, formFactor: formFactor, displayAs: displayAs });
13221
13172
  return [2 /*return*/, {