@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.cjs.js CHANGED
@@ -1390,8 +1390,8 @@ var config = {
1390
1390
  /*
1391
1391
  * @Author: baozhoutao@steedos.com
1392
1392
  * @Date: 2022-11-01 15:51:00
1393
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1394
- * @LastEditTime: 2023-03-27 15:42:24
1393
+ * @LastEditors: 廖大雪 2291335922@qq.com
1394
+ * @LastEditTime: 2023-03-09 15:16:10
1395
1395
  * @Description:
1396
1396
  */
1397
1397
 
@@ -1431,7 +1431,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
1431
1431
  "type": "dialog",
1432
1432
  "data": {
1433
1433
  "$master": "$$",
1434
- "_master": "${_master}",
1435
1434
  "defaultData": "${defaultData}",
1436
1435
  "appId": "${appId}",
1437
1436
  "objectName": "${objectName}",
@@ -1503,8 +1502,8 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
1503
1502
  /*
1504
1503
  * @Author: baozhoutao@steedos.com
1505
1504
  * @Date: 2022-11-01 15:49:58
1506
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1507
- * @LastEditTime: 2023-03-27 11:36:49
1505
+ * @LastEditors: baozhoutao@steedos.com
1506
+ * @LastEditTime: 2022-11-08 16:39:40
1508
1507
  * @Description:
1509
1508
  */
1510
1509
 
@@ -1570,12 +1569,6 @@ const getSchema$3 = async (uiSchema, ctx) => {
1570
1569
  };
1571
1570
  };
1572
1571
 
1573
- /*
1574
- * @Author: 殷亮辉 yinlianghui@hotoa.com
1575
- * @Date: 2023-03-22 09:31:21
1576
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
1577
- * @LastEditTime: 2023-03-27 16:03:34
1578
- */
1579
1572
  const getSchema$2 = (uiSchema)=>{
1580
1573
  return {
1581
1574
  "type": "service",
@@ -1626,16 +1619,6 @@ const getSchema$2 = (uiSchema)=>{
1626
1619
  "objectName": `${uiSchema.name}`,
1627
1620
  "__deletedRecord": true
1628
1621
  }
1629
- },
1630
- {
1631
- "actionType": "broadcast",
1632
- "args": {
1633
- "eventName": "@data.changed.${_master.objectName}"
1634
- },
1635
- "data": {
1636
- "objectName": "${_master.objectName}"
1637
- },
1638
- "expression": "${_master.objectName}"
1639
1622
  }
1640
1623
  ]
1641
1624
  }
@@ -3985,15 +3968,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
3985
3968
  `;
3986
3969
  source.adaptor = `
3987
3970
  const enable_tree = ${refObjectConfig.enable_tree};
3988
- const op = api.data.$self.op;
3989
- if(!_.isEmpty(op)){
3990
- // op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
3991
- const rows = _.map(payload.data.rows, (item)=>{
3992
- return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
3993
- })
3994
- payload.data.rows = rows;
3995
- return payload;
3996
- }
3997
3971
  if(enable_tree){
3998
3972
  const records = payload.data.rows;
3999
3973
  const treeRecords = [];
@@ -5870,16 +5844,6 @@ async function getObjectForm(objectSchema, ctx){
5870
5844
  "data": {
5871
5845
  "objectName": `${objectSchema.name}`
5872
5846
  }
5873
- },
5874
- {
5875
- "actionType": "broadcast",
5876
- "args": {
5877
- "eventName": "@data.changed.${_master.objectName}"
5878
- },
5879
- "data": {
5880
- "objectName": "${_master.objectName}"
5881
- },
5882
- "expression": "${_master.objectName}"
5883
5847
  }
5884
5848
  ]
5885
5849
  }
@@ -6671,7 +6635,7 @@ async function getCalendarApi(mainObject, fields, options) {
6671
6635
  const searchableFields = [];
6672
6636
  let { filter, sort, top, setDataToComponentId = '' } = options;
6673
6637
 
6674
- if (!top) {
6638
+ if(!top){
6675
6639
  // 日历请求不翻页
6676
6640
  top = 200;
6677
6641
  }
@@ -6797,8 +6761,7 @@ async function getCalendarApi(mainObject, fields, options) {
6797
6761
  title: n["${calendarOptions.textExpr}"],
6798
6762
  start: n["${calendarOptions.startDateExpr}"],
6799
6763
  end: n["${calendarOptions.endDateExpr}"],
6800
- allDay: n["${calendarOptions.allDayExpr}"],
6801
- extendedProps: n
6764
+ allDay: n["${calendarOptions.allDayExpr}"]
6802
6765
  }
6803
6766
  });
6804
6767
  const successCallback = selfData.successCallback;
@@ -6871,7 +6834,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
6871
6834
  return payload;
