@steedos-widgets/amis-object 1.3.22-beta.2 → 3.6.0-beta.3

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.
@@ -108,6 +108,18 @@ function __generator(thisArg, body) {
108
108
  }
109
109
  }
110
110
 
111
+ function __values(o) {
112
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
113
+ if (m) return m.call(o);
114
+ if (o && typeof o.length === "number") return {
115
+ next: function () {
116
+ if (o && i >= o.length) o = void 0;
117
+ return { value: o && o[i++], done: !o };
118
+ }
119
+ };
120
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
121
+ }
122
+
111
123
  function __read(o, n) {
112
124
  var m = typeof Symbol === "function" && o[Symbol.iterator];
113
125
  if (!m) return o;
@@ -4795,6 +4807,7 @@ async function getQuickEditSchema(field, options){
4795
4807
  {
4796
4808
  "actionType": "custom",
4797
4809
  "script": `
4810
+
4798
4811
  var _display = _.cloneDeep(event.data._display);
4799
4812
  ${displayField}
4800
4813
  doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
@@ -4966,7 +4979,7 @@ async function getQuickEditSchema(field, options){
4966
4979
  "actions":[
4967
4980
  {
4968
4981
  "actionType": "setValue",
4969
- "componentId": `service_listview_${options.objectName}`,
4982
+ "componentId": quickEditId,
4970
4983
  "args": {
4971
4984
  "value":{
4972
4985
  "quickedit_record_permissions_loading": true
@@ -4991,7 +5004,7 @@ async function getQuickEditSchema(field, options){
4991
5004
  },
4992
5005
  {
4993
5006
  "actionType": "setValue",
4994
- "componentId": `service_listview_${options.objectName}`,
5007
+ "componentId": quickEditId,
4995
5008
  "args": {
4996
5009
  "value":{
4997
5010
  "quickedit_record_permissions_loading": false
@@ -5000,7 +5013,7 @@ async function getQuickEditSchema(field, options){
5000
5013
  },
5001
5014
  {
5002
5015
  "actionType": "setValue",
5003
- "componentId": `service_listview_${options.objectName}`,
5016
+ "componentId": quickEditId,
5004
5017
  "args": {
5005
5018
  "value":{
5006
5019
  "quickedit_record_permissions": "${event.data}"
@@ -5179,9 +5192,9 @@ function getFieldWidth(width){
5179
5192
  async function getTableColumns$1(fields, options){
5180
5193
  const columns = [];
5181
5194
  if(!options.isLookup && !options.isInputTable){
5182
- //将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
5183
- columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
5184
- columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
5195
+ if(!options.enable_tree){
5196
+ columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
5197
+ }
5185
5198
  }
5186
5199
  const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
5187
5200
 
@@ -5723,6 +5736,7 @@ async function getTableSchema$1(fields, options){
5723
5736
  if(!isLookup && !hiddenColumnOperation){
5724
5737
  columns.push(await getTableOperation(options));
5725
5738
  }
5739
+
5726
5740
  }
5727
5741
 
5728
5742
  return {
@@ -6032,7 +6046,21 @@ async function getTableApi(mainObject, fields, options){
6032
6046
 
6033
6047
  if(enable_tree){
6034
6048
  const records = payload.data.rows || [];
6035
- const getTreeOptions = SteedosUI.getTreeOptions
6049
+ const getTreeOptions = SteedosUI.getTreeOptions;
6050
+ const assignIndexToTreeRecords = function(tree, parentIndex) {
6051
+ tree.forEach(function (node, index) {
6052
+ // 构建当前节点的 _index
6053
+ var currentIndex = parentIndex ? parentIndex + '-' + (index + 1) : '' + (index + 1);
6054
+
6055
+ // 赋值给节点
6056
+ node._index = currentIndex;
6057
+
6058
+ // 如果有子节点,递归调用函数
6059
+ if (node.children && node.children.length > 0) {
6060
+ assignIndexToTreeRecords(node.children, currentIndex);
6061
+ }
6062
+ });
6063
+ };
6036
6064
  let isTreeOptionsComputed = false;
6037
6065
  if(records.length === 1 && records[0].children){
6038
6066
  isTreeOptionsComputed = true;
@@ -6040,6 +6068,7 @@ async function getTableApi(mainObject, fields, options){
6040
6068
  if(!isTreeOptionsComputed){
6041
6069
  // 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
6042
6070
  payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
6071
+ assignIndexToTreeRecords(payload.data.rows, '');
6043
6072
  }
6044
6073
  try{
6045
6074
  setTimeout(() => {
@@ -6816,6 +6845,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
6816
6845
  "dialog": {
6817
6846
  "type": "dialog",
6818
6847
  "title": title,
6848
+ data,
6819
6849
  "body": [
6820
6850
  {
6821
6851
  "type": "steedos-object-form",
@@ -11396,7 +11426,7 @@ async function getObjectCRUD(objectSchema, fields, options){
11396
11426
  let tableOptions = Object.assign({
11397
11427
  idFieldName: objectSchema.idFieldName, labelFieldName: labelFieldName,
11398
11428
  permissions:objectSchema.permissions,enable_inline_edit:objectSchema.enable_inline_edit,
11399
- crudId: listSchema.id || id
11429
+ crudId: listSchema.id || id, enable_tree: objectSchema.enable_tree
11400
11430
  }, options);
11401
11431
  tableOptions.amisData = createObject(options.amisData || {}, {});
11402
11432
  const table = await getTableSchema$1(fields, tableOptions);
@@ -11488,6 +11518,11 @@ async function getObjectCRUD(objectSchema, fields, options){
11488
11518
  crudModeClassName = `steedos-crud-mode-${body.mode}`;
11489
11519
  }
11490
11520
 
11521
+ if(body.columns && options.formFactor != 'SMALL'){
11522
+ //将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
11523
+ body.columns.splice(body.columns.length - 1, 0, {name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
11524
+ }
11525
+
11491
11526
  if (defaults) {
11492
11527
  const headerSchema = defaults.headerSchema;
11493
11528
  const footerSchema = defaults.footerSchema;
@@ -11512,6 +11547,7 @@ async function getObjectCRUD(objectSchema, fields, options){
11512
11547
  body = wrappedBody;
11513
11548
  }
11514
11549
  }
11550
+
11515
11551
  // console.timeEnd('getObjectCRUD');
11516
11552
  // TODO: data应该只留loaded,其他属性都改为从上层传递下来
11517
11553
  return {
@@ -13714,6 +13750,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
13714
13750
  */
13715
13751
  return payload;
13716
13752
  }
13753
+ if(!payload.data.rows){
13754
+ payload.data.rows = [];
13755
+ }
13717
13756
  if(enable_tree){
13718
13757
  const records = payload.data.rows;
13719
13758
  const treeRecords = [];
@@ -15583,7 +15622,7 @@ async function getFormBody(permissionFields, formFields, ctx){
15583
15622
  * @Author: 殷亮辉 yinlianghui@hotoa.com
15584
15623
  * @Date: 2023-11-15 09:50:22
15585
15624
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
15586
- * @LastEditTime: 2023-12-23 22:13:22
15625
+ * @LastEditTime: 2023-12-27 13:50:26
15587
15626
  */
15588
15627
 
15589
15628
  /**
@@ -15611,20 +15650,22 @@ function getInputTableCell(field, showAsInlineEditMode) {
15611
15650
  name: field.name,
15612
15651
  quickEdit: {
15613
15652
  "type": "steedos-field",
15614
- "config": field,
15615
- hideLabel: true
15653
+ "config": Object.assign({}, field, {
15654
+ label: false
15655
+ })
15616
15656
  }
15617
15657
  }
15618
15658
  }
15619
15659
  else {
15620
15660
  return {
15621
15661
  "type": "steedos-field",
15622
- "config": field,
15662
+ "config": Object.assign({}, field, {
15663
+ label: false
15664
+ }),
15623
15665
  "static": true,
15624
15666
  "readonly": true,
15625
15667
  label: field.label,
15626
- name: field.name,
15627
- hideLabel: true
15668
+ name: field.name
15628
15669
  }
15629
15670
  }
15630
15671
  }
@@ -15830,7 +15871,7 @@ function getFormPagination(props, mode) {
15830
15871
  * @returns 带翻页容器的wrapper
15831
15872
  */
15832
15873
  function getFormPaginationWrapper(props, form, mode) {
15833
- console.log("==getFormPaginationWrapper===", props, mode);
15874
+ // console.log("==getFormPaginationWrapper===", props, mode);
15834
15875
  let serviceId = getComponentId("form_pagination", props.id);
15835
15876
  let tableServiceId = getComponentId("table_service", props.id);
15836
15877
  let innerForm = Object.assign({}, form, {
@@ -15870,8 +15911,28 @@ function getFormPaginationWrapper(props, form, mode) {
15870
15911
  let __wrapperServiceId = "${tableServiceId}";
15871
15912
  let wrapperService = scope.getComponentById(__wrapperServiceId);
15872
15913
  let wrapperServiceData = wrapperService.getData();
15873
- let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
15914
+ // 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
15915
+ // 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
15916
+ let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
15874
15917
  //不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
15918
+ let mode = "${mode}";
15919
+ if(mode === "new"){
15920
+ // 点击子表组件底部新增按钮时新增一条空白行并自动翻页到新增行
15921
+ // 注意点击弹出的子表行详细表单中的新增按钮不会进此service init事件函数中
15922
+ let newItem = {};
15923
+ event.data.__tableItems.push(newItem);
15924
+ lastestFieldValue.push(newItem);
15925
+ event.data.index = lastestFieldValue.length - 1;
15926
+ event.data.__page = lastestFieldValue.length;
15927
+ // 这里新增空白行时要把值同步保存到子表组件中,如果不同步保存的话,用户点击弹出表单右上角的关闭窗口时不会自动删除这里自动增加的空白行,同步后可以让用户手动删除此行
15928
+ doAction({
15929
+ "componentId": "${props.id}",
15930
+ "actionType": "setValue",
15931
+ "args": {
15932
+ "value": lastestFieldValue
15933
+ }
15934
+ });
15935
+ }
15875
15936
  event.data.__tableItems.forEach(function(n,i){
15876
15937
  event.data.__tableItems[i] = lastestFieldValue[i];
15877
15938
  });
@@ -15935,7 +15996,8 @@ async function getForm(props, mode = "edit", formId) {
15935
15996
  "canAccessSuperData": false,
15936
15997
  "className": "steedos-object-form steedos-amis-form"
15937
15998
  };
15938
- if (mode === "edit") {
15999
+ if (mode === "edit" || mode === "new") {
16000
+ // 新增行弹出编辑行表单,在弹出之前已经不用先增加一行,因为在翻页service初始化的时候会判断mode为new时自动新增一行
15939
16001
  let onEditItemSubmitScript = `
15940
16002
  // let fieldValue = _.cloneDeep(event.data["${props.name}"]);
15941
16003
  let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
@@ -15974,66 +16036,66 @@ async function getForm(props, mode = "edit", formId) {
15974
16036
  }
15975
16037
  });
15976
16038
  }
