@done-coding/admin-core 0.3.0 → 0.4.0

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.
Files changed (106) hide show
  1. package/es/bridge/index.mjs +87 -47
  2. package/es/components/app-layout/AppBody.vue.mjs +7 -0
  3. package/es/components/app-layout/AppBody.vue2.mjs +89 -0
  4. package/es/components/app-layout/AppBreadcrumb.vue.mjs +7 -0
  5. package/es/components/app-layout/AppBreadcrumb.vue2.mjs +58 -0
  6. package/es/components/app-layout/AppFooter.vue.mjs +7 -0
  7. package/es/components/app-layout/AppFooter.vue2.mjs +17 -0
  8. package/es/components/app-layout/AppHeader.vue.mjs +7 -0
  9. package/es/components/app-layout/AppHeader.vue2.mjs +99 -0
  10. package/es/components/app-layout/AppLayout.vue.mjs +7 -0
  11. package/es/components/app-layout/AppLayout.vue2.mjs +130 -0
  12. package/es/components/app-layout/AppPage.vue.mjs +7 -0
  13. package/es/components/app-layout/AppPage.vue2.mjs +39 -0
  14. package/es/components/app-layout/AppSidebar.vue.mjs +7 -0
  15. package/es/components/app-layout/AppSidebar.vue2.mjs +97 -0
  16. package/es/components/app-layout/index.mjs +32 -0
  17. package/es/components/display/ActionBtnGroup.vue.mjs +61 -0
  18. package/es/components/display/ActionBtnGroup.vue2.mjs +4 -0
  19. package/es/components/display/HeightProvider.vue.mjs +26 -26
  20. package/es/components/display/TabsHeader.vue.mjs +7 -0
  21. package/es/components/display/TabsHeader.vue2.mjs +76 -0
  22. package/es/components/display/TabsMain.vue.mjs +100 -5
  23. package/es/components/display/TabsMain.vue2.mjs +2 -95
  24. package/es/components/display/TabsNaturalFlow.vue.mjs +17 -0
  25. package/es/components/display/TabsNaturalFlow.vue2.mjs +4 -0
  26. package/es/components/display/TabsRefineFlow.vue.mjs +62 -0
  27. package/es/components/display/TabsRefineFlow.vue2.mjs +4 -0
  28. package/es/components/display/index.mjs +10 -8
  29. package/es/components/form/FormSearch.vue.mjs +2 -2
  30. package/es/components/form/FormSearch.vue2.mjs +107 -63
  31. package/es/components/form/form-search-utils.mjs +25 -0
  32. package/es/components/list-page/ListPage.vue.mjs +2 -2
  33. package/es/components/list-page/ListPage.vue2.mjs +82 -76
  34. package/es/components/misc/ActionBtn.vue.mjs +84 -65
  35. package/es/components/misc/ActionConfirm.vue.mjs +1 -1
  36. package/es/components/misc/ActionConfirm.vue2.mjs +77 -71
  37. package/es/components/misc/SelectModule.vue.mjs +55 -0
  38. package/es/components/misc/SelectModule.vue2.mjs +4 -0
  39. package/es/components/modal/ConfirmModal.vue.mjs +1 -1
  40. package/es/components/modal/ConfirmModal.vue2.mjs +13 -12
  41. package/es/components/modal/modal-shelf-hierarchy.mjs +4 -6
  42. package/es/components/table/TableMain.vue.mjs +3 -3
  43. package/es/components/table/TableMain.vue2.mjs +103 -102
  44. package/es/components/table/ToolbarButtons.vue.mjs +10 -40
  45. package/es/hooks/use-breakpoint.mjs +40 -0
  46. package/es/hooks/use-channel-viewport-height.mjs +18 -0
  47. package/es/index.mjs +165 -128
  48. package/es/inject/key.mjs +18 -8
  49. package/es/router/guard/index.mjs +31 -0
  50. package/es/router/guard/login.mjs +4 -0
  51. package/es/router/guard/permission.mjs +4 -0
  52. package/es/store/app.mjs +103 -0
  53. package/es/store/router-permission.mjs +65 -0
  54. package/es/store/user.mjs +52 -52
  55. package/es/style.css +1 -1
  56. package/package.json +3 -2
  57. package/types/bridge/index.d.ts +193 -89
  58. package/types/components/app-layout/AppBody.vue.d.ts +45 -0
  59. package/types/components/app-layout/AppBreadcrumb.vue.d.ts +25 -0
  60. package/types/components/app-layout/AppFooter.vue.d.ts +2 -0
  61. package/types/components/app-layout/AppHeader.vue.d.ts +55 -0
  62. package/types/components/app-layout/AppLayout.vue.d.ts +76 -0
  63. package/types/components/app-layout/AppPage.vue.d.ts +54 -0
  64. package/types/components/app-layout/AppSidebar.vue.d.ts +51 -0
  65. package/types/components/app-layout/index.d.ts +27 -0
  66. package/types/components/app-layout/types.d.ts +43 -0
  67. package/types/components/display/ActionBtnGroup.vue.d.ts +16 -0
  68. package/types/components/display/HeightProvider.vue.d.ts +10 -6
  69. package/types/components/display/TabsHeader.vue.d.ts +42 -0
  70. package/types/components/display/TabsMain.vue.d.ts +49 -7
  71. package/types/components/display/TabsNaturalFlow.vue.d.ts +16 -0
  72. package/types/components/display/TabsRefineFlow.vue.d.ts +53 -0
  73. package/types/components/display/index.d.ts +16 -13
  74. package/types/components/display/types.d.ts +85 -29
  75. package/types/components/form/form-search-utils.d.ts +24 -0
  76. package/types/components/form/types.d.ts +7 -1
  77. package/types/components/list-page/types.d.ts +1 -1
  78. package/types/components/misc/ActionBtn.vue.d.ts +17 -23
  79. package/types/components/misc/ActionConfirm.vue.d.ts +56 -27
  80. package/types/components/misc/SelectModule.vue.d.ts +2 -0
  81. package/types/components/misc/index.d.ts +11 -1
  82. package/types/components/misc/types.d.ts +35 -26
  83. package/types/components/modal/ConfirmModal.vue.d.ts +17 -0
  84. package/types/components/modal/modal-shelf-hierarchy.d.ts +1 -1
  85. package/types/components/table/types.d.ts +14 -12
  86. package/types/helpers/index.d.ts +10 -3
  87. package/types/hooks/index.d.ts +2 -0
  88. package/types/hooks/use-breakpoint.d.ts +4 -0
  89. package/types/hooks/use-channel-viewport-height.d.ts +28 -0
  90. package/types/index.d.ts +4 -1
  91. package/types/inject/key.d.ts +35 -10
  92. package/types/router/guard/index.d.ts +21 -0
  93. package/types/router/guard/login.d.ts +5 -0
  94. package/types/router/guard/permission.d.ts +5 -0
  95. package/types/router/guard/types.d.ts +15 -0
  96. package/types/router/index.d.ts +1 -0
  97. package/types/store/app.d.ts +149 -0
  98. package/types/store/index.d.ts +2 -0
  99. package/types/store/router-permission.d.ts +80 -0
  100. package/types/store/user.d.ts +11 -9
  101. /package/es/{helpers → bridge}/route.mjs +0 -0
  102. /package/es/{helpers → bridge}/state.mjs +0 -0
  103. /package/es/{helpers → bridge}/storage.mjs +0 -0
  104. /package/types/{helpers → bridge}/route.d.ts +0 -0
  105. /package/types/{helpers → bridge}/state.d.ts +0 -0
  106. /package/types/{helpers → bridge}/storage.d.ts +0 -0
