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

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
@@ -1114,7 +1114,7 @@ function getRecordPermissionsQuery(object, recordId, options){
1114
1114
  function getApi$2 (isMobile){
1115
1115
  if(isMobile);else {
1116
1116
  // return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
1117
- return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
1117
+ return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}&listName=\${listName}`
1118
1118
  }
1119
1119
  }
1120
1120
 
@@ -2354,7 +2354,7 @@ async function getColumnItemOnClick(field, options){
2354
2354
  "_inDrawer": true, // 用于判断是否在抽屉中
2355
2355
  "recordLoaded": false, // 重置数据加载状态
2356
2356
  "recordId": `\${${options.idFieldName}}`,//审批微页面依赖了作用域中的recordId
2357
- "_tableObjectName": options.objectName
2357
+ "_lookupObjectName": options.objectName
2358
2358
  }
2359
2359
  }) : {
2360
2360
  "type": "steedos-record-detail",
@@ -2365,7 +2365,7 @@ async function getColumnItemOnClick(field, options){
2365
2365
  "data": {
2366
2366
  "_inDrawer": true, // 用于判断是否在抽屉中
2367
2367
  "recordLoaded": false, // 重置数据加载状态
2368
- "_tableObjectName": options.objectName
2368
+ "_lookupObjectName": options.objectName
2369
2369
  }
2370
2370
  };
2371
2371
 
@@ -2538,7 +2538,7 @@ async function getTableColumns(object, fields, options){
2538
2538
  body: {
2539
2539
  type: "steedos-field",
2540
2540
  static: true,
2541
- tableObjectName: options.objectName,
2541
+ isLookupInTable: true,
2542
2542
  config: {
2543
2543
  type: "lookup",
2544
2544
  reference_to: field.reference_to,
@@ -3360,10 +3360,13 @@ async function getTableApi(mainObject, fields, options){
3360
3360
  // item[key] = value
3361
3361
  // PC客户端附件子表列表点击标题预览附件功能依赖了_id,所以这里拼出来
3362
3362
  let itemKeyValue = item[key];
3363
- item[key] = value.map(function(item, index){
3364
- item._id = typeof itemKeyValue == 'string' ? itemKeyValue : itemKeyValue[index];
3365
- item.value = typeof itemKeyValue == 'string' ? itemKeyValue : itemKeyValue[index];
3366
- return item;
3363
+ item[key] = value.map(function(curValue, index){
3364
+ let fileId = typeof itemKeyValue == 'string' ? itemKeyValue : itemKeyValue[index];
3365
+ // 克隆一份对象,避免下方value递归污染curValue
3366
+ let result = _.clone(curValue);
3367
+ result._id = fileId;
3368
+ result.value = fileId;
3369
+ return result;
3367
3370
  });
3368
3371
  }else{
3369
3372
  item[key] = _.map(value, (item)=>{
@@ -3479,6 +3482,7 @@ async function getTableApi(mainObject, fields, options){
3479
3482
  ${options.adaptor || ''}
3480
3483
  return payload;
3481
3484
  `;
3485
+ // api.trackExpression='${additionalFilters|json}'
3482
3486
  return api;
3483
3487
  }
3484
3488
 
@@ -3607,6 +3611,11 @@ function getReadonlyFormAdaptor(object, fields, options){
3607
3611
  objectName: "\${objectName}",
3608
3612
  recordId: "\${recordId}"
3609
3613
  }
3614
+ if(window.location.pathname.endsWith("/"+record._id)){
3615
+ payload.data.mainRecord= {
3616
+ record
3617
+ };
3618
+ }
3610
3619
  window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
3611
3620
  }
3612
3621
  if(payload.errors){
@@ -4880,8 +4889,8 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
4880
4889
  /*
4881
4890
  * @Author: baozhoutao@steedos.com
4882
4891
  * @Date: 2022-11-01 15:51:00
4883
- * @LastEditors: baozhoutao@steedos.com
4884
- * @LastEditTime: 2024-12-26 20:28:43
4892
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
4893
+ * @LastEditTime: 2025-07-14 11:56:42
4885
4894
  * @Description:
4886
4895
  */
4887
4896
 
@@ -5005,6 +5014,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
5005
5014
  "isLookup": "${isLookup}",
5006
5015
  "listName": "${listName}",
5007
5016
  "selectedRowResponseResult": "${selectedRowResponseResult}",
5017
+ "_lookupObjectName": "${_lookupObjectName}"
5008
5018
  },
5009
5019
  "title":i18next.t('frontend_form_new') + " ${uiSchema.label | raw}",
