@agent-xy/admin-vue3 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -2
  3. package/dist/index.js +1404 -0
  4. package/dist/style.css +1 -0
  5. package/dist/types/components/BaseCard/index.vue.d.ts +26 -0
  6. package/dist/types/components/DataTable/TableCell.vue.d.ts +14 -0
  7. package/dist/types/components/DataTable/index.vue.d.ts +53 -0
  8. package/dist/types/components/DataTable/types.d.ts +81 -0
  9. package/dist/types/components/Dialog/BaseDialog.vue.d.ts +141 -0
  10. package/dist/types/components/Dialog/index.d.ts +43 -0
  11. package/dist/types/components/Drawer/BaseDrawer.vue.d.ts +130 -0
  12. package/dist/types/components/Drawer/index.d.ts +1 -0
  13. package/dist/types/components/SearchForm/components/FormItem.vue.d.ts +35 -0
  14. package/dist/types/components/SearchForm/index.vue.d.ts +44 -0
  15. package/dist/types/components/SearchForm/types.d.ts +97 -0
  16. package/dist/types/components/SearchForm/values.d.ts +4 -0
  17. package/dist/types/hooks/useAsyncListAction.d.ts +7 -0
  18. package/dist/types/hooks/usePageList.d.ts +30 -0
  19. package/dist/types/hooks/useSelectOptions.d.ts +16 -0
  20. package/dist/types/index.d.ts +16 -0
  21. package/dist/types/types/admin.d.ts +3 -0
  22. package/dist/types/utils/adminCore.d.ts +74 -0
  23. package/dist/types/utils/data.d.ts +2 -0
  24. package/dist/types/utils/formRender.d.ts +2 -0
  25. package/dist/types/utils/tableRender.d.ts +7 -0
  26. package/docs/DataTable.md +23 -0
  27. package/docs/SearchForm.md +21 -0
  28. package/docs/usage.md +33 -0
  29. package/package.json +57 -4
  30. package/templates/manifest.json +82 -0
  31. package/templates/users/README.md +21 -0
  32. package/templates/users/api.ts +4 -0
  33. package/templates/users/components/AddExpireTime.vue +153 -0
  34. package/templates/users/components/MemberHistory.vue +33 -0
  35. package/templates/users/components/RenewalDiscount.vue +167 -0
  36. package/templates/users/config/columns.ts +45 -0
  37. package/templates/users/config/data.ts +22 -0
  38. package/templates/users/config/index.ts +3 -0
  39. package/templates/users/config/searchForm.ts +69 -0
  40. package/templates/users/constants.ts +22 -0
  41. package/templates/users/hooks/useRemoteResource.ts +34 -0
  42. package/templates/users/index.scss +41 -0
  43. package/templates/users/index.vue +273 -0
  44. package/templates/users/mock/index.ts +27 -0
  45. package/templates/users/mock/request.ts +32 -0
  46. package/templates/users/mock/store.ts +161 -0
  47. package/templates/users/types.ts +55 -0
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .base-card[data-v-08a819b4]{background:#fff;border-radius:8px;margin-bottom:20px;overflow:hidden;padding:0 16px}.base-card__header[data-v-08a819b4]{padding:16px 0 10px;font-weight:700;color:#333;font-size:18px}.ai-code-search-form__fields{display:flex;flex-wrap:wrap;gap:12px 16px;align-items:flex-start}.ai-code-search-form .el-form-item{margin:0}.ai-code-search-form__control{max-width:100%}.ai-code-search-form__control .el-select,.ai-code-search-form__control .el-input-number,.ai-code-search-form__control .el-date-editor{width:100%;box-sizing:border-box}.ai-code-search-form__range,.ai-code-search-form__actions{display:flex;align-items:center;gap:8px}.table-cell__clamp[data-v-bba66ae0]{display:-webkit-box;width:100%;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;white-space:normal}.table-cell__link[data-v-bba66ae0]{padding:0;border:0;background:transparent;color:var(--el-color-primary);font:inherit;text-align:inherit;cursor:pointer}.ai-code-table[data-v-e3d6073e]{width:100%}.ai-code-table[data-v-e3d6073e] .el-table{--el-table-header-bg-color: var(--el-fill-color-light)}.ai-code-table__toolbar[data-v-e3d6073e]{display:flex;align-items:center;flex-wrap:wrap;gap:16px;margin-bottom:16px;color:var(--el-text-color-regular)}.ai-code-table__toolbar strong[data-v-e3d6073e]{color:var(--el-color-primary)}.ai-code-table__pagination[data-v-e3d6073e]{display:flex;justify-content:flex-end;margin-top:16px;overflow-x:auto}.ai-code-table__settings-title[data-v-e3d6073e]{margin:0 0 12px;color:var(--el-text-color-secondary)}.ai-code-table__column-list[data-v-e3d6073e]{display:flex;flex-direction:column;max-height:300px;overflow-y:auto}.dialog-footer[data-v-2f0ec0cc],.drawer-footer[data-v-b86ce758]{display:flex;justify-content:flex-end;gap:12px}
@@ -0,0 +1,26 @@
1
+ declare var __VLS_1: {}, __VLS_3: {};
2
+ type __VLS_Slots = {} & {
3
+ title?: (props: typeof __VLS_1) => any;
4
+ } & {
5
+ default?: (props: typeof __VLS_3) => any;
6
+ };
7
+ declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ title: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
+ title: {
14
+ type: StringConstructor;
15
+ default: string;
16
+ };
17
+ }>> & Readonly<{}>, {
18
+ title: string;
19
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
20
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,14 @@
1
+ import type { TableCellScope } from "./types";
2
+ declare const _default: <Row extends object>(__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
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & TableCellScope<Row> & Partial<{}>> & import("vue").PublicProps;
4
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
5
+ attrs: any;
6
+ slots: {};
7
+ emit: {};
8
+ }>) => import("vue").VNode & {
9
+ __ctx?: Awaited<typeof __VLS_setup>;
10
+ };
11
+ export default _default;
12
+ type __VLS_PrettifyLocal<T> = {
13
+ [K in keyof T]: T[K];
14
+ } & {};
@@ -0,0 +1,53 @@
1
+ import type { SortChange, TableColumn, DataTableProps } from "./types";
2
+ declare const _default: <Row extends object>(__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
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onHandleSizeChange?: ((value: {
5
+ pageSize: number;
6
+ }) => any) | undefined;
7
+ readonly onHandleCurrentChange?: ((value: {
8
+ pageNum: number;
9
+ }) => any) | undefined;
10
+ readonly onHandleSelectionChange?: ((rows: Row[]) => any) | undefined;
11
+ readonly onHandleSortChange?: ((value: SortChange) => any) | undefined;
12
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onHandleSizeChange" | "onHandleCurrentChange" | "onHandleSelectionChange" | "onHandleSortChange"> & DataTableProps<Row> & Partial<{}>> & import("vue").PublicProps;
13
+ expose(exposed: import("vue").ShallowUnwrapRef<{
14
+ clearSort: () => void | undefined;
15
+ sort: (prop: string, order: string) => void | undefined;
16
+ doLayout: () => void | undefined;
17
+ clearSelection: () => void | undefined;
18
+ getSelectionRows: () => any[];
19
+ toggleRowSelection: (row: any, selected?: boolean | undefined, ignoreSelectable?: boolean | undefined) => void | undefined;
20
+ }>): void;
21
+ attrs: any;
22
+ slots: {
23
+ [x: string]: ((props: {
24
+ column: TableColumn<Row>;
25
+ index: any;
26
+ row: any;
27
+ }) => any) | undefined;
28
+ } & {
29
+ toolbar?: (props: {}) => any;
30
+ } & {
31
+ 'multiple-operation'?: (props: {
32
+ selectionData: Row[];
33
+ }) => any;
34
+ } & {
35
+ empty?: (props: {}) => any;
36
+ };
37
+ emit: {
38
+ (event: "handleSizeChange", value: {
39
+ pageSize: number;
40
+ }): void;
41
+ (event: "handleCurrentChange", value: {
42
+ pageNum: number;
43
+ }): void;
44
+ (event: "handleSelectionChange", rows: Row[]): void;
45
+ (event: "handleSortChange", value: SortChange): void;
46
+ };
47
+ }>) => import("vue").VNode & {
48
+ __ctx?: Awaited<typeof __VLS_setup>;
49
+ };
50
+ export default _default;
51
+ type __VLS_PrettifyLocal<T> = {
52
+ [K in keyof T]: T[K];
53
+ } & {};
@@ -0,0 +1,81 @@
1
+ import type { h, VNodeChild } from "vue";
2
+ export type SortOrder = "ascending" | "descending" | null;
3
+ /** prop 同时作为字段名、列标识和字段插槽名。 */
4
+ export interface TableColumn<TRow extends object = Record<string, unknown>> {
5
+ prop: string;
6
+ label: string;
7
+ /** 连续且名称、固定方向相同的列合并为一层分组表头。 */
8
+ group?: string;
9
+ showColumn?: boolean;
10
+ width?: string | number;
11
+ minWidth?: string | number;
12
+ align?: "left" | "center" | "right";
13
+ fixed?: boolean | "left" | "right";
14
+ className?: string;
15
+ tooltip?: boolean;
16
+ lineClamp?: number;
17
+ /** false 时此列不可隐藏,与设置入口的位置无关。 */
18
+ hideable?: boolean;
19
+ sortable?: boolean | "custom";
20
+ sortOrders?: SortOrder[];
21
+ type?: "default" | "enum" | "nested" | "clip";
22
+ path?: string;
23
+ enumList?: {
24
+ label: string;
25
+ value: string | number | boolean;
26
+ }[];
27
+ formatter?: (row: TRow, column: TableColumn<TRow>) => string | number | null | undefined;
28
+ render?: (createElement: typeof h, scope: TableCellScope<TRow>) => VNodeChild;
29
+ click?: (row: TRow) => void;
30
+ }
31
+ export interface TableCellScope<TRow extends object = Record<string, unknown>> {
32
+ row: TRow;
33
+ column: TableColumn<TRow>;
34
+ index: number;
35
+ }
36
+ /** 展示分页状态,不改写查询对象。 */
37
+ export interface TablePageParams {
38
+ page?: number;
39
+ page_size?: number;
40
+ page_sizes?: number[];
41
+ currentPage?: number;
42
+ pageSize?: number;
43
+ pageSizes?: number[];
44
+ total?: number;
45
+ }
46
+ export interface SortChange {
47
+ prop: string;
48
+ order: SortOrder;
49
+ }
50
+ export interface TableExpose<TRow extends object = Record<string, unknown>> {
51
+ clearSort: () => void;
52
+ sort: (prop: string, order: Exclude<SortOrder, null>) => void;
53
+ doLayout: () => void;
54
+ clearSelection: () => void;
55
+ getSelectionRows: () => TRow[];
56
+ toggleRowSelection: (row: TRow, selected?: boolean, ignoreSelectable?: boolean) => void;
57
+ }
58
+ export interface DataTableProps<Row extends object> {
59
+ tableData: Row[];
60
+ tableColumns: TableColumn<Row>[];
61
+ pageParams?: TablePageParams | null;
62
+ loading?: boolean;
63
+ border?: boolean;
64
+ stripe?: boolean;
65
+ showHeader?: boolean;
66
+ showSerialNumber?: boolean;
67
+ serialNumberFixed?: boolean;
68
+ selection?: boolean;
69
+ selectionFixed?: boolean;
70
+ reserveSelection?: boolean;
71
+ showColumnSettings?: boolean;
72
+ rowKey: string | ((row: Row) => string | number);
73
+ selectFn?: (row: Row, index: number) => boolean;
74
+ resizable?: boolean;
75
+ tableHeight?: string | number;
76
+ maxHeight?: string | number;
77
+ rowheight?: string;
78
+ minHeight?: string;
79
+ noDataShow?: string;
80
+ paginationLayout?: string;
81
+ }
@@ -0,0 +1,141 @@
1
+ import { type PropType } from 'vue';
2
+ declare function close(): void;
3
+ declare function handleConfirm(): Promise<void>;
4
+ declare var __VLS_11: {}, __VLS_13: {};
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_11) => any;
7
+ } & {
8
+ footer?: (props: typeof __VLS_13) => any;
9
+ };
10
+ declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
11
+ modelValue: BooleanConstructor;
12
+ closeOnConfirm: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ confirmDisabled: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ title: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ width: {
25
+ type: (StringConstructor | NumberConstructor)[];
26
+ default: string;
27
+ };
28
+ closeOnClickModal: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ showClose: {
33
+ type: BooleanConstructor;
34
+ default: boolean;
35
+ };
36
+ destroyOnClose: {
37
+ type: BooleanConstructor;
38
+ default: boolean;
39
+ };
40
+ cancelText: {
41
+ type: StringConstructor;
42
+ default: string;
43
+ };
44
+ confirmText: {
45
+ type: StringConstructor;
46
+ default: string;
47
+ };
48
+ showCancel: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
52
+ showConfirm: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ onConfirm: PropType<() => void | Promise<void>>;
57
+ onCancel: PropType<() => void>;
58
+ onClose: PropType<() => void>;
59
+ }>, {
60
+ close: typeof close;
61
+ confirm: typeof handleConfirm;
62
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
63
+ error: (...args: any[]) => void;
64
+ "update:modelValue": (...args: any[]) => void;
65
+ closed: (...args: any[]) => void;
66
+ opened: (...args: any[]) => void;
67
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
68
+ modelValue: BooleanConstructor;
69
+ closeOnConfirm: {
70
+ type: BooleanConstructor;
71
+ default: boolean;
72
+ };
73
+ confirmDisabled: {
74
+ type: BooleanConstructor;
75
+ default: boolean;
76
+ };
77
+ title: {
78
+ type: StringConstructor;
79
+ default: string;
80
+ };
81
+ width: {
82
+ type: (StringConstructor | NumberConstructor)[];
83
+ default: string;
84
+ };
85
+ closeOnClickModal: {
86
+ type: BooleanConstructor;
87
+ default: boolean;
88
+ };
89
+ showClose: {
90
+ type: BooleanConstructor;
91
+ default: boolean;
92
+ };
93
+ destroyOnClose: {
94
+ type: BooleanConstructor;
95
+ default: boolean;
96
+ };
97
+ cancelText: {
98
+ type: StringConstructor;
99
+ default: string;
100
+ };
101
+ confirmText: {
102
+ type: StringConstructor;
103
+ default: string;
104
+ };
105
+ showCancel: {
106
+ type: BooleanConstructor;
107
+ default: boolean;
108
+ };
109
+ showConfirm: {
110
+ type: BooleanConstructor;
111
+ default: boolean;
112
+ };
113
+ onConfirm: PropType<() => void | Promise<void>>;
114
+ onCancel: PropType<() => void>;
115
+ onClose: PropType<() => void>;
116
+ }>> & Readonly<{
117
+ onError?: ((...args: any[]) => any) | undefined;
118
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
119
+ onClosed?: ((...args: any[]) => any) | undefined;
120
+ onOpened?: ((...args: any[]) => any) | undefined;
121
+ }>, {
122
+ title: string;
123
+ width: string | number;
124
+ modelValue: boolean;
125
+ showConfirm: boolean;
126
+ closeOnConfirm: boolean;
127
+ confirmDisabled: boolean;
128
+ closeOnClickModal: boolean;
129
+ showClose: boolean;
130
+ destroyOnClose: boolean;
131
+ cancelText: string;
132
+ confirmText: string;
133
+ showCancel: boolean;
134
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
135
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
136
+ export default _default;
137
+ type __VLS_WithSlots<T, S> = T & {
138
+ new (): {
139
+ $slots: S;
140
+ };
141
+ };
@@ -0,0 +1,43 @@
1
+ import { type App, type AppContext, type Component, type VNode } from 'vue';
2
+ import BaseDialog from './BaseDialog.vue';
3
+ export { BaseDialog };
4
+ export interface DialogOptions {
5
+ closeOnConfirm?: boolean;
6
+ confirmDisabled?: boolean;
7
+ content?: string | Component | VNode;
8
+ title?: string;
9
+ width?: string | number;
10
+ confirmText?: string;
11
+ cancelText?: string;
12
+ showCancel?: boolean;
13
+ showConfirm?: boolean;
14
+ showClose?: boolean;
15
+ closeOnClickModal?: boolean;
16
+ onConfirm?: () => void | Promise<void>;
17
+ onCancel?: () => void;
18
+ onClose?: () => void;
19
+ onError?: (error: unknown) => void;
20
+ }
21
+ export interface DialogInstance {
22
+ close: () => void;
23
+ update: (options: Partial<DialogOptions>) => void;
24
+ }
25
+ export declare function createDialogService(context: AppContext): {
26
+ showDialog: (options: DialogOptions | string) => DialogInstance;
27
+ Dialog: {
28
+ alert: (content: string, title?: string) => DialogInstance;
29
+ confirm: (content: string, title?: string) => Promise<boolean>;
30
+ component: (component: Component, props?: Record<string, unknown>) => DialogInstance;
31
+ };
32
+ dispose: () => void;
33
+ };
34
+ export declare const showDialog: (options: DialogOptions | string) => DialogInstance;
35
+ export declare const Dialog: {
36
+ alert: (content: string, title?: string) => DialogInstance;
37
+ confirm: (content: string, title?: string) => Promise<boolean>;
38
+ component: (component: Component, props?: Record<string, unknown>) => DialogInstance;
39
+ };
40
+ declare const _default: {
41
+ install(app: App): void;
42
+ };
43
+ export default _default;
@@ -0,0 +1,130 @@
1
+ import { type PropType } from 'vue';
2
+ declare function close(): void;
3
+ declare var __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
4
+ type __VLS_Slots = {} & {
5
+ header?: (props: typeof __VLS_10) => any;
6
+ } & {
7
+ default?: (props: typeof __VLS_12) => any;
8
+ } & {
9
+ footer?: (props: typeof __VLS_14) => any;
10
+ };
11
+ declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
12
+ modelValue: BooleanConstructor;
13
+ title: {
14
+ type: StringConstructor;
15
+ default: string;
16
+ };
17
+ size: {
18
+ type: (StringConstructor | NumberConstructor)[];
19
+ default: string;
20
+ };
21
+ direction: {
22
+ type: PropType<"rtl" | "ltr" | "ttb" | "btt">;
23
+ default: string;
24
+ };
25
+ closeOnClickModal: {
26
+ type: BooleanConstructor;
27
+ default: boolean;
28
+ };
29
+ showClose: {
30
+ type: BooleanConstructor;
31
+ default: boolean;
32
+ };
33
+ destroyOnClose: {
34
+ type: BooleanConstructor;
35
+ default: boolean;
36
+ };
37
+ cancelText: {
38
+ type: StringConstructor;
39
+ default: string;
40
+ };
41
+ confirmText: {
42
+ type: StringConstructor;
43
+ default: string;
44
+ };
45
+ showCancel: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
49
+ showConfirm: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
53
+ onConfirm: PropType<() => void | Promise<void>>;
54
+ onCancel: PropType<() => void>;
55
+ onClose: PropType<() => void>;
56
+ }>, {
57
+ close: typeof close;
58
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
59
+ error: (...args: any[]) => void;
60
+ "update:modelValue": (...args: any[]) => void;
61
+ closed: (...args: any[]) => void;
62
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
63
+ modelValue: BooleanConstructor;
64
+ title: {
65
+ type: StringConstructor;
66
+ default: string;
67
+ };
68
+ size: {
69
+ type: (StringConstructor | NumberConstructor)[];
70
+ default: string;
71
+ };
72
+ direction: {
73
+ type: PropType<"rtl" | "ltr" | "ttb" | "btt">;
74
+ default: string;
75
+ };
76
+ closeOnClickModal: {
77
+ type: BooleanConstructor;
78
+ default: boolean;
79
+ };
80
+ showClose: {
81
+ type: BooleanConstructor;
82
+ default: boolean;
83
+ };
84
+ destroyOnClose: {
85
+ type: BooleanConstructor;
86
+ default: boolean;
87
+ };
88
+ cancelText: {
89
+ type: StringConstructor;
90
+ default: string;
91
+ };
92
+ confirmText: {
93
+ type: StringConstructor;
94
+ default: string;
95
+ };
96
+ showCancel: {
97
+ type: BooleanConstructor;
98
+ default: boolean;
99
+ };
100
+ showConfirm: {
101
+ type: BooleanConstructor;
102
+ default: boolean;
103
+ };
104
+ onConfirm: PropType<() => void | Promise<void>>;
105
+ onCancel: PropType<() => void>;
106
+ onClose: PropType<() => void>;
107
+ }>> & Readonly<{
108
+ onError?: ((...args: any[]) => any) | undefined;
109
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
110
+ onClosed?: ((...args: any[]) => any) | undefined;
111
+ }>, {
112
+ title: string;
113
+ size: string | number;
114
+ modelValue: boolean;
115
+ showConfirm: boolean;
116
+ direction: "ltr" | "rtl" | "ttb" | "btt";
117
+ closeOnClickModal: boolean;
118
+ showClose: boolean;
119
+ destroyOnClose: boolean;
120
+ cancelText: string;
121
+ confirmText: string;
122
+ showCancel: boolean;
123
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
124
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
125
+ export default _default;
126
+ type __VLS_WithSlots<T, S> = T & {
127
+ new (): {
128
+ $slots: S;
129
+ };
130
+ };
@@ -0,0 +1 @@
1
+ export { default as BaseDrawer } from './BaseDrawer.vue';
@@ -0,0 +1,35 @@
1
+ import type { ValidateError } from 'async-validator';
2
+ import type { RuntimeFormItem, FormModel } from '../types';
3
+ type __VLS_Props = {
4
+ item: RuntimeFormItem;
5
+ formObj: FormModel;
6
+ disabled?: boolean;
7
+ };
8
+ declare function updateField(name: string, value: unknown): void;
9
+ declare function clearValidate(): void;
10
+ declare function validate(trigger?: string): Promise<ValidateError[]>;
11
+ declare var __VLS_6: {
12
+ form: FormModel;
13
+ item: RuntimeFormItem;
14
+ value: unknown;
15
+ updateValue: (value: unknown) => void;
16
+ change: typeof updateField;
17
+ };
18
+ type __VLS_Slots = {} & {
19
+ default?: (props: typeof __VLS_6) => any;
20
+ };
21
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
22
+ validate: typeof validate;
23
+ clearValidate: typeof clearValidate;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ change: (field: string, value: unknown) => any;
26
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
27
+ onChange?: ((field: string, value: unknown) => any) | undefined;
28
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
30
+ export default _default;
31
+ type __VLS_WithSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
@@ -0,0 +1,44 @@
1
+ import type { FormModel, RuntimeFormItem, SearchFormProps } from './types';
2
+ declare const _default: <Values extends object>(__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
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onSubmitForm?: ((values: Partial<Values>) => any) | undefined;
5
+ readonly onResetForm?: ((values: Partial<Values>) => any) | undefined;
6
+ readonly onFormChange?: ((values: Partial<Values>) => any) | undefined;
7
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onSubmitForm" | "onResetForm" | "onFormChange"> & SearchFormProps<Values> & Partial<{}>> & import("vue").PublicProps;
8
+ expose(exposed: import("vue").ShallowUnwrapRef<{
9
+ submitForm: () => Promise<boolean>;
10
+ resetForm: () => void;
11
+ getFormData: () => Partial<Values>;
12
+ validate: (callback?: import("element-plus").FormValidateCallback) => import("element-plus").FormValidationResult;
13
+ validateField: (props?: import("element-plus").FormItemProp | import("element-plus").FormItemProp[], callback?: import("element-plus").FormValidateCallback) => import("element-plus").FormValidationResult;
14
+ clearValidate: (props?: import("element-plus").FormItemProp | import("element-plus").FormItemProp[]) => void;
15
+ }>): void;
16
+ attrs: any;
17
+ slots: {
18
+ [x: string]: ((props: {
19
+ form: FormModel;
20
+ item: RuntimeFormItem;
21
+ value: unknown;
22
+ updateValue: (value: unknown) => void;
23
+ change: (name: string, value: unknown) => void;
24
+ }) => any) | undefined;
25
+ } & {
26
+ actions?: (props: {
27
+ submit: () => Promise<boolean>;
28
+ reset: () => void;
29
+ form: Partial<Values>;
30
+ busy: boolean;
31
+ }) => any;
32
+ } & {
33
+ 'actions-extra'?: (props: {
34
+ form: Partial<Values>;
35
+ }) => any;
36
+ };
37
+ emit: ((evt: "submitForm", values: Partial<Values>) => void) & ((evt: "resetForm", values: Partial<Values>) => void) & ((evt: "formChange", values: Partial<Values>) => void);
38
+ }>) => import("vue").VNode & {
39
+ __ctx?: Awaited<typeof __VLS_setup>;
40
+ };
41
+ export default _default;
42
+ type __VLS_PrettifyLocal<T> = {
43
+ [K in keyof T]: T[K];
44
+ } & {};
@@ -0,0 +1,97 @@
1
+ import type { FormInstance, FormItemRule, FormProps } from 'element-plus';
2
+ export type FormModel = Record<string, unknown>;
3
+ export type OptionValue = string | number | boolean;
4
+ export interface SearchOption<Value = OptionValue> {
5
+ label: string;
6
+ value: Value;
7
+ disabled?: boolean;
8
+ }
9
+ export interface RuntimeFormItem {
10
+ itemType: 'text' | 'number' | 'selectOne' | 'date' | 'dateRange' | 'datetimerange' | 'inputBoxInterval' | 'custom';
11
+ propName?: string;
12
+ propName1?: string;
13
+ propName2?: string;
14
+ labelName?: string;
15
+ width?: string | number;
16
+ labelWidth?: string | number;
17
+ placeholder?: string;
18
+ disabled?: boolean;
19
+ clearable?: boolean;
20
+ isRequired?: boolean;
21
+ rules?: FormItemRule | FormItemRule[];
22
+ optionsArr?: SearchOption[];
23
+ multiple?: boolean;
24
+ loading?: boolean;
25
+ filterable?: boolean;
26
+ remote?: boolean;
27
+ remoteMethod?: (query: string, selected: unknown) => void;
28
+ format?: string;
29
+ valueFormat?: string;
30
+ min?: number;
31
+ max?: number;
32
+ precision?: number;
33
+ step?: number;
34
+ slotName?: string;
35
+ controlProps?: Record<string, unknown>;
36
+ }
37
+ type Name<V> = Extract<keyof V, string>;
38
+ type Common = Omit<RuntimeFormItem, 'itemType' | 'propName' | 'propName1' | 'propName2' | 'optionsArr' | 'multiple' | 'valueFormat'>;
39
+ type Supports<V, T, Result> = unknown extends V ? Result : NonNullable<V> extends T ? Result : never;
40
+ type Field<V> = Supports<V, string, {
41
+ itemType: 'text';
42
+ }> | Supports<V, number, {
43
+ itemType: 'number';
44
+ }> | Supports<V, OptionValue, {
45
+ itemType: 'selectOne';
46
+ multiple?: false;
47
+ optionsArr?: SearchOption<Extract<NonNullable<V>, OptionValue>>[];
48
+ }> | Supports<V, OptionValue[], {
49
+ itemType: 'selectOne';
50
+ multiple: true;
51
+ optionsArr?: SearchOption<V extends (infer Item)[] ? Item : OptionValue>[];
52
+ }> | Supports<V, string, {
53
+ itemType: 'date';
54
+ valueFormat?: string;
55
+ }> | Supports<V, Date, {
56
+ itemType: 'date';
57
+ valueFormat: '';
58
+ }> | Supports<V, string[], {
59
+ itemType: 'dateRange' | 'datetimerange';
60
+ valueFormat?: string;
61
+ }> | Supports<V, Date[], {
62
+ itemType: 'dateRange' | 'datetimerange';
63
+ valueFormat: '';
64
+ }> | {
65
+ itemType: 'custom';
66
+ };
67
+ type NumberName<V> = {
68
+ [K in Name<V>]: unknown extends V[K] ? K : NonNullable<V[K]> extends number ? K : never;
69
+ }[Name<V>];
70
+ export type FormItemConfig<Values extends object = Record<string, unknown>> = {
71
+ [K in Name<Values>]: Common & {
72
+ propName: K;
73
+ } & Field<Values[K]>;
74
+ }[Name<Values>] | (Common & {
75
+ itemType: 'inputBoxInterval';
76
+ propName1: NumberName<Values>;
77
+ propName2: NumberName<Values>;
78
+ });
79
+ export interface SearchFormProps<Values extends object> {
80
+ formHeader: FormItemConfig<Values>[];
81
+ formModel?: Partial<Values>;
82
+ disabled?: boolean;
83
+ loading?: boolean;
84
+ showButton?: boolean;
85
+ isShowReset?: boolean;
86
+ labelPosition?: FormProps['labelPosition'];
87
+ labelWidth?: string | number;
88
+ }
89
+ export interface SearchFormExpose<Values extends object> {
90
+ submitForm: () => Promise<boolean>;
91
+ resetForm: () => void;
92
+ getFormData: () => Partial<Values>;
93
+ validate: FormInstance['validate'];
94
+ validateField: FormInstance['validateField'];
95
+ clearValidate: FormInstance['clearValidate'];
96
+ }
97
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { RuntimeFormItem } from './types';
2
+ export declare function clone<Value>(value: Value): Value;
3
+ export declare function same(left: unknown, right: unknown): boolean;
4
+ export declare function fieldNames(field: RuntimeFormItem): string[];