@es-plus/vue3 1.4.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 (49) hide show
  1. package/README.md +1279 -0
  2. package/dist/es-plus.js +2922 -0
  3. package/dist/es-plus.js.map +1 -0
  4. package/dist/es-plus.umd.cjs +2 -0
  5. package/dist/es-plus.umd.cjs.map +1 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/resolver.cjs +101 -0
  8. package/dist/resolver.d.ts +25 -0
  9. package/dist/resolver.mjs +78 -0
  10. package/dist/src/components/es-crud-page/index.d.ts +4 -0
  11. package/dist/src/components/es-crud-page/src/es-crud-page.vue.d.ts +78 -0
  12. package/dist/src/components/es-crud-page/src/types.d.ts +180 -0
  13. package/dist/src/components/es-dialog/index.d.ts +3 -0
  14. package/dist/src/components/es-dialog/src/component.vue.d.ts +60 -0
  15. package/dist/src/components/es-dialog/src/use-dialog.d.ts +16 -0
  16. package/dist/src/components/es-form/index.d.ts +3 -0
  17. package/dist/src/components/es-form/src/es-form.vue.d.ts +83 -0
  18. package/dist/src/components/es-table/index.d.ts +3 -0
  19. package/dist/src/components/es-table/src/column-item.vue.d.ts +82 -0
  20. package/dist/src/components/es-table/src/component.vue.d.ts +154 -0
  21. package/dist/src/components/es-table/src/engines/types.d.ts +25 -0
  22. package/dist/src/components/es-table/src/engines/use-column-adapter.d.ts +44 -0
  23. package/dist/src/components/es-table/src/engines/use-virtual-selection.d.ts +13 -0
  24. package/dist/src/components/es-table/src/engines/use-virtual-sort.d.ts +24 -0
  25. package/dist/src/components/es-table/src/engines/virtual-engine.vue.d.ts +63 -0
  26. package/dist/src/components/es-table/src/table-btns.vue.d.ts +19 -0
  27. package/dist/src/components/svg-icon/index.d.ts +3 -0
  28. package/dist/src/components/svg-icon/src/svg-icon.vue.d.ts +17 -0
  29. package/dist/src/composables/use-form-inputs.d.ts +12 -0
  30. package/dist/src/composables/use-form-layout.d.ts +51 -0
  31. package/dist/src/composables/use-form-request.d.ts +18 -0
  32. package/dist/src/composables/use-table-resize.d.ts +19 -0
  33. package/dist/src/composables/use-table-selection.d.ts +16 -0
  34. package/dist/src/config.d.ts +10 -0
  35. package/dist/src/index.d.ts +17 -0
  36. package/dist/src/resolver.d.ts +44 -0
  37. package/dist/src/style.d.ts +0 -0
  38. package/dist/src/types/index.d.ts +174 -0
  39. package/dist/src/utils/shared.d.ts +17 -0
  40. package/dist/style.css +1 -0
  41. package/package.json +90 -0
  42. package/schemas/README.md +83 -0
  43. package/schemas/api-params.schema.json +36 -0
  44. package/schemas/btn-config.schema.json +77 -0
  45. package/schemas/dialog-options.schema.json +149 -0
  46. package/schemas/form-item.schema.json +146 -0
  47. package/schemas/index.schema.json +71 -0
  48. package/schemas/table-column.schema.json +118 -0
  49. package/schemas/table-options.schema.json +141 -0
