@steedos-widgets/amis-object 6.10.1-beta.33 → 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.
@@ -271,12 +271,12 @@ fieldset.antd-Collapse > legend{
271
271
  border: var(--Form-input-borderWidth) solid transparent;
272
272
  border-radius: var(--Form-input-borderRadius);
273
273
  }
274
-
274
+ /*
275
275
  .antd-Picker .antd-Picker-input .antd-Picker-values .antd-Picker-value{
276
- /* lookup字段值选中项值字符很多超长时换行,包括单选和多选 */
276
+ // lookup字段值选中项值字符很多超长时换行,包括单选和多选
277
277
  white-space: break-spaces;
278
278
  word-break: break-all;
279
- }
279
+ } */
280
280
 
281
281
  .steedos-crud-mode-cards .antd-Card-actions a[disabled]{
282
282
  box-shadow: none;
@@ -1841,8 +1841,17 @@ fieldset.antd-Collapse > legend{
1841
1841
  .steedos-object-button.antd-Button {
1842
1842
  margin-right: 0px;
1843
1843
  }
1844
+ .steedos-object-record-detail-header button[class~="steedos-object-button"] {
1845
+ margin-left: 4px;
1846
+ }
1847
+ .steedos-object-listview-content-wrapper button[class~="steedos-object-button"] {
1848
+ margin-left: 4px;
1849
+ }
1850
+ .steedos-record-related-header button[class~="steedos-object-button"] {
1851
+ margin-left: 4px;
1852
+ }
1844
1853
  /* 魔方定义的按钮,连续的按钮左侧加间隔分开,第一个按钮不会识别此样式 */
1845
- .steedos-object-button + .steedos-object-button {
1854
+ .steedos-object-button + .steedos-object-button button {
1846
1855
  margin-left: 4px;
1847
1856
  }
1848
1857
  /* 魔方定义的按钮,如果是显示在下拉菜单作为菜单按钮则不能加间隔 */
@@ -13536,7 +13536,10 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
13536
13536
  data: {
13537
13537
  relatedKey: relatedKey,
13538
13538
  listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
13539
- _isRelated: true
13539
+ _isRelated: true,
13540
+ record: {
13541
+ recordPermissions: relatedObjectUiSchema.permissions
13542
+ }
13540
13543
  },
13541
13544
  body:[
13542
13545
  amisSchema
@@ -19970,6 +19973,7 @@ const getJudgeOptions = async (instance) => {
19970
19973
 
19971
19974
  const getJudgeInput = async (instance) => {
19972
19975
  const judgeOptions = await getJudgeOptions(instance);
19976
+ // console.log('getJudgeInput', judgeOptions);
19973
19977
  if (judgeOptions.length > 0 && instance.approve.type != 'cc') {
19974
19978
  return {
19975
19979
  type: "radios",
@@ -20010,6 +20014,7 @@ const getJudgeInput = async (instance) => {
20010
20014
 
20011
20015
  //TODO 只有一个下一步时,默认选中,并且禁止修改.
20012
20016
  const getNextStepInput = async (instance) => {
20017
+ // console.log('getNextStepInput', instance);
20013
20018
  if(instance.approve?.type == 'cc'){
20014
20019
  return ;
20015
20020
  }
@@ -20045,14 +20050,30 @@ const getNextStepInput = async (instance) => {
20045
20050
  "next_users": null
20046
20051
  },
20047
20052
  "source": {
20048
- "url": "${context.rootUrl}/api/workflow/v2/nextStep?judge=${new_judge}",
20053
+ "url": "/api/workflow/v2/nextStep?judge=${new_judge}",
20049
20054
  "headers": {
20050
20055
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
20051
20056
  },
20052
20057
  "method": "post",
20053
20058
  "messages": {
20054
20059
  },
20055
- "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;",
20060
+ "requestAdaptor": `
20061
+ let { judge } = api.data;
20062
+ const ctx = api.data.context;
20063
+ if(!judge){
20064
+ judge='approved'
20065
+ };
20066
+ const formValues = context._scoped.getComponentById("instance_form").getValues();
20067
+ api.data = {
20068
+ flowVersionId: ctx.flowVersion._id,
20069
+ instanceId: ctx._id,
20070
+ flowId: ctx.flow._id,
20071
+ step: ctx.step,
20072
+ judge: judge,
20073
+ values: formValues
20074
+ };
20075
+ return api;
20076
+ `,
20056
20077
  "adaptor": `
20057
20078
  payload.data = {
20058
20079
  value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
@@ -20160,7 +20181,7 @@ const getNextStepUsersInput = async (instance) => {
20160
20181
  "messages": {
20161
20182
  },
20162
20183
  "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;",
20163
- "adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
20184
+ "adaptor": "debugger;\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
20164
20185
  "data": {
20165
20186
  "&": "$$",
20166
20187
  "$scopeId": "$scopeId",
@@ -20185,8 +20206,8 @@ const getNextStepUsersInput = async (instance) => {
20185
20206
 
20186
20207
  const getCCSubmitRequestAdaptor = async (instance) => {
20187
20208
  return `
20188
- const instanceForm = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form");
20189
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
20209
+ const instanceForm = context._scoped.getComponentById("instance_form");
20210
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
20190
20211
  api.data = {
20191
20212
  instanceId: "${instance._id}",
20192
20213
  traceId: "${instance.trace._id}",
@@ -20198,9 +20219,9 @@ const getCCSubmitRequestAdaptor = async (instance) => {
20198
20219
  };
20199
20220
 
20200
20221
  const getPostSubmitRequestAdaptor = async (instance) => {
20201
- return ` const instanceForm = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form");
20222
+ return ` const instanceForm = context._scoped.getComponentById("instance_form");
20202
20223
  const formValues = instanceForm.getValues();
20203
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
20224
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
20204
20225
  let nextUsers = approveValues.next_users;
20205
20226
  if(_.isString(nextUsers)){
20206
20227
  nextUsers = [approveValues.next_users];
@@ -20216,7 +20237,7 @@ const getPostSubmitRequestAdaptor = async (instance) => {
20216
20237
  approves: [{
20217
20238
  _id: "${instance.approve._id}",
20218
20239
  next_steps: [{
20219
- step: approveValues.next_step._id,
20240
+ step: approveValues.next_step,
20220
20241
  users: nextUsers,
20221
20242
  }],
20222
20243
  description: approveValues.suggestion,
@@ -20224,6 +20245,7 @@ const getPostSubmitRequestAdaptor = async (instance) => {
20224
20245
  }]
20225
20246
  }]
20226
20247
  }]};
20248
+ console.log('submit api', api);
20227
20249
  api.data = body;
20228
20250
  return api;
20229
20251
  `;
@@ -20231,8 +20253,8 @@ const getPostSubmitRequestAdaptor = async (instance) => {
20231
20253
 
20232
20254
  const getPostEngineRequestAdaptor = async (instance) => {
20233
20255
  return `
20234
- const formValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_form").getValues();
20235
- const approveValues = SteedosUI.getRef(api.data.$scopeId).getComponentById("instance_approval").getValues();
20256
+ const formValues = context._scoped.getComponentById("instance_form").getValues();
20257
+ const approveValues = context._scoped.getComponentById("instance_approval").getValues();
20236
20258
  let nextUsers = approveValues.next_users;
20237
20259
  if(_.isString(nextUsers)){
20238
20260
  nextUsers = [approveValues.next_users];
@@ -20243,7 +20265,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
20243
20265
  trace: "${instance.approve.trace}",
20244
20266
  _id: "${instance.approve._id}",
20245
20267
  next_steps: [{
20246
- step: approveValues.next_step._id,
20268
+ step: approveValues.next_step,
20247
20269
  users: nextUsers,
20248
20270
  }],
20249
20271
  description: approveValues.suggestion,
@@ -20262,7 +20284,7 @@ const getPostEngineRequestAdaptor = async (instance) => {
20262
20284
  * @returns
20263
20285
  */
20264
20286
  const getSubmitActions = async (instance) => {
20265
- // console.log(`getSubmitActions instance====`, instance)
20287
+ console.log(`getSubmitActions instance====`, instance);
20266
20288
  let api = "";
20267
20289
  let requestAdaptor = "";
20268
20290
  if(instance.approve?.type == "cc"){
@@ -20279,7 +20301,9 @@ const getSubmitActions = async (instance) => {
20279
20301
  return null; //TODO 考虑异常情况?
20280
20302
  }
20281
20303
  }
20282
-
20304
+ console.log(`getSubmitActions api====`, api);
20305
+ console.log(`getSubmitActions requestAdaptor====`, requestAdaptor);
20306
+ console.log('getObjectListViewPath========>', Router$1.getObjectListViewPath({appId: "${appId}", objectName: "${objectName}", listViewName: "${side_listview_id}"}));
20283
20307
  return [
20284
20308
  // 校验表单
20285
20309
  {
@@ -20287,7 +20311,7 @@ const getSubmitActions = async (instance) => {
20287
20311
  "args": {},
20288
20312
  "actionType": "custom",
20289
20313
  "script": `
20290
- // console.log("======getSubmitActions");
20314
+ console.log("======getSubmitActions");
20291
20315
  const form = event.context.scoped.getComponentById("instance_form");
20292
20316
  return form.validate().then((instanceFormValidate)=>{
20293
20317
  event.setData({...event.data, instanceFormValidate})
@@ -20311,7 +20335,7 @@ const getSubmitActions = async (instance) => {
20311
20335
  componentId: "",
20312
20336
  args: {
20313
20337
  api: {
20314
- url: `\${context.rootUrl}${api}`,
20338
+ url: `${api}`,
20315
20339
  method: "post",
20316
20340
  dataType: "json",
20317
20341
  data: {
@@ -20347,7 +20371,7 @@ const getSubmitActions = async (instance) => {
20347
20371
  };
20348
20372
 
20349
20373
  const getApprovalDrawerSchema = async (instance) => {
20350
- // console.log("=============getApprovalDrawerSchema=============")
20374
+ console.log("=============getApprovalDrawerSchema=============", instance);
20351
20375
  return {
20352
20376
  type: "drawer",
20353
20377
  overlay: true,
@@ -20361,7 +20385,7 @@ const getApprovalDrawerSchema = async (instance) => {
20361
20385
  bodyClassName: 'p-2',
20362
20386
  footerClassName: 'p-2 pt-0',
20363
20387
  drawerContainer: ()=>{
20364
- return window.$(".antd-Page-content",window.$(".steedos-instance-wrapper"))[0];
20388
+ return document.body;
20365
20389
  },
20366
20390
  body: [
20367
20391
  {
@@ -20510,15 +20534,11 @@ const getAttachments = async (instance)=>{
20510
20534
  {
20511
20535
  type: 'tpl',
20512
20536
  inline: true,
20513
- tpl: `<a href='\${context.rootUrl}/api/files/instances/\${_id}?download=true' target='_blank'>\${original.name}</a>`
20537
+ tpl: `<a href='/api/v6/files/download/cfs.instances.filerecord/\${_id}/\${original.name}?download=true' target='_blank'>\${original.name}</a>`
20514
20538
  }
20515
20539
  ],
20516
20540
  "actions": [
20517
- {
20518
- "icon": "fa fa-eye",
20519
- "type": "button",
20520
- "id": "u:ef52fa8940a8"
20521
- }
20541
+
20522
20542
  ],
20523
20543
  "id": "u:550b3fdc8788"
20524
20544
  },
@@ -20564,7 +20584,7 @@ const getAttachmentUploadInput = async (instance)=>{
20564
20584
  "extractValue": false,
20565
20585
  "valueField": "version_id",
20566
20586
  "receiver": {
20567
- "url": "${context.rootUrl}/api/v4/instances/s3",
20587
+ "url": "/api/instance/${context._id}/file",
20568
20588
  headers: {
20569
20589
  Authorization: "Bearer ${context.tenantId},${context.authToken}"
20570
20590
  },
@@ -20576,7 +20596,7 @@ const getAttachmentUploadInput = async (instance)=>{
20576
20596
  api.data.append('instance', '${instance._id}');
20577
20597
  api.data.append('approve', '${instance.approve?._id}');
20578
20598
  api.data.append('owner', '${auth.userId}');
20579
- api.data.append('owner_name', '${auth.name}');
20599
+ api.data.append('owner_name', '${auth.user.name}');
20580
20600
  return api;
20581
20601
  `
20582
20602
  },
@@ -20655,11 +20675,6 @@ const getRelatedInstances = async (instance)=>{
20655
20675
  }
20656
20676
  ],
20657
20677
  "actions": [
20658
- {
20659
- "icon": "fa fa-eye",
20660
- "type": "button",
20661
- "id": "u:ef52fa8940a8"
20662
- }
20663
20678
  ],
20664
20679
  "id": "u:550b3fdc8788"
20665
20680
  },
@@ -21430,6 +21445,7 @@ const getFlowFormSchema = async (instance, box) => {
21430
21445
  name: "instancePage",
21431
21446
  className: "steedos-amis-instance-view",
21432
21447
  bodyClassName: "overflow-y-auto h-full",
21448
+ headerClassName: "p-0",
21433
21449
  "title": {
21434
21450
  "type": "steedos-record-detail-header",
21435
21451
  "label": "标题面板",
@@ -21451,6 +21467,25 @@ const getFlowFormSchema = async (instance, box) => {
21451
21467
  ".antd-List-heading": {
21452
21468
  "font-size": "14px",
21453
21469
  "font-weight": "500"
21470
+ },
21471
+ ".steedos-object-record-detail-header .antd-Grid-col--mdAuto": {
21472
+ "padding": "0px !important"
21473
+ },
21474
+ ".steedos-amis-instance-view .antd-Page-body": {
21475
+ "width": "710px"
21476
+ },
21477
+ ".antd-List-placeholder": {
21478
+ "display": "none"
21479
+ },
21480
+ ".steedos-amis-instance-view .antd-Table-fixedTop:after":{
21481
+ "box-shadow": "none"
21482
+ },
21483
+ ".antd-List-items": {
21484
+ "border": '0px'
21485
+ },
21486
+ ".antd-ListItem": {
21487
+ "border-top": "0px !important",
21488
+ "background": "transparent !important"
21454
21489
  }
21455
21490
  },
21456
21491
  body: [
@@ -21795,7 +21830,9 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
21795
21830
  return _$1__default.includes(_$1__default.map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
21796
21831
  };
21797
21832
 
21798
- const getInstanceInfo = async ({ instanceId, box }) => {
21833
+ const getInstanceInfo = async (props) => {
21834
+ console.log(`getInstanceInfo props`, props);
21835
+ const { instanceId, box } = props;
21799
21836
  const userId = getSteedosAuth().userId;
21800
21837
  const query = `{
21801
21838
  instance: instances__findOne(id:"${instanceId}"){
@@ -22316,9 +22353,9 @@ var AmisObjectButton = function (props) {
22316
22353
  if (button.type === "amis_button") {
22317
22354
  var amisSchema = button.amis_schema;
22318
22355
  var schema = isString(amisSchema) ? JSON.parse(amisSchema) : amisSchema;
22319
- if (schema && schema.body.length > 0) {
22320
- delete schema.body[0]['visibleOn'];
22321
- }
22356
+ // if(schema && schema.body.length > 0){
22357
+ // delete schema.body[0]['visibleOn']
22358
+ // }
22322
22359
  if (schema && schema.body.length > 0 && button.visibleOn) {
22323
22360
  schema.body[0]['visibleOn'] = button.visibleOn;
22324
22361
  }
@@ -22344,6 +22381,14 @@ var AmisObjectButton = function (props) {
22344
22381
  schema.data = createObject(data, defaultsDeep$1(renderData, schema.data, { context: data.context, global: data.global, }));
22345
22382
  delete schema.data.event;
22346
22383
  }
22384
+ // if(!has(JSON.parse(JSON.stringify(data)), 'record')){
22385
+ // if(schema && schema.data){
22386
+ // schema.data.record = null;
22387
+ // }
22388
+ // renderData.record = null;
22389
+ // }
22390
+ // console.log(`steedos-button button--->`, button);
22391
+ // console.log(`steedos-button schema--->`, schema);
22347
22392
  return (React__default.createElement(React__default.Fragment, null, button && amisSchema ? (React__default.createElement(React__default.Fragment, null, render('body', schema, {
22348
22393
  // 这里的信息会作为 props 传递给子组件,一般情况下都不需要这个,
22349
22394
  data: renderData,
@@ -25079,6 +25124,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
25079
25124
  return __generator(this, function (_f) {
25080
25125
  switch (_f.label) {
25081
25126
  case 0:
25127
+ console.log("===AmisObjectForm=props==", props);
25082
25128
  $schema = props.$schema, recordId = props.recordId, mode = props.mode, _a = props.layout, layout = _a === void 0 ? "horizontal" : _a, labelAlign = props.labelAlign, appId = props.appId, fieldsExtend = props.fieldsExtend, _b = props.excludedFields, excludedFields = _b === void 0 ? null : _b, _c = props.fields, fields = _c === void 0 ? null : _c, _d = props.form, form = _d === void 0 ? {} : _d, _e = props.className, className = _e === void 0 ? "" : _e, enableInitApi = props.enableInitApi, initApiRequestAdaptor = props.initApiRequestAdaptor, initApiAdaptor = props.initApiAdaptor, apiRequestAdaptor = props.apiRequestAdaptor, apiAdaptor = props.apiAdaptor, enableTabs = props.enableTabs, tabsMode = props.tabsMode, submitSuccActions = props.submitSuccActions, data = props.data, formDataFilter = props.formDataFilter, onFormDataFilter = props.onFormDataFilter, env = props.env;
25083
25129
  defaultData = props.defaultData;
25084
25130
  objectApiName = props.objectApiName || "space_users";
@@ -25168,11 +25214,11 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
25168
25214
  formData.recordId = props.recordId;
25169
25215
  }
25170
25216
  amisSchema.className = "steedos-object-form ".concat(className);
25171
- // console.log('AmisObjectForm amisSchema======>', amisSchema)
25172
25217
  amisSchema.data = Object.assign({}, amisSchema.data || {}, formData, { global: globalData, uiSchema: uiSchema });
25173
25218
  if (has(props, 'objectApiName')) {
25174
25219
  amisSchema.data.objectName = objectApiName;
25175
25220
  }
25221
+ console.log('AmisObjectForm amisSchema======>', amisSchema);
25176
25222
  return [2 /*return*/, amisSchema];
25177
25223
  }
25178
25224
  });
@@ -25574,9 +25620,9 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
25574
25620
  e_1 = _d.sent();
25575
25621
  console.warn(e_1);
25576
25622
  return [3 /*break*/, 6];
25577
- case 6:
25578
- // console.log(`AmisRecordDetailHeader==>`, config)
25579
- return [2 /*return*/, config];
25623
+ case 6:
25624
+ console.log("AmisRecordDetailHeader==>", config);
25625
+ return [2 /*return*/, config];
25580
25626
  }
25581
25627
  });
25582
25628
  }); };
@@ -27504,7 +27550,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
27504
27550
  label: false,
27505
27551
  className: 'm-0',
27506
27552
  tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
27507
- popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
27553
+ popOver: window.showLookupPopOver && fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
27508
27554
  "trigger": "hover",
27509
27555
  "className": "steedos-record-detail-popover",
27510
27556
  "position": "left-bottom",
@@ -27606,7 +27652,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
27606
27652
  type: 'static',
27607
27653
  className: 'm-0',
27608
27654
  tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\" ".concat(lookupATagClick, ">${label}</a>"),
27609
- popOver: fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
27655
+ popOver: window.showLookupPopOver && fieldRefObject.compactLayouts && window.innerWidth >= 768 ? {
27610
27656
  "trigger": "hover",
27611
27657
  "className": "steedos-record-detail-popover",
27612
27658
  "position": "left-bottom",
@@ -28210,6 +28256,7 @@ var AmisInstanceDetail = function (props) { return __awaiter(void 0, void 0, voi
28210
28256
  return __generator(this, function (_a) {
28211
28257
  switch (_a.label) {
28212
28258
  case 0:
28259
+ console.log("AmisInstanceDetail", props);
28213
28260
  instanceId = props.instanceId, boxName = props.boxName, data = props.data;
28214
28261
  return [4 /*yield*/, getInstanceInfo({ instanceId: instanceId, box: boxName })];
28215
28262
  case 1:
@@ -28219,7 +28266,7 @@ var AmisInstanceDetail = function (props) { return __awaiter(void 0, void 0, voi
28219
28266
  schema = _a.sent();
28220
28267
  // console.log(`AmisInstanceDetail schema`, schema);
28221
28268
  schema.data = __assign$2(__assign$2({ "&": "$$", recordLoaded: true, submit_date: instanceInfo.submit_date, applicant_name: instanceInfo.applicant_name, related_instances: instanceInfo.related_instances, historyApproves: instanceInfo.historyApproves, boxName: boxName }, instanceInfo.approveValues), { context: Object.assign({}, data.context, instanceInfo), record: instanceInfo, applicant: instanceInfo.applicant._id });
28222
- // console.log(`AmisInstanceDetail schema`, schema)
28269
+ console.log("AmisInstanceDetail schema", schema);
28223
28270
  return [2 /*return*/, schema];
28224
28271
  }
28225
28272
  });