@steedos-widgets/amis-object 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.
@@ -2649,6 +2649,12 @@ body.sidebar #sidebar {
2649
2649
  .steedos-input-table .antd-DropDown-popover .antd-PopOver-overlay {
2650
2650
  display: none;
2651
2651
  }
2652
+ .steedos-input-table .antd-Table-table .antd-Table-placeholder {
2653
+ display: none;
2654
+ }
2655
+ .steedos-input-table .antd-Table-table thead > tr > th {
2656
+ border-right: none;
2657
+ }
2652
2658
 
2653
2659
 
2654
2660
  .steedos-record-selected {
@@ -4834,7 +4834,8 @@ instance
4834
4834
  }
4835
4835
  });
4836
4836
 
4837
- async function getQuickEditSchema(field, options){
4837
+ async function getQuickEditSchema(object, columnField, options){
4838
+ let field = object.fields[columnField.name];
4838
4839
  //判断在amis3.2以上环境下,放开批量编辑与lookup的单元格编辑
4839
4840
  let isAmisVersionforBatchEdit = false;
4840
4841
  if(window.amisRequire && window.amisRequire('amis')){
@@ -5302,7 +5303,7 @@ function getFieldWidth(width){
5302
5303
  }
5303
5304
  }
5304
5305
 
5305
- async function getTableColumns$1(fields, options){
5306
+ async function getTableColumns$1(object, fields, options){
5306
5307
  const columns = [];
5307
5308
  if(!options.isLookup && !options.isInputTable){
5308
5309
  if(!options.enable_tree){
@@ -5316,7 +5317,7 @@ async function getTableColumns$1(fields, options){
5316
5317
  continue;
5317
5318
  }
5318
5319
  //增加quickEdit属性,实现快速编辑
5319
- const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
5320
+ const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
5320
5321
  let className = "";
5321
5322
  const bowserType = getBowserType();
5322
5323
  if(bowserType === "Safari"){
@@ -5888,7 +5889,7 @@ async function getDefaultCrudCard(columns, options) {
5888
5889
  return card;
5889
5890
  }
5890
5891
 
5891
- async function getTableSchema$1(fields, options){
5892
+ async function getTableSchema$1(object, fields, options){
5892
5893
  if(!options){
5893
5894
  options = {};
5894
5895
  }
@@ -5910,7 +5911,7 @@ async function getTableSchema$1(fields, options){
5910
5911
  columns = await getMobileTableColumns(fields, options);
5911
5912
  }
5912
5913
  else {
5913
- columns = await getTableColumns$1(fields, options);
5914
+ columns = await getTableColumns$1(object, fields, options);
5914
5915
 
5915
5916
  if(listSchema.mode === "cards"){
5916
5917
  let card = listSchema.card;
@@ -11998,7 +11999,7 @@ async function getObjectCRUD(objectSchema, fields, options){
11998
11999
  crudId: listSchema.id || id, enable_tree: objectSchema.enable_tree
11999
12000
  }, options);
12000
12001
  tableOptions.amisData = createObject(options.amisData || {}, {});
12001
- const table = await getTableSchema$1(fields, tableOptions);
12002
+ const table = await getTableSchema$1(objectSchema, fields, tableOptions);
12002
12003
  // delete table.mode;
12003
12004
  //image与avatar需要在提交修改时特别处理
12004
12005
  const imageNames = _$1__default["default"].compact(_$1__default["default"].map(_$1__default["default"].filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
@@ -12265,7 +12266,7 @@ async function getObjectForm(objectSchema, ctx){
12265
12266
  body: {
12266
12267
  type: 'wrapper',
12267
12268
  className: 'p-0 m-0',
12268
- body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
12269
+ body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true})),
12269
12270
  hiddenOn: "${editFormInited != true}",
12270
12271
  },
12271
12272
  panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
@@ -12873,8 +12874,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
12873
12874
  /*
12874
12875
  * @Author: baozhoutao@steedos.com
12875
12876
  * @Date: 2022-07-05 15:55:39
12876
- * @LastEditors: baozhoutao@steedos.com
12877
- * @LastEditTime: 2024-02-18 16:05:21
12877
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
12878
+ * @LastEditTime: 2024-02-23 16:37:06
12878
12879
  * @Description:
12879
12880
  */
12880
12881
 
@@ -13222,6 +13223,7 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
13222
13223
  let fields = [];
13223
13224
  for (const column of columns) {
13224
13225
  if (_$1.isString(column)) {
13226
+ let columnField;
13225
13227
  if (column.indexOf('.') > 0) {
13226
13228
  const fieldName = column.split('.')[0];
13227
13229
  const displayName = column.split('.')[1];
@@ -13229,23 +13231,30 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
13229
13231
  if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to)) {
13230
13232
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
13231
13233
  const rfFieldInfo = rfUiSchema.fields[displayName];
13232
- fields.push(Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx));
13234
+ columnField = Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx);
13233
13235
  }else if(filedInfo && filedInfo.type === 'object'){
13234
- fields.push(uiSchema.fields[column]);
13236
+ columnField = uiSchema.fields[column];
13235
13237
  }
13236
13238
  } else {
13237
13239
  if (uiSchema.fields[column]) {
13238
- fields.push(Object.assign({}, uiSchema.fields[column], ctx));
13240
+ columnField = Object.assign({}, uiSchema.fields[column], ctx);
13239
13241
  }
13240
13242
  else if(ctx.extra){
13241
13243
  // 配置列表视图extra_columns时允许字段是hidden的,hidden的字段在uiSchema.fields中不存在
13242
- fields.push({
13244
+ columnField = {
13243
13245
  extra: true,
13244
13246
  name: column
13245
- });
13247
+ };
13246
13248
  }
13247
13249
  }
13250
+ if(columnField){
13251
+ // 列上的字段不认uiSchema.fields中定义的amis属性
13252
+ columnField = Object.assign({}, columnField, {amis: undefined});
13253
+ fields.push(columnField);
13254
+ }
13255
+
13248
13256
  } else if (_$1.isObject(column)) {
13257
+ let columnField;
13249
13258
  if (column.field.indexOf('.') > 0) {
13250
13259
  const fieldName = column.field.split('.')[0];
13251
13260
  const displayName = column.field.split('.')[1];
@@ -13253,33 +13262,34 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
13253
13262
  if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to)) {
13254
13263
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
13255
13264
  const rfFieldInfo = rfUiSchema.fields[displayName];
13256
- fields.push(Object.assign({}, rfFieldInfo, ctx,
13265
+ columnField = Object.assign({}, rfFieldInfo, ctx,
13257
13266
  { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } },
13258
13267
  {
13259
13268
  width: column.width,
13260
- wrap: column.wrap, // wrap = true 是没效果的
13261
- amis: column.amis
13269
+ wrap: column.wrap // wrap = true 是没效果的
13262
13270
  }
13263
- ));
13271
+ );
13264
13272
  }
13265
13273
  } else {
13266
13274
  if (uiSchema.fields[column.field]) {
13267
- fields.push(
13268
- Object.assign({}, uiSchema.fields[column.field], ctx, {
13269
- width: column.width,
13270
- wrap: column.wrap, // wrap = true 是没效果的
13271
- amis: column.amis
13272
- })
13273
- );
13275
+ columnField = Object.assign({}, uiSchema.fields[column.field], ctx, {
13276
+ width: column.width,
13277
+ wrap: column.wrap // wrap = true 是没效果的
13278
+ });
13274
13279
  }
13275
13280
  else if(ctx.extra){
13276
13281
  // 配置列表视图extra_columns时允许字段是hidden的,hidden的字段在uiSchema.fields中不存在
13277
- fields.push({
13282
+ columnField = {
13278
13283
  extra: true,
13279
13284
  name: column.field
13280
- });
13285
+ };
13281
13286
  }
13282
13287
  }
13288
+ if(columnField){
13289
+ // 列上的字段不认uiSchema.fields中定义的amis属性,用列上配置的amis覆盖
13290
+ columnField = Object.assign({}, columnField, {amis: column.amis});
13291
+ fields.push(columnField);
13292
+ }
13283
13293
  }
13284
13294
  }
13285
13295
  return fields;
@@ -13853,7 +13863,22 @@ async function getSelectUserSchema(field, readonly, ctx) {
13853
13863
  async function getSource(field, ctx) {
13854
13864
  // 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} }"
13855
13865
  const refObjectName = ctx.objectName;
13856
- const data = await getFindQuery({ name: refObjectName }, null, [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }], {
13866
+ let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
13867
+ let defaultOptionQueryFields = optionQueryFields.filter(function (f) { return f.name !== "children" });
13868
+
13869
+ // 把自动填充规则中依赖的字段也加到api请求中
13870
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
13871
+ if (autoFillMapping && autoFillMapping.length) {
13872
+ autoFillMapping.forEach(function (item) {
13873
+ if(item.from !== "children"){
13874
+ optionQueryFields.push({ name: item.from });
13875
+ }
13876
+ defaultOptionQueryFields.push({ name: item.from });
13877
+ });
13878
+ }
13879
+
13880
+ const data = await getFindQuery({ name: refObjectName }, null, optionQueryFields, {
13881
+ expand: false,
13857
13882
  alias: "options",
13858
13883
  filters: "{__filters}"
13859
13884
  });
@@ -13864,7 +13889,8 @@ async function getSource(field, ctx) {
13864
13889
  // });
13865
13890
  // childrenData.query = childrenData.query.replace(/,count\:.+/, "}");
13866
13891
  // data.query = data.query.replace(/}$/, "," + childrenData.query.replace(/{(.+)}/, "$1}"));
13867
- const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }], {
13892
+ const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, defaultOptionQueryFields, {
13893
+ expand: false,
13868
13894
  alias: "defaultValueOptions",
13869
13895
  filters: "{__options_filters}"
13870
13896
  });
@@ -13931,7 +13957,20 @@ async function getSource(field, ctx) {
13931
13957
  async function getDeferApi(field, ctx) {
13932
13958
  // data.query 最终格式 "{ \toptions:{__object_name}(filters:{__filters}){{__fields}} }"
13933
13959
  const refObjectName = ctx.objectName;
13934
- const data = await getFindQuery({ name: "{__object_name}" }, null, [], {
13960
+ let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
13961
+
13962
+ // 把自动填充规则中依赖的字段也加到api请求中
13963
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
13964
+ if (autoFillMapping && autoFillMapping.length) {
13965
+ autoFillMapping.forEach(function (item) {
13966
+ if(item.from !== "children"){
13967
+ optionQueryFields.push({ name: item.from });
13968
+ }
13969
+ });
13970
+ }
13971
+
13972
+ const data = await getFindQuery({ name: "{__object_name}" }, null, optionQueryFields, {
13973
+ expand: false,
13935
13974
  alias: "options",
13936
13975
  // filters: "{__filters}",
13937
13976
  queryOptions: `filters: {__filters}, sort: "{__sort}"`
@@ -13946,8 +13985,6 @@ async function getDeferApi(field, ctx) {
13946
13985
  filters = filters(field);
13947
13986
  }
13948
13987
  data.query = data.query.replace(/,count\:.+/, "}");
13949
- // 字段要根据请求参数动态生成,写死为__fields后续在发送适配器中替换
13950
- data.query = data.query.replace("{_id}", "{{__fields}}");
13951
13988
  const requestAdaptor = `
13952
13989
  var dep = api.query.dep;
13953
13990
  var term = api.query.term;
@@ -13957,11 +13994,10 @@ async function getDeferApi(field, ctx) {
13957
13994
  var sort = "";
13958
13995
  if (dep) {
13959
13996
  objectName = "${refObjectName}";
13960
- fields = "_id,value:${ctx.valueField},label:${ctx.labelField},children";
13961
13997
  filters = [['parent', '=', dep]];
13962
13998
  sort = "${ctx.sort}";
13963
13999
  }
13964
- 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());
14000
+ api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
13965
14001
  return api;
13966
14002
  `;
13967
14003
  const adaptor = `
@@ -14315,6 +14351,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
14315
14351
  }
14316
14352
  });
14317
14353
 
14354
+ // 把自动填充规则中依赖的字段也加到api请求中
14355
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
14356
+ if (autoFillMapping && autoFillMapping.length) {
14357
+ autoFillMapping.forEach(function (item) {
14358
+ if(!_$1__namespace.find(tableFields, function(f){
14359
+ return f.name === item.from
14360
+ })){
14361
+ tableFields.push(refObjectConfig.fields[item.from]);
14362
+ }
14363
+ });
14364
+ }
14365
+
14318
14366
  _$1__namespace.each(refObjectConfig.fields, function (field) {
14319
14367
  if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
14320
14368
  searchableFields.push(field.name);
@@ -14571,7 +14619,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
14571
14619
  if(refObjectConfig.name === 'organizations'){
14572
14620
  labelFieldName = 'name';
14573
14621
  }
14574
- pickerSchema = await getTableSchema$1(tableFields, {
14622
+ pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
14575
14623
  labelFieldName,
14576
14624
  top: top,
14577
14625
  isLookup: true,
@@ -14746,22 +14794,31 @@ async function lookupToAmisSelect(field, readonly, ctx){
14746
14794
 
14747
14795
  let apiInfo;
14748
14796
  let defaultValueOptionsQueryData;
14797
+ const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
14749
14798
  if(referenceTo){
14750
- // 字段值单独走一个请求合并到source的同一个GraphQL接口中
14751
- defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
14799
+ let queryFields = [
14752
14800
  Object.assign({}, referenceTo.labelField, {alias: 'label'}),
14753
14801
  Object.assign({}, referenceTo.valueField, {alias: 'value'})
14754
- ], {
14802
+ ];
14803
+
14804
+ // 把自动填充规则中依赖的字段也加到api请求中
14805
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
14806
+ if (autoFillMapping && autoFillMapping.length) {
14807
+ autoFillMapping.forEach(function (item) {
14808
+ queryFields.push(refObjectConfig.fields[item.from]);
14809
+ });
14810
+ }
14811
+
14812
+ // 字段值单独走一个请求合并到source的同一个GraphQL接口中
14813
+ defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, queryFields, {
14814
+ expand: false,
14755
14815
  alias: "defaultValueOptions",
14756
14816
  filters: "{__options_filters}",
14757
14817
  count: false
14758
14818
  });
14759
14819
  apiInfo = await getApi({
14760
14820
  name: referenceTo.objectName
14761
- }, null, [
14762
- Object.assign({}, referenceTo.labelField, {alias: 'label'}),
14763
- Object.assign({}, referenceTo.valueField, {alias: 'value'})
14764
- ], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
14821
+ }, null, queryFields, {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
14765
14822
 
14766
14823
  apiInfo.adaptor = `
14767
14824
  const data = payload.data;
@@ -14785,7 +14842,6 @@ async function lookupToAmisSelect(field, readonly, ctx){
14785
14842
  };
14786
14843
  }
14787
14844
 
14788
- const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
14789
14845
  let listView = getLookupListView(refObjectConfig);
14790
14846
 
14791
14847
  let listviewFilter = getListViewFilter(listView);
@@ -14971,13 +15027,13 @@ async function getApi(object, recordId, fields, options){
14971
15027
  }
14972
15028
 
14973
15029
  async function getAutoFill(field, refObject) {
14974
- let autoFillMapping = field.auto_fill_mapping;
15030
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
14975
15031
  if (autoFillMapping && autoFillMapping.length) {
14976
15032
  let fillMapping = {};
14977
- let fieldsForApi = [];
15033
+ // let fieldsForApi = [];
14978
15034
  autoFillMapping.forEach(function (item) {
14979
15035
  fillMapping[item.to] = `\${${item.from}}`;
14980
- fieldsForApi.push(item.from);
15036
+ // fieldsForApi.push(item.from);
14981
15037
  });
14982
15038
  // let api = {
14983
15039
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
@@ -15171,7 +15227,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
15171
15227
  actions: false
15172
15228
  });
15173
15229
  }else {
15174
- pickerSchema = await getTableSchema$1(tableFields, {
15230
+ pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
15175
15231
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
15176
15232
  top: top,
15177
15233
  isLookup: true,
@@ -16318,15 +16374,15 @@ var index = /*#__PURE__*/Object.freeze({
16318
16374
  /*
16319
16375
  * @Author: baozhoutao@steedos.com
16320
16376
  * @Date: 2022-05-26 16:02:08
16321
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
16322
- * @LastEditTime: 2023-11-29 17:48:27
16377
+ * @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
16378
+ * @LastEditTime: 2024-02-25 14:13:10
16323
16379
  * @Description:
16324
16380
  */
16325
16381
 
16326
16382
  const getFieldSchemaArray = (formFields, ctx) => {
16327
16383
  let fieldSchemaArray = [];
16328
16384
  fieldSchemaArray.length = 0;
16329
- const recordId = ctx && ctx.recordId;
16385
+ ctx && ctx.recordId;
16330
16386
 
16331
16387
  _$1__namespace.forEach(formFields, (field) => {
16332
16388
  if (!field.group || field.group == 'null' || field.group == '-')
@@ -16339,9 +16395,7 @@ const getFieldSchemaArray = (formFields, ctx) => {
16339
16395
  }
16340
16396
 
16341
16397
  let forceHidden = false;
16342
- if(!recordId && field.readonly && !ctx.isEditor){
16343
- // 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
16344
- // 表单只读时所有字段都是readonly,设计器中如果forceHidden会造成整个表单在只读的时候显示为空白了,所以要排除掉
16398
+ if(ctx.omitReadonlyFields && field.readonly){
16345
16399
  forceHidden = true;
16346
16400
  }
16347
16401
 
@@ -17312,6 +17366,7 @@ async function getForm(props, mode = "edit", formId) {
17312
17366
  async function getButtonActions(props, mode) {
17313
17367
  let actions = [];
17314
17368
  let primaryKey = getTablePrimaryKey(props);
17369
+ let tableServiceId = getComponentId("table_service", props.id);
17315
17370
  let formId = getComponentId("form", props.id);
17316
17371
  let dialogId = getComponentId("dialog", props.id);
17317
17372
  let buttonNextId = getComponentId("button_next", props.id);
@@ -17628,7 +17683,30 @@ async function getButtonActions(props, mode) {
17628
17683
  // };
17629
17684
  // 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
17630
17685
  // actions = [actionNewLine, actionShowEditDialog];
17631
- actions = [actionShowEditDialog];
17686
+ if (props.enableDialog === false) {
17687
+ actions = [
17688
+ {
17689
+ "actionType": "custom",
17690
+ "script": `
17691
+ let scope = event.context.scoped;
17692
+ let __wrapperServiceId = "${tableServiceId}";
17693
+ let wrapperService = scope.getComponentById(__wrapperServiceId);
17694
+ let wrapperServiceData = wrapperService.getData();
17695
+ let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
17696
+ lastestFieldValue.push({})
17697
+ doAction({
17698
+ "componentId": "${props.id}",
17699
+ "actionType": "setValue",
17700
+ "args": {
17701
+ "value": lastestFieldValue
17702
+ }
17703
+ });
17704
+ `
17705
+ }
17706
+ ];
17707
+ }else {
17708
+ actions = [actionShowEditDialog];
17709
+ }
17632
17710
  }
17633
17711
  else if (mode == "edit") {
17634
17712
  actions = [actionShowEditDialog];
@@ -17860,31 +17938,34 @@ const getAmisInputTableSchema = async (props) => {
17860
17938
  let inlineEditMode = props.inlineEditMode;
17861
17939
  let showAsInlineEditMode = inlineEditMode && props.editable;
17862
17940
  if (showOperation) {
17863
- if (props.editable) {
17864
- let showEditButton = true;
17865
- if (showAsInlineEditMode) {
17866
- // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
17867
- showEditButton = true;
17868
- // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
17869
- // if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
17870
- // showEditButton = true;
17871
- // }
17872
- // else {
17873
- // showEditButton = false;
17874
- // }
17941
+ if (props.enableDialog !== false) {
17942
+ if (props.editable) {
17943
+ let showEditButton = true;
17944
+ if (showAsInlineEditMode) {
17945
+ // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
17946
+ showEditButton = true;
17947
+ // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
17948
+ // if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
17949
+ // showEditButton = true;
17950
+ // }
17951
+ // else {
17952
+ // showEditButton = false;
17953
+ // }
17954
+ }
17955
+ // 编辑时显示编辑按钮
17956
+ if (showEditButton) {
17957
+ let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
17958
+ buttonsForColumnOperations.push(buttonEditSchema);
17959
+ }
17875
17960
  }
17876
- // 编辑时显示编辑按钮
17877
- if (showEditButton) {
17878
- let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
17879
- buttonsForColumnOperations.push(buttonEditSchema);
17961
+ else {
17962
+ // 只读时显示查看按钮
17963
+ // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
17964
+ let buttonViewSchema = await getButtonView(props);
17965
+ buttonsForColumnOperations.push(buttonViewSchema);
17880
17966
  }
17881
17967
  }
17882
- else {
17883
- // 只读时显示查看按钮
17884
- // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
17885
- let buttonViewSchema = await getButtonView(props);
17886
- buttonsForColumnOperations.push(buttonViewSchema);
17887
- }
17968
+
17888
17969
  if (props.removable) {
17889
17970
  let buttonDeleteSchema = await getButtonDelete(props);
17890
17971
  buttonsForColumnOperations.push(buttonDeleteSchema);
@@ -22341,9 +22422,9 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
22341
22422
  if (!appId) {
22342
22423
  appId = data.context.appId || 'admin';
22343
22424
  }
22344
- badgeText = "${ss:keyvalues.badge.value | pick:".concat(appId, " | toInt}");
22425
+ badgeText = "${keyvalues.badge.value | pick:".concat(appId, " | toInt}");
22345
22426
  if (appId == "approve_workflow") {
22346
- badgeText = "${ss:keyvalues.badge.value | pick:'workflow' | toInt}";
22427
+ badgeText = "${keyvalues.badge.value | pick:'workflow' | toInt}";
22347
22428
  }
22348
22429
  if (links) {
22349
22430
  return [2 /*return*/, {
@@ -22360,7 +22441,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
22360
22441
  schemaApi: {
22361
22442
  "method": "get",
22362
22443
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
22363
- "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 "),
22444
+ "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 \"keyvalues\": \"${ss:keyvalues}\"\n },\n \"id\": \"appMenuService\",\n \"onEvent\": {\n \"@data.changed.steedos_keyvalues\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"args\": {\n \"value\": {\n \"keyvalues\": \"${event.data.keyvalues}\"\n }\n }\n }\n ]\n }\n },\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 "),
22364
22445
  "headers": {
22365
22446
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
22366
22447
  }
@@ -22479,6 +22560,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
22479
22560
  },
22480
22561
  {
22481
22562
  "type": "dropdown-button",
22563
+ "visibleOn": "${window:innerWidth > 768}",
22482
22564
  "label": false,
22483
22565
  "trigger": "click",
22484
22566
  "level": "link",
@@ -23949,13 +24031,16 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
23949
24031
  return __generator(this, function (_a) {
23950
24032
  switch (_a.label) {
23951
24033
  case 0:
23952
- props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog, props.primaryKey, props.showOperation, props.fieldPrefix, props.autoGeneratePrimaryKeyValue, props.mode, props.disabledOn, props.disabled, props.visibleOn, props.visible, props.hiddenOn, props.hidden;
24034
+ props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog, props.primaryKey, props.showOperation, props.fieldPrefix, props.autoGeneratePrimaryKeyValue, props.mode, props.disabledOn, props.disabled, props.visibleOn, props.visible, props.hiddenOn, props.hidden, props.enableDialog;
23953
24035
  extendProps = {};
23954
24036
  if (props.disabledOn || props.disabled) {
23955
24037
  extendProps["addable"] = false;
23956
24038
  extendProps["editable"] = false;
23957
24039
  extendProps["removable"] = false;
23958
24040
  }
24041
+ if (props.enableDialog === false) {
24042
+ extendProps["inlineEditMode"] = true;
24043
+ }
23959
24044
  return [4 /*yield*/, getAmisInputTableSchema(Object.assign({}, props, extendProps))];
23960
24045
  case 1:
23961
24046
  amisSchema = _a.sent();