@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.cjs.js CHANGED
@@ -1141,7 +1141,7 @@ function getRecordPermissionsQuery(object, recordId, options){
1141
1141
  function getApi$2 (isMobile){
1142
1142
  if(isMobile);else {
1143
1143
  // return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
1144
- return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
1144
+ return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}&listName=\${listName}`
1145
1145
  }
1146
1146
  }
1147
1147
 
@@ -2381,7 +2381,7 @@ async function getColumnItemOnClick(field, options){
2381
2381
  "_inDrawer": true, // 用于判断是否在抽屉中
2382
2382
  "recordLoaded": false, // 重置数据加载状态
2383
2383
  "recordId": `\${${options.idFieldName}}`,//审批微页面依赖了作用域中的recordId
2384
- "_tableObjectName": options.objectName
2384
+ "_lookupObjectName": options.objectName
2385
2385
  }
2386
2386
  }) : {
2387
2387
  "type": "steedos-record-detail",
@@ -2392,7 +2392,7 @@ async function getColumnItemOnClick(field, options){
2392
2392
  "data": {
2393
2393
  "_inDrawer": true, // 用于判断是否在抽屉中
2394
2394
  "recordLoaded": false, // 重置数据加载状态
2395
- "_tableObjectName": options.objectName
2395
+ "_lookupObjectName": options.objectName
2396
2396
  }
2397
2397
  };
2398
2398
 
@@ -2565,7 +2565,7 @@ async function getTableColumns(object, fields, options){
2565
2565
  body: {
2566
2566
  type: "steedos-field",
2567
2567
  static: true,
2568
- tableObjectName: options.objectName,
2568
+ isLookupInTable: true,
2569
2569
  config: {
2570
2570
  type: "lookup",
2571
2571
  reference_to: field.reference_to,
@@ -3387,10 +3387,13 @@ async function getTableApi(mainObject, fields, options){
3387
3387
  // item[key] = value
3388
3388
  // PC客户端附件子表列表点击标题预览附件功能依赖了_id,所以这里拼出来
3389
3389
  let itemKeyValue = item[key];
3390
- item[key] = value.map(function(item, index){
3391
- item._id = typeof itemKeyValue == 'string' ? itemKeyValue : itemKeyValue[index];
3392
- item.value = typeof itemKeyValue == 'string' ? itemKeyValue : itemKeyValue[index];
3393
- return item;
3390
+ item[key] = value.map(function(curValue, index){
3391
+ let fileId = typeof itemKeyValue == 'string' ? itemKeyValue : itemKeyValue[index];
3392
+ // 克隆一份对象,避免下方value递归污染curValue
3393
+ let result = _.clone(curValue);
3394
+ result._id = fileId;
3395
+ result.value = fileId;
3396
+ return result;
3394
3397
  });
3395
3398
  }else{
3396
3399
  item[key] = _.map(value, (item)=>{
@@ -3506,6 +3509,7 @@ async function getTableApi(mainObject, fields, options){
3506
3509
  ${options.adaptor || ''}
3507
3510
  return payload;
3508
3511
  `;
3512
+ // api.trackExpression='${additionalFilters|json}'
3509
3513
  return api;
3510
3514
  }
3511
3515
 
@@ -3634,6 +3638,11 @@ function getReadonlyFormAdaptor(object, fields, options){
3634
3638
  objectName: "\${objectName}",
3635
3639
  recordId: "\${recordId}"
3636
3640
  }
3641
+ if(window.location.pathname.endsWith("/"+record._id)){
3642
+ payload.data.mainRecord= {
3643
+ record
3644
+ };
3645
+ }
3637
3646
  window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
3638
3647
  }
3639
3648
  if(payload.errors){
@@ -4907,8 +4916,8 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
4907
4916
  /*
4908
4917
  * @Author: baozhoutao@steedos.com
4909
4918
  * @Date: 2022-11-01 15:51:00
4910
- * @LastEditors: baozhoutao@steedos.com
4911
- * @LastEditTime: 2024-12-26 20:28:43
4919
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
4920
+ * @LastEditTime: 2025-07-14 11:56:42
4912
4921
  * @Description:
4913
4922
  */
4914
4923
 
@@ -5032,6 +5041,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
5032
5041
  "isLookup": "${isLookup}",
5033
5042
  "listName": "${listName}",
5034
5043
  "selectedRowResponseResult": "${selectedRowResponseResult}",
5044
+ "_lookupObjectName": "${_lookupObjectName}"
5035
5045
  },
5036
5046
  "title":i18next__default["default"].t('frontend_form_new') + " ${uiSchema.label | raw}",
