@steedos-widgets/sortable 1.3.4-beta.8 → 1.3.5

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.
@@ -20381,7 +20381,7 @@
20381
20381
  if(optionColor){
20382
20382
  const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
20383
20383
  const color = getContrastColor(background);
20384
- const optionColorStyle = 'background:'+background+';color:'+color;
20384
+ const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
20385
20385
  map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
20386
20386
  }else {
20387
20387
  map[optionValue] = option.label;
@@ -20642,17 +20642,17 @@
20642
20642
  }
20643
20643
 
20644
20644
  const countQuery = options.count === false ? "" : `,count:${object.name}__count(filters:{__filters})`;
20645
- const moreQuerie = options.moreQueries?.length ? ("," + options.moreQueries.map(function(item){
20646
- // 把最外层的{}去除
20647
- return item.replace(/^{/,"").replace(/}$/,"");
20648
- }).join(",")) : "";
20645
+ // const moreQuerie = options.moreQueries?.length ? ("," + options.moreQueries.map(function(item){
20646
+ // // 把最外层的{}去除
20647
+ // return item.replace(/^{/,"").replace(/}$/,"");
20648
+ // }).join(",")) : "";
20649
20649
 
20650
20650
  return {
20651
20651
  orderBy: "${orderBy}",
20652
20652
  orderDir: "${orderDir}",
20653
20653
  pageNo: "${page}",
20654
20654
  pageSize: "${perPage}",
20655
- query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}}${countQuery}${moreQuerie}}`
20655
+ query: `{${alias}:${object.name}${queryOptions}{${await getFieldsTemplate(fields, options.expand)}${treeFields}${cfsFields}}${countQuery}}`
20656
20656
  }
20657
20657
  }
20658
20658
 
@@ -21518,7 +21518,8 @@
21518
21518
  if(isLookup){
21519
21519
  searchableFieldsStoreKey += "/lookup/" + objectName;
21520
21520
  }
21521
- let defaultSearchableFields = sessionStorage.getItem(searchableFieldsStoreKey);
21521
+ searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
21522
+ let defaultSearchableFields = localStorage.getItem(searchableFieldsStoreKey);
21522
21523
  if(defaultSearchableFields){
21523
21524
  defaultSearchableFields = defaultSearchableFields.split(",");
21524
21525
  }
@@ -21587,7 +21588,8 @@
21587
21588
  if(isLookup){
21588
21589
  searchableFieldsStoreKey += "/lookup/" + objectName;
21589
21590
  }
21590
- sessionStorage.setItem(searchableFieldsStoreKey, value);
21591
+ searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
21592
+ localStorage.setItem(searchableFieldsStoreKey, value);
21591
21593
 
21592
21594
  // ===START===:当变更可搜索字段时,如果被移除的可搜索字段在本地存储中已经存入过滤条件中则应该清除本地存储中相关字段的过滤条件。
21593
21595
  const searchableFields = data.fields;
@@ -22093,7 +22095,8 @@
22093
22095
  "&": "${list_view}",
22094
22096
  "name":"",
22095
22097
  "label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
22096
- "shared":false
22098
+ "shared":false,
22099
+ "object_name": "${targetObjectName}",
22097
22100
  },
22098
22101
  "fieldsExtend": fieldsExtend$3(),
22099
22102
  "fields": fields(),
@@ -22881,7 +22884,7 @@ let resizeWindow = function(){
22881
22884
  //触发amis crud 高度重算
22882
22885
  setTimeout(()=>{
22883
22886
  window.dispatchEvent(new Event("resize"))
22884
- }, 500);
22887
+ }, 1000);
22885
22888
  }
22886
22889
  resizeWindow();
22887
22890
  // 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
@@ -23118,6 +23121,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23118
23121
  }
23119
23122
 
23120
23123
  function getObjectFooterToolbar(mainObject, formFactor, options) {
23124
+ // crud card模式与table模式两种情况下showPageInput默认值不一样,所以需要显式设置为false
23121
23125
  if (formFactor === 'SMALL') {
23122
23126
  // return [
23123
23127
  // "load-more",
@@ -23127,14 +23131,17 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23127
23131
  "switch-per-page",
23128
23132
  {
23129
23133
  "type": "pagination",
23130
- "maxButtons": 5
23134
+ "maxButtons": 5,
23135
+ "showPageInput": false
23131
23136
  }
23132
23137
  ]
23133
23138
  }else {
23134
23139
  return [
23140
+ // "statistics",
23135
23141
  {
23136
23142
  "type": "pagination",
23137
- "maxButtons": 5
23143
+ "maxButtons": 5,
23144
+ "showPageInput": false
23138
23145
  }
23139
23146
  ]
23140
23147
  }
@@ -23143,16 +23150,31 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23143
23150
  if(options && options.isRelated){
23144
23151
  return [
23145
23152
  "statistics",
23146
- "pagination"
23153
+ {
23154
+ "type": "pagination",
23155
+ "maxButtons": 10,
23156
+ "showPageInput": false
23157
+ }
23147
23158
  ]
23148
23159
 
23149
23160
  }
23150
23161
  else {
23151
- return [
23152
- "switch-per-page",
23162
+ const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
23163
+ const is_lookup = options.isLookup;
23164
+ const commonConfig = [
23153
23165
  "statistics",
23154
- "pagination"
23155
- ]
23166
+ {
23167
+ "type": "pagination",
23168
+ "maxButtons": 10,
23169
+ "showPageInput": false
23170
+ }
23171
+ ];
23172
+
23173
+ if (no_pagination && is_lookup) {
23174
+ return commonConfig;
23175
+ } else {
23176
+ return ["switch-per-page", ...commonConfig];
23177
+ }
23156
23178
  }
23157
23179
  }
23158
23180
  }
@@ -23702,10 +23724,13 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23702
23724
  const op = api.data.$self.op;
23703
23725
  if(!_.isEmpty(op)){
23704
23726
  // op不为空,表示处于字段初始编辑状态,不是点击后出现弹窗状态。
23727
+ // 这里不可以用_.pick函数让payload只返回labelField和valueField,因为字段上配置的amis autoFill功能可能依赖了其他字段
23728
+ /*
23705
23729
  const rows = _.map(payload.data.rows, (item)=>{
23706
23730
  return _.pick(item, ["${referenceTo.labelField.name}", "${referenceTo.valueField.name}"]);
23707
23731
  })
23708
23732
  payload.data.rows = rows;
23733
+ */
23709
23734
  return payload;
23710
23735
  }
23711
23736
  if(enable_tree){
@@ -23786,13 +23811,15 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23786
23811
  pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
23787
23812
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
23788
23813
  const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
23789
- if (isAllowCreate && isCreate) {
23814
+ // lookup字段配置过滤条件就强制不显示新建按钮
23815
+ let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
23816
+ if (isAllowCreate && isCreate && !isHasFilters) {
23790
23817
  const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
23791
23818
  new_button.align = "right";
23792
23819
  // 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
23793
23820
  pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
23794
23821
  }
23795
- pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
23822
+ pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar(refObjectConfig,ctx.formFactor,{isLookup: true});
23796
23823
  if (ctx.filterVisible !== false) {
23797
23824
  pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
23798
23825
  ...ctx,
@@ -23920,10 +23947,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23920
23947
  // const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
23921
23948
 
23922
23949
  let apiInfo;
23923
-
23950
+ let defaultValueOptionsQueryData;
23924
23951
  if(referenceTo){
23925
23952
  // 字段值单独走一个请求合并到source的同一个GraphQL接口中
23926
- const defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
23953
+ defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
23927
23954
  Object.assign({}, referenceTo.labelField, {alias: 'label'}),
23928
23955
  Object.assign({}, referenceTo.valueField, {alias: 'value'})
23929
23956
  ], {
@@ -23936,7 +23963,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23936
23963
  }, null, [
23937
23964
  Object.assign({}, referenceTo.labelField, {alias: 'label'}),
23938
23965
  Object.assign({}, referenceTo.valueField, {alias: 'value'})
23939
- ], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`, moreQueries: [defaultValueOptionsQueryData.query]});
23966
+ ], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
23940
23967
 
