@yeepay/yee-boss-ui 0.1.13 → 0.1.15

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 (39) hide show
  1. package/README.md +245 -17
  2. package/dist/components/PlatformConfigProvider.vue.d.ts +4 -9
  3. package/dist/components/descriptions/YeeDescriptions.vue.d.ts +5 -7
  4. package/dist/components/descriptions/index.d.ts +1 -1
  5. package/dist/components/descriptions/types.d.ts +25 -1
  6. package/dist/components/ellipsis-text/YeeEllipsisText.vue.d.ts +2 -8
  7. package/dist/components/ellipsis-text/index.d.ts +1 -1
  8. package/dist/components/ellipsis-text/types.d.ts +12 -1
  9. package/dist/components/file-preview/YeeFilePreview.vue.d.ts +3 -3
  10. package/dist/components/file-preview/index.d.ts +1 -1
  11. package/dist/components/file-preview/types.d.ts +38 -0
  12. package/dist/components/file-upload/YeeFileUpload.vue.d.ts +5 -14
  13. package/dist/components/file-upload/index.d.ts +1 -1
  14. package/dist/components/file-upload/types.d.ts +51 -0
  15. package/dist/components/form/YeeForm.vue.d.ts +2 -2
  16. package/dist/components/form/component-map.d.ts +9 -0
  17. package/dist/components/form/form-api.d.ts +10 -4
  18. package/dist/components/form/index.d.ts +1 -1
  19. package/dist/components/form/types.d.ts +114 -5
  20. package/dist/components/grid/YeeGrid.vue.d.ts +4 -110
  21. package/dist/components/grid/index.d.ts +2 -2
  22. package/dist/components/grid/types.d.ts +40 -3
  23. package/dist/components/grid/use-yee-grid.d.ts +6 -3
  24. package/dist/components/grid/yee-grid-api.d.ts +11 -3
  25. package/dist/components/modal/YeeModal.vue.d.ts +3 -14
  26. package/dist/components/modal/index.d.ts +3 -2
  27. package/dist/components/modal/types.d.ts +64 -2
  28. package/dist/components/page/YeePage.vue.d.ts +2 -8
  29. package/dist/components/page/index.d.ts +1 -1
  30. package/dist/components/page/types.d.ts +22 -0
  31. package/dist/components/platform-config-provider/types.d.ts +12 -0
  32. package/dist/components/select/YeeSelect.vue.d.ts +15 -13
  33. package/dist/components/select/index.d.ts +3 -2
  34. package/dist/components/select/types.d.ts +115 -13
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +1104 -1032
  37. package/dist/style.css +1 -1
  38. package/dist/theme/types.d.ts +65 -0
  39. package/package.json +4 -3
@@ -1,26 +1,77 @@
1
1
  import { UploadProps } from 'ant-design-vue';
2
+ /** 文件列表中的单个文件,沿用 Ant Design Vue UploadFile。 */
2
3
  export type YeeUploadFile = NonNullable<NonNullable<UploadProps['fileList']>[number]>;
4
+ /** 上传完成后写回文件列表的结果。 */
3
5
  export interface YeeUploadResult {
6
+ /** 服务端返回的文件名。 */
4
7
  name?: string;
8
+ /** 文件可访问地址。 */
5
9
  url?: string;
6
10
  }
11
+ /** 自动上传回调接收的参数。 */
7
12
  export interface YeeUploadRequestOptions {
13
+ /** 当前待上传文件。 */
8
14
  file: File;
15
+ /** 将上传标记为失败。 */
9
16
  onError: (error: Error) => void;
17
+ /** 更新上传进度,取值范围为 0 到 100。 */
10
18
  onProgress: (percent: number) => void;
19
+ /** 将上传标记为成功并写回文件信息。 */
11
20
  onSuccess: (result?: YeeUploadResult) => void;
21
+ /** 当前文件在上传列表中的唯一标识。 */
12
22
  uid: string;
13
23
  }
24
+ /** 手动模式选择文件时发送的事件参数。 */
25
+ export interface YeeFileSelectPayload {
26
+ /** 当前选择的原始文件。 */
27
+ file: File;
28
+ /** 当前文件在上传列表中的唯一标识。 */
29
+ uid: string;
30
+ }
31
+ /** YeeFileUpload 的公开属性。 */
14
32
  export interface YeeFileUploadProps {
33
+ /** 原生文件选择器 accept 配置。 */
15
34
  accept?: string;
35
+ /** 自动上传实现,由业务侧接入统一请求层。 */
16
36
  customRequest?: (options: YeeUploadRequestOptions) => Promise<void> | void;
37
+ /** 当前文件列表,支持 v-model:file-list。 */
17
38
  fileList?: YeeUploadFile[];
39
+ /** 上传触发块高度,数字按 px 处理。 */
18
40
  height?: number | string;
41
+ /** 是否启用手动上传模式。 */
19
42
  manual?: boolean;
43
+ /** 最多允许展示的文件数量。 */
20
44
  maxCount?: number;
45
+ /** 单个文件大小上限,单位 MB。 */
21
46
  maxSize?: number;
47
+ /** 是否允许一次选择多个文件。 */
22
48
  multiple?: boolean;
49
+ /** 是否只读展示文件列表。 */
23
50
  readonly?: boolean;
51
+ /** 上传触发块文案。 */
24
52
  uploadText?: string;
53
+ /** 上传触发块宽度,数字按 px 处理。 */
25
54
  width?: number | string;
26
55
  }
