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