@steedos-widgets/amis-lib 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.
package/dist/index.esm.js CHANGED
@@ -1363,8 +1363,8 @@ var config = {
1363
1363
  /*
1364
1364
  * @Author: baozhoutao@steedos.com
1365
1365
  * @Date: 2022-11-01 15:51:00
1366
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1367
- * @LastEditTime: 2023-03-27 15:42:24
1366
+ * @LastEditors: 廖大雪 2291335922@qq.com
1367
+ * @LastEditTime: 2023-03-09 15:16:10
1368
1368
  * @Description:
1369
1369
  */
1370
1370
 
@@ -1404,7 +1404,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
1404
1404
  "type": "dialog",
1405
1405
  "data": {
1406
1406
  "$master": "$$",
1407
- "_master": "${_master}",
1408
1407
  "defaultData": "${defaultData}",
1409
1408
  "appId": "${appId}",
1410
1409
  "objectName": "${objectName}",
@@ -1476,8 +1475,8 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
1476
1475
  /*
1477
1476
  * @Author: baozhoutao@steedos.com
1478
1477
  * @Date: 2022-11-01 15:49:58
1479
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1480
- * @LastEditTime: 2023-03-27 11:36:49
1478
+ * @LastEditors: baozhoutao@steedos.com
1479
+ * @LastEditTime: 2022-11-08 16:39:40
1481
1480
  * @Description:
1482
1481
  */
1483
1482
 
@@ -1543,12 +1542,6 @@ const getSchema$3 = async (uiSchema, ctx) => {
1543
1542
  };
1544
1543
  };
1545
1544
 
1546
- /*
1547
- * @Author: 殷亮辉 yinlianghui@hotoa.com
1548
- * @Date: 2023-03-22 09:31:21
1549
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1550
- * @LastEditTime: 2023-03-27 16:03:34
1551
- */
1552
1545
  const getSchema$2 = (uiSchema)=>{
1553
1546
  return {
1554
1547
  "type": "service",
@@ -1599,16 +1592,6 @@ const getSchema$2 = (uiSchema)=>{
1599
1592
  "objectName": `${uiSchema.name}`,
1600
1593
  "__deletedRecord": true
1601
1594
  }
1602
- },
1603
- {
1604
- "actionType": "broadcast",
1605
- "args": {
1606
- "eventName": "@data.changed.${_master.objectName}"
1607
- },
1608
- "data": {
1609
- "objectName": "${_master.objectName}"
1610
- },
1611
- "expression": "${_master.objectName}"
1612
1595
  }
1613
1596
  ]
1614
1597
  }
@@ -3958,15 +3941,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
3958
3941
  `;
3959
3942
  source.adaptor = `
3960
3943
  const enable_tree = ${refObjectConfig.enable_tree};
3961
- const op = api.data.$self.op;
3962
- if(!_.isEmpty(op)){
3963
- // op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
3964
- const rows = _.map(payload.data.rows, (item)=>{
3965
- return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
3966
- })
3967
- payload.data.rows = rows;
3968
- return payload;
3969
- }
3970
3944
  if(enable_tree){
3971
3945
  const records = payload.data.rows;
3972
3946
  const treeRecords = [];
@@ -5843,16 +5817,6 @@ async function getObjectForm(objectSchema, ctx){
5843
5817
  "data": {
5844
5818
  "objectName": `${objectSchema.name}`
5845
5819
  }
5846
- },
5847
- {
5848
- "actionType": "broadcast",
5849
- "args": {
5850
- "eventName": "@data.changed.${_master.objectName}"
5851
- },
5852
- "data": {
5853
- "objectName": "${_master.objectName}"
5854
- },
5855
- "expression": "${_master.objectName}"
5856
5820
  }
5857
5821
  ]
5858
5822
  }
@@ -6644,7 +6608,7 @@ async function getCalendarApi(mainObject, fields, options) {
6644
6608
  const searchableFields = [];
6645
6609
  let { filter, sort, top, setDataToComponentId = '' } = options;
6646
6610
 
6647
- if (!top) {
6611
+ if(!top){
6648
6612
  // 日历请求不翻页
6649
6613
  top = 200;
6650
6614
  }
@@ -6770,8 +6734,7 @@ async function getCalendarApi(mainObject, fields, options) {
6770
6734
  title: n["${calendarOptions.textExpr}"],
6771
6735
  start: n["${calendarOptions.startDateExpr}"],
6772
6736
  end: n["${calendarOptions.endDateExpr}"],
6773
- allDay: n["${calendarOptions.allDayExpr}"],
6774
- extendedProps: n
6737
+ allDay: n["${calendarOptions.allDayExpr}"]
6775
6738
  }
6776
6739
  });
6777
6740
  const successCallback = selfData.successCallback;
@@ -6844,7 +6807,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
6844
6807
  return payload;