5037
5047
  "body": [
@@ -5104,8 +5114,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
5104
5114
  /*
5105
5115
  * @Author: baozhoutao@steedos.com
5106
5116
  * @Date: 2022-11-01 15:49:58
5107
- * @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
5108
- * @LastEditTime: 2024-05-19 10:01:07
5117
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
5118
+ * @LastEditTime: 2025-07-14 11:55:43
5109
5119
  * @Description:
5110
5120
  */
5111
5121
 
@@ -5135,6 +5145,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
5135
5145
  : page.schema;
5136
5146
  }
5137
5147
 
5148
+ // console.log('formSchema====>', formSchema);
5138
5149
 
5139
5150
  return {
5140
5151
  type: "service",
@@ -5159,9 +5170,10 @@ const getSchema$4 = async (uiSchema, ctx) => {
5159
5170
  showCloseButton: true,
5160
5171
  "data": {
5161
5172
  "&": "$$",
5162
- "_master": "${_master}",
5173
+ "_master": "${mainRecord}",
5163
5174
  "_master._isRelated": "${_isRelated}",
5164
- "_master.relatedKey": "${relatedKey}"
5175
+ "_master.relatedKey": "${relatedKey}",
5176
+ "_lookupObjectName": "${_lookupObjectName}"
5165
5177
  },
5166
5178
  size: "lg",
5167
5179
  "actions": [
@@ -5260,12 +5272,12 @@ const getSchema$3 = (uiSchema)=>{
5260
5272
  {
5261
5273
  "actionType": "broadcast",
5262
5274
  "args": {
5263
- "eventName": "@data.changed.${_tableObjectName}"
5275
+ "eventName": "@data.changed.${_lookupObjectName}"
5264
5276
  },
5265
5277
  "data": {
5266
- "objectName": "${_tableObjectName}"
5278
+ "objectName": "${_lookupObjectName}"
5267
5279
  },
5268
- "expression": `\${_tableObjectName != '${uiSchema.name}' && _tableObjectName}`
5280
+ "expression": `\${_lookupObjectName != '${uiSchema.name}' && _lookupObjectName}`
5269
5281
  }
5270
5282
  ]
5271
5283
  }
@@ -6498,7 +6510,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
6498
6510
  });
6499
6511
  // 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
6500
6512
  if(!_.isEmpty(omitedEmptyFormValue)){
6501
- let crudService = SteedosUI.getRef(data.$scopeId).parent.getComponentById("service_listview_" + data.objectName)
6513
+ let scopeRef = SteedosUI.getRef(data.$scopeId);
6514
+ let crudService = scopeRef && scopeRef.parent.getComponentById("service_listview_" + data.objectName)
6502
6515
  crudService && crudService.setData({isFieldsFilterEmpty: false});
6503
6516
  // setData({ showFieldsFilter: true });//自动展开搜索栏
6504
6517
  }
@@ -7597,6 +7610,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
7597
7610
  "size": "sm",
7598
7611
  "hideCaret": true,
7599
7612
  "closeOnClick": true,
7613
+ "visibleOn": "\${listName && uiSchema.list_views[listName].disableSwitch != true}",
7600
7614
  "btnClassName": "!bg-transparent !border-none !hover:border-none text-lg h-5 font-bold p-0 text-black leading-none",
7601
7615
  "buttons": [
7602
7616
  ...listViewButtonOptions,
@@ -7609,6 +7623,12 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
7609
7623
  },
7610
7624
  listviewNewButton
7611
7625
  ]
7626
+ },
7627
+ {
7628
+ "type": "tpl",
7629
+ "className": "steedos-listview-change-button text-lg font-bold",
7630
+ "tpl": "\${listName ? uiSchema.list_views[listName].label : uiSchema.list_views[defaultListName].label}",
7631
+ "visibleOn": "\${listName && uiSchema.list_views[listName].disableSwitch}",
7612
7632
  }
7613
7633
  ],
7614
7634
  "md": "",
@@ -10006,16 +10026,16 @@ async function getObjectForm(objectSchema, ctx){
10006
10026
  },
10007
10027
  "expression": `\${_master.objectName != '${objectSchema.name}' && _master.objectName}`
10008
10028
  },
10009
- // 列表视图、对象表格组件上的lookup字段,点开右侧弹出drawer窗口,修改记录后刷新列表
10029
+ // 列表视图、对象表格、对象表单组件上的lookup字段,点开右侧弹出drawer窗口,修改记录后刷新列表
10010
10030
  {
10011
10031
  "actionType": "broadcast",
10012
10032
  "args": {
10013
- "eventName": "@data.changed.${_tableObjectName}"
10033
+ "eventName": "@data.changed.${_lookupObjectName}"
10014
10034
  },
10015
10035
  "data": {
10016
- "objectName": "${_tableObjectName}"
10036
+ "objectName": "${_lookupObjectName}"
10017
10037
  },
10018
- "expression": `\${_tableObjectName != '${objectSchema.name}' && _tableObjectName}`
10038
+ "expression": `\${_lookupObjectName != '${objectSchema.name}' && _lookupObjectName}`
10019
10039
  },
