@jzg223/design-runtime 0.0.0-stage → 0.0.1
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/CHANGELOG.md +176 -0
- package/README.md +275 -2
- package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/api.js +149 -0
- package/dist/comb/design-comb.vue.js +7 -0
- package/dist/comb/design-comb2.vue.js +591 -0
- package/dist/compat.js +74 -0
- package/dist/components/ApiSwitch.vue.js +7 -0
- package/dist/components/ApiSwitch2.vue.js +98 -0
- package/dist/components/design-debug/dev-mode-toggle.vue.js +7 -0
- package/dist/components/design-debug/dev-mode-toggle2.vue.js +41 -0
- package/dist/components/design-debug/dev-mode.js +45 -0
- package/dist/components/design-debug/dev-state-button.vue.js +7 -0
- package/dist/components/design-debug/dev-state-button2.vue.js +447 -0
- package/dist/components/design-debug/expr-eval.js +81 -0
- package/dist/components/design-shared/host-api.js +47 -0
- package/dist/components/design-shared/popup-host.js +11 -0
- package/dist/components/design-table/design-table-inner.vue.js +7 -0
- package/dist/components/design-table/design-table-inner2.vue.js +39 -0
- package/dist/components/design-table/design-table.vue.js +7 -0
- package/dist/components/design-table/design-table2.vue.js +937 -0
- package/dist/components/design-table/row-actions/delete-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/delete-action2.vue.js +42 -0
- package/dist/components/design-table/row-actions/edit-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/edit-action2.vue.js +145 -0
- package/dist/components/design-table/row-actions/index.js +36 -0
- package/dist/components/design-table/row-actions/modal-comb-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-comb-action2.vue.js +66 -0
- package/dist/components/design-table/row-actions/modal-custom-action.vue.js +7 -0
- package/dist/components/design-table/row-actions/modal-custom-action2.vue.js +105 -0
- package/dist/components/design-table/row-actions/modal-form-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-form-action2.vue.js +82 -0
- package/dist/components/design-table/row-actions/modal-table-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-table-action2.vue.js +67 -0
- package/dist/components/design-table/row-actions/modal-tree-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/modal-tree-action2.vue.js +70 -0
- package/dist/components/design-table/row-actions/navigate-comb-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-comb-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/navigate-form-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-form-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/navigate-table-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-table-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/navigate-tree-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/navigate-tree-action2.vue.js +47 -0
- package/dist/components/design-table/row-actions/other-action.vue.js +4 -0
- package/dist/components/design-table/row-actions/other-action2.vue.js +44 -0
- package/dist/components/design-tools/add-tool.vue.js +4 -0
- package/dist/components/design-tools/add-tool2.vue.js +136 -0
- package/dist/components/design-tools/command-executor.js +135 -0
- package/dist/components/design-tools/export-tool.vue.js +4 -0
- package/dist/components/design-tools/export-tool2.vue.js +46 -0
- package/dist/components/design-tools/import-tool.vue.js +4 -0
- package/dist/components/design-tools/import-tool2.vue.js +101 -0
- package/dist/components/design-tools/index.js +36 -0
- package/dist/components/design-tools/modal-comb-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-comb-tool2.vue.js +56 -0
- package/dist/components/design-tools/modal-form-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-form-tool2.vue.js +66 -0
- package/dist/components/design-tools/modal-hcm-tool.vue.js +7 -0
- package/dist/components/design-tools/modal-hcm-tool2.vue.js +85 -0
- package/dist/components/design-tools/modal-table-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-table-tool2.vue.js +54 -0
- package/dist/components/design-tools/modal-tree-tool.vue.js +4 -0
- package/dist/components/design-tools/modal-tree-tool2.vue.js +57 -0
- package/dist/components/design-tools/navigate-comb-tool.vue.js +4 -0
- package/dist/components/design-tools/navigate-comb-tool2.vue.js +34 -0
- package/dist/components/design-tools/navigate-form-tool.vue.js +4 -0
- package/dist/components/design-tools/navigate-form-tool2.vue.js +34 -0
- package/dist/components/design-tools/navigate-table-tool.vue.js +4 -0
- package/dist/components/design-tools/navigate-table-tool2.vue.js +33 -0
- package/dist/components/design-tools/other-tool.vue.js +4 -0
- package/dist/components/design-tools/other-tool2.vue.js +34 -0
- package/dist/components/flow-status-cell/flow-status-cell.vue.js +7 -0
- package/dist/components/flow-status-cell/flow-status-cell2.vue.js +124 -0
- package/dist/flow.js +22 -0
- package/dist/form/cell-condition.js +122 -0
- package/dist/form/derived-express.js +34 -0
- package/dist/form/design-form-inner.vue.js +7 -0
- package/dist/form/design-form-inner2.vue.js +449 -0
- package/dist/form/design-form.vue.js +7 -0
- package/dist/form/design-form2.vue.js +681 -0
- package/dist/form/fields/checkbox-field.vue.js +88 -0
- package/dist/form/fields/checkbox-field2.vue.js +4 -0
- package/dist/form/fields/custom-field.vue.js +36 -0
- package/dist/form/fields/custom-field2.vue.js +4 -0
- package/dist/form/fields/date-field.vue.js +64 -0
- package/dist/form/fields/date-field2.vue.js +4 -0
- package/dist/form/fields/embedded-list-field.vue.js +7 -0
- package/dist/form/fields/embedded-list-field2.vue.js +437 -0
- package/dist/form/fields/file-field.vue.js +88 -0
- package/dist/form/fields/file-field2.vue.js +4 -0
- package/dist/form/fields/image-field.vue.js +90 -0
- package/dist/form/fields/image-field2.vue.js +4 -0
- package/dist/form/fields/index.js +106 -0
- package/dist/form/fields/month-field.vue.js +51 -0
- package/dist/form/fields/month-field2.vue.js +4 -0
- package/dist/form/fields/org-select-field.vue.js +7 -0
- package/dist/form/fields/org-select-field2.vue.js +187 -0
- package/dist/form/fields/orgs-select-field.vue.js +182 -0
- package/dist/form/fields/orgs-select-field2.vue.js +4 -0
- package/dist/form/fields/radio-field.vue.js +91 -0
- package/dist/form/fields/radio-field2.vue.js +4 -0
- package/dist/form/fields/select-field.vue.js +7 -0
- package/dist/form/fields/select-field2.vue.js +317 -0
- package/dist/form/fields/splitline-field.vue.js +7 -0
- package/dist/form/fields/splitline-field2.vue.js +50 -0
- package/dist/form/fields/switch-field.vue.js +32 -0
- package/dist/form/fields/switch-field2.vue.js +4 -0
- package/dist/form/fields/text-field.vue.js +78 -0
- package/dist/form/fields/text-field2.vue.js +4 -0
- package/dist/form/fields/time-field.vue.js +50 -0
- package/dist/form/fields/time-field2.vue.js +4 -0
- package/dist/form/fields/tree-field.vue.js +157 -0
- package/dist/form/fields/tree-field2.vue.js +4 -0
- package/dist/form/number-precision.js +18 -0
- package/dist/form/transformer.js +162 -0
- package/dist/host.js +76 -0
- package/dist/http.js +19 -0
- package/dist/index.js +166 -0
- package/dist/mapping.js +44 -0
- package/dist/org/dept-api.js +30 -0
- package/dist/org/dept-tree-source.js +53 -0
- package/dist/org/dept-tree.js +122 -0
- package/dist/registry.js +77 -0
- package/dist/search/design-search.vue.js +7 -0
- package/dist/search/design-search2.vue.js +232 -0
- package/dist/search/transformer.js +115 -0
- package/dist/style.css +1220 -0
- package/dist/table/data.js +18 -0
- package/dist/table/load-gate.js +19 -0
- package/dist/table/query-body.js +59 -0
- package/dist/table/query-dedupe.js +54 -0
- package/dist/table/query-search.js +9 -0
- package/dist/table/row-action-mapping.js +34 -0
- package/dist/table/transformer.js +328 -0
- package/dist/tree/design-tree.vue.js +7 -0
- package/dist/tree/design-tree2.vue.js +783 -0
- package/dist/types/api.d.ts +83 -0
- package/dist/types/comb/design-comb.vue.d.ts +38 -0
- package/dist/types/compat.d.ts +46 -0
- package/dist/types/components/ApiSwitch.vue.d.ts +31 -0
- package/dist/types/components/design-debug/dev-mode-toggle.vue.d.ts +2 -0
- package/dist/types/components/design-debug/dev-mode.d.ts +8 -0
- package/dist/types/components/design-debug/dev-state-button.vue.d.ts +55 -0
- package/dist/types/components/design-debug/expr-eval.d.ts +55 -0
- package/dist/types/components/design-shared/host-api.d.ts +60 -0
- package/dist/types/components/design-shared/popup-host.d.ts +13 -0
- package/dist/types/components/design-table/design-table-inner.vue.d.ts +19 -0
- package/dist/types/components/design-table/design-table.vue.d.ts +70 -0
- package/dist/types/components/design-table/row-actions/delete-action.vue.d.ts +12 -0
- package/dist/types/components/design-table/row-actions/edit-action.vue.d.ts +14 -0
- package/dist/types/components/design-table/row-actions/index.d.ts +25 -0
- package/dist/types/components/design-table/row-actions/modal-comb-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/modal-custom-action.vue.d.ts +15 -0
- package/dist/types/components/design-table/row-actions/modal-form-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/modal-table-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/modal-tree-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-comb-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-form-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-table-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/navigate-tree-action.vue.d.ts +10 -0
- package/dist/types/components/design-table/row-actions/other-action.vue.d.ts +14 -0
- package/dist/types/components/design-tools/add-tool.vue.d.ts +23 -0
- package/dist/types/components/design-tools/command-executor.d.ts +80 -0
- package/dist/types/components/design-tools/export-tool.vue.d.ts +9 -0
- package/dist/types/components/design-tools/import-tool.vue.d.ts +14 -0
- package/dist/types/components/design-tools/index.d.ts +23 -0
- package/dist/types/components/design-tools/modal-comb-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/modal-form-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/modal-hcm-tool.vue.d.ts +23 -0
- package/dist/types/components/design-tools/modal-table-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/modal-tree-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/navigate-comb-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/navigate-form-tool.vue.d.ts +11 -0
- package/dist/types/components/design-tools/navigate-table-tool.vue.d.ts +12 -0
- package/dist/types/components/design-tools/other-tool.vue.d.ts +16 -0
- package/dist/types/components/flow-status-cell/flow-status-cell.vue.d.ts +14 -0
- package/dist/types/components/index.d.ts +33 -0
- package/dist/types/flow.d.ts +50 -0
- package/dist/types/form/cell-condition.d.ts +35 -0
- package/dist/types/form/derived-express.d.ts +28 -0
- package/dist/types/form/design-form-inner.vue.d.ts +55 -0
- package/dist/types/form/design-form.vue.d.ts +96 -0
- package/dist/types/form/fields/checkbox-field.vue.d.ts +14 -0
- package/dist/types/form/fields/custom-field.vue.d.ts +22 -0
- package/dist/types/form/fields/date-field.vue.d.ts +12 -0
- package/dist/types/form/fields/embedded-list-field.vue.d.ts +26 -0
- package/dist/types/form/fields/file-field.vue.d.ts +12 -0
- package/dist/types/form/fields/image-field.vue.d.ts +12 -0
- package/dist/types/form/fields/index.d.ts +34 -0
- package/dist/types/form/fields/month-field.vue.d.ts +12 -0
- package/dist/types/form/fields/org-select-field.vue.d.ts +14 -0
- package/dist/types/form/fields/orgs-select-field.vue.d.ts +12 -0
- package/dist/types/form/fields/radio-field.vue.d.ts +14 -0
- package/dist/types/form/fields/select-field.vue.d.ts +14 -0
- package/dist/types/form/fields/splitline-field.vue.d.ts +7 -0
- package/dist/types/form/fields/switch-field.vue.d.ts +12 -0
- package/dist/types/form/fields/text-field.vue.d.ts +12 -0
- package/dist/types/form/fields/time-field.vue.d.ts +12 -0
- package/dist/types/form/fields/tree-field.vue.d.ts +12 -0
- package/dist/types/form/number-precision.d.ts +15 -0
- package/dist/types/form/transformer.d.ts +27 -0
- package/dist/types/host.d.ts +182 -0
- package/dist/types/http.d.ts +59 -0
- package/dist/types/index.d.ts +41 -0
- package/dist/types/mapping.d.ts +39 -0
- package/dist/types/org/dept-api.d.ts +12 -0
- package/dist/types/org/dept-tree-source.d.ts +15 -0
- package/dist/types/org/dept-tree.d.ts +62 -0
- package/dist/types/registry.d.ts +79 -0
- package/dist/types/search/design-search.vue.d.ts +46 -0
- package/dist/types/search/transformer.d.ts +36 -0
- package/dist/types/table/data.d.ts +30 -0
- package/dist/types/table/index.d.ts +20 -0
- package/dist/types/table/load-gate.d.ts +24 -0
- package/dist/types/table/query-body.d.ts +46 -0
- package/dist/types/table/query-dedupe.d.ts +42 -0
- package/dist/types/table/query-search.d.ts +21 -0
- package/dist/types/table/row-action-mapping.d.ts +36 -0
- package/dist/types/table/transformer.d.ts +59 -0
- package/dist/types/tree/design-tree.vue.d.ts +33 -0
- package/dist/types/types.d.ts +525 -0
- package/dist/types/utils/default-value.d.ts +16 -0
- package/dist/types/utils/download.d.ts +9 -0
- package/dist/types/utils/popup-width.d.ts +21 -0
- package/dist/utils/default-value.js +38 -0
- package/dist/utils/download.js +19 -0
- package/dist/utils/popup-width.js +19 -0
- package/package.json +73 -4
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { DesignTableTool as TableTool, PlatformFormConfig } from '../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 模块分类 */
|
|
4
|
+
category?: string;
|
|
5
|
+
/** 配置名称 */
|
|
6
|
+
name?: string;
|
|
7
|
+
/** 直接传入配置(可选,跳过 API 请求) */
|
|
8
|
+
config?: PlatformFormConfig | null;
|
|
9
|
+
/** 表单初始数据(直接传入,优先级低于 sourceId) */
|
|
10
|
+
source?: Record<string, any>;
|
|
11
|
+
/** 编辑模式下的记录 ID(传入后会调用 showUrl 拉取数据) */
|
|
12
|
+
sourceId?: string | number;
|
|
13
|
+
/** 额外参数(外部上下文注入,保存时合并进 info 一并提交) */
|
|
14
|
+
/** 上游组件推过来的参数;与路由参数合并为组件自身 extraParams(随保存作为 params 下发后端) */
|
|
15
|
+
parentParams?: Record<string, any>;
|
|
16
|
+
/** 表单标题 */
|
|
17
|
+
taskTitle?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 显示模式(保留兼容入参,不再影响按钮显示)
|
|
20
|
+
* 自 2026-09 起表单按钮一律按配置的「工具条(toolBars)」渲染,
|
|
21
|
+
* 不再自动生成底部 保存/删除/重置;standalone 与 embedded 显示已无差别。
|
|
22
|
+
*/
|
|
23
|
+
mode?: 'embedded' | 'standalone';
|
|
24
|
+
/** dev 悬浮按钮距容器顶部距离(px);嵌套在其它设计组件内时下移,避免与父组件按钮重叠 */
|
|
25
|
+
devButtonTop?: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 供父组件调用的提交入口(不依赖按钮:取当前表单值后走统一保存逻辑)
|
|
29
|
+
* 从 inner form 获取当前表单值后执行保存
|
|
30
|
+
*/
|
|
31
|
+
declare function submit(): Promise<any>;
|
|
32
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {
|
|
33
|
+
getFormApi: () => {
|
|
34
|
+
getValues: () => Record<string, any>;
|
|
35
|
+
setValues: (values: Record<string, any>) => void;
|
|
36
|
+
resetForm: () => void;
|
|
37
|
+
form: {
|
|
38
|
+
values: Record<string, any>;
|
|
39
|
+
};
|
|
40
|
+
derivedValues: Record<string, any>;
|
|
41
|
+
} | undefined;
|
|
42
|
+
/** 程序化提交入口:取当前表单值并走统一保存逻辑(供父组件/宿主调用) */
|
|
43
|
+
submit: typeof submit;
|
|
44
|
+
/** 保存进行中状态(供宿主读取,如同步到 drawer confirmLoading) */
|
|
45
|
+
saving: import("vue").Ref<boolean, boolean>;
|
|
46
|
+
/** 表单配置的宽度(供抽屉组件读取) */
|
|
47
|
+
formConfigWidth: import("vue").ComputedRef<string | number | undefined>;
|
|
48
|
+
/** 表单配置的标题(供抽屉组件读取) */
|
|
49
|
+
formConfigTitle: import("vue").ComputedRef<string | undefined>;
|
|
50
|
+
/** 开发面板状态(本库不渲染调试台,留给宿主调试台按需读取) */
|
|
51
|
+
devState: import("vue").ComputedRef<Record<string, any>>;
|
|
52
|
+
toolScope: import("vue").ComputedRef<Record<string, any>>;
|
|
53
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
54
|
+
deleted: () => any;
|
|
55
|
+
saved: (result: any) => any;
|
|
56
|
+
"data-change": (data: Record<string, any>) => any;
|
|
57
|
+
"url-change": (urls: {
|
|
58
|
+
delete: string;
|
|
59
|
+
insert: string;
|
|
60
|
+
show: string;
|
|
61
|
+
update: string;
|
|
62
|
+
}) => any;
|
|
63
|
+
"config-loaded": (config: {
|
|
64
|
+
title?: string;
|
|
65
|
+
width?: number | string;
|
|
66
|
+
}) => any;
|
|
67
|
+
"update:title": (title: string) => any;
|
|
68
|
+
"tool-command": (tool: TableTool) => any;
|
|
69
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
70
|
+
onDeleted?: (() => any) | undefined;
|
|
71
|
+
onSaved?: ((result: any) => any) | undefined;
|
|
72
|
+
"onData-change"?: ((data: Record<string, any>) => any) | undefined;
|
|
73
|
+
"onUrl-change"?: ((urls: {
|
|
74
|
+
delete: string;
|
|
75
|
+
insert: string;
|
|
76
|
+
show: string;
|
|
77
|
+
update: string;
|
|
78
|
+
}) => any) | undefined;
|
|
79
|
+
"onConfig-loaded"?: ((config: {
|
|
80
|
+
title?: string;
|
|
81
|
+
width?: number | string;
|
|
82
|
+
}) => any) | undefined;
|
|
83
|
+
"onUpdate:title"?: ((title: string) => any) | undefined;
|
|
84
|
+
"onTool-command"?: ((tool: TableTool) => any) | undefined;
|
|
85
|
+
}>, {
|
|
86
|
+
name: string;
|
|
87
|
+
config: PlatformFormConfig | null;
|
|
88
|
+
source: Record<string, any>;
|
|
89
|
+
mode: "embedded" | "standalone";
|
|
90
|
+
category: string;
|
|
91
|
+
sourceId: string | number;
|
|
92
|
+
parentParams: Record<string, any>;
|
|
93
|
+
taskTitle: string;
|
|
94
|
+
devButtonTop: number;
|
|
95
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
96
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
"update:derived": (values: Record<string, any>) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
12
|
+
"onUpdate:derived"?: ((values: Record<string, any>) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* 自定义字段 — 默认回退组件
|
|
4
|
+
* 外部可通过 `fieldRegistry.register('myType', MyComponent)` 注册自定义类型
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ `cell` 声明为可选(默认 {}):它同时被「插槽兜底」复用(扩展包组件没注册、
|
|
7
|
+
* 菜单页面插槽解析不到组件等),那些场景调用方可能没有 cell 配置;
|
|
8
|
+
* 必填会让回退组件自己先崩在 `cell.type` 上(2026-10-21 实测:页面插槽白屏)。
|
|
9
|
+
*/
|
|
10
|
+
type __VLS_Props = {
|
|
11
|
+
cell?: PlatformFormCell;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
modelValue?: any;
|
|
14
|
+
};
|
|
15
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
"update:modelValue": (value: any) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
cell: PlatformFormCell;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DesignTableTool as TableTool, PlatformFormCell, RowAction } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** 内嵌列表单元格配置(embeddedList + mappings + title) */
|
|
4
|
+
cell: PlatformFormCell;
|
|
5
|
+
/** 主表单字段当前值(含派生值,随输入实时变化) */
|
|
6
|
+
master?: Record<string, any>;
|
|
7
|
+
/** 主键字段名(用于判断主记录是否存在:无 id → 仅标题行) */
|
|
8
|
+
pfield?: string;
|
|
9
|
+
/** 表单外部参数(路由/上游 parentParams),作为映射 params 作用域 */
|
|
10
|
+
extraParams?: Record<string, any>;
|
|
11
|
+
/** 表单所在模块(列表未存 module 时的兜底) */
|
|
12
|
+
category?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
15
|
+
"tool-command": (tool: TableTool) => any;
|
|
16
|
+
"row-command": (action: RowAction, row: Record<string, any>) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
"onTool-command"?: ((tool: TableTool) => any) | undefined;
|
|
19
|
+
"onRow-command"?: ((action: RowAction, row: Record<string, any>) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
category: string;
|
|
22
|
+
pfield: string;
|
|
23
|
+
extraParams: Record<string, any>;
|
|
24
|
+
master: Record<string, any>;
|
|
25
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import CustomField from './custom-field.vue';
|
|
3
|
+
import TextField from './text-field.vue';
|
|
4
|
+
/** 尚未迁入的字段类型(命中即回退占位 + warn,见 resolveComponent) */
|
|
5
|
+
export declare const pendingFieldTypes: string[];
|
|
6
|
+
/** 宿主侧统一请求:走注入的 http(返回值已按平台口径解包) */
|
|
7
|
+
export { hostRequest } from '../../components/design-shared/host-api';
|
|
8
|
+
/**
|
|
9
|
+
* 注册自定义字段组件(与 `registerComponents` 等价,保留宿主侧的旧名字)
|
|
10
|
+
* @param type 字段 type 名(同时可作为 `cell.comname` 使用)
|
|
11
|
+
*/
|
|
12
|
+
export declare function register(type: string, comp: Component): void;
|
|
13
|
+
/** 批量注册自定义类型 */
|
|
14
|
+
export declare function registerFields(map: Record<string, Component>): void;
|
|
15
|
+
/**
|
|
16
|
+
* 查找字段组件:自定义注册表 > 内置 > CustomField 回退
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveComponent(type?: string): Component;
|
|
19
|
+
/**
|
|
20
|
+
* 按**单元格**解析组件(运行端统一入口)
|
|
21
|
+
*
|
|
22
|
+
* - `type === 'my'`(构建端的「自定义」):按 `cell.comname` 查注册表;
|
|
23
|
+
* 没填 comname / 名字没注册 → warn 一次并回退 CustomField(占位输入框,不炸表单)。
|
|
24
|
+
* - 其它类型:走 {@link resolveComponent}。
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveCellComponent(cell?: {
|
|
27
|
+
comname?: string;
|
|
28
|
+
type?: string;
|
|
29
|
+
}): Component;
|
|
30
|
+
/** 已注册的自定义组件名(含内置字段类型),用于「先判断有没有」的插槽 */
|
|
31
|
+
export declare function listCustomComponents(): string[];
|
|
32
|
+
/** 某个 comname / 字段类型是否真的可用 */
|
|
33
|
+
export declare function hasCustomComponent(comname?: string): boolean;
|
|
34
|
+
export { CustomField, TextField };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
"update:derived": (values: Record<string, any>) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
12
|
+
"onUpdate:derived"?: ((values: Record<string, any>) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
"update:derived": (values: Record<string, any>) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
12
|
+
"onUpdate:derived"?: ((values: Record<string, any>) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
"update:derived": (values: Record<string, any>) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
12
|
+
"onUpdate:derived"?: ((values: Record<string, any>) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlatformFormCell } from '../../types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
cell: PlatformFormCell;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
modelValue?: any;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: any) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 数字(小数)输入的小数位数 `cell.decimalLen` 的解析与取整(纯函数,便于单测)。
|
|
3
|
+
*
|
|
4
|
+
* 语义(与设计器 cell/text.vue 的「小数位数」一致):
|
|
5
|
+
* `0` → 整数
|
|
6
|
+
* 留空/非法 → 不限位数(保持历史行为)
|
|
7
|
+
* `N` → 最多 N 位小数,超出四舍五入
|
|
8
|
+
*/
|
|
9
|
+
/** 解析小数位数:''/纯空格/null/undefined/负数/非整数/非数字 → undefined(不限位数) */
|
|
10
|
+
export declare function parsePrecision(raw: unknown): number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* 按精度四舍五入;未配置精度(undefined)或非有限数时原样返回。
|
|
13
|
+
* 加 EPSILON 是为了抵消二进制浮点误差(如 1.005 直接 toFixed 会得 1.00)。
|
|
14
|
+
*/
|
|
15
|
+
export declare function roundToPrecision(num: number, precision?: number): number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DesignFormSchema } from '../search/transformer';
|
|
2
|
+
import type { PlatformDerivedField, PlatformFormCell, PlatformFormConfig } from '../types';
|
|
3
|
+
/** 网格布局配置(供 DesignFormInner 渲染 CSS Grid) */
|
|
4
|
+
export interface FormGridConfig {
|
|
5
|
+
cells: PlatformFormCell[];
|
|
6
|
+
colWidths: number[];
|
|
7
|
+
rowHeights: number[];
|
|
8
|
+
totalCol: number;
|
|
9
|
+
totalRow: number;
|
|
10
|
+
derivedFieldList: PlatformDerivedField[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 将平台表单配置转换为 DesignFormSchema 数组 + 网格布局信息
|
|
14
|
+
*
|
|
15
|
+
* 支持两种格式:
|
|
16
|
+
* 1. 新格式:config.cells 直接包含 { cells, totalRow, totalCol, colWidths, rowHeights }
|
|
17
|
+
* 2. 旧格式:config.content 为 JSON 字符串,解析后得到 cells
|
|
18
|
+
*/
|
|
19
|
+
export declare function transformFormConfig(config: PlatformFormConfig): {
|
|
20
|
+
gridConfig: FormGridConfig;
|
|
21
|
+
schema: DesignFormSchema[];
|
|
22
|
+
labelWidth: number;
|
|
23
|
+
insertUrl: string | undefined;
|
|
24
|
+
updateUrl: string | undefined;
|
|
25
|
+
deleteUrl: string | undefined;
|
|
26
|
+
showUrl: string | undefined;
|
|
27
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 宿主能力契约(T2 的核心设计)
|
|
3
|
+
*
|
|
4
|
+
* 本库要能装进**任意**基于 vben 的项目,就不能 import 宿主内部的东西
|
|
5
|
+
* (`#/utils/http`、`#/adapter/vxe-table`、app 的 pinia store…)。
|
|
6
|
+
* 做法:宿主在 bootstrap 里调一次 `installDesignPlatform(ctx)`,把公共能力注入进来;
|
|
7
|
+
* 库内一律通过 `getDesignHost()` 取。
|
|
8
|
+
*
|
|
9
|
+
* ## 判断「一个能力该 peer 还是该注入」的三级优先(2026-10-27 定)
|
|
10
|
+
*
|
|
11
|
+
* 1. **真 npm 包 → 直接 peer + external**:`vue`、`vue-router`、`antdv-next`、`@antdv-next/icons`、
|
|
12
|
+
* `vxe-table`。理由:外部使用方 `npm i` 得到的就是构建好的产物与 `.d.ts`。
|
|
13
|
+
* 2. **宿主私有 / 业务数据 → 注入**:`http`(宿主那一个请求实例)、`dict`(宿主的字典数据)、
|
|
14
|
+
* `workflow`(业务后端的流程接口)、`message` / `modal` / `t` / `getAuth`。
|
|
15
|
+
* 理由:库里既没有数据源也不能自建一份,否则会出现第二套口径。
|
|
16
|
+
* 3. **vben 基座包(`@vben/*`)→ 注入,不能 peer**:`Page` / `useVbenModal` / `useVbenDrawer` /
|
|
17
|
+
* `useVbenVxeGrid`。理由:`@vben/plugins`、`@vben/common-ui` 的 `exports` 直接指向 `./src/*.ts`
|
|
18
|
+
* (源码导出,vben monorepo 内部用),发到 npm 的库若声明成 peer,外部使用方装不到可用产物,
|
|
19
|
+
* 而且 .d.ts 里引用它会让类型解析直接失败。
|
|
20
|
+
*
|
|
21
|
+
* 结论:**`@vben/*` 出现在本库任何 import 里都是 bug**(`npm run verify` 的白名单也会盯住)。
|
|
22
|
+
*
|
|
23
|
+
* 约定:除 `http` 外全部可选。缺哪个,用到它的功能降级(不是崩溃),并在控制台给**一次**明确提示。
|
|
24
|
+
* 只有**单例**才有资格注入(登录态 / i18n / 路由 / http 客户端 / antd 的 message、modal)。
|
|
25
|
+
*/
|
|
26
|
+
import type { Component } from 'vue';
|
|
27
|
+
import type { DesignHttp } from './http';
|
|
28
|
+
/** 消息提示(宿主一般是 antd 的 message 实例) */
|
|
29
|
+
export interface DesignHostMessage {
|
|
30
|
+
error: (msg: string) => void;
|
|
31
|
+
info?: (msg: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* 持续提示,返回关闭函数(导出/导入这类长任务用)。
|
|
34
|
+
* 未注入时回退 antdv-next 的 message.loading({ duration: 0 })。
|
|
35
|
+
*/
|
|
36
|
+
loading?: (content: string) => () => void;
|
|
37
|
+
success: (msg: string) => void;
|
|
38
|
+
warning: (msg: string) => void;
|
|
39
|
+
}
|
|
40
|
+
/** 模态框(宿主一般是 antd 的 modal 实例) */
|
|
41
|
+
export interface DesignHostModal {
|
|
42
|
+
confirm: (options: Record<string, any>) => void;
|
|
43
|
+
/** 纯提示框(`other` 工具的 `openDialog` 在没有 onOk 时用它);未注入时降级为 message */
|
|
44
|
+
info?: (options: Record<string, any>) => void;
|
|
45
|
+
}
|
|
46
|
+
/** 登录态只读快照:库绝不自己去读 localStorage / token */
|
|
47
|
+
export interface DesignAuthSnapshot {
|
|
48
|
+
/** 是否已登录(宿主从自己的 store 读) */
|
|
49
|
+
loggedIn: boolean;
|
|
50
|
+
/** 低代码页面常见的按钮级权限码 */
|
|
51
|
+
permissions?: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* UI 外壳能力(vben 基座包,源码导出 ⇒ 只能注入,见文件头第 3 条)
|
|
55
|
+
*
|
|
56
|
+
* 这些都是 `[组件, api]` 形态的组合函数:库内组件用 `<component :is="Shell">` 渲染拿到的组件,
|
|
57
|
+
* 靠 `api.open() / api.close() / api.setState()` 控制,与 vben 里用法一致。
|
|
58
|
+
*/
|
|
59
|
+
export interface DesignHostUi {
|
|
60
|
+
/** vben 的 `Page` 页容器(标题/描述/面包屑);未注入时用普通容器兜底 */
|
|
61
|
+
Page?: Component;
|
|
62
|
+
/** vben 的 `useVbenDrawer`(表单抽屉) */
|
|
63
|
+
useVbenDrawer?: (...args: any[]) => any;
|
|
64
|
+
/** vben 的 `useVbenModal`(弹窗) */
|
|
65
|
+
useVbenModal?: (...args: any[]) => any;
|
|
66
|
+
/**
|
|
67
|
+
* vben 的 `useVbenVxeGrid`(**必须是宿主 adapter 里那个包装过的版本**:
|
|
68
|
+
* 它在模块顶层调过 `setupVbenVxeTable`,表格的边框/工具栏/分页/代理响应口径都在那里配好)。
|
|
69
|
+
* 表格与树形视图都要它;未注入时这两个组件不可用(取数仍是好的)。
|
|
70
|
+
*/
|
|
71
|
+
useVbenVxeGrid?: (...args: any[]) => any;
|
|
72
|
+
}
|
|
73
|
+
/** 字典能力(业务数据,必须在宿主) */
|
|
74
|
+
export interface DesignHostDict {
|
|
75
|
+
/** 字典项:宿主 `#/utils/render` 的 `getDictOptions` */
|
|
76
|
+
getOptions?: (dictName: string) => any[];
|
|
77
|
+
/** 值 → 标签:宿主 `#/utils/render` 的 `renderDict`(缺了字典列降级显示原值 + warn 一次) */
|
|
78
|
+
render?: (value: any, dictName: string, options?: Record<string, any>) => any;
|
|
79
|
+
}
|
|
80
|
+
/** 业务后端能力(流程等),按需注入;缺了对应功能不显示,不报错 */
|
|
81
|
+
export interface DesignHostWorkflow {
|
|
82
|
+
/**
|
|
83
|
+
* 流程「提交/发起」弹窗组件(**宿主 app 私有**:vben 里的 `#/views/workflow/components`
|
|
84
|
+
* 的 `applyModal`)。表单「提交并走流程」时用它提交申请人节点。
|
|
85
|
+
*
|
|
86
|
+
* 未注入时:提交按钮降级为**只保存不发起流程**,并 warn 一次 ——
|
|
87
|
+
* 因为发起流程要宿主 app 的流程定义/表单上下文,库里没有也无法自建。
|
|
88
|
+
*/
|
|
89
|
+
applyModal?: Component;
|
|
90
|
+
/** 撤回/取消流程申请:宿主 `#/api/workflow/instance` 的 `cancelProcessApply` */
|
|
91
|
+
cancelProcessApply?: (data: any) => Promise<any>;
|
|
92
|
+
}
|
|
93
|
+
/** 上传结果(宿主各家口径不同,库只依赖 `url`) */
|
|
94
|
+
export interface DesignUploadResult {
|
|
95
|
+
/** 可访问地址(表单值存的就是它) */
|
|
96
|
+
url: string;
|
|
97
|
+
/** 原始文件名(可选) */
|
|
98
|
+
name?: string;
|
|
99
|
+
/** 其它字段(如 ossId)原样透传给宿主自己的组件 */
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
}
|
|
102
|
+
export interface DesignUploadOptions {
|
|
103
|
+
/** 上传进度(0~100) */
|
|
104
|
+
onProgress?: (percent: number) => void;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 文件上传能力(**宿主实现**)。
|
|
108
|
+
*
|
|
109
|
+
* 为什么不像 `http` 那样直接给接口路径:上传地址与返回口径是**平台相关**的
|
|
110
|
+
* (vben/ruoyi 是 `POST /resource/oss/upload` → `{url, fileName, ossId}`,别的项目各不相同)。
|
|
111
|
+
* 库只要求「给个 File,还我一个 url」,接口细节全部留在宿主。
|
|
112
|
+
*
|
|
113
|
+
* 未注入时:`file` / `image` 字段显示「上传不可用」提示并 warn 一次。
|
|
114
|
+
*/
|
|
115
|
+
export type DesignHostUpload = (file: File, options?: DesignUploadOptions) => Promise<DesignUploadResult>;
|
|
116
|
+
export interface DesignHost {
|
|
117
|
+
/**
|
|
118
|
+
* 网络层。**必须**注入宿主自己的请求实例适配(见 http.ts 顶部说明),
|
|
119
|
+
* 否则库内取数没有登录态,且宿主的 401 处理不生效。
|
|
120
|
+
*/
|
|
121
|
+
http?: DesignHttp;
|
|
122
|
+
/** 文件上传(file / image 字段用),见 DesignHostUpload */
|
|
123
|
+
upload?: DesignHostUpload;
|
|
124
|
+
/** 国际化:传 key 返回文案;未注入时用内置中文兜底 */
|
|
125
|
+
t?: (key: string) => string;
|
|
126
|
+
message?: DesignHostMessage;
|
|
127
|
+
modal?: DesignHostModal;
|
|
128
|
+
/** 登录态快照(函数形式,保证每次取到最新值) */
|
|
129
|
+
getAuth?: () => DesignAuthSnapshot;
|
|
130
|
+
/** UI 外壳(Page / 抽屉 / 弹窗 / vxe-grid),见 DesignHostUi */
|
|
131
|
+
ui?: DesignHostUi;
|
|
132
|
+
/** 字典渲染(业务数据在宿主) */
|
|
133
|
+
dict?: DesignHostDict;
|
|
134
|
+
/** 业务后端能力(流程等) */
|
|
135
|
+
workflow?: DesignHostWorkflow;
|
|
136
|
+
/**
|
|
137
|
+
* 严格版本自检:为 true 时,若宿主的 vue / antdv-next 不在支持区间,**启动即抛错**。
|
|
138
|
+
* 默认 false(只 console.error),避免一个版本提示把整个应用打挂;
|
|
139
|
+
* CI / 预发环境建议打开。
|
|
140
|
+
*/
|
|
141
|
+
strictCompat?: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 安装 / 更新宿主能力。宿主在 bootstrap 里调一次;
|
|
145
|
+
* 允许重复调用(后到的覆盖同名项,便于热更 / 多应用共存)。
|
|
146
|
+
*
|
|
147
|
+
* `ui` / `dict` / `workflow` 三个分组是**按键合并**的:
|
|
148
|
+
* `installDesignPlatform({ ui: { Page } })` 之后再
|
|
149
|
+
* `installDesignPlatform({ ui: { useVbenVxeGrid } })`,两个能力都在。
|
|
150
|
+
*
|
|
151
|
+
* 首次调用会顺带跑一次依赖版本自检(见 compat.ts),不匹配时明确报出来。
|
|
152
|
+
*/
|
|
153
|
+
export declare function installDesignPlatform(next: DesignHost): DesignHost;
|
|
154
|
+
/** 读取宿主能力(库内部使用) */
|
|
155
|
+
export declare function getDesignHost(): DesignHost;
|
|
156
|
+
/** 取文案:宿主注入了 `t` 就用宿主语言,否则内置中文兜底 */
|
|
157
|
+
export declare function hostT(key: string, fallback: string): string;
|
|
158
|
+
/** 仅测试用:清空注入 */
|
|
159
|
+
export declare function resetDesignHost(): void;
|
|
160
|
+
/** UI 外壳能力(可能为空对象,用前自己判字段) */
|
|
161
|
+
export declare function getHostUi(): DesignHostUi;
|
|
162
|
+
/** 字典能力(可能为空对象;`render` 缺失时字典列降级为原值) */
|
|
163
|
+
export declare function getHostDict(): DesignHostDict;
|
|
164
|
+
/** 业务后端能力(可能为空对象;缺字段的功能直接不显示) */
|
|
165
|
+
export declare function getHostWorkflow(): DesignHostWorkflow;
|
|
166
|
+
/**
|
|
167
|
+
* 取 http:没注入就直接报错(这是**唯一**必须注入的能力,静默降级只会让问题更难查)
|
|
168
|
+
*/
|
|
169
|
+
export declare function requireHttp(): DesignHttp;
|
|
170
|
+
/**
|
|
171
|
+
* 取 vxe-grid 组合函数:没注入就报错(表格/树形视图没有它渲染不出网格)。
|
|
172
|
+
*
|
|
173
|
+
* 为什么不像 `getHostDict()` 那样返回空对象:网格是这类组件的**主体**,
|
|
174
|
+
* 静默降级成"空白页"比直接抛错更难查。
|
|
175
|
+
*/
|
|
176
|
+
export declare function requireVxeGrid(): NonNullable<DesignHostUi['useVbenVxeGrid']>;
|
|
177
|
+
/**
|
|
178
|
+
* 取抽屉/弹窗组合函数:返回 undefined 时调用方必须降级(不打开面板、只提示)。
|
|
179
|
+
* 不抛错的原因:这两个是**外壳**,缺了仍可用别的形式展示(例如抽屉退化成弹窗),
|
|
180
|
+
* 属于可选能力。
|
|
181
|
+
*/
|
|
182
|
+
export declare function getHostPopup(kind: 'drawer' | 'modal'): ((...args: any[]) => any) | undefined;
|