@@ -1,46 +1,102 @@
1
- import { Component } from 'vue';
1
+ import { Component, ComputedRef, VNode } from 'vue';
2
2
 
3
+ /** ActionBtnGroup 按钮 size 枚举(对齐 element-plus ElButton size) */
4
+ export type ActionBtnSize = "large" | "default" | "small";
3
5
  /**
4
- * `HeightProvider` 组件 props。
5
- *
6
- * 单组件即一个高度预算节点:预算优先级严格为
7
- * `height`(显式传入)→ channel 最近祖先 HeightProvider inject 下分的
8
- * 剩余高度 → 兜底 `0`。节点扣除自身 `#header` 槽实测高度后,
9
- * 将剩余可用高度沿同 channel `provide` 给后代,形成递归预算链。
6
+ * ActionBtnGroup 单项配置
7
+ * ---
8
+ * 泛型 Ctx 由消费方决定形状(toolbar 传 ToolbarButtonContext / 表格 OPERATE 列传 row 上下文 / 等)。
9
+ * FormItem.render 三态对标:string(全局组件名)/ Component(对象/异步)/ functional((props) => VNode)。
10
10
  */
11
+ export interface ActionBtnConfigItem<Ctx = void> {
12
+ /** 唯一标识 */
13
+ key: string;
14
+ /** ActionBtn props 工厂(含 confirmConfig / beforeOpen / ElButton 全透传),与 props 二选一优先 */
15
+ actionBtnProps?: (ctx: Ctx) => Record<string, any>;
16
+ /** ElButton props 工厂,与 actionBtnProps 二选一 */
17
+ props?: (ctx: Ctx) => Record<string, any>;
18
+ /** 按钮文字;render 缺省时回退 */
19
+ label?: string;
20
+ /**
21
+ * 按钮内容 render(对标 FormItem.render 三态);优先级高于 label。
22
+ * - string:全局注册组件名
23
+ * - Component:对象/异步组件
24
+ * - functional:`(props: { ctx }) => VNode`——通过 `:ctx` prop 拿到上下文
25
+ */
26
+ render?: string | Component | ((props: {
27
+ ctx: Ctx;
28
+ }) => VNode);
29
+ /** 显示条件,返回 false 跳过该项;缺省视为 true */
30
+ show?: (ctx: Ctx) => boolean;
31
+ }
32
+ /** ActionBtnGroup props */
33
+ export interface ActionBtnGroupProps<Ctx = void> {
34
+ /** 按钮配置列表 */
35
+ configs?: ActionBtnConfigItem<Ctx>[];
36
+ /** 渲染上下文(透传给每项 actionBtnProps / props / render / show) */
37
+ ctx: Ctx;
38
+ /**
39
+ * 默认按钮 size——未传时不强加 size(沿用 ElButton 自身默认);
40
+ * 传入时作为基础 size 注入每项,业务侧 actionBtnProps / props 返回对象内显式 size 优先。
41
+ */
42
+ defaultSize?: ActionBtnSize;
43
+ }
44
+ /** HeightProvider props——见组件 JSDoc */
11
45
  export interface HeightProviderProps {
12
- /** px,预算最高优先级来源(非空时无视祖先 inject;height=0 视为显式 0) */
13
- height?: number;
14
- /** 预算 channel,默认 FULLSCREEN_HEIGHT_CHANNEL */
15
- channel?: symbol;
46
+ /** px,视口可用高度(必填) */
47
+ viewportHeight: number;
48
+ /** px,默认槽可用高度兜底下限;超 viewportHeight 时会撑破父容器(有意设计) */
49
+ minHeight?: number;
16
50
  }