@@ -0,0 +1,174 @@
1
+ import { VNode, RenderFunction } from 'vue';
2
+ import { FormProps, ButtonProps } from 'element-plus';
3
+
4
+ export interface FormItemOption {
5
+ prop: string;
6
+ label: string;
7
+ labelKey?: string;
8
+ formtype?: 'Input' | 'Select' | 'datePicker' | 'timePicker' | 'Slider' | 'ColorPicker' | 'Transfer' | 'Cascader' | 'Radio' | 'Checkbox' | 'Switch' | 'Rate' | 'Upload';
9
+ span?: number;
10
+ attrs?: Record<string, unknown>;
11
+ on?: Record<string, unknown>;
12
+ dataOptions?: Array<{
13
+ label: string;
14
+ value: unknown;
15
+ }>;
16
+ isHidden?: (model: Record<string, unknown>, item: FormItemOption, formProps: FormProps) => boolean;
17
+ render?: (h: RenderFunction, model: Record<string, unknown>, ctx: {
18
+ row: FormItemOption;
19
+ index: number;
20
+ }) => VNode | string;
21
+ apiParams?: ApiParams;
22
+ /** 是否在组件初始化时自动加载接口数据,默认 true;设为 false 时需手动调用 formItmeRequestInstance 加载 */
23
+ isInitRun?: boolean;
24
+ callOptionListFormat?: (data: unknown[]) => unknown[];
25
+ /** 自定义 HTTP 请求方法,用于覆盖全局请求配置 */
26
+ httpRequest?: (params: Record<string, unknown>) => Promise<unknown>;
27
+ /** 响应数据回调映射,crtn 用于将 API 响应转换为 dataOptions 格式 */
28
+ listenToCallBack?: Record<string, (params: unknown) => unknown>;
29
+ components?: Record<string, unknown>;
30
+ width?: number | string;
31
+ [key: string]: unknown;
32
+ }
33
+ export interface ApiParams {
34
+ url: string;
35
+ method?: string;
36
+ headers?: Record<string, string>;
37
+ model?: Record<string, unknown>;
38
+ options?: Record<string, unknown>;
39
+ }
40
+ export interface BtnConfig {
41
+ name: string;
42
+ key?: string;
43
+ type?: ButtonProps['type'];
44
+ size?: ButtonProps['size'];
45
+ icon?: string;
46
+ direction?: 'left' | 'right';
47
+ loading?: boolean;
48
+ disabled?: boolean | (() => boolean);
49
+ permissionValue?: string;
50
+ click?: (model: Record<string, unknown>, formRef: unknown, httpRequestInstance?: unknown) => void;
51
+ [key: string]: unknown;
52
+ }
53
+ export interface LayoutFormProps {
54
+ rowLayProps?: Record<string, unknown>;
55
+ fromLayProps?: {
56
+ isBtnHidden?: boolean;
57
+ minFoldRows?: number;
58
+ btnColSpan?: number;
59
+ labelBtnWidth?: string | number;
60
+ };
61
+ setOptions?: boolean;
62
+ }
63
+ export interface TableColumn {
64
+ prop?: string;
65
+ key?: string;
66
+ label?: string;
67
+ labelKey?: string;
68
+ width?: number | string;
69
+ minWidth?: number | string;
70
+ align?: string;
71
+ fixed?: boolean | string;
72
+ formatter?: (row: Record<string, unknown>) => string;
73
+ render?: (h: RenderFunction, ctx: {
74
+ row: Record<string, unknown>;
75
+ value: unknown;
76
+ index: number;
77
+ }) => VNode | string;
78
+ scopedSlots?: {
79
+ customRender?: string;
80
+ };
81
+ groups?: TableColumn[];
82
+ ellipsis?: boolean;
83
+ hidCol?: boolean;
84
+ btns?: Array<{
85
+ name: string;
86
+ type?: string;
87
+ clickEvent?: (row: Record<string, unknown>) => void;
88
+ }>;
89
+ [key: string]: unknown;
90
+ }
91
+ export interface TableOptions {
92
+ multiSelect?: boolean;
93
+ expand?: boolean;
94
+ snIndex?: boolean;
95
+ loading?: boolean;
96
+ border?: boolean;
97
+ stripe?: boolean;
98
+ size?: 'large' | 'default' | 'small';
99
+ headerCellStyle?: Record<string, unknown>;
100
+ highlightCurrentRow?: boolean;
101
+ cachePageSelection?: boolean;
102
+ heightType?: 'auto' | 'height' | 'maxHeight';
103
+ tabHeight?: number | string;
104
+ isInitRun?: boolean;
105
+ actionUrl?: string;
106
+ apiParams?: ApiParams;
107
+ httpRequest?: (params: Record<string, unknown>) => Promise<unknown>;
108
+ listenToCallBack?: Record<string, (params: unknown) => unknown>;
109
+ configTableOut?: Record<string, string>;
110
+ entryQuery?: Record<string, unknown>;
111
+ configBtn?: BtnConfig[];
112
+ leftText?: string;
113
+ rowkey?: string;
114
+ height?: number | string;
115
+ /** 启用虚拟滚动(等同 engine: 'virtual') */
116
+ virtual?: boolean;
117
+ /** 表格渲染引擎:default=el-table, virtual=el-table-v2 */
118
+ engine?: 'default' | 'virtual';
119
+ /** 虚拟滚动行高(默认 50) */
120
+ rowHeight?: number;
121
+ /** 动态行高预估值 */
122
+ estimatedRowHeight?: number;
123
+ /** 可视区域外预渲染行数(默认 2) */
124
+ overscanCount?: number;
125
+ /** 行类名(虚拟模式支持函数) */
126
+ rowClassName?: string | ((params: {
127
+ row: Record<string, unknown>;
128
+ rowIndex: number;
129
+ }) => string);
130
+ [key: string]: unknown;
131
+ }
132
+ export interface PaginationConfig {
133
+ pageSize?: number;
134
+ current?: number;
135
+ total?: number;
136
+ pageSizes?: number[];
137
+ size?: 'large' | 'default' | 'small';
138
+ isSmall?: boolean;
139
+ }
140
+ export interface DialogOptions {
141
+ title?: string;
142
+ width?: string | number;
143
+ render?: (h: RenderFunction, instance: unknown, components: Record<string, unknown>) => VNode;
144
+ renderHeader?: (h: RenderFunction, instance: unknown) => VNode;
145
+ renderFooter?: (h: RenderFunction, instance: unknown) => VNode;
146
+ configBtn?: BtnConfig[];
147
+ onSubmit?: (close: () => void) => void;
148
+ onClosed?: () => void;
149
+ isDraggable?: boolean;
150
+ hiddenFullBtn?: boolean;
151
+ isHiddenFooter?: boolean;
152
+ maxHeight?: string | number;
153
+ appendTo?: string | HTMLElement;
154
+ fullscreen?: boolean;
155
+ [key: string]: unknown;
156
+ }
157
+ export interface EsFormInstance {
158
+ validate: () => Promise<boolean>;
159
+ resetFields: () => void;
160
+ clearValidate: () => void;
161
+ }
162
+ export interface EsTableInstance {
163
+ httpRequestInstance: (model?: Record<string, unknown>) => Promise<unknown>;
164
+ clearSelection: () => void;
165
+ toggleRowSelection: (row: Record<string, unknown>, selected?: boolean) => void;
166
+ clearAllSelection: () => void;
167
+ refresh: () => void;
168
+ }
169
+ export interface EsPlusOptions {
170
+ permission?: (value: string) => boolean;
171
+ t?: (key: string) => string;
172
+ globalProperties?: boolean;
173
+ [key: string]: unknown;
174
+ }
@@ -0,0 +1,17 @@
1
+ export declare const isObject: (value: unknown) => value is Record<string, unknown>;
2
+ export declare const isArray: (value: unknown) => value is unknown[];
3
+ export declare const isFunction: (value: unknown) => value is Function;
4
+ export declare const isString: (value: unknown) => value is string;
5
+ export declare const isNumber: (value: unknown) => value is number;
6
+ export declare const isEmpty: (value: unknown) => boolean;
7
+ export declare const firstWordUpperCase: (str: string) => string;
8
+ export declare const kebabToCamel: (str: string) => string;
9
+ export declare const toPascalCase: (str: string) => string;
10
+ export declare const findValueByKey: (obj: Record<string, unknown>, key: string, depth?: number) => unknown;
11
+ export declare const wrapPromise: <T>(promise: Promise<T>) => Promise<{
12
+ status: "fulfilled";
13
+ value: T;
14
+ } | {
15
+ status: "rejected";
16
+ reason: unknown;
17
+ }>;
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.btns[data-v-8f7dddb8]{padding:0 0 5px;display:flex;justify-content:space-between;align-items:center}.left-text[data-v-8f7dddb8]{color:#7d7d7d;font-size:14px}.btn-container_block[data-v-8f7dddb8]{display:flex;justify-content:space-between;align-items:center;flex:1}.btn-container_block .btn-left[data-v-8f7dddb8]{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.btn-container_block .btn-right[data-v-8f7dddb8]{display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap}@media (max-width: 768px){.btns[data-v-8f7dddb8]{flex-direction:column;align-items:flex-start}.btn-container_block[data-v-8f7dddb8]{flex-direction:column;align-items:flex-start;gap:10px}.btn-container_block .btn-left[data-v-8f7dddb8],.btn-container_block .btn-right[data-v-8f7dddb8]{width:100%;justify-content:flex-start}}.es-virtual-table-wrapper{position:relative;width:100%}.es-virtual-table--border .el-table-v2{border:1px solid var(--el-border-color-lighter)}.es-virtual-table--border .el-table-v2 .el-table-v2__header-cell,.es-virtual-table--border .el-table-v2 .el-table-v2__row-cell{border-right:1px solid var(--el-border-color-lighter);border-bottom:1px solid var(--el-border-color-lighter)}.es-virtual-table--stripe .el-table-v2__row:nth-child(2n){background-color:var(--el-fill-color-lighter)}.es-virtual-table--highlight .el-table-v2__row.current-row{background-color:var(--el-color-primary-light-9)!important}.es-virtual-table--highlight .el-table-v2__row:hover{background-color:var(--el-fill-color-light)}.es-virtual-table__empty{position:absolute;top:50px;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;background:#fff;z-index:1}.es-virtual-table__empty .ant-empty-image{height:40px;margin-bottom:8px}.es-virtual-table__empty .ant-empty-img-simple-ellipse{fill:#f5f5f5}.es-virtual-table__empty .ant-empty-img-simple-g{stroke:#d9d9d9}.es-virtual-table__empty .ant-empty-img-simple-path{fill:#fafafa}.es-virtual-table__empty .ant-empty-description{color:#00000040;font-size:14px}.es-virtual-expand-icon{color:var(--el-text-color-secondary)}.es-virtual-expand-icon:hover{color:var(--el-color-primary)}.el-dp_tables[data-v-8904b77a],.el-dp_tables[data-v-8904b77a] .el-table__body-wrapper{height:auto}.table_component[data-v-8904b77a]{width:100%;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;overflow:hidden}.table_containers[data-v-8904b77a]{flex:1;width:100%;height:100%;display:flex;justify-content:space-between;flex-direction:column;align-items:flex-start;position:relative}.pagination_page[data-v-8904b77a]{width:100%;display:flex;justify-content:center;align-items:center}.btn-slot[data-v-8904b77a]{width:100%}.btn-slot .headerBar[data-v-8904b77a]{box-sizing:border-box;background-color:#fff;border-radius:6px}.btn-slot .headerBar[data-v-8904b77a] .el-form-item--small .el-form-item__label{box-sizing:border-box}.tableContainer[data-v-8904b77a]{border-radius:0;transition:all 1.5s;flex:1;width:100%;display:flex;justify-content:space-between;flex-direction:column;align-items:flex-start}.tableContainer .table_inner_containers[data-v-8904b77a]{width:100%}.tableContainer[data-v-8904b77a] .el-table__empty-block{width:100%!important;margin:32px 0;font-size:14px;line-height:1.5715}.tableContainer[data-v-8904b77a] .el-table__empty-block .el-table__empty-text{width:auto!important}.tableContainer[data-v-8904b77a] .el-table__empty-block .ant-empty-image{height:40px;margin-bottom:8px}.tableContainer[data-v-8904b77a] .el-table__empty-block .ant-empty-image .ant-empty-img-simple-ellipse{fill:#f5f5f5}.tableContainer[data-v-8904b77a] .el-table__empty-block .ant-empty-image .ant-empty-img-simple-g{stroke:#d9d9d9}.tableContainer[data-v-8904b77a] .el-table__empty-block .ant-empty-image .ant-empty-img-simple-path{fill:#fafafa}.tableContainer[data-v-8904b77a] .el-table__empty-block .ant-empty-description{line-height:1.5715;color:#00000040}.tableContainer[data-v-8904b77a] .el-tag{height:20px;padding:0 7px;line-height:20px;background:#fafafa;border:none;border-radius:4px}.tableContainer[data-v-8904b77a] .el-tag.el-tag--info{color:#000000d9}.tableContainer[data-v-8904b77a] .el-tag.el-tag--success{color:#52c41a;background:#f6ffed;border-color:#b7eb8f}.es-form[data-v-490779d8] .el-form-item{margin-bottom:18px}.es-form[data-v-490779d8] .el-form-item__label{font-weight:500}.es-form .buttonOperate[data-v-490779d8]{display:flex;align-items:center;flex-wrap:wrap;gap:8px}.es-form .leftRightBtn[data-v-490779d8]{display:flex;justify-content:space-between;align-items:center;width:100%}.es-form .leftRightBtn .btn-left[data-v-490779d8],.es-form .leftRightBtn .btn-right[data-v-490779d8]{display:flex;align-items:center}.es-form .btn-formItem[data-v-490779d8]{margin-bottom:0}.es-form .formItemCols[data-v-490779d8]{width:100%}.dp-dialog_wrapper[data-v-8464358d] .dialogAuto{margin:0!important}.dp-dialog_wrapper[data-v-8464358d] .el-overlay-dialog{display:flex;justify-content:center;align-items:center}.dp-dialog_wrapper[data-v-8464358d] .el-dialog{padding:10px}.dp-dialog_wrapper[data-v-8464358d] .el-dialog .el-dialog__footer{padding-top:0}.dp-dialog_wrapper[data-v-8464358d] .el-dialog .el-dialog__body{padding:10px 0}.dp-dialog_wrapper[data-v-8464358d] .el-dialog .el-dialog__header{border-bottom:1px solid #eee;display:flex;padding:0 0 10px;align-items:center;justify-content:space-between;margin:0}.dialog-title[data-v-8464358d]{line-height:24px;font-size:14px;color:#303133;font-weight:700}.btns[data-v-8464358d]{display:flex;align-items:center}.btns i[data-v-8464358d]{margin-right:8px;font-size:14px;cursor:pointer}.btns i[data-v-8464358d]:last-child{margin-right:0}.dialog_body_layouts[data-v-8464358d]{overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:rgba(135,162,189,.1490196078) rgba(200,213,225,.2784313725)}[data-v-8464358d]::-webkit-scrollbar{width:14px;height:14px}[data-v-8464358d]::-webkit-scrollbar-button{width:0;height:0;display:none}[data-v-8464358d]::-webkit-scrollbar-corner{background-color:transparent}[data-v-8464358d]::-webkit-scrollbar-thumb{min-height:12px;border:4px solid transparent;background-clip:content-box;border-radius:7px;background-color:#c8d5e1}[data-v-8464358d]::-webkit-scrollbar-thumb:hover{background-color:#a8bbcf}[data-v-8464358d]::-webkit-scrollbar-thumb:active{background-color:#87a2bd}[data-v-8464358d]::-webkit-scrollbar-track{background-color:transparent}[data-v-8464358d]::-webkit-scrollbar-track-piece{background-color:transparent}.es-crud-page[data-v-7dea095a]{width:100%}.svg-icon[data-v-50f5fe3f]{width:1em;height:1em;vertical-align:-.15em;fill:currentColor;overflow:hidden}.svg-external-icon[data-v-50f5fe3f]{background-color:currentColor;-webkit-mask-size:cover!important;mask-size:cover!important;display:inline-block}
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "@es-plus/vue3",
3
+ "version": "1.4.0",
4
+ "description": "es-plus for Vue 3 + Element Plus: configuration-driven enterprise components, sharing the same JSON config schema as @es-plus/vue2 (Vue 2 + Element UI). Renamed from es-plus-ui starting v1.4.0.",
5
+ "type": "module",
6
+ "main": "./dist/es-plus.umd.cjs",
7
+ "module": "./dist/es-plus.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/es-plus.js",
12
+ "require": "./dist/es-plus.umd.cjs",
13
+ "types": "./dist/index.d.ts"
14
+ },
15
+ "./resolver": {
16
+ "import": "./dist/resolver.mjs",
17
+ "require": "./dist/resolver.cjs",
18
+ "types": "./dist/resolver.d.ts"
19
+ },
20
+ "./dist/style.css": "./dist/style.css",
21
+ "./schemas/*": "./schemas/*"
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "schemas",
26
+ "README.md"
27
+ ],
28
+ "sideEffects": [
29
+ "**/*.css"
30
+ ],
31
+ "scripts": {
32
+ "typecheck": "vue-tsc --noEmit -p tsconfig.build.json",
33
+ "typecheck:all": "vue-tsc --noEmit",
34
+ "build": "vite build",
35
+ "prepublishOnly": "npm run typecheck && npm run build",
36
+ "test": "vitest",
37
+ "test:ui": "vitest --ui",
38
+ "test:coverage": "vitest --coverage"
39
+ },
40
+ "keywords": [
41
+ "vue3",
42
+ "vue",
43
+ "element-plus",
44
+ "component-library",
45
+ "form",
46
+ "table",
47
+ "dialog",
48
+ "es-plus",
49
+ "typescript",
50
+ "enterprise",
51
+ "config-driven",
52
+ "crud",
53
+ "json-schema",
54
+ "ai-friendly"
55
+ ],
56
+ "author": "liujiaao <303363554@qq.com>",
57
+ "license": "MIT",
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "https://github.com/liujiaao/es-plus.git",
61
+ "directory": "packages/es-plus"
62
+ },
63
+ "homepage": "https://liujiaao.github.io/es-plus/",
64
+ "bugs": {
65
+ "url": "https://github.com/liujiaao/es-plus/issues"
66
+ },
67
+ "publishConfig": {
68
+ "access": "public",
69
+ "registry": "https://registry.npmjs.org/"
70
+ },
71
+ "peerDependencies": {
72
+ "@element-plus/icons-vue": "^2.1.0",
73
+ "element-plus": "^2.2.0",
74
+ "vue": "^3.2.0"
75
+ },
76
+ "devDependencies": {
77
+ "@vitejs/plugin-vue": "^5.0.0",
78
+ "@vitejs/plugin-vue-jsx": "^4.0.0",
79
+ "@vue/test-utils": "^2.4.0",
80
+ "element-plus": "^2.5.0",
81
+ "happy-dom": "^14.0.0",
82
+ "sass": "^1.70.0",
83
+ "typescript": "^5.3.0",
84
+ "vite": "^5.0.0",
85
+ "vite-plugin-dts": "^3.7.0",
86
+ "vitest": "^1.2.0",
87
+ "vue": "^3.4.0",
88
+ "vue-tsc": "^3.3.1"
89
+ }
90
+ }
@@ -0,0 +1,83 @@
1
+ # @es-plus/vue3 JSON Schema
2
+
3
+ JSON Schema definitions for `@es-plus/vue3` configuration objects. Enables IDE autocompletion, validation, and hover documentation when writing `@es-plus/vue3` configs. The same schemas describe `@es-plus/vue2` configs (renderers share identical config shape).
4
+
5
+ ## Usage in VS Code
6
+
7
+ ### Method 1: Per-file `$schema` (for JSON config files)
8
+
9
+ ```json
10
+ {
11
+ "$schema": "node_modules/@es-plus/vue3/schemas/form-item.schema.json",
12
+ "prop": "name",
13
+ "label": "Name",
14
+ "formtype": "Input"
15
+ }
16
+ ```
17
+
18
+ ### Method 2: VS Code settings (for `.json` files matching a pattern)
19
+
20
+ Add to `.vscode/settings.json`:
21
+
22
+ ```json
23
+ {
24
+ "json.schemas": [
25
+ {
26
+ "fileMatch": ["**/form-items.json", "**/formItems.json"],
27
+ "url": "./node_modules/@es-plus/vue3/schemas/form-item.schema.json"
28
+ },
29
+ {
30
+ "fileMatch": ["**/table-columns.json", "**/columns.json"],
31
+ "url": "./node_modules/@es-plus/vue3/schemas/table-column.schema.json"
32
+ },
33
+ {
34
+ "fileMatch": ["**/table-options.json"],
35
+ "url": "./node_modules/@es-plus/vue3/schemas/table-options.schema.json"
36
+ }
37
+ ]
38
+ }
39
+ ```
40
+
41
+ ### Method 3: Use with AI coding assistants
42
+
43
+ When using Cursor, Claude Code, or GitHub Copilot, include the schema in your prompt context:
44
+
45
+ ```
46
+ Use the @es-plus/vue3 JSON Schema at node_modules/@es-plus/vue3/schemas/index.schema.json
47
+ to generate valid configuration for my CRUD page.
48
+ ```
49
+
50
+ ## Available Schemas
51
+
52
+ | Schema | Description |
53
+ |--------|-------------|
54
+ | `form-item.schema.json` | Single form field config (FormItemOption) |
55
+ | `table-column.schema.json` | Single table column config (TableColumn) |
56
+ | `table-options.schema.json` | Table options config (TableOptions) |
57
+ | `btn-config.schema.json` | Button config (BtnConfig) |
58
+ | `dialog-options.schema.json` | Dialog options for useDialog() |
59
+ | `api-params.schema.json` | API request parameters |
60
+ | `index.schema.json` | Root schema with all definitions |
61
+
62
+ ## Schema Structure
63
+
64
+ ```
65
+ index.schema.json
66
+ ├── form-item.schema.json
67
+ │ └── api-params.schema.json
68
+ ├── table-column.schema.json
69
+ ├── table-options.schema.json
70
+ │ ├── api-params.schema.json
71
+ │ └── btn-config.schema.json
72
+ ├── btn-config.schema.json
73
+ └── dialog-options.schema.json
74
+ └── btn-config.schema.json
75
+ ```
76
+
77
+ ## Vue 2 users
78
+
79
+ `@es-plus/vue2` ships the same schema files at `node_modules/@es-plus/vue2/schemas/...`. Substitute the package name in the paths above. Configs validated against either set are runtime-compatible with both renderers.
80
+
81
+ ## Legacy users (`es-plus-ui`)
82
+
83
+ If you still depend on the deprecated `es-plus-ui` stub package, the old paths `node_modules/es-plus-ui/schemas/...` no longer exist (the stub does not re-export schemas). Migrate the import path to `@es-plus/vue3` per the [v1.4 migration guide](https://github.com/liujiaao/es-plus/blob/master/docs/migrate-v1.4.md).
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://es-plus-ui.github.io/schemas/api-params.schema.json",
4
+ "title": "API Parameters Configuration",
5
+ "description": "Configuration for API requests in @es-plus/vue3 components",
6
+ "type": "object",
7
+ "required": ["url"],
8
+ "properties": {
9
+ "url": {
10
+ "type": "string",
11
+ "description": "API endpoint URL"
12
+ },
13
+ "method": {
14
+ "type": "string",
15
+ "enum": ["GET", "POST", "PUT", "DELETE", "PATCH"],
16
+ "default": "GET",
17
+ "description": "HTTP request method"
18
+ },
19
+ "headers": {
20
+ "type": "object",
21
+ "description": "Request headers",
22
+ "additionalProperties": { "type": "string" }
23
+ },
24
+ "model": {
25
+ "type": "object",
26
+ "description": "Additional parameters merged into the request",
27
+ "additionalProperties": true
28
+ },
29
+ "options": {
30
+ "type": "object",
31
+ "description": "Extra request options",
32
+ "additionalProperties": true
33
+ }
34
+ },
35
+ "additionalProperties": true
36
+ }
@@ -0,0 +1,77 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://es-plus-ui.github.io/schemas/btn-config.schema.json",
4
+ "title": "Button Configuration",
5
+ "description": "Configuration for action buttons in @es-plus/vue3 EsForm and EsTable",
6
+ "type": "object",
7
+ "required": ["name"],
8
+ "properties": {
9
+ "name": {
10
+ "type": "string",
11
+ "description": "Button display text"
12
+ },
13
+ "key": {
14
+ "type": "string",
15
+ "description": "Button identifier. Special values: 'query' triggers table data fetch, 'reset' resets the form",
16
+ "examples": ["query", "reset", "add", "export"]
17
+ },
18
+ "type": {
19
+ "type": "string",
20
+ "enum": ["primary", "success", "warning", "danger", "info", ""],
21
+ "description": "Button visual type (Element Plus button types)"
22
+ },
23
+ "size": {
24
+ "type": "string",
25
+ "enum": ["large", "default", "small"],
26
+ "description": "Button size"
27
+ },
28
+ "icon": {
29
+ "type": "string",
30
+ "description": "Element Plus icon name (e.g., 'Search', 'Plus', 'Delete')"
31
+ },
32
+ "direction": {
33
+ "type": "string",
34
+ "enum": ["left", "right"],
35
+ "default": "right",
36
+ "description": "Button alignment in the form button area"
37
+ },
38
+ "loading": {
39
+ "type": "boolean",
40
+ "default": false,
41
+ "description": "Show loading spinner on the button"
42
+ },
43
+ "disabled": {
44
+ "oneOf": [
45
+ { "type": "boolean" }
46
+ ],
47
+ "description": "Disable the button. Can be a boolean or a function () => boolean"
48
+ },
49
+ "triggerEvent": {
50
+ "type": "boolean",
51
+ "default": false,
52
+ "description": "When true, automatically triggers form-table linkage. With key='query', calls parent EsTable's httpRequestInstance. With key='reset', resets form fields"
53
+ },
54
+ "click": {
55
+ "description": "Click handler. In form context: (model, formRef, httpRequestInstance?) => void. In dialog context: (instance, { close, getRefs, dialogVm }) => void"
56
+ },
57
+ "code": {
58
+ "type": "integer",
59
+ "enum": [1, 2],
60
+ "description": "Button group position in table toolbar. 1 = left group, 2 = right group"
61
+ },
62
+ "isHide": {
63
+ "oneOf": [
64
+ { "type": "boolean" }
65
+ ],
66
+ "description": "Hide the button. Can be a boolean or a function () => boolean"
67
+ },
68
+ "permissionValue": {
69
+ "type": "string",
70
+ "description": "Permission code for button visibility control"
71
+ },
72
+ "render": {
73
+ "description": "Custom render function for the button slot"
74
+ }
75
+ },
76
+ "additionalProperties": true
77
+ }
@@ -0,0 +1,149 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://es-plus-ui.github.io/schemas/dialog-options.schema.json",
4
+ "title": "useDialog Options Configuration",
5
+ "description": "Configuration object passed to the useDialog() hook in @es-plus/vue3",
6
+ "type": "object",
7
+ "properties": {
8
+ "title": {
9
+ "type": "string",
10
+ "description": "Dialog title"
11
+ },
12
+ "width": {
13
+ "oneOf": [
14
+ { "type": "string" },
15
+ { "type": "number" }
16
+ ],
17
+ "default": "50%",
18
+ "description": "Dialog width (CSS value or number in px)"
19
+ },
20
+ "height": {
21
+ "oneOf": [
22
+ { "type": "string" },
23
+ { "type": "number" }
24
+ ],
25
+ "description": "Dialog height"
26
+ },
27
+ "maxHeight": {
28
+ "oneOf": [
29
+ { "type": "string" },
30
+ { "type": "number" }
31
+ ],
32
+ "description": "Maximum height for dialog body content area"
33
+ },
34
+ "key": {
35
+ "type": "string",
36
+ "description": "Unique identifier. Same key reuses dialog instance"
37
+ },
38
+ "render": {
39
+ "description": "Content render function. Signature: (h, { registerRef, getRefs }, components) => VNode"
40
+ },
41
+ "renderHeader": {
42
+ "description": "Header render function. Signature: (h, instance) => VNode"
43
+ },
44
+ "renderFooter": {
45
+ "description": "Footer render function. Signature: (h, instance) => VNode"
46
+ },
47
+ "configBtn": {
48
+ "type": "array",
49
+ "description": "Footer action buttons. Click signature: (currentRef, { close, getRefs, dialogInstance }) => void",
50
+ "items": { "$ref": "btn-config.schema.json" }
51
+ },
52
+ "isDraggable": {
53
+ "type": "boolean",
54
+ "default": false,
55
+ "description": "Enable drag to move the dialog"
56
+ },
57
+ "fullscreen": {
58
+ "type": "boolean",
59
+ "default": false,
60
+ "description": "Start dialog in fullscreen mode"
61
+ },
62
+ "hiddenFullBtn": {
63
+ "type": "boolean",
64
+ "default": false,
65
+ "description": "Hide the fullscreen toggle button in header"
66
+ },
67
+ "isHiddenFooter": {
68
+ "type": "boolean",
69
+ "default": false,
70
+ "description": "Hide the entire footer section"
71
+ },
72
+ "center": {
73
+ "type": "boolean",
74
+ "description": "Vertically center the dialog"
75
+ },
76
+ "closeOnClickModal": {
77
+ "type": "boolean",
78
+ "default": false,
79
+ "description": "Close dialog when clicking the overlay mask"
80
+ },
81
+ "closeOnPressEscape": {
82
+ "type": "boolean",
83
+ "default": false,
84
+ "description": "Close dialog when pressing ESC key"
85
+ },
86
+ "showClose": {
87
+ "type": "boolean",
88
+ "default": true,
89
+ "description": "Show the close button in header"
90
+ },
91
+ "destroyOnClose": {
92
+ "type": "boolean",
93
+ "default": true,
94
+ "description": "Destroy dialog content when closed"
95
+ },
96
+ "loading": {
97
+ "type": "boolean",
98
+ "default": false,
99
+ "description": "Show loading state on the dialog"
100
+ },
101
+ "customClass": {
102
+ "type": "string",
103
+ "description": "Custom CSS class for the dialog"
104
+ },
105
+ "appendToBody": {
106
+ "type": "boolean",
107
+ "description": "Mount dialog to document body"
108
+ },
109
+ "appendTo": {
110
+ "type": "string",
111
+ "description": "CSS selector or HTMLElement for dialog mount target"
112
+ },
113
+ "modal": {
114
+ "type": "boolean",
115
+ "description": "Show overlay mask behind dialog"
116
+ },
117
+ "lockScroll": {
118
+ "type": "boolean",
119
+ "description": "Lock page scroll when dialog is open"
120
+ },
121
+ "onlyInstance": {
122
+ "type": "boolean",
123
+ "default": false,
124
+ "description": "Singleton mode: reuses one dialog instance, updates content on subsequent calls"
125
+ },
126
+ "showDefaultButtons": {
127
+ "type": "boolean",
128
+ "description": "Show default Confirm/Cancel buttons"
129
+ },
130
+ "confirmText": {
131
+ "type": "string",
132
+ "description": "Custom text for the confirm button"
133
+ },
134
+ "cancelText": {
135
+ "type": "string",
136
+ "description": "Custom text for the cancel button"
137
+ },
138
+ "onSubmit": {
139
+ "description": "Submit callback. Signature: (close) => void"
140
+ },
141
+ "onClosed": {
142
+ "description": "Callback fired after dialog is fully closed"
143
+ },
144
+ "onOpen": {
145
+ "description": "Callback fired when dialog opens"
146
+ }
147
+ },
148
+ "additionalProperties": true
149
+ }