@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.esm.js CHANGED
@@ -7488,7 +7488,6 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
7488
7488
  "id": "u:ce9e3fcc411a"
7489
7489
  }
7490
7490
  ],
7491
- "className": "steedos-overflow-visible-dialog",
7492
7491
  "showCloseButton": true,
7493
7492
  "showErrorMsg": true,
7494
7493
  "showLoading": true,
@@ -8478,7 +8477,6 @@ const getSetListviewFiltersButtonSchema = ()=>{
8478
8477
  }
8479
8478
  }
8480
8479
  ],
8481
- "className": "steedos-overflow-visible-dialog",
8482
8480
  "showCloseButton": true,
8483
8481
  "showErrorMsg": true,
8484
8482
  "showLoading": true,
@@ -10361,7 +10359,10 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
10361
10359
  data: {
10362
10360
  relatedKey: relatedKey,
10363
10361
  listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
10364
- _isRelated: true
10362
+ _isRelated: true,
10363
+ record: {
10364
+ recordPermissions: relatedObjectUiSchema.permissions
10365
+ }
10365
10366
  },
10366
10367
  body:[
10367
10368
  amisSchema
@@ -10594,7 +10595,7 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
10594
10595
  * @Author: baozhoutao@steedos.com
10595
10596
  * @Date: 2022-07-05 15:55:39
10596
10597
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
10597
- * @LastEditTime: 2025-05-20 19:29:36
10598
+ * @LastEditTime: 2025-06-17 20:18:18
10598
10599
  * @Description:
10599
10600
  */
10600
10601
 
@@ -10950,12 +10951,13 @@ async function getListSchema(
10950
10951
  "filtersFunction": listview_filters,
10951
10952
  "sort": sort,
10952
10953
  "ctx": ctx,
10953
- "requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
10954
- "adaptor": listView.adaptor || ctx.adaptor,
10954
+ "requestAdaptor": ctx.requestAdaptor || listView.requestAdaptor,
10955
+ "adaptor": ctx.adaptor || listView.adaptor,
10955
10956
  "headerToolbarItems": ctx.headerToolbarItems,
10956
10957
  "filterVisible": ctx.filterVisible,
10957
10958
  "rowClassNameExpr": ctx.rowClassNameExpr,
10958
- "crudDataFilter": ctx.crudDataFilter,
10959
+ "crud": ctx.crud || listView.crud,
10960
+ "crudDataFilter": ctx.crudDataFilter || listView.crudDataFilter ,
10959
10961
  "onCrudDataFilter": ctx.onCrudDataFilter
10960
10962
  };
10961
10963
  // console.log(`getListSchema===>`,amisSchema)
@@ -12564,7 +12566,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
12564
12566
  {
12565
12567
  "actionType": "custom",
12566
12568
  "script": `
12567
- const masterRecord = event.data._master && event.data._master.record;
12569
+ // lookup字段弹出列表,点击新建按钮,新建记录成功后,触发@data.changed.xxx,
12570
+ // 此时context.props.data值是lookup字段所在表单数据,经测试多层lookup弹出列表新建记录成功后context.props.data始终取的是最近一层的lookup字段所在表单数据,符合预期
12571
+ const masterRecord = context.props.data;//event.data._master && event.data._master.record;
12568
12572
  const fieldConfig = ${JSON.stringify(field)};
12569
12573
  let reference_to = fieldConfig.reference_to;
12570
12574
  let saveValue;
@@ -12574,7 +12578,6 @@ async function lookupToAmisPicker(field, readonly, ctx){
12574
12578
  }
12575
12579
  const saveField = fieldConfig.reference_to_field || '_id';
12576
12580
  const saveFieldValue = newRecord[saveField];
12577
-
12578
12581
  if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){
12579
12582
 
12580
12583
  const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};
@@ -12594,8 +12597,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
12594
12597
 
12595
12598
  }else{
12596
12599
  if(fieldConfig.multiple){
12597
- // TODO: 连续新建多个记录时,因为获取的主记录不是实时的,所以只会勾选最后一个新建的记录。
12598
- const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
12600
+ // const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
12601
+ // 连续新建多个记录时,因为masterRecord获取的主记录不是实时的,所以只会勾选最后一个新建的记录
12602
+ // 而下面context.context.component指向的是lookup picker组件,可以直接取到用户实时勾选的记录。
12603
+ const fieldValue = context.context.component.props.store.toJSON().selectedItems
12599
12604
  saveValue = fieldValue.concat(saveFieldValue);
12600
12605
  }else{
12601
12606
  saveValue = saveFieldValue;
@@ -16791,6 +16796,7 @@ const getJudgeOptions = async (instance) => {
16791
16796
 
16792
16797
  const getJudgeInput = async (instance) => {
16793
16798
  const judgeOptions = await getJudgeOptions(instance);
16799
+ // console.log('getJudgeInput', judgeOptions);
16794
16800
  if (judgeOptions.length > 0 && instance.approve.type != 'cc') {
16795
16801
  return {
16796
16802
  type: "radios",
@@ -16831,6 +16837,7 @@ const getJudgeInput = async (instance) => {
16831
16837
 
16832
16838
  //TODO 只有一个下一步时,默认选中,并且禁止修改.
16833
16839
  const getNextStepInput = async (instance) => {
16840
+ // console.log('getNextStepInput', instance);
16834
16841
  if(instance.approve?.type == 'cc'){
16835
16842
  return ;
16836
16843
  }
@@ -16866,14 +16873,30 @@ const getNextStepInput = async (instance) => {
16866
16873
  "next_users": null
16867
16874
  },
16868
16875
  "source": {
16869
- "url": "${context.rootUrl}/api/workflow/v2/nextStep?judge=${new_judge}",
16876
+ "url": "/api/workflow/v2/nextStep?judge=${new_judge}",
16870
16877
  "headers": {
16871
16878
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
16872
16879
  },
16873
16880
  "method": "post",
16874
16881
  "messages": {
16875
16882
  },
16876
- "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;",
16883
+ "requestAdaptor": `
16884
+ let { judge } = api.data;
16885
+ const ctx = api.data.context;
16886
+ if(!judge){
16887
+ judge='approved'
16888
+ };
16889
+ const formValues = context._scoped.getComponentById("instance_form").getValues();
16890
+ api.data = {
16891
+ flowVersionId: ctx.flowVersion._id,
16892
+ instanceId: ctx._id,
16893
+ flowId: ctx.flow._id,
16894
+ step: ctx.step,
16895
+ judge: judge,
16896
+ values: formValues
16897
+ };
16898
+ return api;
16899
+ `,
16877
16900
  "adaptor": `
16878
16901
  payload.data = {
16879
16902
  value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
@@ -16981,7 +17004,7 @@ const getNextStepUsersInput = async (instance) => {
16981
17004
  "messages": {
16982
17005
  },
16983
17006
  "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;",
16984
- "adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
17007
+ "adaptor": "debugger;\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
16985
17008
  "data": {
16986
17009
  "&": "$$",
16987
17010
  "$scopeId": "$scopeId",
@@ -17006,8 +17029,8 @@ const getNextStepUsersInput = async (instance) => {
17006
17029
 
17007
17030
  const getCCSubmitRequestAdaptor = async (instance) => {
17008
17031
  return `
17009
- const instanceForm = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form");
17010
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
17032
+ const instanceForm = context._scoped.getComponentById("instance_form");
17033
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
17011
17034
  api.data = {
17012
17035
  instanceId: "${instance._id}",
17013
17036
  traceId: "${instance.trace._id}",
@@ -17019,9 +17042,9 @@ const getCCSubmitRequestAdaptor = async (instance) => {
17019
17042
  };
17020
17043
 
17021
17044
  const getPostSubmitRequestAdaptor = async (instance) => {
17022
- return ` const instanceForm = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form");
17045
+ return ` const instanceForm = context._scoped.getComponentById("instance_form");
17023
17046
  const formValues = instanceForm.getValues();
17024
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
17047
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
17025
17048
  let nextUsers = approveValues.next_users;
17026
17049
  if(_.isString(nextUsers)){
17027
17050
  nextUsers = [approveValues.next_users];
@@ -17037,7 +17060,7 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17037
17060
  approves: [{
17038
17061
  _id: "${instance.approve._id}",
17039
17062
  next_steps: [{
17040
- step: approveValues.next_step._id,
17063
+ step: approveValues.next_step,
17041
17064
  users: nextUsers,
17042
17065
  }],
17043
17066
  description: approveValues.suggestion,
@@ -17045,6 +17068,7 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17045
17068
  }]
17046
17069
  }]
17047
17070
  }]};
17071
+ console.log('submit api', api);
17048
17072
  api.data = body;
17049
17073
  return api;
17050
17074
  `;
@@ -17052,8 +17076,8 @@ const getPostSubmitRequestAdaptor = async (instance) => {
17052
17076
 
17053
17077
  const getPostEngineRequestAdaptor = async (instance) => {
17054
17078
  return `
17055
- const formValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form").getValues();
17056
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
17079
+ const formValues = context._scoped.getComponentById("instance_form").getValues();
17080
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
17057
17081
  let nextUsers = approveValues.next_users;
17058
17082
  if(_.isString(nextUsers)){
17059
17083
  nextUsers = [approveValues.next_users];
@@ -17064,7 +17088,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
17064
17088
  trace: "${instance.approve.trace}",
17065
17089
  _id: "${instance.approve._id}",
17066
17090
  next_steps: [{
17067
- step: approveValues.next_step._id,
17091
+ step: approveValues.next_step,
17068
17092
  users: nextUsers,
17069
17093
  }],
17070
17094
  description: approveValues.suggestion,
@@ -17083,7 +17107,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
17083
17107
  * @returns
17084
17108
  */
17085
17109
  const getSubmitActions = async (instance) => {
17086
- // console.log(`getSubmitActions instance====`, instance)
17110
+ console.log(`getSubmitActions instance====`, instance);
17087
17111
  let api = "";
17088
17112
  let requestAdaptor = "";
17089
17113
  if(instance.approve?.type == "cc"){
@@ -17100,7 +17124,9 @@ const getSubmitActions = async (instance) => {
17100
17124
  return null; //TODO 考虑异常情况?
17101
17125
  }
17102
17126
  }
17103
-
17127
+ console.log(`getSubmitActions api====`, api);
17128
+ console.log(`getSubmitActions requestAdaptor====`, requestAdaptor);
17129
+ console.log('getObjectListViewPath========>', Router$1.getObjectListViewPath({appId: "${appId}", objectName: "${objectName}", listViewName: "${side_listview_id}"}));
17104
17130
  return [
17105
17131
  // 校验表单
17106
17132
  {
@@ -17108,7 +17134,7 @@ const getSubmitActions = async (instance) => {
17108
17134
  "args": {},
17109
17135
  "actionType": "custom",
17110
17136
  "script": `
17111
- // console.log("======getSubmitActions");
17137
+ console.log("======getSubmitActions");
17112
17138
  const form = event.context.scoped.getComponentById("instance_form");
17113
17139
  return form.validate().then((instanceFormValidate)=>{
17114
17140
  event.setData({...event.data, instanceFormValidate})
@@ -17132,7 +17158,7 @@ const getSubmitActions = async (instance) => {
17132
17158
  componentId: "",
17133
17159
  args: {
17134
17160
  api: {
17135
- url: `\${context.rootUrl}${api}`,
17161
+ url: `${api}`,
17136
17162
  method: "post",
17137
17163
  dataType: "json",
17138
17164
  data: {
@@ -17168,7 +17194,7 @@ const getSubmitActions = async (instance) => {
17168
17194
  };
17169
17195
 
17170
17196
  const getApprovalDrawerSchema = async (instance) => {
17171
- // console.log("=============getApprovalDrawerSchema=============")
17197
+ console.log("=============getApprovalDrawerSchema=============", instance);
17172
17198
  return {
17173
17199
  type: "drawer",
17174
17200
  overlay: true,
@@ -17182,7 +17208,7 @@ const getApprovalDrawerSchema = async (instance) => {
17182
17208
  bodyClassName: 'p-2',
17183
17209
  footerClassName: 'p-2 pt-0',
17184
17210
  drawerContainer: ()=>{
17185
- return window.$(".antd-Page-content",window.$(".steedos-instance-wrapper"))[0];
17211
+ return document.body;
17186
17212
  },
17187
17213
  body: [
17188
17214
  {
@@ -17331,15 +17357,11 @@ const getAttachments = async (instance)=>{
17331
17357
  {
17332
17358
  type: 'tpl',
17333
17359
  inline: true,
17334
- tpl: `<a href='\${context.rootUrl}/api/files/instances/\${_id}?download=true' target='_blank'>\${original.name}</a>`
17360
+ tpl: `<a href='/api/v6/files/download/cfs.instances.filerecord/\${_id}/\${original.name}?download=true' target='_blank'>\${original.name}</a>`
17335
17361
  }
17336
17362
  ],
17337
17363
  "actions": [
17338
- {
17339
- "icon": "fa fa-eye",
17340
- "type": "button",
17341
- "id": "u:ef52fa8940a8"
17342
- }
17364
+
17343
17365
  ],
17344
17366
  "id": "u:550b3fdc8788"
17345
17367
  },
@@ -17385,7 +17407,7 @@ const getAttachmentUploadInput = async (instance)=>{
17385
17407
  "extractValue": false,
17386
17408
  "valueField": "version_id",
17387
17409
  "receiver": {
17388
- "url": "${context.rootUrl}/api/v4/instances/s3",
17410
+ "url": "/api/instance/${context._id}/file",
17389
17411
  headers: {
17390
17412
  Authorization: "Bearer ${context.tenantId},${context.authToken}"
17391
17413
  },
@@ -17397,7 +17419,7 @@ const getAttachmentUploadInput = async (instance)=>{
17397
17419
  api.data.append('instance', '${instance._id}');
17398
17420
  api.data.append('approve', '${instance.approve?._id}');
17399
17421
  api.data.append('owner', '${auth.userId}');
17400
- api.data.append('owner_name', '${auth.name}');
17422
+ api.data.append('owner_name', '${auth.user.name}');
17401
17423
  return api;
17402
17424
  `
17403
17425
  },
@@ -17476,11 +17498,6 @@ const getRelatedInstances = async (instance)=>{
17476
17498
  }
17477
17499
  ],
17478
17500
  "actions": [
17479
- {
17480
- "icon": "fa fa-eye",
17481
- "type": "button",
17482
- "id": "u:ef52fa8940a8"
17483
- }
17484
17501
  ],
17485
17502
  "id": "u:550b3fdc8788"
17486
17503
  },
@@ -18251,6 +18268,7 @@ const getFlowFormSchema = async (instance, box) => {
18251
18268
  name: "instancePage",
18252
18269
  className: "steedos-amis-instance-view",
18253
18270
  bodyClassName: "overflow-y-auto h-full",
18271
+ headerClassName: "p-0",
18254
18272
  "title": {
18255
18273
  "type": "steedos-record-detail-header",
18256
18274
  "label": "标题面板",
@@ -18272,6 +18290,25 @@ const getFlowFormSchema = async (instance, box) => {
18272
18290
  ".antd-List-heading": {
18273
18291
  "font-size": "14px",
18274
18292
  "font-weight": "500"
18293
+ },
18294
+ ".steedos-object-record-detail-header .antd-Grid-col--mdAuto": {
18295
+ "padding": "0px !important"
18296
+ },
18297
+ ".steedos-amis-instance-view .antd-Page-body": {
18298
+ "width": "710px"
18299
+ },
18300
+ ".antd-List-placeholder": {
18301
+ "display": "none"
18302
+ },
18303
+ ".steedos-amis-instance-view .antd-Table-fixedTop:after":{
18304
+ "box-shadow": "none"
18305
+ },
18306
+ ".antd-List-items": {
18307
+ "border": '0px'
18308
+ },
18309
+ ".antd-ListItem": {
18310
+ "border-top": "0px !important",
18311
+ "background": "transparent !important"
18275
18312
  }
18276
18313
  },
18277
18314
  body: [
@@ -18616,7 +18653,9 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
18616
18653
  return ___default.includes(___default.map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
18617
18654
  };
18618
18655
 
18619
- const getInstanceInfo = async ({ instanceId, box }) => {
18656
+ const getInstanceInfo = async (props) => {
18657
+ console.log(`getInstanceInfo props`, props);
18658
+ const { instanceId, box } = props;
18620
18659
  const userId = getSteedosAuth$1().userId;
18621
18660
  const query = `{
18622
18661
  instance: instances__findOne(id:"${instanceId}"){