mantur-components 0.1.5 → 0.1.7

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/README.md CHANGED
@@ -193,15 +193,33 @@ formatDateByLang("2026-05-19T12:00:00Z", "datetime", "en-US");
193
193
 
194
194
  未传语言时会读取组件库当前语言;中文输出 `YYYY-MM-DD` / `YYYY-MM-DD HH:mm:ss`,英文输出 `MM/DD/YYYY` / `MM/DD/YYYY HH:mm:ss`。
195
195
 
196
+ ## 主应用跳转工具
197
+
198
+ 组件库导出 `redirectToManturMain`,用于从当前子应用跳转到主应用入口:
199
+
200
+ ```ts
201
+ import { redirectToManturMain } from "mantur-components";
202
+
203
+ redirectToManturMain(import.meta.env.VITE_MAIN_PREFIX, import.meta.env.VITE_APP_NAME);
204
+ ```
205
+
206
+ 行为说明:
207
+
208
+ - `VITE_MAIN_PREFIX` 为空时按 dev 环境处理,跳转到当前 URL 的 80 端口。
209
+ - `VITE_MAIN_PREFIX` 存在时,将当前 URL 的子域名替换为 `VITE_MAIN_PREFIX`。
210
+ - 非 dev 跳转会追加 `appName=VITE_APP_NAME` 和 `redirect=当前路由地址` 参数。
211
+ - 需要只生成 URL 不跳转时,可传 `{ navigate: false }`。
212
+
196
213
  ## 公共导出
197
214
 
198
215
  ```ts
199
- import { ManturHeader, formatDateByLang } from "mantur-components";
216
+ import { ManturHeader, formatDateByLang, redirectToManturMain } from "mantur-components";
200
217
  import type {
201
218
  ManturDateFormatType,
202
219
  ManturDateInput,
203
220
  ManturHeaderProps,
204
221
  ManturHeaderUser,
222
+ ManturMainRedirectOptions,
205
223
  ManturTenant,
206
224
  ManturTenantContextDetail,
207
225
  } from "mantur-components";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export { ManturHeader } from "./header";
2
2
  export { formatDateByLang } from "./utils/date";
3
3
  export type { ManturDateFormatType, ManturDateInput } from "./utils/date";
4
+ export { redirectToManturMain } from "./utils/url";
5
+ export type { ManturMainRedirectOptions } from "./utils/url";
4
6
  export type { ManturHeaderLabels, ManturHeaderProps, ManturHeaderUser, ManturProfileValues, ManturRole, ManturTenant, ManturTenantAuthContext, ManturTenantContextDetail, ManturUserPoints, } from "./types";