5010
5020
  "body": [
@@ -5077,8 +5087,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
5077
5087
  /*
5078
5088
  * @Author: baozhoutao@steedos.com
5079
5089
  * @Date: 2022-11-01 15:49:58
5080
- * @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
5081
- * @LastEditTime: 2024-05-19 10:01:07
5090
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
5091
+ * @LastEditTime: 2025-07-14 11:55:43
5082
5092
  * @Description:
5083
5093
  */
5084
5094
 
@@ -5108,6 +5118,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
5108
5118
  : page.schema;
5109
5119
  }
5110
5120
 
5121
+ // console.log('formSchema====>', formSchema);
5111
5122
 
5112
5123
  return {
5113
5124
  type: "service",
@@ -5132,9 +5143,10 @@ const getSchema$4 = async (uiSchema, ctx) => {
5132
5143
  showCloseButton: true,
5133
5144
  "data": {
5134
5145
  "&": "$$",
5135
- "_master": "${_master}",
5146
+ "_master": "${mainRecord}",
5136
5147
  "_master._isRelated": "${_isRelated}",
5137
- "_master.relatedKey": "${relatedKey}"
5148
+ "_master.relatedKey": "${relatedKey}",
5149
+ "_lookupObjectName": "${_lookupObjectName}"
5138
5150
  },
5139
5151
  size: "lg",
5140
5152
  "actions": [
@@ -5233,12 +5245,12 @@ const getSchema$3 = (uiSchema)=>{
5233
5245
  {
5234
5246
  "actionType": "broadcast",
5235
5247
  "args": {
5236
- "eventName": "@data.changed.${_tableObjectName}"
5248
+ "eventName": "@data.changed.${_lookupObjectName}"
5237
5249
  },
5238
5250
  "data": {
5239
- "objectName": "${_tableObjectName}"
5251
+ "objectName": "${_lookupObjectName}"
5240
5252
  },
5241
- "expression": `\${_tableObjectName != '${uiSchema.name}' && _tableObjectName}`
5253
+ "expression": `\${_lookupObjectName != '${uiSchema.name}' && _lookupObjectName}`
5242
5254
  }
5243
5255
  ]
5244
5256
  }
@@ -6471,7 +6483,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6471
6483
  });
6472
6484
  // 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
6473
6485
  if(!_.isEmpty(omitedEmptyFormValue)){
6474
- let crudService = SteedosUI.getRef(data.$scopeId).parent.getComponentById("service_listview_" + data.objectName)
6486
+ let scopeRef = SteedosUI.getRef(data.$scopeId);
6487
+ let crudService = scopeRef && scopeRef.parent.getComponentById("service_listview_" + data.objectName)
6475
6488
  crudService && crudService.setData({isFieldsFilterEmpty: false});
6476
6489
  // setData({ showFieldsFilter: true });//自动展开搜索栏
6477
6490
  }
@@ -7570,6 +7583,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
7570
7583
  "size": "sm",
7571
7584
  "hideCaret": true,
7572
7585
  "closeOnClick": true,
7586
+ "visibleOn": "\${listName && uiSchema.list_views[listName].disableSwitch != true}",
7573
7587
  "btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
7574
7588
  "buttons": [
7575
7589
  ...listViewButtonOptions,
@@ -7582,6 +7596,12 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
7582
7596
  },
7583
7597
  listviewNewButton
7584
7598
  ]
7599
+ },
7600
+ {
7601
+ "type": "tpl",
7602
+ "className": "steedos-listview-change-button text-lg font-bold",
7603
+ "tpl": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
7604
+ "visibleOn": "\${listName && uiSchema.list_views[listName].disableSwitch}",
7585
7605
  }
7586
7606
  ],
7587
7607
  "md": "",
@@ -9979,16 +9999,16 @@ async function getObjectForm(objectSchema, ctx){
9979
9999
  },
9980
10000
  "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
9981
10001
  },
9982
- // 列表视图、对象表格组件上的lookup字段,点开右侧弹出drawer窗口,修改记录后刷新列表
10002
+ // 列表视图、对象表格、对象表单组件上的lookup字段,点开右侧弹出drawer窗口,修改记录后刷新列表
9983
10003
  {
9984
10004
  "actionType": "broadcast",
9985
10005
  "args": {
9986
- "eventName": "@data.changed.${_tableObjectName}"
10006
+ "eventName": "@data.changed.${_lookupObjectName}"
9987
10007
  },
9988
10008
  "data": {
9989
- "objectName": "${_tableObjectName}"
10009
+ "objectName": "${_lookupObjectName}"
9990
10010
  },
9991
- "expression": `\${_tableObjectName != '${objectSchema.name}' && _tableObjectName}`
10011
+ "expression": `\${_lookupObjectName != '${objectSchema.name}' && _lookupObjectName}`
9992
10012
  },