56
+ /** YeeFileUpload 的公开事件。 */
57
+ export interface YeeFileUploadEmits {
58
+ /** 文件从列表中移除时触发。 */
59
+ fileRemoved: [file: YeeUploadFile];
60
+ /** 手动模式选中文件时触发。 */
61
+ fileSelect: [payload: YeeFileSelectPayload];
62
+ /** 文件列表变化时触发。 */
63
+ 'update:fileList': [fileList: YeeUploadFile[]];
64
+ /** 任意文件上传成功后触发。 */
65
+ uploadSuccess: [];
66
+ /** 整体上传状态变化时触发。 */
67
+ uploadingChange: [isUploading: boolean];
68
+ }
69
+ /** 通过组件 ref 调用的手动上传方法。 */
70
+ export interface YeeFileUploadExpose {
71
+ /** 将指定文件标记为失败。 */
72
+ addError: (uid: string) => void;
73
+ /** 将指定文件标记为成功并写回地址。 */
74
+ addResult: (uid: string, result: Required<Pick<YeeUploadResult, 'url'>> & YeeUploadResult) => void;
75
+ /** 获取当前列表中的原始 File 对象。 */
76
+ getFiles: () => File[];
77
+ }
@@ -1,9 +1,9 @@
1
- import { YeeFormValues, YeeFormProps } from './types';
1
+ import { YeeFormSlots, YeeFormValues, YeeFormProps } from './types';
2
2
  declare const _default: <TValues extends object = YeeFormValues>(__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<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & YeeFormProps<TValues> & Partial<{}>> & import('vue').PublicProps;
4
4
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
5
  attrs: any;
6
- slots: {};
6
+ slots: Readonly<YeeFormSlots<TValues>> & YeeFormSlots<TValues>;
7
7
  emit: {};
8
8
  }>) => import('vue').VNode & {
9
9
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -0,0 +1,9 @@
1
+ import { Component } from 'vue';
2
+ import { YeeFormBuiltInComponent } from './types';
3
+ export declare const yeeFormComponentMap: Record<YeeFormBuiltInComponent, Component>;
4
+ export declare const yeeFormModelPropMap: {
5
+ readonly Checkbox: "checked";
6
+ readonly Radio: "checked";
7
+ readonly Switch: "checked";
8
+ readonly Upload: "fileList";
9
+ };
@@ -1,14 +1,20 @@
1
1
  import { ShallowRef } from 'vue';
2
- import { YeeFormOptions, YeeFormSchema, YeeFormSchemaUpdate, YeeFormValues } from './types';
2
+ import { YeeFormSchema, YeeFormSchemaUpdate, YeeFormValues } from './types';
3
3
  export declare class YeeFormApi<TValues extends object = YeeFormValues> {
4
+ /** 当前表单 Schema,由组件初始化,可通过 updateSchema 动态更新。 */
4
5
  readonly schema: ShallowRef<readonly YeeFormSchema<TValues>[]>;
5
6
  private initialValues;
6
7
  private readonly values;
7
- configure(options: YeeFormOptions<TValues>): void;
8
- getFieldValue(fieldName: keyof TValues & string): unknown;
8
+ /** 获取指定字段值,并保留 TValues 中声明的字段类型。 */
9
+ getFieldValue<TKey extends keyof TValues & string>(fieldName: TKey): TValues[TKey] | undefined;
10
+ /** 获取当前全部字段值的浅拷贝。 */
9
11
  getValues(): TValues;
12
+ /** 将字段值恢复为 initialValues。 */
10
13
  resetForm(): void;
11
- setFieldValue(fieldName: keyof TValues & string, value: unknown): void;
14
+ /** 设置指定字段值,字段名和值必须与 TValues 保持一致。 */
15
+ setFieldValue<TKey extends keyof TValues & string>(fieldName: TKey, value: TValues[TKey]): void;
16
+ /** 批量更新已声明字段的值。 */
12
17
  setValues(values: Partial<TValues>): void;
18
+ /** 按字段名动态更新 Schema。 */
13
19
  updateSchema(updates: readonly YeeFormSchemaUpdate<TValues>[]): void;
14
20
  }
@@ -1,3 +1,3 @@
1
1
  export { default as YeeForm } from './YeeForm.vue';
2
2
  export { YeeFormApi } from './form-api';
3
- export type { YeeFormComponent, YeeFormOptions, YeeFormSchema, YeeFormSchemaUpdate, YeeFormValues, YeeFormProps, } from './types';
3
+ export type { YeeFormBuiltInComponent, YeeFormComponent, YeeFormComponentPropsMap, YeeFormOptions, YeeFormSchema, YeeFormSchemaUpdate, YeeFormSlotProps, YeeFormSlots, YeeFormValues, YeeFormProps, } from './types';
@@ -1,28 +1,137 @@
1
- export type YeeFormComponent = 'Input' | 'RangePicker' | 'Select';
1
+ import { AutoCompleteProps, CascaderProps, CheckboxGroupProps, CheckboxProps, DatePickerProps, InputNumberProps, InputProps, MentionsProps, RadioGroupProps, RadioProps, RateProps, SegmentedProps, SelectProps, SliderProps, SwitchProps, TextAreaProps, TimePickerProps, TimeRangePickerProps, TreeSelectProps } from 'ant-design-vue';
2
+ import { RangePickerProps } from 'ant-design-vue/es/date-picker';
3
+ import { VNodeChild } from 'vue';
4
+ import { YeeFileUploadProps } from '../file-upload/types';
5
+ /** Input.Password 在 Ant Design Vue 的 InputProps 之外提供的属性。 */
6
+ interface YeeFormInputPasswordProps extends InputProps {
7
+ /** 点击图标时触发的默认动作。 */
8
+ action?: string;
9
+ /** 自定义密码显隐图标。 */
10
+ iconRender?: (visible: boolean) => VNodeChild;
11
+ /** 受控的密码可见状态。 */
12
+ visible?: boolean;
13
+ /** 是否显示密码切换按钮。 */
14
+ visibilityToggle?: boolean;
15
+ /** 密码可见状态变化事件。 */
16
+ 'onUpdate:visible'?: (visible: boolean) => void;
17
+ }
18
+ /** YeeForm 当前支持的表单组件及其原生属性。 */
19
+ export interface YeeFormComponentPropsMap {
20
+ AutoComplete: AutoCompleteProps;
21
+ Cascader: CascaderProps;
22
+ Checkbox: CheckboxProps;
23
+ CheckboxGroup: CheckboxGroupProps;
24
+ Custom: Record<string, unknown>;
25
+ DatePicker: DatePickerProps;
26
+ Input: InputProps;
27
+ InputNumber: InputNumberProps;
28
+ InputPassword: YeeFormInputPasswordProps;
29
+ Mentions: MentionsProps;
30
+ Radio: RadioProps;
31
+ RadioGroup: RadioGroupProps;
32
+ RangePicker: RangePickerProps;
33
+ Rate: RateProps;
34
+ Segmented: SegmentedProps;
35
+ Select: SelectProps;
36
+ Slider: SliderProps;
37
+ Switch: SwitchProps;
38
+ Textarea: TextAreaProps;
39
+ TimePicker: TimePickerProps;
40
+ TimeRangePicker: TimeRangePickerProps;
41
+ TreeSelect: TreeSelectProps;
42
+ Upload: YeeFileUploadProps;
43
+ }
44
+ /** YeeForm 当前支持的 Schema 组件名。 */
45
+ export type YeeFormComponent = keyof YeeFormComponentPropsMap;
46
+ /** YeeForm 内置渲染的组件名;Custom 由字段同名插槽渲染。 */
47
+ export type YeeFormBuiltInComponent = Exclude<YeeFormComponent, 'Custom'>;
48
+ /** YeeForm 默认的字段值结构;建议业务侧传入更具体的泛型。 */
2
49
  export type YeeFormValues = Record<string, unknown>;
3
- export interface YeeFormSchema<TValues extends object = YeeFormValues> {
4
- component: YeeFormComponent;
5
- componentProps?: Record<string, unknown>;
50
+ interface YeeFormSchemaBase<TValues extends object = YeeFormValues> {
51
+ /** 字段名,只允许使用 TValues 中已声明的键。 */
6
52
  fieldName: keyof TValues & string;
53
+ /** 是否隐藏当前字段。 */
7
54
  hide?: boolean;
55
+ /** 字段标题。 */
8
56
  label: string;
9
57
  }
10
- export interface YeeFormSchemaUpdate<TValues extends object = YeeFormValues> extends Partial<Omit<YeeFormSchema<TValues>, 'fieldName'>> {
58
+ /** 单个 Schema 字段;componentProps 会根据 component 自动提示。 */
59
+ export type YeeFormSchema<TValues extends object = YeeFormValues> = {
60
+ [TComponent in YeeFormComponent]: YeeFormSchemaBase<TValues> & {
61
+ /** 渲染使用的表单组件。 */
62
+ component: TComponent;
63
+ /** 对应 Ant Design Vue 组件的原生属性。 */
64
+ componentProps?: YeeFormComponentPropsMap[TComponent];
65
+ };
66
+ }[YeeFormComponent];
67
+ interface YeeFormSchemaUpdateBase<TValues extends object = YeeFormValues> {
68
+ /** 需要更新的字段名。 */
11
69
  fieldName: keyof TValues & string;
70
+ /** 是否隐藏当前字段。 */
71
+ hide?: boolean;
72
+ /** 新的字段标题。 */
73
+ label?: string;
12
74
  }
75
+ /**
76
+ * 动态更新 Schema 时使用的字段配置。
77
+ * 传入 component 时,componentProps 会自动收窄为对应组件的原生属性。
78
+ */
79
+ export type YeeFormSchemaUpdate<TValues extends object = YeeFormValues> = YeeFormSchemaUpdateBase<TValues> & {
80
+ /** 不切换组件,只更新当前组件属性。 */
81
+ component?: never;
82
+ /** 当前组件的属性;组件类型由已有 Schema 决定。 */
83
+ componentProps?: YeeFormComponentPropsMap[YeeFormComponent];
84
+ } | {
85
+ [TComponent in YeeFormComponent]: YeeFormSchemaUpdateBase<TValues> & {
86
+ /** 需要切换到的表单组件。 */
87
+ component: TComponent;
88
+ /** 对应组件的原生属性。 */
89
+ componentProps?: YeeFormComponentPropsMap[TComponent];
90
+ };
91
+ }[YeeFormComponent];
92
+ /** YeeForm 的运行配置。 */
13
93
  export interface YeeFormOptions<TValues extends object = YeeFormValues> {
94
+ /** 初始是否折叠。 */
14
95
  collapsed?: boolean;
96
+ /** 折叠状态下展示的行数。 */
15
97
  collapsedRows?: number;
98
+ /** 折叠状态变化回调。 */
16
99
  handleCollapsedChange?: (collapsed: boolean) => void;
100
+ /** 表单初始值。 */
17
101
  initialValues?: Partial<TValues>;
102
+ /** 表单字段 Schema。 */
18
103
  schema: readonly YeeFormSchema<TValues>[];
104
+ /** 是否显示展开/收起按钮。 */
19
105
  showCollapseButton?: boolean;
106
+ /** 字段变化后是否立即查询。 */
20
107
  submitOnChange?: boolean;
108
+ /** 是否允许按 Enter 查询。 */
21
109
  submitOnEnter?: boolean;
22
110
  }
111
+ /** YeeForm 的公开属性。 */
23
112
  export interface YeeFormProps<TValues extends object = YeeFormValues> {
113
+ /** 管理字段值和 Schema 的表单 API。 */
24
114
  api: import('./form-api').YeeFormApi<TValues>;
115
+ /** 点击重置后的回调。 */
25
116
  onReset?: () => Promise<void> | void;
117
+ /** 点击查询后的回调。 */
26
118
  onSubmit?: (values: TValues) => Promise<void> | void;
119
+ /** 表单运行配置。 */
27
120
  options: YeeFormOptions<TValues>;
28
121
  }
122
+ /** YeeForm 字段插槽接收的参数。 */
123
+ export interface YeeFormSlotProps<TValues extends object = YeeFormValues, TFieldName extends keyof TValues & string = keyof TValues & string> {
124
+ /** 当前字段的 Schema。 */
125
+ field: YeeFormSchema<TValues>;
126
+ /** 将当前字段写回 YeeFormApi。 */
127
+ setValue: (value: TValues[TFieldName]) => void;
128
+ /** 当前字段值。 */
129
+ value: TValues[TFieldName] | undefined;
130
+ /** 当前表单全部字段值的浅拷贝。 */
131
+ values: TValues;
132
+ }
133
+ /** YeeForm 的字段同名作用域插槽。 */
134
+ export type YeeFormSlots<TValues extends object = YeeFormValues> = {
135
+ [TFieldName in keyof TValues & string]?: (props: YeeFormSlotProps<TValues, TFieldName>) => unknown;
136
+ };
137
+ export {};
@@ -1,115 +1,9 @@
1
1
  import { VxeGridProps } from 'vxe-table';
2
- import { YeeGridInternalProps } from './types';
2
+ import { YeeGridInternalProps, YeeGridSlots } from './types';
3
+ type __VLS_Props = YeeGridInternalProps;
3
4
  declare function __VLS_template(): {
4
5
  attrs: Partial<{}>;
5
- slots: Partial<Record<string, (_: {
6
- [key: string]: any;
7
- $table: import('vxe-table').VxeTableConstructor<any>;
8
- $grid: import('vxe-table').VxeGridConstructor<any> | null | undefined;
9
- $gantt: import('vxe-pc-ui').VxeGanttConstructor<any> | null | undefined;
10
- rowid: string;
11
- row: any;
12
- rowIndex: number;
13
- $rowIndex: number;
14
- _rowIndex: number;
15
- column: import("vxe-table").VxeTableDefines.ColumnInfo<any>;
16
- columnIndex: number;
17
- $columnIndex: number;
18
- _columnIndex: number;
19
- option: import("vxe-table").VxeColumnPropTypes.FilterItem;
20
- type: string;
21
- fixed: import("vxe-table").VxeColumnPropTypes.Fixed;
22
- checked: boolean;
23
- indeterminate: boolean;
24
- seq: string | number;
25
- level: number;
26
- isEdit: boolean;
27
- isHidden: boolean;
28
- field: string;
29
- item: any;
30
- data: any;
31
- tooltipContent: string;
32
- groupContent: string;
33
- groupField: string;
34
- childCount: number;
35
- groupValues: number;
36
- aggValue: number;
37
- visibleData: any[];
38
- items: any[];
39
- }) => any>> & {
40
- 'table-title'?(_: {}): any;
41
- 'toolbar-actions'?(_: {
42
- [key: string]: any;
43
- $table: import('vxe-table').VxeTableConstructor<any>;
44
- $grid: import('vxe-table').VxeGridConstructor<any> | null | undefined;
45
- $gantt: import('vxe-pc-ui').VxeGanttConstructor<any> | null | undefined;
46
- rowid: string;
47
- row: any;
48
- rowIndex: number;
49
- $rowIndex: number;
50
- _rowIndex: number;
51
- column: import("vxe-table").VxeTableDefines.ColumnInfo<any>;
52
- columnIndex: number;
53
- $columnIndex: number;
54
- _columnIndex: number;
55
- option: import("vxe-table").VxeColumnPropTypes.FilterItem;
56
- type: string;
57
- fixed: import("vxe-table").VxeColumnPropTypes.Fixed;
58
- checked: boolean;
59
- indeterminate: boolean;
60
- seq: string | number;
61
- level: number;
62
- isEdit: boolean;
63
- isHidden: boolean;
64
- field: string;
65
- item: any;
66
- data: any;
67
- tooltipContent: string;
68
- groupContent: string;
69
- groupField: string;
70
- childCount: number;
71
- groupValues: number;
72
- aggValue: number;
73
- visibleData: any[];
74
- items: any[];
75
- }): any;
76
- 'toolbar-tools'?(_: {
77
- [key: string]: any;
78
- $table: import('vxe-table').VxeTableConstructor<any>;
79
- $grid: import('vxe-table').VxeGridConstructor<any> | null | undefined;
80
- $gantt: import('vxe-pc-ui').VxeGanttConstructor<any> | null | undefined;
81
- rowid: string;
82
- row: any;
83
- rowIndex: number;
84
- $rowIndex: number;
85
- _rowIndex: number;
86
- column: import("vxe-table").VxeTableDefines.ColumnInfo<any>;
87
- columnIndex: number;
88
- $columnIndex: number;
89
- _columnIndex: number;
90
- option: import("vxe-table").VxeColumnPropTypes.FilterItem;
91
- type: string;
92
- fixed: import("vxe-table").VxeColumnPropTypes.Fixed;
93
- checked: boolean;
94
- indeterminate: boolean;
95
- seq: string | number;
96
- level: number;
97
- isEdit: boolean;
98
- isHidden: boolean;
99
- field: string;
100
- item: any;
101
- data: any;
102
- tooltipContent: string;
103
- groupContent: string;
104
- groupField: string;
105
- childCount: number;
106
- groupValues: number;
107
- aggValue: number;
108
- visibleData: any[];
109
- items: any[];
110
- }): any;
111
- empty?(_: {}): any;
112
- };
6
+ slots: Readonly<YeeGridSlots<Record<string, unknown>>> & YeeGridSlots<Record<string, unknown>>;
113
7
  refs: {
114
8
  gridRef: (import('vxe-table').VxeGridMethods<any> & {
115
9
  $props: VxeGridProps<any> & import('vxe-table').VxeGridEventProps<any>;
@@ -119,7 +13,7 @@ declare function __VLS_template(): {
119
13
  rootEl: HTMLElement;
120
14
  };
121
15
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
122
- declare const __VLS_component: import('vue').DefineComponent<YeeGridInternalProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<YeeGridInternalProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
16
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
123
17
  gridRef: (import('vxe-table').VxeGridMethods<any> & {
124
18
  $props: VxeGridProps<any> & import('vxe-table').VxeGridEventProps<any>;
125
19
  $slots: import('vxe-table').VxeGridSlots<any>;
@@ -1,4 +1,4 @@
1
1
  export { YeeGridApi } from './yee-grid-api';
2
2
  export { useYeeGrid } from './use-yee-grid';
3
- export type { YeeGridPage, YeeGridQuery, YeeGridQueryParams, YeeGridToolbarConfig, YeeGridOptions, UseYeeGridOptions, } from './types';
4
- export type { VxeGridDefines, VxeGridListeners, VxeGridPropTypes, VxeTableDefines, } from 'vxe-table';
3
+ export type { YeeGridComponent, YeeGridPage, YeeGridQuery, YeeGridQueryParams, YeeGridToolbarConfig, YeeGridOptions, YeeGridRuntimeProps, YeeGridSlots, UseYeeGridOptions, } from './types';
4
+ export type { VxeGridDefines, VxeGridListeners, VxeGridPropTypes, VxeGridSlotTypes, VxeTableDefines, } from 'vxe-table';
@@ -1,14 +1,20 @@
1
- import { VxeGridInstance, VxeGridListeners, VxeGridProps as NativeVxeGridProps } from 'vxe-table';
1
+ import { VxeGridSlots, VxeGridInstance, VxeGridListeners, VxeGridProps as NativeVxeGridProps, VxeGridSlotTypes } from 'vxe-table';
2
+ import { DefineComponent, VNodeChild } from 'vue';
2
3
  import { YeeFormOptions, YeeFormValues } from '../form';
3
4
  import { YeeGridApi } from './yee-grid-api';
4
5
  type NativeProxyConfig<T> = NonNullable<NativeVxeGridProps<T>['proxyConfig']>;
5
6
  type NativeProxyAjax<T> = NonNullable<NativeProxyConfig<T>['ajax']>;
6
7
  type NativeProxyQuery<T> = NonNullable<NativeProxyAjax<T>['query']>;
8
+ /** VXE Grid 发起代理查询时传入的分页、排序等参数。 */
7
9
  export type YeeGridQueryParams<T> = Parameters<NativeProxyQuery<T>>[0];
10
+ /** YeeGrid 分页查询统一返回结构。 */
8
11
  export interface YeeGridPage<T> {
12
+ /** 当前页数据。 */
9
13
  items: readonly T[];
14
+ /** 符合查询条件的数据总数。 */
10
15
  total: number;
11
16
  }
17
+ /** YeeGrid 代理查询函数。 */
12
18
  export type YeeGridQuery<T, TFormValues extends object = YeeFormValues> = (params: YeeGridQueryParams<T>, formValues: TFormValues) => Promise<YeeGridPage<T>>;
13
19
  type YeeGridProxyAjax<T, TFormValues extends object> = Omit<NativeProxyAjax<T>, 'query'> & {
14
20
  query?: YeeGridQuery<T, TFormValues>;
@@ -17,26 +23,57 @@ type YeeGridProxyConfig<T, TFormValues extends object> = Omit<NativeProxyConfig<
17
23
  ajax?: YeeGridProxyAjax<T, TFormValues>;
18
24
  };
19
25
  type NativeToolbarConfig<T> = NonNullable<NativeVxeGridProps<T>['toolbarConfig']>;
26
+ /** YeeGrid 工具栏配置,继承 VXE Grid ToolbarConfig。 */
20
27
  export type YeeGridToolbarConfig<T> = NativeToolbarConfig<T> & {
28
+ /** 是否在工具栏预留查询表单控制能力。 */
21
29
  search?: boolean;
22
30
  };
31
+ /** YeeGrid 表格配置,完整继承 VXE Grid 并收紧查询返回值。 */
23
32
  export type YeeGridOptions<T = Record<string, unknown>, TFormValues extends object = YeeFormValues> = Omit<NativeVxeGridProps<T>, 'proxyConfig' | 'toolbarConfig'> & {
24
33
  proxyConfig?: YeeGridProxyConfig<T, TFormValues>;
25
34
  toolbarConfig?: YeeGridToolbarConfig<T>;
26
35
  };
36
+ /** useYeeGrid 的初始化配置。 */
27
37
  export interface UseYeeGridOptions<T = Record<string, unknown>, TFormValues extends object = YeeFormValues> {
38
+ /** 可选的查询表单配置。 */
28
39
  formOptions?: YeeFormOptions<TFormValues>;
40
+ /** VXE Grid 原生事件。 */
29
41
  gridEvents?: VxeGridListeners<T>;
42
+ /** VXE Grid 表格配置。 */
30
43
  gridOptions: YeeGridOptions<T, TFormValues>;
44
+ /** 是否在查询表单和表格之间展示分隔带。 */
31
45
  separator?: boolean;
46
+ /** 查询表单初始是否可见。 */
32
47
  showSearchForm?: boolean;
33
48
  }
49
+ /** useYeeGrid 返回组件可直接传入的属性。 */
34
50
  export interface YeeGridRuntimeProps {
51
+ /** 表格标题。 */
35
52
  tableTitle?: string;
53
+ /** 表格标题旁的帮助提示。 */
36
54
  tableTitleHelp?: string;
37
55
  }
38
- export interface YeeGridInternalProps extends YeeGridRuntimeProps {
39
- api: YeeGridApi;
56
+ /** useYeeGrid 返回组件的公开插槽。 */
57
+ export interface YeeGridSlots<T = Record<string, unknown>> extends VxeGridSlots<T> {
58
+ /** 空数据状态;YeeGrid 已提供默认空态。 */
59
+ empty?: () => VNodeChild;
60
+ /** 自定义表格标题。 */
61
+ 'table-title'?: () => VNodeChild;
62
+ /** 工具栏左侧操作区。 */
63
+ 'toolbar-actions'?: (props: VxeGridSlotTypes.DefaultSlotParams<T>) => VNodeChild;
64
+ /** 工具栏右侧工具区。 */
65
+ 'toolbar-tools'?: (props: VxeGridSlotTypes.DefaultSlotParams<T>) => VNodeChild;
40
66
  }
67
+ /** useYeeGrid 返回的、携带行类型和插槽提示的组件类型。 */
68
+ export type YeeGridComponent<T = Record<string, unknown>> = DefineComponent<YeeGridRuntimeProps> & {
69
+ new (): {
70
+ $slots: YeeGridSlots<T>;
71
+ };
72
+ };
73
+ /** YeeGrid 内部挂载属性,不属于业务页面的直接调用入口。 */
74
+ export interface YeeGridInternalProps<T = Record<string, unknown>, TFormValues extends object = YeeFormValues> extends YeeGridRuntimeProps {
75
+ api: YeeGridApi<T, TFormValues>;
76
+ }
77
+ /** YeeGrid 内部持有的 VXE Grid 实例。 */
41
78
  export type YeeGridRef<T> = VxeGridInstance<T>;
42
79
  export {};
@@ -1,5 +1,8 @@
1
- import { DefineComponent } from 'vue';
2
1
  import { YeeFormValues } from '../form';
3
2
  import { YeeGridApi } from './yee-grid-api';
4
- import { YeeGridRuntimeProps, UseYeeGridOptions } from './types';
5
- export declare function useYeeGrid<T = Record<string, unknown>, TFormValues extends object = YeeFormValues>(options: UseYeeGridOptions<T, TFormValues>): readonly [DefineComponent<YeeGridRuntimeProps>, YeeGridApi<T, TFormValues>];
3
+ import { YeeGridComponent as YeeGridPublicComponent, UseYeeGridOptions } from './types';
4
+ /**
5
+ * 创建类型安全的 YeeGrid 组件和控制器。
6
+ * T 为表格行类型,TFormValues 为查询表单字段类型。
7
+ */
8
+ export declare function useYeeGrid<T = Record<string, unknown>, TFormValues extends object = YeeFormValues>(options: UseYeeGridOptions<T, TFormValues>): readonly [YeeGridPublicComponent<T>, YeeGridApi<T, TFormValues>];
@@ -1,18 +1,26 @@
1
1
  import { ShallowRef } from 'vue';
2
2
  import { YeeFormApi, YeeFormValues } from '../form';
3
- import { YeeGridOptions, YeeGridRef, UseYeeGridOptions } from './types';
3
+ import { YeeGridOptions, UseYeeGridOptions } from './types';
4
+ /** useYeeGrid 返回的表格控制器。 */
4
5
  export declare class YeeGridApi<T = Record<string, unknown>, TFormValues extends object = YeeFormValues> {
6
+ /** 查询表单控制器。 */
5
7
  readonly formApi: YeeFormApi<TFormValues>;
8
+ /** 查询表单当前是否可见。 */
6
9
  readonly searchFormVisible: ShallowRef<boolean>;
10
+ /** 当前 Grid 初始化配置。 */
7
11
  readonly state: ShallowRef<UseYeeGridOptions<T, TFormValues>>;
8
12
  private grid;
9
13
  constructor(options: UseYeeGridOptions<T, TFormValues>);
10
- mount(grid: YeeGridRef<T>): void;
14
+ /** 保留当前页码并执行查询,可在查询前合并表单值。 */
11
15
  query: (values?: Partial<TFormValues>) => Promise<unknown>;
16
+ /** 回到第一页并重新查询,可在查询前合并表单值。 */
12
17
  reload: (values?: Partial<TFormValues>) => Promise<unknown>;
18
+ /** 合并更新 VXE Grid 配置。 */
13
19
  setGridOptions(options: Partial<YeeGridOptions<T, TFormValues>>): void;
20
+ /** 设置表格加载状态。 */
14
21
  setLoading(loading: boolean): void;
22
+ /** 合并更新 useYeeGrid 初始化配置。 */
15
23
  setState(state: Partial<UseYeeGridOptions<T, TFormValues>>): void;
24
+ /** 切换查询表单显隐,并返回切换后的状态。 */
16
25
  toggleSearchForm(show?: boolean): boolean;
17
- unmount(): void;
18
26
  }
@@ -1,22 +1,11 @@
1
- import { VNodeChild } from 'vue';
2
- import { YeeModalProps } from './types';
3
- type __VLS_Props = YeeModalProps;
1
+ import { YeeModalOwnProps, YeeModalSlots } from './types';
2
+ type __VLS_Props = YeeModalOwnProps;
4
3
  type __VLS_PublicProps = {
5
4
  'open'?: boolean;
6
5
  } & __VLS_Props;
7
6
  declare function __VLS_template(): {
8
7
  attrs: Partial<{}>;
9
- slots: Readonly<{
10
- closeIcon(): VNodeChild;
11
- default(): VNodeChild;
12
- footer(): VNodeChild;
13
- header(): VNodeChild;
14
- }> & {
15
- closeIcon(): VNodeChild;
16
- default(): VNodeChild;
17
- footer(): VNodeChild;
18
- header(): VNodeChild;
19
- };
8
+ slots: Readonly<YeeModalSlots> & YeeModalSlots;
20
9
  refs: {};
21
10
  rootEl: any;
22
11
  };
@@ -1,2 +1,3 @@
1
- export { default as YeeModal } from './YeeModal.vue';
2
- export type { YeeModalProps, YeeModalType } from './types';
1
+ import { YeeModalComponent as YeeModalPublicComponent } from './types';
2
+ export declare const YeeModal: YeeModalPublicComponent;
3
+ export type { YeeModalComponent, YeeModalEmits, YeeModalProps, YeeModalSlots, YeeModalType, } from './types';
@@ -1,21 +1,83 @@
1
- import { StyleValue } from 'vue';
1
+ import { DrawerProps, ModalProps } from 'ant-design-vue';
2
+ import { ComponentOptionsMixin, DefineComponent, StyleValue, VNodeChild } from 'vue';
3
+ /** YeeModal 支持的容器形态。 */
2
4
  export type YeeModalType = 'drawer' | 'modal';
3
- export interface YeeModalProps {
5
+ /** YeeModal 自身管理的属性。 */
6
+ export interface YeeModalOwnProps {
7
+ /** 取消按钮文案。 */
4
8
  cancelButtonText?: string;
9
+ /** Modal 是否垂直居中;Drawer 模式忽略此项。 */
5
10
  centered?: boolean;
11
+ /** 是否显示关闭按钮。 */
6
12
  closable?: boolean;
13
+ /** 确认按钮加载状态。 */
7
14
  confirmButtonLoading?: boolean;
15
+ /** 确认按钮文案。 */
8
16
  confirmButtonText?: string;
17
+ /** 关闭后是否销毁内容。 */
9
18
  destroyOnClose?: boolean;
19
+ /** Modal 是否全屏;Drawer 模式忽略此项。 */
10
20
  fullscreen?: boolean;
21
+ /** 是否显示全屏切换按钮。 */
11
22
  fullscreenButton?: boolean;
23
+ /** 是否允许按 Esc 关闭。 */
12
24
  keyboard?: boolean;
25
+ /** 点击遮罩是否关闭。 */
13
26
  maskClosable?: boolean;
27
+ /** 打开状态,支持 v-model:open。 */
28
+ open?: boolean;
29
+ /** 是否显示取消按钮。 */
14
30
  showCancelButton?: boolean;
31
+ /** 是否显示确认按钮。 */
15
32
  showConfirmButton?: boolean;
33
+ /** Modal 或 Drawer 根节点样式。 */
16
34
  style?: StyleValue;
35
+ /** 标题。 */
17
36
  title?: string;
37
+ /** 容器类型。 */
18
38
  type?: YeeModalType;
39
+ /** 宽度。 */
19
40
  width?: number | string;
41
+ /** Dialog 根节点的无障碍属性。 */
20
42
  wrapProps?: Record<string, unknown>;
21
43
  }
44
+ type YeeModalManagedProp = 'afterClose' | 'cancelText' | 'centered' | 'closable' | 'closeIcon' | 'confirmLoading' | 'destroyOnClose' | 'footer' | 'keyboard' | 'maskClosable' | 'onCancel' | 'onClose' | 'onOk' | 'onUpdate:open' | 'open' | 'style' | 'title' | 'visible' | 'width' | 'wrapProps';
45
+ /**
46
+ * YeeModal 的完整公开属性。
47
+ * 除组件自身管理的属性外,同时提供 Ant Design Vue Modal/Drawer 的透传属性提示。
48
+ */
49
+ export type YeeModalProps = YeeModalOwnProps & Omit<ModalProps, YeeModalManagedProp> & Partial<Omit<DrawerProps, YeeModalManagedProp | keyof ModalProps>>;
50
+ /** YeeModal 的公开事件。 */
51
+ export type YeeModalEmits = {
52
+ /** 用户执行取消或关闭操作时触发。 */
53
+ cancel: [event: Event];
54
+ /** 弹层关闭动画结束后触发。 */
55
+ close: [];
56
+ /** 用户点击确认按钮时触发,弹层是否关闭由父组件决定。 */
57
+ confirm: [event: Event];
58
+ /** 全屏状态变化时触发。 */
59
+ 'update:fullscreen': [fullscreen: boolean];
60
+ /** 打开状态变化时触发。 */
61
+ 'update:open': [open: boolean];
62
+ };
63
+ type YeeModalEmitOptions = {
64
+ [TEvent in keyof YeeModalEmits]: (...args: YeeModalEmits[TEvent]) => void;
65
+ };
66
+ /** YeeModal 的公开插槽。 */
67
+ export interface YeeModalSlots {
68
+ /** 自定义关闭图标。 */
69
+ closeIcon?: () => VNodeChild;
70
+ /** 弹层主体内容。 */
71
+ default?: () => VNodeChild;
72
+ /** 自定义底部操作区。 */
73
+ footer?: () => VNodeChild;
74
+ /** 自定义标题区域。 */
75
+ header?: () => VNodeChild;
76
+ }
77
+ /** 带完整 Props、Events 和 Slots 提示的 YeeModal 组件类型。 */
78
+ export type YeeModalComponent = DefineComponent<YeeModalProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, YeeModalEmitOptions> & {
79
+ new (): {
80
+ $slots: YeeModalSlots;
81
+ };
82
+ };
83
+ export {};