@steedos-widgets/amis-lib 6.3.14 → 6.3.16

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.esm.js CHANGED
@@ -3151,12 +3151,15 @@ async function getTableApi(mainObject, fields, options){
3151
3151
  let selfData = JSON.parse(JSON.stringify(api.data.$self));
3152
3152
  // 保留一份初始data,以供自定义发送适配器中获取原始数据。
3153
3153
  const data = _.cloneDeep(api.data);
3154
+ let needToStoreListViewProps;
3154
3155
  try{
3155
3156
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
3156
3157
  const listName = api.data.listName;
3158
+ // 只有在列表页面中才需要存储和读取本地存储中的参数,相关子表组件不需要
3159
+ needToStoreListViewProps = !!listName && !api.body.$self._isRelated;
3157
3160
  const listViewPropsStoreKey = location.pathname + "/crud";
3158
3161
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3159
- if(localListViewProps){
3162
+ if(needToStoreListViewProps && localListViewProps){
3160
3163
  localListViewProps = JSON.parse(localListViewProps);
3161
3164
  selfData = Object.assign({}, localListViewProps, selfData);
3162
3165
  if(!api.data.filter){
@@ -3295,7 +3298,7 @@ async function getTableApi(mainObject, fields, options){
3295
3298
 
3296
3299
  //写入本次存储filters、sort
3297
3300
  const listViewPropsStoreKey = location.pathname + "/crud/query";
3298
- sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify({
3301
+ needToStoreListViewProps && sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify({
3299
3302
  filters: filters,
3300
3303
  sort: sort.trim(),
3301
3304
  pageSize: pageSize,
@@ -3411,9 +3414,12 @@ async function getTableApi(mainObject, fields, options){
3411
3414
  }
3412
3415
 
3413
3416
 
3417
+ let needToStoreListViewProps;
3414
3418
  try{
3415
3419
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
3416
3420
  const listName = api.body.listName;
3421
+ // 只有在列表页面中才需要存储和读取本地存储中的参数,相关子表组件不需要
3422
+ needToStoreListViewProps = !!listName && !api.body.$self._isRelated;
3417
3423
  const listViewPropsStoreKey = location.pathname + "/crud";
3418
3424
  /**
3419
3425
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
@@ -3425,7 +3431,7 @@ async function getTableApi(mainObject, fields, options){
3425
3431
  * orderBy:排序字段
3426
3432
  * orderDir:排序方向
3427
3433
  */
3428
- let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
3434
+ let localListViewProps = needToStoreListViewProps && sessionStorage.getItem(listViewPropsStoreKey);
3429
3435
  let selfData = JSON.parse(JSON.stringify(api.body.$self));
3430
3436
  if(localListViewProps){
3431
3437
  localListViewProps = JSON.parse(localListViewProps);
@@ -3443,7 +3449,7 @@ async function getTableApi(mainObject, fields, options){
3443
3449
 
3444
3450
  delete selfData.context;
3445
3451
  delete selfData.global;
3446
- sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(selfData));
3452
+ needToStoreListViewProps && sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(selfData));
3447
3453
  // 返回页码到UI界面
3448
3454
  payload.data.page= selfData.page;
3449
3455
  }