17
- /**
18
- * `TabsMain` 单个 tab 项配置。
19
- *
20
- * 内容渲染优先级:`#{key}` 内容槽 > `component` > 空。
21
- * 标题渲染优先级:`#header-{key}` 标题槽 > `title` 文本。
22
- */
51
+ /** TabsMain 单个 tab 项配置 */
23
52
  export interface TabsMainItem {
24
- /** tab 唯一标识,v-model 值与槽名(#{key} / #header-{key})均以此为准 */
53
+ /** 唯一标识,v-model 值与槽名(#{key} / #header-{key})以此为准 */
25
54
  key: string;
26
- /** tab 标题文本,#header-{key} 槽缺省时回退此文本 */
55
+ /** 标题文本,#header-{key} 槽缺省时回退 */
27
56
  title: string;
28
- /** tab 内容组件,#{key} 槽缺省时回退渲染此组件 */
57
+ /** 内容组件,#{key} 槽缺省时回退渲染 */
29
58
  component?: Component;
30
59
  }
60
+ /** tabs 族跨节点高度联动 channel 的 inject payload */
61
+ export interface TabsChannelPayload {
62
+ /** 下一级 TabsMain 可消费的视口高度(响应式) */
63
+ viewportHeight: ComputedRef<number>;
64
+ /** 下一级嵌套深度(非响应式),顶层 = 1,每嵌套 +1;本期预埋不消费 */
65
+ level: number;
66
+ }
67
+ /** [top, right, bottom, left] px——TabsMain 默认插槽容器内置 padding(top+bottom 同步从 channel viewportHeight 扣减) */
68
+ export type TabsMainPadding = [number, number, number, number];
69
+ /**
70
+ * TabsHeader 视觉风格变体(与 level 字号解耦)。
71
+ * - card:浏览器 tabs 风格(active 三面 border + 两侧 100vw separator,真打通)
72
+ * - indicator:标准 2px 下划线
73
+ * - indicator-compact:紧凑 1px 下划线
74
+ * - plain:无装饰(active 加粗 + primary 字色)
75
+ */
76
+ export type TabsHeaderVariant = "card" | "indicator" | "indicator-compact" | "plain";
31
77
  /**
32
- * `TabsMain` 组件 props。
78
+ * TabsMain props。
33
79
  *
34
- * `channel` / `height` 原样透传内部组合的 HeightProvider,
35
- * tab-bar 占用 HeightProvider `#header` 槽并计入 reserve,
36
- * 内容区消费剩余可用高度。激活 tab 由 `v-model<string>` 双向绑定,
37
- * 非法或空值自动归一到首个 tab。
80
+ * 高度优先级:parentChannel inject > viewportHeight > inject `BODY_CONTENT_VIEWPORT_HEIGHT` > 0。
81
+ * channel / parentChannel [MUST NOT] 响应式变更(setup 期快照,变更 console.error 忽略)。
38
82
  */
39
83
  export interface TabsMainProps {
40
84
  /** tab 配置列表 */
41
85
  tabs: TabsMainItem[];
42
- /** 预算 channel,默认 FULLSCREEN_HEIGHT_CHANNEL,透传内部 HeightProvider */
43
- channel?: symbol;
44
- /** px,透传 HeightProvider 供顶层使用 */
45
- height?: number;
86
+ /** px,视口可用高度;未传时降级 BODY_CONTENT_VIEWPORT_HEIGHT 老链 */
87
+ viewportHeight?: number;
88
+ /** px,默认内容区高度兜底下限 */
89
+ minHeight?: number;
90
+ /** 作为父时的通道标识(字符串,内部 Symbol.for 跨包共享键) */
91
+ channel?: string;
92
+ /** 作为子时要消费的父通道标识 */
93
+ parentChannel?: string;
94
+ /** 默认插槽容器内置 padding [top,right,bottom,left],默认 [10,0,0,0];top+bottom 同步从 slot scope/channel viewportHeight 扣减 */
95
+ padding?: TabsMainPadding;
96
+ /** 精细化布局:true(默认) 走 HeightProvider 精确扣 header reserve + padding 给 available;false 不包 HeightProvider,默认槽 viewportHeight 直接给 viewportHeightFinal(不扣减),业务自然流 */
97
+ refine?: boolean;
98
+ /** 精细化预留高度(px),从 viewportHeightFinal 中预扣,refine=false 时同样生效 */
99
+ refineReduceHeight?: number;
100
+ /** 显式指定 TabsHeader 视觉风格,不传则按 visualLevel 推导默认(L1=card / L2=indicator / L3=indicator-compact / L4=plain)。字号始终跟随 level,不受 variant 影响。 */
101
+ variant?: TabsHeaderVariant;
46
102
  }
