@steedos-widgets/amis-lib 6.10.16 → 6.10.17

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
@@ -1114,7 +1114,7 @@ function getRecordPermissionsQuery(object, recordId, options){
1114
1114
  function getApi$2 (isMobile){
1115
1115
  if(isMobile);else {
1116
1116
  // return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
1117
- return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}&listName=\${listName}`
1117
+ return `\${context.rootUrl}/graphql?reload=\${additionalFilters|join}`
1118
1118
  }
1119
1119
  }
1120
1120
 
@@ -5013,6 +5013,55 @@ async function getTableSchema$1(object, fields, options){
5013
5013
  }
5014
5014
 
5015
5015
 
5016
+ /**
5017
+ * 移除符合特定规则的sessionStorage项,用于清除列表视图组件请求接口的历史查询条件、翻页页码等本地存储参数数据,只保留最后一次的相关参数
5018
+ * 兼容列表视图的两栏和三栏模式,以及列表视图的简化版(不带/grid)路径
5019
+ * @param {string} suffix - 需要匹配的路径后缀,如"/crud"或"/crud/query"
5020
+ * @returns {string} 返回包含正则表达式和清除逻辑的代码字符串
5021
+ */
5022
+ function removeTableApiSessionStorageItems(suffix) {
5023
+ // 手动转义suffix中的斜线/以确保正则表达式能够正确匹配路径
5024
+ const escapedSuffix = suffix.replace(/\//g, '\\/');
5025
+
5026
+ return `
5027
+ /**
5028
+ * 正则表达式1:匹配不带 /grid 的路径,路径结尾为 ${escapedSuffix}
5029
+ * - 适用于路径格式:/app/{appName}/{objectName}${suffix}
5030
+ * - 可能的suffix值包括:"/crud", "/crud/query"
5031
+ */
5032
+ const noGridPattern = new RegExp('^\\\\/app\\\\/([^\\\\/]+)\\\\/([^\\\\/]+)${escapedSuffix}$');
5033
+
5034
+ /**
5035
+ * 正则表达式2:匹配带 /grid 的路径,路径结尾为 ${escapedSuffix}
5036
+ * - 适用于路径格式:/app/{appName}/{objectName}/grid/{listName}${suffix}
5037
+ * - 可能的suffix值包括:"/crud", "/crud/query"
5038
+ */
5039
+ const withGridPattern = new RegExp('^\\\\/app\\\\/([^\\\\/]+)\\\\/([^\\\\/]+)\\\\/grid\\\\/([^\\\\/]+)${escapedSuffix}$');
5040
+
5041
+ /**
5042
+ * 正则表达式3:匹配带 /view 的路径(列表三栏模式),路径结尾为 ${escapedSuffix}
5043
+ * - 适用于路径格式:/app/{appName}/{objectName}/view/{recordId}${suffix}
5044
+ * - 可能的suffix值包括:"/crud", "/crud/query"
5045
+ */
5046
+ const withViewPattern = new RegExp('^\\\\/app\\\\/([^\\\\/]+)\\\\/([^\\\\/]+)\\\\/view\\\\/([^\\\\/]+)${escapedSuffix}$');
5047
+
5048
+ // 清除 sessionStorage 中符合条件的历史数据
5049
+ for (let i = 0; i < sessionStorage.length; i++) {
5050
+ const key = sessionStorage.key(i);
5051
+
5052
+ /**
5053
+ * 检查是否匹配规则并移除匹配的sessionStorage项:
5054
+ * - noGridPattern 匹配简化版路径
5055
+ * - withGridPattern 匹配带有 /grid 的路径
5056
+ * - withViewPattern 匹配带有 /view 的路径
5057
+ */
5058
+ if (noGridPattern.test(key) || withGridPattern.test(key) || withViewPattern.test(key)) {
5059
+ sessionStorage.removeItem(key);
5060
+ i--; // 因为移除之后,索引也跟着变化,所以需要回退一步
5061
+ }
5062
+ }
5063
+ `;
5064
+ }
5016
5065
 
5017
5066
  /**
5018
5067
  *
@@ -5246,13 +5295,16 @@ async function getTableApi(mainObject, fields, options){
5246
5295
 
5247
5296
  //写入本次存储filters、sort
5248
5297
  const listViewPropsStoreKey = location.pathname + "/crud/query";
5249
- needToStoreListViewProps && sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify({
5250
- filters: filters,
5251
- sort: sort.trim(),
5252
- pageSize: pageSize,
5253
- skip: skip,
5254
- fields: ${JSON.stringify(_$1.map(fields, 'name'))}
5255
- }));
5298
+ if(needToStoreListViewProps) {
5299
+ ${removeTableApiSessionStorageItems("/crud/query")};
5300
+ sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify({
5301
+ filters: filters,
5302
+ sort: sort.trim(),
5303
+ pageSize: pageSize,
5304
+ skip: skip,
5305
+ fields: ${JSON.stringify(_$1.map(fields, 'name'))}
5306
+ }));
5307
+ }
5256
5308
  // console.log('table requestAdaptor', api);
5257
5309
  return api;
5258
5310
  `;
@@ -5388,7 +5440,10 @@ async function getTableApi(mainObject, fields, options){
5388
5440
 
5389
5441
  delete selfData.context;
5390
5442
  delete selfData.global;
5391
- needToStoreListViewProps && sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(selfData));
5443
+ if(needToStoreListViewProps) {
5444
+ ${removeTableApiSessionStorageItems("/crud")};
5445
+ sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(selfData));
5446
+ }
5392
5447
  // 返回页码到UI界面
5393
5448
  payload.data.page= selfData.page;
5394
5449
  }