@steedos-widgets/amis-lib 6.10.26 → 6.10.27

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
@@ -3793,13 +3793,20 @@ function getCalendarRecordPermissionsApi(mainObject, recordId) {
3793
3793
 
3794
3794
  function getCalendarRecordSaveApi(object, calendarOptions) {
3795
3795
  const formData = {};
3796
+ const groups = calendarOptions.groups;
3797
+ const groupFieldName = groups?.[0];
3796
3798
  const idFieldName = object.idFieldName || "_id";
3797
3799
  formData[idFieldName] = "${event.data.event.id}";
3798
3800
  const nameFieldKey = object.NAME_FIELD_KEY || "name";
3799
3801
  formData[nameFieldKey] = "${event.data.event.title}";
3800
3802
  formData[calendarOptions.startDateExpr] = "${event.data.event.start}";
3801
3803
  formData[calendarOptions.endDateExpr] = "${event.data.event.end}";
3802
- formData[calendarOptions.allDayExpr] = "${event.data.event.allDay}";
3804
+ if (calendarOptions.allDayExpr){
3805
+ formData[calendarOptions.allDayExpr] = "${event.data.event.allDay}";
3806
+ }
3807
+ if (groupFieldName){
3808
+ formData[groupFieldName] = "${event.data.event._def.resourceIds[0]}";
3809
+ }
3803
3810
  // formData[calendarOptions.textExpr] = "${event.data.event.title}";
3804
3811
  const apiData = {
3805
3812
  objectName: object.name,
@@ -3846,20 +3853,32 @@ function getCalendarResourcesApi(objectSchema, calendarOptions) {
3846
3853
  const groupFieldName = groups[0];
3847
3854
  const groupField = objectSchema.fields[groupFieldName];
3848
3855
  let groupObjectName = groupField?.reference_to;
3856
+ let groupReferenceToField = groupField?.reference_to_field || "_id";
3849
3857
  if (!groupObjectName){
3850
3858
  return {};
3851
3859
  }
3852
- const fetchFields = [objectSchema.NAME_FIELD_KEY || 'name'];
3860
+ let groupFilters = filters || [];
3861
+ let spaceUsersAdditionalFilters = ["user_accepted", "=", true];
3862
+ if (groupObjectName === "users") {
3863
+ groupObjectName = "space_users";
3864
+ groupReferenceToField = "user";
3865
+ }
3866
+ if (groupObjectName === "space_users") {
3867
+ groupFilters = groupFilters.length > 0 ? [groupFilters, spaceUsersAdditionalFilters] : spaceUsersAdditionalFilters;
3868
+ }
3869
+ const groupObjectConfig = getUISchemaSync(groupObjectName);
3870
+ const groupNameField = groupObjectConfig.NAME_FIELD_KEY || 'name';
3871
+ const fetchFields = [groupNameField, groupReferenceToField];
3853
3872
  if (color) {
3854
3873
  fetchFields.push(color);
3855
3874
  }
3856
3875
  return {
3857
- url: `/api/v1/${groupObjectName}?fields=${JSON.stringify(fetchFields)}&filters=${JSON.stringify(filters || [])}`,
3876
+ url: `/api/v1/${groupObjectName}?fields=${JSON.stringify(fetchFields)}&filters=${JSON.stringify(groupFilters || [])}&top=1000`,
3858
3877
  adaptor: function (payload, response, api, context) {
3859
3878
  const items = payload?.data?.items || [];
3860
3879
  const resources = items.map(item => ({
3861
- id: item._id,
3862
- title: item.name,
3880
+ id: item[groupReferenceToField],
3881
+ title: item[groupNameField],
3863
3882
  eventColor: item.color
3864
3883
  }));
3865
3884
  context.successCallback(resources);
@@ -10402,7 +10421,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
10402
10421
  * @Author: baozhoutao@steedos.com
10403
10422
  * @Date: 2022-07-05 15:55:39
10404
10423
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
10405
- * @LastEditTime: 2025-12-02 15:56:17
10424
+ * @LastEditTime: 2025-12-04 14:03:00
10406
10425
  * @Description:
10407
10426
  */
10408
10427
 
@@ -10686,6 +10705,13 @@ async function getViewSchema(objectName, recordId, ctx) {
10686
10705
  };
10687
10706
  }
10688
10707
 
10708
+ function isListViewSupported(listView) {
10709
+ if(listView.type === "calendar" || listView.type === "timeline"){
10710
+ return listView.type === "timeline" ? (!!window.BuilderFullCalendarScheduler) : (!!window.BuilderFullCalendar || !!window.BuilderFullCalendarScheduler);
10711
+ }
10712
+ return true;
10713
+ }
10714
+
10689
10715
  // 获取列表视图
10690
10716
  async function getListSchema(
10691
10717
  appName,
@@ -10712,6 +10738,16 @@ async function getListSchema(
10712
10738
  if (!listView) {
10713
10739
  return { uiSchema };
10714
10740
  }
10741
+ if (!isListViewSupported(listView)) {
10742
+ return {
10743
+ uiSchema,
10744
+ amisSchema: {
10745
+ "type": "alert",
10746
+ "body": `当前版本不支持此视图类型`,
10747
+ "level": "warning"
10748
+ }
10749
+ };
10750
+ }
10715
10751
 
10716
10752
  // 直接返回自定义的列表视图schema
10717
10753
  if(listView.enable_amis_schema && listView.amis_schema){
@@ -17979,7 +18015,9 @@ const getFieldEditTpl = async (field, label)=>{
17979
18015
  visibleOn: field.visibleOn,
17980
18016
  requiredOn: field.requiredOn
17981
18017
  };
17982
-
18018
+ if(field.default_value){
18019
+ tpl.value = field.default_value;
18020
+ }
17983
18021
  if(isOpinionField(field)){
17984
18022
  tpl.type = 'input-group';
17985
18023
  tpl.body = [
@@ -18379,7 +18417,7 @@ const getFieldEditTpl = async (field, label)=>{
18379
18417
  break;
18380
18418
  }
18381
18419
  }
18382
- // console.log('getFieldEditTpl ', label, tpl)
18420
+ console.log('getFieldEditTpl ', label, tpl, field);
18383
18421
  return tpl;
18384
18422
  };
18385
18423