@steedos-widgets/amis-lib 3.6.2-beta.12 → 3.6.2-beta.14

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
@@ -389,8 +389,8 @@ const Router = {
389
389
  /*
390
390
  * @Author: baozhoutao@steedos.com
391
391
  * @Date: 2022-07-20 16:29:22
392
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
393
- * @LastEditTime: 2023-12-28 14:59:08
392
+ * @LastEditors: liaodaxue
393
+ * @LastEditTime: 2024-01-25 14:44:17
394
394
  * @Description:
395
395
  */
396
396
 
@@ -462,6 +462,25 @@ function getComparableAmisVersion() {
462
462
  }
463
463
  }
464
464
 
465
+ /**
466
+ * 判断浏览器类型
467
+ * @returns 按需返回浏览器类型;
468
+ */
469
+ function getBowserType() {
470
+ const userAgent = navigator.userAgent;
471
+ if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
472
+ return "Chrome";
473
+ } else if (userAgent.indexOf("Firefox") !== -1) {
474
+ return "Firefox";
475
+ } else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
476
+ return "Safari";
477
+ } else if (userAgent.indexOf("Edg") !== -1) {
478
+ return "Edge";
479
+ } else {
480
+ return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
481
+ }
482
+ }
483
+
465
484
  /*
466
485
  * @Author: baozhoutao@steedos.com
467
486
  * @Date: 2022-05-23 09:53:08
@@ -1865,7 +1884,8 @@ async function getQuickEditSchema(field, options){
1865
1884
  "failed": "失败了呢。。"
1866
1885
  }
1867
1886
  }
1868
- }
1887
+ },
1888
+ "expression": "${!recordPermissions.modifyAllRecords}"
1869
1889
  },
1870
1890
  {
1871
1891
  "actionType": "setValue",
@@ -1881,7 +1901,7 @@ async function getQuickEditSchema(field, options){
1881
1901
  "componentId": quickEditId,
1882
1902
  "args": {
1883
1903
  "value":{
1884
- "quickedit_record_permissions": "${event.data}"
1904
+ "quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
1885
1905
  }
1886
1906
  }
1887
1907
  }
@@ -1945,7 +1965,7 @@ async function getQuickEditSchema(field, options){
1945
1965
  `
1946
1966
  }
1947
1967
  },
1948
- "expression":"${event.data.value}"
1968
+ "expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
1949
1969
  },
1950
1970
  {
1951
1971
  "actionType": "setValue",
@@ -1976,10 +1996,20 @@ async function getQuickEditSchema(field, options){
1976
1996
  "script": `
1977
1997
  const noPermission = event.data.noPermission;
1978
1998
  const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
1979
- const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
1999
+ let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
1980
2000
  noPermission.forEach(function (item) {
1981
2001
  crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
2002
+ _.remove(selectedItems, (selected) => selected._id === item);
1982
2003
  })
2004
+ doAction({
2005
+ "componentId": "${quickEditId}",
2006
+ "actionType": "setValue",
2007
+ "args": {
2008
+ "value": {
2009
+ selectedItems
2010
+ }
2011
+ }
2012
+ });
1983
2013
  `
1984
2014
  },
1985
2015
  {
@@ -2070,7 +2100,8 @@ async function getTableColumns(fields, options){
2070
2100
  //增加quickEdit属性,实现快速编辑
2071
2101
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
2072
2102
  let className = "";
2073
- if(/Safari/.test(navigator.userAgent)){
2103
+ const bowserType = getBowserType();
2104
+ if(bowserType === "Safari"){
2074
2105
  className += " whitespace-nowrap ";
2075
2106
  }else {
2076
2107
  if(field.wrap != true){
@@ -2079,6 +2110,18 @@ async function getTableColumns(fields, options){
2079
2110
  className += " break-words ";
2080
2111
  }
2081
2112
  }
2113
+
2114
+ if (typeof field.amis?.className == "object") {
2115
+ className = {
2116
+ [className]: "true",
2117
+ ...field.amis.className
2118
+ };
2119
+ } else if (typeof field.amis?.className == "string") {
2120
+ className = `${className} ${field.amis.className} `;
2121
+ }
2122
+ let fieldAmis = _$1.clone(field.amis);
2123
+ delete fieldAmis?.className;
2124
+
2082
2125
  let columnItem;
2083
2126
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
2084
2127
  const previewFileScript = `
@@ -2129,7 +2172,7 @@ async function getTableColumns(fields, options){
2129
2172
  toggled: field.toggled,
2130
2173
  static: true,
2131
2174
  className,
2132
- }, field.amis, {name: field.name});
2175
+ }, fieldAmis, {name: field.name});
2133
2176
  }else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
2134
2177
  columnItem = Object.assign({}, {
2135
2178
  type: "switch",
@@ -2140,7 +2183,7 @@ async function getTableColumns(fields, options){
2140
2183
  static: true,
2141
2184
  className,
2142
2185
  ...getAmisFileReadonlySchema(field)
2143
- }, field.amis, {name: field.name});
2186
+ }, fieldAmis, {name: field.name});
2144
2187
  }
2145
2188
  else if(field.type === 'select'){
2146
2189
  const map = getSelectMap(field.options);
@@ -2155,7 +2198,7 @@ async function getTableColumns(fields, options){
2155
2198
  className,
2156
2199
  inputClassName: "inline",
2157
2200
  static: true,
2158
- }, field.amis, {name: field.name});
2201
+ }, fieldAmis, {name: field.name});
2159
2202
  }
2160
2203
  else {
2161
2204
  const tpl = await getFieldTpl(field, options);
@@ -2182,15 +2225,6 @@ async function getTableColumns(fields, options){
2182
2225
  // }
2183
2226
 
2184
2227
  //field上的amis属性里的clssname需要单独判断类型合并
2185
- if (typeof field.amis?.className == "object") {
2186
- className = {
2187
- [className]: "true",
2188
- ...field.amis.className
2189
- };
2190
- } else if (typeof field.amis?.className == "string") {
2191
- className = `${className} ${field.amis.className} `;
2192
- }
2193
- delete field.amis?.className;
2194
2228
 
2195
2229
  if(!field.hidden && !field.extra){
2196
2230
  columnItem = Object.assign({}, {
@@ -2207,7 +2241,7 @@ async function getTableColumns(fields, options){
2207
2241
  static: true,
2208
2242
  options: field.type === 'html' ? {html: true} : null
2209
2243
  // toggled: true
2210
- }, field.amis, {name: field.name});
2244
+ }, fieldAmis, {name: field.name});
2211
2245
 
2212
2246
  if(field.type === 'color'){
2213
2247
  columnItem.type = 'color';
@@ -2972,15 +3006,8 @@ async function getTableApi(mainObject, fields, options){
2972
3006
  }
2973
3007
  });
2974
3008
  };
2975
- let isTreeOptionsComputed = false;
2976
- if(records.length === 1 && records[0].children){
2977
- isTreeOptionsComputed = true;
2978
- }
2979
- if(!isTreeOptionsComputed){
2980
- // 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
2981
- payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
2982
- assignIndexToTreeRecords(payload.data.rows, '');
2983
- }
3009
+ payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
3010
+ assignIndexToTreeRecords(payload.data.rows, '');
2984
3011
  }
2985
3012
 
2986
3013
 
@@ -4876,9 +4903,16 @@ const getSchema$2 = (uiSchema) => {
4876
4903
  "form": {
4877
4904
  debug: false,
4878
4905
  resetAfterSubmit: false,
4906
+ data: {
4907
+ editFormInited: true,
4908
+ },
4879
4909
  initApi: {
4910
+ method: 'GET',
4880
4911
  url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
4881
4912
  sendOn: 'this.recordId',
4913
+ data: null,
4914
+ requestAdaptor: "return api;",
4915
+ adaptor: "return payload;",
4882
4916
  responseData: {
4883
4917
  importState: "${state}"
4884
4918
  }
@@ -8611,14 +8645,7 @@ async function getObjectCRUD(objectSchema, fields, options){
8611
8645
  headers: {
8612
8646
  Authorization: "Bearer ${context.tenantId},${context.authToken}",
8613
8647
  },
8614
- requestAdaptor: quickSaveApiRequestAdaptor,
8615
- adaptor: `
8616
- if(payload.errors){
8617
- payload.status = 2;
8618
- payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
8619
- }
8620
- return payload;
8621
- `
8648
+ requestAdaptor: quickSaveApiRequestAdaptor
8622
8649
  },
8623
8650
  // 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
8624
8651
  // 使用表达式给tr添加初始选中状态
@@ -8635,6 +8662,21 @@ async function getObjectCRUD(objectSchema, fields, options){
8635
8662
  crudModeClassName = `steedos-crud-mode-${body.mode}`;
8636
8663
  }
8637
8664
 
8665
+ body.quickSaveApi.adaptor = `
8666
+ if(payload.errors){
8667
+ payload.status = 2;
8668
+ payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
8669
+ }
8670
+ debugger;
8671
+ var scope = SteedosUI.getRef(context.scopeId);
8672
+ var scopeParent = scope && scope.parent;
8673
+ var crudScoped = scopeParent.getComponentById('${body.id}');
8674
+ setTimeout(()=>{
8675
+ crudScoped && crudScoped.control.updateAutoFillHeight();
8676
+ }, 500);
8677
+ return payload;
8678
+ `;
8679
+
8638
8680
  if(body.columns && options.formFactor != 'SMALL'){
8639
8681
  //将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
8640
8682
  body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
@@ -9000,7 +9042,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
9000
9042
  * @Author: baozhoutao@steedos.com
9001
9043
  * @Date: 2022-07-05 15:55:39
9002
9044
  * @LastEditors: baozhoutao@steedos.com
9003
- * @LastEditTime: 2024-01-15 10:34:46
9045
+ * @LastEditTime: 2024-01-24 10:18:17
9004
9046
  * @Description:
9005
9047
  */
