@me-framework/me-ui-antdv-next 0.0.35 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,56 +1,67 @@
1
1
  # me-ui-antdv-next
2
2
 
3
- #### 介绍
4
-
5
- 基于 Vue 3 + TypeScript + antdv-next 的企业级 UI 组件库。
6
-
7
- - Vue 3 Composition API
8
- - TypeScript 类型支持
9
- - antdv-next 生态
10
- - Lucide 图标库
11
- - Vite 构建
12
-
13
- #### 软件架构
14
-
15
- - `src/` - 组件库源码
16
- - `components/` - 组件目录,每个组件一个子目录
17
- - `styles/` - 全局样式和设计变量
18
- - `utils/` - 工具函数
19
- - `composables/` - 组合式函数
20
- - `types/` - 全局类型定义
21
- - `index.ts` - 组件库入口
22
- - `demo/` - 开发演示站点
23
- - `views/` - 演示页面
24
- - `layout/` - 布局组件
25
- - `router/` - 路由配置
26
- - `composables/` - 演示用组合式函数
27
- - `config/` - 配置文件
28
- - `document/` - Markdown 格式文档
29
- - `scripts/` - 发布脚本
30
-
31
- #### 安装教程
3
+ > 基于 Vue 3 + TypeScript + antdv-next 的企业级 UI 组件库
4
+
5
+ ## 特性
6
+
7
+ - **Vue 3 Composition API** + `<script setup>`
8
+ - **TypeScript** 全量类型支持,附带组件级子路径类型
9
+ - 基于 **antdv-next**(Ant Design Vue 的 Vue 3 分支)二次封装,`a-` 前缀组件由消费项目全局注册
10
+ - **Lucide** 图标库 + 支持阿里 **iconfont** 动态加载
11
+ - **双构建形态**:全量(ES + UMD + 单 style.css)与按需(组件级子路径 + Resolver)
12
+ - Vite 8 构建,支持按需导入自动 Tree-shaking
13
+
14
+ ## 组件列表
15
+
16
+ | 分类 | 组件 | 说明 |
17
+ | --- | --- | --- |
18
+ | 基础 | [MeIcon](document/components/me-icon.md) | 图标(Lucide + iconfont) |
19
+ | 基础 | [MeText](document/components/me-text.md) | 文字 |
20
+ | 导航 | [MeBreadcrumb](document/components/me-breadcrumb.md) | 面包屑 |
21
+ | 导航 | [MeNav](document/components/me-nav.md) | 导航标签(手写斜角 tab) |
22
+ | 导航 | [MeMenu](document/components/me-menu.md) | 导航菜单 |
23
+ | 导航 | [MeTreeMenu](document/components/me-tree-menu.md) | 树形菜单 |
24
+ | 布局 | [MeBox](document/components/me-box.md) | 容器 |
25
+ | 布局 | [MeCard](document/components/me-card.md) | 卡片 |
26
+ | 布局 | [MeBody](document/components/me-body.md) | 内容体 |
27
+ | 布局 | [MeSkeleton](document/components/me-skeleton.md) | 骨架屏 |
28
+ | 布局 | [MeCodeBox](document/components/me-code-box.md) | 代码展示(含行号高亮) |
29
+ | 表单 | [MeInputGps](document/components/me-input-gps.md) | GPS 坐标输入 |
30
+ | 表单 | [MeInputIconSelector](document/components/me-input-icon-selector.md) | 图标选择器 |
31
+ | 表单 | [MeInputRadio](document/components/me-input-radio.md) | 单选卡片 |
32
+ | 表单 | [MeLoadJson](document/components/me-load-json.md) | JSON 导入编辑器 |
33
+ | 表单 | [MeInputProperty](document/components/me-input-property.md) | 属性编辑器(支持数组/弹窗模式) |
34
+ | 表单 | [MeInputNumber](document/components/me-input-number.md) | 数字输入框 |
35
+ | 表单 | [MeInputJson](document/components/me-input-json.md) | JSON 编辑器 |
36
+ | 表单 | [MeLoginPage](document/components/me-login-page.md) | 登录页 |
37
+ | 反馈 | [MeMessage](document/components/me-message.md) | 消息对话框(支持函数式调用) |
38
+ | 反馈 | [MeModal](document/components/me-modal.md) | 对话框 |
39
+
40
+ > 组件完整 API 与示例见 `document/components/` 目录,在线演示见 `demo/`。
41
+
42
+ ## 环境要求
43
+
44
+ - **Vue** ≥ 3.0(peerDependency)
45
+ - **antdv-next**:组件内部使用 `a-` 前缀组件,消费项目需先全局注册
46
+ - **TypeScript** ≥ 4.7(支持 `exports` 子路径通配解析)
47
+
48
+ ## 安装
32
49
 
