ai-front-base 0.2.2 → 0.2.6
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/dist/components/AiDatePicker/index.vue.mjs +62 -9
- package/dist/components/AiDatePicker/types.ts +9 -12
- package/dist/components/AiDateRangePicker/index.mjs +7 -0
- package/dist/components/AiDateRangePicker/index.vue.mjs +33 -0
- package/dist/components/AiDateRangePicker/types.ts +33 -0
- package/dist/components/AiForm/README.md +35 -0
- package/dist/components/AiForm/index.mjs +4 -1
- package/dist/components/AiForm/index.vue.mjs +145 -36
- package/dist/components/AiForm/types.ts +402 -22
- package/dist/components/AiInput/index.vue.mjs +46 -11
- package/dist/components/AiInput/types.ts +7 -6
- package/dist/components/AiSelect/index.vue.mjs +98 -17
- package/dist/components/AiSelect/types.ts +10 -17
- package/dist/components/AiTable/index.mjs +5 -2
- package/dist/components/AiTable/index.vue.mjs +213 -22
- package/dist/components/AiTable/types.ts +196 -16
- package/dist/components/AiTag/types.ts +6 -7
- package/dist/components/README.md +15 -31
- package/dist/components/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/dist/components/install.mjs +15 -0
- package/dist/index.mjs +14 -50
- package/dist/layouts/README.md +17 -14
- package/dist/layouts/default.md +238 -0
- package/dist/styles/README.md +18 -139
- package/dist/styles/index.scss +5 -0
- package/dist/styles/light.scss +102 -0
- package/package.json +2 -1
- package/dist/components/AiAside/index.mjs +0 -4
- package/dist/components/AiAside/index.vue.mjs +0 -20
- package/dist/components/AiAside/types.ts +0 -6
- package/dist/components/AiBadge/index.mjs +0 -4
- package/dist/components/AiBadge/index.vue.mjs +0 -20
- package/dist/components/AiBadge/types.ts +0 -10
- package/dist/components/AiBreadcrumb/index.mjs +0 -4
- package/dist/components/AiBreadcrumb/index.vue.mjs +0 -20
- package/dist/components/AiBreadcrumb/types.ts +0 -7
- package/dist/components/AiCheckbox/index.mjs +0 -4
- package/dist/components/AiCheckbox/index.vue.mjs +0 -20
- package/dist/components/AiCheckbox/types.ts +0 -14
- package/dist/components/AiContainer/index.mjs +0 -4
- package/dist/components/AiContainer/index.vue.mjs +0 -20
- package/dist/components/AiContainer/types.ts +0 -6
- package/dist/components/AiDialog/index.mjs +0 -4
- package/dist/components/AiDialog/index.vue.mjs +0 -20
- package/dist/components/AiDialog/types.ts +0 -11
- package/dist/components/AiFooter/index.mjs +0 -4
- package/dist/components/AiFooter/index.vue.mjs +0 -20
- package/dist/components/AiFooter/types.ts +0 -6
- package/dist/components/AiHeader/index.mjs +0 -4
- package/dist/components/AiHeader/index.vue.mjs +0 -20
- package/dist/components/AiHeader/types.ts +0 -6
- package/dist/components/AiLoading/index.mjs +0 -5
- package/dist/components/AiLoading/types.ts +0 -7
- package/dist/components/AiMain/index.mjs +0 -4
- package/dist/components/AiMain/index.vue.mjs +0 -20
- package/dist/components/AiMain/types.ts +0 -4
- package/dist/components/AiMenu/index.mjs +0 -4
- package/dist/components/AiMenu/index.vue.mjs +0 -20
- package/dist/components/AiMenu/types.ts +0 -9
- package/dist/components/AiMessage/index.mjs +0 -5
- package/dist/components/AiMessage/types.ts +0 -9
- package/dist/components/AiNotification/index.mjs +0 -5
- package/dist/components/AiNotification/types.ts +0 -10
- package/dist/components/AiPagination/index.mjs +0 -4
- package/dist/components/AiPagination/index.vue.mjs +0 -15
- package/dist/components/AiPagination/types.ts +0 -9
- package/dist/components/AiProgress/index.mjs +0 -4
- package/dist/components/AiProgress/index.vue.mjs +0 -15
- package/dist/components/AiProgress/types.ts +0 -10
- package/dist/components/AiRadio/index.mjs +0 -4
- package/dist/components/AiRadio/index.vue.mjs +0 -20
- package/dist/components/AiRadio/types.ts +0 -8
- package/dist/components/AiSwitch/index.mjs +0 -4
- package/dist/components/AiSwitch/index.vue.mjs +0 -15
- package/dist/components/AiSwitch/types.ts +0 -9
- package/dist/components/AiTabs/index.mjs +0 -4
- package/dist/components/AiTabs/index.vue.mjs +0 -20
- package/dist/components/AiTabs/types.ts +0 -9
- package/dist/components/AiTimePicker/index.mjs +0 -4
- package/dist/components/AiTimePicker/index.vue.mjs +0 -15
- package/dist/components/AiTimePicker/types.ts +0 -16
- package/dist/components/AiUpload/index.mjs +0 -4
- package/dist/components/AiUpload/index.vue.mjs +0 -20
- package/dist/components/AiUpload/types.ts +0 -11
- package/dist/layouts/government.md +0 -223
- package/dist/layouts/union.md +0 -229
- package/dist/styles/blue.scss +0 -71
- package/dist/styles/dark.scss +0 -71
- package/dist/styles/element-plus-theme.css +0 -52
- package/dist/styles/index.css +0 -77
- package/dist/styles/light-blue.scss +0 -71
package/dist/layouts/README.md
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
# Layouts布局规则
|
|
2
2
|
|
|
3
|
-
AI
|
|
3
|
+
AI组件库默认布局规则 - 确保页面风格统一、布局合理
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 布局规则
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
本组件库提供统一的默认布局规则,适用于所有企业级后台管理系统。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
详见:[default.md](default.md)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
- **government** - 政务服务布局规则(详见 [government.md](government.md))**【默认】**
|
|
13
|
-
- **union** - 工会系统布局规则(详见 [union.md](union.md))
|
|
11
|
+
## 核心要点
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
1. **必须使用CSS变量** - 禁止硬编码颜色、圆角等样式
|
|
14
|
+
2. **固定页面结构** - 使用标准的 `.page-container` + `.search-section` + `.table-section` 结构
|
|
15
|
+
3. **统一命名规范** - 使用规定的class命名
|
|
16
|
+
4. **统一间距** - 页面20px,卡片20-24px
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
+
## 开发规范
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
20
|
+
**开发任何页面前,必须先阅读 [default.md](default.md) 中的布局规则**
|
|
21
|
+
|
|
22
|
+
- ✅ 使用规范中的页面结构模板
|
|
23
|
+
- ✅ 使用CSS变量而非硬编码
|
|
24
|
+
- ✅ 遵循命名和间距规范
|
|
25
|
+
- ❌ 不要自创页面结构
|
|
26
|
+
- ❌ 不要使用硬编码样式
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# 默认布局规则(PC端)
|
|
2
|
+
|
|
3
|
+
## 场景概述
|
|
4
|
+
|
|
5
|
+
**适用场景**:企业级后台管理系统
|
|
6
|
+
**平台**:PC端
|
|
7
|
+
**核心特点**:现代专业、清晰透明、高效便捷
|
|
8
|
+
|
|
9
|
+
## 颜色方案
|
|
10
|
+
|
|
11
|
+
**默认主题**:使用项目CSS变量,自动适配主题切换
|
|
12
|
+
|
|
13
|
+
## 页面结构规范
|
|
14
|
+
|
|
15
|
+
### 1. 标准管理页面(列表+表单)
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<template>
|
|
19
|
+
<div class="page-container">
|
|
20
|
+
<!-- 搜索区 -->
|
|
21
|
+
<div class="search-section">
|
|
22
|
+
<AiForm v-model="searchForm" :config="searchConfig">
|
|
23
|
+
<template #action>
|
|
24
|
+
<el-button type="primary">搜索</el-button>
|
|
25
|
+
<el-button>重置</el-button>
|
|
26
|
+
<el-button type="success">新增</el-button>
|
|
27
|
+
</template>
|
|
28
|
+
</AiForm>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<!-- 表格区 -->
|
|
32
|
+
<div class="table-section">
|
|
33
|
+
<AiTable :columns="columns" :data="tableData" :pagination="pagination">
|
|
34
|
+
<template #action="{ row }">
|
|
35
|
+
<el-button link type="primary">编辑</el-button>
|
|
36
|
+
<el-button link type="danger">删除</el-button>
|
|
37
|
+
</template>
|
|
38
|
+
</AiTable>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style scoped>
|
|
44
|
+
.page-container {
|
|
45
|
+
padding: 20px;
|
|
46
|
+
background: var(--el-bg-color-page);
|
|
47
|
+
min-height: 100vh;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.search-section {
|
|
51
|
+
background: var(--el-bg-color);
|
|
52
|
+
padding: 20px;
|
|
53
|
+
border-radius: var(--el-border-radius-base);
|
|
54
|
+
margin-bottom: 20px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.table-section {
|
|
58
|
+
background: var(--el-bg-color);
|
|
59
|
+
padding: 20px;
|
|
60
|
+
border-radius: var(--el-border-radius-base);
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 2. 表单页面
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<template>
|
|
69
|
+
<div class="page-container">
|
|
70
|
+
<div class="form-section">
|
|
71
|
+
<div class="form-header">
|
|
72
|
+
<h3>{{ title }}</h3>
|
|
73
|
+
</div>
|
|
74
|
+
<AiForm v-model="formData" :config="formConfig" :rules="rules" />
|
|
75
|
+
<div class="form-footer">
|
|
76
|
+
<el-button>取消</el-button>
|
|
77
|
+
<el-button type="primary">提交</el-button>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<style scoped>
|
|
84
|
+
.form-section {
|
|
85
|
+
background: var(--el-bg-color);
|
|
86
|
+
padding: 24px;
|
|
87
|
+
border-radius: var(--el-border-radius-base);
|
|
88
|
+
max-width: 800px;
|
|
89
|
+
margin: 0 auto;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.form-header {
|
|
93
|
+
margin-bottom: 24px;
|
|
94
|
+
padding-bottom: 16px;
|
|
95
|
+
border-bottom: 1px solid var(--el-border-color);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.form-footer {
|
|
99
|
+
margin-top: 24px;
|
|
100
|
+
padding-top: 16px;
|
|
101
|
+
border-top: 1px solid var(--el-border-color);
|
|
102
|
+
text-align: right;
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 3. 详情页面
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<template>
|
|
111
|
+
<div class="page-container">
|
|
112
|
+
<div class="detail-section">
|
|
113
|
+
<div class="detail-header">
|
|
114
|
+
<h3>{{ title }}</h3>
|
|
115
|
+
<div class="actions">
|
|
116
|
+
<el-button>编辑</el-button>
|
|
117
|
+
<el-button type="danger">删除</el-button>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="detail-content">
|
|
121
|
+
<!-- 详情内容 -->
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</template>
|
|
126
|
+
|
|
127
|
+
<style scoped>
|
|
128
|
+
.detail-section {
|
|
129
|
+
background: var(--el-bg-color);
|
|
130
|
+
padding: 24px;
|
|
131
|
+
border-radius: var(--el-border-radius-base);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.detail-header {
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: space-between;
|
|
137
|
+
align-items: center;
|
|
138
|
+
margin-bottom: 24px;
|
|
139
|
+
padding-bottom: 16px;
|
|
140
|
+
border-bottom: 1px solid var(--el-border-color);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.detail-content {
|
|
144
|
+
line-height: 2;
|
|
145
|
+
}
|
|
146
|
+
</style>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 样式规范
|
|
150
|
+
|
|
151
|
+
### 必须使用的CSS变量
|
|
152
|
+
|
|
153
|
+
```css
|
|
154
|
+
/* 背景色 */
|
|
155
|
+
--el-bg-color-page /* 页面背景 */
|
|
156
|
+
--el-bg-color /* 组件背景(卡片、表格、表单) */
|
|
157
|
+
|
|
158
|
+
/* 文字色 */
|
|
159
|
+
--el-text-color-primary /* 主要文字 */
|
|
160
|
+
--el-text-color-regular /* 常规文字 */
|
|
161
|
+
--el-text-color-secondary /* 次要文字 */
|
|
162
|
+
|
|
163
|
+
/* 边框 */
|
|
164
|
+
--el-border-color /* 边框颜色 */
|
|
165
|
+
--el-border-radius-base /* 圆角(8px) */
|
|
166
|
+
|
|
167
|
+
/* 间距 */
|
|
168
|
+
padding: 20px /* 页面外边距 */
|
|
169
|
+
padding: 24px /* 卡片内边距 */
|
|
170
|
+
margin-bottom: 20px /* 区块间距 */
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 禁止使用硬编码
|
|
174
|
+
|
|
175
|
+
❌ 错误示例:
|
|
176
|
+
```css
|
|
177
|
+
background: #ffffff;
|
|
178
|
+
background: white;
|
|
179
|
+
border-radius: 4px;
|
|
180
|
+
color: #333;
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
✅ 正确示例:
|
|
184
|
+
```css
|
|
185
|
+
background: var(--el-bg-color);
|
|
186
|
+
border-radius: var(--el-border-radius-base);
|
|
187
|
+
color: var(--el-text-color-primary);
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 组件使用规范
|
|
191
|
+
|
|
192
|
+
### 表单搜索区
|
|
193
|
+
|
|
194
|
+
- 使用 `AiForm` 组件
|
|
195
|
+
- 默认 `col: 6`(一行4个字段)
|
|
196
|
+
- 操作按钮放在 `#action` 插槽
|
|
197
|
+
- 按钮顺序:主操作 → 次要操作 → 新增操作
|
|
198
|
+
|
|
199
|
+
### 表格区
|
|
200
|
+
|
|
201
|
+
- 使用 `AiTable` 组件
|
|
202
|
+
- 不要在 `columns` 中定义 `action` 列(组件自动添加)
|
|
203
|
+
- 操作按钮使用 `link` 类型
|
|
204
|
+
- 状态字段使用 `AiTag` 组件
|
|
205
|
+
|
|
206
|
+
### 弹窗表单
|
|
207
|
+
|
|
208
|
+
- 使用 `el-dialog` + `AiForm`
|
|
209
|
+
- 宽度:`600px`(标准)/ `800px`(复杂表单)
|
|
210
|
+
- 表单项 `col: 24`(独占一行)
|
|
211
|
+
|
|
212
|
+
## 间距规范
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
页面容器 padding: 20px
|
|
216
|
+
卡片内边距 padding: 20px(搜索区)/ 24px(表单、详情)
|
|
217
|
+
卡片间距 margin-bottom: 20px
|
|
218
|
+
表单项间距 由 AiForm 自动处理
|
|
219
|
+
按钮间距 由 ElementPlus 自动处理
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## 命名规范
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
.page-container /* 页面容器 */
|
|
226
|
+
.search-section /* 搜索区 */
|
|
227
|
+
.table-section /* 表格区 */
|
|
228
|
+
.form-section /* 表单区 */
|
|
229
|
+
.detail-section /* 详情区 */
|
|
230
|
+
.form-header /* 表单头部 */
|
|
231
|
+
.form-footer /* 表单底部 */
|
|
232
|
+
.detail-header /* 详情头部 */
|
|
233
|
+
.detail-content /* 详情内容 */
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## 响应式规则
|
|
237
|
+
|
|
238
|
+
暂不支持响应式,仅适配PC端(最小宽度1280px)
|
package/dist/styles/README.md
CHANGED
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
AI组件库样式主题库
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 默认主题
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## 可选主题
|
|
10
|
-
|
|
11
|
-
- **blue** - 蓝色专业主题(政务、企业)
|
|
12
|
-
- **light-blue** - 浅蓝温馨主题(工会、服务)
|
|
13
|
-
- **dark** - 深色主题(科技、数据)
|
|
7
|
+
本组件库提供统一的**light浅色主题**,适用于所有企业级后台管理系统。
|
|
14
8
|
|
|
15
9
|
## 使用方式
|
|
16
10
|
|
|
@@ -19,161 +13,47 @@ AI组件库样式主题库
|
|
|
19
13
|
import 'ai-front-base/styles'
|
|
20
14
|
```
|
|
21
15
|
|
|
22
|
-
**步骤2
|
|
16
|
+
**步骤2:设置主题**
|
|
23
17
|
|
|
24
|
-
|
|
18
|
+
在HTML的body标签上设置data-theme属性:
|
|
25
19
|
|
|
26
|
-
**方法1:在index.html中直接设置(推荐)**
|
|
27
20
|
```html
|
|
28
21
|
<!DOCTYPE html>
|
|
29
22
|
<html>
|
|
30
23
|
<head>...</head>
|
|
31
|
-
<body data-theme="
|
|
24
|
+
<body data-theme="light">
|
|
32
25
|
<div id="app"></div>
|
|
33
26
|
</body>
|
|
34
27
|
</html>
|
|
35
28
|
```
|
|
36
29
|
|
|
37
|
-
|
|
30
|
+
或在App.vue中设置:
|
|
38
31
|
```vue
|
|
39
32
|
<script setup>
|
|
40
33
|
import { onMounted } from 'vue'
|
|
41
34
|
|
|
42
35
|
onMounted(() => {
|
|
43
|
-
document.body.setAttribute('data-theme', '
|
|
36
|
+
document.body.setAttribute('data-theme', 'light')
|
|
44
37
|
})
|
|
45
38
|
</script>
|
|
46
39
|
```
|
|
47
40
|
|
|
48
|
-
**方法3:支持主题切换**
|
|
49
|
-
```vue
|
|
50
|
-
<script setup>
|
|
51
|
-
import { ref, watch } from 'vue'
|
|
52
|
-
|
|
53
|
-
const theme = ref('blue')
|
|
54
|
-
|
|
55
|
-
watch(theme, (newTheme) => {
|
|
56
|
-
document.body.setAttribute('data-theme', newTheme)
|
|
57
|
-
}, { immediate: true })
|
|
58
|
-
|
|
59
|
-
const changeTheme = (newTheme) => {
|
|
60
|
-
theme.value = newTheme
|
|
61
|
-
}
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<template>
|
|
65
|
-
<div>
|
|
66
|
-
<button @click="changeTheme('blue')">蓝色主题</button>
|
|
67
|
-
<button @click="changeTheme('light-blue')">浅蓝主题</button>
|
|
68
|
-
<button @click="changeTheme('dark')">深色主题</button>
|
|
69
|
-
</div>
|
|
70
|
-
</template>
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
**可选主题值:**
|
|
74
|
-
- `blue` - 蓝色专业主题(默认)
|
|
75
|
-
- `light-blue` - 浅蓝温馨主题
|
|
76
|
-
- `dark` - 深色主题
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## CSS变量体系
|
|
80
|
-
|
|
81
|
-
### 色值变量
|
|
82
|
-
```css
|
|
83
|
-
/* 主色系 */
|
|
84
|
-
--ai-primary /* 主色 */
|
|
85
|
-
--ai-success /* 成功色 */
|
|
86
|
-
--ai-warning /* 警告色 */
|
|
87
|
-
--ai-danger /* 危险色 */
|
|
88
|
-
--ai-info /* 信息色 */
|
|
89
|
-
|
|
90
|
-
/* 背景色 */
|
|
91
|
-
--ai-bg-base /* 基础背景 */
|
|
92
|
-
--ai-bg-light /* 浅色背景 */
|
|
93
|
-
--ai-bg-dark /* 深色背景 */
|
|
94
|
-
--ai-bg-overlay /* 遮罩背景 */
|
|
95
|
-
|
|
96
|
-
/* 文字色 */
|
|
97
|
-
--ai-text-primary /* 主要文字 */
|
|
98
|
-
--ai-text-regular /* 常规文字 */
|
|
99
|
-
--ai-text-secondary /* 次要文字 */
|
|
100
|
-
--ai-text-placeholder /* 占位文字 */
|
|
101
|
-
--ai-text-disabled /* 禁用文字 */
|
|
102
|
-
|
|
103
|
-
/* 边框色 */
|
|
104
|
-
--ai-border-base /* 基础边框 */
|
|
105
|
-
--ai-border-light /* 浅色边框 */
|
|
106
|
-
--ai-border-dark /* 深色边框 */
|
|
107
|
-
|
|
108
|
-
/* 功能色 */
|
|
109
|
-
--ai-link /* 链接色 */
|
|
110
|
-
--ai-hover /* 悬停色 */
|
|
111
|
-
--ai-active /* 激活色 */
|
|
112
|
-
--ai-disabled /* 禁用色 */
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### 间距变量
|
|
116
|
-
```css
|
|
117
|
-
/* 基础间距 */
|
|
118
|
-
--ai-spacing-xs /* 4px */
|
|
119
|
-
--ai-spacing-sm /* 8px */
|
|
120
|
-
--ai-spacing-md /* 16px */
|
|
121
|
-
--ai-spacing-lg /* 24px */
|
|
122
|
-
--ai-spacing-xl /* 32px */
|
|
123
|
-
|
|
124
|
-
/* 内边距 */
|
|
125
|
-
--ai-padding-xs/sm/md/lg/xl
|
|
126
|
-
|
|
127
|
-
/* 外边距 */
|
|
128
|
-
--ai-margin-xs/sm/md/lg/xl
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### 尺寸变量
|
|
132
|
-
```css
|
|
133
|
-
/* 圆角 */
|
|
134
|
-
--ai-radius-sm /* 2px */
|
|
135
|
-
--ai-radius-base /* 4px */
|
|
136
|
-
--ai-radius-lg /* 8px */
|
|
137
|
-
--ai-radius-xl /* 12px */
|
|
138
|
-
|
|
139
|
-
/* 字号 */
|
|
140
|
-
--ai-font-xs /* 12px */
|
|
141
|
-
--ai-font-sm /* 14px */
|
|
142
|
-
--ai-font-base /* 16px */
|
|
143
|
-
--ai-font-lg /* 18px */
|
|
144
|
-
--ai-font-xl /* 20px */
|
|
145
|
-
|
|
146
|
-
/* 行高 */
|
|
147
|
-
--ai-line-height-sm/base/lg
|
|
148
|
-
|
|
149
|
-
/* 阴影 */
|
|
150
|
-
--ai-shadow-sm/base/lg
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### 动画变量
|
|
154
|
-
```css
|
|
155
|
-
--ai-transition-fast /* 0.1s */
|
|
156
|
-
--ai-transition-base /* 0.3s */
|
|
157
|
-
--ai-transition-slow /* 0.5s */
|
|
158
|
-
```
|
|
159
|
-
|
|
160
41
|
## CSS样式规范
|
|
161
42
|
|
|
162
|
-
### ⚠️
|
|
43
|
+
### ⚠️ 强制规则(MUST)
|
|
163
44
|
|
|
164
|
-
1.
|
|
165
|
-
2.
|
|
166
|
-
3.
|
|
45
|
+
1. **MUST 禁止硬编码色值** - 所有颜色必须使用CSS变量
|
|
46
|
+
2. **MUST 禁止硬编码间距** - 所有padding/margin必须使用间距变量
|
|
47
|
+
3. **MUST 禁止硬编码尺寸** - 圆角、字号、行高必须使用对应变量
|
|
167
48
|
|
|
168
49
|
### ✅ 正确示例
|
|
169
50
|
```css
|
|
170
51
|
.button {
|
|
171
|
-
color: var(--
|
|
172
|
-
background: var(--
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
transition: all var(--ai-transition-base);
|
|
52
|
+
color: var(--el-text-color-primary);
|
|
53
|
+
background: var(--el-color-primary);
|
|
54
|
+
border-radius: var(--el-border-radius-base);
|
|
55
|
+
font-size: var(--el-font-size-base);
|
|
56
|
+
transition: all var(--el-transition-duration);
|
|
177
57
|
}
|
|
178
58
|
```
|
|
179
59
|
|
|
@@ -181,9 +61,8 @@ const changeTheme = (newTheme) => {
|
|
|
181
61
|
```css
|
|
182
62
|
.button {
|
|
183
63
|
color: #333; /* ❌ 硬编码色值 */
|
|
184
|
-
background: #
|
|
64
|
+
background: #1677ff; /* ❌ 硬编码色值 */
|
|
185
65
|
padding: 8px 16px; /* ❌ 硬编码间距 */
|
|
186
|
-
border-radius:
|
|
66
|
+
border-radius: 8px; /* ❌ 硬编码圆角 */
|
|
187
67
|
}
|
|
188
68
|
```
|
|
189
|
-
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
body[data-theme="light"] {
|
|
2
|
+
// ==================== 主色系 ====================
|
|
3
|
+
--el-color-primary: #1677ff;
|
|
4
|
+
--el-color-primary-light-3: #79bbff;
|
|
5
|
+
--el-color-primary-light-5: #a0cfff;
|
|
6
|
+
--el-color-primary-light-7: #c6e2ff;
|
|
7
|
+
--el-color-primary-light-8: #d9ecff;
|
|
8
|
+
--el-color-primary-light-9: #ecf5ff;
|
|
9
|
+
--el-color-primary-dark-2: #0958d9;
|
|
10
|
+
|
|
11
|
+
--el-color-success: #52c41a;
|
|
12
|
+
--el-color-success-light-3: #95d475;
|
|
13
|
+
--el-color-success-light-5: #b3e19d;
|
|
14
|
+
--el-color-success-light-7: #d1edc4;
|
|
15
|
+
--el-color-success-light-8: #e1f3d8;
|
|
16
|
+
--el-color-success-light-9: #f0f9eb;
|
|
17
|
+
--el-color-success-dark-2: #389e0d;
|
|
18
|
+
|
|
19
|
+
--el-color-warning: #faad14;
|
|
20
|
+
--el-color-warning-light-3: #fcd572;
|
|
21
|
+
--el-color-warning-light-5: #fde29a;
|
|
22
|
+
--el-color-warning-light-7: #fdefc2;
|
|
23
|
+
--el-color-warning-light-8: #fef5da;
|
|
24
|
+
--el-color-warning-light-9: #fefaec;
|
|
25
|
+
--el-color-warning-dark-2: #d48806;
|
|
26
|
+
|
|
27
|
+
--el-color-danger: #ff4d4f;
|
|
28
|
+
--el-color-danger-light-3: #ff9c9e;
|
|
29
|
+
--el-color-danger-light-5: #ffb8b8;
|
|
30
|
+
--el-color-danger-light-7: #ffd4d4;
|
|
31
|
+
--el-color-danger-light-8: #ffe3e3;
|
|
32
|
+
--el-color-danger-light-9: #fff1f0;
|
|
33
|
+
--el-color-danger-dark-2: #cf1322;
|
|
34
|
+
|
|
35
|
+
--el-color-info: #1677ff;
|
|
36
|
+
--el-color-info-light-3: #79bbff;
|
|
37
|
+
--el-color-info-light-5: #a0cfff;
|
|
38
|
+
--el-color-info-light-7: #c6e2ff;
|
|
39
|
+
--el-color-info-light-8: #d9ecff;
|
|
40
|
+
--el-color-info-light-9: #ecf5ff;
|
|
41
|
+
--el-color-info-dark-2: #0958d9;
|
|
42
|
+
|
|
43
|
+
// ==================== 背景色 ====================
|
|
44
|
+
// 基础背景色
|
|
45
|
+
--el-bg-color: #ffffff; // 组件基础背景:卡片、弹窗、表格等
|
|
46
|
+
--el-bg-color-page: #f5f7fa; // 页面背景色
|
|
47
|
+
--el-bg-color-overlay: #ffffff; // 弹出层背景:下拉菜单、日期选择器面板
|
|
48
|
+
|
|
49
|
+
// 填充色(用于输入框、按钮等内部填充)
|
|
50
|
+
--el-fill-color-blank: #ffffff; // 输入框背景、下拉选项背景
|
|
51
|
+
--el-fill-color: #f5f7fa; // 禁用状态背景
|
|
52
|
+
--el-fill-color-light: #fafafa; // 悬停状态背景
|
|
53
|
+
--el-fill-color-lighter: #fafafa; // 次要填充
|
|
54
|
+
--el-fill-color-extra-light: #fafafa; // 最浅填充
|
|
55
|
+
--el-fill-color-dark: #e6e8eb; // 深色填充
|
|
56
|
+
--el-fill-color-darker: #e6e8eb; // 更深填充
|
|
57
|
+
|
|
58
|
+
// 遮罩层
|
|
59
|
+
--el-mask-color: rgba(0, 0, 0, 0.5); // 弹窗遮罩
|
|
60
|
+
|
|
61
|
+
// ==================== 文字色 ====================
|
|
62
|
+
--el-text-color-primary: #1f2937;
|
|
63
|
+
--el-text-color-regular: #4b5563;
|
|
64
|
+
--el-text-color-secondary: #9ca3af;
|
|
65
|
+
--el-text-color-placeholder: #d1d5db;
|
|
66
|
+
--el-text-color-disabled: #e5e7eb;
|
|
67
|
+
|
|
68
|
+
// ==================== 边框色 ====================
|
|
69
|
+
--el-border-color: #e5e7eb;
|
|
70
|
+
--el-border-color-light: #f3f4f6;
|
|
71
|
+
--el-border-color-lighter: #f9fafb;
|
|
72
|
+
--el-border-color-extra-light: #f9fafb;
|
|
73
|
+
--el-border-color-dark: #d1d5db;
|
|
74
|
+
--el-border-color-darker: #9ca3af;
|
|
75
|
+
|
|
76
|
+
// ==================== 圆角 ====================
|
|
77
|
+
--el-border-radius-base: 8px;
|
|
78
|
+
--el-border-radius-small: 4px;
|
|
79
|
+
--el-border-radius-round: 16px;
|
|
80
|
+
--el-border-radius-circle: 50%;
|
|
81
|
+
|
|
82
|
+
// ==================== 字体 ====================
|
|
83
|
+
--el-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
84
|
+
|
|
85
|
+
--el-font-size-extra-small: 12px;
|
|
86
|
+
--el-font-size-small: 13px;
|
|
87
|
+
--el-font-size-base: 14px;
|
|
88
|
+
--el-font-size-medium: 14px;
|
|
89
|
+
--el-font-size-large: 16px;
|
|
90
|
+
--el-font-size-extra-large: 18px;
|
|
91
|
+
|
|
92
|
+
--el-font-weight-primary: 500;
|
|
93
|
+
|
|
94
|
+
// ==================== 阴影 ====================
|
|
95
|
+
--el-box-shadow-light: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
96
|
+
--el-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
97
|
+
--el-box-shadow-dark: 0 4px 12px rgba(0, 0, 0, 0.10);
|
|
98
|
+
|
|
99
|
+
// ==================== 动画 ====================
|
|
100
|
+
--el-transition-duration: 0.3s;
|
|
101
|
+
--el-transition-duration-fast: 0.15s;
|
|
102
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-front-base",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "企业级PC端AI组件库 - 基于Vue3和Element Plus",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"type": "module",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "vite build && node scripts/post-build.mjs",
|
|
24
|
+
"preview": "vite --config vite.preview.config.ts",
|
|
24
25
|
"prepublishOnly": "pnpm build"
|
|
25
26
|
},
|
|
26
27
|
"repository": {
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineComponent as o, resolveComponent as r, openBlock as n, createBlock as s, normalizeProps as a, guardReactiveProps as i, withCtx as l, renderSlot as p } from "vue";
|
|
2
|
-
const m = /* @__PURE__ */ o({
|
|
3
|
-
name: "AiAside",
|
|
4
|
-
inheritAttrs: !0,
|
|
5
|
-
__name: "index",
|
|
6
|
-
setup(d) {
|
|
7
|
-
return (e, _) => {
|
|
8
|
-
const t = r("el-aside");
|
|
9
|
-
return n(), s(t, a(i(e.$attrs)), {
|
|
10
|
-
default: l(() => [
|
|
11
|
-
p(e.$slots, "default")
|
|
12
|
-
]),
|
|
13
|
-
_: 3
|
|
14
|
-
}, 16);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
export {
|
|
19
|
-
m as default
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineComponent as o, resolveComponent as r, openBlock as n, createBlock as a, normalizeProps as s, guardReactiveProps as l, withCtx as p, renderSlot as d } from "vue";
|
|
2
|
-
const m = /* @__PURE__ */ o({
|
|
3
|
-
name: "AiBadge",
|
|
4
|
-
inheritAttrs: !0,
|
|
5
|
-
__name: "index",
|
|
6
|
-
setup(i) {
|
|
7
|
-
return (e, _) => {
|
|
8
|
-
const t = r("el-badge");
|
|
9
|
-
return n(), a(t, s(l(e.$attrs)), {
|
|
10
|
-
default: p(() => [
|
|
11
|
-
d(e.$slots, "default")
|
|
12
|
-
]),
|
|
13
|
-
_: 3
|
|
14
|
-
}, 16);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
export {
|
|
19
|
-
m as default
|
|
20
|
-
};
|