@steedos-widgets/amis-lib 6.10.2-beta.1 → 6.10.2-beta.2

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
@@ -5054,12 +5054,15 @@ async function getTableApi(mainObject, fields, options){
5054
5054
  let selfData = JSON.parse(JSON.stringify(api.data.$self));
5055
5055
  // 保留一份初始data,以供自定义发送适配器中获取原始数据。
5056
5056
  const data = _.cloneDeep(api.data);
5057
+ let needToStoreListViewProps;
5057
5058
  try{
5058
5059
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
5059
5060
  const listName = api.data.listName;
5061
+ // 只有在列表页面中才需要存储和读取本地存储中的参数,相关子表组件不需要
5062
+ needToStoreListViewProps = !!listName && !api.body.$self._isRelated;
5060
5063
  const listViewPropsStoreKey = location.pathname + "/crud";
5061
5064
  let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
5062
- if(localListViewProps){
5065
+ if(needToStoreListViewProps && localListViewProps){
5063
5066
  localListViewProps = JSON.parse(localListViewProps);
5064
5067
  selfData = Object.assign({}, localListViewProps, selfData);
5065
5068
  if(!api.data.filter){
@@ -5201,7 +5204,7 @@ async function getTableApi(mainObject, fields, options){
5201
5204
 
5202
5205
  //写入本次存储filters、sort
5203
5206
  const listViewPropsStoreKey = location.pathname + "/crud/query";
5204
- sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify({
5207
+ needToStoreListViewProps && sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify({
5205
5208
  filters: filters,
5206
5209
  sort: sort.trim(),
5207
5210
  pageSize: pageSize,
@@ -5308,9 +5311,12 @@ async function getTableApi(mainObject, fields, options){
5308
5311
  }
5309
5312
 
5310
5313
 
5314
+ let needToStoreListViewProps;
5311
5315
  try{
5312
5316
  // TODO: 不应该直接在这里取localStorage,应该从外面传入
5313
5317
  const listName = api.body.listName;
5318
+ // 只有在列表页面中才需要存储和读取本地存储中的参数,相关子表组件不需要
5319
+ needToStoreListViewProps = !!listName && !api.body.$self._isRelated;
5314
5320
  const listViewPropsStoreKey = location.pathname + "/crud";
5315
5321
  /**
5316
5322
  * localListViewProps规范来自crud请求api中api.data.$self参数值的。
@@ -5322,7 +5328,7 @@ async function getTableApi(mainObject, fields, options){
5322
5328
  * orderBy:排序字段
5323
5329
  * orderDir:排序方向
5324
5330
  */
5325
- let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
5331
+ let localListViewProps = needToStoreListViewProps && sessionStorage.getItem(listViewPropsStoreKey);
5326
5332
  let selfData = JSON.parse(JSON.stringify(api.body.$self));
5327
5333
  if(localListViewProps){
5328
5334
  localListViewProps = JSON.parse(localListViewProps);
@@ -5340,7 +5346,7 @@ async function getTableApi(mainObject, fields, options){
5340
5346
 
5341
5347
  delete selfData.context;
5342
5348
  delete selfData.global;
5343
- sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(selfData));
5349
+ needToStoreListViewProps && sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(selfData));
5344
5350
  // 返回页码到UI界面
5345
5351
  payload.data.page= selfData.page;
5346
5352
  }