15977
- else if (mode === "new") {
15978
- let onNewItemSubmitScript = `
15979
- let newItem = JSON.parse(JSON.stringify(event.data));
15980
- if(event.data["${props.name}"]){
15981
- // let fieldValue = event.data.__tableItems;
15982
- // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
15983
- let fieldValue = event.data["${props.name}"];
15984
- fieldValue.push(newItem);
15985
- doAction({
15986
- "componentId": "${props.id}",
15987
- "actionType": "setValue",
15988
- "args": {
15989
- "value": fieldValue
15990
- }
15991
- });
15992
- }
15993
- else{
15994
- // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
15995
- doAction({
15996
- "componentId": "${props.id}",
15997
- "actionType": "setValue",
15998
- "args": {
15999
- "value": [newItem]
16000
- }
16001
- });
16002
- }
16003
- `;
16004
- Object.assign(schema, {
16005
- "onEvent": {
16006
- "submit": {
16007
- "weight": 0,
16008
- "actions": [
16009
- {
16010
- "actionType": "custom",
16011
- "script": onNewItemSubmitScript
16012
- },
16013
- // {
16014
- // "componentId": props.id,
16015
- // "actionType": "addItem",//input-table组件的needConfirm属性为true时,addItem动作会把新加的行显示为编辑状态,所以只能使用上面的custom script来setValue实现添加行
16016
- // "args": {
16017
- // "index": `\${${props.name}.length || 9000}`,//这里加9000是因为字段如果没放在form组件内,props.name.length拿不到值
16018
- // "item": {
16019
- // "&": "$$"
16020
- // }
16021
- // }
16022
- // }
16023
- ]
16024
- }
16025
- }
16026
- });
16027
- }
16039
+ // else if (mode === "new") {
16040
+ // let onNewItemSubmitScript = `
16041
+ // let newItem = JSON.parse(JSON.stringify(event.data));
16042
+ // if(event.data["${props.name}"]){
16043
+ // // let fieldValue = event.data.__tableItems;
16044
+ // // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
16045
+ // let fieldValue = event.data["${props.name}"];
16046
+ // fieldValue.push(newItem);
16047
+ // doAction({
16048
+ // "componentId": "${props.id}",
16049
+ // "actionType": "setValue",
16050
+ // "args": {
16051
+ // "value": fieldValue
16052
+ // }
16053
+ // });
16054
+ // }
16055
+ // else{
16056
+ // // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
16057
+ // doAction({
16058
+ // "componentId": "${props.id}",
16059
+ // "actionType": "setValue",
16060
+ // "args": {
16061
+ // "value": [newItem]
16062
+ // }
16063
+ // });
16064
+ // }
16065
+ // `;
16066
+ // Object.assign(schema, {
16067
+ // "onEvent": {
16068
+ // "submit": {
16069
+ // "weight": 0,
16070
+ // "actions": [
16071
+ // {
16072
+ // "actionType": "custom",
16073
+ // "script": onNewItemSubmitScript
16074
+ // },
16075
+ // // {
16076
+ // // "componentId": props.id,
16077
+ // // "actionType": "addItem",//input-table组件的needConfirm属性为true时,addItem动作会把新加的行显示为编辑状态,所以只能使用上面的custom script来setValue实现添加行
16078
+ // // "args": {
16079
+ // // "index": `\${${props.name}.length || 9000}`,//这里加9000是因为字段如果没放在form组件内,props.name.length拿不到值
16080
+ // // "item": {
16081
+ // // "&": "$$"
16082
+ // // }
16083
+ // // }
16084
+ // // }
16085
+ // ]
16086
+ // }
16087
+ // }
16088
+ // });
16089
+ // }
16028
16090
  schema = getFormPaginationWrapper(props, schema, mode);