6872
6835
  `,
6873
6836
  headers: {
6874
- Authorization: "Bearer ${context.tenantId},${context.authToken}"
6837
+ Authorization: "Bearer ${context.tenantId},${context.authToken}"
6875
6838
  }
6876
6839
  };
6877
6840
  }
@@ -6890,9 +6853,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
6890
6853
  calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, _$1.omitBy(calendarOptions, _$1.isNil));
6891
6854
 
6892
6855
  const titleFields = calendarOptions.title || [
6893
- calendarOptions.startDateExpr,
6894
- calendarOptions.endDateExpr,
6895
- calendarOptions.allDayExpr,
6856
+ calendarOptions.startDateExpr,
6857
+ calendarOptions.endDateExpr,
6858
+ calendarOptions.allDayExpr,
6896
6859
  calendarOptions.textExpr
6897
6860
  ];
6898
6861
  let fields = [];
@@ -6916,9 +6879,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
6916
6879
  }
6917
6880
  }
6918
6881
  let initialView = calendarOptions.currentView;
6919
- if (initialView) {
6882
+ if(initialView){
6920
6883
  // day, week, month, agenda
6921
- switch (initialView) {
6884
+ switch(initialView){
6922
6885
  case "day":
6923
6886
  initialView = "timeGridDay";
6924
6887
  break;
@@ -7025,154 +6988,19 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7025
6988
  const recordId = "${event.id}";
7026
6989
  const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
7027
6990
  const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
7028
-
6991
+
7029
6992
  const businessHours = {
7030
- daysOfWeek: [1, 2, 3, 4, 5],
6993
+ daysOfWeek: [ 1, 2, 3, 4, 5 ],
7031
6994
  startTime: '08:00',
7032
6995
  endTime: '18:00',
7033
6996
  };
7034
- if (!_$1.isEmpty(calendarOptions.startDayHour)) {
6997
+ if(!_$1.isEmpty(calendarOptions.startDayHour)){
7035
6998
  businessHours.startTime = `${calendarOptions.startDayHour}:00`;
7036
6999
  }
7037
- if (!_$1.isEmpty(calendarOptions.endDayHour)) {
7000
+ if(!_$1.isEmpty(calendarOptions.endDayHour)){
7038
7001
  businessHours.endTime = `${calendarOptions.endDayHour}:00`;
7039
7002
  }
7040
-
7041
- const onEvent = {
7042
- "getEvents": {
7043
- "weight": 0,
7044
- "actions": [
7045
- {
7046
- "componentId": "",
7047
- "args": {
7048
- },
7049
- "actionType": "custom",
7050
- "script": onGetEventsScript
7051
- }
7052
- ]
7053
- },
7054
- "select": {
7055
- "weight": 0,
7056
- "actions": [
7057
- {
7058
- "componentId": "",
7059
- "args": {
7060
- },
7061
- "actionType": "custom",
7062
- "script": onSelectScript
7063
- }
7064
- ]
7065
- },
7066
- "eventClick": {
7067
- "weight": 0,
7068
- "actions": [
7069
- {
7070
- "componentId": "",
7071
- "args": {
7072
- },
7073
- "actionType": "custom",
7074
- "script": onEventClickScript
7075
- }
7076
- ]
7077
- },
7078
- "eventAdd": {
7079
- "weight": 0,
7080
- "actions": [
7081
- {
7082
- "componentId": "",
7083
- "args": {
7084
- },
7085
- "actionType": "custom",
7086
- "script": "console.log('eventAdd'); console.log(event);"
7087
- }
7088
- ]
7089
- },
7090
- "eventChange": {
7091
- "weight": 0,
7092
- "actions": [
7093
- {
7094
- "actionType": 'ajax',
7095
- "args": {
7096
- "api": recordPermissionsApi
7097
- }
7098
- },
7099
- {
7100
- "actionType": "toast",
7101
- "expression": "!event.data.editable",
7102
- "args": {
7103
- "msgType": "error",
7104
- "msg": "您没有编辑该记录的权限!",
7105
- "position": "top-center"
7106
- }
7107
- },
7108
- {
7109
- "actionType": 'ajax',
7110
- "expression": "event.data.editable",
7111
- "args": {
7112
- "api": recordSaveApi,
7113
- "messages": {
7114
- "success": objectSchema.label + "修改成功",
7115
- "failed": objectSchema.label + "修改失败!"
7116
- }
7117
- }
7118
- }
7119
- ]
7120
- },
7121
- "eventRemove": {
7122
- "weight": 0,
7123
- "actions": [
7124
- {
7125
- "componentId": "",
7126
- "args": {
7127
- },
7128
- "actionType": "custom",
7129
- "script": "console.log('eventRemove'); console.log(event);"
7130
- }
7131
- ]
7132
- },
7133
- "eventsSet": {
7134
- "weight": 0,
7135
- "actions": [
7136
- {
7137
- "componentId": "",
7138
- "args": {
7139
- },
7140
- "actionType": "custom",
7141
- "script": "console.log('eventsSet'); console.log(event);"
7142
- }
7143
- ]
7144
- }
7145
- };
7146
-
7147
- Object.assign(onEvent, options.onEvent);
7148
-
7149
- const config = options.config || {};
7150
- if(config.eventContent && typeof config.eventContent === "string"){
7151
- const hasReturn = /\breturn\b/.test(config.eventContent);
7152
- if(hasReturn){
7153
- try {
7154
- // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7155
- let fn = new Function("arg", config.eventContent);
7156
- config.eventContent = fn;
7157
- } catch (e) {
7158
- console.warn(e);
7159
- }
7160
- }
7161
- }
7162
-
7163
- if(config.noEventsContent && typeof config.noEventsContent === "string"){
7164
- const hasReturn = /\breturn\b/.test(config.noEventsContent);
7165
- if(hasReturn){
7166
- try {
7167
- // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7168
- let fn = new Function("arg", config.noEventsContent);
7169
- config.noEventsContent = fn;
7170
- } catch (e) {
7171
- console.warn(e);
7172
- }
7173
- }
7174
- }
7175
-
7003
+
7176
7004
  const amisSchema = {
7177
7005
  "type": "steedos-fullcalendar",
7178
7006
  "label": "",
@@ -7182,8 +7010,135 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
7182
7010
  "selectMirror": permissions.allowCreate,
7183
7011
  "initialView": initialView,
7184
7012
  "businessHours": businessHours,
7185
- ...config,
7186
- "onEvent": onEvent
7013
+ "onEvent": {
7014
+ "getEvents": {
7015
+ "weight": 0,
7016
+ "actions": [
7017
+ {
7018
+ "componentId": "",
7019
+ "args": {
7020
+ },
7021
+ "actionType": "custom",
7022
+ "script": onGetEventsScript
7023
+ }
7024
+ ]
7025
+ },
7026
+ "select": {
7027
+ "weight": 0,
7028
+ "actions": [
7029
+ {
7030
+ "componentId": "",
7031
+ "args": {
7032
+ },
7033
+ "actionType": "custom",
7034
+ "script": onSelectScript
7035
+ }
7036
+ ]
7037
+ },
7038
+ "eventClick": {
7039
+ "weight": 0,
7040
+ "actions": [
7041
+ {
7042
+ "componentId": "",
7043
+ "args": {
7044
+ },
7045
+ "actionType": "custom",
7046
+ "script": onEventClickScript
7047
+ }
7048
+ ]
7049
+ },
7050
+ "eventAdd": {
7051
+ "weight": 0,
7052
+ "actions": [
7053
+ {
7054
+ "componentId": "",
7055
+ "args": {
7056
+ },
7057
+ "actionType": "custom",
7058
+ "script": "console.log('eventAdd'); console.log(event);"
7059
+ }
7060
+ ]
7061
+ },
7062
+ "eventChange": {
7063
+ "weight": 0,
7064
+ "actions": [
7065
+ {
7066
+ "actionType": 'ajax',
7067
+ "args": {
7068
+ "api": recordPermissionsApi
7069
+ }
7070
+ },
7071
+ {
7072
+ "actionType": "toast",
7073
+ "expression": "!event.data.editable",
7074
+ "args": {
7075
+ "msgType": "error",
7076
+ "msg": "您没有编辑该记录的权限!",
7077
+ "position": "top-center"
7078
+ }
7079
+ },
7080
+ {
7081
+ "actionType": 'ajax',
7082
+ "expression": "event.data.editable",
7083
+ "args": {
7084
+ "api": recordSaveApi,
7085
+ "messages": {
7086
+ "success": objectSchema.label + "修改成功",
7087
+ "failed": objectSchema.label + "修改失败!"
7088
+ }
7089
+ }
7090
+ }
7091
+ ]
7092
+ },
7093
+ "eventRemove": {
7094
+ "weight": 0,
7095
+ "actions": [
7096
+ {
7097
+ "componentId": "",
7098
+ "args": {
7099
+ },
7100
+ "actionType": "custom",
7101
+ "script": "console.log('eventRemove'); console.log(event);"
7102
+ }
7103
+ ]
7104
+ },
7105
+ "eventsSet": {
7106
+ "weight": 0,
7107
+ "actions": [
7108
+ {
7109
+ "componentId": "",
7110
+ "args": {
7111
+ },
7112
+ "actionType": "custom",
7113
+ "script": "console.log('eventsSet'); console.log(event);"
7114
+ }
7115
+ ]
7116
+ },
7117
+ "eventDidMount": {
7118
+ "weight": 0,
7119
+ "actions": [
7120
+ {
7121
+ "componentId": "",
7122
+ "args": {
7123
+ },
7124
+ "actionType": "custom",
7125
+ "script": "console.log('eventDidMount'); console.log(event);"
7126
+ }
7127
+ ]
7128
+ },
7129
+ "eventWillUnmount": {
7130
+ "weight": 0,
7131
+ "actions": [
7132
+ {
7133
+ "componentId": "",
7134
+ "args": {
7135
+ },
7136
+ "actionType": "custom",
7137
+ "script": "console.log('eventWillUnmount'); console.log(event);"
7138
+ }
7139
+ ]
7140
+ },
7141
+ }
7187
7142
  };
7188
7143
  return amisSchema;
7189
7144
  }