33
50
  ```bash
34
- # 安装依赖
35
- npm install
51
+ npm install @me-framework/me-ui-antdv-next
52
+ #
53
+ yarn add @me-framework/me-ui-antdv-next
54
+ # 或
55
+ pnpm add @me-framework/me-ui-antdv-next
56
+ ```
36
57
 
37
- # 启动开发服务器
38
- npm run dev
58
+ > 注意:`antdv-next` 为 peer 依赖,需在消费项目中一并安装。
39
59
 
40
- # 构建组件库
41
- npm run build
60
+ ## 快速开始
42
61
 
43
- # 构建演示站点
44
- npm run build:demo
45
-
46
- # 类型检查
47
- npm run type-check
48
- ```
49
-
50
- #### 使用说明
62
+ ### 全局引入
51
63
 
52
64
  ```ts
53
- // 全局引入
54
65
  import { createApp } from 'vue'
55
66
  import Antd from 'antdv-next'
56
67
  import 'antdv-next/dist/reset.css'
@@ -58,27 +69,26 @@ import MeUiAntdv from '@me-framework/me-ui-antdv-next'
58
69
  import '@me-framework/me-ui-antdv-next/dist/style.css'
59
70
 
60
71
  const app = createApp(App)
61
- app.use(Antd)
72
+ app.use(Antd) // 先注册 antdv-next(组件内部依赖 a- 前缀组件)
62
73
  app.use(MeUiAntdv)
63
74
  app.mount('#app')
64
75
  ```
65
76
 
66
77
  ```vue
67
- <!-- 组件使用 -->
68
78
  <template>
69
- <MeButton type="primary">按钮</MeButton>
79
+ <MeIcon name="Home" />
70
80
  </template>
71
81
  ```
72
82
 
73
83
  ### 按需引入(推荐,减小打包体积)
74
84
 
75
- 组件库支持**组件级子路径按需导入**,每个组件可独立引入 JS 与样式,避免全量体积负担。
85
+ 组件库支持**组件级子路径按需导入**,每个组件可独立引入 JS 与样式。
76
86
 
77
87
  ```ts
78
88
  import { createApp } from 'vue'
79
89
  import Antd from 'antdv-next'
80
90
  import 'antdv-next/dist/reset.css'
81
- // 1) 先引入基础 token 基线(设计变量::root / html.dark),按需引任意组件都需引一次
91
+ // 1) 先引入基础 token 基线(:root / html.dark 设计变量),按需引入任意组件都需引一次
82
92
  import '@me-framework/me-ui-antdv-next/base.css'
83
93
  // 2) 按需引入组件
84
94
  import MeMenu from '@me-framework/me-ui-antdv-next/menu'
@@ -90,7 +100,7 @@ app.use(MeMenu)
90
100
  app.mount('#app')