23941
23968
  apiInfo.adaptor = `
23942
23969
  const data = payload.data;
@@ -24030,11 +24057,16 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24030
24057
  var optionsFiltersOp = "${field.multiple ? "in" : "="}";
24031
24058
  var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
24032
24059
  if (defaultValue && !api.data.$term) {
24060
+ const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
24061
+ const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
24033
24062
  // 字段值单独请求,没值的时候在请求中返回空
24034
24063
  optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
24035
24064
  if(filters.length > 0){
24036
24065
  optionsFilters = [filters, optionsFilters];
24037
24066
  }
24067
+ if(defaultValueOptionsQuery){
24068
+ api.data.query = "{"+api.data.query.replace(/^{/,"").replace(/}$/,"")+","+defaultValueOptionsQuery+"}";
24069
+ }
24038
24070
  }
24039
24071
  api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));
24040
24072
  return api;
@@ -24076,7 +24108,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24076
24108
  disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
24077
24109
  // labelField: labelField,
24078
24110
  // valueField: valueField,
24079
- source: apiInfo,
24111
+ // source: apiInfo,
24080
24112
  autoComplete: apiInfo,
24081
24113
  searchable: true,
24082
24114
  };
@@ -24155,10 +24187,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24155
24187
 
24156
24188
  const refObject = await getUISchema(referenceTo.objectName);
24157
24189
 
24158
- // 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
24159
- // 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
24160
- // TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
24161
- if(refObject.enable_enhanced_lookup == true && lodash.exports.isEmpty(field.depend_on)){
24190
+ // 优先取字段中配置的enable_enhanced_lookup,字段上没配置时,才从对象上取enable_enhanced_lookup属性
24191
+ let enableEnhancedLookup = lodash.exports.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
24192
+ // 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
24193
+ if(enableEnhancedLookup == true){
24162
24194
  return await lookupToAmisPicker(field, readonly, ctx);
24163
24195
  }else if(refObject.enable_tree) {
24164
24196
  return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
@@ -24471,8 +24503,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24471
24503
  /*
24472
24504
  * @Author: baozhoutao@steedos.com
24473
24505
  * @Date: 2022-10-28 14:15:09
24474
- * @LastEditors: baozhoutao@steedos.com
24475
- * @LastEditTime: 2022-11-02 18:06:16
24506
+ * @LastEditors: liaodaxue
24507
+ * @LastEditTime: 2023-10-30 17:51:54
24476
24508
  * @Description:
24477
24509
  */
24478
24510
 
@@ -24523,11 +24555,26 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24523
24555
  useChunk: false, // 关闭分块上传
24524
24556
  receiver: {
24525
24557
  method: "post",
24558
+ dataType: "form-data",
24526
24559
  url: `\${context.rootUrl}/s3/${tableName}`,
24527
- data: {
24528
- $: "$$",
24529
- context: `\${context}`,
24530
- },
24560
+ requestAdaptor: `
24561
+ const { _master, global,context } = api.body;
24562
+ // const { recordId, objectName } = _master;
24563
+ const { spaceId, userId, user } = global;
24564
+ /*
24565
+ record_id: recordId,
24566
+ parent: recordId,
24567
+ object_name: objectName,
24568
+ owner_name: user.name,
24569
+ space: spaceId,
24570
+ owner: userId
24571
+ */
24572
+ // 参考platform 2.2版本,附件字段保存时cfs.files.filerecord、cfs.images.filerecord表中的metadata下只保存space、owner两个属性值。
24573
+ api.data.append('space', spaceId);
24574
+ api.data.append('owner', userId);
24575
+
24576
+ return api;
24577
+ `,
24531
24578
  adaptor: `
