@steedos-widgets/amis-lib 1.1.0 → 1.1.1

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
@@ -3967,6 +3967,11 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
3967
3967
  `;
3968
3968
  source.adaptor = `
3969
3969
  const enable_tree = ${refObjectConfig.enable_tree};
3970
+ const value = api.data.$self.value;
3971
+ if(!_.isEmpty(value)){
3972
+ // value 不为空值,表示返回当前选中节点信息
3973
+ return payload;
3974
+ }
3970
3975
  if(enable_tree){
3971
3976
  const records = payload.data.rows;
3972
3977
  const treeRecords = [];
@@ -6634,7 +6639,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
6634
6639
  const searchableFields = [];
6635
6640
  let { filter, sort, top, setDataToComponentId = '' } = options;
6636
6641
 
6637
- if(!top){
6642
+ if (!top) {
6638
6643
  // 日历请求不翻页
6639
6644
  top = 200;
6640
6645
  }
@@ -6760,7 +6765,8 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
6760
6765
  title: n["${calendarOptions.textExpr}"],
6761
6766
  start: n["${calendarOptions.startDateExpr}"],
6762
6767
  end: n["${calendarOptions.endDateExpr}"],
6763
- allDay: n["${calendarOptions.allDayExpr}"]
6768
+ allDay: n["${calendarOptions.allDayExpr}"],
6769
+ extendedProps: n
6764
6770
  }
6765
6771
  });
6766
6772
  const successCallback = selfData.successCallback;
@@ -6833,7 +6839,7 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
6833
6839
  return payload;
