@steedos-widgets/amis-lib 1.2.35-beta.2 → 1.2.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -3376,7 +3376,7 @@
3376
3376
  if(!event.data.isLookup){
3377
3377
  // 刷新浏览器后,filterFormValues值是空的,只能从本地存储中取出并重置为空值
3378
3378
  const listViewId = event.data.listViewId;
3379
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
3379
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
3380
3380
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3381
3381
  if(localListViewProps){
3382
3382
  localListViewProps = JSON.parse(localListViewProps);
@@ -3408,7 +3408,7 @@
3408
3408
  searchableFieldsStoreKey += "lookup/" + objectName;
3409
3409
  }
3410
3410
  else{
3411
- searchableFieldsStoreKey += listViewId;
3411
+ searchableFieldsStoreKey += (listViewId || "");
3412
3412
  }
3413
3413
  let defaultSearchableFields = sessionStorage.getItem(searchableFieldsStoreKey);
3414
3414
  if(defaultSearchableFields){
@@ -3435,7 +3435,9 @@
3435
3435
  setData({ showFieldsFilter: false });
3436
3436
  }
3437
3437
  else{
3438
- const listViewPropsStoreKey = location.pathname + "/crud/" + data.listViewId ;
3438
+ console.log("===listViewPropsStoreKey=data==", data);
3439
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (data.listViewId || "");
3440
+ console.log("===listViewPropsStoreKey=122==", listViewPropsStoreKey);
3439
3441
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3440
3442
  if(localListViewProps){
3441
3443
  localListViewProps = JSON.parse(localListViewProps);
@@ -3481,7 +3483,7 @@
3481
3483
  searchableFieldsStoreKey += "lookup/" + objectName;
3482
3484
  }
3483
3485
  else{
3484
- searchableFieldsStoreKey += listViewId;
3486
+ searchableFieldsStoreKey += (listViewId || "");
3485
3487
  }
3486
3488
  sessionStorage.setItem(searchableFieldsStoreKey, value);
3487
3489
 
@@ -3539,7 +3541,7 @@
3539
3541
  }
3540
3542
 
3541
3543
  // 列表视图crud支持本地缓存,所以需要进一步清除浏览器本地缓存里面用户在可搜索项中移除的字段值
3542
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
3544
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
3543
3545
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3544
3546
  if(localListViewProps){
3545
3547
  localListViewProps = JSON.parse(localListViewProps);
@@ -3658,7 +3660,8 @@
3658
3660
  const fields = uiSchema.fields;
3659
3661
  const options = (payload.data?.options || []).filter(function(item){
3660
3662
  let field = fields[item.value];
3661
- return !!field && window.isFieldTypeSearchable(field.type)
3663
+ // TODO: 暂时禁用location类型字段的列表搜索
3664
+ return !!field && window.isFieldTypeSearchable(field.type) && field.type !== 'location'
3662
3665
  });
3663
3666
  payload.data = {
3664
3667
  "options": options
@@ -5261,6 +5264,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
5261
5264
 
5262
5265
  function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false, hiddenCount = false, headerToolbarItems, filterVisible = true} = {}){
5263
5266
  // console.log(`getObjectHeaderToolbar====>`, filterVisible)
5267
+ console.log(`getObjectHeaderToolbar`, mainObject);
5264
5268
  const isMobile = window.innerWidth < 768;
5265
5269
  if(isMobile){
5266
5270
  showDisplayAs = false;
@@ -5360,7 +5364,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
5360
5364
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
5361
5365
  },
5362
5366
  // getExportExcelToolbarButtonSchema(),
5363
- getSettingListviewToolbarButtonSchema(),
5367
+ mainObject?.permissions?.allowCreateListViews ? getSettingListviewToolbarButtonSchema() : {},
5364
5368
  getDisplayAsButton(mainObject?.name),
5365
5369
  filterVisible ? {
5366
5370
  "label": i18next__default["default"].t('frontend_button_search_tooltip'),
@@ -7200,12 +7204,35 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
7200
7204
  }
7201
7205
  }
7202
7206
 
7207
+ const coordinatesType = field.coordinatesType || "bd09";
7203
7208
  convertData = {
7204
7209
  type: getAmisStaticFieldType('location', readonly),
7205
7210
  tpl: readonly ? getLocationTpl(field) : null,
7206
7211
  ak,
7207
7212
  vendor,
7208
- label: field.label
7213
+ clearable: true,
7214
+ coordinatesType,
7215
+ label: field.label,
7216
+ pipeOut: (value, oldValue, data) => {
7217
+ if (value) {
7218
+ const lng = value.lng;
7219
+ const lat = value.lat;
7220
+ let coordinates = [lng,lat];
7221
+ if(window.coordtransform){
7222
+ if(coordinatesType.toLowerCase() === 'bd09'){
7223
+ const bd09togcj02 = window.coordtransform.bd09togcj02(lng,lat);
7224
+ coordinates = window.coordtransform.gcj02towgs84(bd09togcj02[0],bd09togcj02[1]);
7225
+ }else if(coordinatesType.toLowerCase() === 'gcj02'){
7226
+ coordinates = window.coordtransform.gcj02towgs84(lng,lat);
7227
+ }
7228
+ }
7229
+ value.wgs84 = {
7230
+ type: "Point",
7231
+ coordinates
7232
+ };
7233
+ return value; // 切换到数字之后的默认值
7234
+ }
7235
+ }
7209
7236
  };
7210
7237
  break;
7211
7238
  case 'avatar':
@@ -7673,6 +7700,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
7673
7700
  if(field.type == "file" && field.multiple){
7674
7701
  quickEditSchema = false;
7675
7702
  }
7703
+ //TODO:location字段在列表中快速编辑后存在bug,保存时可能会丢失部分数据,暂时禁用
7704
+ if(field.type == "location"){
7705
+ quickEditSchema = false;
7706
+ }
7676
7707
  }
7677
7708
  return quickEditSchema;
7678
7709
  }
@@ -8227,7 +8258,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
8227
8258
  try{
8228
8259
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
8229
8260
  const listViewId = api.data.listViewId;
8230
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
8261
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
8231
8262
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
8232
8263
  if(localListViewProps){
8233
8264
  localListViewProps = JSON.parse(localListViewProps);
@@ -8428,7 +8459,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
8428
8459
  try{
8429
8460
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
8430
8461
  const listViewId = api.body.listViewId;
8431
- const listViewPropsStoreKey = location.pathname + "/crud/" + listViewId ;
8462
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (listViewId || "");
8432
8463
  /**
8433
8464
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
8434
8465
  * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
@@ -10396,8 +10427,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
10396
10427
  /*
10397
10428
  * @Author: baozhoutao@steedos.com
10398
10429
  * @Date: 2022-07-05 15:55:39
10399
- * @LastEditors: baozhoutao@steedos.com
10400
- * @LastEditTime: 2023-07-29 13:58:07
10430
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
10431
+ * @LastEditTime: 2023-08-01 14:50:23
10401
10432
  * @Description:
10402
10433
  */
10403
10434
 
@@ -10662,7 +10693,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
10662
10693
  * 本次存储代码段
10663
10694
  */
10664
10695
  try {
10665
- const listViewPropsStoreKey = location.pathname + "/crud/" + ctx.listViewId;
10696
+ const listViewPropsStoreKey = location.pathname + "/crud/" + (ctx.listViewId || "");
10666
10697
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
10667
10698
  /**
10668
10699
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。