@@ -0,0 +1,24 @@
1
+ import { ColProps } from 'element-plus';
2
+ import { Breakpoint } from '../../hooks/use-breakpoint';
3
+
4
+ export declare const computeItemsPerRow: (span: number) => number;
5
+ /**
6
+ * 计算按钮 ElCol 的 offset,使其推到当前行最右。
7
+ * ElRow 共 24 格。
8
+ *
9
+ * @param visibleCount 可见表单项数量(不含按钮自身)
10
+ * @param span 当前断点下每个表单项的 span
11
+ */
12
+ export declare const computeButtonOffset: (visibleCount: number, span: number) => number;
13
+ /**
14
+ * 按每个响应断点分别计算按钮的 { span, offset },
15
+ * 返回可直接 v-bind 到 ElCol 的对象。
16
+ */
17
+ export declare const computeButtonColProps: (layout: Partial<ColProps> | undefined, visibleCount: number) => Record<string, {
18
+ span: number;
19
+ offset: number;
20
+ }>;
21
+ /**
22
+ * 计算当前断点下每行能容纳的表单项数。
23
+ */
24
+ export declare const getCurrentSpan: (layout: Partial<ColProps> | undefined, breakpoint: Breakpoint) => number;
@@ -1,5 +1,5 @@
1
1
  import { FormItemRule, ColProps, FormItemProps } from 'element-plus';
2
- import { VNode } from 'vue';
2
+ import { VNode, ComputedRef } from 'vue';
3
3
 
