@steedos-widgets/amis-lib 6.10.26 → 6.10.28

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
@@ -3820,13 +3820,20 @@ function getCalendarRecordPermissionsApi(mainObject, recordId) {
3820
3820
 
3821
3821
  function getCalendarRecordSaveApi(object, calendarOptions) {
3822
3822
  const formData = {};
3823
+ const groups = calendarOptions.groups;
3824
+ const groupFieldName = groups?.[0];
3823
3825
  const idFieldName = object.idFieldName || "_id";
3824
3826
  formData[idFieldName] = "${event.data.event.id}";
3825
3827
  const nameFieldKey = object.NAME_FIELD_KEY || "name";
3826
3828
  formData[nameFieldKey] = "${event.data.event.title}";
3827
3829
  formData[calendarOptions.startDateExpr] = "${event.data.event.start}";
3828
3830
  formData[calendarOptions.endDateExpr] = "${event.data.event.end}";
3829
- formData[calendarOptions.allDayExpr] = "${event.data.event.allDay}";
3831
+ if (calendarOptions.allDayExpr){
3832
+ formData[calendarOptions.allDayExpr] = "${event.data.event.allDay}";
3833
+ }
3834
+ if (groupFieldName){
3835
+ formData[groupFieldName] = "${event.data.event._def.resourceIds[0]}";
3836
+ }
3830
3837
  // formData[calendarOptions.textExpr] = "${event.data.event.title}";
3831
3838
  const apiData = {
3832
3839
  objectName: object.name,
@@ -3873,20 +3880,32 @@ function getCalendarResourcesApi(objectSchema, calendarOptions) {
3873
3880
  const groupFieldName = groups[0];
3874
3881
  const groupField = objectSchema.fields[groupFieldName];
3875
3882
  let groupObjectName = groupField?.reference_to;
3883
+ let groupReferenceToField = groupField?.reference_to_field || "_id";
3876
3884
  if (!groupObjectName){
3877
3885
  return {};
3878
3886
  }
3879
- const fetchFields = [objectSchema.NAME_FIELD_KEY || 'name'];
3887
+ let groupFilters = filters || [];
3888
+ let spaceUsersAdditionalFilters = ["user_accepted", "=", true];
3889
+ if (groupObjectName === "users") {
3890
+ groupObjectName = "space_users";
3891
+ groupReferenceToField = "user";
3892
+ }
3893
+ if (groupObjectName === "space_users") {
3894
+ groupFilters = groupFilters.length > 0 ? [groupFilters, spaceUsersAdditionalFilters] : spaceUsersAdditionalFilters;
3895
+ }
3896
+ const groupObjectConfig = getUISchemaSync(groupObjectName);
3897
+ const groupNameField = groupObjectConfig.NAME_FIELD_KEY || 'name';
3898
+ const fetchFields = [groupNameField, groupReferenceToField];
3880
3899
  if (color) {
3881
3900
  fetchFields.push(color);
3882
3901
  }
3883
3902
  return {
3884
- url: `/api/v1/${groupObjectName}?fields=${JSON.stringify(fetchFields)}&filters=${JSON.stringify(filters || [])}`,
3903
+ url: `/api/v1/${groupObjectName}?fields=${JSON.stringify(fetchFields)}&filters=${JSON.stringify(groupFilters || [])}&top=1000`,
3885
3904
  adaptor: function (payload, response, api, context) {
3886
3905
  const items = payload?.data?.items || [];
3887
3906
  const resources = items.map(item => ({
3888
- id: item._id,
3889
- title: item.name,
3907
+ id: item[groupReferenceToField],
3908
+ title: item[groupNameField],
3890
3909
  eventColor: item.color
3891
3910
  }));
3892
3911
  context.successCallback(resources);
@@ -10429,7 +10448,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
10429
10448
  * @Author: baozhoutao@steedos.com
10430
10449
  * @Date: 2022-07-05 15:55:39
10431
10450
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
10432
- * @LastEditTime: 2025-12-02 15:56:17
10451
+ * @LastEditTime: 2025-12-04 14:03:00
10433
10452
  * @Description:
10434
10453
  */
10435
10454
 
@@ -10713,6 +10732,13 @@ async function getViewSchema(objectName, recordId, ctx) {
10713
10732
  };
10714
10733
  }
10715
10734
 
10735
+ function isListViewSupported(listView) {
10736
+ if(listView.type === "calendar" || listView.type === "timeline"){
10737
+ return listView.type === "timeline" ? (!!window.BuilderFullCalendarScheduler) : (!!window.BuilderFullCalendar || !!window.BuilderFullCalendarScheduler);
10738
+ }
10739
+ return true;
10740
+ }
10741
+
10716
10742
  // 获取列表视图
10717
10743
  async function getListSchema(
10718
10744
  appName,
@@ -10739,6 +10765,16 @@ async function getListSchema(
10739
10765
  if (!listView) {
10740
10766
  return { uiSchema };
10741
10767
  }
10768
+ if (!isListViewSupported(listView)) {
10769
+ return {
10770
+ uiSchema,
10771
+ amisSchema: {
10772
+ "type": "alert",
10773
+ "body": `当前版本不支持此视图类型`,
10774
+ "level": "warning"
10775
+ }
10776
+ };
10777
+ }
10742
10778
 
10743
10779
  // 直接返回自定义的列表视图schema
10744
10780
  if(listView.enable_amis_schema && listView.amis_schema){
@@ -17616,21 +17652,21 @@ const getApprovalDrawerSchema = async (instance, events) => {
17616
17652
  placeholder: i18next__default["default"].t('frontend_workflow_suggestion_placeholder'),//"请填写意见",
17617
17653
  requiredOn: "${judge === 'rejected'}",
17618
17654
  value: userApprove?.description,
17619
- // "onEvent": {
17620
- // "blur": {
17621
- // "actions": [
17622
- // {
17623
- // "componentId": "u:instancePage",
17624
- // "actionType": "setValue",
17625
- // "args": {
17626
- // "value": {
17627
- // "instance_my_approve_description": "${value}"
17628
- // }
17629
- // }
17630
- // }
17631
- // ]
17632
- // }
17633
- // }
17655
+ "onEvent": {
17656
+ "blur": {
17657
+ "actions": [
17658
+ {
17659
+ "componentId": "u:instancePage",
17660
+ "actionType": "setValue",
17661
+ "args": {
17662
+ "value": {
17663
+ "instance_my_approve_description": "${value}"
17664
+ }
17665
+ }
17666
+ }
17667
+ ]
17668
+ }
17669
+ }
17634
17670
  },
17635
17671
  await getNextStepInput(instance, nextStepChangeEvents),
17636
17672
  await getNextStepUsersInput(instance, nextStepUserChangeEvents),
@@ -17955,7 +17991,7 @@ const getInstanceApprovalHistory = async ()=>{
17955
17991
  * @Author: baozhoutao@steedos.com
17956
17992
  * @Date: 2022-09-07 16:20:45
17957
17993
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
17958
- * @LastEditTime: 2025-11-20 20:13:03
17994
+ * @LastEditTime: 2025-12-04 13:47:10
17959
17995
  * @Description:
17960
17996
  */
17961
17997
 
@@ -18006,7 +18042,9 @@ const getFieldEditTpl = async (field, label)=>{
18006
18042
  visibleOn: field.visibleOn,
18007
18043
  requiredOn: field.requiredOn
18008
18044
  };
18009
-
18045
+ if(field.default_value){
18046
+ tpl.value = field.default_value;
18047
+ }
18010
18048
  if(isOpinionField(field)){
18011
18049
  tpl.type = 'input-group';
18012
18050
  tpl.body = [
@@ -18406,7 +18444,7 @@ const getFieldEditTpl = async (field, label)=>{
18406
18444
  break;
18407
18445
  }
18408
18446
  }
18409
- // console.log('getFieldEditTpl ', label, tpl)
18447
+ console.log('getFieldEditTpl ', label, tpl, field);
18410
18448
  return tpl;
18411
18449
  };
18412
18450
 
@@ -18748,6 +18786,22 @@ const getApplicantTableView = async (instance) => {
18748
18786
  "onEvent": {
18749
18787
  "change": {
18750
18788
  "actions": [
18789
+ {
18790
+ "actionType": "ajax",
18791
+ "api": {
18792
+ "url": "/api/workflow/v2/instance/save",
18793
+ "method": "post",
18794
+ "sendOn": "",
18795
+ "requestAdaptor": "var _SteedosUI$getRef$get, _approveValues$next_s;\nconst formValues = context._scoped.getComponentById(\"instance_form\").getValues(); const _formValues = JSON.parse(JSON.stringify(formValues)); if(_formValues){delete _formValues.__applicant} \nconst approveValues = (_SteedosUI$getRef$get = context._scoped.getComponentById(\"instance_approval\")) === null || _SteedosUI$getRef$get === void 0 ? void 0 : _SteedosUI$getRef$get.getValues();\nlet nextUsers = approveValues === null || approveValues === void 0 ? void 0 : approveValues.next_users;\nif (_.isString(nextUsers)) {\n nextUsers = [approveValues.next_users];\n}\nconst instance = context.record;\nconst body = {\n instance: {\n _id: instance._id,\n applicant: context.__applicant,\n submitter: formValues.submitter,\n traces: [{\n _id: instance.trace._id,\n step: instance.step._id,\n approves: [{\n _id: instance.approve._id,\n next_steps: [{\n step: approveValues === null || approveValues === void 0 || (_approveValues$next_s = approveValues.next_step) === null || _approveValues$next_s === void 0 ? void 0 : _approveValues$next_s._id,\n users: nextUsers\n }],\n description: approveValues === null || approveValues === void 0 ? void 0 : approveValues.suggestion,\n values: _formValues\n }]\n }]\n }\n};\napi.data = body;\nreturn api;",
18796
+ "adaptor": "if (payload.instance == \"upgraded\") { window.setTimeout(function(){ window.location.reload(); }, 2000); return {...payload, status: 1, msg: t('instance_action_instance_save_msg_upgraded')}; } \n return payload.instance === true ? {...payload, status: 0, msg: ''} : {...payload, status: 1, msg: t('instance_action_instance_save_msg_failed')};",
18797
+ "headers": {
18798
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
18799
+ },
18800
+ "data": {
18801
+ "&": "$$"
18802
+ }
18803
+ }
18804
+ },
18751
18805
  {
18752
18806
  "actionType": "ajax",
18753
18807
  "api": {
@@ -18780,7 +18834,7 @@ const getApplicantTableView = async (instance) => {
18780
18834
  id: "u:2016b04355f4",
18781
18835
  };
18782
18836
  }
18783
-
18837
+ // console.log('applicantInput', applicantInput);
18784
18838
  if(applicantInput){
18785
18839
  if(applicantInput.className){
18786
18840
  applicantInput.className = `${applicantInput.className} inline-left`;
@@ -18959,8 +19013,7 @@ const getFlowFormSchema = async (instance, box) => {
18959
19013
  nextStepUserChangeEvents = onEvent?.nextStepUserChange?.actions || [];
18960
19014
  }
18961
19015
  // if (box == 'inbox' || box == 'draft') {
18962
- // TODO: 临时去掉 AutoOpenApproveDrawer 功能因为测试到性能问题
18963
- if ((box == 'inbox' || box == 'draft') && window.enableAutoOpenApproveDrawer) {
19016
+ if ((box == 'inbox' || box == 'draft') && !!!window.disableAutoOpenApproveDrawer) {
18964
19017
  // 滚动条滚动到底部弹出底部签批drawer窗口
18965
19018
  initedEvents.push({
18966
19019
  "actionType": "custom",
@@ -21865,6 +21918,17 @@ var widget_zh = {
21865
21918
  * @LastEditTime: 2025-08-26 10:17:05
21866
21919
  */
21867
21920
 
21921
+ const resources = {
21922
+ "en": {
21923
+ translation: en_us$1,
21924
+ 'widgets-meta': widget_en
21925
+ },
21926
+ "zh-CN": {
21927
+ translation: zh_cn$1,
21928
+ 'widgets-meta': widget_zh
21929
+ }
21930
+ };
21931
+
21868
21932
  const getUserLanguage$1 = () => {
21869
21933
  var lan = Builder.settings.context?.user?.language || Builder.settings.locale || window.navigator.language;
21870
21934
  if(lan === 'en' || lan.startsWith('en-')){
@@ -21872,15 +21936,33 @@ const getUserLanguage$1 = () => {
21872
21936
  }
21873
21937
  return lan;
21874
21938
  };
21939
+
21940
+ var locale$1 = "zh-CN";
21875
21941
  if (typeof window != 'undefined') {
21876
21942
  window.steedosI18next = i18next__namespace;
21877
- getUserLanguage$1();
21943
+ // locale = getUserLanguage();
21878
21944
  }
21879
21945
 
21880
- i18next__namespace.addResources('en', 'translation', en_us$1);
21881
- i18next__namespace.addResources('en', 'widgets-meta', widget_en);
21882
- i18next__namespace.addResources('zh-CN', 'translation', zh_cn$1);
21883
- i18next__namespace.addResources('zh-CN', 'widgets-meta', widget_zh);
21946
+ if (!i18next__namespace.isInitialized) {
21947
+ i18next__namespace
21948
+ // .use(LanguageDetector)
21949
+ .init({
21950
+ // lng: locale,
21951
+ fallbackLng: 'zh-CN',
21952
+ resources,
21953
+ }, ()=>{
21954
+ console.log("i18next initialized:", locale$1);
21955
+ // i18next.addResources('en', 'translation', en_us);
21956
+ // i18next.addResources('en', 'widgets-meta', widget_en);
21957
+ // i18next.addResources('zh-CN', 'translation', zh_cn);
21958
+ // i18next.addResources('zh-CN', 'widgets-meta', widget_zh);
21959
+ });
21960
+ } else {
21961
+ i18next__namespace.addResources('en', 'translation', en_us$1);
21962
+ i18next__namespace.addResources('en', 'widgets-meta', widget_en);
21963
+ i18next__namespace.addResources('zh-CN', 'translation', zh_cn$1);
21964
+ i18next__namespace.addResources('zh-CN', 'widgets-meta', widget_zh);
21965
+ }
21884
21966
 
21885
21967
  var asc$1 = "Asc";
21886
21968
  var cancel$1 = "Cancel";