form-design-v3 1.0.6 → 1.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.
@@ -353,20 +353,53 @@ declare function registerComponent(def: WidgetDefinition): void;
353
353
  interface ApiConfig {
354
354
  /** 网关前缀(含环境),如 /bpmapi-uat;经 dev-server 代理时用相对路径 */
355
355
  baseUrl: string;
356
+ /**
357
+ * 统一登录站点地址(末尾带 /)。
358
+ *
359
+ * 库里不读自己的构建期 env(库产物里 `import.meta.env.*` 会被静态化,读不到宿主环境),
360
+ * 也不写死地址:按「宿主注入 > window 全局 > 空」的顺序取,
361
+ * 取到就会在 401 时自动跳转登录页。
362
+ */
363
+ loginSite?: string;
364
+ /**
365
+ * 登录态失效(HTTP 401)完整接管回调。
366
+ *
367
+ * 设了就完全交给它处理(不再走库内的 loginSite 跳转),
368
+ * 适合宿主已有自己的登录跳转实现(如 renderer 的全局 fetch 拦截)。
369
+ */
370
+ onUnauthorized?: () => void;
356
371
  }
357
372
  declare function configureApi(options: Partial<ApiConfig>): void;
358
373
  /** @deprecated 兼容旧名:baseModule 即网关前缀(不带前导斜杠也可) */
359
374
  declare function setBaseModule(module: string): void;
360
375
  /** @deprecated 兼容旧名:后端模块已固定为 formdesigner/v1,无需配置 */
361
376
  declare function setApiModule(_module: string): void;
377
+ /** 设置 401(登录态失效)回调;传 undefined 取消。宿主已自己接管跳转时使用 */
378
+ declare function setUnauthorizedHandler(handler?: () => void): void;
379
+ /**
380
+ * 设置统一登录站点地址(末尾带 /)。
381
+ * 宿主按自己的环境变量注入(如 renderer 的 VITE_APP_LOGIN_SITE),库不写死。
382
+ */
383
+ declare function setLoginSite(loginSite?: string): void;
384
+ /**
385
+ * 解析登录站点,优先级:setApiProps > setLoginSite > configureApi > window 全局。
386
+ * window 兜底让宿主无需改组件调用,只要在入口把环境变量挂到全局即可。
387
+ */
388
+ declare function resolveLoginSite(): string;
389
+ /** 跳转统一登录页:带上当前地址,登录后回到原页面;未配置站点时返回 false */
390
+ declare function redirectToLogin(): boolean;
362
391
 
363
392
  interface InstallOptions {
364
393
  /** 网关前缀(含环境),如 /bpmapi-uat;对应后端 api/formdesigner/v1 之前的部分 */
365
394
  baseUrl?: string;
395
+ /** 统一登录站点地址(跟随宿主环境变量,如 renderer 的 VITE_APP_LOGIN_SITE) */
396
+ loginSite?: string;
397
+ /** 完全接管 401 处理(设了就不再走库内 loginSite 跳转) */
398
+ onUnauthorized?: () => void;
366
399
  }
367
400
  declare const DesignerPlugin: {
368
401
  install(app: App, options?: InstallOptions): void;
369
402
  };
370
403
 
371
- export { _default$1 as Designer, LIFECYCLE_HOOKS, _default as Renderer, configureApi, DesignerPlugin as default, loadFormFromLocal, registerComponent, renderForm, setApiModule, setBaseModule };
404
+ export { _default$1 as Designer, LIFECYCLE_HOOKS, _default as Renderer, configureApi, DesignerPlugin as default, loadFormFromLocal, redirectToLogin, registerComponent, renderForm, resolveLoginSite, setApiModule, setBaseModule, setLoginSite, setUnauthorizedHandler };
372
405
  export type { BaseWidgetProps, CardWidgetProps, ColumnConfig, ColumnEditMode, CustomEvent, EditMode, EnumItem, FieldMeta, FormEvents, FormLifecycleEvents, FormMode, FormSchema, GridWidgetProps, HiddenMode, InstallOptions, LabelWidgetProps, LifecycleHook, RenderFormHandle, RenderFormOptions, RenderMode, SlotWidgetProps, SubtableDef, SubtableField, SubtableWidgetProps, TextWidgetProps, WidgetNode, WidgetProps, WidgetType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-design-v3",
3
- "version": "1.0.6",
3
+ "version": "1.1.7",
4
4
  "description": "流程表单设计器 / 渲染器 (Vue3 + TS)",
5
5
  "type": "module",
6
6
  "main": "./dist-lib/form-design-v3.umd.cjs",
@@ -47,7 +47,7 @@
47
47
  "author": "mt",
48
48
  "repository": {
49
49
  "type": "git",
50
- "url": "http://code.xincheng.com/oa/bpm_2.0.git",
50
+ "url": "https://code.xincheng.com/oa/bpm_2.0.git",
51
51
  "directory": "designer"
52
52
  },
53
53
  "peerDependencies": {
@@ -1,12 +0,0 @@
1
- {
2
- "name": "form-design-v3",
3
- "version": "1.0.1",
4
- "main": "CodeEditor-CJeYvarM.js",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
7
- },
8
- "keywords": [],
9
- "author": "",
10
- "license": "ISC",
11
- "description": ""
12
- }