joy-admin-components 0.1.23 → 0.1.25

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/package.json CHANGED
@@ -1,7 +1,18 @@
1
1
  {
2
2
  "name": "joy-admin-components",
3
- "version": "0.1.23",
4
- "main": "./src/index.js",
3
+ "version": "0.1.25",
4
+ "main": "./dist/joy-admin-components.umd.js",
5
+ "module": "./dist/joy-admin-components.es.js",
6
+ "types": "./src/index.d.ts",
7
+ "exports": {
8
+ "./components/*": {
9
+ "types": "./src/components/*/index.d.ts",
10
+ "import": "./src/components/*/index.vue"
11
+ }
12
+ },
13
+ "files": [
14
+ "src/components"
15
+ ],
5
16
  "scripts": {
6
17
  "dev": "vite",
7
18
  "build": "vite build",
@@ -15,7 +26,8 @@
15
26
  "vue": "^3.3.4",
16
27
  "element-plus": "^2.3.8",
17
28
  "@vitejs/plugin-vue": "^4.2.3",
18
- "vite": "^4.4.6"
29
+ "vite": "^4.4.6",
30
+ "vue-i18n": "^9.10.1"
19
31
  },
20
32
  "devDependencies": {}
21
33
  }
@@ -0,0 +1,43 @@
1
+ import { DefineComponent } from 'vue';
2
+ import { SelectProps } from 'element-plus';
3
+
4
+ /**
5
+ * 字典选择器组件 - 基于 Element Plus Select 封装
6
+ * 支持 API 请求数据、全选、多语言等功能
7
+ */
8
+ export interface CmpDictionaryProps extends /* @vue-ignore */ Partial<SelectProps> {
9
+ /** 获取下拉数据的 API 函数 */
10
+ api?: () => Promise<{ data: any[] }>;
11
+ /** 是否显示全选复选框(仅多选模式),默认 true */
12
+ showCheckAll?: boolean;
13
+ /** 选项点击回调函数 */
14
+ optionClick?: (item: any) => void;
15
+ /** 多选模式下的最大选择数量 */
16
+ maxLimit?: number;
17
+ /** 多选模式下的最小选择数量 */
18
+ minLimit?: number;
19
+ /** 静态数据源(如果提供则不使用 api) */
20
+ data?: any[];
21
+ /** 字段映射配置 */
22
+ labelValue?: {
23
+ label?: string;
24
+ labelEn?: string;
25
+ value?: string;
26
+ };
27
+ /** 是否使用本地 i18n 翻译 label,默认 false */
28
+ changeLocal?: boolean;
29
+ /** v-model 绑定值 */
30
+ modelValue?: any;
31
+ }
32
+
33
+ export interface CmpDictionaryEmits {
34
+ /** API 请求成功后触发 */
35
+ (e: 'success', data: any[]): void;
36
+ /** 选择值变化时触发 */
37
+ (e: 'change', value: any): void;
38
+ /** v-model 更新事件 */
39
+ (e: 'update:modelValue', value: any): void;
40
+ }
41
+
42
+ declare const CmpDictionary: DefineComponent<CmpDictionaryProps, {}, any, {}, {}, {}, {}, CmpDictionaryEmits>;
43
+ export default CmpDictionary;
@@ -0,0 +1,19 @@
1
+ import { DefineComponent } from 'vue';
2
+ import { PopconfirmProps } from 'element-plus';
3
+
4
+ /**
5
+ * 确认按钮组件 - 基于 Element Plus Popconfirm 封装
6
+ * 点击后弹出确认气泡,确认后执行操作(自动防抖 500ms)
7
+ * 继承 Element Plus ElPopconfirm 所有属性
8
+ */
9
+ export interface ConfrimButtonProps extends /* @vue-ignore */ Partial<PopconfirmProps> {}
10
+
11
+ export interface ConfrimButtonEmits {
12
+ /** 确认操作时触发(已防抖处理) */
13
+ (e: 'ok'): void;
14
+ /** 取消操作时触发 */
15
+ (e: 'no'): void;
16
+ }
17
+
18
+ declare const ConfrimButton: DefineComponent<ConfrimButtonProps, {}, any, {}, {}, {}, {}, ConfrimButtonEmits>;
19
+ export default ConfrimButton;
@@ -0,0 +1,20 @@
1
+ import { DefineComponent } from 'vue';
2
+
3
+ /**
4
+ * 导入按钮组件 - 文件上传按钮
5
+ * 点击按钮选择文件,支持自定义文件类型
6
+ */
7
+ export interface ImportButtonProps {
8
+ /** 接受的文件类型,默认 '.xlsx,.xls' */
9
+ accept?: string;
10
+ /** 按钮加载状态 */
11
+ loading?: boolean;
12
+ }
13
+
14
+ export interface ImportButtonEmits {
15
+ /** 文件选择后触发 */
16
+ (e: 'fileChange', file: File): void;
17
+ }
18
+
19
+ declare const ImportButton: DefineComponent<ImportButtonProps, {}, any, {}, {}, {}, {}, ImportButtonEmits>;
20
+ export default ImportButton;
@@ -0,0 +1,20 @@
1
+ import { DefineComponent } from 'vue';
2
+ import { FormProps } from 'element-plus';
3
+
4
+ /**
5
+ * LayOutForm 组件 - 带栅格布局的表单容器
6
+ * 继承 Element Plus ElForm 所有属性
7
+ * 自动为表单项添加栅格布局,支持多列表单
8
+ */
9
+ export interface LayOutFormProps extends /* @vue-ignore */ FormProps {
10
+ /** 栅格间隔,默认 20 */
11
+ gutter?: number;
12
+ }
13
+
14
+ export interface LayOutFormEmits {
15
+ /** 组件挂载完成后触发,返回表单 ref */
16
+ (e: 'ref', formRef: any): void;
17
+ }
18
+
19
+ declare const LayOutForm: DefineComponent<LayOutFormProps, {}, any, {}, {}, {}, {}, LayOutFormEmits>;
20
+ export default LayOutForm;
@@ -0,0 +1,92 @@
1
+ import { DefineComponent } from 'vue';
2
+
3
+ /** 搜索表单项 */
4
+ export interface SearchFormItem {
5
+ /** 字段 key */
6
+ key: string;
7
+ /** 字段名称 */
8
+ name: string;
9
+ /** 字段值 */
10
+ value: any;
11
+ /** 表单项类型 */
12
+ type?: 'input' | 'select' | 'date' | 'custom' | 'br';
13
+ /** 日期类型 */
14
+ dateType?: 'date' | 'daterange' | 'datetimerange';
15
+ /** 是否隐藏 */
16
+ hidden?: boolean;
17
+ /** 自定义渲染函数(type 为 custom 时使用) */
18
+ render?: () => any;
19
+ /** 额外配置 */
20
+ option?: {
21
+ class?: string;
22
+ [key: string]: any;
23
+ };
24
+ }
25
+
26
+ /** 搜索表单配置 */
27
+ export interface SearchFormConfig {
28
+ /** 表单项列表 */
29
+ items: SearchFormItem[];
30
+ /** 选中的行数据(多选) */
31
+ selections?: any[];
32
+ /** 是否显示搜索栏 */
33
+ showSearch?: boolean;
34
+ /** 是否显示分页 */
35
+ showPage?: boolean;
36
+ /** 是否显示阴影 */
37
+ showShadow?: boolean;
38
+ /** 是否显示复选框 */
39
+ showCheckBox?: boolean;
40
+ }
41
+
42
+ /** 表格配置 */
43
+ export interface TableConfig {
44
+ /** 数据格式化函数 */
45
+ dataFormat?: (data: any[]) => any[];
46
+ /** 重置回调函数 */
47
+ reset?: () => void | Promise<void>;
48
+ /** 自定义配置 */
49
+ customConfig?: Record<string, any>;
50
+ /** 列配置 */
51
+ columnConfig?: Record<string, any>;
52
+ /** 表格高度 */
53
+ height?: number | string;
54
+ [key: string]: any;
55
+ }
56
+
57
+ /**
58
+ * ListPage 组件 - 列表页面容器
59
+ * 集成搜索栏、表格、分页等功能
60
+ * 基于 VxeTable 实现
61
+ */
62
+ export interface ListPageProps {
63
+ /** 表格唯一标识,用于本地存储列设置 */
64
+ id: string;
65
+ /** 加载状态 */
66
+ loading?: boolean;
67
+ /** 是否立即请求数据,默认 true */
68
+ immediate?: boolean;
69
+ /** 搜索表单配置 */
70
+ searchForm?: SearchFormConfig;
71
+ /** 获取列表数据的 API 函数 */
72
+ api?: (params: any) => Promise<{ code: number; data: { rows: any[]; totalRows: number } }>;
73
+ /** 静态数据源(如果提供则不使用 api) */
74
+ data?: any[];
75
+ /** 表格配置 */
76
+ tableConfig?: TableConfig;
77
+ }
78
+
79
+ /** ListPage 暴露的方法 */
80
+ export interface ListPageExpose {
81
+ /** VxeTable 实例 */
82
+ tableRef: any;
83
+ /** 刷新列表数据 */
84
+ getList: (params?: any) => void;
85
+ /** 获取当前搜索参数 */
86
+ getPrm: () => any;
87
+ /** 重新计算表格高度 */
88
+ calculateTableHeight: () => void;
89
+ }
90
+
91
+ declare const ListPage: DefineComponent<ListPageProps, {}, any>;
92
+ export default ListPage;
@@ -0,0 +1,51 @@
1
+ import { DefineComponent } from 'vue';
2
+
3
+ /** 搜索表单项 */
4
+ export interface SearchBarFormItem {
5
+ /** 字段 key */
6
+ key: string;
7
+ /** 字段名称 */
8
+ name: string;
9
+ /** 字段值 */
10
+ value: any;
11
+ /** 表单项类型 */
12
+ type?: 'input' | 'select' | 'date' | 'custom' | 'br';
13
+ /** 日期类型 */
14
+ dateType?: 'date' | 'daterange' | 'datetimerange';
15
+ /** 是否隐藏 */
16
+ hidden?: boolean;
17
+ /** 自定义渲染函数(type 为 custom 时使用) */
18
+ render?: () => any;
19
+ /** 额外配置 */
20
+ option?: {
21
+ class?: string;
22
+ [key: string]: any;
23
+ };
24
+ }
25
+
26
+ /** 搜索表单配置 */
27
+ export interface SearchBarForm {
28
+ /** 表单项列表 */
29
+ items: SearchBarFormItem[];
30
+ /** 表单数据对象 */
31
+ data?: Record<string, any>;
32
+ }
33
+
34
+ /**
35
+ * SearchBar 组件 - 搜索栏
36
+ * 支持多种表单项类型,可折叠展开
37
+ */
38
+ export interface SearchBarProps {
39
+ /** 搜索表单配置 */
40
+ form: SearchBarForm;
41
+ }
42
+
43
+ export interface SearchBarEmits {
44
+ /** 筛选按钮点击时触发 */
45
+ (e: 'confirm'): void;
46
+ /** 重置按钮点击时触发 */
47
+ (e: 'reset'): void;
48
+ }
49
+
50
+ declare const SearchBar: DefineComponent<SearchBarProps, {}, any, {}, {}, {}, {}, SearchBarEmits>;
51
+ export default SearchBar;
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- v18.18.0
package/index.html DELETED
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" href="/favicon.ico" />
6
- <link rel="stylesheet" href="//at.alicdn.com/t/font_2570680_gkyjimtz1d.css" />
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
- <!-- <script src="https://cdn.staticfile.net/translate.js/3.1.2/translate.js"></script> -->
9
- <title></title>
10
- </head>
11
- <body>
12
- <div id="app"></div>
13
- <script type="module" src="/src/main.js"></script>
14
- <!-- <script>
15
- translate.language.setLocal('chinese_simplified'); //设置本地语种(当前网页的语种)。如果不设置,默认自动识别当前网页显示文字的语种。 可填写如 'english'、'chinese_simplified' 等,具体参见文档下方关于此的说明。
16
- translate.service.use('client.edge'); //设置机器翻译服务通道,直接客户端本身,不依赖服务端 。相关说明参考 http://translate.zvo.cn/43086.html
17
- translate.execute(); //进行翻译
18
- document.body.addEventListener('click', () => {
19
- translate.execute(); //进行翻译
20
- });
21
- </script> -->
22
- </body>
23
- </html>
package/src/App.vue DELETED
@@ -1,12 +0,0 @@
1
- <template>
2
- <div id="app">
3
- <JoyForm>
4
- <el-form-item label="用户名" prop="username" :span="4">
5
- <el-input placeholder="请输入用户名"></el-input>
6
- </el-form-item>
7
- </JoyForm>
8
- </div>
9
- </template>
10
- <script>
11
-
12
- </script>
package/src/index.js DELETED
@@ -1,3 +0,0 @@
1
- import LayOutForm from './components/LayOutForm/index.vue';
2
-
3
- export { LayOutForm };
package/src/main.js DELETED
@@ -1,16 +0,0 @@
1
- /*
2
- * @Date: 2022-05-22 20:44:25
3
- * @Description:
4
- */
5
- import { createApp } from 'vue';
6
- import App from './App.vue';
7
- import JoyAdminComponents from './index.js';
8
- import ElementPlus from "element-plus";
9
- import "element-plus/theme-chalk/display.css"; // 引入基于断点的隐藏类
10
- import "element-plus/dist/index.css";
11
-
12
- const app = createApp(App);
13
- app.use(JoyAdminComponents);
14
- app.use(ElementPlus);
15
-
16
- app.mount("#app");
package/vite.config.js DELETED
@@ -1,38 +0,0 @@
1
- import { defineConfig } from 'vite'
2
- import vue from '@vitejs/plugin-vue'
3
-
4
- // https://vitejs.dev/config/
5
- export default defineConfig({
6
- plugins: [vue()],
7
- define: {
8
- // enable hydration mismatch details in production build
9
- __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "true",
10
- },
11
- base: "./",
12
- build: {
13
- lib: {
14
- entry: "./src/index.js",
15
- name: "JoyAdminComponents",
16
- fileName: (format) => `joy-admin-components.${format}.js`,
17
- },
18
- rollupOptions: {
19
- external: ["vue", "element-plus"],
20
- output: {
21
- globals: {
22
- vue: "Vue",
23
- "element-plus": "ElementPlus",
24
- },
25
- },
26
- },
27
- },
28
- server: {
29
- watch: {
30
- usePolling: true, // 修复HMR热更新失效
31
- overlay: true,
32
- },
33
- port: 3008,
34
- host: "0.0.0.0",
35
- hmr: true,
36
- open: true,
37
- },
38
- });