4
4
  export type OnlyOneKey<T extends Record<string, any>> = {
5
5
  [K in keyof T]: {
@@ -143,6 +143,10 @@ export interface FormSearchInstance extends FormMainInstance {
143
143
  triggerSearch: () => void;
144
144
  /** 触发重置 */
145
145
  triggerReset: () => void;
146
+ /** 切换折叠状态 */
147
+ toggleCollapse: (nextValue?: boolean) => void;
148
+ /** 当前折叠状态 */
149
+ isCollapsed: ComputedRef<boolean>;
146
150
  }
147
151
  /** FormItem props */
148
152
  export interface FormMainItemProps {
@@ -162,6 +166,8 @@ export interface FormSearchProps<PO extends Record<string, any>, SO extends Reco
162
166
  labelWidth?: string;
163
167
  /** 静态参数(非表单 非分页参数) */
164
168
  staticQuery?: SQ;
169
+ /** 最多展示行数,超出折叠。0 = 不折叠。默认 2 */
170
+ maxRows?: number;
165
171
  }
166
172
  /** form item loading 信息 */
167
173
  export interface FormItemLoadingInfo {
@@ -3,7 +3,7 @@ import { TableApiParams, TableApiResult, TableMainInstance, TableMainProps } fro
3
3
 
4
4
  export type FormSearchOptionsKey = "staticQuery";
5
5
  export type FormSearchRewriteKey = "list";
6
- export type TableMainOptionsKey = "refine" | "refineReduceHeight";
6
+ export type TableMainOptionsKey = "refine" | "refineReduceHeight" | "viewportHeight" | "parentChannel";
7
7
  export type TableMainRequiredKey = "columns" | "rowKey";
8
8
  export type TableMainRewriteKey = "api" | "query" | "injectInfo";
9
9
  export type ListPageInnerInjectInfo<PO extends Record<string, any>,
@@ -1,26 +1,20 @@
1
- import { ActionBtnProps } from './types';
1
+ import { ActionBtnConfirmConfig } from './types';
2
2
 
3
- declare function __VLS_template(): {
4
- default?(_: {}): any;
3
+ declare const _default: <T = void>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{
5
+ readonly onClick?: ((evt: MouseEvent) => any) | undefined;
6
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & (Omit<import('element-plus').ButtonProps, "loading"> & {
7
+ confirmMode?: import('./types').ActionConfirmMode;
8
+ confirmConfig?: ActionBtnConfirmConfig | ((data: T) => ActionBtnConfirmConfig) | undefined;
9
+ beforeOpen?: (() => Promise<T>) | undefined;
10
+ }), keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
11
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
12
+ attrs: any;
13
+ slots: ReturnType<() => {
14
+ default?(_: {}): any;
15
+ }>;
16
+ emit: (evt: "click", evt: MouseEvent) => void;
17
+ }>) => import('vue').VNode & {
18
+ __ctx?: Awaited<typeof __VLS_setup>;
5
19
  };
6
- declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ActionBtnProps>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
7
- click: (evt: MouseEvent) => void;
8
- }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ActionBtnProps>>> & Readonly<{
9
- onClick?: ((evt: MouseEvent) => any) | undefined;
10
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
11
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
12
20
  export default _default;
13
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
- type __VLS_TypePropsToRuntimeProps<T> = {
15
- [K in keyof T]-?: {} extends Pick<T, K> ? {
16
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
- } : {
18
- type: import('vue').PropType<T[K]>;
19
- required: true;
20
- };
21
- };
22
- type __VLS_WithTemplateSlots<T, S> = T & {
23
- new (): {
24
- $slots: S;
25
- };
26
- };
@@ -1,39 +1,68 @@
1
- import { ActionConfirmProps } from './types';
1
+ import { ActionConfirmTextResolver } from './types';
2
2
 
3
3
  declare function __VLS_template(): {
4
4
  default?(_: {}): any;
5
5
  };
6
- declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ActionConfirmProps>, {
7
- confirmText: string;
8
- cancelText: string;
9
- }>>, {
10
- run: () => Promise<boolean>;
11
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ActionConfirmProps>, {
12
- confirmText: string;
13
- cancelText: string;
14
- }>>> & Readonly<{}>, {
6
+ declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
7
+ show: import('vue').PropType<boolean>;
8
+ type: {
9
+ type: globalThis.PropType<"" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text">;
10
+ };
11
+ title: {
12
+ type: globalThis.PropType<ActionConfirmTextResolver>;
13
+ };
14
+ content: {
15
+ type: globalThis.PropType<ActionConfirmTextResolver>;
16
+ };
17
+ cancelText: {
18
+ type: globalThis.PropType<string>;
19
+ default: string;
20
+ };
21
+ confirmText: {
22
+ type: globalThis.PropType<string>;
23
+ default: string;
24
+ };
25
+ mode: {
26
+ type: globalThis.PropType<import('./types').ActionConfirmMode>;
27
+ required: true;
28
+ };
29
+ submitFn: {
30
+ type: globalThis.PropType<() => void | Promise<void>>;
31
+ required: true;
32
+ };
33
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
34
+ show: import('vue').PropType<boolean>;
35
+ type: {
36
+ type: globalThis.PropType<"" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text">;
37
+ };
38
+ title: {
39
+ type: globalThis.PropType<ActionConfirmTextResolver>;
40
+ };
41
+ content: {
42
+ type: globalThis.PropType<ActionConfirmTextResolver>;
43
+ };
44
+ cancelText: {
45
+ type: globalThis.PropType<string>;
46
+ default: string;
47
+ };
48
+ confirmText: {
49
+ type: globalThis.PropType<string>;
50
+ default: string;
51
+ };
52
+ mode: {
53
+ type: globalThis.PropType<import('./types').ActionConfirmMode>;
54
+ required: true;
55
+ };
56
+ submitFn: {
57
+ type: globalThis.PropType<() => void | Promise<void>>;
58
+ required: true;
59
+ };
60
+ }>> & Readonly<{}>, {
15
61
  cancelText: string;
16
62
  confirmText: string;
17
63
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
18
64
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
19
65
  export default _default;
20
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
- type __VLS_TypePropsToRuntimeProps<T> = {
22
- [K in keyof T]-?: {} extends Pick<T, K> ? {
23
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
24
- } : {
25
- type: import('vue').PropType<T[K]>;
26
- required: true;
27
- };
28
- };
29
- type __VLS_WithDefaults<P, D> = {
30
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
31
- default: D[K];
32
- }> : P[K];
33
- };
34
- type __VLS_Prettify<T> = {
35
- [K in keyof T]: T[K];
36
- } & {};
37
66
  type __VLS_WithTemplateSlots<T, S> = T & {
38
67
  new (): {
39
68
  $slots: S;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -6,7 +6,17 @@ import { default as ActionButtonDanger } from './ActionButtonDanger.vue';
6
6
  import { default as ActionButtonWarn } from './ActionButtonWarn.vue';
7
7
  import { default as ActionBtn } from './ActionBtn.vue';
8
8
  import { default as ActionConfirm } from './ActionConfirm.vue';
9
+ import { default as SelectModule } from './SelectModule.vue';
9
10
 
10
11
  export * from './types';
11
- export { TriggerAutoImport, AutoRefresh, ActionButton, ActionButtonDanger, ActionButtonWarn, ActionBtn, ActionConfirm, };
12
+ export { TriggerAutoImport, AutoRefresh, ActionBtn, ActionConfirm, SelectModule, };
13
+ /**
14
+ * @deprecated 改用 {@link ActionBtn}——`ActionBtn` 通过 `confirmConfig` 一体化承载
15
+ * loading 自动接管 + 同步/异步 confirm-gate(popconfirm / message-box 两种 mode),
16
+ * 并对 ElButton 全部 props 透传。`ActionButton` / `ActionButtonDanger` / `ActionButtonWarn`
17
+ * 三个旧组件计划后续版本移除;新代码请直接使用 `ActionBtn`,
18
+ * 危险态用 `<ActionBtn type="danger" :confirm-config="{ type: 'danger', ... }">`,
19
+ * 警告态用 `<ActionBtn :confirm-config="{ type: 'warning', ... }">`。
20
+ */
21
+ export { ActionButton, ActionButtonDanger, ActionButtonWarn };
12
22
  export declare const miscInstall: Plugin;
@@ -12,13 +12,14 @@ export type ActionConfirmTextResolver = string | (() => string | VNode[]);
12
12
  /**
13
13
  * ActionBtn 的确认配置(嵌套对象;无此配置则为普通按钮,不触发确认)。
14
14
  *
15
- * ⚠️ 瞬时用户激活限制:配置本项后,点击与原始 `@click` handler 之间隔了一次
16
- * 异步确认。原始点击的瞬时用户激活(transient user activation)此时已过期
17
- * (注意:事件对象 `isTrusted` 仍为 true,失效的是激活窗口而非事件本身)。
18
- * confirm 后的 handler [MUST NOT] 调用依赖用户激活的 API——`window.open`、
19
- * `navigator.clipboard.*`、`requestFullscreen` 等会被浏览器拦截。需要这类
20
- * 操作时改用不带 confirmConfig 的 ActionBtn / 普通按钮。此为 confirm-gate
21
- * 模式固有代价,组件层无法绕过。
15
+ * ⚠️ 瞬时用户激活限制:`confirmConfig` `beforeOpen` 均会异步打断点击的瞬时
16
+ * 用户激活窗口(transient user activation)——confirm 后 / beforeOpen 之后的
17
+ * handler 与原始点击之间隔了一次异步等待,原始激活此时已过期(注意:事件对象
18
+ * `isTrusted` 仍为 true,失效的是激活窗口而非事件本身)。故 confirm /
19
+ * beforeOpen 之后的 handler [MUST NOT] 调用依赖瞬时用户激活的 API——
20
+ * `window.open`、`navigator.clipboard.*`、`requestFullscreen` 等会被浏览器
21
+ * 拦截。需要这类操作时改用无 `confirmConfig` 且无 `beforeOpen` 的 ActionBtn /
22
+ * 普通按钮。此为 confirm-gate / async-prefetch 模式固有代价,组件层无法绕过。
22
23
  */
23
24
  export interface ActionBtnConfirmConfig {
24
25
  /** 确认标题 */
@@ -34,22 +35,37 @@ export interface ActionBtnConfirmConfig {
34
35
  }
35
36
  /**
36
37
  * ActionBtn 组件 props。
37
- * 完全兼容 ElButton(继承 ButtonProps),仅一处改写 + 两个增量:
38
+ * 完全兼容 ElButton(继承 ButtonProps),仅一处改写 + 三个增量:
38
39
  * - `loading` 被 Omit:有意的 ElButton 不兼容,唯一接管项——loading 由组件内部
39
- * 独占,对接异步 confirm 的进行态(innerLoading),对外不可设置。
40
+ * 独占,对接异步 confirm / beforeOpen 的进行态(innerLoading),对外不可设置。
40
41
  * - `disabled` 原生透传,不改写不扩展。
41
- * - 增量:`confirmMode` / `confirmConfig`。无 `ctx`、无泛型——动态数据由调用方
42
- * 在自身作用域闭包捕获,组件不做数据回环。
42
+ * - 增量:`confirmMode` / `confirmConfig` / `beforeOpen`。
43
+ * - 泛型 `T`:由 `beforeOpen` 返回值反推,并透传给 `confirmConfig` 函数形态的
44
+ * 入参;未传 `beforeOpen` 时默认 `T = void`,函数形态的 `data = undefined`。
43
45
  */
44
- export type ActionBtnProps = Omit<ButtonProps, "loading"> & {
46
+ export type ActionBtnProps<T = void> = Omit<ButtonProps, "loading"> & {
45
47
  /** 确认交互形态,仅在 confirmConfig 存在时生效,默认 "popconfirm" */
46
48
  confirmMode?: ActionConfirmMode;
47
- /** 确认配置;存在时点击需经确认闸门,确认后才触发 click */
48
- confirmConfig?: ActionBtnConfirmConfig;
49
+ /**
50
+ * 确认配置;存在时点击需经确认闸门,确认后才触发 click。
51
+ * - 对象形态:静态确认配置(向后兼容)。
52
+ * - 函数形态:`(data: T) => ActionBtnConfirmConfig`,`data` 来自 `beforeOpen`
53
+ * 返回值;无 `beforeOpen` 时 `data = undefined`(T 默认 `void`)。
54
+ */
55
+ confirmConfig?: ActionBtnConfirmConfig | ((data: T) => ActionBtnConfirmConfig);
56
+ /**
57
+ * 点击后、弹层前的异步预取钩子。
58
+ * - 返回值类型 `T` 反推给 `confirmConfig` 函数形态的入参。
59
+ * - 失败时静默退出(不弹层、不触发 `@click` handler);调用方 [MUST] 在内部
60
+ * 自行 catch 并显示反馈(如 `ElMessage.error`),忘记 catch 会"点了没反应"。
61
+ * - 期间按钮显 loading 态(`innerLoading`);同 `confirmConfig` 一样消耗
62
+ * 瞬时用户激活(详见 {@link ActionBtnConfirmConfig} 顶部注释)。
63
+ */
64
+ beforeOpen?: () => Promise<T>;
49
65
  };
50
66
  /**
51
67
  * ActionConfirm 组件 props(扁平,confirm 原语;可独立于 ActionBtn 消费)。
52
- * 触发元素由默认 slot 提供;确认流程经 defineExpose 的 `run()` 命令式驱动。
68
+ * 触发元素由默认 slot 提供;弹层可见性由 `v-model:show` 声明式驱动。
53
69
  */
54
70
  export interface ActionConfirmProps {
55
71
  /** 确认交互形态 */
@@ -65,16 +81,9 @@ export interface ActionConfirmProps {
65
81
  /** 确认按钮 type */
66
82
  type?: ButtonProps["type"];
67
83
  /**
68
- * 被确认闸住的待执行动作。用户点确认后调用;返回 Promise 时弹层保持不关、
69
- * 确认按钮 loading,直到 settle(成功或失败均结束)。
70
- */
71
- action: () => unknown | Promise<unknown>;
72
- }
73
- /** ActionConfirm 实例(defineExpose) */
74
- export interface ActionConfirmInstance {
75
- /**
76
- * 驱动一次确认流程。
77
- * @returns 已确认并完成 action → true;用户取消 → false
84
+ * 点击确认后调用。返回 Promise 时确认按钮 loading + 弹层保持不关,
85
+ * **仅成功(fulfill)才关闭弹层**;失败(reject 或同步 throw)时清 loading
86
+ * 弹层保持打开,错误由 `submitFn` 内部自行 catch 反馈。
78
87
  */
79
- run: () => Promise<boolean>;
88
+ submitFn: () => void | Promise<void>;
80
89
  }
@@ -1,3 +1,5 @@
1
+ import { ButtonProps } from 'element-plus';
2
+
1
3
  declare function __VLS_template(): {
2
4
  title?(_: {}): any;
3
5
  default?(_: {}): any;
@@ -28,6 +30,12 @@ declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractP
28
30
  closeOnClickModal?: boolean;
29
31
  /** 是否使用确认按钮loading */
30
32
  useLoading?: boolean;
33
+ /**
34
+ * 确认按钮 type(对齐 element-plus ElButton type)。
35
+ * 默认 'primary';danger / warning / success / info 全枚举均支持,
36
+ * 与 ActionConfirm popconfirm 模式按钮颜色行为对齐。
37
+ */
38
+ type?: ButtonProps["type"];
31
39
  }>, {
32
40
  showClose: boolean;
33
41
  cancelText: string;
@@ -37,6 +45,7 @@ declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractP
37
45
  reverse: boolean;
38
46
  closeOnPressEscape: boolean;
39
47
  closeOnClickModal: boolean;
48
+ type: string;
40
49
  }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
41
50
  "update:show": (value: boolean) => void;
42
51
  }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
@@ -60,6 +69,12 @@ declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractP
60
69
  closeOnClickModal?: boolean;
61
70
  /** 是否使用确认按钮loading */
62
71
  useLoading?: boolean;
72
+ /**
73
+ * 确认按钮 type(对齐 element-plus ElButton type)。
74
+ * 默认 'primary';danger / warning / success / info 全枚举均支持,
75
+ * 与 ActionConfirm popconfirm 模式按钮颜色行为对齐。
76
+ */
77
+ type?: ButtonProps["type"];
63
78
  }>, {
64
79
  showClose: boolean;
65
80
  cancelText: string;
@@ -69,9 +84,11 @@ declare const __VLS_component: import('vue').DefineComponent<globalThis.ExtractP
69
84
  reverse: boolean;
70
85
  closeOnPressEscape: boolean;
71
86
  closeOnClickModal: boolean;
87
+ type: string;
72
88
  }>>> & Readonly<{
73
89
  "onUpdate:show"?: ((value: boolean) => any) | undefined;
74
90
  }>, {
91
+ type: "" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text";
75
92
  showClose: boolean;
76
93
  cancelText: string | (() => VNode);
77
94
  confirmText: string | (() => VNode);
@@ -1,7 +1,7 @@
1
1
  import { ModalLevel } from './modal-shelf-types';
2
2
 
3
3
  /**
4
- * 层级合法性:app 必最顶层;page 祖先仅允许 app;custom 可嵌套任何(含 custom 套 custom)。
4
+ * 层级合法性:app 必最顶层;page 祖先允许 app/page(父子页面嵌套场景),仅禁止 custom;custom 可嵌套任何(含 custom 套 custom)。
5
5
  * 非法仅开发期 console.error,不抛、不静默。
6
6
  */
7
7
  export declare function assertLevelHierarchy(level: ModalLevel, ancestorLevels: ModalLevel[]): void;
@@ -3,6 +3,7 @@ import { APP_API_LIST_MODEL_KEY_CONFIG, BuildListParams } from '../../config';
3
3
  import { DotToObject, UnionToIntersection } from '../../types';
4
4
  import { ExportColumnConfig } from '../../utils';
5
5
  import { ExtractPropTypes, VNode } from 'vue';
6
+ import { ActionBtnConfigItem } from '../display';
6
7
 
7
8
  /**
8
9
  * 表格请求参数
@@ -61,18 +62,15 @@ export interface ToolbarButtonContext<T extends Record<string, any> = Record<str
61
62
  total: number;
62
63
  };
63
64
  }
64
- /** toolbar 额外按钮配置 */
65
- export interface ToolbarButtonConfig<T extends Record<string, any> = Record<string, any>> {
66
- key: string;
67
- /** ElButton props,与 actionButtonProps 二选一 */
68
- props?: (ctx: ToolbarButtonContext<T>) => Record<string, any>;
69
- /** ActionButton props(含 data/tipContent),与 props 二选一 */
70
- actionButtonProps?: (ctx: ToolbarButtonContext<T>) => Record<string, any>;
71
- /** 按钮文字。btnRender 优先 */
72
- label?: string;
73
- /** 按钮内容 render,优先级高于 label */
74
- btnRender?: (ctx: ToolbarButtonContext<T>) => VNode[];
75
- }
65
+ /**
66
+ * toolbar 额外按钮配置(BL-4 / 2026-05-26 重定义为 ActionBtnConfigItem 别名)
67
+ * ---
68
+ * 跨族迁移到 display/ActionBtnGroup 后,本类型沦为通用配置的 toolbar 特化别名;
69
+ * 字段集与 ActionBtnConfigItem 完全一致(key / actionBtnProps / props / label / render / show)。
70
+ * 旧的 VNode[] 返回函数字段已移除,render 三态(string | Component | functional)
71
+ * 对标 FormItem;升级路径见 MIGRATION.md BL-4 节。
72
+ */
73
+ export type ToolbarButtonConfig<T extends Record<string, any> = Record<string, any>> = ActionBtnConfigItem<ToolbarButtonContext<T>>;
76
74
  /** toolbar 可配置项(通过 TableMain 的 toolbar prop 传入) */
77
75
  export interface TableToolbarConfig {
78
76
  /** 是否显示刷新按钮,默认 true */
@@ -173,4 +171,8 @@ F extends Record<string, any>> {
173
171
  injectInfo?: F;
174
172
  /** 数据视口最大高度最小值 */
175
173
  dataViewMaxHeightMinValue?: number;
174
+ /** 视口可用高度(优先级高于 BODY_CONTENT_VIEWPORT_HEIGHT 老链 inject,低于 parentChannel inject);未传时回退 inject 链 + fallback 500 */
175
+ viewportHeight?: number;
176
+ /** 父级 tabs 族 channel 标识(setup 期 Symbol.for 快照,变更 console.error 忽略);命中后高度从父级 inject 取,优先级最高 */
177
+ parentChannel?: string;
176
178
  }
@@ -1,6 +1,13 @@
1
1
  export * from './form';
2
- export * from './storage';
3
- export * from './state';
4
- export * from './route';
5
2
  export * from './types';
6
3
  export * from './list-helper';
4
+ /** @deprecated 改用 appAdminBridge.useState() */
5
+ export { createUseState } from '../bridge/state';
6
+ /** @deprecated 改用 appAdminBridge.useState() */
7
+ export type { UseStateOptions } from '../bridge/state';
8
+ /** @deprecated 改用 appAdminBridge.generateRouteMetaRawTree() */
9
+ export { createGenerateRouteMetaRawTree } from '../bridge/route';
10
+ /** @deprecated 改用 appAdminBridge.generateRouteMetaRawTree() */
11
+ export type { RouteMetaDefaultConfig } from '../bridge/route';
12
+ /** @deprecated 改用 appAdminBridge.getStorage() */
13
+ export { createStorageWithNamespace } from '../bridge/storage';
@@ -1,4 +1,6 @@
1
+ export * from './use-breakpoint';
1
2
  export * from './activated';
2
3
  export * from './feel-size';
3
4
  export * from './menus-dispatch';
4
5
  export * from './timeout';
6
+ export * from './use-channel-viewport-height';
@@ -0,0 +1,4 @@
1
+ export type Breakpoint = "xs" | "sm" | "md" | "lg" | "xl";
2
+ export declare const useBreakpoint: () => {
3
+ activeBreakpoint: Readonly<globalThis.Ref<Breakpoint, Breakpoint>>;
4
+ };
@@ -0,0 +1,28 @@
1
+ import { ComputedRef } from 'vue';
2
+
3
+ /** useChannelViewportHeight 第二参数 options */
4
+ export interface UseChannelViewportHeightOptions {
5
+ /** body inject 未命中时的最终兜底,默认 0 */
6
+ fallback?: number;
7
+ }
8
+ /** useChannelViewportHeight 入参对象形状(约定 reactive,props 即满足) */
9
+ export interface UseChannelViewportHeightMaybeProps {
10
+ /** props.viewportHeight,优先级位于 parentChannel inject 之下、body inject 之上 */
11
+ viewportHeight?: number;
12
+ /** tabs 族 channel 父级标识——setup 期 Symbol.for 快照,变更 console.error 忽略 */
13
+ parentChannel?: string;
14
+ }
15
+ /** useChannelViewportHeight 返回值 */
16
+ export interface UseChannelViewportHeightReturn {
17
+ /** 最终视口高度,链路 parentChannel > viewportHeight > body inject > fallback */
18
+ viewportHeightFinal: ComputedRef<number>;
19
+ /** parent inject 命中时取 payload.level,否则 0;调用方算 childLevel = parentLevel + 1 */
20
+ parentLevel: ComputedRef<number>;
21
+ }
22
+ /**
23
+ * tabs 族 channel 视口高度解析 hook。
24
+ * 链路:parentChannel inject > maybeProps.viewportHeight > body inject > options.fallback。
25
+ * `parentChannel` setup 期 Symbol.for 快照,变更 console.error 忽略(非响应式)。
26
+ * 入参 maybeProps 约定 reactive 对象(props 即满足);返回 viewportHeightFinal/parentLevel 均为 computed。
27
+ */
28
+ export declare const useChannelViewportHeight: (maybeProps: UseChannelViewportHeightMaybeProps, options?: UseChannelViewportHeightOptions) => UseChannelViewportHeightReturn;
package/types/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import { modalInstall } from './components/modal';
7
7
  import { tableInstall } from './components/table';
8
8
  import { listPageInstall } from './components/list-page';
9
9
  import { panelInstall } from './components/panel';
10
+ import { appLayoutInstall } from './components/app-layout';
10
11
 
11
12
  export * from './components/form';
12
13
  export * from './components/menu';
@@ -16,6 +17,8 @@ export * from './components/modal';
16
17
  export * from './components/table';
17
18
  export * from './components/list-page';
18
19
  export * from './components/panel';
20
+ export * from './components/app-layout';
21
+ export * from './router';
19
22
  export * from './utils';
20
23
  export * from './hooks';
21
24
  export * from './types';
@@ -24,5 +27,5 @@ export * from './inject';
24
27
  export * from './helpers';
25
28
  export * from './bridge';
26
29
  export * from './store';
27
- export { formInstall, menuInstall, displayInstall, miscInstall, modalInstall, tableInstall, listPageInstall, panelInstall, };
30
+ export { formInstall, menuInstall, displayInstall, miscInstall, modalInstall, tableInstall, listPageInstall, panelInstall, appLayoutInstall, };
28
31
  export declare const installComponents: Plugin;