@steedos-widgets/sortable 1.3.4-beta.9 → 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
  }
@@ -23789,13 +23811,15 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23789
23811
  pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
23790
23812
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
23791
23813
  const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
23792
- if (isAllowCreate && isCreate) {
23814
+ // lookup字段配置过滤条件就强制不显示新建按钮
23815
+ let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
23816
+ if (isAllowCreate && isCreate && !isHasFilters) {
23793
23817
  const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
23794
23818
  new_button.align = "right";
23795
23819
  // 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
23796
23820
  pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length - 1, 0, new_button);
23797
23821
  }
23798
- pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar();
23822
+ pickerSchema.footerToolbar = refObjectConfig.enable_tree ? [] : getObjectFooterToolbar(refObjectConfig,ctx.formFactor,{isLookup: true});
23799
23823
  if (ctx.filterVisible !== false) {
23800
23824
  pickerSchema.filter = await getObjectFilter(refObjectConfig, fields, {
23801
23825
  ...ctx,
@@ -23923,10 +23947,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23923
23947
  // const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
23924
23948
 
23925
23949
  let apiInfo;
23926
-
23950
+ let defaultValueOptionsQueryData;
23927
23951
  if(referenceTo){
23928
23952
  // 字段值单独走一个请求合并到source的同一个GraphQL接口中
23929
- const defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
23953
+ defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
23930
23954
  Object.assign({}, referenceTo.labelField, {alias: 'label'}),
23931
23955
  Object.assign({}, referenceTo.valueField, {alias: 'value'})
23932
23956
  ], {
@@ -23939,7 +23963,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
23939
23963
  }, null, [
23940
23964
  Object.assign({}, referenceTo.labelField, {alias: 'label'}),
23941
23965
  Object.assign({}, referenceTo.valueField, {alias: 'value'})
23942
- ], {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}"`});
23943
23967
 
23944
23968
  apiInfo.adaptor = `
23945
23969
  const data = payload.data;
@@ -24033,11 +24057,16 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24033
24057
  var optionsFiltersOp = "${field.multiple ? "in" : "="}";
24034
24058
  var optionsFilters = [["${valueFieldKey}", optionsFiltersOp, []]];
24035
24059
  if (defaultValue && !api.data.$term) {
24060
+ const defaultValueOptionsQueryData = ${JSON.stringify(defaultValueOptionsQueryData)};
24061
+ const defaultValueOptionsQuery = defaultValueOptionsQueryData?.query?.replace(/^{/,"").replace(/}$/,"");
24036
24062
  // 字段值单独请求,没值的时候在请求中返回空
24037
24063
  optionsFilters = [["${valueFieldKey}", optionsFiltersOp, defaultValue]];
24038
24064
  if(filters.length > 0){
24039
24065
  optionsFilters = [filters, optionsFilters];
24040
24066
  }
24067
+ if(defaultValueOptionsQuery){
24068
+ api.data.query = "{"+api.data.query.replace(/^{/,"").replace(/}$/,"")+","+defaultValueOptionsQuery+"}";
24069
+ }
24041
24070
  }
24042
24071
  api.data.query = api.data.query.replace(/{__options_filters}/g, JSON.stringify(optionsFilters));
24043
24072
  return api;
@@ -24079,7 +24108,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24079
24108
  disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || ((this.relatedKey ==='${field.name}') && (${field.multiple} != true)) )`,
24080
24109
  // labelField: labelField,
24081
24110
  // valueField: valueField,
24082
- source: apiInfo,
24111
+ // source: apiInfo,
24083
24112
  autoComplete: apiInfo,
24084
24113
  searchable: true,
24085
24114
  };
@@ -24158,10 +24187,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24158
24187
 
24159
24188
  const refObject = await getUISchema(referenceTo.objectName);
24160
24189
 
24161
- // 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
24162
- // 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
24163
- // TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
24164
- 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){
24165
24194
  return await lookupToAmisPicker(field, readonly, ctx);
24166
24195
  }else if(refObject.enable_tree) {
24167
24196
  return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
@@ -24474,8 +24503,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24474
24503
  /*
24475
24504
  * @Author: baozhoutao@steedos.com
24476
24505
  * @Date: 2022-10-28 14:15:09
24477
- * @LastEditors: baozhoutao@steedos.com
24478
- * @LastEditTime: 2022-11-02 18:06:16
24506
+ * @LastEditors: liaodaxue
24507
+ * @LastEditTime: 2023-10-30 17:51:54
24479
24508
  * @Description:
24480
24509
  */
24481
24510
 
@@ -24526,11 +24555,26 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24526
24555
  useChunk: false, // 关闭分块上传
24527
24556
  receiver: {
24528
24557
  method: "post",
24558
+ dataType: "form-data",
24529
24559
  url: `\${context.rootUrl}/s3/${tableName}`,
24530
- data: {
24531
- $: "$$",
24532
- context: `\${context}`,
24533
- },
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
+ `,
24534
24578
  adaptor: `
24535
24579
  const { context } = api.body;
24536
24580
  var rootUrl = context.rootUrl + "/api/files/${tableName}/";
@@ -24611,8 +24655,6 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24611
24655
  }
24612
24656
 
24613
24657
  async function convertSFieldToAmisField(field, readonly, ctx) {
24614
- // console.log('convertSFieldToAmisField====>', field, readonly, ctx)
24615
- const isMobile = window.innerWidth <= 768;
24616
24658
  // 创建人和修改人、创建时间和修改时间不显示
24617
24659
  if(lodash.exports.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
24618
24660
  return;
@@ -24701,26 +24743,33 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24701
24743
  };
24702
24744
  break;
24703
24745
  case 'date':
24704
- convertData = isMobile && !readonly ? {
24705
- type: "native-date",
24706
- pipeIn: (value, data) => {
24707
- if (value) {
24708
- value = moment(value).utc().format('YYYY-MM-DD');
24709
- return value;
24710
- } else {
24711
- return "";
24712
- }
24713
-
24714
- },
24715
- pipeOut: (value, oldValue, data) => {
24716
- if (value) {
24717
- value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
24718
- return value;
24719
- } else {
24720
- return "";
24721
- }
24722
- }
24723
- } : {
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 = {
24724
24773
  type: getAmisStaticFieldType('date', readonly),
24725
24774
  inputFormat: "YYYY-MM-DD",
24726
24775
  format:'YYYY-MM-DDT00:00:00.000[Z]',
@@ -24739,43 +24788,51 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24739
24788
  };
24740
24789
  break;
24741
24790
  case 'datetime':
24742
- convertData = isMobile && !readonly ? {
24743
- type: "combo",
24744
- pipeIn: (value, data) => {
24745
- let revalue = {};
24746
- if (value && value != "Invalid date") {
24747
- value = moment(value).format('YYYY-MM-DD HH:mm:ss');
24748
- revalue[field.name + "-native-date"] = value.split(' ')[0];
24749
- revalue[field.name + "-native-time"] = value.split(' ')[1];
24750
- } else {
24751
- revalue[field.name + "-native-date"] = "";
24752
- revalue[field.name + "-native-time"] = "";
24753
- }
24754
- return revalue;
24755
- },
24756
- pipeOut: (value, oldValue, data) => {
24757
- let revalue = "";
24758
- if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
24759
- revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
24760
- revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
24761
- }
24762
- return revalue;
24763
- },
24764
- items: [
24765
- {
24766
- type: "native-date",
24767
- name: field.name + "-native-date",
24768
- className: "steedos-native-date",
24769
- value: ""
24770
- },
24771
- {
24772
- type: "native-time",
24773
- name: field.name + "-native-time",
24774
- className: "steedos-native-time",
24775
- value: ""
24776
- }
24777
- ]
24778
- } : {
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 = {
24779
24836
  type: getAmisStaticFieldType('datetime', readonly),
24780
24837
  inputFormat: 'YYYY-MM-DD HH:mm',
24781
24838
  format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
@@ -24795,26 +24852,34 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24795
24852
  };
24796
24853
  break;
24797
24854
  case 'time':
24798
- convertData = isMobile && !readonly ? {
24799
- type: "native-time",
24800
- pipeIn: (value, data) => {
24801
- if (value) {
24802
- value = moment(value).utc().format('HH:mm');
24803
- return value;
24804
- } else {
24805
- return "";
24806
- }
24807
-
24808
- },
24809
- pipeOut: (value, oldValue, data) => {
24810
- if (value) {
24811
- value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
24812
- return value;
24813
- } else {
24814
- return "";
24815
- }
24816
- }
24817
- } : {
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 = {
24818
24883
  type: getAmisStaticFieldType('time', readonly),
24819
24884
  inputFormat: 'HH:mm',
24820
24885
  timeFormat:'HH:mm',
@@ -24864,7 +24929,20 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
24864
24929
  type: getAmisStaticFieldType('number', readonly),
24865
24930
  min: field.min,
24866
24931
  max: field.max,
24867
- 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
+ },
24868
24946
  };
24869
24947
  }
24870
24948
  break;
@@ -25259,8 +25337,41 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25259
25337
  };
25260
25338
 
25261
25339
  async function getQuickEditSchema(field, options){
25262
- 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传值
25263
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
+
25264
25375
  if (field.disabled) {
25265
25376
  quickEditSchema = false;
25266
25377
  } else {
@@ -25277,7 +25388,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25277
25388
  {
25278
25389
  "actionType": "custom",
25279
25390
  "script": `
25280
- var _display = event.data._display;
25391
+ var _display = _.cloneDeep(event.data._display);
25281
25392
  ${displayField}
25282
25393
  doAction({actionType: 'setValue', "args": {"value": {_display}},componentId: "${quickEditId}"});
25283
25394
  `
@@ -25299,7 +25410,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25299
25410
  第二种是增加选项时,按照value的值,找到对应选项,并按照_display的规则为其赋值
25300
25411
  */
25301
25412
  TempDisplayField = `
25302
- const preData = event.data.__super.${field.name};
25413
+ const preData = _.cloneDeep(event.data.__super.${field.name});
25303
25414
  if(preData && event.data.${field.name}.length < preData.length){
25304
25415
  let deletedIndex;
25305
25416
  preData.forEach(function(item,index){
@@ -25343,7 +25454,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25343
25454
  break;
25344
25455
  case "percent":
25345
25456
  TempDisplayField = `
25346
- _display["${field.name}"] = (event.data.value * 100).toFixed(${field.scale}) + '%';
25457
+ _display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
25347
25458
  `;
25348
25459
  quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
25349
25460
  break;
@@ -25494,6 +25605,131 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25494
25605
  }
25495
25606
 
25496
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
+ }
25497
25733
  } else {
25498
25734
  quickEditSchema = false;
25499
25735
  }
@@ -25528,6 +25764,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25528
25764
  const columns = [];
25529
25765
  if(!options.isLookup){
25530
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"});
25531
25769
  }
25532
25770
  const allowEdit = options.permissions?.allowEdit && !options.isLookup && options.enable_inline_edit != false;
25533
25771
 
@@ -25559,7 +25797,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25559
25797
  {
25560
25798
  "args": {
25561
25799
  "api": {
25562
- "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'}",
25563
25801
  "method": "get",
25564
25802
  "headers": {
25565
25803
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
@@ -25606,7 +25844,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25606
25844
  else if(field.type === 'select'){
25607
25845
  const map = getSelectMap(field.options);
25608
25846
  columnItem = Object.assign({}, {
25609
- type: "mapping",
25847
+ type: "static-mapping",
25610
25848
  name: field.name,
25611
25849
  label: field.label,
25612
25850
  map: map,
@@ -25621,7 +25859,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25621
25859
  const tpl = await getFieldTpl(field, options);
25622
25860
  let type = 'text';
25623
25861
  if(tpl){
25624
- type = 'tpl';
25862
+ type = 'static';
25625
25863
  }else if(field.type === 'html'){
25626
25864
  type = 'markdown';
25627
25865
  }else if(field.type === 'url'){
@@ -25662,6 +25900,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25662
25900
  columnItem.quickEdit = quickEditSchema;
25663
25901
  columnItem.quickEditEnabledOn = "${is_system !== true}";
25664
25902
  }
25903
+ columnItem.id = `${options.objectName}_${field.name}_\${_index}`;
25665
25904
  columns.push(columnItem);
25666
25905
  }
25667
25906
  }
@@ -25940,7 +26179,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25940
26179
  }
25941
26180
  return {
25942
26181
  type: 'operation',
25943
- label: instance.t('frontend_operation'),
26182
+ label: "",
25944
26183
  fixed: 'right',
25945
26184
  labelClassName: 'text-center',
25946
26185
  className: 'text-center steedos-listview-operation w-10',
@@ -25974,23 +26213,87 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25974
26213
  }
25975
26214
  }
25976
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
+
25977
26250
  async function getTableSchema$1(fields, options){
25978
26251
  if(!options){
25979
26252
  options = {};
25980
26253
  }
25981
26254
  let { isLookup, hiddenColumnOperation } = options;
26255
+ const defaults = options.defaults;
26256
+ const listSchema = (defaults && defaults.listSchema) || {};
26257
+
25982
26258
  let columns = [];
25983
26259
  let useMobileColumns = options.formFactor === 'SMALL' || ["split"].indexOf(options.displayAs) > -1;
25984
26260
  if(isLookup){
25985
26261
  // 在lookup手机端列表模式调式好之前不使用getMobileTableColumns
25986
26262
  useMobileColumns = false;
25987
26263
  }
26264
+ if(listSchema.mode && listSchema.mode !== "table"){
26265
+ // 如果指定的mode,则不走我们内置的手机端列表效果,使用steedos组件内部开发的默认card/list效果,或者由用户自己实现card/list模式的crud列表
26266
+ useMobileColumns = false;
26267
+ }
25988
26268
  if(useMobileColumns){
25989
26269
  columns = await getMobileTableColumns(fields, options);
25990
26270
  }
25991
26271
  else {
25992
26272
  columns = await getTableColumns(fields, options);
25993
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
+
25994
26297
  if(!isLookup && !hiddenColumnOperation){
25995
26298
  columns.push(await getTableOperation(options));
25996
26299
  }
@@ -25998,6 +26301,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
25998
26301
 
25999
26302
  return {
26000
26303
  mode: "table",
26304
+ perPageAvailable: [5, 10, 20, 50, 100, 500],
26001
26305
  name: "thelist",
26002
26306
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
26003
26307
  className: "",
@@ -26085,8 +26389,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26085
26389
  /*
26086
26390
  * @Author: baozhoutao@steedos.com
26087
26391
  * @Date: 2022-07-05 15:55:39
26088
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
26089
- * @LastEditTime: 2023-09-21 17:35:06
26392
+ * @LastEditors: liaodaxue
26393
+ * @LastEditTime: 2023-10-20 11:38:25
26090
26394
  * @Description:
26091
26395
  */
26092
26396
 
@@ -26383,8 +26687,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
26383
26687
  "filtersFunction": listview_filters,
26384
26688
  "sort": sort,
26385
26689
  "ctx": ctx,
26386
- "requestAdaptor": listView.requestAdaptor,
26387
- "adaptor": listView.adaptor,
26690
+ "requestAdaptor": listView.requestAdaptor || ctx.requestAdaptor,
26691
+ "adaptor": listView.adaptor || ctx.adaptor,
26388
26692
  "headerToolbarItems": ctx.headerToolbarItems,
26389
26693
  "filterVisible": ctx.filterVisible,
26390
26694
  "rowClassNameExpr": ctx.rowClassNameExpr,
@@ -31518,7 +31822,13 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31518
31822
  var empty = [];
31519
31823
  function MultipleContainers(props) {
31520
31824
  var _this = this;
31521
- 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 ? [{
31522
31832
  "type": "tpl",
31523
31833
  "tpl": "${label}",
31524
31834
  "inline": false,
@@ -31526,24 +31836,28 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31526
31836
  "type": "tpl",
31527
31837
  "tpl": "${label}",
31528
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;
31529
- defaultValue && delete (defaultValue.$$id);
31839
+ value && delete (value.$$id);
31530
31840
  var _w = __read(React.useState(function () {
31531
31841
  var _a;
31532
- return (_a = defaultValue) !== null && _a !== void 0 ? _a : {
31842
+ return (_a = value) !== null && _a !== void 0 ? _a : {
31533
31843
  A: ['A1', 'A2'],
31534
31844
  B: ['B1', 'B2'],
31535
31845
  C: ['C1', 'C2'],
31536
31846
  };
31537
31847
  }), 2), items = _w[0], setItems = _w[1];
31538
31848
  var _x = __read(React.useState(Object.keys(items)), 2), containers = _x[0], setContainers = _x[1];
31539
- 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 () {
31540
31854
  var value, rendererEvent;
31541
31855
  return __generator(this, function (_a) {
31542
31856
  switch (_a.label) {
31543
31857
  case 0:
31544
31858
  if (!amisDispatchEvent || !amisOnChange)
31545
31859
  return [2 /*return*/];
31546
- value = items;
31860
+ value = newItems || items;
31547
31861
  return [4 /*yield*/, amisDispatchEvent('change', createObject(amisData, {
31548
31862
  value: value
31549
31863
  }))];
@@ -31552,7 +31866,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31552
31866
  if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
31553
31867
  return [2 /*return*/];
31554
31868
  }
31555
- setTimeout(function () { return amisOnChange(value); }, 1000);
31869
+ setTimeout(function () { return amisOnChange(value); }, 500);
31556
31870
  return [2 /*return*/];
31557
31871
  }
31558
31872
  });
@@ -31655,6 +31969,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31655
31969
  var active = _a.active, over = _a.over;
31656
31970
  var overId = over === null || over === void 0 ? void 0 : over.id;
31657
31971
  if (overId == null || overId === TRASH_ID || active.id in items) {
31972
+ // 拖动的是分组则跳过后面的逻辑
31658
31973
  return;
31659
31974
  }
31660
31975
  var overContainer = findContainer(overId);
@@ -31730,19 +32045,44 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31730
32045
  return;
31731
32046
  }
31732
32047
  var overContainer = findContainer(overId);
32048
+ var newItems = items;
31733
32049
  if (overContainer) {
31734
- var activeIndex_1 = items[activeContainer].indexOf(active.id);
31735
- var overIndex_1 = items[overContainer].indexOf(overId);
31736
- if (activeIndex_1 !== overIndex_1) {
31737
- setItems(function (items) {
31738
- var _a;
31739
- return (__assign$1(__assign$1({}, items), (_a = {}, _a[overContainer] = arrayMove(items[overContainer], activeIndex_1, overIndex_1), _a)));
31740
- });
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
+ }
31741
32081
  }
31742
32082
  }
31743
32083
  setActiveId(null);
31744
32084
  // console.log('拖动结束2,更新form value')
31745
- handleChange();
32085
+ handleChange(newItems);
31746
32086
  }, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers },
31747
32087
  React__default["default"].createElement("div", { style: {
31748
32088
  display: 'inline-grid',