@steedos-widgets/amis-lib 6.10.1-beta.32 → 6.10.1-beta.34

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
@@ -7515,7 +7515,6 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
7515
7515
  "id": "u:ce9e3fcc411a"
7516
7516
  }
7517
7517
  ],
7518
- "className": "steedos-overflow-visible-dialog",
7519
7518
  "showCloseButton": true,
7520
7519
  "showErrorMsg": true,
7521
7520
  "showLoading": true,
@@ -8505,7 +8504,6 @@ const getSetListviewFiltersButtonSchema = ()=>{
8505
8504
  }
8506
8505
  }
8507
8506
  ],
8508
- "className": "steedos-overflow-visible-dialog",
8509
8507
  "showCloseButton": true,
8510
8508
  "showErrorMsg": true,
8511
8509
  "showLoading": true,
@@ -10388,7 +10386,10 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
10388
10386
  data: {
10389
10387
  relatedKey: relatedKey,
10390
10388
  listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
10391
- _isRelated: true
10389
+ _isRelated: true,
10390
+ record: {
10391
+ recordPermissions: relatedObjectUiSchema.permissions
10392
+ }
10392
10393
  },
10393
10394
  body:[
10394
10395
  amisSchema
@@ -10621,7 +10622,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
10621
10622
  * @Author: baozhoutao@steedos.com
10622
10623
  * @Date: 2022-07-05 15:55:39
10623
10624
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
10624
- * @LastEditTime: 2025-05-20 19:29:36
10625
+ * @LastEditTime: 2025-06-17 20:18:18
10625
10626
  * @Description:
10626
10627
  */
10627
10628
 
@@ -10977,12 +10978,13 @@ async function getListSchema(
10977
10978
  "filtersFunction": listview_filters,
10978
10979
  "sort": sort,
10979
10980
  "ctx": ctx,
10980
- "requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
10981
- "adaptor": listView.adaptor || ctx.adaptor,
10981
+ "requestAdaptor": ctx.requestAdaptor || listView.requestAdaptor,
10982
+ "adaptor": ctx.adaptor || listView.adaptor,
10982
10983
  "headerToolbarItems": ctx.headerToolbarItems,
10983
10984
  "filterVisible": ctx.filterVisible,
10984
10985
  "rowClassNameExpr": ctx.rowClassNameExpr,
10985
- "crudDataFilter": ctx.crudDataFilter,
10986
+ "crud": ctx.crud || listView.crud,
10987
+ "crudDataFilter": ctx.crudDataFilter || listView.crudDataFilter ,
10986
10988
  "onCrudDataFilter": ctx.onCrudDataFilter
10987
10989
  };
10988
10990
  // console.log(`getListSchema===>`,amisSchema)
@@ -12591,7 +12593,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
12591
12593
  {
12592
12594
  "actionType": "custom",
12593
12595
  "script": `
12594
- const masterRecord = event.data._master && event.data._master.record;
12596
+ // lookup字段弹出列表,点击新建按钮,新建记录成功后,触发@data.changed.xxx,
12597
+ // 此时context.props.data值是lookup字段所在表单数据,经测试多层lookup弹出列表新建记录成功后context.props.data始终取的是最近一层的lookup字段所在表单数据,符合预期
12598
+ const masterRecord = context.props.data;//event.data._master && event.data._master.record;
12595
12599
  const fieldConfig = ${JSON.stringify(field)};
12596
12600
  let reference_to = fieldConfig.reference_to;
12597
12601
  let saveValue;
@@ -12601,7 +12605,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
12601
12605
  }
12602
12606
  const saveField = fieldConfig.reference_to_field || '_id';
12603
12607
  const saveFieldValue = newRecord[saveField];
12604
-
12605
12608
  if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){
12606
12609
 
12607
12610
  const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};
@@ -12621,8 +12624,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
12621
12624
 
12622
12625
  }else{
12623
12626
  if(fieldConfig.multiple){
12624
- // TODO: 连续新建多个记录时,因为获取的主记录不是实时的,所以只会勾选最后一个新建的记录。
12625
- const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
12627
+ // const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
12628
+ // 连续新建多个记录时,因为masterRecord获取的主记录不是实时的,所以只会勾选最后一个新建的记录
12629
+ // 而下面context.context.component指向的是lookup picker组件,可以直接取到用户实时勾选的记录。
12630
+ const fieldValue = context.context.component.props.store.toJSON().selectedItems
12626
12631
  saveValue = fieldValue.concat(saveFieldValue);
12627
12632
  }else{
12628
12633
  saveValue = saveFieldValue;
@@ -16818,6 +16823,7 @@ const getJudgeOptions = async (instance) => {
16818
16823
 
16819
16824
  const getJudgeInput = async (instance) => {
16820
16825
  const judgeOptions = await getJudgeOptions(instance);
16826
+ // console.log('getJudgeInput', judgeOptions);
16821
16827
  if (judgeOptions.length > 0 && instance.approve.type != 'cc') {
16822
16828
  return {
16823
16829
  type: "radios",
@@ -16858,6 +16864,7 @@ const getJudgeInput = async (instance) => {
16858
16864
 
16859
16865
  //TODO 只有一个下一步时,默认选中,并且禁止修改.
16860
16866
  const getNextStepInput = async (instance) => {
16867
+ // console.log('getNextStepInput', instance);
16861
16868
  if(instance.approve?.type == 'cc'){
16862
16869
  return ;
16863
16870
  }
@@ -16893,14 +16900,30 @@ const getNextStepInput = async (instance) => {
16893
16900
  "next_users": null
16894
16901
  },
16895
16902
  "source": {
16896
- "url": "${context.rootUrl}/api/workflow/v2/nextStep?judge=${new_judge}",
16903
+ "url": "/api/workflow/v2/nextStep?judge=${new_judge}",
16897
16904
  "headers": {
16898
16905
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
16899
16906
  },
16900
16907
  "method": "post",
16901
16908
  "messages": {
16902
16909
  },
16903
- "requestAdaptor": "let { context, judge } = api.data; if(!judge){judge='approved'}\nconst formValues = SteedosUI.getRef(api.data.$scopeId).getComponentById(\"instance_form\").getValues();\n\napi.data = {\nflowVersionId: context.flowVersion._id,\n instanceId: context._id,\n flowId: context.flow._id,\n step: context.step,\n judge: judge,\n values: formValues\n}\n\n\n return api;",
16910
+ "requestAdaptor": `
16911
+ let { judge } = api.data;
16912
+ const ctx = api.data.context;
16913
+ if(!judge){
16914
+ judge='approved'
16915
+ };
16916
+ const formValues = context._scoped.getComponentById("instance_form").getValues();
16917
+ api.data = {
16918
+ flowVersionId: ctx.flowVersion._id,
16919
+ instanceId: ctx._id,
16920
+ flowId: ctx.flow._id,
16921
+ step: ctx.step,
16922
+ judge: judge,
16923
+ values: formValues
16924
+ };
16925
+ return api;
16926
+ `,
16904
16927
  "adaptor": `
16905
16928
  payload.data = {
16906
16929
  value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
@@ -17008,7 +17031,7 @@ const getNextStepUsersInput = async (instance) => {
17008
17031
  "messages": {
17009
17032
  },
17010
17033
  "requestAdaptor": "\nconst { context, next_step, $scopeId } = api.data;\nconst formValues = SteedosUI.getRef($scopeId).getComponentById(\"instance_form\").getValues();\n\napi.data = {\n instanceId: context._id,\n nextStepId: next_step._id,\n values: formValues\n}\n\n\n return api;",
17011
- "adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
17034
+ "adaptor": "debugger;\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
17012
17035
  "data": {
17013
17036
  "&": "$$",
17014
17037
  "$scopeId": "$scopeId",
@@ -17033,8 +17056,8 @@ const getNextStepUsersInput = async (instance) => {
17033
17056
 
17034
17057
  const getCCSubmitRequestAdaptor = async (instance) => {
17035
17058
  return `
17036
- const instanceForm = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form");
17037
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
17059
+ const instanceForm = context._scoped.getComponentById("instance_form");
17060
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
17038
17061
  api.data = {
17039
17062
  instanceId: "${instance._id}",
17040
17063
  traceId: "${instance.trace._id}",
@@ -17046,9 +17069,9 @@ const getCCSubmitRequestAdaptor = async (instance) => {
17046
17069
  };
17047
17070
 
17048
17071
  const getPostSubmitRequestAdaptor = async (instance) => {
17049
- return ` const instanceForm = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form");
17072
+ return ` const instanceForm = context._scoped.getComponentById("instance_form");
17050
17073
  const formValues = instanceForm.getValues();
17051
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
17074
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
17052
17075
  let nextUsers = approveValues.next_users;
17053
17076
  if(_.isString(nextUsers)){
17054
17077
  nextUsers = [approveValues.next_users];
@@ -17064,7 +17087,7 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17064
17087
  approves: [{
17065
17088
  _id: "${instance.approve._id}",
17066
17089
  next_steps: [{
17067
- step: approveValues.next_step._id,
17090
+ step: approveValues.next_step,
17068
17091
  users: nextUsers,
17069
17092
  }],
17070
17093
  description: approveValues.suggestion,
@@ -17072,6 +17095,7 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17072
17095
  }]
17073
17096
  }]
17074
17097
  }]};
17098
+ console.log('submit api', api);
17075
17099
  api.data = body;
17076
17100
  return api;
17077
17101
  `;
@@ -17079,8 +17103,8 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17079
17103
 
17080
17104
  const getPostEngineRequestAdaptor = async (instance) => {
17081
17105
  return `
17082
- const formValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form").getValues();
17083
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
17106
+ const formValues = context._scoped.getComponentById("instance_form").getValues();
17107
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
17084
17108
  let nextUsers = approveValues.next_users;
17085
17109
  if(_.isString(nextUsers)){
17086
17110
  nextUsers = [approveValues.next_users];
@@ -17091,7 +17115,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
17091
17115
  trace: "${instance.approve.trace}",
17092
17116
  _id: "${instance.approve._id}",
17093
17117
  next_steps: [{
17094
- step: approveValues.next_step._id,
17118
+ step: approveValues.next_step,
17095
17119
  users: nextUsers,
17096
17120
  }],
17097
17121
  description: approveValues.suggestion,
@@ -17110,7 +17134,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
17110
17134
  * @returns
17111
17135
  */
17112
17136
  const getSubmitActions = async (instance) => {
17113
- // console.log(`getSubmitActions instance====`, instance)
17137
+ console.log(`getSubmitActions instance====`, instance);
17114
17138
  let api = "";
17115
17139
  let requestAdaptor = "";
17116
17140
  if(instance.approve?.type == "cc"){
@@ -17127,7 +17151,9 @@ const getSubmitActions = async (instance) => {
17127
17151
  return null; //TODO 考虑异常情况?
17128
17152
  }
17129
17153
  }
17130
-
17154
+ console.log(`getSubmitActions api====`, api);
17155
+ console.log(`getSubmitActions requestAdaptor====`, requestAdaptor);
17156
+ console.log('getObjectListViewPath========>', amisLib.Router.getObjectListViewPath({appId: "${appId}", objectName: "${objectName}", listViewName: "${side_listview_id}"}));
17131
17157
  return [
17132
17158
  // 校验表单
17133
17159
  {
@@ -17135,7 +17161,7 @@ const getSubmitActions = async (instance) => {
17135
17161
  "args": {},
17136
17162
  "actionType": "custom",
17137
17163
  "script": `
17138
- // console.log("======getSubmitActions");
17164
+ console.log("======getSubmitActions");
17139
17165
  const form = event.context.scoped.getComponentById("instance_form");
17140
17166
  return form.validate().then((instanceFormValidate)=>{
17141
17167
  event.setData({...event.data, instanceFormValidate})
@@ -17159,7 +17185,7 @@ const getSubmitActions = async (instance) => {
17159
17185
  componentId: "",
17160
17186
  args: {
17161
17187
  api: {
17162
- url: `\${context.rootUrl}${api}`,
17188
+ url: `${api}`,
17163
17189
  method: "post",
17164
17190
  dataType: "json",
17165
17191
  data: {
@@ -17195,7 +17221,7 @@ const getSubmitActions = async (instance) => {
17195
17221
  };
17196
17222
 
17197
17223
  const getApprovalDrawerSchema = async (instance) => {
17198
- // console.log("=============getApprovalDrawerSchema=============")
17224
+ console.log("=============getApprovalDrawerSchema=============", instance);
17199
17225
  return {
17200
17226
  type: "drawer",
17201
17227
  overlay: true,
@@ -17209,7 +17235,7 @@ const getApprovalDrawerSchema = async (instance) => {
17209
17235
  bodyClassName: 'p-2',
17210
17236
  footerClassName: 'p-2 pt-0',
17211
17237
  drawerContainer: ()=>{
17212
- return window.$(".antd-Page-content",window.$(".steedos-instance-wrapper"))[0];
17238
+ return document.body;
17213
17239
  },
17214
17240
  body: [
17215
17241
  {
@@ -17358,15 +17384,11 @@ const getAttachments = async (instance)=>{
17358
17384
  {
17359
17385
  type: 'tpl',
17360
17386
  inline: true,
17361
- tpl: `<a href='\${context.rootUrl}/api/files/instances/\${_id}?download=true' target='_blank'>\${original.name}</a>`
17387
+ tpl: `<a href='/api/v6/files/download/cfs.instances.filerecord/\${_id}/\${original.name}?download=true' target='_blank'>\${original.name}</a>`
17362
17388
  }
17363
17389
  ],
17364
17390
  "actions": [
17365
- {
17366
- "icon": "fa fa-eye",
17367
- "type": "button",
17368
- "id": "u:ef52fa8940a8"
17369
- }
17391
+
17370
17392
  ],
17371
17393
  "id": "u:550b3fdc8788"
17372
17394
  },
@@ -17412,7 +17434,7 @@ const getAttachmentUploadInput = async (instance)=>{
17412
17434
  "extractValue": false,
17413
17435
  "valueField": "version_id",
17414
17436
  "receiver": {
17415
- "url": "${context.rootUrl}/api/v4/instances/s3",
17437
+ "url": "/api/instance/${context._id}/file",
17416
17438
  headers: {
17417
17439
  Authorization: "Bearer ${context.tenantId},${context.authToken}"
17418
17440
  },
@@ -17424,7 +17446,7 @@ const getAttachmentUploadInput = async (instance)=>{
17424
17446
  api.data.append('instance', '${instance._id}');
17425
17447
  api.data.append('approve', '${instance.approve?._id}');
17426
17448
  api.data.append('owner', '${auth.userId}');
17427
- api.data.append('owner_name', '${auth.name}');
17449
+ api.data.append('owner_name', '${auth.user.name}');
17428
17450
  return api;
17429
17451
  `
17430
17452
  },
@@ -17503,11 +17525,6 @@ const getRelatedInstances = async (instance)=>{
17503
17525
  }
17504
17526
  ],
17505
17527
  "actions": [
17506
- {
17507
- "icon": "fa fa-eye",
17508
- "type": "button",
17509
- "id": "u:ef52fa8940a8"
17510
- }
17511
17528
  ],
17512
17529
  "id": "u:550b3fdc8788"
17513
17530
  },
@@ -18278,6 +18295,7 @@ const getFlowFormSchema = async (instance, box) => {
18278
18295
  name: "instancePage",
18279
18296
  className: "steedos-amis-instance-view",
18280
18297
  bodyClassName: "overflow-y-auto h-full",
18298
+ headerClassName: "p-0",
18281
18299
  "title": {
18282
18300
  "type": "steedos-record-detail-header",
18283
18301
  "label": "标题面板",
@@ -18299,6 +18317,25 @@ const getFlowFormSchema = async (instance, box) => {
18299
18317
  ".antd-List-heading": {
18300
18318
  "font-size": "14px",
18301
18319
  "font-weight": "500"
18320
+ },
18321
+ ".steedos-object-record-detail-header .antd-Grid-col--mdAuto": {
18322
+ "padding": "0px !important"
18323
+ },
18324
+ ".steedos-amis-instance-view .antd-Page-body": {
18325
+ "width": "710px"
18326
+ },
18327
+ ".antd-List-placeholder": {
18328
+ "display": "none"
18329
+ },
18330
+ ".steedos-amis-instance-view .antd-Table-fixedTop:after":{
18331
+ "box-shadow": "none"
18332
+ },
18333
+ ".antd-List-items": {
18334
+ "border": '0px'
18335
+ },
18336
+ ".antd-ListItem": {
18337
+ "border-top": "0px !important",
18338
+ "background": "transparent !important"
18302
18339
  }
18303
18340
  },
18304
18341
  body: [
@@ -18643,7 +18680,9 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
18643
18680
  return ___default["default"].includes(___default["default"].map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
18644
18681
  };
18645
18682
 
18646
- const getInstanceInfo = async ({ instanceId, box }) => {
18683
+ const getInstanceInfo = async (props) => {
18684
+ console.log(`getInstanceInfo props`, props);
18685
+ const { instanceId, box } = props;
18647
18686
  const userId = amisLib.getSteedosAuth().userId;
18648
18687
  const query = `{
18649
18688
  instance: instances__findOne(id:"${instanceId}"){