10020
10040
  ...submitSuccActions,
10021
10041
  // {
@@ -14254,7 +14274,8 @@ async function getFieldSearchable(perField, permissionFields, ctx){
14254
14274
  _field.removable = false;
14255
14275
  _field.value = [null,null];
14256
14276
  _field.items = {
14257
- type: "input-number"
14277
+ type: "input-number",
14278
+ clearValueOnEmpty: true
14258
14279
  };
14259
14280
  _field.is_wide = true;
14260
14281
  fieldNamePrefix = `${fieldNamePrefix}between__`;
@@ -14302,6 +14323,10 @@ async function getFieldSearchable(perField, permissionFields, ctx){
14302
14323
  delete _field.amis.hidden;
14303
14324
  delete _field.amis.hiddenOn;
14304
14325
  delete _field.amis.autoFill;
14326
+ if(_field.type.indexOf("-range") > -1 || _field.type === 'input-array'){
14327
+ // 范围类型不允许变更type,否则会因为某些属性兼容性问题报错页面奔溃,比如input-date-range类型有shortcuts属性,改为input-date后其shortcuts属性有兼容性问题
14328
+ delete _field.amis.type;
14329
+ }
14305
14330
  }
14306
14331
 
14307
14332
  const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
@@ -17941,6 +17966,10 @@ const getFieldEditTpl = async (field, label)=>{
17941
17966
  case "section":
17942
17967
  tpl.type = "input-text";
17943
17968
  break;
17969
+ default:
17970
+ tpl.type = 'steedos-field';
17971
+ tpl.config = field.steedos_field;
17972
+ break;
17944
17973
  }
17945
17974
  }
17946
17975
  // console.log('getFieldEditTpl ', label, tpl)
@@ -18065,15 +18094,15 @@ const getTdField = async (field, fieldsCount) => {
18065
18094
 
18066
18095
  const getTdTitle = (field) => {
18067
18096
  return {
18068
- className: "td-title",
18097
+ className: `td-title td-title-${field.type}`,
18069
18098
  align: field.type != "section" ? "center" : "left",
18070
18099
  width: field.type != "section" ? "16%" : "",
18071
18100
  colspan: field.type == "section" ? 4 : "",
18072
- background: "#FFFFFF",
18101
+ background: field.type == "section" ? "#f1f1f1" : "#FFFFFF",
18073
18102
  body: [
18074
18103
  {
18075
18104
  type: "tpl",
18076
- tpl: `<div>${field.name || field.code} ${field.is_required ? '<span class="antd-Form-star">*</span>' : ''}</div>`,
18105
+ tpl: `<div class='${field.type == "section" ? "font-bold" : ""}'>${field.name || field.code} ${field.is_required ? '<span class="antd-Form-star">*</span>' : ''}</div>`,
18077
18106
  },
18078
18107
  ],
18079
18108
  // "id": "u:9b001b7ff92d",
@@ -18146,6 +18175,7 @@ const getFormTableView = async (instance) => {
18146
18175
  trs: await getFormTrs(instance),
18147
18176
  id: "u:047f3669468b",
18148
18177
  };
18178
+ console.log('getFormTableView===>', instance, formSchema);
18149
18179
  return formSchema;
18150
18180
  };
18151
18181
 
@@ -18175,6 +18205,14 @@ const getApplicantTableView = async (instance) => {
18175
18205
  };
18176
18206
  }
18177
18207
 
18208
+ if(applicantInput){
18209
+ if(applicantInput.className){
18210
+ applicantInput.className = `${applicantInput.className} inline-left`;
18211
+ }else {
18212
+ applicantInput.className = `inline-left`;
18213
+ }
18214
+ }
18215
+
18178
18216
  return {
18179
18217
  type: "table-view",
18180
18218
  className: "instance-applicant-view",
@@ -18186,70 +18224,50 @@ const getApplicantTableView = async (instance) => {
18186
18224
  className: "td-title",
18187
18225
  background: "#FFFFFF",
18188
18226
  align: "left",
18189
- width: "16%",
18227
+ width: "50%",
18190
18228
  colspan: "",
18191
18229
  body: [
18192
18230
  {
18193
18231
  type: "tpl",
18194
- tpl: "<div>提交人</div>",
18232
+ tpl: "<div class='inline-left'>提交人:</div>",
18195
18233
  id: "u:ee62634201bf",
18196
18234
  },
18235
+ applicantInput
18197
18236
  ],
18198
18237
  id: "u:6c24c1bb99c9",
18199
18238
  style: {
18200
18239
  padding: "none",
18201
18240
  },
18202
18241
  },
18203
- {
18204
- background: "#FFFFFF",
18205
- colspan: 1,
18206
- align: "left",
18207
- className: "td-field",
18208
- width: "32%",
18209
- body: [
18210
- applicantInput
18211
- ],
18212
- id: "u:45d65d91905c",
18213
- },
18214
18242
  {
18215
18243
  className: "td-title",
18216
18244
  background: "#FFFFFF",
18217
18245
  align: "left",
18218
- width: "16%",
18246
+ width: "50%",
18219
18247
  colspan: "",
18220
18248
  body: [
18221
18249
  {
18222
18250
  type: "tpl",
18223
- tpl: "<div>提交日期</div>",
18251
+ tpl: "<div class='inline-left'>提交日期:</div>",
18224
18252
  id: "u:6d0a7763d527",
18225
18253
  },
18226
- ],
18227
- id: "u:c8b8214ac931",
18228
- style: {
18229
- padding: "none",
18230
- },
18231
- },
18232
- {
18233
- background: "#FFFFFF",
18234
- colspan: 1,
18235
- align: "left",
18236
- className: "td-field",
18237
- width: "32%",
18238
- body: [
18239
18254
  {
18240
18255
  label: false,
18241
18256
  mode: "horizontal",
18242
- className: "m-none p-none",
18257
+ className: "m-none p-none inline-left",
18243
18258
  disabled: true,
18244
18259
  type: "tpl",
18245
18260
  inputFormat: "YYYY-MM-DD",
18246
18261
  valueFormat: "YYYY-MM-DDT00:00:00.000[Z]",
18247
18262
  tpl: '<div>${submit_date}</div>',
18248
18263
  id: "u:2016b04355f4",
18249
- },
18264
+ }
18250
18265
  ],
18251
- id: "u:81b07d82a5e4",
18252
- },
18266
+ id: "u:c8b8214ac931",
18267
+ style: {
18268
+ padding: "none",
18269
+ },
18270
+ }
18253
18271
  ],
