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