91
101
  ```
92
102
 
93
- #### 使用 unplugin-vue-components 自动按需引入
103
+ ### 使用 unplugin-vue-components 自动按需引入
94
104
 
95
105
  在 Vite 项目中配置:
96
106
 
@@ -111,13 +121,109 @@ export default defineConfig({
111
121
  > - 组件内部依赖的兄弟组件(如 `menu` 依赖 `icon`)会随子入口自动引入,无需手动补引。
112
122
  > - 需要 TypeScript ≥ 4.7 以支持 `exports` 子路径通配解析。
113
123
 
114
- #### 参与贡献
124
+ ### 函数式 API
125
+
126
+ `MeMessage` 支持函数式调用,可传入配置对象直接弹出消息对话框:
127
+
128
+ ```ts
129
+ import { $message } from '@me-framework/me-ui-antdv-next'
130
+
131
+ // 打开(normal / process 双状态,请求期间自动切换 loading)
132
+ const instance = $message({
133
+ data: {
134
+ normal: { title: '提示', message: '确认执行该操作?' },
135
+ process: { title: '处理中', message: '请稍候…', loading: true },
136
+ },
137
+ handler: {
138
+ confirm: (data) => { /* 确认回调 */ },
139
+ cancel: () => { /* 取消回调 */ },
140
+ },
141
+ })
142
+ // 手动关闭
143
+ instance.close()
144
+ // 关闭所有
145
+ $message.closeAll()
146
+ ```
147
+
148
+ `MeIcon` 提供 `loadIconfont()` 动态加载阿里 iconfont Symbol 资源:
149
+
150
+ ```ts
151
+ import { loadIconfont } from '@me-framework/me-ui-antdv-next'
152
+
153
+ loadIconfont('//at.alicdn.com/t/c/font_xxx.js')
154
+ ```
155
+
156
+ ## 构建产物
157
+
158
+ 包同时输出**全量**与**按需**两种形态,均通过 `package.json` 的 `exports` 字段暴露子路径:
159
+
160
+ ```
161
+ dist/
162
+ ├── me-ui-antdv-next.js # 全量 ES
163
+ ├── me-ui-antdv-next.umd.cjs # 全量 UMD(<script> 直引)
164
+ ├── style.css # 全量样式(已含 base token)
165
+ ├── index.d.ts # 全量类型入口
166
+ ├── base/index.css # 按需:基础 token 基线
167
+ ├── menu/ # 按需:每组件一个子路径
168
+ │ ├── index.js
169
+ │ ├── index.css
170
+ │ └── index.d.ts
171
+ ├── resolver/index.js # unplugin Resolver
172
+ └── ...
173
+ ```
174
+
175
+ ## 本地开发
176
+
177
+ ```bash
178
+ # 安装依赖
179
+ npm install
180
+
181
+ # 启动开发演示服务器
182
+ npm run dev
183
+
184
+ # 构建组件库(vue-tsc 类型检查 + 全量构建 + 按需构建 + 重组子路径 dts)
185
+ npm run build
186
+ # 或
187
+ npm run build:lib
188
+
189
+ # 构建演示站点
190
+ npm run build:demo
191
+
192
+ # 类型检查
193
+ npm run type-check
194
+
195
+ # 发布(patch/minor/major,或 beta 预发布)
196
+ npm run release
197
+ npm run release:beta
198
+ npm run quick-patch # 快速 patch 版本发布
199
+ ```
200
+
201
+ ## 项目结构
202
+
203
+ ```
204
+ ├── src/ # 组件库源码
205
+ │ ├── components/ # 组件目录,每个组件一个子目录(含 index.ts/index.vue/style.scss/types.ts)
206
+ │ ├── styles/ # 全局样式与设计变量(base.scss 为按需 token 基线入口)
207
+ │ ├── resolver/ # 按需 Resolver(componentDirMap 维护组件名→目录映射)
208
+ │ ├── utils/ # 工具函数
209
+ │ ├── composables/ # 组合式函数
210
+ │ ├── types/ # 全局类型定义
211
+ │ └── index.ts # 组件库入口
212
+ ├── demo/ # 开发演示站点(views/layout/router/config)
213
+ ├── document/ # Markdown 组件文档
214
+ ├── scripts/ # 构建后处理与发布脚本
215
+ ├── vite.config.ts # 全量构建配置(ES + UMD + style.css)
216
+ ├── vite.ondemand.config.ts # 按需构建配置(多入口 + 子路径 dts)
217
+ └── package.json # 包入口与 exports 声明
218
+ ```
219
+
220
+ ## 参与贡献
115
221
 
116
222
  1. Fork 本仓库
117
- 2. 新建 Feat_xxx 分支
223
+ 2. 新建 `Feat_xxx` 分支
118
224
  3. 提交代码
119
225
  4. 新建 Pull Request
120
226
 
121
- #### License
227
+ ## License
122
228
 
123
- MIT
229
+ [MIT](LICENSE)