6845
6808
  `,
6846
6809
  headers: {
6847
- Authorization: "Bearer ${context.tenantId},${context.authToken}"
6810
+ Authorization: "Bearer ${context.tenantId},${context.authToken}"
6848
6811
  }
6849
6812
  };
6850
6813
  }
@@ -6863,9 +6826,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
6863
6826
  calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, omitBy(calendarOptions, isNil));
6864
6827
 
6865
6828
  const titleFields = calendarOptions.title || [
6866
- calendarOptions.startDateExpr,
6867
- calendarOptions.endDateExpr,
6868
- calendarOptions.allDayExpr,
6829
+ calendarOptions.startDateExpr,
6830
+ calendarOptions.endDateExpr,
6831
+ calendarOptions.allDayExpr,
6869
6832
  calendarOptions.textExpr
6870
6833
  ];
6871
6834
  let fields = [];
@@ -6889,9 +6852,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
6889
6852
  }
6890
6853
  }
6891
6854
  let initialView = calendarOptions.currentView;
6892
- if (initialView) {
6855
+ if(initialView){
6893
6856
  // day, week, month, agenda
6894
- switch (initialView) {
6857
+ switch(initialView){
6895
6858
  case "day":
6896
6859
  initialView = "timeGridDay";
6897
6860
  break;
@@ -6998,154 +6961,19 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
6998
6961
  const recordId = "${event.id}";
6999
6962
  const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
7000
6963
  const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
7001
-
6964
+
7002
6965
  const businessHours = {
7003
- daysOfWeek: [1, 2, 3, 4, 5],
6966
+ daysOfWeek: [ 1, 2, 3, 4, 5 ],
7004
6967
  startTime: '08:00',
7005
6968
  endTime: '18:00',
7006
6969
  };
7007
- if (!isEmpty(calendarOptions.startDayHour)) {
6970
+ if(!isEmpty(calendarOptions.startDayHour)){
7008
6971
  businessHours.startTime = `${calendarOptions.startDayHour}:00`;
7009
6972
  }
7010
- if (!isEmpty(calendarOptions.endDayHour)) {
6973
+ if(!isEmpty(calendarOptions.endDayHour)){
7011
6974
  businessHours.endTime = `${calendarOptions.endDayHour}:00`;
7012
6975
  }
7013
-
7014
- const onEvent = {
7015
- "getEvents": {
7016
- "weight": 0,
7017
- "actions": [
7018
- {
7019
- "componentId": "",
7020
- "args": {
7021
- },
7022
- "actionType": "custom",
7023
- "script": onGetEventsScript
7024
- }
7025
- ]
7026
- },
7027
- "select": {
7028
- "weight": 0,
7029
- "actions": [
7030
- {
7031
- "componentId": "",
7032
- "args": {
7033
- },
7034
- "actionType": "custom",
7035
- "script": onSelectScript
7036
- }
7037
- ]
7038
- },
7039
- "eventClick": {
7040
- "weight": 0,
7041
- "actions": [
7042
- {
7043
- "componentId": "",
7044
- "args": {
7045
- },
7046
- "actionType": "custom",
7047
- "script": onEventClickScript
7048
- }
7049
- ]
7050
- },
7051
- "eventAdd": {
7052
- "weight": 0,
7053
- "actions": [
7054
- {
7055
- "componentId": "",
7056
- "args": {
7057
- },
7058
- "actionType": "custom",
7059
- "script": "console.log('eventAdd'); console.log(event);"
7060
- }
7061
- ]
7062
- },
7063
- "eventChange": {
7064
- "weight": 0,
7065
- "actions": [
7066
- {
7067
- "actionType": 'ajax',
7068
- "args": {
7069
- "api": recordPermissionsApi
7070
- }
7071
- },
7072
- {
7073
- "actionType": "toast",
7074
- "expression": "!event.data.editable",
7075
- "args": {
7076
- "msgType": "error",
7077
- "msg": "您没有编辑该记录的权限!",
7078
- "position": "top-center"
7079
- }
7080
- },
7081
- {
7082
- "actionType": 'ajax',
7083
- "expression": "event.data.editable",
7084
- "args": {
7085
- "api": recordSaveApi,
7086
- "messages": {
7087
- "success": objectSchema.label + "修改成功",
7088
- "failed": objectSchema.label + "修改失败!"
7089
- }
7090
- }
7091
- }
7092
- ]
7093
- },
7094
- "eventRemove": {
7095
- "weight": 0,
7096
- "actions": [
7097
- {
7098
- "componentId": "",
7099
- "args": {
7100
- },
7101
- "actionType": "custom",
7102
- "script": "console.log('eventRemove'); console.log(event);"
7103
- }
7104
- ]
7105
- },
7106
- "eventsSet": {
7107
- "weight": 0,
7108
- "actions": [
7109
- {
7110
- "componentId": "",
7111
- "args": {
7112
- },
7113
- "actionType": "custom",
7114
- "script": "console.log('eventsSet'); console.log(event);"
7115
- }
7116
- ]
7117
- }
7118
- };
7119
-
7120
- Object.assign(onEvent, options.onEvent);
7121
-
7122
- const config = options.config || {};
7123
- if(config.eventContent && typeof config.eventContent === "string"){
7124
- const hasReturn = /\breturn\b/.test(config.eventContent);
7125
- if(hasReturn){
7126
- try {
7127
- // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7128
- let fn = new Function("arg", config.eventContent);
7129
- config.eventContent = fn;
7130
- } catch (e) {
7131
- console.warn(e);
7132
- }
7133
- }
7134
- }
7135
-
7136
- if(config.noEventsContent && typeof config.noEventsContent === "string"){
7137
- const hasReturn = /\breturn\b/.test(config.noEventsContent);
7138
- if(hasReturn){
7139
- try {
7140
- // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7141
- let fn = new Function("arg", config.noEventsContent);
7142
- config.noEventsContent = fn;
7143
- } catch (e) {
7144
- console.warn(e);
7145
- }
7146
- }
7147
- }
7148
-
6976
+
7149
6977
  const amisSchema = {
7150
6978
  "type": "steedos-fullcalendar",
7151
6979
  "label": "",
@@ -7155,8 +6983,135 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7155
6983
  "selectMirror": permissions.allowCreate,
7156
6984
  "initialView": initialView,
7157
6985
  "businessHours": businessHours,
7158
- ...config,
7159
- "onEvent": onEvent
6986
+ "onEvent": {
6987
+ "getEvents": {
6988
+ "weight": 0,
6989
+ "actions": [
6990
+ {
6991
+ "componentId": "",
6992
+ "args": {
6993
+ },
6994
+ "actionType": "custom",
6995
+ "script": onGetEventsScript
6996
+ }
6997
+ ]
6998
+ },
6999
+ "select": {
7000
+ "weight": 0,
7001
+ "actions": [
7002
+ {
7003
+ "componentId": "",
7004
+ "args": {
7005
+ },
7006
+ "actionType": "custom",
7007
+ "script": onSelectScript
7008
+ }
7009
+ ]
7010
+ },
7011
+ "eventClick": {
7012
+ "weight": 0,
7013
+ "actions": [
7014
+ {
7015
+ "componentId": "",
7016
+ "args": {
7017
+ },
7018
+ "actionType": "custom",
7019
+ "script": onEventClickScript
7020
+ }
7021
+ ]
7022
+ },
7023
+ "eventAdd": {
7024
+ "weight": 0,
7025
+ "actions": [
7026
+ {
7027
+ "componentId": "",
7028
+ "args": {
7029
+ },
7030
+ "actionType": "custom",
7031
+ "script": "console.log('eventAdd'); console.log(event);"
7032
+ }
7033
+ ]
7034
+ },
7035
+ "eventChange": {
7036
+ "weight": 0,
7037
+ "actions": [
7038
+ {
7039
+ "actionType": 'ajax',
7040
+ "args": {
7041
+ "api": recordPermissionsApi
7042
+ }
7043
+ },
7044
+ {
7045
+ "actionType": "toast",
7046
+ "expression": "!event.data.editable",
7047
+ "args": {
7048
+ "msgType": "error",
7049
+ "msg": "您没有编辑该记录的权限!",
7050
+ "position": "top-center"
7051
+ }
7052
+ },
7053
+ {
7054
+ "actionType": 'ajax',
7055
+ "expression": "event.data.editable",
7056
+ "args": {
7057
+ "api": recordSaveApi,
7058
+ "messages": {
7059
+ "success": objectSchema.label + "修改成功",
7060
+ "failed": objectSchema.label + "修改失败!"
7061
+ }
7062
+ }
7063
+ }
7064
+ ]
7065
+ },
7066
+ "eventRemove": {
7067
+ "weight": 0,
7068
+ "actions": [
7069
+ {
7070
+ "componentId": "",
7071
+ "args": {
7072
+ },
7073
+ "actionType": "custom",
7074
+ "script": "console.log('eventRemove'); console.log(event);"
7075
+ }
7076
+ ]
7077
+ },
7078
+ "eventsSet": {
7079
+ "weight": 0,
7080
+ "actions": [
7081
+ {
7082
+ "componentId": "",
7083
+ "args": {
7084
+ },
7085
+ "actionType": "custom",
7086
+ "script": "console.log('eventsSet'); console.log(event);"
7087
+ }
7088
+ ]
7089
+ },
7090
+ "eventDidMount": {
7091
+ "weight": 0,
7092
+ "actions": [
7093
+ {
7094
+ "componentId": "",
7095
+ "args": {
7096
+ },
7097
+ "actionType": "custom",
7098
+ "script": "console.log('eventDidMount'); console.log(event);"
7099
+ }
7100
+ ]
7101
+ },
7102
+ "eventWillUnmount": {
7103
+ "weight": 0,
7104
+ "actions": [
7105
+ {
7106
+ "componentId": "",
7107
+ "args": {
7108
+ },
7109
+ "actionType": "custom",
7110
+ "script": "console.log('eventWillUnmount'); console.log(event);"
7111
+ }
7112
+ ]
7113
+ },
7114
+ }
7160
7115
  };
7161
7116
  return amisSchema;
7162
7117
  }