ehr-form-engine 1.0.0-beta.2 → 1.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/dist/index.cjs.js +4 -30
- package/dist/index.es.js +32188 -34119
- package/dist/src/components/ConfigProvider/index.d.ts +4 -0
- package/dist/src/components/ConfigProvider/index.vue.d.ts +24 -0
- package/dist/src/components/Core/index.vue.d.ts +32 -3
- package/dist/src/components/Dependency/Operator/index.vue.d.ts +2 -2
- package/dist/src/components/Dependency/types/emits.d.ts +1 -1
- package/dist/src/components/Designer/index.vue.d.ts +4 -1
- package/dist/src/components/Panel/ContainerProperty/index.vue.d.ts +2 -3
- package/dist/src/components/Panel/Designer/index.vue.d.ts +37 -5
- package/dist/src/components/Panel/FieldProperty/index.vue.d.ts +2 -3
- package/dist/src/components/Panel/TableProperty/index.vue.d.ts +2 -3
- package/dist/src/components/Panel/UploadProperty/index.vue.d.ts +2 -3
- package/dist/src/components/Panel/types/designer.d.ts +9 -0
- package/dist/src/components/Panel/types/emits.d.ts +6 -5
- package/dist/src/components/Panel/types/index.d.ts +1 -0
- package/dist/src/components/Panel/types/props.d.ts +3 -3
- package/dist/src/components/Render/Core/index.d.ts +3 -0
- package/dist/src/components/Render/Core/index.vue.d.ts +50 -0
- package/dist/src/components/Render/Form/index.vue.d.ts +24 -3
- package/dist/src/components/Render/MobileTable/index.d.ts +3 -0
- package/dist/src/components/Render/MobileTable/index.vue.d.ts +28 -0
- package/dist/src/components/Render/Table/index.vue.d.ts +4 -1
- package/dist/src/components/Render/Upload/index.vue.d.ts +34 -1
- package/dist/src/components/Render/Uploads/index.vue.d.ts +2 -0
- package/dist/src/components/Render/index.d.ts +2 -0
- package/dist/src/components/Render/types/props.d.ts +7 -5
- package/dist/src/components/Render/types/types.d.ts +35 -0
- package/dist/src/components/index.d.ts +9 -3
- package/dist/src/composables/index.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +37 -0
- package/dist/src/composables/useDesigner.d.ts +38 -0
- package/dist/src/data/common/dataMap.d.ts +1 -0
- package/dist/src/data/components/componentMap.d.ts +1 -0
- package/dist/src/styles/css.d.ts +4 -0
- package/dist/src/types/config.d.ts +129 -0
- package/dist/src/types/types.d.ts +6 -2
- package/dist/src/utils/device.d.ts +12 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +33 -21
- package/dist/src/components/utils/sleep.d.ts +0 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DesignerGlobalConfig, HrFormEngineConfig, TableGlobalConfig, UploadGlobalConfig, ValidationGlobalConfig } from '../types/config';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 获取全局配置
|
|
5
|
+
* @returns 合并后的全局配置对象
|
|
6
|
+
*/
|
|
7
|
+
export declare function useConfig(): HrFormEngineConfig;
|
|
8
|
+
/**
|
|
9
|
+
* 获取上传组件配置
|
|
10
|
+
* @returns 上传组件配置(已合并默认值)
|
|
11
|
+
*/
|
|
12
|
+
export declare function useUploadConfig(): UploadGlobalConfig;
|
|
13
|
+
/**
|
|
14
|
+
* 获取表格组件配置
|
|
15
|
+
* @returns 表格组件配置(已合并默认值)
|
|
16
|
+
*/
|
|
17
|
+
export declare function useTableConfig(): TableGlobalConfig;
|
|
18
|
+
/**
|
|
19
|
+
* 获取设计器配置
|
|
20
|
+
* @returns 设计器配置(已合并默认值)
|
|
21
|
+
*/
|
|
22
|
+
export declare function useDesignerConfig(): DesignerGlobalConfig;
|
|
23
|
+
/**
|
|
24
|
+
* 获取校验规则配置
|
|
25
|
+
* @returns 校验规则配置(已合并默认值)
|
|
26
|
+
*/
|
|
27
|
+
export declare function useValidationConfig(): ValidationGlobalConfig;
|
|
28
|
+
/**
|
|
29
|
+
* 获取上传尺寸配置
|
|
30
|
+
* 优先级:schema.pixel > 全局配置 typeWidthMap/typeHeightMap > 默认配置
|
|
31
|
+
* @param fieldType 上传字段类型
|
|
32
|
+
* @returns { width, height } 尺寸配置
|
|
33
|
+
*/
|
|
34
|
+
export declare function useUploadDimensions(fieldType: string): {
|
|
35
|
+
width: number;
|
|
36
|
+
height: number;
|
|
37
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComputedRef, UnwrapNestedRefs } from 'vue';
|
|
2
|
+
import { ItemTypeTag, JsonSchemaType } from '../types';
|
|
3
|
+
|
|
4
|
+
export interface DesignerState {
|
|
5
|
+
jsonSchema: JsonSchemaType[];
|
|
6
|
+
selectedId: string | null;
|
|
7
|
+
history: DesignerHistoryRecord[];
|
|
8
|
+
historyIndex: number;
|
|
9
|
+
isDragging: boolean;
|
|
10
|
+
draggedItem: JsonSchemaType | null;
|
|
11
|
+
}
|
|
12
|
+
export interface DesignerHistoryRecord {
|
|
13
|
+
jsonSchema: JsonSchemaType[];
|
|
14
|
+
selectedId: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface DesignerInstance {
|
|
17
|
+
state: UnwrapNestedRefs<DesignerState>;
|
|
18
|
+
selectedItem: ComputedRef<JsonSchemaType | null>;
|
|
19
|
+
selectedItemType: ComputedRef<ItemTypeTag | null>;
|
|
20
|
+
canUndo: ComputedRef<boolean>;
|
|
21
|
+
canRedo: ComputedRef<boolean>;
|
|
22
|
+
selectItem: (id: string | null) => void;
|
|
23
|
+
loadSchema: (schema: JsonSchemaType[]) => void;
|
|
24
|
+
addItem: (parentId: string | null, item: JsonSchemaType) => void;
|
|
25
|
+
deleteItem: (id: string) => void;
|
|
26
|
+
updateItem: (id: string, changes: Partial<JsonSchemaType>) => void;
|
|
27
|
+
moveItem: (id: string, direction: 'up' | 'down') => void;
|
|
28
|
+
undo: () => void;
|
|
29
|
+
redo: () => void;
|
|
30
|
+
reset: () => void;
|
|
31
|
+
findItemById: (schema: JsonSchemaType[], id: string) => JsonSchemaType | null;
|
|
32
|
+
findParentById: (schema: JsonSchemaType[], id: string) => JsonSchemaType | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 设计器状态管理
|
|
36
|
+
* 提供完整的设计器状态管理功能,包括选中、历史记录、增删改查等
|
|
37
|
+
*/
|
|
38
|
+
export declare function useDesigner(): DesignerInstance;
|
|
@@ -11,6 +11,7 @@ export declare const datePickerMap: {
|
|
|
11
11
|
export declare const datePickerOptions: Array<SelectOption>;
|
|
12
12
|
export declare const timePickerOptions: Array<SelectOption>;
|
|
13
13
|
export declare const selectModeOptions: Array<SelectOption>;
|
|
14
|
+
export declare const mobileInputModeOptions: Array<SelectOption>;
|
|
14
15
|
export declare const uploadListTypeOptions: Array<SelectOption>;
|
|
15
16
|
export declare const selectPlacementOptions: Array<SelectOption>;
|
|
16
17
|
export declare const layoutOptions: Array<SelectOption>;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 上传组件全局配置
|
|
5
|
+
*/
|
|
6
|
+
export interface UploadGlobalConfig {
|
|
7
|
+
/**
|
|
8
|
+
* 默认上传 API 地址
|
|
9
|
+
* 可被组件 props.uploadApiUrl 覆盖
|
|
10
|
+
* @default undefined(必须传入)
|
|
11
|
+
*/
|
|
12
|
+
defaultUploadApiUrl?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 上传类型对应的宽度映射
|
|
15
|
+
* 可被组件 schema.pixel.width 覆盖
|
|
16
|
+
*/
|
|
17
|
+
typeWidthMap?: Record<string, number>;
|
|
18
|
+
/**
|
|
19
|
+
* 上传类型对应的高度映射
|
|
20
|
+
* 可被组件 schema.pixel.height 覆盖
|
|
21
|
+
*/
|
|
22
|
+
typeHeightMap?: Record<string, number>;
|
|
23
|
+
/**
|
|
24
|
+
* 默认单图上传接口路径后缀
|
|
25
|
+
* @default 'single'
|
|
26
|
+
*/
|
|
27
|
+
singleUploadPath?: string;
|
|
28
|
+
/**
|
|
29
|
+
* 默认多图上传接口路径后缀
|
|
30
|
+
* @default 'multiple'
|
|
31
|
+
*/
|
|
32
|
+
multipleUploadPath?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 表格组件全局配置
|
|
36
|
+
*/
|
|
37
|
+
export interface TableGlobalConfig {
|
|
38
|
+
/**
|
|
39
|
+
* 表格滚动加载的防抖延迟(毫秒)
|
|
40
|
+
* @default 800
|
|
41
|
+
*/
|
|
42
|
+
scrollDebounceMs?: number;
|
|
43
|
+
/**
|
|
44
|
+
* 默认分页大小选项
|
|
45
|
+
* @default [10, 20, 50, 100]
|
|
46
|
+
*/
|
|
47
|
+
pageSizeOptions?: number[];
|
|
48
|
+
/**
|
|
49
|
+
* 默认每页条数
|
|
50
|
+
* @default 20
|
|
51
|
+
*/
|
|
52
|
+
defaultPageSize?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 设计器全局配置
|
|
56
|
+
*/
|
|
57
|
+
export interface DesignerGlobalConfig {
|
|
58
|
+
/**
|
|
59
|
+
* 是否启用组件拖拽动画
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
enableDragAnimation?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 拖拽动画持续时间(毫秒)
|
|
65
|
+
* @default 300
|
|
66
|
+
*/
|
|
67
|
+
dragAnimationDurationMs?: number;
|
|
68
|
+
/**
|
|
69
|
+
* 属性面板宽度
|
|
70
|
+
* @default 300
|
|
71
|
+
*/
|
|
72
|
+
propertyPanelWidth?: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 校验规则全局配置
|
|
76
|
+
*/
|
|
77
|
+
export interface ValidationGlobalConfig {
|
|
78
|
+
/**
|
|
79
|
+
* 必填项错误消息模板
|
|
80
|
+
* @default '{field} 为必填项'
|
|
81
|
+
*/
|
|
82
|
+
requiredMessageTemplate?: string;
|
|
83
|
+
/**
|
|
84
|
+
* 最小上传数量错误消息模板
|
|
85
|
+
* @default '{field} 至少需要上传 {min} 个附件'
|
|
86
|
+
*/
|
|
87
|
+
minUploadCountMessageTemplate?: string;
|
|
88
|
+
/**
|
|
89
|
+
* 自定义校验规则扩展
|
|
90
|
+
*/
|
|
91
|
+
customRules?: Record<string, {
|
|
92
|
+
pattern: RegExp;
|
|
93
|
+
message: string;
|
|
94
|
+
}>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 组件库全局配置对象
|
|
98
|
+
*/
|
|
99
|
+
export interface HrFormEngineConfig {
|
|
100
|
+
/**
|
|
101
|
+
* 上传组件配置
|
|
102
|
+
*/
|
|
103
|
+
upload?: UploadGlobalConfig;
|
|
104
|
+
/**
|
|
105
|
+
* 表格组件配置
|
|
106
|
+
*/
|
|
107
|
+
table?: TableGlobalConfig;
|
|
108
|
+
/**
|
|
109
|
+
* 设计器配置
|
|
110
|
+
*/
|
|
111
|
+
designer?: DesignerGlobalConfig;
|
|
112
|
+
/**
|
|
113
|
+
* 校验规则配置
|
|
114
|
+
*/
|
|
115
|
+
validation?: ValidationGlobalConfig;
|
|
116
|
+
/**
|
|
117
|
+
* 是否开启调试模式
|
|
118
|
+
* @default false
|
|
119
|
+
*/
|
|
120
|
+
debug?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 配置注入 key
|
|
124
|
+
*/
|
|
125
|
+
export declare const HR_FORM_ENGINE_CONFIG_KEY: InjectionKey<HrFormEngineConfig>;
|
|
126
|
+
/**
|
|
127
|
+
* 默认配置
|
|
128
|
+
*/
|
|
129
|
+
export declare const DEFAULT_CONFIG: HrFormEngineConfig;
|
|
@@ -138,6 +138,7 @@ export declare namespace ComponentProps {
|
|
|
138
138
|
maxlength: number;
|
|
139
139
|
placeholder: string;
|
|
140
140
|
showCount: boolean;
|
|
141
|
+
inputmode?: string;
|
|
141
142
|
}>;
|
|
142
143
|
type InputNumberProps = StrictProps<{
|
|
143
144
|
addonAfter?: string;
|
|
@@ -147,6 +148,7 @@ export declare namespace ComponentProps {
|
|
|
147
148
|
precision: number;
|
|
148
149
|
prefix?: string;
|
|
149
150
|
step: number;
|
|
151
|
+
inputmode?: string;
|
|
150
152
|
}>;
|
|
151
153
|
type InputPasswordProps = StrictProps<InputProps & {
|
|
152
154
|
visibilityToggle: boolean;
|
|
@@ -157,6 +159,7 @@ export declare namespace ComponentProps {
|
|
|
157
159
|
maxlength: number;
|
|
158
160
|
placeholder: string;
|
|
159
161
|
showCount: boolean;
|
|
162
|
+
inputmode?: string;
|
|
160
163
|
}>;
|
|
161
164
|
type RadioGroupProps = StrictProps<{
|
|
162
165
|
optionType: 'button' | 'default';
|
|
@@ -245,7 +248,7 @@ interface ComponentMap {
|
|
|
245
248
|
};
|
|
246
249
|
InputNumber: {
|
|
247
250
|
DataType: 'number';
|
|
248
|
-
ModelValue: number | undefined;
|
|
251
|
+
ModelValue: null | number | undefined;
|
|
249
252
|
NeedOptions: false;
|
|
250
253
|
Props: ComponentProps.InputNumberProps;
|
|
251
254
|
};
|
|
@@ -276,7 +279,7 @@ interface ComponentMap {
|
|
|
276
279
|
};
|
|
277
280
|
Select: {
|
|
278
281
|
DataType: 'select';
|
|
279
|
-
ModelValue: number | string | undefined;
|
|
282
|
+
ModelValue: null | number | string | undefined;
|
|
280
283
|
NeedOptions: true;
|
|
281
284
|
Props: ComponentProps.SelectProps;
|
|
282
285
|
};
|
|
@@ -346,6 +349,7 @@ export type BaseSchemaType<CN extends ValidComponentName, Tag extends ItemTypeTa
|
|
|
346
349
|
isEndNode: boolean;
|
|
347
350
|
label: string;
|
|
348
351
|
labelProp?: CN extends 'none' ? LabelProp : never;
|
|
352
|
+
minCount: number;
|
|
349
353
|
modelValue: ComponentMap[CN]['ModelValue'];
|
|
350
354
|
name: string;
|
|
351
355
|
required: boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 基础移动端检测(UA+屏幕宽度双重判断)
|
|
3
|
+
* @returns 是否为移动端
|
|
4
|
+
*/
|
|
5
|
+
export declare const isMobile: () => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* 响应式设备检测(支持SSR+微信环境)
|
|
8
|
+
* @returns isMobileDevice: 响应式移动端标识
|
|
9
|
+
*/
|
|
10
|
+
export declare const useDeviceDetect: () => {
|
|
11
|
+
isMobileDevice: import('vue').Ref<boolean, boolean>;
|
|
12
|
+
};
|