18254
18272
  },
18255
18273
  ],
@@ -18303,7 +18321,7 @@ const getFlowFormSchema = async (instance, box) => {
18303
18321
  "recordId": instance._id,
18304
18322
  "id": "u:e6b2adbe0e21",
18305
18323
  "showRecordTitle": false,
18306
- "className": "p-0 m-0 p0 m0"
18324
+ "className": "p-0 m-0 p0 m0 bg-gray-50"
18307
18325
  },
18308
18326
  "css": {
18309
18327
  ".instance-approve-history .antd-Table-table thead": {
@@ -18322,7 +18340,7 @@ const getFlowFormSchema = async (instance, box) => {
18322
18340
  "padding": "0px !important"
18323
18341
  },
18324
18342
  ".steedos-amis-instance-view .antd-Page-body": {
18325
- "width": "710px"
18343
+ "width": "1024px"
18326
18344
  },
18327
18345
  ".antd-List-placeholder": {
18328
18346
  "display": "none"
@@ -18680,6 +18698,7 @@ const isCurrentStepOpinionField = (field, currentStep)=>{
18680
18698
  return ___default["default"].includes(___default["default"].map(getOpinionFieldStepsName(field), 'stepName'), currentStep?.name);
18681
18699
  };
18682
18700
 
18701
+
18683
18702
  const getInstanceInfo = async (props) => {
18684
18703
  console.log(`getInstanceInfo props`, props);
18685
18704
  const { instanceId, box } = props;
@@ -18765,7 +18784,7 @@ const getInstanceInfo = async (props) => {
18765
18784
  });
18766
18785
 
18767
18786
  const moment = getMoment();
18768
-
18787
+ console.log('getInstanceInfo====>', step, formVersion.fields);
18769
18788
  return {
18770
18789
  box: box,
18771
18790
  _id: instanceId,
@@ -18783,9 +18802,17 @@ const getInstanceInfo = async (props) => {
18783
18802
  title: instance.name || instance.form.name,
18784
18803
  name: instance.name || instance.form.name,
18785
18804
  fields: ___default["default"].map(formVersion.fields, (field) => {
18786
- return Object.assign({}, field, {
18805
+ const newField = Object.assign({}, field, {
18787
18806
  permission: userApprove?.type != 'cc' && (step?.permissions[field.code] || ( isCurrentStepOpinionField(field, step) ? 'editable' : '')),
18788
18807
  }) ;
18808
+ if(field.type === 'section'){
18809
+ newField.fields = ___default["default"].map(field.fields, (sfield) => {
18810
+ return Object.assign({}, sfield, {
18811
+ permission: userApprove?.type != 'cc' && (step?.permissions[sfield.code] || ( isCurrentStepOpinionField(sfield, step) ? 'editable' : '')),
18812
+ });
18813
+ });
18814
+ }
18815
+ return newField;
18789
18816
  }),
18790
18817
  flowVersion: flowVersion,
18791
18818
  formVersion: formVersion,