@done-coding/admin-core 0.9.0 → 0.9.1-alpha.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.
- package/docs/nested-config-paradigm.md +80 -0
- package/es/bridge/theme.mjs +41 -38
- package/es/components/app-layout/AppTheme.vue.mjs +2 -2
- package/es/components/app-layout/AppTheme.vue2.mjs +19 -19
- package/es/components/form/FormItemNestForm.vue.mjs +7 -0
- package/es/components/form/FormItemNestForm.vue2.mjs +49 -0
- package/es/components/form/FormItemNestFormList.vue.mjs +7 -0
- package/es/components/form/FormItemNestFormList.vue2.mjs +137 -0
- package/es/components/form/FormMain.vue.mjs +5 -140
- package/es/components/form/FormMain.vue2.mjs +160 -2
- package/es/components/form/FormSearch.vue.mjs +2 -2
- package/es/components/form/FormSearch.vue2.mjs +43 -42
- package/es/components/form/FormSubmitPanel.vue2.mjs +21 -20
- package/es/components/form/nest-form-item-list.mjs +71 -0
- package/es/components/form/nest-form-item.mjs +42 -0
- package/es/components/form/nest-registry.mjs +7 -0
- package/es/components/form/use-nest-form-list.mjs +22 -0
- package/es/components/form/use-nest-form.mjs +34 -0
- package/es/components/form/use-nest-layout-scale.mjs +14 -0
- package/es/components/form/utils.mjs +77 -61
- package/es/components/modal/ConfirmModal.vue.mjs +1 -2
- package/es/components/modal/ConfirmModal.vue2.mjs +73 -94
- package/es/components/modal/DetailModal.vue.mjs +6 -6
- package/es/components/panel/PanelItemNestForm.vue.mjs +7 -0
- package/es/components/panel/PanelItemNestForm.vue2.mjs +69 -0
- package/es/components/panel/PanelItemNestPanel.vue.mjs +34 -0
- package/es/components/panel/PanelItemNestPanel.vue2.mjs +4 -0
- package/es/components/panel/PanelMain.vue.mjs +2 -2
- package/es/components/panel/PanelMain.vue2.mjs +52 -45
- package/es/components/panel/nest-panel-form.mjs +53 -0
- package/es/components/panel/nest-panel-item.mjs +25 -0
- package/es/index.mjs +182 -153
- package/es/inject/key.mjs +12 -6
- package/es/style.css +1 -1
- package/package.json +2 -2
- package/types/bridge/index.d.ts +3 -3
- package/types/bridge/theme.d.ts +22 -3
- package/types/components/form/FormItemNestForm.vue.d.ts +36 -0
- package/types/components/form/FormItemNestFormList.vue.d.ts +63 -0
- package/types/components/form/FormMain.vue.d.ts +2 -2
- package/types/components/form/FormSearch.vue.d.ts +2 -2
- package/types/components/form/index.d.ts +9 -1
- package/types/components/form/nest-form-item-list.d.ts +63 -0
- package/types/components/form/nest-form-item.d.ts +36 -0
- package/types/components/form/nest-registry.d.ts +22 -0
- package/types/components/form/types.d.ts +2 -0
- package/types/components/form/use-nest-form-list.d.ts +20 -0
- package/types/components/form/use-nest-form.d.ts +26 -0
- package/types/components/form/use-nest-layout-scale.d.ts +17 -0
- package/types/components/form/utils.d.ts +26 -1
- package/types/components/panel/PanelItemNestForm.vue.d.ts +35 -0
- package/types/components/panel/PanelItemNestPanel.vue.d.ts +22 -0
- package/types/components/panel/index.d.ts +5 -1
- package/types/components/panel/nest-panel-form.d.ts +38 -0
- package/types/components/panel/nest-panel-item.d.ts +28 -0
- package/types/components/panel/types.d.ts +2 -0
- package/types/components/table/TableMain.vue.d.ts +2 -2
- package/types/inject/key.d.ts +28 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ColProps } from 'element-plus';
|
|
2
|
+
import { PanelItemConfig, PanelScopeBase } from './types';
|
|
3
|
+
import { FormItemConfigList } from '../form';
|
|
4
|
+
export interface NestPanelFormOptions {
|
|
5
|
+
/** 父 item key */
|
|
6
|
+
key: string;
|
|
7
|
+
/** 父 item label */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** 子 FormMain 配置列表(吃嵌套子对象) */
|
|
10
|
+
list: FormItemConfigList;
|
|
11
|
+
/** 父 item 栅格布局 */
|
|
12
|
+
layout?: Partial<ColProps>;
|
|
13
|
+
/** 子表单行间距 */
|
|
14
|
+
rowGutter?: number;
|
|
15
|
+
/** 提交按钮文案 */
|
|
16
|
+
submitText?: string;
|
|
17
|
+
/** 取消按钮文案 */
|
|
18
|
+
cancelText?: string;
|
|
19
|
+
/** 是否可编辑,缺省 true */
|
|
20
|
+
editable?: boolean | ((scope: PanelScopeBase) => boolean);
|
|
21
|
+
/** 单字段提交:校验通过后回流草稿到父数据(panel 既有 submitFn 语义) */
|
|
22
|
+
submitFn: PanelItemConfig["submitFn"];
|
|
23
|
+
/** 只读态展示渲染;缺省走 PanelItem 默认(纯文本 data[key]) */
|
|
24
|
+
render?: PanelItemConfig["render"];
|
|
25
|
+
/** 是否叠本层嵌套布局 rebase(P3,缺省 true;false = 逆向逃生口,子层 layout 原样直透) */
|
|
26
|
+
rebase?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 生成「父 panel item 编辑态内嵌子 FormMain」的 PanelItemConfig(C3 配套 helper)
|
|
30
|
+
* ----
|
|
31
|
+
* 走 editorRender(优先级高于 editorConfig,panel/types.ts L65-77)挂 PanelItemNestForm:
|
|
32
|
+
* - 编辑态:PanelEditSwitch 进编辑时深克隆草稿(scope.data),子 FormMain 绑草稿嵌套对象
|
|
33
|
+
* in-place 编辑(不穿透真实 data,ADR-5 panel 分支);
|
|
34
|
+
* - 提交:组件内 validateChild 通过 → 本 helper wire 的 submit(`submitFn(草稿) → closeEdit`)回流;
|
|
35
|
+
* - 取消:closeEdit 关编辑态,草稿丢弃,下次进编辑重新克隆。
|
|
36
|
+
* editorConfig 与 editorRender 互斥——C3 用 editorRender,同一 item [MUST NOT] 再配 editorConfig。
|
|
37
|
+
*/
|
|
38
|
+
export declare function nestPanelForm(options: NestPanelFormOptions): PanelItemConfig;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ColProps, CardProps } from 'element-plus';
|
|
2
|
+
import { PanelItemConfig, PanelItemConfigList } from './types';
|
|
3
|
+
export interface NestPanelItemOptions {
|
|
4
|
+
/** 父 item key */
|
|
5
|
+
key: string;
|
|
6
|
+
/** 父 item label */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** 子 PanelMain 配置列表(吃嵌套子对象) */
|
|
9
|
+
list: PanelItemConfigList;
|
|
10
|
+
/** 父 item 栅格布局 */
|
|
11
|
+
layout?: Partial<ColProps>;
|
|
12
|
+
/** 子 PanelMain 子项是否包 Card */
|
|
13
|
+
itemCard?: boolean | Partial<CardProps & {
|
|
14
|
+
lastMarginBottom?: string;
|
|
15
|
+
}>;
|
|
16
|
+
/** 子 PanelMain 行间距 */
|
|
17
|
+
rowGutter?: number;
|
|
18
|
+
/** 是否叠本层嵌套布局 rebase(P3,缺省 true;false = 逆向逃生口,子层 layout 原样直透) */
|
|
19
|
+
rebase?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 生成「父 panel item 内嵌子 PanelMain」的 PanelItemConfig(C2 配套 helper)
|
|
23
|
+
* ----
|
|
24
|
+
* 降低业务方手写 h(PanelItemNestPanel) 噪音:传 key/label/子 list 即得一个满足
|
|
25
|
+
* PanelItemConfig 的纯展示配置项,render 出口挂 PanelItemNestPanel(嵌套对象只读展示)。
|
|
26
|
+
* 值贯通:render scope.value(= data[key] 嵌套对象)作子 PanelMain.data。
|
|
27
|
+
*/
|
|
28
|
+
export declare function nestPanelItem(options: NestPanelItemOptions): PanelItemConfig;
|
|
@@ -63,6 +63,8 @@ export interface PanelMainProps<PO extends Record<string, any> = Record<string,
|
|
|
63
63
|
/** 行水平间距 */
|
|
64
64
|
rowGutter?: number;
|
|
65
65
|
layout?: Partial<ColProps>;
|
|
66
|
+
/** P3 嵌套 rebase 累乘因子(缺省 1 = 顶级行为不变,向后兼容)。由联结薄壳算出后传子 PanelMain */
|
|
67
|
+
layoutScale?: number;
|
|
66
68
|
list: PanelItemConfigList<PO, SO>;
|
|
67
69
|
/** item是否包括Card */
|
|
68
70
|
itemCard?: boolean | Partial<CardProps & {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { TableMainProps, TableMainInstance, ElTableColumnProps, TablePageInfo } from './types';
|
|
2
2
|
declare const _default: <T extends Record<string, any>, SQ extends Record<string, any>, F extends Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
|
-
readonly onLoadingChange?: ((value: boolean) => any) | undefined;
|
|
5
4
|
readonly "onUpdate:isAutoRefresh"?: ((value: boolean) => any) | undefined;
|
|
5
|
+
readonly onLoadingChange?: ((value: boolean) => any) | undefined;
|
|
6
6
|
readonly "onUpdate:refreshInterval"?: ((value: number) => any) | undefined;
|
|
7
7
|
readonly "onUpdate:customView"?: ((value: boolean) => any) | undefined;
|
|
8
8
|
readonly onPageChange?: ((value: number) => any) | undefined;
|
|
9
9
|
readonly onPageSizeChange?: ((value: number) => any) | undefined;
|
|
10
10
|
readonly onDataChange?: ((data: T[]) => any) | undefined;
|
|
11
11
|
readonly onPageInfoChange?: ((info: TablePageInfo) => any) | undefined;
|
|
12
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "
|
|
12
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:isAutoRefresh" | "onLoadingChange" | "onUpdate:refreshInterval" | "onUpdate:customView" | "onPageChange" | "onPageSizeChange" | "onDataChange" | "onPageInfoChange"> & ({
|
|
13
13
|
isAutoRefresh?: boolean;
|
|
14
14
|
refreshInterval?: number;
|
|
15
15
|
customView?: boolean;
|
package/types/inject/key.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { InjectionKey } from 'vue';
|
|
1
|
+
import { InjectionKey, Ref } from 'vue';
|
|
2
2
|
import { AdminBridge } from '../bridge';
|
|
3
3
|
import { ModalLevel, ShelfController } from '../components/modal';
|
|
4
4
|
import { AppLayoutAppStoreSlice, AppLayoutUserStoreSlice, AppLayoutBridgeSlice } from '../components/app-layout';
|
|
5
|
+
import { NestFormExposeMap } from '../components/form';
|
|
5
6
|
/**
|
|
6
7
|
* body 视口高度
|
|
7
8
|
* ---
|
|
@@ -70,3 +71,29 @@ export declare const APP_LAYOUT_BRIDGE_KEY: InjectionKey<AppLayoutBridgeSlice>;
|
|
|
70
71
|
* Symbol.for 保证跨包/跨 chunk/跨 ESM 实例唯一(同 APP_LAYOUT_BRIDGE_KEY,规则 8)。
|
|
71
72
|
*/
|
|
72
73
|
export declare const ADMIN_BRIDGE_KEY: InjectionKey<AdminBridge>;
|
|
74
|
+
/**
|
|
75
|
+
* 嵌套子 FormMain exposeMap inject key(配置化嵌套联结组件 Nest 三件套挂载)。
|
|
76
|
+
* ---
|
|
77
|
+
* 每个 FormMain `provide` 一份本 key 的空 exposeMap(shallowReactive,按 item key 索引),
|
|
78
|
+
* 供其后代联结组件(FormItemNestForm)`inject` 到**最近祖先** FormMain 的 map 并把子
|
|
79
|
+
* FormMain 的级联 expose 写入(key = 自身 item key);FormMain 的 validate/clearValidate/
|
|
80
|
+
* resetFields 遍历自身 map 级联子表单。
|
|
81
|
+
* ---
|
|
82
|
+
* provide/inject 链天然实现「只挂最近祖先」(inject 向上解析至最近 provide)。
|
|
83
|
+
* 注册由联结组件显式触发(非裸嵌套 FormMain 自动注册)→ 旧用法零回归(additive)。
|
|
84
|
+
* ---
|
|
85
|
+
* Symbol.for 保证跨包/跨 chunk/跨 ESM 实例唯一(规则 8,同上)。
|
|
86
|
+
*/
|
|
87
|
+
export declare const FORM_NEST_REGISTRY_KEY: InjectionKey<NestFormExposeMap>;
|
|
88
|
+
/**
|
|
89
|
+
* 嵌套布局 rebase 累乘因子 inject key(P3 嵌套布局 rebase 挂载)。
|
|
90
|
+
* ---
|
|
91
|
+
* 每个 FormMain / PanelMain `provide` 自身 `layoutScale`(缺省 1)的响应式只读引用;
|
|
92
|
+
* 其后代联结组件(FormItemNestForm / FormItemNestFormList / PanelItemNestPanel /
|
|
93
|
+
* PanelItemNestForm)`inject` 到**最近祖先**的 scale,叠本层因子
|
|
94
|
+
* `childScale = parentScale × (24 / parentItemSpan)` 后作 `layoutScale` 传子 Form/PanelMain。
|
|
95
|
+
* ---
|
|
96
|
+
* 顶级 FormMain/PanelMain 未嵌套时 provide 1 → 子层缺省行为不变(向后兼容)。
|
|
97
|
+
* Symbol.for 保证跨包/跨 chunk/跨 ESM 实例唯一(规则 8,同上)。
|
|
98
|
+
*/
|
|
99
|
+
export declare const NEST_LAYOUT_SCALE_KEY: InjectionKey<Readonly<Ref<number>>>;
|