@steedos-widgets/sortable 1.3.4-beta.18 → 1.3.4-beta.20

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.
@@ -55213,7 +55213,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
55213
55213
  if(isLookup){
55214
55214
  searchableFieldsStoreKey += "/lookup/" + objectName;
55215
55215
  }
55216
- let defaultSearchableFields = sessionStorage.getItem(searchableFieldsStoreKey);
55216
+ searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
55217
+ let defaultSearchableFields = localStorage.getItem(searchableFieldsStoreKey);
55217
55218
  if(defaultSearchableFields){
55218
55219
  defaultSearchableFields = defaultSearchableFields.split(",");
55219
55220
  }
@@ -55282,7 +55283,8 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
55282
55283
  if(isLookup){
55283
55284
  searchableFieldsStoreKey += "/lookup/" + objectName;
55284
55285
  }
55285
- sessionStorage.setItem(searchableFieldsStoreKey, value);
55286
+ searchableFieldsStoreKey = searchableFieldsStoreKey + "/" + (data.context && data.context.userId);
55287
+ localStorage.setItem(searchableFieldsStoreKey, value);
55286
55288
 
55287
55289
  // ===START===:当变更可搜索字段时,如果被移除的可搜索字段在本地存储中已经存入过滤条件中则应该清除本地存储中相关字段的过滤条件。
55288
55290
  const searchableFields = data.fields;
@@ -57873,10 +57875,10 @@ async function lookupToAmis(field, readonly, ctx){
57873
57875
 
57874
57876
  const refObject = await getUISchema(referenceTo.objectName);
57875
57877
 
57876
- // 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
57877
- // 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
57878
- // TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
57879
- if(refObject.enable_enhanced_lookup == true){
57878
+ // 优先取字段中配置的enable_enhanced_lookup,字段上没配置时,才从对象上取enable_enhanced_lookup属性
57879
+ let enableEnhancedLookup = lodash.exports.isBoolean(field.enable_enhanced_lookup) ? field.enable_enhanced_lookup : refObject.enable_enhanced_lookup;
57880
+ // 默认使用下拉框模式显示lookup选项,只能配置了enable_enhanced_lookup才使用弹出增强模式
57881
+ if(enableEnhancedLookup == true){
57880
57882
  return await lookupToAmisPicker(field, readonly, ctx);
57881
57883
  }else if(refObject.enable_tree) {
57882
57884
  return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
@@ -59002,8 +59004,44 @@ var config = {
59002
59004
  };
59003
59005
 
59004
59006
  async function getQuickEditSchema(field, options){
59007
+ //判断在amis3.2以上环境下,放开批量编辑
59008
+ const isAmisVersionforBatchEdit = amisRequire('amis').version[0] >= 3 && amisRequire('amis').version[2] >= 2;
59005
59009
  const quickEditId = options.objectName + "_" + field.name + "QuickEdit";//定义快速编辑的表单id,用于setvalue传值
59006
59010
  var quickEditSchema = { body: [], id: quickEditId };
59011
+ //select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
59012
+ if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
59013
+ const submitEvent = {
59014
+ submit: {
59015
+ actions: [
59016
+ {
59017
+ actionType: "custom",
59018
+ script: `
59019
+ const items = event.data.items;
59020
+ const selectedItems = event.data.selectedItems;
59021
+ if(event.data.isBatchEdit){
59022
+ selectedItems.forEach(function(selectedItem){
59023
+ items[selectedItem._index-1]._display.${field.name} = event.data._display.${field.name};
59024
+ })
59025
+ doAction({actionType: 'setValue', "args": {"value": {items}},componentId: "${options.crudId}","dataMergeMode": "override"});
59026
+ selectedItems.forEach(function(selectedItem){
59027
+ doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + selectedItem._index});
59028
+ })
59029
+ }else{
59030
+ items[event.data._index-1]._display.${field.name} = event.data._display.${field.name};
59031
+ doAction({actionType: 'setValue', "args": {"value": {items}},componentId: "${options.crudId}","dataMergeMode": "override"});
59032
+ doAction({actionType: 'setValue', "args": {"value": event.data.${field.name}},componentId: "${options.objectName + "_" + field.name + "_"}" + event.data._index});
59033
+ }
59034
+ `
59035
+ },
59036
+ {
59037
+ "actionType": "closeDialog"
59038
+ }
59039
+ ]
59040
+ }
59041
+ };
59042
+ quickEditSchema.onEvent = submitEvent;
59043
+ }
59044
+
59007
59045
  if (field.disabled) {
59008
59046
  quickEditSchema = false;
59009
59047
  } else {
@@ -59237,6 +59275,14 @@ async function getQuickEditSchema(field, options){
59237
59275
  }
59238
59276
 
59239
59277
  });
59278
+ if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
59279
+ quickEditSchema.body.push({
59280
+ "name": "isBatchEdit",
59281
+ "type": "checkbox",
59282
+ "option": "更新${COUNT(selectedItems)}个选定记录",
59283
+ "visibleOn": "${ARRAYSOME(selectedItems, item => item._id === _id) && COUNT(selectedItems)>1}"
59284
+ });
59285
+ }
59240
59286
  } else {
59241
59287
  quickEditSchema = false;
59242
59288
  }
@@ -59349,7 +59395,7 @@ async function getTableColumns(fields, options){
59349
59395
  else if(field.type === 'select'){
59350
59396
  const map = getSelectMap(field.options);
59351
59397
  columnItem = Object.assign({}, {
59352
- type: "mapping",
59398
+ type: "static-mapping",
59353
59399
  name: field.name,
59354
59400
  label: field.label,
59355
59401
  map: map,
@@ -59364,7 +59410,7 @@ async function getTableColumns(fields, options){
59364
59410
  const tpl = await getFieldTpl(field, options);
59365
59411
  let type = 'text';
59366
59412
  if(tpl){
59367
- type = 'tpl';
59413
+ type = 'static';
59368
59414
  }else if(field.type === 'html'){
59369
59415
  type = 'markdown';
59370
59416
  }else if(field.type === 'url'){
@@ -59405,6 +59451,7 @@ async function getTableColumns(fields, options){
59405
59451
  columnItem.quickEdit = quickEditSchema;
59406
59452
  columnItem.quickEditEnabledOn = "${is_system !== true}";
59407
59453
  }
59454
+ columnItem.id = `${options.objectName}_${field.name}_\${_index}`;
59408
59455
  columns.push(columnItem);
59409
59456
  }
59410
59457
  }