@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.
@@ -1834,8 +1834,8 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
1834
1834
  /*
1835
1835
  * @Author: baozhoutao@steedos.com
1836
1836
  * @Date: 2022-11-01 15:49:58
1837
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1838
- * @LastEditTime: 2023-03-25 17:22:00
1837
+ * @LastEditors: baozhoutao@steedos.com
1838
+ * @LastEditTime: 2022-11-08 16:39:40
1839
1839
  * @Description:
1840
1840
  */
1841
1841
 
@@ -1879,10 +1879,6 @@ const getSchema$3 = async (uiSchema, ctx) => {
1879
1879
  actionType: "dialog",
1880
1880
  dialog: {
1881
1881
  type: "dialog",
1882
- "data": {
1883
- "&": "$$",
1884
- "$master": "$$"
1885
- },
1886
1882
  title: title,
1887
1883
  bodyClassName: "",
1888
1884
  body: [formSchema],
@@ -1905,12 +1901,6 @@ const getSchema$3 = async (uiSchema, ctx) => {
1905
1901
  };
1906
1902
  };
1907
1903
 
1908
- /*
1909
- * @Author: 殷亮辉 yinlianghui@hotoa.com
1910
- * @Date: 2023-03-22 09:31:21
1911
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1912
- * @LastEditTime: 2023-03-25 22:41:27
1913
- */
1914
1904
  const getSchema$2 = (uiSchema)=>{
1915
1905
  return {
1916
1906
  "type": "service",
@@ -1961,16 +1951,6 @@ const getSchema$2 = (uiSchema)=>{
1961
1951
  "objectName": `${uiSchema.name}`,
1962
1952
  "__deletedRecord": true
1963
1953
  }
1964
- },
1965
- {
1966
- "actionType": "broadcast",
1967
- "args": {
1968
- "eventName": "@data.changed.${masterObjectName}"
1969
- },
1970
- "data": {
1971
- "objectName": "${masterObjectName}"
1972
- },
1973
- "expression": "${masterObjectName}"
1974
1954
  }
1975
1955
  ]
1976
1956
  }
@@ -4320,15 +4300,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
4320
4300
  `;
4321
4301
  source.adaptor = `
4322
4302
  const enable_tree = ${refObjectConfig.enable_tree};
4323
- const op = api.data.$self.op;
4324
- if(!_.isEmpty(op)){
4325
- // op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
4326
- const rows = _.map(payload.data.rows, (item)=>{
4327
- return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
4328
- })
4329
- payload.data.rows = rows;
4330
- return payload;
4331
- }
4332
4303
  if(enable_tree){
4333
4304
  const records = payload.data.rows;
4334
4305
  const treeRecords = [];
@@ -6205,16 +6176,6 @@ async function getObjectForm(objectSchema, ctx){
6205
6176
  "data": {
6206
6177
  "objectName": `${objectSchema.name}`
6207
6178
  }
6208
- },
6209
- {
6210
- "actionType": "broadcast",
6211
- "args": {
6212
- "eventName": "@data.changed.${$master.masterObjectName}"
6213
- },
6214
- "data": {
6215
- "objectName": "${$master.masterObjectName}"
6216
- },
6217
- "expression": "${$master.masterObjectName}"
6218
6179
  }
6219
6180
  ]
6220
6181
  }
@@ -7006,7 +6967,7 @@ async function getCalendarApi(mainObject, fields, options) {
7006
6967
  const searchableFields = [];
7007
6968
  let { filter, sort, top, setDataToComponentId = '' } = options;
7008
6969
 
7009
- if (!top) {
6970
+ if(!top){
7010
6971
  // 日历请求不翻页
7011
6972
  top = 200;
7012
6973
  }
@@ -7132,8 +7093,7 @@ async function getCalendarApi(mainObject, fields, options) {
7132
7093
  title: n["${calendarOptions.textExpr}"],
7133
7094
  start: n["${calendarOptions.startDateExpr}"],
7134
7095
  end: n["${calendarOptions.endDateExpr}"],
7135
- allDay: n["${calendarOptions.allDayExpr}"],
7136
- extendedProps: n
7096
+ allDay: n["${calendarOptions.allDayExpr}"]
7137
7097
  }
7138
7098
  });
