@oj-module/runtime 0.1.20 → 0.1.21

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.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 本页自己的页签 key(`removeTrailingSlash(pathname)`),供 `setTableTitle` /
3
+ * `resetTableTitle` / `addTab` 定位页签。
4
+ *
5
+ * keepAlive 陷阱:keepalive-for-react 把页面缓存在隐藏 portal 里,而 LocationContext
6
+ * 在 KeepAlive **之上**——切 tab 时缓存树随**激活页**位置重渲染,缓存页里的
7
+ * `useLocation()` 返回的是别家页签的路径。若拿它当页签 key,`setTableTitle` 会把
8
+ * 本页标题写到当前激活页签上(最后打开的文档页把之后切换到的每个页签都改成自己的标题)。
9
+ *
10
+ * 页签存活期内 key 不变(宿主 cacheKey = pathname+search,一页一路径),故首渲染
11
+ * (此时本页必是激活页)捕获一次即可;缓存树后续多少次重渲染都不会漂移。
12
+ * 需要跟随导航的位置信息请直接用 `useLocation`,不要用本 hook。
13
+ */
14
+ export declare function useTabKey(): string;
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export { PageError } from "./components/page-error";
26
26
  export * from "./constants/options";
27
27
  export * from "./hooks/use-access";
28
28
  export { usePreferences } from "./hooks/use-preferences";
29
+ export { useTabKey } from "./hooks/use-tab-key";
29
30
  export * from "./icons";
30
31
  export { LayoutEffects } from "./layout/layout-effects";
31
32
  export { setupI18n } from "./locales";
package/dist/runtime.js CHANGED
@@ -255,10 +255,10 @@ function getAppInfo() {
255
255
  return {
256
256
  "pkg": {
257
257
  "name": "@oj-module/runtime",
258
- "version": "0.1.20",
258
+ "version": "0.1.21",
259
259
  "license": "MIT"
260
260
  },
261
- "lastBuildTime": "2026-10-15 16:50:57"
261
+ "lastBuildTime": "2026-10-15 18:45:29"
262
262
  };
263
263
  }
264
264
  var init_get_app_info = __esmMin((() => {}));
@@ -9372,6 +9372,28 @@ function getBooleanOptions(t) {
9372
9372
  }];
9373
9373
  }
9374
9374
  //#endregion
9375
+ //#region src/hooks/use-tab-key/index.ts
9376
+ init_remove_trailing_slash();
9377
+ /**
9378
+ * 本页自己的页签 key(`removeTrailingSlash(pathname)`),供 `setTableTitle` /
9379
+ * `resetTableTitle` / `addTab` 定位页签。
9380
+ *
9381
+ * keepAlive 陷阱:keepalive-for-react 把页面缓存在隐藏 portal 里,而 LocationContext
9382
+ * 在 KeepAlive **之上**——切 tab 时缓存树随**激活页**位置重渲染,缓存页里的
9383
+ * `useLocation()` 返回的是别家页签的路径。若拿它当页签 key,`setTableTitle` 会把
9384
+ * 本页标题写到当前激活页签上(最后打开的文档页把之后切换到的每个页签都改成自己的标题)。
9385
+ *
9386
+ * 页签存活期内 key 不变(宿主 cacheKey = pathname+search,一页一路径),故首渲染
9387
+ * (此时本页必是激活页)捕获一次即可;缓存树后续多少次重渲染都不会漂移。
9388
+ * 需要跟随导航的位置信息请直接用 `useLocation`,不要用本 hook。
9389
+ */
9390
+ function useTabKey() {
9391
+ const { pathname } = useLocation();
9392
+ const keyRef = useRef(void 0);
9393
+ if (keyRef.current === void 0) keyRef.current = removeTrailingSlash(pathname);
9394
+ return keyRef.current;
9395
+ }
9396
+ //#endregion
9375
9397
  //#region src/module-loader/define-module.ts
9376
9398
  /**
9377
9399
  * 声明一个模块。
@@ -27441,4 +27463,4 @@ init_ri();
27441
27463
  init_menu_icons();
27442
27464
  init_tree();
27443
27465
  //#endregion
27444
- export { AccessControl, AccessControlRoles, AntdApp, BasicButton, BasicContent, BasicTable, EmbeddedIcon, ErrorBoundary, ExternalIcon, FormAvatarItem, FormTreeItem, Iframe, LayoutCenterIcon, LayoutEffects, LayoutLeftIcon, LayoutRightIcon, MixedNavigationIcon, OutsidePageIcon, PageError, ProfileCardIcon, RiAccountCircleLine, RiContrastFill, RiFullscreenExitLine, RiFullscreenLine, RiMailCheckLine, RiMoonIcon, RiReactjsLine, RiSunIcon, RiUserSettingsLine, ServerErrorIcon, SideNavigationIcon, TopNavigationIcon, TwoColumnNavigationIcon, accessControlCodes, defineModule, fetchAddMenuItem, fetchAddRoleItem, fetchAsyncRoutes, fetchDeleteMenuItem, fetchDeleteRoleItem, fetchLogin, fetchLogout, fetchMenuByRoleId, fetchMenuList, fetchRefreshToken, fetchRoleList, fetchRoleMenu, fetchUpdateMenuItem, fetchUpdateRoleItem, fetchUserInfo, filterTree, getAllExpandedKeys, getAppInfo, getBooleanOptions, getModule, getModules, getRedirectPath, getRegisteredApiPrefix, getRegisteredStore, getRoutes, getYesNoOptions, handleTree, loadAll, mapTree, menuIcons, notify, permissionPrefix, setupI18n, traverseTreeValues, unloadModule, useAccess, useAuthStore, usePreferences, useSlotNodes, useTabsStore, useUserStore, external_exports as z };
27466
+ export { AccessControl, AccessControlRoles, AntdApp, BasicButton, BasicContent, BasicTable, EmbeddedIcon, ErrorBoundary, ExternalIcon, FormAvatarItem, FormTreeItem, Iframe, LayoutCenterIcon, LayoutEffects, LayoutLeftIcon, LayoutRightIcon, MixedNavigationIcon, OutsidePageIcon, PageError, ProfileCardIcon, RiAccountCircleLine, RiContrastFill, RiFullscreenExitLine, RiFullscreenLine, RiMailCheckLine, RiMoonIcon, RiReactjsLine, RiSunIcon, RiUserSettingsLine, ServerErrorIcon, SideNavigationIcon, TopNavigationIcon, TwoColumnNavigationIcon, accessControlCodes, defineModule, fetchAddMenuItem, fetchAddRoleItem, fetchAsyncRoutes, fetchDeleteMenuItem, fetchDeleteRoleItem, fetchLogin, fetchLogout, fetchMenuByRoleId, fetchMenuList, fetchRefreshToken, fetchRoleList, fetchRoleMenu, fetchUpdateMenuItem, fetchUpdateRoleItem, fetchUserInfo, filterTree, getAllExpandedKeys, getAppInfo, getBooleanOptions, getModule, getModules, getRedirectPath, getRegisteredApiPrefix, getRegisteredStore, getRoutes, getYesNoOptions, handleTree, loadAll, mapTree, menuIcons, notify, permissionPrefix, setupI18n, traverseTreeValues, unloadModule, useAccess, useAuthStore, usePreferences, useSlotNodes, useTabKey, useTabsStore, useUserStore, external_exports as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oj-module/runtime",
3
3
  "type": "module",
4
- "version": "0.1.20",
4
+ "version": "0.1.21",
5
5
  "description": "React Antd Admin 框架运行时,供模块工程消费",
6
6
  "license": "MIT",
7
7
  "imports": {