9993
10013
  ...submitSuccActions,
9994
10014
  // {
@@ -14227,7 +14247,8 @@ async function getFieldSearchable(perField, permissionFields, ctx){
14227
14247
  _field.removable = false;
14228
14248
  _field.value = [null,null];
14229
14249
  _field.items = {
14230
- type: "input-number"
14250
+ type: "input-number",
14251
+ clearValueOnEmpty: true
14231
14252
  };
14232
14253
  _field.is_wide = true;
14233
14254
  fieldNamePrefix = `${fieldNamePrefix}between__`;
@@ -14275,6 +14296,10 @@ async function getFieldSearchable(perField, permissionFields, ctx){
14275
14296
  delete _field.amis.hidden;
14276
14297
  delete _field.amis.hiddenOn;
14277
14298
  delete _field.amis.autoFill;
14299
+ if(_field.type.indexOf("-range") > -1 || _field.type === 'input-array'){
14300
+ // 范围类型不允许变更type,否则会因为某些属性兼容性问题报错页面奔溃,比如input-date-range类型有shortcuts属性,改为input-date后其shortcuts属性有兼容性问题
14301
+ delete _field.amis.type;
14302
+ }
14278
14303
  }
14279
14304
 
14280
14305
  const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
@@ -17914,6 +17939,10 @@ const getFieldEditTpl = async (field, label)=>{
17914
17939
  case "section":
17915
17940
  tpl.type = "input-text";
17916
17941
  break;
17942
+ default:
17943
+ tpl.type = 'steedos-field';
17944
+ tpl.config = field.steedos_field;
17945
+ break;
17917
17946
  }
17918
17947
  }
17919
17948
  // console.log('getFieldEditTpl ', label, tpl)
@@ -18038,15 +18067,15 @@ const getTdField = async (field, fieldsCount) => {
18038
18067
 
18039
18068
  const getTdTitle = (field) => {
18040
18069
  return {
18041
- className: "td-title",
18070
+ className: `td-title td-title-${field.type}`,
18042
18071
  align: field.type != "section" ? "center" : "left",
18043
18072
  width: field.type != "section" ? "16%" : "",
18044
18073
  colspan: field.type == "section" ? 4 : "",
18045
- background: "#FFFFFF",
18074
+ background: field.type == "section" ? "#f1f1f1" : "#FFFFFF",
18046
18075
  body: [
18047
18076
  {
18048
18077
  type: "tpl",
18049
- tpl: `<div>${field.name || field.code} ${field.is_required ? '<span class="antd-Form-star">*</span>' : ''}</div>`,
18078
+ tpl: `<div class='${field.type == "section" ? "font-bold" : ""}'>${field.name || field.code} ${field.is_required ? '<span class="antd-Form-star">*</span>' : ''}</div>`,
18050
18079
  },
18051
18080
  ],
18052
18081
  // "id": "u:9b001b7ff92d",
@@ -18119,6 +18148,7 @@ const getFormTableView = async (instance) => {
18119
18148
  trs: await getFormTrs(instance),
18120
18149
  id: "u:047f3669468b",
18121
18150
  };
18151
+ console.log('getFormTableView===>', instance, formSchema);
18122
18152
  return formSchema;
18123
18153
  };
18124
18154
 
@@ -18148,6 +18178,14 @@ const getApplicantTableView = async (instance) => {
18148
18178
  };
18149
18179
  }
18150
18180
 
18181
+ if(applicantInput){
18182
+ if(applicantInput.className){
18183
+ applicantInput.className = `${applicantInput.className} inline-left`;
18184
+ }else {
18185
+ applicantInput.className = `inline-left`;
18186
+ }
18187
+ }
18188
+
18151
18189
  return {
18152
18190
  type: "table-view",
18153
18191
  className: "instance-applicant-view",
@@ -18159,70 +18197,50 @@ const getApplicantTableView = async (instance) => {
18159
18197
  className: "td-title",
18160
18198
  background: "#FFFFFF",
18161
18199
  align: "left",
18162
- width: "16%",
18200
+ width: "50%",
18163
18201
  colspan: "",
18164
18202
  body: [
18165
18203
  {
18166
18204
  type: "tpl",
18167
- tpl: "<div>提交人</div>",
18205
+ tpl: "<div class='inline-left'>提交人:</div>",
18168
18206
  id: "u:ee62634201bf",
18169
18207
  },
18208
+ applicantInput
18170
18209
  ],
18171
18210
  id: "u:6c24c1bb99c9",
18172
18211
  style: {
18173
18212
  padding: "none",
18174
18213
  },
18175
18214
  },
18176
- {
18177
- background: "#FFFFFF",
18178
- colspan: 1,
18179
- align: "left",
18180
- className: "td-field",
18181
- width: "32%",
18182
- body: [
18183
- applicantInput
18184
- ],
18185
- id: "u:45d65d91905c",
18186
- },
18187
18215
  {
18188
18216
  className: "td-title",
18189
18217
  background: "#FFFFFF",
18190
18218
  align: "left",
18191
- width: "16%",
18219
+ width: "50%",
18192
18220
  colspan: "",
18193
18221
  body: [
18194
18222
  {
18195
18223
  type: "tpl",
18196
- tpl: "<div>提交日期</div>",
18224
+ tpl: "<div class='inline-left'>提交日期:</div>",
18197
18225
  id: "u:6d0a7763d527",
18198
18226
  },
18199
- ],
18200
- id: "u:c8b8214ac931",
18201
- style: {
18202
- padding: "none",
18203
- },
18204
- },
18205
- {
18206
- background: "#FFFFFF",
18207
- colspan: 1,
18208
- align: "left",
18209
- className: "td-field",
18210
- width: "32%",
18211
- body: [
18212
18227
  {
18213
18228
  label: false,
18214
18229
  mode: "horizontal",
18215
- className: "m-none p-none",
18230
+ className: "m-none p-none inline-left",
18216
18231
  disabled: true,
18217
18232
  type: "tpl",
18218
18233
  inputFormat: "YYYY-MM-DD",
18219
18234
  valueFormat: "YYYY-MM-DDT00:00:00.000[Z]",
18220
18235
  tpl: '<div>${submit_date}</div>',
18221
18236
  id: "u:2016b04355f4",
18222
- },
18237
+ }
18223
18238
  ],
18224
- id: "u:81b07d82a5e4",
18225
- },
18239
+ id: "u:c8b8214ac931",
18240
+ style: {
18241
+ padding: "none",
18242
+ },
18243
+ }
18226
18244
  ],