24532
24579
  const { context } = api.body;
24533
24580
  var rootUrl = context.rootUrl + "/api/files/${tableName}/";
@@ -24608,8 +24655,6 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24608
24655
  }
24609
24656
 
24610
24657
  async function convertSFieldToAmisField(field, readonly, ctx) {
24611
- // console.log('convertSFieldToAmisField====>', field, readonly, ctx)
24612
- const isMobile = window.innerWidth <= 768;
24613
24658
  // 创建人和修改人、创建时间和修改时间不显示
24614
24659
  if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
24615
24660
  return;
@@ -24698,26 +24743,33 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24698
24743
  };
24699
24744
  break;
24700
24745
  case 'date':
24701
- convertData = isMobile && !readonly ? {
24702
- type: "native-date",
24703
- pipeIn: (value, data) => {
24704
- if (value) {
24705
- value = moment(value).utc().format('YYYY-MM-DD');
24706
- return value;
24707
- } else {
24708
- return "";
24709
- }
24710
-
24711
- },
24712
- pipeOut: (value, oldValue, data) => {
24713
- if (value) {
24714
- value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
24715
- return value;
24716
- } else {
24717
- return "";
24718
- }
24719
- }
24720
- } : {
24746
+ // convertData = isMobile && !readonly ? {
24747
+ // type: "native-date",
24748
+ // pipeIn: (value, data) => {
24749
+ // if (value) {
24750
+ // value = moment(value).utc().format('YYYY-MM-DD');
24751
+ // return value;
24752
+ // } else {
24753
+ // return "";
24754
+ // }
24755
+
24756
+ // },
24757
+ // pipeOut: (value, oldValue, data) => {
24758
+ // if (value) {
24759
+ // value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
24760
+ // return value;
24761
+ // } else {
24762
+ // return "";
24763
+ // }
24764
+ // }
24765
+ // } : {
24766
+ // type: getAmisStaticFieldType('date', readonly),
24767
+ // inputFormat: "YYYY-MM-DD",
24768
+ // format:'YYYY-MM-DDT00:00:00.000[Z]',
24769
+ // tpl: readonly ? Tpl.getDateTpl(field) : null,
24770
+ // // utc: true
24771
+ // }
24772
+ convertData = {
24721
24773
  type: getAmisStaticFieldType('date', readonly),
24722
24774
  inputFormat: "YYYY-MM-DD",
24723
24775
  format:'YYYY-MM-DDT00:00:00.000[Z]',
@@ -24736,43 +24788,51 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24736
24788
  };
24737
24789
  break;
24738
24790
  case 'datetime':
24739
- convertData = isMobile && !readonly ? {
24740
- type: "combo",
24741
- pipeIn: (value, data) => {
24742
- let revalue = {};
24743
- if (value && value != "Invalid date") {
24744
- value = moment(value).format('YYYY-MM-DD HH:mm:ss');
24745
- revalue[field.name + "-native-date"] = value.split(' ')[0];
24746
- revalue[field.name + "-native-time"] = value.split(' ')[1];
24747
- } else {
24748
- revalue[field.name + "-native-date"] = "";
24749
- revalue[field.name + "-native-time"] = "";
24750
- }
24751
- return revalue;
24752
- },
24753
- pipeOut: (value, oldValue, data) => {
24754
- let revalue = "";
24755
- if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
24756
- revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
24757
- revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
24758
- }
24759
- return revalue;
24760
- },
24761
- items: [
24762
- {
24763
- type: "native-date",
24764
- name: field.name + "-native-date",
24765
- className: "steedos-native-date",
24766
- value: ""
24767
- },
24768
- {
24769
- type: "native-time",
24770
- name: field.name + "-native-time",
24771
- className: "steedos-native-time",
24772
- value: ""
24773
- }
24774
- ]
24775
- } : {
24791
+ // convertData = isMobile && !readonly ? {
24792
+ // type: "combo",
24793
+ // pipeIn: (value, data) => {
24794
+ // let revalue = {};
24795
+ // if (value && value != "Invalid date") {
24796
+ // value = moment(value).format('YYYY-MM-DD HH:mm:ss');
24797
+ // revalue[field.name + "-native-date"] = value.split(' ')[0];
24798
+ // revalue[field.name + "-native-time"] = value.split(' ')[1];
24799
+ // } else {
24800
+ // revalue[field.name + "-native-date"] = "";
24801
+ // revalue[field.name + "-native-time"] = "";
24802
+ // }
24803
+ // return revalue;
24804
+ // },
24805
+ // pipeOut: (value, oldValue, data) => {
24806
+ // let revalue = "";
24807
+ // if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
24808
+ // revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
24809
+ // revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
24810
+ // }
24811
+ // return revalue;
24812
+ // },
24813
+ // items: [
24814
+ // {
24815
+ // type: "native-date",
24816
+ // name: field.name + "-native-date",
24817
+ // className: "steedos-native-date",
24818
+ // value: ""
24819
+ // },
24820
+ // {
24821
+ // type: "native-time",
24822
+ // name: field.name + "-native-time",
24823
+ // className: "steedos-native-time",
24824
+ // value: ""
24825
+ // }
24826
+ // ]
24827
+ // } : {
24828
+ // type: getAmisStaticFieldType('datetime', readonly),
24829
+ // inputFormat: 'YYYY-MM-DD HH:mm',
24830
+ // format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
24831
+ // tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
24832
+ // utc: true,
24833
+ // }
24834
+
24835
+ convertData = {
24776
24836
  type: getAmisStaticFieldType('datetime', readonly),
24777
24837
  inputFormat: 'YYYY-MM-DD HH:mm',
24778
24838
  format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
@@ -24792,26 +24852,34 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24792
24852
  };
24793
24853
  break;
24794
24854
  case 'time':
24795
- convertData = isMobile && !readonly ? {
24796
- type: "native-time",
24797
- pipeIn: (value, data) => {
24798
- if (value) {
24799
- value = moment(value).utc().format('HH:mm');
24800
- return value;
24801
- } else {
24802
- return "";
24803
- }
24804
-
24805
- },
24806
- pipeOut: (value, oldValue, data) => {
24807
- if (value) {
24808
- value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
24809
- return value;
24810
- } else {
24811
- return "";
24812
- }
24813
- }
24814
- } : {
24855
+ // convertData = isMobile && !readonly ? {
24856
+ // type: "native-time",
24857
+ // pipeIn: (value, data) => {
24858
+ // if (value) {
24859
+ // value = moment(value).utc().format('HH:mm');
24860
+ // return value;
24861
+ // } else {
24862
+ // return "";
24863
+ // }
24864
+
24865
+ // },
24866
+ // pipeOut: (value, oldValue, data) => {
24867
+ // if (value) {
24868
+ // value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
24869
+ // return value;
24870
+ // } else {
24871
+ // return "";
24872
+ // }
24873
+ // }
24874
+ // } : {
24875
+ // type: getAmisStaticFieldType('time', readonly),
24876
+ // inputFormat: 'HH:mm',
24877
+ // timeFormat:'HH:mm',
24878
+ // format:'1970-01-01THH:mm:00.000[Z]',
24879
+ // tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
24880
+ // // utc: true
24881
+ // }
24882
+ convertData = {
24815
24883
  type: getAmisStaticFieldType('time', readonly),
24816
24884
  inputFormat: 'HH:mm',
24817
24885
  timeFormat:'HH:mm',
@@ -24861,7 +24929,20 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24861
24929
  type: getAmisStaticFieldType('number', readonly),
24862
24930
  min: field.min,
24863
24931
  max: field.max,
24864
- precision: field.scale
24932
+ precision: field.scale,
24933
+ suffix: "%",
24934
+ pipeIn: (value, data) => {
24935
+ if(value){
24936
+ return value*100;
24937
+ }
24938
+ return value;
24939
+ },
24940
+ pipeOut: (value, oldValue, data) => {
24941
+ if(value){
24942
+ return value/100;
24943
+ }
24944
+ return value;
24945
+ },
24865
24946
  };
24866
24947
  }
24867
24948
  break;
@@ -25256,8 +25337,41 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25256
25337
  };