6834
6840
  `,
6835
6841
  headers: {
6836
- Authorization: "Bearer ${context.tenantId},${context.authToken}"
6842
+ Authorization: "Bearer ${context.tenantId},${context.authToken}"
6837
6843
  }
6838
6844
  };
6839
6845
  }
@@ -6852,9 +6858,9 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
6852
6858
  calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, _$1.omitBy(calendarOptions, _$1.isNil));
6853
6859
 
6854
6860
  const titleFields = calendarOptions.title || [
6855
- calendarOptions.startDateExpr,
6856
- calendarOptions.endDateExpr,
6857
- calendarOptions.allDayExpr,
6861
+ calendarOptions.startDateExpr,
6862
+ calendarOptions.endDateExpr,
6863
+ calendarOptions.allDayExpr,
6858
6864
  calendarOptions.textExpr
6859
6865
  ];
6860
6866
  let fields = [];
@@ -6878,9 +6884,9 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
6878
6884
  }
6879
6885
  }
6880
6886
  let initialView = calendarOptions.currentView;
6881
- if(initialView){
6887
+ if (initialView) {
6882
6888
  // day, week, month, agenda
6883
- switch(initialView){
6889
+ switch (initialView) {
6884
6890
  case "day":
6885
6891
  initialView = "timeGridDay";
6886
6892
  break;
@@ -6987,19 +6993,154 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
6987
6993
  const recordId = "${event.id}";
6988
6994
  const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
6989
6995
  const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
6990
-
6996
+
6991
6997
  const businessHours = {
6992
- daysOfWeek: [ 1, 2, 3, 4, 5 ],
6998
+ daysOfWeek: [1, 2, 3, 4, 5],
6993
6999
  startTime: '08:00',
6994
7000
  endTime: '18:00',
6995
7001
  };
6996
- if(!_$1.isEmpty(calendarOptions.startDayHour)){
7002
+ if (!_$1.isEmpty(calendarOptions.startDayHour)) {
6997
7003
  businessHours.startTime = `${calendarOptions.startDayHour}:00`;
6998
7004
  }
6999
- if(!_$1.isEmpty(calendarOptions.endDayHour)){
7005
+ if (!_$1.isEmpty(calendarOptions.endDayHour)) {
7000
7006
  businessHours.endTime = `${calendarOptions.endDayHour}:00`;
7001
7007
  }
7002
-
7008
+
7009
+ const onEvent = {
7010
+ "getEvents": {
7011
+ "weight": 0,
7012
+ "actions": [
7013
+ {
7014
+ "componentId": "",
7015
+ "args": {
7016
+ },
7017
+ "actionType": "custom",
7018
+ "script": onGetEventsScript
7019
+ }
7020
+ ]
7021
+ },
7022
+ "select": {
7023
+ "weight": 0,
7024
+ "actions": [
7025
+ {
7026
+ "componentId": "",
7027
+ "args": {
7028
+ },
7029
+ "actionType": "custom",
7030
+ "script": onSelectScript
7031
+ }
7032
+ ]
7033
+ },
7034
+ "eventClick": {
7035
+ "weight": 0,
7036
+ "actions": [
7037
+ {
7038
+ "componentId": "",
7039
+ "args": {
7040
+ },
7041
+ "actionType": "custom",
7042
+ "script": onEventClickScript
7043
+ }
7044
+ ]
7045
+ },
7046
+ "eventAdd": {
7047
+ "weight": 0,
7048
+ "actions": [
7049
+ {
7050
+ "componentId": "",
7051
+ "args": {
7052
+ },
7053
+ "actionType": "custom",
7054
+ "script": "console.log('eventAdd'); console.log(event);"
7055
+ }
7056
+ ]
7057
+ },
7058
+ "eventChange": {
7059
+ "weight": 0,
7060
+ "actions": [
7061
+ {
7062
+ "actionType": 'ajax',
7063
+ "args": {
7064
+ "api": recordPermissionsApi
7065
+ }
7066
+ },
7067
+ {
7068
+ "actionType": "toast",
7069
+ "expression": "!event.data.editable",
7070
+ "args": {
7071
+ "msgType": "error",
7072
+ "msg": "您没有编辑该记录的权限!",
7073
+ "position": "top-center"
7074
+ }
7075
+ },
7076
+ {
7077
+ "actionType": 'ajax',
7078
+ "expression": "event.data.editable",
7079
+ "args": {
7080
+ "api": recordSaveApi,
7081
+ "messages": {
7082
+ "success": objectSchema.label + "修改成功",
7083
+ "failed": objectSchema.label + "修改失败!"
7084
+ }
7085
+ }
7086
+ }
7087
+ ]
7088
+ },
7089
+ "eventRemove": {
7090
+ "weight": 0,
7091
+ "actions": [
7092
+ {
7093
+ "componentId": "",
7094
+ "args": {
7095
+ },
7096
+ "actionType": "custom",
7097
+ "script": "console.log('eventRemove'); console.log(event);"
7098
+ }
7099
+ ]
7100
+ },
7101
+ "eventsSet": {
7102
+ "weight": 0,
7103
+ "actions": [
7104
+ {
7105
+ "componentId": "",
7106
+ "args": {
7107
+ },
7108
+ "actionType": "custom",
7109
+ "script": "console.log('eventsSet'); console.log(event);"
7110
+ }
7111
+ ]
7112
+ }
7113
+ };
7114
+
7115
+ Object.assign(onEvent, options.onEvent);
7116
+
7117
+ const config = options.config || {};
7118
+ if(config.eventContent && typeof config.eventContent === "string"){
7119
+ const hasReturn = /\breturn\b/.test(config.eventContent);
7120
+ if(hasReturn){
7121
+ try {
7122
+ // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7123
+ let fn = new Function("arg", config.eventContent);
7124
+ config.eventContent = fn;
7125
+ } catch (e) {
7126
+ console.warn(e);
7127
+ }
7128
+ }
7129
+ }
7130
+
7131
+ if(config.noEventsContent && typeof config.noEventsContent === "string"){
7132
+ const hasReturn = /\breturn\b/.test(config.noEventsContent);
7133
+ if(hasReturn){
7134
+ try {
7135
+ // 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
7136
+ let fn = new Function("arg", config.noEventsContent);
7137
+ config.noEventsContent = fn;
7138
+ } catch (e) {
7139
+ console.warn(e);
7140
+ }
7141
+ }
7142
+ }
7143
+
7003
7144
  const amisSchema = {
7004
7145
  "type": "steedos-fullcalendar",
7005
7146
  "label": "",
@@ -7009,135 +7150,8 @@ filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsF
7009
7150
  "selectMirror": permissions.allowCreate,
7010
7151
  "initialView": initialView,
7011
7152
  "businessHours": businessHours,
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
- }
7153
+ ...config,
7154
+ "onEvent": onEvent
7141
7155
  };
7142
7156
  return amisSchema;
7143
7157
  }