afn-basic-components 1.0.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.
package/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # afn-basic-components
2
+
3
+ 一个基于 Vue 2 和 Element UI 的基础组件库,包含常用的公共组件和样式。
4
+
5
+ ## 📦 安装
6
+
7
+ ```bash
8
+ npm install afn-basic-components
9
+ ```
10
+
11
+ ## 🚀 使用
12
+
13
+ ### 完整引入
14
+
15
+ 在 main.js 中引入:
16
+
17
+ ```javascript
18
+ import Vue from 'vue'
19
+ import AfnBasicComponents from 'afn-basic-components'
20
+ import 'afn-basic-components/src/styles/index.scss'
21
+
22
+ Vue.use(AfnBasicComponents)
23
+ ```
24
+
25
+ ### 按需引入
26
+
27
+ ```javascript
28
+ import { GlobalDrawer, MessagePopUp, ProTable } from 'afn-basic-components'
29
+ import 'afn-basic-components/src/styles/index.scss'
30
+
31
+ export default {
32
+ components: {
33
+ GlobalDrawer,
34
+ MessagePopUp,
35
+ ProTable
36
+ }
37
+ }
38
+ ```
39
+
40
+ ## 📚 组件列表
41
+
42
+ ### GlobalDrawer - 全局抽屉
43
+
44
+ 一个功能强大的抽屉组件,支持标题、内容、宽度、方向等配置。
45
+
46
+ **Props:**
47
+ - `visible` (Boolean) - 是否显示抽屉,默认 false
48
+ - `title` (String) - 抽屉标题
49
+ - `width` (String) - 抽屉宽度,默认 '50%'
50
+ - `direction` (String) - 抽屉方向,可选 'rtl' | 'ltr' | 'ttb' | 'btt',默认 'rtl'
51
+ - `beforeClose` (Function) - 关闭前的回调函数
52
+
53
+ **Events:**
54
+ - `close` - 抽屉关闭时触发
55
+ - `open` - 抽屉打开时触发
56
+
57
+ **示例:**
58
+ ```vue
59
+ <global-drawer
60
+ :visible.sync="drawerVisible"
61
+ title="标题"
62
+ width="60%"
63
+ @close="handleClose"
64
+ >
65
+ <div>抽屉内容</div>
66
+ </global-drawer>
67
+ ```
68
+
69
+ ### MessagePopUp - 消息弹窗
70
+
71
+ 一个美观的消息提示组件,支持多种类型和配置。
72
+
73
+ **Props:**
74
+ - `visible` (Boolean) - 是否显示弹窗,默认 false
75
+ - `type` (String) - 消息类型,可选 'success' | 'warning' | 'info' | 'error',默认 'info'
76
+ - `title` (String) - 弹窗标题
77
+ - `message` (String) - 弹窗消息内容
78
+ - `duration` (Number) - 显示时长(毫秒),0 表示不自动关闭,默认 3000
79
+ - `showClose` (Boolean) - 是否显示关闭按钮,默认 true
80
+
81
+ **Events:**
82
+ - `close` - 弹窗关闭时触发
83
+
84
+ **示例:**
85
+ ```vue
86
+ <message-pop-up
87
+ :visible.sync="messageVisible"
88
+ type="success"
89
+ title="成功"
90
+ message="操作成功!"
91
+ @close="handleClose"
92
+ />
93
+ ```
94
+
95
+ ### ProTable - 专业表格
96
+
97
+ 一个功能强大的表格组件,支持搜索、分页、排序等功能。
98
+
99
+ **Props:**
100
+ - `tableData` (Array) - 表格数据
101
+ - `columns` (Array) - 表格列配置
102
+ - `loading` (Boolean) - 是否加载中,默认 false
103
+ - `pagination` (Object) - 分页配置
104
+ - `showSearch` (Boolean) - 是否显示搜索区域,默认 true
105
+ - `showPagination` (Boolean) - 是否显示分页,默认 true
106
+
107
+ **Events:**
108
+ - `search` - 搜索时触发
109
+ - `reset` - 重置时触发
110
+ - `page-change` - 页码变化时触发
111
+ - `size-change` - 每页条数变化时触发
112
+
113
+ **示例:**
114
+ ```vue
115
+ <pro-table
116
+ :table-data="tableData"
117
+ :columns="columns"
118
+ :pagination="pagination"
119
+ :loading="loading"
120
+ @search="handleSearch"
121
+ @reset="handleReset"
122
+ @page-change="handlePageChange"
123
+ @size-change="handleSizeChange"
124
+ />
125
+ ```
126
+
127
+ ## 🎨 样式
128
+
129
+ 组件库包含完整的样式文件,支持:
130
+
131
+ - **variables.scss** - 样式变量定义
132
+ - **btn.scss** - 按钮样式
133
+ - **mixin.scss** - SCSS 混合宏
134
+ - **transition.scss** - 过渡动画
135
+ - **element-ui.scss** - Element UI 样式覆盖
136
+ - **sidebar.scss** - 侧边栏样式
137
+ - **ruoyi.scss** - 通用样式
138
+
139
+ ## 🔧 开发
140
+
141
+ ```bash
142
+ # 安装依赖
143
+ npm install
144
+
145
+ # 本地开发
146
+ npm run serve
147
+
148
+ # 构建
149
+ npm run build
150
+ ```
151
+
152
+ ## 📝 依赖
153
+
154
+ - Vue ^2.6.0
155
+ - Element UI ^2.15.0
156
+
157
+ ## 📄 License
158
+
159
+ MIT
160
+
161
+ ## 🤝 贡献
162
+
163
+ 欢迎提交 Issue 和 Pull Request!
164
+
165
+ ## 💬 联系方式
166
+
167
+ 如有问题,请提交 Issue。
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "afn-basic-components",
3
+ "version": "1.0.0",
4
+ "description": "基础公共组件库 - 包含GlobalDrawer、MessagePopUp、ProTable等组件和样式",
5
+ "main": "src/index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [
10
+ "vue",
11
+ "components",
12
+ "element-ui",
13
+ "global-drawer",
14
+ "message-popup",
15
+ "pro-table"
16
+ ],
17
+ "author": "",
18
+ "license": "MIT",
19
+ "peerDependencies": {
20
+ "vue": "^2.6.0",
21
+ "element-ui": "^2.15.0"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": ""
26
+ },
27
+ "files": [
28
+ "src"
29
+ ]
30
+ }
@@ -0,0 +1,99 @@
1
+ @import './variables.scss';
2
+
3
+ @mixin colorBtn($color) {
4
+ background: $color;
5
+
6
+ &:hover {
7
+ color: $color;
8
+
9
+ &:before,
10
+ &:after {
11
+ background: $color;
12
+ }
13
+ }
14
+ }
15
+
16
+ .blue-btn {
17
+ @include colorBtn($blue)
18
+ }
19
+
20
+ .light-blue-btn {
21
+ @include colorBtn($light-blue)
22
+ }
23
+
24
+ .red-btn {
25
+ @include colorBtn($red)
26
+ }
27
+
28
+ .pink-btn {
29
+ @include colorBtn($pink)
30
+ }
31
+
32
+ .green-btn {
33
+ @include colorBtn($green)
34
+ }
35
+
36
+ .tiffany-btn {
37
+ @include colorBtn($tiffany)
38
+ }
39
+
40
+ .yellow-btn {
41
+ @include colorBtn($yellow)
42
+ }
43
+
44
+ .pan-btn {
45
+ font-size: 14px;
46
+ color: #fff;
47
+ padding: 14px 36px;
48
+ border-radius: 8px;
49
+ border: none;
50
+ outline: none;
51
+ transition: 600ms ease all;
52
+ position: relative;
53
+ display: inline-block;
54
+
55
+ &:hover {
56
+ background: #fff;
57
+
58
+ &:before,
59
+ &:after {
60
+ width: 100%;
61
+ transition: 600ms ease all;
62
+ }
63
+ }
64
+
65
+ &:before,
66
+ &:after {
67
+ content: '';
68
+ position: absolute;
69
+ top: 0;
70
+ right: 0;
71
+ height: 2px;
72
+ width: 0;
73
+ transition: 400ms ease all;
74
+ }
75
+
76
+ &::after {
77
+ right: inherit;
78
+ top: inherit;
79
+ left: 0;
80
+ bottom: 0;
81
+ }
82
+ }
83
+
84
+ .custom-button {
85
+ display: inline-block;
86
+ line-height: 1;
87
+ white-space: nowrap;
88
+ cursor: pointer;
89
+ background: #fff;
90
+ color: #fff;
91
+ -webkit-appearance: none;
92
+ text-align: center;
93
+ box-sizing: border-box;
94
+ outline: 0;
95
+ margin: 0;
96
+ padding: 10px 15px;
97
+ font-size: 14px;
98
+ border-radius: 4px;
99
+ }
@@ -0,0 +1,305 @@
1
+ // cover some element-ui styles
2
+ body {
3
+ color: #333; // 主文本颜色
4
+ font-weight: normal;
5
+ font-family: PingFangSC, PingFang SC;
6
+ }
7
+ .el-breadcrumb__inner,
8
+ .el-breadcrumb__inner a {
9
+ font-weight: 400 !important;
10
+ }
11
+
12
+ .el-upload {
13
+ input[type="file"] {
14
+ display: none !important;
15
+ }
16
+ }
17
+
18
+ .el-upload__input {
19
+ display: none;
20
+ }
21
+
22
+ .cell {
23
+ .el-tag {
24
+ margin-right: 0px;
25
+ }
26
+ }
27
+
28
+ .small-padding {
29
+ .cell {
30
+ padding-left: 5px;
31
+ padding-right: 5px;
32
+ }
33
+ }
34
+
35
+ .fixed-width {
36
+ .el-button--mini {
37
+ padding: 7px 10px;
38
+ width: 60px;
39
+ }
40
+ }
41
+
42
+ .status-col {
43
+ .cell {
44
+ padding: 0 10px;
45
+ text-align: center;
46
+
47
+ .el-tag {
48
+ margin-right: 0px;
49
+ }
50
+ }
51
+ }
52
+
53
+ // to fixed https://github.com/ElemeFE/element/issues/2461
54
+ .el-dialog {
55
+ transform: none;
56
+ left: 0;
57
+ position: relative;
58
+ margin: 0 auto;
59
+ }
60
+
61
+ // refine element ui upload
62
+ .upload-container {
63
+ .el-upload {
64
+ width: 100%;
65
+
66
+ .el-upload-dragger {
67
+ width: 100%;
68
+ height: 200px;
69
+ }
70
+ }
71
+ }
72
+
73
+ // dropdown
74
+ .el-dropdown-menu {
75
+ a {
76
+ display: block;
77
+ }
78
+ }
79
+
80
+ // fix date-picker ui bug in filter-item
81
+ .el-range-editor.el-input__inner {
82
+ display: inline-flex !important;
83
+ }
84
+
85
+ // to fix el-date-picker css style
86
+ .el-range-separator {
87
+ box-sizing: content-box;
88
+ }
89
+ // 新增全局输入框样式
90
+ .el-input {
91
+ &__inner {
92
+ background: #f1f1f1;
93
+ border-radius: 4px;
94
+ font-family: PingFangSC, PingFang SC;
95
+ font-weight: normal;
96
+ height: 34px;
97
+ line-height: 34px !important;
98
+ color: #333;
99
+ border: none;
100
+ }
101
+ .el-input__inner {
102
+ &::placeholder {
103
+ color: #999 !important;
104
+ font-family: PingFangSC, PingFang SC !important;
105
+ font-weight: normal !important;
106
+ line-height: 34px !important;
107
+ }
108
+ }
109
+ }
110
+ .el-textarea__inner {
111
+ background-color: #f1f1f1;
112
+ color: #333;
113
+ border: none;
114
+ &::placeholder {
115
+ color: #999 !important;
116
+ font-family: PingFangSC, PingFang SC !important;
117
+ font-weight: normal !important;
118
+ }
119
+ }
120
+ .el-date-editor {
121
+ /* 核弹级穿透 */
122
+ @at-root {
123
+ .el-range-editor.el-input__inner {
124
+ background: #f1f1f1;
125
+ border: none;
126
+ color: #333;
127
+ line-height: 34px !important;
128
+ .el-range-input {
129
+ background: transparent;
130
+ color: #333;
131
+ line-height: 34px !important;
132
+ padding: 0 10px;
133
+ &::placeholder {
134
+ color: #999 !important;
135
+ font-family: PingFangSC, PingFang SC !important;
136
+ font-weight: normal !important;
137
+ line-height: 34px !important;
138
+ }
139
+ }
140
+
141
+ /* 激活状态保持背景色 */
142
+ /* &.is-active {
143
+ box-shadow: 0 0 0 2px rgba(74, 127, 248, 0.2);
144
+ } */
145
+ }
146
+ }
147
+ }
148
+ //只有在el-form-item下的才生效的样式
149
+ .el-form-item.el-form-item--small {
150
+ // 当包含输入控件时
151
+ &:has(.el-input, .el-date-editor) {
152
+ background: #f1f1f1;
153
+ border-radius: 4px;
154
+ padding: 0px 12px;
155
+ transition: all 0.3s ease;
156
+ color: #333;
157
+ // 移除label边距
158
+ .el-form-item__label {
159
+ padding: 0;
160
+ color: #333; // 主文本颜色
161
+ font-family: PingFangSC, PingFang SC;
162
+ font-weight: 400;
163
+ font-size: 14px;
164
+ }
165
+ .el-input {
166
+ &__inner {
167
+ border: none;
168
+ }
169
+ }
170
+ }
171
+ }
172
+ .vue-treeselect__control {
173
+ background: #f1f1f1 !important;
174
+ border: none !important;
175
+ /* border: none; */
176
+ }
177
+ .tree-border {
178
+ background-color: #f1f1f1 !important;
179
+ }
180
+
181
+ .el-form {
182
+ color: #333;
183
+ .el-form-item__label {
184
+ color: #333;
185
+ font-weight: 500;
186
+ font-family: PingFangSC, PingFang SC;
187
+ }
188
+ }
189
+ .el-table {
190
+ color: #333 !important;
191
+ font-weight: normal;
192
+ font-family: PingFangSC, PingFang SC;
193
+ font-size: 13px;
194
+ border-bottom: 1px solid #f2f2f2;
195
+ &::before {
196
+ height: 0 !important;
197
+ content: none !important;
198
+ }
199
+ // 表格标题行
200
+ .el-table__header-wrapper {
201
+ th {
202
+ background-color: #f2f2f2 !important; // 浅灰色背景
203
+ border-bottom: none !important; // 去掉下划线
204
+ // 保持原有文字样式
205
+ color: #333 !important;
206
+ font-weight: 500;
207
+ font-family: PingFangSC, PingFang SC;
208
+ &:hover {
209
+ background-color: #e9eaec !important; // 悬停浅灰色
210
+ cursor: pointer; // 显示手型指针
211
+ }
212
+ }
213
+ }
214
+ // 表格主体分割线
215
+ .el-table__body {
216
+ tr:hover {
217
+ background-color: #f5f8fe !important;
218
+
219
+ td {
220
+ background-color: transparent !important;
221
+ }
222
+ }
223
+
224
+ td {
225
+ border-bottom: 1px solid #f2f2f2 !important;
226
+ }
227
+ // 最后一列去掉分割线
228
+ .el-table__row:last-child td {
229
+ border-bottom: none !important;
230
+ }
231
+ }
232
+ }
233
+ //取消树形展开的边框
234
+ .tree-border {
235
+ border: none !important;
236
+ }
237
+ /* 取消标签的边框 */
238
+ .el-tag {
239
+ border: none !important;
240
+ }
241
+ .vue-treeselect__menu {
242
+ background-color: #fff !important;
243
+ /* border: none !important; */
244
+ &,
245
+ * {
246
+ background-color: #fff !important;
247
+ }
248
+ color: #333;
249
+ // 新增菜单项文字样式
250
+ .vue-treeselect__label {
251
+ font-weight: 400 !important; // 中等粗细
252
+ font-family: PingFangSC-Medium, PingFang SC; // 确保字体存在
253
+ }
254
+ }
255
+ // 重置按钮的样式
256
+ .custom-btn {
257
+ background-color: #f2f2f2 !important;
258
+ color: #333 !important;
259
+ border: none !important;
260
+ border-radius: 4px;
261
+ transition: all 0.3s ease;
262
+ font-weight: 500 !important;
263
+ font-family: PingFangSC, PingFang SC;
264
+
265
+ &:hover {
266
+ background-color: #f5f5f5 !important;
267
+ color: #4a7ff8 !important;
268
+ }
269
+
270
+ &:active {
271
+ background-color: #eaebed !important;
272
+ }
273
+ &:disabled {
274
+ background: #f2f2f2 !important;
275
+ color: #c6c6c6 !important;
276
+ }
277
+ }
278
+ // 修复选择器层级
279
+ .el-menu--vertical > .el-menu .svg-icon {
280
+ display: none !important;
281
+ margin-right: 16px;
282
+ }
283
+ //下拉框的边框去掉
284
+ .el-select-dropdown {
285
+ border: none;
286
+ //划过背景颜色
287
+ .el-select-dropdown__item.hover,
288
+ .el-select-dropdown__item:hover {
289
+ background-color: #f1f1f1 !important;
290
+ }
291
+ }
292
+
293
+ // 选择按钮样式
294
+ .choice-btn {
295
+ background-color: #fff !important;
296
+ color: #4a7ff8 !important;
297
+ border: 1px solid #4a7ff8 !important;
298
+ border-radius: 4px;
299
+ font-family: PingFangSC, PingFang SC;
300
+ font-weight: 400;
301
+ font-size: 14px;
302
+ }
303
+ .el-button--text {
304
+ font-size: 13px;
305
+ }