25257
25338
 
25258
25339
  async function getQuickEditSchema(field, options){
25259
- const quickEditId = options.objectName + "_" + field.name + "QuickEdit";//定义快速编辑的表单id,用于setvalue传值
25340
+ //判断在amis3.2以上环境下,放开批量编辑
25341
+ const isAmisVersionforBatchEdit = amisRequire('amis').version[0] >= 3 && amisRequire('amis').version[2] >= 2;
25342
+ const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
25260
25343
  var quickEditSchema = { body: [], id: quickEditId };
25344
+ //select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
25345
+ if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
25346
+ const submitEvent = {
25347
+ submit: {
25348
+ actions: [
25349
+ {
25350
+ actionType: "custom",
25351
+ script: `
25352
+ let items = _.cloneDeep(event.data.items);
25353
+ let selectedItems = _.cloneDeep(event.data.selectedItems);
25354
+ if(event.data.isBatchEdit){
25355
+ selectedItems.forEach(function(selectedItem){
25356
+ selectedItem._display.${field.name} = event.data._display.${field.name};
25357
+ doAction({actionType: 'setValue', "args": {"value": selectedItem._display},componentId: "_display_" + selectedItem._index});
25358
+ doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
25359
+ })
25360
+ }else{
25361
+ doAction({actionType: 'setValue', "args": {"value": event.data._display},componentId: "_display_" + event.data._index});
25362
+ doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
25363
+ }
25364
+ `
25365
+ },
25366
+ {
25367
+ "actionType": "closeDialog"
25368
+ }
25369
+ ]
25370
+ }
25371
+ };
25372
+ quickEditSchema.onEvent = submitEvent;
25373
+ }
25374
+
25261
25375
  if (field.disabled) {
25262
25376
  quickEditSchema = false;
25263
25377
  } else {
@@ -25274,7 +25388,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25274
25388
  {
25275
25389
  "actionType": "custom",
25276
25390
  "script": `
25277
- var _display = event.data._display;
25391
+ var _display = _.cloneDeep(event.data._display);
25278
25392
  ${displayField}
25279
25393
  doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
25280
25394
  `
@@ -25296,7 +25410,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25296
25410
  第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
25297
25411
  */
25298
25412
  TempDisplayField = `
25299
- const preData = event.data.__super.${field.name};
25413
+ const preData = _.cloneDeep(event.data.__super.${field.name});
25300
25414
  if(preData && event.data.${field.name}.length < preData.length){
25301
25415
  let deletedIndex;
25302
25416
  preData.forEach(function(item,index){
@@ -25340,7 +25454,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25340
25454
  break;
25341
25455
  case "percent":
25342
25456
  TempDisplayField = `
25343
- _display["${field.name}"] = (event.data.value * 100).toFixed(${field.scale}) + '%';
25457
+ _display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
25344
25458
  `;
25345
25459
  quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
25346
25460
  break;
@@ -25491,6 +25605,131 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25491
25605
  }
25492
25606
 
25493
25607
  });
25608
+ if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
25609
+ quickEditSchema.body.push({
25610
+ "name": "isBatchEdit",
25611
+ "type": "checkbox",
25612
+ "option": [
25613
+ {
25614
+ "type": "tpl",
25615
+ "tpl": "更新${COUNT(selectedItems)}个选定记录"
25616
+ },
25617
+ {
25618
+ "type": "spinner",
25619
+ "showOn": "${batchPermissionLoading}",
25620
+ "size": "sm",
25621
+ "className": "mr-4"
25622
+ }
25623
+ ],
25624
+ "visibleOn": "${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1 && quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}",
25625
+ "disabledOn": "${batchPermissionLoading}",
25626
+ "onEvent":{
25627
+ "change":{
25628
+ "actions":[
25629
+ {
25630
+ "actionType": "setValue",
25631
+ "componentId": quickEditId,
25632
+ "args": {
25633
+ "value":{
25634
+ "batchPermissionLoading": true
25635
+ }
25636
+ },
25637
+ "expression":"${event.data.value}"
25638
+ },
25639
+ {
25640
+ "actionType": "ajax",
25641
+ "args": {
25642
+ "api": {
25643
+ "url": "${context.rootUrl}/graphql",
25644
+ "method": "post",
25645
+ "headers": {
25646
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
25647
+ },
25648
+ "data": {
25649
+ "query": "{rows:${objectName}(filters:[\"_id\",\"in\",${selectedItems | pick:_id | split | json}]){_id,_permissions{allowEdit}}}"
25650
+ },
25651
+ "adaptor": `
25652
+ const noPermission = [];
25653
+ payload.data.rows.forEach(function (row) {
25654
+ if(!row._permissions.allowEdit){
25655
+ noPermission.push(row._id);
25656
+ }
25657
+ })
25658
+ payload.data.noPermission = noPermission;
25659
+ return payload;
25660
+ `
25661
+ }
25662
+ },
25663
+ "expression":"${event.data.value}"
25664
+ },
25665
+ {
25666
+ "actionType": "setValue",
25667
+ "componentId": quickEditId,
25668
+ "args": {
25669
+ "value":{
25670
+ "batchPermissionLoading": false
25671
+ }
25672
+ },
25673
+ "expression":"${event.data.value}"
25674
+ },
25675
+ {
25676
+ "actionType": "dialog",
25677
+ "dialog":{
25678
+ "title": "记录权限",
25679
+ "showCloseButton": false,
25680
+ "body":[
25681
+ {
25682
+ "type": "tpl",
25683
+ "tpl": "当前选中记录中,有${COUNT(noPermission)}条记录无编辑权限,是否需要批量编辑其他记录?"
25684
+ }
25685
+ ],
25686
+ "onEvent":{
25687
+ "confirm":{
25688
+ "actions":[
25689
+ {
25690
+ "actionType": "custom",
25691
+ "script": `
25692
+ const noPermission = event.data.noPermission;
25693
+ const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
25694
+ const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
25695
+ noPermission.forEach(function (item) {
25696
+ crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
25697
+ })
25698
+ `
25699
+ },
25700
+ {
25701
+ "actionType": "setValue",
25702
+ "componentId": quickEditId,
25703
+ "args": {
25704
+ "value":{
25705
+ "isBatchEdit": true
25706
+ }
25707
+ },
25708
+ }
25709
+ ]
25710
+ },
25711
+ "cancel":{
25712
+ "actions":[
25713
+ {
25714
+ "actionType": "setValue",
25715
+ "componentId": quickEditId,
25716
+ "args": {
25717
+ "value":{
25718
+ "isBatchEdit": false
25719
+ }
25720
+ },
25721
+ }
25722
+ ]
25723
+ }
25724
+ }
25725
+ },
25726
+ "expression":"${COUNT(event.data.noPermission)>0}"
25727
+ }
25728
+ ]
25729
+ }
25730
+ }
25731
+ });
25732
+ }
25494
25733
  } else {
25495
25734
  quickEditSchema = false;
25496
25735
  }
@@ -25525,6 +25764,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25525
25764
  const columns = [];
25526
25765
  if(!options.isLookup){
25527
25766
  columns.push({name: '_index',type: 'text', width: 32, placeholder: ""});
25767
+ //将_display放入crud的columns中,可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
25768
+ columns.push({name: '_display',type: 'static', width: 32, placeholder: "",id: "_display_${_index}", className: "hidden"});
25528
25769
  }
25529
25770
  const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
25530
25771
 
@@ -25556,7 +25797,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25556
25797
  {
25557
25798
  "args": {
25558
25799
  "api": {
25559
- "url": "${context.rootUrl}/api/files/files/${versions[0]}?download=true",
25800
+ "url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
25560
25801
  "method": "get",
25561
25802
  "headers": {
25562
25803
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
@@ -25603,7 +25844,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25603
25844
  else if(field.type === 'select'){
25604
25845
  const map = getSelectMap(field.options);
25605
25846
  columnItem = Object.assign({}, {
25606
- type: "mapping",
25847
+ type: "static-mapping",
25607
25848
  name: field.name,
25608
25849
  label: field.label,
25609
25850
  map: map,
@@ -25618,7 +25859,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25618
25859
  const tpl = await getFieldTpl(field, options);
25619
25860
  let type = 'text';
25620
25861
  if(tpl){
25621
- type = 'tpl';
25862
+ type = 'static';
25622
25863
  }else if(field.type === 'html'){
25623
25864
  type = 'markdown';
25624
25865
  }else if(field.type === 'url'){
@@ -25659,6 +25900,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25659
25900
  columnItem.quickEdit = quickEditSchema;
25660
25901
  columnItem.quickEditEnabledOn = "${is_system !== true}";
25661
25902
  }
25903
+ columnItem.id = `${options.objectName}_${field.name}_\${_index}`;
25662
25904
  columns.push(columnItem);
25663
25905
  }
25664
25906
  }
@@ -25937,7 +26179,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25937
26179
  }
25938
26180
  return {
25939
26181
  type: 'operation',
25940
- label: instance.t('frontend_operation'),
26182
+ label: "",
25941
26183
  fixed: 'right',
25942
26184
  labelClassName: 'text-center',
25943
26185
  className: 'text-center steedos-listview-operation w-10',
@@ -25971,23 +26213,87 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25971
26213
  }
25972
26214
  }
25973
26215
 
26216
+ async function getDefaultCrudCard(columns, options) {
26217
+ let labelFieldName = options?.labelFieldName || "name";
26218
+ let titleColumn, bodyColumns = [];
26219
+ columns.forEach(function (item) {
26220
+ delete item.quickEdit;
26221
+ delete item.width;
26222
+ if (item.name === labelFieldName) {
26223
+ titleColumn = item;
26224
+ }
26225
+ else {
26226
+ if (item.name !== "_index") {
26227
+ bodyColumns.push(item);
26228
+ }
26229
+ }
26230
+ });
26231
+ let card = {
26232
+ "header": {
26233
+ "title": titleColumn.tpl
26234
+ },
26235
+ body: bodyColumns,
26236
+ // useCardLabel: false,
26237
+ toolbar: []
26238
+ };
26239
+ let hideToolbarOperation = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
26240
+ if(!hideToolbarOperation){
26241
+ let toolbarOperation = await getTableOperation(options);
26242
+ if (toolbarOperation) {
26243
+ toolbarOperation.className += " inline-block w-auto";
26244
+ }
26245
+ card.toolbar.push(toolbarOperation);
26246
+ }
26247
+ return card;
26248
+ }
26249
+
25974
26250
  async function getTableSchema$1(fields, options){
25975
26251
  if(!options){
25976
26252
  options = {};
25977
26253
  }
25978
26254
  let { isLookup, hiddenColumnOperation } = options;
26255
+ const defaults = options.defaults;
26256
+ const listSchema = (defaults && defaults.listSchema) || {};
26257
+
25979
26258
  let columns = [];
25980
26259
  let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
25981
26260
  if(isLookup){
25982
26261
  // 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
25983
26262
  useMobileColumns = false;
25984
26263
  }
26264
+ if(listSchema.mode && listSchema.mode !== "table"){
26265
+ // 如果指定的mode,则不走我们内置的手机端列表效果,使用steedos组件内部开发的默认card/list效果,或者由用户自己实现card/list模式的crud列表
26266
+ useMobileColumns = false;
26267
+ }
25985
26268
  if(useMobileColumns){
25986
26269
  columns = await getMobileTableColumns(fields, options);
25987
26270
  }
25988
26271
  else {
25989
26272
  columns = await getTableColumns(fields, options);
25990
26273
 
26274
+ if(listSchema.mode === "cards"){
26275
+ let card = listSchema.card;
26276
+ if(!card){
26277
+ card = await getDefaultCrudCard(columns, options);
26278
+ }
26279
+ return {
26280
+ mode: "cards",
26281
+ perPageAvailable: [5, 10, 20, 50, 100, 500],
26282
+ name: "thelist",
26283
+ headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
26284
+ className: "",
26285
+ draggable: false,
26286
+ defaultParams: getDefaultParams(options),
26287
+ card: card,
26288
+ syncLocation: false,
26289
+ keepItemSelectionOnPageChange: true,
26290
+ checkOnItemClick: isLookup ? true : false,
26291
+ labelTpl: `\${${options.labelFieldName}}`,
26292
+ autoFillHeight: false, // 自动高度效果不理想,先关闭
26293
+ columnsTogglable: false
26294
+ }
26295
+ }
26296
+
25991
26297
  if(!isLookup && !hiddenColumnOperation){
25992
26298
  columns.push(await getTableOperation(options));
25993
26299
  }
@@ -25995,6 +26301,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25995
26301
 
25996
26302
  return {
25997
26303
  mode: "table",
26304
+ perPageAvailable: [5, 10, 20, 50, 100, 500],
25998
26305
  name: "thelist",
25999
26306
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
26000
26307
  className: "",
@@ -26082,8 +26389,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26082
26389
  /*
26083
26390
  * @Author: baozhoutao@steedos.com
26084
26391
  * @Date: 2022-07-05 15:55:39
26085
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
26086
- * @LastEditTime: 2023-09-21 17:35:06
26392
+ * @LastEditors: liaodaxue
26393
+ * @LastEditTime: 2023-10-20 11:38:25
26087
26394
  * @Description:
26088
26395
  */
26089
26396
 
@@ -26380,8 +26687,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26380
26687
  "filtersFunction": listview_filters,
26381
26688
  "sort": sort,
26382
26689
  "ctx": ctx,
26383
- "requestAdaptor": listView.requestAdaptor,
26384
- "adaptor": listView.adaptor,
26690
+ "requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
26691
+ "adaptor": listView.adaptor || ctx.adaptor,
26385
26692
  "headerToolbarItems": ctx.headerToolbarItems,
26386
26693
  "filterVisible": ctx.filterVisible,
26387
26694
  "rowClassNameExpr": ctx.rowClassNameExpr,
@@ -31515,7 +31822,13 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31515
31822
  var empty = [];
31516
31823
  function MultipleContainers(props) {
31517
31824
  var _this = this;
31518
- var _a = props.adjustScale, adjustScale = _a === void 0 ? false : _a; props.itemCount; var cancelDrop = props.cancelDrop, _c = props.columns, columns = _c === void 0 ? 1 : _c, _d = props.handle, handle = _d === void 0 ? true : _d, containerStyle = props.containerStyle, _e = props.coordinateGetter, coordinateGetter$1 = _e === void 0 ? coordinateGetter : _e, _f = props.getItemStyles, getItemStyles = _f === void 0 ? function () { return ({}); } : _f, _g = props.wrapperStyle, wrapperStyle = _g === void 0 ? function () { return ({}); } : _g, _h = props.minimal, minimal = _h === void 0 ? false : _h, modifiers = props.modifiers, renderItem = props.renderItem, _j = props.strategy, strategy = _j === void 0 ? verticalListSortingStrategy : _j, _k = props.addable, addable = _k === void 0 ? false : _k, _l = props.trashable, trashable = _l === void 0 ? false : _l, _m = props.vertical, vertical = _m === void 0 ? false : _m, scrollable = props.scrollable, _o = props.boardSource, boardSource = _o === void 0 ? [] : _o, _p = props.cardSource, cardSource = _p === void 0 ? [] : _p, defaultValue = props.defaultValue, amisOnChange = props.onChange, amisData = props.data, amisDispatchEvent = props.dispatchEvent, amisRender = props.render, _q = props.cardSchema, cardSchema = _q === void 0 ? [{
31825
+ var _a = props.adjustScale, adjustScale = _a === void 0 ? false : _a; props.itemCount; var cancelDrop = props.cancelDrop, _c = props.columns, columns = _c === void 0 ? 1 : _c, _d = props.handle, handle = _d === void 0 ? true : _d, containerStyle = props.containerStyle, _e = props.coordinateGetter, coordinateGetter$1 = _e === void 0 ? coordinateGetter : _e, _f = props.getItemStyles, getItemStyles = _f === void 0 ? function () { return ({}); } : _f, _g = props.wrapperStyle, wrapperStyle = _g === void 0 ? function () { return ({}); } : _g, _h = props.minimal, minimal = _h === void 0 ? false : _h, modifiers = props.modifiers, renderItem = props.renderItem,
31826
+ // strategy = verticalListSortingStrategy,
31827
+ _j = props.strategy,
31828
+ // strategy = verticalListSortingStrategy,
31829
+ strategy = _j === void 0 ? rectSortingStrategy : _j, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
31830
+ _k = props.addable, //这里默认值不用rectSortingStrategy的话,会出现字段在左右两边拖动变更顺序时拖动过程中dragOverlay丢失问题
31831
+ addable = _k === void 0 ? false : _k, _l = props.trashable, trashable = _l === void 0 ? false : _l, _m = props.vertical, vertical = _m === void 0 ? false : _m, scrollable = props.scrollable, _o = props.boardSource, boardSource = _o === void 0 ? [] : _o, _p = props.cardSource, cardSource = _p === void 0 ? [] : _p, value = props.value, amisOnChange = props.onChange, amisData = props.data, amisDispatchEvent = props.dispatchEvent, amisRender = props.render, _q = props.cardSchema, cardSchema = _q === void 0 ? [{
31519
31832
  "type": "tpl",
31520
31833
  "tpl": "${label}",
31521
31834
  "inline": false,
@@ -31523,24 +31836,28 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31523
31836
  "type": "tpl",
31524
31837
  "tpl": "${label}",
31525
31838
  }] : _r, _s = props.boardFooter, boardFooter = _s === void 0 ? [] : _s, _t = props.wrapperClassName, wrapperClassName = _t === void 0 ? "gap-2" : _t, _u = props.boardClassName, boardClassName = _u === void 0 ? "border rounded" : _u, _v = props.cardClassName, cardClassName = _v === void 0 ? "" : _v;
31526
- defaultValue && delete (defaultValue.$$id);
31839
+ value && delete (value.$$id);
31527
31840
  var _w = __read(React.useState(function () {
31528
31841
  var _a;
31529
- return (_a = defaultValue) !== null && _a !== void 0 ? _a : {
31842
+ return (_a = value) !== null && _a !== void 0 ? _a : {
31530
31843
  A: ['A1', 'A2'],
31531
31844
  B: ['B1', 'B2'],
31532
31845
  C: ['C1', 'C2'],
31533
31846
  };
31534
31847
  }), 2), items = _w[0], setItems = _w[1];
31535
31848
  var _x = __read(React.useState(Object.keys(items)), 2), containers = _x[0], setContainers = _x[1];
31536
- var handleChange = function () { return __awaiter(_this, void 0, void 0, function () {
31849
+ React.useEffect(function () {
31850
+ setItems(value);
31851
+ setContainers(Object.keys(value));
31852
+ }, [value]);
31853
+ var handleChange = function (newItems) { return __awaiter(_this, void 0, void 0, function () {
31537
31854
  var value, rendererEvent;
31538
31855
  return __generator(this, function (_a) {
31539
31856
  switch (_a.label) {
31540
31857
  case 0:
31541
31858
  if (!amisDispatchEvent || !amisOnChange)
31542
31859
  return [2 /*return*/];
31543
- value = items;
31860
+ value = newItems || items;
31544
31861
  return [4 /*yield*/, amisDispatchEvent('change', createObject(amisData, {
31545
31862
  value: value
31546
31863
  }))];
@@ -31549,7 +31866,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31549
31866
  if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
31550
31867
  return [2 /*return*/];
31551
31868
  }
31552
- setTimeout(function () { return amisOnChange(value); }, 1000);
31869
+ setTimeout(function () { return amisOnChange(value); }, 500);
31553
31870
  return [2 /*return*/];
31554
31871
  }
31555
31872
  });
@@ -31652,6 +31969,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31652
31969
  var active = _a.active, over = _a.over;
31653
31970
  var overId = over === null || over === void 0 ? void 0 : over.id;
31654
31971
  if (overId == null || overId === TRASH_ID || active.id in items) {
31972
+ // 拖动的是分组则跳过后面的逻辑
31655
31973
  return;
31656
31974
  }
31657
31975
  var overContainer = findContainer(overId);
@@ -31727,19 +32045,44 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31727
32045
  return;
31728
32046
  }
31729
32047
  var overContainer = findContainer(overId);
32048
+ var newItems = items;
31730
32049
  if (overContainer) {
31731
- var activeIndex_1 = items[activeContainer].indexOf(active.id);
31732
- var overIndex_1 = items[overContainer].indexOf(overId);
31733
- if (activeIndex_1 !== overIndex_1) {
31734
- setItems(function (items) {
31735
- var _a;
31736
- return (__assign$1(__assign$1({}, items), (_a = {}, _a[overContainer] = arrayMove(items[overContainer], activeIndex_1, overIndex_1), _a)));
31737
- });
32050
+ if (activeContainer !== overContainer) {
32051
+ // 拖动变更分组之间的顺序时,activeContainer overContainer 值不相等
32052
+ setTimeout(function () {
32053
+ var sortedGroups = over.data.current.sortable.items; //不加setTimeout的话,这里拿到的会是变更前的数据
32054
+ newItems = {};
32055
+ sortedGroups.forEach(function (groupKey) {
32056
+ newItems[groupKey] = items[groupKey];
32057
+ });
32058
+ delete newItems[TRASH_ID];
32059
+ delete newItems[PLACEHOLDER_ID];
32060
+ if (lodash.exports.keys(items).join(",") !== lodash.exports.keys(newItems).join(",")) {
32061
+ // 只有顺序发生变化时才触发change事件
32062
+ setItems(newItems);
32063
+ // console.log('拖动结束2,更新form value')
32064
+ handleChange(newItems);
32065
+ }
32066
+ setActiveId(null);
32067
+ }, 500);
32068
+ return;
32069
+ }
32070
+ else {
32071
+ // 同一个分组中字段顺序变更以及把一个字段从某个分组拖动到另一个分组内时,activeContainer 与 overContainer 值相等
32072
+ var activeIndex_1 = items[activeContainer].indexOf(active.id);
32073
+ var overIndex_1 = items[overContainer].indexOf(overId);
32074
+ if (activeIndex_1 !== overIndex_1) {
32075
+ setItems(function (items) {
32076
+ var _a;
32077
+ newItems = __assign$1(__assign$1({}, items), (_a = {}, _a[overContainer] = arrayMove(items[overContainer], activeIndex_1, overIndex_1), _a));
32078
+ return newItems;
32079
+ });
32080
+ }
31738
32081
  }
31739
32082
  }
31740
32083
  setActiveId(null);
31741
32084
  // console.log('拖动结束2,更新form value')
31742
- handleChange();
32085
+ handleChange(newItems);
31743
32086
  }, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers },
31744
32087
  React__default["default"].createElement("div", { style: {
31745
32088
  display: 'inline-grid',