16029
16091
  return schema;
16030
16092
  }
16031
16093
 
16032
16094
 
16033
16095
  /**
16034
- * 编辑、新增和查看按钮actions
16096
+ * 编辑、新增、删除、查看按钮actions
16035
16097
  * @param {*} props
16036
- * @param {*} mode edit/new/readonly
16098
+ * @param {*} mode edit/new/readonly/delete
16037
16099
  */
16038
16100
  async function getButtonActions(props, mode) {
16039
16101
  let actions = [];
@@ -16124,6 +16186,7 @@ async function getButtonActions(props, mode) {
16124
16186
  }
16125
16187
  ];
16126
16188
  if(props.addable){
16189
+ // 有新增行权限时额外添加新增和复制按钮
16127
16190
  dialogButtons = [
16128
16191
  {
16129
16192
  "type": "button",
@@ -16188,7 +16251,8 @@ async function getButtonActions(props, mode) {
16188
16251
  // "__tableItems": `\${${props.name}}`
16189
16252
  // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
16190
16253
  // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
16191
- "__tableItems": `\${${props.name}|json|toJson}`
16254
+ // "__tableItems": `\${${props.name}|json|toJson}`
16255
+ "__tableItems": `\${(${props.name} || [])|json|toJson}`
16192
16256
  },
16193
16257
  "actions": dialogButtons,
16194
16258
  "onEvent": {
@@ -16211,11 +16275,12 @@ async function getButtonActions(props, mode) {
16211
16275
  Object.assign(actionShowEditDialog.dialog, props.dialog);
16212
16276
  }
16213
16277
  if (mode == "new") {
16214
- let onNewLineScript = `
16278
+ `
16215
16279
  let newItem = {};
16216
16280
  if(event.data["${props.name}"]){
16217
16281
  // let fieldValue = event.data.__tableItems;
16218
16282
  // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
16283
+ // let fieldValue = _.clone(event.data["${props.name}"]);
16219
16284
  let fieldValue = event.data["${props.name}"];
16220
16285
  fieldValue.push(newItem);
16221
16286
  doAction({
@@ -16239,11 +16304,9 @@ async function getButtonActions(props, mode) {
16239
16304
  event.data.index = 1;
16240
16305
  }
16241
16306
  `;
16242
- let actionNewLine = {
16243
- "actionType": "custom",
16244
- "script": onNewLineScript
16245
- };
16246
- actions = [actionNewLine, actionShowEditDialog];
16307
+ // 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
16308
+ // actions = [actionNewLine, actionShowEditDialog];
16309
+ actions = [actionShowEditDialog];
16247
16310
  }
16248
16311
  else if (mode == "edit") {
16249
16312
  actions = [actionShowEditDialog];
@@ -16281,12 +16344,47 @@ async function getButtonActions(props, mode) {
16281
16344
  // "__tableItems": `\${${props.name}}`
16282
16345
  // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
16283
16346
  // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
16284
- "__tableItems": `\${${props.name}|json|toJson}`
16285
- },
16347
+ // "__tableItems": `\${${props.name}|json|toJson}`
16348
+ "__tableItems": `\${(${props.name} || [])|json|toJson}`
16349
+ },
16286
16350
  }
16287
16351
  }
16288
16352
  ];
16289
16353
  }
16354
+ else if (mode == "delete") {
16355
+ let tableServiceId = getComponentId("table_service", props.id);
16356
+ let onDeleteItemScript = `
16357
+ // let fieldValue = event.data["${props.name}"];
16358
+ let scope = event.context.scoped;
16359
+ let __wrapperServiceId = "${tableServiceId}";
16360
+ let wrapperService = scope.getComponentById(__wrapperServiceId);
16361
+ let wrapperServiceData = wrapperService.getData();
16362
+ // 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16363
+ // 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
16364
+ let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
16365
+ lastestFieldValue.splice(event.data.index, 1);
16366
+ doAction({
16367
+ "componentId": "${props.id}",
16368
+ "actionType": "setValue",
16369
+ "args": {
16370
+ "value": lastestFieldValue
16371
+ }
16372
+ });
16373
+ `;
16374
+ actions = [
16375
+ // {
16376
+ // "actionType": "deleteItem",
16377
+ // "args": {
16378
+ // "index": "${index+','}" //这里不加逗号后续会报错,语法是逗号分隔可以删除多行
16379
+ // },
16380
+ // "componentId": props.id
16381
+ // },
16382
+ {
16383
+ "actionType": "custom",
16384
+ "script": onDeleteItemScript
16385
+ }
16386
+ ];
16387
+ }
16290
16388
  return actions;
16291
16389
  }
16292
16390
 
@@ -16332,24 +16430,7 @@ async function getButtonView(props) {
16332
16430
  };
16333
16431
  }
16334
16432
 
16335
- function getButtonDelete(props) {
16336
- let tableServiceId = getComponentId("table_service", props.id);
16337
- let onDeleteItemScript = `
16338
- // let fieldValue = event.data["${props.name}"];
16339
- let scope = event.context.scoped;
16340
- let __wrapperServiceId = "${tableServiceId}";
16341
- let wrapperService = scope.getComponentById(__wrapperServiceId);
16342
- let wrapperServiceData = wrapperService.getData();
16343
- let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16344
- lastestFieldValue.splice(event.data.index, 1);
16345
- doAction({
16346
- "componentId": "${props.id}",
16347
- "actionType": "setValue",
16348
- "args": {
16349
- "value": lastestFieldValue
16350
- }
16351
- });
16352
- `;
16433
+ async function getButtonDelete(props) {
16353
16434
  return {
16354
16435
  "type": "button",
16355
16436
  "label": "",
@@ -16357,19 +16438,7 @@ function getButtonDelete(props) {
16357
16438
  "level": "link",
16358
16439
  "onEvent": {
16359
16440
  "click": {
16360
- "actions": [
16361
- // {
16362
- // "actionType": "deleteItem",
16363
- // "args": {
16364
- // "index": "${index+','}" //这里不加逗号后续会报错,语法是逗号分隔可以删除多行
16365
- // },
16366
- // "componentId": props.id
16367
- // },
16368
- {
16369
- "actionType": "custom",
16370
- "script": onDeleteItemScript
16371
- }
16372
- ]
16441
+ "actions": await getButtonActions(props, "delete")
16373
16442
  }
16374
16443
  }
16375
16444
  };
@@ -16409,7 +16478,7 @@ const getAmisInputTableSchema = async (props) => {
16409
16478
  buttonsForColumnOperations.push(buttonViewSchema);
16410
16479
  }
16411
16480
  if (props.removable) {
16412
- let buttonDeleteSchema = getButtonDelete(props);
16481
+ let buttonDeleteSchema = await getButtonDelete(props);
16413
16482
  buttonsForColumnOperations.push(buttonDeleteSchema);
16414
16483
  }
16415
16484
  let inputTableSchema = {
@@ -16436,7 +16505,7 @@ const getAmisInputTableSchema = async (props) => {
16436
16505
  "name": "__op__",
16437
16506
  "type": "operation",
16438
16507
  "buttons": buttonsForColumnOperations,
16439
- "width": buttonsForColumnOperations.length > 1 ? "46px" : "20px"
16508
+ "width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
16440
16509
  });
16441
16510
  }
16442
16511
  if (showAsInlineEditMode) {
@@ -19855,6 +19924,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
19855
19924
  },
19856
19925
  {
19857
19926
  "actionType": "reload",
19927
+ "componentId": "listview_" + objectApiName,
19858
19928
  "expression": "${(event.data.recordId || event.data.__deletedRecord === true || event.data.displayAs === 'split') && event.data._isRelated != true}" //不是新建, 或分栏模式下新建主对象记录, 则刷新列表
19859
19929
  }
19860
19930
  ]
@@ -20752,7 +20822,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
20752
20822
  schemaApi: {
20753
20823
  "method": "get",
20754
20824
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
20755
- "adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n //\u5DE6\u5C42\u663E\u793A\u65F6\u5BA1\u6279\u5355\u663E\u793Abadge\u6570\u91CF\n \"itemBadge\": {\n \"mode\": \"text\",\n \"text\": \"").concat(badgeText, "\",\n \"visibleOn\": \"${id == 'instances'}\",\n \"overflowCount\": 99,\n \"style\": stacked?{\n \"right\": \"20%\",\n \"margin-right\": \"-23px\",\n \"height\": \"20px\",\n \"border-radius\": \"10px\",\n \"font-size\": \"16px\",\n \"line-height\": \"18px\",\n \"top\": \"50%\"\n }:{\n \"transform\": \"translate(calc(50% - 17px), calc(-50% + 10px))\",\n \"border-radius\": \"6.5px\",\n \"height\": \"15px\",\n \"line-height\": \"13px\",\n \"padding\": \"0px 4px\",\n \"font-size\": \"12px\"\n }\n },\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
20825
+ "adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n //\u5DE6\u5C42\u663E\u793A\u65F6\u5BA1\u6279\u5355\u663E\u793Abadge\u6570\u91CF\n \"itemBadge\": {\n \"mode\": \"text\",\n \"text\": \"").concat(badgeText, "\",\n \"visibleOn\": \"${id == 'instance_tasks'}\",\n \"overflowCount\": 99,\n \"style\": stacked?{\n \"right\": \"20%\",\n \"margin-right\": \"-23px\",\n \"height\": \"20px\",\n \"border-radius\": \"10px\",\n \"font-size\": \"16px\",\n \"line-height\": \"18px\",\n \"top\": \"50%\"\n }:{\n \"transform\": \"translate(calc(50% - 17px), calc(-50% + 10px))\",\n \"border-radius\": \"6.5px\",\n \"height\": \"15px\",\n \"line-height\": \"13px\",\n \"padding\": \"0px 4px\",\n \"font-size\": \"12px\"\n }\n },\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
20756
20826
  "headers": {
20757
20827
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
20758
20828
  }
@@ -21451,7 +21521,7 @@ function getAmisStaticFieldType(type, data_type, options) {
21451
21521
  return "number";
21452
21522
  }
21453
21523
  else if (type === 'autonumber') {
21454
- return "text";
21524
+ return "input-text"; //不可以用text,因为会出现字段label显示不出来的问题
21455
21525
  }
21456
21526
  else if (type === 'percent') {
21457
21527
  return "number";
@@ -21471,13 +21541,14 @@ function getAmisStaticFieldType(type, data_type, options) {
21471
21541
  return type;
21472
21542
  }
21473
21543
  var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
21474
- var steedosField, field, _a, readonly, _b, ctx, config, fStatic, hideLabel, defaultSource, source, schema, schema, fieldAmis, schema, error_1;
21475
- var _c, _d, _e;
21476
- return __generator(this, function (_f) {
21477
- switch (_f.label) {
21544
+ var steedosField, field, _a, readonly, _b, ctx, config, fStatic, defaultSource, source, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, tableFields, _c, _d, subField, subFieldName, fieldAmis, schema, error_1;
21545
+ var e_1, _e;
21546
+ var _f, _g, _h;
21547
+ return __generator(this, function (_j) {
21548
+ switch (_j.label) {
21478
21549
  case 0:
21479
21550
  steedosField = null;
21480
- field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, props.$schema, fStatic = props.static, hideLabel = props.hideLabel;
21551
+ field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, props.$schema, fStatic = props.static;
21481
21552
  // console.log(`AmisSteedosField`, props)
21482
21553
  // if($schema.config && isString($schema.config)){
21483
21554
  // $schema.config = JSON.parse($schema.config)
@@ -21494,18 +21565,25 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21494
21565
  // 这里要clone是因为后面图片字段类型执行steedosField.amis = ...的时候会造成input-table中的图片字段在弹出编辑表单点击确认后整个input-table组件重新渲染了,从而导致其翻页功能异常
21495
21566
  steedosField = _$1.clone(steedosField);
21496
21567
  }
21568
+ // if (props.label && !steedosField.label) {
21569
+ // steedosField.label = props.label;
21570
+ // }
21571
+ if (typeof props.label === "string" || props.label === false) {
21572
+ // 始终优先取组件上配置的label,且可以通过配置组件的label属性值为false来隐藏字段label
21573
+ steedosField.label = props.label;
21574
+ }
21497
21575
  if (!fStatic && steedosField.readonly && !props.data.hasOwnProperty("_display")) {
21498
21576
  // 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
21499
21577
  fStatic = true;
21500
21578
  }
21501
- _f.label = 1;
21579
+ _j.label = 1;
21502
21580
  case 1:
21503
- _f.trys.push([1, 16, , 17]);
21581
+ _j.trys.push([1, 18, , 19]);
21504
21582
  if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 2];
21505
21583
  defaultSource = {
21506
21584
  "method": "post",
21507
21585
  "url": "${context.rootUrl}/graphql",
21508
- "requestAdaptor": "\n var steedosField = ".concat(JSON.stringify(steedosField), ";\n var objectName, filters, valueFieldKey, labelFieldKey;\n if(_.isString(steedosField.reference_to)){\n // reference_to\u4E3A\u5355\u9009\n const referenceTo = getReferenceToSync(steedosField);\n const referenceToField = steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = _.get(api.data, steedosField.name);\n if(_.isString(value)){\n value = [value]\n }\n filters = [referenceToField, \"in\", value || []];\n if(objectName == \"object_fields\"){\n //\u5BF9\u8C61\u4E3Aobject_fields\u65F6\uFF0C\u5FC5\u987B\u52A0\u4E0Aobject\u7684\u8FC7\u6EE4\u6761\u4EF6\n const filtersFunction = ").concat(steedosField.filtersFunction || steedosField._filtersFunction, ";\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data);\n if(_filters && _filters.length > 0){\n filters = [filters,_filters]\n }\n }\n }\n }else{\n // reference_to\u4E3A\u591A\u9009\n const _steedosField = {\n ...steedosField,\n reference_to: api.data[steedosField.name].o\n }\n const referenceTo = getReferenceToSync(_steedosField);\n const referenceToField = _steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = api.data[_steedosField.name] && api.data[_steedosField.name].ids;\n filters = [referenceToField, \"in\", value || []];\n }\n api.data = {\n query: '{options:' + objectName + '(filters: ' + JSON.stringify(filters) + '){label: ' + labelFieldKey + ',value: ' + valueFieldKey + '}}'\n }\n return api;\n "),
21586
+ "requestAdaptor": "\n var steedosField = ".concat(JSON.stringify(steedosField), ";\n var objectName, filters, valueFieldKey, labelFieldKey;\n if(_.isString(steedosField.reference_to)){\n // reference_to\u4E3A\u5355\u9009\n const referenceTo = getReferenceToSync(steedosField);\n const referenceToField = steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = _.get(api.data, steedosField.name);\n if(_.isString(value)){\n value = [value]\n }\n filters = [referenceToField, \"in\", value || []];\n if(objectName == \"object_fields\" || objectName == \"object_actions\"){\n //\u5BF9\u8C61\u4E3Aobject_fields\u65F6\uFF0C\u5FC5\u987B\u52A0\u4E0Aobject\u7684\u8FC7\u6EE4\u6761\u4EF6\n const filtersFunction = ").concat(steedosField.filtersFunction || steedosField._filtersFunction, ";\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data);\n if(_filters && _filters.length > 0){\n filters = [filters,_filters]\n }\n }\n }\n }else{\n // reference_to\u4E3A\u591A\u9009\n const _steedosField = {\n ...steedosField,\n reference_to: api.data[steedosField.name].o\n }\n const referenceTo = getReferenceToSync(_steedosField);\n const referenceToField = _steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = api.data[_steedosField.name] && api.data[_steedosField.name].ids;\n filters = [referenceToField, \"in\", value || []];\n }\n api.data = {\n query: '{options:' + objectName + '(filters: ' + JSON.stringify(filters) + '){label: ' + labelFieldKey + ',value: ' + valueFieldKey + '}}'\n }\n return api;\n "),
21509
21587
  "trackExpression": "${" + steedosField.name + "}",
21510
21588
  "cache": 3000
21511
21589
  };
@@ -21522,28 +21600,59 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21522
21600
  defaultSource.adaptor = "\n var options = ".concat(JSON.stringify(steedosField.options), "\n if(api.body.$term){\n options = _.filter(options, function(o) {\n var label = o.label;\n return label.toLowerCase().indexOf(api.body.$term.toLowerCase()) > -1;\n });\n }\n if(!payload.data){\n payload.data = {};\n }\n payload.data.options = options;\n return payload;\n ");
21523
21601
  }
21524
21602
  }
21525
- source = ((_c = steedosField.amis) === null || _c === void 0 ? void 0 : _c.source) || ((_d = steedosField.amis) === null || _d === void 0 ? void 0 : _d.autoComplete) || defaultSource;
21603
+ source = ((_f = steedosField.amis) === null || _f === void 0 ? void 0 : _f.source) || ((_g = steedosField.amis) === null || _g === void 0 ? void 0 : _g.autoComplete) || defaultSource;
21526
21604
  schema = Object.assign({}, {
21527
21605
  type: 'select',
21528
21606
  multiple: steedosField.multiple,
21529
21607
  name: steedosField.name,
21530
21608
  label: steedosField.label,
21531
21609
  static: true,
21532
- className: (_e = steedosField.amis) === null || _e === void 0 ? void 0 : _e.className,
21610
+ className: (_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.className,
21533
21611
  source: source,
21534
21612
  }, _$1.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
21535
21613
  schema.placeholder = "";
21536
- if (hideLabel) {
21537
- delete schema.label;
21538
- }
21539
21614
  return [2 /*return*/, schema];
21540
21615
  case 2:
21541
- if (!fStatic) return [3 /*break*/, 13];
21616
+ if (!fStatic) return [3 /*break*/, 15];
21542
21617
  if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 4];
21543
21618
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
21544
- case 3:
21545
- // 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
21546
- return [2 /*return*/, _f.sent()];
21619
+ case 3:
21620
+ fieldSchema = _j.sent();
21621
+ if (steedosField.type === 'file' && fieldSchema.disabled) {
21622
+ fieldValue = fieldSchema.value;
21623
+ if (fieldValue && fieldValue.length) {
21624
+ hasImageOrFile_1 = false;
21625
+ _$1.forEach(fieldValue, function (item) {
21626
+ var fileName = item.name;
21627
+ if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.slice(-4)) > -1) {
21628
+ hasImageOrFile_1 = true;
21629
+ }
21630
+ });
21631
+ if (!hasImageOrFile_1) {
21632
+ return [2 /*return*/, fieldSchema];
21633
+ }
21634
+ fieldHtml_1 = "";
21635
+ _$1.forEach(fieldValue, function (item) {
21636
+ var fileName = item.name;
21637
+ var fileUrl = item.url;
21638
+ var filePreviewHtml = '';
21639
+ if ([".pdf", ".jpg", ".jpeg", ".png", ".gif"].indexOf(fileName.slice(-4)) > -1) {
21640
+ var indexOfQuestionMark = fileUrl.indexOf('?');
21641
+ if (indexOfQuestionMark > -1) {
21642
+ var filePreviewUrl = fileUrl.substring(0, indexOfQuestionMark);
21643
+ filePreviewHtml = "&ensp;<a href=\"".concat(filePreviewUrl, "\" target=\"_blank\" class=\"antd-Link\"><span class=\"antd-TplField\"><span>\u9884\u89C8</span></span></a>");
21644
+ }
21645
+ }
21646
+ var tpl = "\n <div class=\"antd-FileControl-itemInfo flex-wrap\">\n <span class=\"antd-FileControl-itemInfoIcon flex justify-center items-center\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 14 16\" class=\"icon icon-file\"><path d=\"M0 0v16h14V4.001L9.939 0H0Zm1 1h8v4h4v10H1V1Zm9 .464 2.575 2.537H10V1.464Z\"></path><path d=\"M4 12h6v-1H4zM4 9h6V8H4z\"></path></svg></span>\n <a class=\"antd-FileControl-itemInfoText\" target=\"_blank\" rel=\"noopener\" href=\"".concat(fileUrl, "\">").concat(fileName, "</a>\n ").concat(filePreviewHtml ? filePreviewHtml : '', "\n </div>\n ");
21647
+ fieldHtml_1 += tpl;
21648
+ });
21649
+ return [2 /*return*/, {
21650
+ "type": "tpl",
21651
+ "tpl": fieldHtml_1
21652
+ }];
21653
+ }
21654
+ }
21655
+ return [2 /*return*/, fieldSchema];
21547
21656
  case 4:
21548
21657
  schema = Object.assign({}, steedosField, {
21549
21658
  type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
@@ -21556,33 +21665,75 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21556
21665
  timeFormat: 'HH:mm',
21557
21666
  format: '1970-01-01THH:mm:00.000[Z]',
21558
21667
  });
21559
- return [3 /*break*/, 12];
21668
+ return [3 /*break*/, 14];
21560
21669
  case 5:
21561
21670
  if (!(steedosField.type === "percent")) return [3 /*break*/, 6];
21562
21671
  Object.assign(schema, {
21563
21672
  "percent": steedosField.scale ? steedosField.scale : true
21564
21673
  });
21565
- return [3 /*break*/, 12];
21674
+ return [3 /*break*/, 14];
21566
21675
  case 6:
21567
21676
  if (!(steedosField.type === "password")) return [3 /*break*/, 7];
21568
21677
  Object.assign(schema, {
21569
21678
  "revealPassword": false //没生效,需要用样式隐藏
21570
21679
  });
21571
- return [3 /*break*/, 12];
21680
+ return [3 /*break*/, 14];
21572
21681
  case 7:
21573
21682
  if (!(steedosField.type === "select")) return [3 /*break*/, 8];
21574
21683
  Object.assign(schema, {
21575
21684
  "placeholder": ""
21576
21685
  });
21577
- return [3 /*break*/, 12];
21686
+ return [3 /*break*/, 14];
21578
21687
  case 8:
21579
21688
  if (!(steedosField.type === "color")) return [3 /*break*/, 9];
21580
21689
  Object.assign(schema, {
21581
21690
  "defaultColor": null
21582
21691
  });
21583
- return [3 /*break*/, 12];
21692
+ return [3 /*break*/, 14];
21584
21693
  case 9:
21585
- if (!(steedosField.type === "image")) return [3 /*break*/, 10];
21694
+ if (!(steedosField.type === "number")) return [3 /*break*/, 10];
21695
+ // amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
21696
+ Object.assign(schema, {
21697
+ "precision": steedosField.scale || 0
21698
+ });
21699
+ return [3 /*break*/, 14];
21700
+ case 10:
21701
+ if (!(steedosField.type === "table")) return [3 /*break*/, 11];
21702
+ if (steedosField.subFields) {
21703
+ tableFields = [];
21704
+ try {
21705
+ for (_c = __values(field.subFields), _d = _c.next(); !_d.done; _d = _c.next()) {
21706
+ subField = _d.value;
21707
+ if (!subField.name.endsWith(".$")) {
21708
+ subFieldName = subField.name.replace("".concat(field._prefix || '').concat(field.name, ".$."), '').replace("".concat(field.name, "."), '');
21709
+ // const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
21710
+ tableFields.push(Object.assign({}, subField, { name: subFieldName }));
21711
+ }
21712
+ }
21713
+ }
21714
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
21715
+ finally {
21716
+ try {
21717
+ if (_d && !_d.done && (_e = _c.return)) _e.call(_c);
21718
+ }
21719
+ finally { if (e_1) throw e_1.error; }
21720
+ }
21721
+ Object.assign(schema, {
21722
+ type: 'steedos-input-table',
21723
+ showIndex: true,
21724
+ editable: false,
21725
+ addable: false,
21726
+ removable: false,
21727
+ draggable: false,
21728
+ fields: tableFields,
21729
+ amis: {
21730
+ columnsTogglable: false
21731
+ }
21732
+ });
21733
+ }
21734
+ return [3 /*break*/, 14];
21735
+ case 11:
21736
+ if (!(steedosField.type === "image")) return [3 /*break*/, 12];
21586
21737
  Object.assign(schema, {
21587
21738
  enlargeAble: true,
21588
21739
  showToolbar: true,
@@ -21613,21 +21764,18 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21613
21764
  return value;
21614
21765
  }
21615
21766
  });
21616
- return [3 /*break*/, 12];
21617
- case 10:
21618
- if (!(steedosField.type === "file")) return [3 /*break*/, 12];
21767
+ return [3 /*break*/, 14];
21768
+ case 12:
21769
+ if (!(steedosField.type === "file")) return [3 /*break*/, 14];
21619
21770
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
21620
- case 11:
21771
+ case 13:
21621
21772
  // 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
21622
21773
  // convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
21623
- return [2 /*return*/, _f.sent()];
21624
- case 12:
21774
+ return [2 /*return*/, _j.sent()];
21775
+ case 14:
21625
21776
  Object.assign(schema, steedosField.amis || {});
21626
- if (hideLabel) {
21627
- delete schema.label;
21628
- }
21629
21777
  return [2 /*return*/, schema];
21630
- case 13:
21778
+ case 15:
21631
21779
  fieldAmis = steedosField.amis || {};
21632
21780
  if (!props.data.hasOwnProperty("_display")) {
21633
21781
  // 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
@@ -21685,19 +21833,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21685
21833
  }
21686
21834
  }
21687
21835
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
21688
- case 14:
21689
- schema = _f.sent();
21690
- if (hideLabel) {
21691
- delete schema.label;
21692
- }
21836
+ case 16:
21837
+ schema = _j.sent();
21693
21838
  // console.log(`AmisSteedosField return schema`, schema)
21694
21839
  return [2 /*return*/, schema];
21695
- case 15: return [3 /*break*/, 17];
21696
- case 16:
21697
- error_1 = _f.sent();
21840
+ case 17: return [3 /*break*/, 19];
21841
+ case 18:
21842
+ error_1 = _j.sent();
21698
21843
  console.log("error", error_1);
21699
- return [3 /*break*/, 17];
21700
- case 17: return [2 /*return*/, null];
21844
+ return [3 /*break*/, 19];
21845
+ case 19: return [2 /*return*/, null];
21701
21846
  }
21702
21847
  });
21703
21848
  }); };