18227
18245
  },
18228
18246
  ],
@@ -18276,7 +18294,7 @@ const getFlowFormSchema = async (instance, box) => {
18276
18294
  "recordId": instance._id,
18277
18295
  "id": "u:e6b2adbe0e21",
18278
18296
  "showRecordTitle": false,
18279
- "className": "p-0 m-0 p0 m0"
18297
+ "className": "p-0 m-0 p0 m0 bg-gray-50"
18280
18298
  },
18281
18299
  "css": {
18282
18300
  ".instance-approve-history .antd-Table-table thead": {
@@ -18295,7 +18313,7 @@ const getFlowFormSchema = async (instance, box) => {
18295
18313
  "padding": "0px !important"
18296
18314
  },
18297
18315
  ".steedos-amis-instance-view .antd-Page-body": {
18298
- "width": "710px"
18316
+ "width": "1024px"
18299
18317
  },
18300
18318
  ".antd-List-placeholder": {
18301
18319
  "display": "none"
@@ -18653,6 +18671,7 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
18653
18671
  return ___default.includes(___default.map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
18654
18672
  };
18655
18673
 
18674
+
18656
18675
  const getInstanceInfo = async (props) => {
18657
18676
  console.log(`getInstanceInfo props`, props);
18658
18677
  const { instanceId, box } = props;
@@ -18738,7 +18757,7 @@ const getInstanceInfo = async (props) => {
18738
18757
  });
18739
18758
 
18740
18759
  const moment = getMoment();
18741
-
18760
+ console.log('getInstanceInfo====>', step, formVersion.fields);
18742
18761
  return {
18743
18762
  box: box,
18744
18763
  _id: instanceId,
@@ -18756,9 +18775,17 @@ const getInstanceInfo = async (props) => {
18756
18775
  title: instance.name || instance.form.name,
18757
18776
  name: instance.name || instance.form.name,
18758
18777
  fields: ___default.map(formVersion.fields, (field) => {
18759
- return Object.assign({}, field, {
18778
+ const newField = Object.assign({}, field, {
18760
18779
  permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
18761
18780
  }) ;
18781
+ if(field.type === 'section'){
18782
+ newField.fields = ___default.map(field.fields, (sfield) => {
18783
+ return Object.assign({}, sfield, {
18784
+ permission: userApprove?.type != 'cc' && (step?.permissions[sfield.code] || ( isCurrentStepOpinionField(sfield, step) ? 'editable' : '')),
18785
+ });
18786
+ });
18787
+ }
18788
+ return newField;
18762
18789
  }),
18763
18790
  flowVersion: flowVersion,
18764
18791
  formVersion: formVersion,