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