7139
7099
  const successCallback = selfData.successCallback;
@@ -7206,7 +7166,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
7206
7166
  return payload;
7207
7167
  `,
7208
7168
  headers: {
7209
- Authorization: "Bearer ${context.tenantId},${context.authToken}"
7169
+ Authorization: "Bearer ${context.tenantId},${context.authToken}"
7210
7170
  }
7211
7171
  };
7212
7172
  }
@@ -7225,9 +7185,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7225
7185
  calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, omitBy(calendarOptions, isNil));
7226
7186
 
7227
7187
  const titleFields = calendarOptions.title || [
7228
- calendarOptions.startDateExpr,
7229
- calendarOptions.endDateExpr,
7230
- calendarOptions.allDayExpr,
7188
+ calendarOptions.startDateExpr,
7189
+ calendarOptions.endDateExpr,
7190
+ calendarOptions.allDayExpr,
7231
7191
  calendarOptions.textExpr
7232
7192
  ];
7233
7193
  let fields = [];
@@ -7251,9 +7211,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7251
7211
  }
7252
7212
  }
7253
7213
  let initialView = calendarOptions.currentView;
7254
- if (initialView) {
7214
+ if(initialView){
7255
7215
  // day, week, month, agenda
7256
- switch (initialView) {
7216
+ switch(initialView){
7257
7217
  case "day":
7258
7218
  initialView = "timeGridDay";
7259
7219
  break;
@@ -7360,154 +7320,19 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7360
7320
  const recordId = "${event.id}";
7361
7321
  const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
7362
7322
  const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
7363
-
7323
+
7364
7324
  const businessHours = {
7365
- daysOfWeek: [1, 2, 3, 4, 5],
7325
+ daysOfWeek: [ 1, 2, 3, 4, 5 ],
7366
7326
  startTime: '08:00',
7367
7327
  endTime: '18:00',
7368
7328
  };
7369
- if (!isEmpty(calendarOptions.startDayHour)) {
7329
+ if(!isEmpty(calendarOptions.startDayHour)){
7370
7330
  businessHours.startTime = `${calendarOptions.startDayHour}:00`;
7371
7331
  }
7372
- if (!isEmpty(calendarOptions.endDayHour)) {
7332
+ if(!isEmpty(calendarOptions.endDayHour)){
7373
7333
  businessHours.endTime = `${calendarOptions.endDayHour}:00`;
7374
7334
  }
7375
-
7376
- const onEvent = {
7377
- "getEvents": {
7378
- "weight": 0,
7379
- "actions": [
7380
- {
7381
- "componentId": "",
7382
- "args": {
7383
- },
7384
- "actionType": "custom",
7385
- "script": onGetEventsScript
7386
- }
7387
- ]
7388
- },
7389
- "select": {
7390
- "weight": 0,
7391
- "actions": [
7392
- {
7393
- "componentId": "",
7394
- "args": {
7395
- },
7396
- "actionType": "custom",
7397
- "script": onSelectScript
7398
- }
7399
- ]
7400
- },
7401
- "eventClick": {
7402
- "weight": 0,
7403
- "actions": [
7404
- {
7405
- "componentId": "",
7406
- "args": {
7407
- },
7408
- "actionType": "custom",
7409
- "script": onEventClickScript
7410
- }
7411
- ]
7412
- },
7413
- "eventAdd": {
7414
- "weight": 0,
7415
- "actions": [
7416
- {
7417
- "componentId": "",
7418
- "args": {
7419
- },
7420
- "actionType": "custom",
7421
- "script": "console.log('eventAdd'); console.log(event);"
7422
- }
7423
- ]
7424
- },
7425
- "eventChange": {
7426
- "weight": 0,
7427
- "actions": [
7428
- {
7429
- "actionType": 'ajax',
7430
- "args": {
7431
- "api": recordPermissionsApi
7432
- }
7433
- },
7434
- {
7435
- "actionType": "toast",
7436
- "expression": "!event.data.editable",
7437
- "args": {
7438
- "msgType": "error",
7439
- "msg": "您没有编辑该记录的权限!",
7440
- "position": "top-center"
7441
- }
7442
- },
7443
- {
7444
- "actionType": 'ajax',
7445
- "expression": "event.data.editable",
7446
- "args": {
7447
- "api": recordSaveApi,
7448
- "messages": {
7449
- "success": objectSchema.label + "修改成功",
7450
- "failed": objectSchema.label + "修改失败!"
7451
- }
7452
- }
7453
- }
7454
- ]
7455
- },
7456
- "eventRemove": {
7457
- "weight": 0,
7458
- "actions": [
7459
- {
7460
- "componentId": "",
7461
- "args": {
7462
- },
7463
- "actionType": "custom",
7464
- "script": "console.log('eventRemove'); console.log(event);"
7465
- }
7466
- ]
7467
- },
7468
- "eventsSet": {
7469
- "weight": 0,
7470
- "actions": [
7471
- {
7472
- "componentId": "",
7473
- "args": {
7474
- },
7475
- "actionType": "custom",
7476
- "script": "console.log('eventsSet'); console.log(event);"
7477
- }
7478
- ]
7479
- }
7480
- };
7481
-
7482
- Object.assign(onEvent, options.onEvent);
7483
-
7484
- const config = options.config || {};
7485
- if(config.eventContent && typeof config.eventContent === "string"){
7486
- const hasReturn = /\breturn\b/.test(config.eventContent);
7487
- if(hasReturn){
7488
- try {
7489
- // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7490
- let fn = new Function("arg", config.eventContent);
7491
- config.eventContent = fn;
7492
- } catch (e) {
7493
- console.warn(e);
7494
- }
7495
- }
7496
- }
7497
-
7498
- if(config.noEventsContent && typeof config.noEventsContent === "string"){
7499
- const hasReturn = /\breturn\b/.test(config.noEventsContent);
7500
- if(hasReturn){
7501
- try {
7502
- // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7503
- let fn = new Function("arg", config.noEventsContent);
7504
- config.noEventsContent = fn;
7505
- } catch (e) {
7506
- console.warn(e);
7507
- }
7508
- }
7509
- }
7510
-
7335
+
7511
7336
  const amisSchema = {
7512
7337
  "type": "steedos-fullcalendar",
7513
7338
  "label": "",
@@ -7517,8 +7342,135 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7517
7342
  "selectMirror": permissions.allowCreate,
7518
7343
  "initialView": initialView,
7519
7344
  "businessHours": businessHours,
7520
- ...config,
7521
- "onEvent": onEvent
7345
+ "onEvent": {
7346
+ "getEvents": {
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
+ }
7522
7474
  };
7523
7475
  return amisSchema;
7524
7476
  }
@@ -12082,12 +12034,11 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
12082
12034
  }); };
12083
12035
 
12084
12036
  var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
12085
- var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, onEvent, config, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
12037
+ var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
12086
12038
  return __generator(this, function (_b) {
12087
12039
  switch (_b.label) {
12088
12040
  case 0:
12089
- console.log("AmisObjectCalendar props", props);
12090
- 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;
12041
+ 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;
12091
12042
  objectApiName = props.objectApiName || "events";
12092
12043
  amisSchemaData = Object.assign({}, data, defaultData);
12093
12044
  return [4 /*yield*/, getCalendarSchema(amisSchemaData.appId, objectApiName, {
@@ -12097,7 +12048,7 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
12097
12048
  endDateExpr: endDateExpr,
12098
12049
  allDayExpr: allDayExpr,
12099
12050
  textExpr: textExpr
12100
- }, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction, onEvent: onEvent, config: config })];
12051
+ }, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction })];
12101
12052
  case 1:
12102
12053
  schema = (_b.sent());
12103
12054
  uiSchema = schema.uiSchema;
@@ -13187,7 +13138,7 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
13187
13138
  "showHeader": true,
13188
13139
  "showDisplayAs": (defaultFormFactor !== 'SMALL'),
13189
13140
  "formFactor": formFactor,
13190
- "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'
13141
+ "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'
13191
13142
  };
13192
13143
  defData = __assign$2(__assign$2({}, $schema.data), { objectName: objectApiName, listViewId: listViewId, listName: listviewId, appId: appId, formFactor: formFactor, displayAs: displayAs });
13193
13144
  return [2 /*return*/, {