@steedos-widgets/amis-lib 3.6.4-beta.2 → 3.6.4-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1680,7 +1680,8 @@ i18next__default["default"]
1680
1680
  }
1681
1681
  });
1682
1682
 
1683
- async function getQuickEditSchema(field, options){
1683
+ async function getQuickEditSchema(object, columnField, options){
1684
+ let field = object.fields[columnField.name];
1684
1685
  //判断在amis3.2以上环境下,放开批量编辑与lookup的单元格编辑
1685
1686
  let isAmisVersionforBatchEdit = false;
1686
1687
  if(window.amisRequire && window.amisRequire('amis')){
@@ -2148,7 +2149,7 @@ function getFieldWidth(width){
2148
2149
  }
2149
2150
  }
2150
2151
 
2151
- async function getTableColumns(fields, options){
2152
+ async function getTableColumns(object, fields, options){
2152
2153
  const columns = [];
2153
2154
  if(!options.isLookup && !options.isInputTable){
2154
2155
  if(!options.enable_tree){
@@ -2162,7 +2163,7 @@ async function getTableColumns(fields, options){
2162
2163
  continue;
2163
2164
  }
2164
2165
  //增加quickEdit属性,实现快速编辑
2165
- const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
2166
+ const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
2166
2167
  let className = "";
2167
2168
  const bowserType = getBowserType();
2168
2169
  if(bowserType === "Safari"){
@@ -2734,7 +2735,7 @@ async function getDefaultCrudCard(columns, options) {
2734
2735
  return card;
2735
2736
  }
2736
2737
 
2737
- async function getTableSchema$1(fields, options){
2738
+ async function getTableSchema$1(object, fields, options){
2738
2739
  if(!options){
2739
2740
  options = {};
2740
2741
  }
@@ -2756,7 +2757,7 @@ async function getTableSchema$1(fields, options){
2756
2757
  columns = await getMobileTableColumns(fields, options);
2757
2758
  }
2758
2759
  else {
2759
- columns = await getTableColumns(fields, options);
2760
+ columns = await getTableColumns(object, fields, options);
2760
2761
 
2761
2762
  if(listSchema.mode === "cards"){
2762
2763
  let card = listSchema.card;
@@ -8844,7 +8845,7 @@ async function getObjectCRUD(objectSchema, fields, options){
8844
8845
  crudId: listSchema.id || id, enable_tree: objectSchema.enable_tree
8845
8846
  }, options);
8846
8847
  tableOptions.amisData = createObject(options.amisData || {}, {});
8847
- const table = await getTableSchema$1(fields, tableOptions);
8848
+ const table = await getTableSchema$1(objectSchema, fields, tableOptions);
8848
8849
  // delete table.mode;
8849
8850
  //image与avatar需要在提交修改时特别处理
8850
8851
  const imageNames = ___default["default"].compact(___default["default"].map(___default["default"].filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
@@ -9111,7 +9112,7 @@ async function getObjectForm(objectSchema, ctx){
9111
9112
  body: {
9112
9113
  type: 'wrapper',
9113
9114
  className: 'p-0 m-0',
9114
- body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
9115
+ body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true})),
9115
9116
  hiddenOn: "${editFormInited != true}",
9116
9117
  },
9117
9118
  panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
@@ -9719,8 +9720,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
9719
9720
  /*
9720
9721
  * @Author: baozhoutao@steedos.com
9721
9722
  * @Date: 2022-07-05 15:55:39
9722
- * @LastEditors: baozhoutao@steedos.com
9723
- * @LastEditTime: 2024-02-18 16:05:21
9723
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
9724
+ * @LastEditTime: 2024-02-23 16:37:06
9724
9725
  * @Description:
9725
9726
  */
9726
9727
 
@@ -10068,6 +10069,7 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
10068
10069
  let fields = [];
10069
10070
  for (const column of columns) {
10070
10071
  if (_$1.isString(column)) {
10072
+ let columnField;
10071
10073
  if (column.indexOf('.') > 0) {
10072
10074
  const fieldName = column.split('.')[0];
10073
10075
  const displayName = column.split('.')[1];
@@ -10075,23 +10077,30 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
10075
10077
  if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to)) {
10076
10078
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
10077
10079
  const rfFieldInfo = rfUiSchema.fields[displayName];
10078
- fields.push(Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx));
10080
+ columnField = Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx);
10079
10081
  }else if(filedInfo && filedInfo.type === 'object'){
10080
- fields.push(uiSchema.fields[column]);
10082
+ columnField = uiSchema.fields[column];
10081
10083
  }
10082
10084
  } else {
10083
10085
  if (uiSchema.fields[column]) {
10084
- fields.push(Object.assign({}, uiSchema.fields[column], ctx));
10086
+ columnField = Object.assign({}, uiSchema.fields[column], ctx);
10085
10087
  }
10086
10088
  else if(ctx.extra){
10087
10089
  // 配置列表视图extra_columns时允许字段是hidden的,hidden的字段在uiSchema.fields中不存在
10088
- fields.push({
10090
+ columnField = {
10089
10091
  extra: true,
10090
10092
  name: column
10091
- });
10093
+ };
10092
10094
  }
10093
10095
  }
10096
+ if(columnField){
10097
+ // 列上的字段不认uiSchema.fields中定义的amis属性
10098
+ columnField = Object.assign({}, columnField, {amis: undefined});
10099
+ fields.push(columnField);
10100
+ }
10101
+
10094
10102
  } else if (_$1.isObject(column)) {
10103
+ let columnField;
10095
10104
  if (column.field.indexOf('.') > 0) {
10096
10105
  const fieldName = column.field.split('.')[0];
10097
10106
  const displayName = column.field.split('.')[1];
@@ -10099,33 +10108,34 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
10099
10108
  if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to)) {
10100
10109
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
10101
10110
  const rfFieldInfo = rfUiSchema.fields[displayName];
10102
- fields.push(Object.assign({}, rfFieldInfo, ctx,
10111
+ columnField = Object.assign({}, rfFieldInfo, ctx,
10103
10112
  { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } },
10104
10113
  {
10105
10114
  width: column.width,
10106
- wrap: column.wrap, // wrap = true 是没效果的
10107
- amis: column.amis
10115
+ wrap: column.wrap // wrap = true 是没效果的
10108
10116
  }
10109
- ));
10117
+ );
10110
10118
  }
10111
10119
  } else {
10112
10120
  if (uiSchema.fields[column.field]) {
10113
- fields.push(
10114
- Object.assign({}, uiSchema.fields[column.field], ctx, {
10115
- width: column.width,
10116
- wrap: column.wrap, // wrap = true 是没效果的
10117
- amis: column.amis
10118
- })
10119
- );
10121
+ columnField = Object.assign({}, uiSchema.fields[column.field], ctx, {
10122
+ width: column.width,
10123
+ wrap: column.wrap // wrap = true 是没效果的
10124
+ });
10120
10125
  }
10121
10126
  else if(ctx.extra){
10122
10127
  // 配置列表视图extra_columns时允许字段是hidden的,hidden的字段在uiSchema.fields中不存在
10123
- fields.push({
10128
+ columnField = {
10124
10129
  extra: true,
10125
10130
  name: column.field
10126
- });
10131
+ };
10127
10132
  }
10128
10133
  }
10134
+ if(columnField){
10135
+ // 列上的字段不认uiSchema.fields中定义的amis属性,用列上配置的amis覆盖
10136
+ columnField = Object.assign({}, columnField, {amis: column.amis});
10137
+ fields.push(columnField);
10138
+ }
10129
10139
  }
10130
10140
  }
10131
10141
  return fields;
@@ -10699,7 +10709,22 @@ async function getSelectUserSchema(field, readonly, ctx) {
10699
10709
  async function getSource(field, ctx) {
10700
10710
  // data.query 最终格式 "{ \tleftOptions:organizations(filters: {__filters}){value:_id,label:name,children}, children:organizations(filters: {__filters}){ref:_id,children}, defaultValueOptions:space_users(filters: {__options_filters}){user,name} }"
10701
10711
  const refObjectName = ctx.objectName;
10702
- const data = await getFindQuery({ name: refObjectName }, null, [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }], {
10712
+ let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
10713
+ let defaultOptionQueryFields = optionQueryFields.filter(function (f) { return f.name !== "children" });
10714
+
10715
+ // 把自动填充规则中依赖的字段也加到api请求中
10716
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
10717
+ if (autoFillMapping && autoFillMapping.length) {
10718
+ autoFillMapping.forEach(function (item) {
10719
+ if(item.from !== "children"){
10720
+ optionQueryFields.push({ name: item.from });
10721
+ }
10722
+ defaultOptionQueryFields.push({ name: item.from });
10723
+ });
10724
+ }
10725
+
10726
+ const data = await getFindQuery({ name: refObjectName }, null, optionQueryFields, {
10727
+ expand: false,
10703
10728
  alias: "options",
10704
10729
  filters: "{__filters}"
10705
10730
  });
@@ -10710,7 +10735,8 @@ async function getSource(field, ctx) {
10710
10735
  // });
10711
10736
  // childrenData.query = childrenData.query.replace(/,count\:.+/, "}");
10712
10737
  // data.query = data.query.replace(/}$/, "," + childrenData.query.replace(/{(.+)}/, "$1}"));
10713
- const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }], {
10738
+ const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, defaultOptionQueryFields, {
10739
+ expand: false,
10714
10740
  alias: "defaultValueOptions",
10715
10741
  filters: "{__options_filters}"
10716
10742
  });
@@ -10777,7 +10803,20 @@ async function getSource(field, ctx) {
10777
10803
  async function getDeferApi(field, ctx) {
10778
10804
  // data.query 最终格式 "{ \toptions:{__object_name}(filters:{__filters}){{__fields}} }"
10779
10805
  const refObjectName = ctx.objectName;
10780
- const data = await getFindQuery({ name: "{__object_name}" }, null, [], {
10806
+ let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
10807
+
10808
+ // 把自动填充规则中依赖的字段也加到api请求中
10809
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
10810
+ if (autoFillMapping && autoFillMapping.length) {
10811
+ autoFillMapping.forEach(function (item) {
10812
+ if(item.from !== "children"){
10813
+ optionQueryFields.push({ name: item.from });
10814
+ }
10815
+ });
10816
+ }
10817
+
10818
+ const data = await getFindQuery({ name: "{__object_name}" }, null, optionQueryFields, {
10819
+ expand: false,
10781
10820
  alias: "options",
10782
10821
  // filters: "{__filters}",
10783
10822
  queryOptions: `filters: {__filters}, sort: "{__sort}"`
@@ -10792,8 +10831,6 @@ async function getDeferApi(field, ctx) {
10792
10831
  filters = filters(field);
10793
10832
  }
10794
10833
  data.query = data.query.replace(/,count\:.+/, "}");
10795
- // 字段要根据请求参数动态生成,写死为__fields后续在发送适配器中替换
10796
- data.query = data.query.replace("{_id}", "{{__fields}}");
10797
10834
  const requestAdaptor = `
10798
10835
  var dep = api.query.dep;
10799
10836
  var term = api.query.term;
@@ -10803,11 +10840,10 @@ async function getDeferApi(field, ctx) {
10803
10840
  var sort = "";
10804
10841
  if (dep) {
10805
10842
  objectName = "${refObjectName}";
10806
- fields = "_id,value:${ctx.valueField},label:${ctx.labelField},children";
10807
10843
  filters = [['parent', '=', dep]];
10808
10844
  sort = "${ctx.sort}";
10809
10845
  }
10810
- api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__fields}/g, fields).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
10846
+ api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
10811
10847
  return api;
10812
10848
  `;
10813
10849
  const adaptor = `
@@ -11161,6 +11197,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
11161
11197
  }
11162
11198
  });
11163
11199
 
11200
+ // 把自动填充规则中依赖的字段也加到api请求中
11201
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
11202
+ if (autoFillMapping && autoFillMapping.length) {
11203
+ autoFillMapping.forEach(function (item) {
11204
+ if(!___namespace.find(tableFields, function(f){
11205
+ return f.name === item.from
11206
+ })){
11207
+ tableFields.push(refObjectConfig.fields[item.from]);
11208
+ }
11209
+ });
11210
+ }
11211
+
11164
11212
  ___namespace.each(refObjectConfig.fields, function (field) {
11165
11213
  if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
11166
11214
  searchableFields.push(field.name);
@@ -11417,7 +11465,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
11417
11465
  if(refObjectConfig.name === 'organizations'){
11418
11466
  labelFieldName = 'name';
11419
11467
  }
11420
- pickerSchema = await getTableSchema$1(tableFields, {
11468
+ pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
11421
11469
  labelFieldName,
11422
11470
  top: top,
11423
11471
  isLookup: true,
@@ -11592,22 +11640,31 @@ async function lookupToAmisSelect(field, readonly, ctx){
11592
11640
 
11593
11641
  let apiInfo;
11594
11642
  let defaultValueOptionsQueryData;
11643
+ const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
11595
11644
  if(referenceTo){
11596
- // 字段值单独走一个请求合并到source的同一个GraphQL接口中
11597
- defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
11645
+ let queryFields = [
11598
11646
  Object.assign({}, referenceTo.labelField, {alias: 'label'}),
11599
11647
  Object.assign({}, referenceTo.valueField, {alias: 'value'})
11600
- ], {
11648
+ ];
11649
+
11650
+ // 把自动填充规则中依赖的字段也加到api请求中
11651
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
11652
+ if (autoFillMapping && autoFillMapping.length) {
11653
+ autoFillMapping.forEach(function (item) {
11654
+ queryFields.push(refObjectConfig.fields[item.from]);
11655
+ });
11656
+ }
11657
+
11658
+ // 字段值单独走一个请求合并到source的同一个GraphQL接口中
11659
+ defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, queryFields, {
11660
+ expand: false,
11601
11661
  alias: "defaultValueOptions",
11602
11662
  filters: "{__options_filters}",
11603
11663
  count: false
11604
11664
  });
11605
11665
  apiInfo = await getApi({
11606
11666
  name: referenceTo.objectName
11607
- }, null, [
11608
- Object.assign({}, referenceTo.labelField, {alias: 'label'}),
11609
- Object.assign({}, referenceTo.valueField, {alias: 'value'})
11610
- ], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
11667
+ }, null, queryFields, {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
11611
11668
 
11612
11669
  apiInfo.adaptor = `
11613
11670
  const data = payload.data;
@@ -11631,7 +11688,6 @@ async function lookupToAmisSelect(field, readonly, ctx){
11631
11688
  };
11632
11689
  }
11633
11690
 
11634
- const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
11635
11691
  let listView = getLookupListView(refObjectConfig);
11636
11692
 
11637
11693
  let listviewFilter = getListViewFilter(listView);
@@ -11817,13 +11873,13 @@ async function getApi(object, recordId, fields, options){
11817
11873
  }
11818
11874
 
11819
11875
  async function getAutoFill(field, refObject) {
11820
- let autoFillMapping = field.auto_fill_mapping;
11876
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
11821
11877
  if (autoFillMapping && autoFillMapping.length) {
11822
11878
  let fillMapping = {};
11823
- let fieldsForApi = [];
11879
+ // let fieldsForApi = [];
11824
11880
  autoFillMapping.forEach(function (item) {
11825
11881
  fillMapping[item.to] = `\${${item.from}}`;
11826
- fieldsForApi.push(item.from);
11882
+ // fieldsForApi.push(item.from);
11827
11883
  });
11828
11884
  // let api = {
11829
11885
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
@@ -12017,7 +12073,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
12017
12073
  actions: false
12018
12074
  });
12019
12075
  }else {
12020
- pickerSchema = await getTableSchema$1(tableFields, {
12076
+ pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
12021
12077
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
12022
12078
  top: top,
12023
12079
  isLookup: true,
@@ -13164,15 +13220,15 @@ var index = /*#__PURE__*/Object.freeze({
13164
13220
  /*
13165
13221
  * @Author: baozhoutao@steedos.com
13166
13222
  * @Date: 2022-05-26 16:02:08
13167
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
13168
- * @LastEditTime: 2023-11-29 17:48:27
13223
+ * @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
13224
+ * @LastEditTime: 2024-02-25 14:13:10
13169
13225
  * @Description:
13170
13226
  */
13171
13227
 
13172
13228
  const getFieldSchemaArray = (formFields, ctx) => {
13173
13229
  let fieldSchemaArray = [];
13174
13230
  fieldSchemaArray.length = 0;
13175
- const recordId = ctx && ctx.recordId;
13231
+ ctx && ctx.recordId;
13176
13232
 
13177
13233
  ___namespace.forEach(formFields, (field) => {
13178
13234
  if (!field.group || field.group == 'null' || field.group == '-')
@@ -13185,9 +13241,7 @@ const getFieldSchemaArray = (formFields, ctx) => {
13185
13241
  }
13186
13242
 
13187
13243
  let forceHidden = false;
13188
- if(!recordId && field.readonly && !ctx.isEditor){
13189
- // 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
13190
- // 表单只读时所有字段都是readonly,设计器中如果forceHidden会造成整个表单在只读的时候显示为空白了,所以要排除掉
13244
+ if(ctx.omitReadonlyFields && field.readonly){
13191
13245
  forceHidden = true;
13192
13246
  }
13193
13247
 
@@ -14158,6 +14212,7 @@ async function getForm(props, mode = "edit", formId) {
14158
14212
  async function getButtonActions(props, mode) {
14159
14213
  let actions = [];
14160
14214
  let primaryKey = getTablePrimaryKey(props);
14215
+ let tableServiceId = getComponentId("table_service", props.id);
14161
14216
  let formId = getComponentId("form", props.id);
14162
14217
  let dialogId = getComponentId("dialog", props.id);
14163
14218
  let buttonNextId = getComponentId("button_next", props.id);
@@ -14474,7 +14529,30 @@ async function getButtonActions(props, mode) {
14474
14529
  // };
14475
14530
  // 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
14476
14531
  // actions = [actionNewLine, actionShowEditDialog];
14477
- actions = [actionShowEditDialog];
14532
+ if (props.enableDialog === false) {
14533
+ actions = [
14534
+ {
14535
+ "actionType": "custom",
14536
+ "script": `
14537
+ let scope = event.context.scoped;
14538
+ let __wrapperServiceId = "${tableServiceId}";
14539
+ let wrapperService = scope.getComponentById(__wrapperServiceId);
14540
+ let wrapperServiceData = wrapperService.getData();
14541
+ let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
14542
+ lastestFieldValue.push({})
14543
+ doAction({
14544
+ "componentId": "${props.id}",
14545
+ "actionType": "setValue",
14546
+ "args": {
14547
+ "value": lastestFieldValue
14548
+ }
14549
+ });
14550
+ `
14551
+ }
14552
+ ];
14553
+ }else {
14554
+ actions = [actionShowEditDialog];
14555
+ }
14478
14556
  }
14479
14557
  else if (mode == "edit") {
14480
14558
  actions = [actionShowEditDialog];
@@ -14706,31 +14784,34 @@ const getAmisInputTableSchema = async (props) => {
14706
14784
  let inlineEditMode = props.inlineEditMode;
14707
14785
  let showAsInlineEditMode = inlineEditMode && props.editable;
14708
14786
  if (showOperation) {
14709
- if (props.editable) {
14710
- let showEditButton = true;
14711
- if (showAsInlineEditMode) {
14712
- // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
14713
- showEditButton = true;
14714
- // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
14715
- // if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
14716
- // showEditButton = true;
14717
- // }
14718
- // else {
14719
- // showEditButton = false;
14720
- // }
14787
+ if (props.enableDialog !== false) {
14788
+ if (props.editable) {
14789
+ let showEditButton = true;
14790
+ if (showAsInlineEditMode) {
14791
+ // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
14792
+ showEditButton = true;
14793
+ // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
14794
+ // if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
14795
+ // showEditButton = true;
14796
+ // }
14797
+ // else {
14798
+ // showEditButton = false;
14799
+ // }
14800
+ }
14801
+ // 编辑时显示编辑按钮
14802
+ if (showEditButton) {
14803
+ let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
14804
+ buttonsForColumnOperations.push(buttonEditSchema);
14805
+ }
14721
14806
  }
14722
- // 编辑时显示编辑按钮
14723
- if (showEditButton) {
14724
- let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
14725
- buttonsForColumnOperations.push(buttonEditSchema);
14807
+ else {
14808
+ // 只读时显示查看按钮
14809
+ // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
14810
+ let buttonViewSchema = await getButtonView(props);
14811
+ buttonsForColumnOperations.push(buttonViewSchema);
14726
14812
  }
14727
14813
  }
14728
- else {
14729
- // 只读时显示查看按钮
14730
- // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
14731
- let buttonViewSchema = await getButtonView(props);
14732
- buttonsForColumnOperations.push(buttonViewSchema);
14733
- }
14814
+
14734
14815
  if (props.removable) {
14735
14816
  let buttonDeleteSchema = await getButtonDelete(props);
14736
14817
  buttonsForColumnOperations.push(buttonDeleteSchema);