@steedos-widgets/amis-lib 3.6.2-beta.11 → 3.6.2-beta.13

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
@@ -354,6 +354,9 @@ const Router = {
354
354
  if(uiSchema.enable_split){
355
355
  defaultDisplay = "split";
356
356
  }
357
+ if(window.innerWidth <= 768){
358
+ return "grid";
359
+ }
357
360
  return value ? value : defaultDisplay;
358
361
  },
359
362
 
@@ -2037,7 +2040,7 @@ async function getQuickEditSchema(field, options){
2037
2040
  }
2038
2041
 
2039
2042
  function getFieldWidth(width){
2040
- const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
2043
+ const defaultWidth = null;
2041
2044
  if(typeof width == 'string'){
2042
2045
  if(isNaN(width)){
2043
2046
  return width || defaultWidth;
@@ -2067,14 +2070,14 @@ async function getTableColumns(fields, options){
2067
2070
  //增加quickEdit属性,实现快速编辑
2068
2071
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
2069
2072
  let className = "";
2070
- if(field.wrap != true){
2071
- if(field.wrap != false && field.is_wide){
2072
- className += " break-words ";
2073
- }else {
2073
+ if(/Safari/.test(navigator.userAgent)){
2074
+ className += " whitespace-nowrap ";
2075
+ }else {
2076
+ if(field.wrap != true){
2074
2077
  className += " whitespace-nowrap ";
2078
+ }else {
2079
+ className += " break-words ";
2075
2080
  }
2076
- }else {
2077
- className += " break-words ";
2078
2081
  }
2079
2082
  let columnItem;
2080
2083
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
@@ -2969,15 +2972,8 @@ async function getTableApi(mainObject, fields, options){
2969
2972
  }
2970
2973
  });
2971
2974
  };
2972
- let isTreeOptionsComputed = false;
2973
- if(records.length === 1 && records[0].children){
2974
- isTreeOptionsComputed = true;
2975
- }
2976
- if(!isTreeOptionsComputed){
2977
- // 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
2978
- payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
2979
- assignIndexToTreeRecords(payload.data.rows, '');
2980
- }
2975
+ payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
2976
+ assignIndexToTreeRecords(payload.data.rows, '');
2981
2977
  }
2982
2978
 
2983
2979
 
@@ -4873,9 +4869,16 @@ const getSchema$2 = (uiSchema) => {
4873
4869
  "form": {
4874
4870
  debug: false,
4875
4871
  resetAfterSubmit: false,
4872
+ data: {
4873
+ editFormInited: true,
4874
+ },
4876
4875
  initApi: {
4876
+ method: 'GET',
4877
4877
  url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
4878
4878
  sendOn: 'this.recordId',
4879
+ data: null,
4880
+ requestAdaptor: "return api;",
4881
+ adaptor: "return payload;",
4879
4882
  responseData: {
4880
4883
  importState: "${state}"
4881
4884
  }
@@ -8997,7 +9000,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
8997
9000
  * @Author: baozhoutao@steedos.com
8998
9001
  * @Date: 2022-07-05 15:55:39
8999
9002
  * @LastEditors: baozhoutao@steedos.com
9000
- * @LastEditTime: 2024-01-15 10:34:46
9003
+ * @LastEditTime: 2024-01-24 10:18:17
9001
9004
  * @Description:
9002
9005
  */
9003
9006
 
@@ -9096,7 +9099,9 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
9096
9099
  const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
9097
9100
  mainRelated[arr[0]] = foreign_key_value;
9098
9101
  }
9099
- }else {
9102
+ }
9103
+ // 防止related_lists中没有相关子表,但是details中有相关子表的情况
9104
+ if(!mainRelated[relatedObjectName]){
9100
9105
  const details = union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
9101
9106
  for (const detail of details) {
9102
9107
  const arr = detail.split(".");
@@ -10632,17 +10637,13 @@ function getReferenceToSync(field) {
10632
10637
 
10633
10638
  function getLookupSapceUserTreeSchema(isMobile){
10634
10639
  let apiAdaptor = `
10635
- // console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
10636
10640
  const records = payload.data.options;
10637
- let isTreeOptionsComputed = false;
10638
- if(records.length === 1 && records[0].children){
10639
- isTreeOptionsComputed = true;
10640
- }
10641
- if(isTreeOptionsComputed){
10642
- return payload;
10643
- }
10644
10641
  const treeRecords = [];
10645
- const getChildren = (records, childrenIds) => {
10642
+ const getChildren = (currentRecord, records, childrenIds) => {
10643
+ if (currentRecord.children && typeof currentRecord.children[0] === "object") {
10644
+ // 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
10645
+ return currentRecord.children;
10646
+ }
10646
10647
  if (!childrenIds) {
10647
10648
  return;
10648
10649
  }
@@ -10651,7 +10652,7 @@ function getLookupSapceUserTreeSchema(isMobile){
10651
10652
  });
10652
10653
  _.each(children, (item) => {
10653
10654
  if (item.children) {
10654
- item.children = getChildren(records, item.children)
10655
+ item.children = getChildren(item, records, item.children)
10655
10656
  }else{
10656
10657
  item.children = [];
10657
10658
  }
@@ -10677,7 +10678,7 @@ function getLookupSapceUserTreeSchema(isMobile){
10677
10678
 
10678
10679
  _.each(records, (record) => {
10679
10680
  if (record.noParent == 1) {
10680
- treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
10681
+ treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
10681
10682
  }
10682
10683
  });
10683
10684
  console.log(treeRecords)
@@ -10727,6 +10728,7 @@ function getLookupSapceUserTreeSchema(isMobile){
10727
10728
  }
10728
10729
  },
10729
10730
  "label": "",
10731
+ "mode": "normal",
10730
10732
  "name": "organizations",
10731
10733
  "multiple": false,
10732
10734
  "joinValues": false,
@@ -12523,7 +12525,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
12523
12525
  }else {
12524
12526
  convertData.className = 'm-0';
12525
12527
  }
12526
- if(readonly){
12528
+ if(readonly && ctx.mode !== 'edit'){
12527
12529
  convertData.className = `${convertData.className} border-b`;
12528
12530
  }
12529
12531
  if(readonly){
@@ -12805,6 +12807,13 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
12805
12807
  }
12806
12808
  }
12807
12809
 
12810
+ fieldSetBody.forEach((field)=>{
12811
+ //判断label是否存在,不存在时将label的空占位元素隐藏
12812
+ if(!field.label){
12813
+ field.labelClassName = "none";
12814
+ }
12815
+ });
12816
+
12808
12817
  // fieldSet 已支持显隐控制
12809
12818
  const sectionFieldsVisibleOn = _$1.map(_$1.compact(_$1.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
12810
12819
  let visible = visibleOn;
@@ -12947,10 +12956,10 @@ function uuidv4() {
12947
12956
  * @Author: 殷亮辉 yinlianghui@hotoa.com
12948
12957
  * @Date: 2023-11-15 09:50:22
12949
12958
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12950
- * @LastEditTime: 2024-01-21 23:40:13
12959
+ * @LastEditTime: 2024-01-24 14:56:03
12951
12960
  */
12952
12961
 
12953
- function getTablePrimaryKey(props){
12962
+ function getTablePrimaryKey(props) {
12954
12963
  return props.primaryKey || "_id";
12955
12964
  }
12956
12965
 
@@ -12960,22 +12969,22 @@ function getTablePrimaryKey(props){
12960
12969
  * @param {*} primaryKey 主键字段名,一般为_id
12961
12970
  * @returns 转换后的子表组件字段值
12962
12971
  */
12963
- function getTableValueWithPrimaryKeyValue(value, primaryKey){
12964
- if(!primaryKey){
12972
+ function getTableValueWithPrimaryKeyValue(value, primaryKey) {
12973
+ if (!primaryKey) {
12965
12974
  return value;
12966
12975
  }
12967
- return (value || []).map((itemValue)=>{
12976
+ return (value || []).map((itemValue) => {
12968
12977
  //这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里把primaryKey字段值保存了
12969
12978
  const newItemValue = clone(itemValue);
12970
- if(newItemValue[primaryKey]){
12971
- if(newItemValue.children){
12979
+ if (newItemValue[primaryKey]) {
12980
+ if (newItemValue.children) {
12972
12981
  newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
12973
12982
  }
12974
12983
  return newItemValue;
12975
12984
  }
12976
12985
  else {
12977
12986
  newItemValue[primaryKey] = uuidv4();
12978
- if(newItemValue.children){
12987
+ if (newItemValue.children) {
12979
12988
  newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
12980
12989
  }
12981
12990
  return newItemValue;
@@ -12989,14 +12998,14 @@ function getTableValueWithPrimaryKeyValue(value, primaryKey){
12989
12998
  * @param {*} primaryKey 主键字段名,一般为_id
12990
12999
  * @returns 转换后的子表组件字段值
12991
13000
  */
12992
- function getTableValueWithoutPrimaryKeyValue(value, primaryKey){
12993
- if(!primaryKey){
13001
+ function getTableValueWithoutPrimaryKeyValue(value, primaryKey) {
13002
+ if (!primaryKey) {
12994
13003
  return value;
12995
13004
  }
12996
- return (value || []).map((itemValue)=>{
13005
+ return (value || []).map((itemValue) => {
12997
13006
  //这里clone只是为了保险,不是必须的,每次修改子表数据是否都会生成新的primaryKey字段值是由pipeOut中识别autoGeneratePrimaryKeyValue决定的,跟这里没关系
12998
13007
  const newItemValue = clone(itemValue);
12999
- if(newItemValue.children){
13008
+ if (newItemValue.children) {
13000
13009
  newItemValue.children = getTableValueWithoutPrimaryKeyValue(newItemValue.children, primaryKey);
13001
13010
  }
13002
13011
  delete newItemValue[primaryKey];
@@ -13010,12 +13019,12 @@ function getTableValueWithoutPrimaryKeyValue(value, primaryKey){
13010
13019
  * @param {*} fieldPrefix 字段前缀
13011
13020
  * @returns 转换后的子表组件字段值
13012
13021
  */
13013
- function getTableValueWithoutFieldPrefix(value, fieldPrefix){
13022
+ function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
13014
13023
  let convertedValue = [];
13015
- (value || []).forEach((itemValue)=>{
13024
+ (value || []).forEach((itemValue) => {
13016
13025
  var newItemValue = {};
13017
- for(let n in itemValue){
13018
- if(itemValue.hasOwnProperty(n)){
13026
+ for (let n in itemValue) {
13027
+ if (itemValue.hasOwnProperty(n)) {
13019
13028
  newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
13020
13029
  }
13021
13030
  }
@@ -13030,16 +13039,16 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix){
13030
13039
  * @param {*} fieldPrefix 字段前缀
13031
13040
  * @returns 转换后的子表组件字段值
13032
13041
  */
13033
- function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey){
13042
+ function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
13034
13043
  let convertedValue = [];
13035
- (value || []).forEach((itemValue)=>{
13044
+ (value || []).forEach((itemValue) => {
13036
13045
  var newItemValue = {};
13037
- for(let n in itemValue){
13038
- if(itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey){
13046
+ for (let n in itemValue) {
13047
+ if (itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey) {
13039
13048
  newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
13040
13049
  }
13041
13050
  }
13042
- if(primaryKey && itemValue[primaryKey]){
13051
+ if (primaryKey && itemValue[primaryKey]) {
13043
13052
  newItemValue[primaryKey] = itemValue[primaryKey];
13044
13053
  }
13045
13054
  convertedValue.push(newItemValue);
@@ -13053,7 +13062,7 @@ function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey){
13053
13062
  * @param {*} fieldPrefix 字段前缀
13054
13063
  * @returns 转换后的子表组件字段值
13055
13064
  */
13056
- function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
13065
+ function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix) {
13057
13066
  return (fields || []).map((item) => {
13058
13067
  const newItem = clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
13059
13068
  newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
@@ -13091,6 +13100,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
13091
13100
  name: field.name,
13092
13101
  quickEdit: {
13093
13102
  "type": "steedos-field",
13103
+ "mode": "inline",
13094
13104
  "config": Object.assign({}, field, {
13095
13105
  label: false
13096
13106
  })
@@ -13170,7 +13180,9 @@ async function getInputTableColumns(props) {
13170
13180
  }
13171
13181
  }
13172
13182
  if (field) {
13173
- let tableCell = getInputTableCell(field, showAsInlineEditMode);
13183
+ let mode = typeof extendColumnProps.inlineEditMode === "boolean" ?
13184
+ extendColumnProps.inlineEditMode : showAsInlineEditMode;
13185
+ let tableCell = getInputTableCell(field, mode);
13174
13186
  return Object.assign({}, tableCell, extendColumnProps);
13175
13187
  }
13176
13188
  else {
@@ -13193,7 +13205,7 @@ async function getInputTableColumns(props) {
13193
13205
  */
13194
13206
  function getFormPagination(props, mode) {
13195
13207
  let showPagination = true;
13196
- if(mode === "new" && !!!props.editable){
13208
+ if (mode === "new" && !!!props.editable) {
13197
13209
  //不允许编辑只允许新建时不应该让用户操作翻页
13198
13210
  showPagination = false;
13199
13211
  }
@@ -13209,37 +13221,41 @@ function getFormPagination(props, mode) {
13209
13221
  let __formId = "${formId}";
13210
13222
  let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
13211
13223
  let pageChangeDirection = context.props.pageChangeDirection;
13224
+ let mode = "${mode}";
13212
13225
  // event.data中的index和__page分别表示当前要把表单数据提交到的行索引和用于标定下一页页码的当前页页码
13213
13226
  // 一般来说__page = index + 1,但是可以让event.data中传入__page和index值不是这种联系。
13214
13227
  // 比如__page设置为3,index设置为0表示把当前表单数据提交到第一页,但是跳转到第4页,弹出的表单中底下的新增和复制按钮依赖了此功能
13215
13228
  // let currentPage = currentIndex + 1;
13216
13229
  let currentPage = event.data.__page;
13217
13230
  let currentIndex = event.data.index;
13218
- // 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
13219
- let currentFormValues = scope.getComponentById(__formId).getValues();
13220
- // 这里不clone的话,其值会带上__super属性
13221
- currentFormValues = _.clone(currentFormValues);
13222
- var parent = event.data.parent;
13223
- var __parentIndex = event.data.__parentIndex;
13224
- if(parent){
13225
- fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
13226
- // 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
13227
- fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
13228
- children: fieldValue[__parentIndex].children,
13229
- __fix_rerender_after_children_modified_tag: new Date().getTime()
13231
+ if(mode !== "readonly"){
13232
+ // 新建编辑时,翻页才需要把当前页表单保存,只读时直接翻页即可
13233
+ // 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
13234
+ let currentFormValues = scope.getComponentById(__formId).getValues();
13235
+ // 这里不clone的话,其值会带上__super属性
13236
+ currentFormValues = _.clone(currentFormValues);
13237
+ var parent = event.data.parent;
13238
+ var __parentIndex = event.data.__parentIndex;
13239
+ if(parent){
13240
+ fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
13241
+ // 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
13242
+ fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
13243
+ children: fieldValue[__parentIndex].children,
13244
+ __fix_rerender_after_children_modified_tag: new Date().getTime()
13245
+ });
13246
+ }
13247
+ else{
13248
+ fieldValue[currentIndex] = currentFormValues;
13249
+ }
13250
+ // 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
13251
+ doAction({
13252
+ "componentId": "${props.id}",
13253
+ "actionType": "setValue",
13254
+ "args": {
13255
+ "value": fieldValue
13256
+ }
13230
13257
  });
13231
13258
  }
13232
- else{
13233
- fieldValue[currentIndex] = currentFormValues;
13234
- }
13235
- // 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
13236
- doAction({
13237
- "componentId": "${props.id}",
13238
- "actionType": "setValue",
13239
- "args": {
13240
- "value": fieldValue
13241
- }
13242
- });
13243
13259
 
13244
13260
  // 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
13245
13261
  let targetPage;
@@ -13299,7 +13315,7 @@ function getFormPagination(props, mode) {
13299
13315
  {
13300
13316
  "type": "tpl",
13301
13317
  // 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
13302
- "tpl": "${__page}/${__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length}"
13318
+ "tpl": "${__page}/${__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length}"
13303
13319
  },
13304
13320
  {
13305
13321
  "type": "button",
@@ -13309,7 +13325,7 @@ function getFormPagination(props, mode) {
13309
13325
  "pageChangeDirection": "next",
13310
13326
  // "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
13311
13327
  // 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
13312
- "disabledOn": showPagination ? "${__page >= (__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length)}" : "true",
13328
+ "disabledOn": showPagination ? "${__page >= (__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length)}" : "true",
13313
13329
  "size": "sm",
13314
13330
  "id": buttonNextId,
13315
13331
  "onEvent": {
@@ -13629,7 +13645,7 @@ async function getButtonActions(props, mode) {
13629
13645
  let formPaginationId = getComponentId("form_pagination", props.id);
13630
13646
  let parentFormData = "${__super.__super.__super.__super || {}}";
13631
13647
  let amisVersion = getComparableAmisVersion();
13632
- if(amisVersion < 3.6){
13648
+ if (amisVersion < 3.6) {
13633
13649
  parentFormData = "${__super.__super || {}}";
13634
13650
  }
13635
13651
  if (mode == "new" || mode == "edit") {
@@ -13793,13 +13809,13 @@ async function getButtonActions(props, mode) {
13793
13809
  `;
13794
13810
  let dialogButtons = [
13795
13811
  {
13796
- "type": "button",
13797
- "label": "完成",
13798
- "actionType": "confirm",
13799
- "level": "primary"
13812
+ "type": "button",
13813
+ "label": "完成",
13814
+ "actionType": "confirm",
13815
+ "level": "primary"
13800
13816
  }
13801
13817
  ];
13802
- if(props.addable){
13818
+ if (props.addable) {
13803
13819
  // 有新增行权限时额外添加新增和复制按钮
13804
13820
  dialogButtons = [
13805
13821
  {
@@ -13872,7 +13888,7 @@ async function getButtonActions(props, mode) {
13872
13888
  // 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
13873
13889
  // 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
13874
13890
  "__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
13875
- },
13891
+ },
13876
13892
  "actions": dialogButtons,
13877
13893
  "onEvent": {
13878
13894
  "confirm": {
@@ -13970,7 +13986,10 @@ async function getButtonActions(props, mode) {
13970
13986
  // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
13971
13987
  // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
13972
13988
  // "__tableItems": `\${${props.name}|json|toJson}`
13973
- "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
13989
+ // "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
13990
+ // 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
13991
+ // 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
13992
+ "__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
13974
13993
  },
13975
13994
  }
13976
13995
  }
@@ -14107,7 +14126,7 @@ const getAmisInputTableSchema = async (props) => {
14107
14126
  }
14108
14127
  let primaryKey = getTablePrimaryKey(props);
14109
14128
  let showOperation = props.showOperation;
14110
- if(showOperation !== false){
14129
+ if (showOperation !== false) {
14111
14130
  showOperation = true;
14112
14131
  }
14113
14132
  let fieldPrefix = props.fieldPrefix;
@@ -14119,7 +14138,7 @@ const getAmisInputTableSchema = async (props) => {
14119
14138
  let buttonsForColumnOperations = [];
14120
14139
  let inlineEditMode = props.inlineEditMode;
14121
14140
  let showAsInlineEditMode = inlineEditMode && props.editable;
14122
- if(showOperation){
14141
+ if (showOperation) {
14123
14142
  if (props.editable) {
14124
14143
  let showEditButton = true;
14125
14144
  if (showAsInlineEditMode) {
@@ -14153,7 +14172,7 @@ const getAmisInputTableSchema = async (props) => {
14153
14172
  let amis = props["input-table"] || props.amis || {};//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
14154
14173
  let inputTableSchema = {
14155
14174
  "type": "input-table",
14156
- "label": props.label,
14175
+ "mode": "normal",
14157
14176
  "name": props.name,
14158
14177
  //不可以addable/editable/removable设置为true,因为会在原生的操作列显示操作按钮图标,此开关实测只控制这个按钮显示不会影响功能
14159
14178
  // "addable": props.addable,
@@ -14170,31 +14189,31 @@ const getAmisInputTableSchema = async (props) => {
14170
14189
  "showFooterAddBtn": false,
14171
14190
  "className": props.tableClassName,
14172
14191
  "pipeIn": (value, data) => {
14173
- if(fieldPrefix){
14192
+ if (fieldPrefix) {
14174
14193
  value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
14175
14194
  }
14176
- if(primaryKey){
14195
+ if (primaryKey) {
14177
14196
  // 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
14178
14197
  // 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
14179
14198
  // 这里要注意,流程详细设置界面的字段设置功能中的子表组件中,数据库里保存的子表字段行数据是有primaryKey字段值的,它不依赖这里自动生成行primaryKey值功能
14180
14199
  value = getTableValueWithPrimaryKeyValue(value, primaryKey);
14181
14200
  }
14182
- if(amis.pipeIn){
14183
- if(typeof amis.pipeIn === 'function'){
14201
+ if (amis.pipeIn) {
14202
+ if (typeof amis.pipeIn === 'function') {
14184
14203
  return amis.pipeIn(value, data);
14185
14204
  }
14186
14205
  }
14187
14206
  return value;
14188
14207
  },
14189
14208
  "pipeOut": (value, data) => {
14190
- value = (value || []).map(function(item){
14209
+ value = (value || []).map(function (item) {
14191
14210
  delete item.__fix_rerender_after_children_modified_tag;
14192
14211
  return item;
14193
14212
  });
14194
- if(fieldPrefix){
14213
+ if (fieldPrefix) {
14195
14214
  value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
14196
14215
  }
14197
- if(props.autoGeneratePrimaryKeyValue === true){
14216
+ if (props.autoGeneratePrimaryKeyValue === true) {
14198
14217
  // 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
14199
14218
  // 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
14200
14219
  value = getTableValueWithPrimaryKeyValue(value, primaryKey);
@@ -14206,8 +14225,8 @@ const getAmisInputTableSchema = async (props) => {
14206
14225
  // 只有autoGeneratePrimaryKey配置为true时,每行的primaryKey字段值才会始终保持不变
14207
14226
  value = getTableValueWithoutPrimaryKeyValue(value, primaryKey);
14208
14227
  }
14209
- if(amis.pipeOut){
14210
- if(typeof amis.pipeOut === 'function'){
14228
+ if (amis.pipeOut) {
14229
+ if (typeof amis.pipeOut === 'function') {
14211
14230
  return amis.pipeOut(value, data);
14212
14231
  }
14213
14232
  }
@@ -14222,9 +14241,6 @@ const getAmisInputTableSchema = async (props) => {
14222
14241
  "width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
14223
14242
  });
14224
14243
  }
14225
- if (showAsInlineEditMode) {
14226
- inputTableSchema.needConfirm = false;
14227
- }
14228
14244
  if (amis) {
14229
14245
  // 支持配置amis属性重写或添加最终生成的input-table中任何属性。
14230
14246
  delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
@@ -14266,10 +14282,19 @@ const getAmisInputTableSchema = async (props) => {
14266
14282
  });
14267
14283
  }
14268
14284
  let schema = {
14269
- "type": "service",
14270
- "body": schemaBody,
14271
- "className": props.className,
14272
- "id": serviceId
14285
+ "type": "control",
14286
+ "body": {
14287
+ "type": "service",
14288
+ "body": schemaBody,
14289
+ "id": serviceId
14290
+ },
14291
+ "label": props.label,
14292
+ "labelClassName": props.label ? props.labelClassName : "none",
14293
+ "labelRemark": props.labelRemark,
14294
+ "labelAlign": props.labelAlign,
14295
+ //控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
14296
+ "mode": props.mode || null,
14297
+ "className": props.className
14273
14298
  };
14274
14299
  // console.log("===schema===", schema);
14275
14300
  return schema;