9006
9048
 
@@ -9099,7 +9141,9 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
9099
9141
  const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
9100
9142
  mainRelated[arr[0]] = foreign_key_value;
9101
9143
  }
9102
- }else {
9144
+ }
9145
+ // 防止related_lists中没有相关子表,但是details中有相关子表的情况
9146
+ if(!mainRelated[relatedObjectName]){
9103
9147
  const details = union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
9104
9148
  for (const detail of details) {
9105
9149
  const arr = detail.split(".");
@@ -10726,6 +10770,7 @@ function getLookupSapceUserTreeSchema(isMobile){
10726
10770
  }
10727
10771
  },
10728
10772
  "label": "",
10773
+ "mode": "normal",
10729
10774
  "name": "organizations",
10730
10775
  "multiple": false,
10731
10776
  "joinValues": false,
@@ -12953,10 +12998,10 @@ function uuidv4() {
12953
12998
  * @Author: 殷亮辉 yinlianghui@hotoa.com
12954
12999
  * @Date: 2023-11-15 09:50:22
12955
13000
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12956
- * @LastEditTime: 2024-01-22 15:59:32
13001
+ * @LastEditTime: 2024-01-25 14:11:50
12957
13002
  */
12958
13003
 
12959
- function getTablePrimaryKey(props){
13004
+ function getTablePrimaryKey(props) {
12960
13005
  return props.primaryKey || "_id";
12961
13006
  }
12962
13007
 
@@ -12966,22 +13011,22 @@ function getTablePrimaryKey(props){
12966
13011
  * @param {*} primaryKey 主键字段名,一般为_id
12967
13012
  * @returns 转换后的子表组件字段值
12968
13013
  */
12969
- function getTableValueWithPrimaryKeyValue(value, primaryKey){
12970
- if(!primaryKey){
13014
+ function getTableValueWithPrimaryKeyValue(value, primaryKey) {
13015
+ if (!primaryKey) {
12971
13016
  return value;
12972
13017
  }
12973
- return (value || []).map((itemValue)=>{
13018
+ return (value || []).map((itemValue) => {
12974
13019
  //这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里把primaryKey字段值保存了
12975
13020
  const newItemValue = clone(itemValue);
12976
- if(newItemValue[primaryKey]){
12977
- if(newItemValue.children){
13021
+ if (newItemValue[primaryKey]) {
13022
+ if (newItemValue.children) {
12978
13023
  newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
12979
13024
  }
12980
13025
  return newItemValue;
12981
13026
  }
12982
13027
  else {
12983
13028
  newItemValue[primaryKey] = uuidv4();
12984
- if(newItemValue.children){
13029
+ if (newItemValue.children) {
12985
13030
  newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
12986
13031
  }
12987
13032
  return newItemValue;
@@ -12995,14 +13040,14 @@ function getTableValueWithPrimaryKeyValue(value, primaryKey){
12995
13040
  * @param {*} primaryKey 主键字段名,一般为_id
12996
13041
  * @returns 转换后的子表组件字段值
12997
13042
  */
12998
- function getTableValueWithoutPrimaryKeyValue(value, primaryKey){
12999
- if(!primaryKey){
13043
+ function getTableValueWithoutPrimaryKeyValue(value, primaryKey) {
13044
+ if (!primaryKey) {
13000
13045
  return value;
13001
13046
  }
13002
- return (value || []).map((itemValue)=>{
13047
+ return (value || []).map((itemValue) => {
13003
13048
  //这里clone只是为了保险,不是必须的,每次修改子表数据是否都会生成新的primaryKey字段值是由pipeOut中识别autoGeneratePrimaryKeyValue决定的,跟这里没关系
13004
13049
  const newItemValue = clone(itemValue);
13005
- if(newItemValue.children){
13050
+ if (newItemValue.children) {
13006
13051
  newItemValue.children = getTableValueWithoutPrimaryKeyValue(newItemValue.children, primaryKey);
13007
13052
  }
13008
13053
  delete newItemValue[primaryKey];
@@ -13016,12 +13061,12 @@ function getTableValueWithoutPrimaryKeyValue(value, primaryKey){
13016
13061
  * @param {*} fieldPrefix 字段前缀
13017
13062
  * @returns 转换后的子表组件字段值
13018
13063
  */
13019
- function getTableValueWithoutFieldPrefix(value, fieldPrefix){
13064
+ function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
13020
13065
  let convertedValue = [];
13021
- (value || []).forEach((itemValue)=>{
13066
+ (value || []).forEach((itemValue) => {
13022
13067
  var newItemValue = {};
13023
- for(let n in itemValue){
13024
- if(itemValue.hasOwnProperty(n)){
13068
+ for (let n in itemValue) {
13069
+ if (itemValue.hasOwnProperty(n)) {
13025
13070
  newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
13026
13071
  }
13027
13072
  }
@@ -13036,16 +13081,16 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix){
13036
13081
  * @param {*} fieldPrefix 字段前缀
13037
13082
  * @returns 转换后的子表组件字段值
13038
13083
  */
13039
- function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey){
13084
+ function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
13040
13085
  let convertedValue = [];
13041
- (value || []).forEach((itemValue)=>{
13086
+ (value || []).forEach((itemValue) => {
13042
13087
  var newItemValue = {};
13043
- for(let n in itemValue){
13044
- if(itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey){
13088
+ for (let n in itemValue) {
13089
+ if (itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey) {
13045
13090
  newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
13046
13091
  }
13047
13092
  }
13048
- if(primaryKey && itemValue[primaryKey]){
13093
+ if (primaryKey && itemValue[primaryKey]) {
13049
13094
  newItemValue[primaryKey] = itemValue[primaryKey];
13050
13095
  }
13051
13096
  convertedValue.push(newItemValue);
@@ -13059,7 +13104,7 @@ function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey){
13059
13104
  * @param {*} fieldPrefix 字段前缀
13060
13105
  * @returns 转换后的子表组件字段值
13061
13106
  */
13062
- function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
13107
+ function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix) {
13063
13108
  return (fields || []).map((item) => {
13064
13109
  const newItem = clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
13065
13110
  newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
@@ -13097,6 +13142,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
13097
13142
  name: field.name,
13098
13143
  quickEdit: {
13099
13144
  "type": "steedos-field",
13145
+ "mode": "inline",
13100
13146
  "config": Object.assign({}, field, {
13101
13147
  label: false
13102
13148
  })
@@ -13104,16 +13150,20 @@ function getInputTableCell(field, showAsInlineEditMode) {
13104
13150
  }
13105
13151
  }
13106
13152
  else {
13153
+ // 这里加一层service是因为amis 3.6/6.0中有bug,不加的话,这里会显示为父作用域中中的同名变量值,见:https://github.com/baidu/amis/issues/9520
13107
13154
  return {
13108
- "type": "steedos-field",
13109
- "config": Object.assign({}, field, {
13110
- label: false
13111
- }),
13112
- inInputTable: true,
13113
- "static": true,
13114
- "readonly": true,
13155
+ "type": "service",
13115
13156
  label: field.label,
13116
- name: field.name
13157
+ name: field.name,
13158
+ "body":[{
13159
+ "type": "steedos-field",
13160
+ "config": Object.assign({}, field, {
13161
+ label: false
13162
+ }),
13163
+ inInputTable: true,
13164
+ "static": true,
13165
+ "readonly": true
13166
+ }]
13117
13167
  }
13118
13168
  }
13119
13169
  }
@@ -13176,7 +13226,9 @@ async function getInputTableColumns(props) {
13176
13226
  }
13177
13227
  }
13178
13228
  if (field) {
13179
- let tableCell = getInputTableCell(field, showAsInlineEditMode);
13229
+ let mode = typeof extendColumnProps.inlineEditMode === "boolean" ?
13230
+ extendColumnProps.inlineEditMode : showAsInlineEditMode;
13231
+ let tableCell = getInputTableCell(field, mode);
13180
13232
  return Object.assign({}, tableCell, extendColumnProps);
13181
13233
  }
13182
13234
  else {
@@ -13199,7 +13251,7 @@ async function getInputTableColumns(props) {
13199
13251
  */
13200
13252
  function getFormPagination(props, mode) {
13201
13253
  let showPagination = true;
13202
- if(mode === "new" && !!!props.editable){
13254
+ if (mode === "new" && !!!props.editable) {
13203
13255
  //不允许编辑只允许新建时不应该让用户操作翻页
13204
13256
  showPagination = false;
13205
13257
  }
@@ -13639,7 +13691,7 @@ async function getButtonActions(props, mode) {
13639
13691
  let formPaginationId = getComponentId("form_pagination", props.id);
13640
13692
  let parentFormData = "${__super.__super.__super.__super || {}}";
13641
13693
  let amisVersion = getComparableAmisVersion();
13642
- if(amisVersion < 3.6){
13694
+ if (amisVersion < 3.6) {
13643
13695
  parentFormData = "${__super.__super || {}}";
13644
13696
  }
13645
13697
  if (mode == "new" || mode == "edit") {
@@ -13803,13 +13855,13 @@ async function getButtonActions(props, mode) {
13803
13855
  `;
13804
13856
  let dialogButtons = [
13805
13857
  {
13806
- "type": "button",
13807
- "label": "完成",
13808
- "actionType": "confirm",
13809
- "level": "primary"
13858
+ "type": "button",
13859
+ "label": "完成",
13860
+ "actionType": "confirm",
13861
+ "level": "primary"
13810
13862
  }
13811
13863
  ];
13812
- if(props.addable){
13864
+ if (props.addable) {
13813
13865
  // 有新增行权限时额外添加新增和复制按钮
13814
13866
  dialogButtons = [
13815
13867
  {
@@ -13882,7 +13934,7 @@ async function getButtonActions(props, mode) {
13882
13934
  // 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
13883
13935
  // 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
13884
13936
  "__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
13885
- },
13937
+ },
13886
13938
  "actions": dialogButtons,
13887
13939
  "onEvent": {
13888
13940
  "confirm": {
@@ -14120,7 +14172,7 @@ const getAmisInputTableSchema = async (props) => {
14120
14172
  }
14121
14173
  let primaryKey = getTablePrimaryKey(props);
14122
14174
  let showOperation = props.showOperation;
14123
- if(showOperation !== false){
14175
+ if (showOperation !== false) {
14124
14176
  showOperation = true;
14125
14177
  }
14126
14178
  let fieldPrefix = props.fieldPrefix;
@@ -14132,7 +14184,7 @@ const getAmisInputTableSchema = async (props) => {
14132
14184
  let buttonsForColumnOperations = [];
14133
14185
  let inlineEditMode = props.inlineEditMode;
14134
14186
  let showAsInlineEditMode = inlineEditMode && props.editable;
14135
- if(showOperation){
14187
+ if (showOperation) {
14136
14188
  if (props.editable) {
14137
14189
  let showEditButton = true;
14138
14190
  if (showAsInlineEditMode) {
@@ -14183,31 +14235,31 @@ const getAmisInputTableSchema = async (props) => {
14183
14235
  "showFooterAddBtn": false,
14184
14236
  "className": props.tableClassName,
14185
14237
  "pipeIn": (value, data) => {
14186
- if(fieldPrefix){
14238
+ if (fieldPrefix) {
14187
14239
  value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
14188
14240
  }
14189
- if(primaryKey){
14241
+ if (primaryKey) {
14190
14242
  // 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
14191
14243
  // 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
14192
14244
  // 这里要注意,流程详细设置界面的字段设置功能中的子表组件中,数据库里保存的子表字段行数据是有primaryKey字段值的,它不依赖这里自动生成行primaryKey值功能
14193
14245
  value = getTableValueWithPrimaryKeyValue(value, primaryKey);
14194
14246
  }
14195
- if(amis.pipeIn){
14196
- if(typeof amis.pipeIn === 'function'){
14247
+ if (amis.pipeIn) {
14248
+ if (typeof amis.pipeIn === 'function') {
14197
14249
  return amis.pipeIn(value, data);
14198
14250
  }
14199
14251
  }
14200
14252
  return value;
14201
14253
  },
14202
14254
  "pipeOut": (value, data) => {
14203
- value = (value || []).map(function(item){
14255
+ value = (value || []).map(function (item) {
14204
14256
  delete item.__fix_rerender_after_children_modified_tag;
14205
14257
  return item;
14206
14258
  });
14207
- if(fieldPrefix){
14259
+ if (fieldPrefix) {
14208
14260
  value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
14209
14261
  }
14210
- if(props.autoGeneratePrimaryKeyValue === true){
14262
+ if (props.autoGeneratePrimaryKeyValue === true) {
14211
14263
  // 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
14212
14264
  // 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
14213
14265
  value = getTableValueWithPrimaryKeyValue(value, primaryKey);
@@ -14219,8 +14271,8 @@ const getAmisInputTableSchema = async (props) => {
14219
14271
  // 只有autoGeneratePrimaryKey配置为true时,每行的primaryKey字段值才会始终保持不变
14220
14272
  value = getTableValueWithoutPrimaryKeyValue(value, primaryKey);
14221
14273
  }
14222
- if(amis.pipeOut){
14223
- if(typeof amis.pipeOut === 'function'){
14274
+ if (amis.pipeOut) {
14275
+ if (typeof amis.pipeOut === 'function') {
14224
14276
  return amis.pipeOut(value, data);
14225
14277
  }
14226
14278
  }
@@ -14235,9 +14287,10 @@ const getAmisInputTableSchema = async (props) => {
14235
14287
  "width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
14236
14288
  });
14237
14289
  }
14238
- if (showAsInlineEditMode) {
14239
- inputTableSchema.needConfirm = false;
14240
- }
14290
+ // if (showAsInlineEditMode) {
14291
+ // // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
14292
+ // inputTableSchema.needConfirm = false;
14293
+ // }
14241
14294
  if (amis) {
14242
14295
  // 支持配置amis属性重写或添加最终生成的input-table中任何属性。
14243
14296
  delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
@@ -14279,19 +14332,19 @@ const getAmisInputTableSchema = async (props) => {
14279
14332
  });
14280
14333
  }
14281
14334
  let schema = {
14282
- "type": "service",
14283
- "body": [
14284
- {
14285
- "type": "control",
14286
- "body": schemaBody,
14287
- "label": props.label,
14288
- "labelClassName": props.label ? props.labelClassName : "none",
14289
- "labelRemark": props.labelRemark,
14290
- "labelAlign": props.labelAlign
14291
- }
14292
- ],
14293
- "className": props.className,
14294
- "id": serviceId
14335
+ "type": "control",
14336
+ "body": {
14337
+ "type": "service",
14338
+ "body": schemaBody,
14339
+ "id": serviceId
14340
+ },
14341
+ "label": props.label,
14342
+ "labelClassName": props.label ? props.labelClassName : "none",
14343
+ "labelRemark": props.labelRemark,
14344
+ "labelAlign": props.labelAlign,
14345
+ //控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
14346
+ "mode": props.mode || null,
14347
+ "className": props.className
14295
14348
  };
14296
14349
  // console.log("===schema===", schema);
14297
14350
  return schema;