xt-element-ui 1.2.4 → 1.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/LICENSE +21 -0
  3. package/README.md +240 -104
  4. package/docs/README.md +100 -0
  5. package/docs/components/base/xt-button.md +114 -0
  6. package/docs/components/base/xt-card-item.md +104 -0
  7. package/docs/components/base/xt-card.md +108 -0
  8. package/docs/components/base/xt-config-provider.md +199 -0
  9. package/docs/components/base/xt-flex-box.md +115 -0
  10. package/docs/components/base/xt-grid-box.md +303 -0
  11. package/docs/components/base/xt-input.md +150 -0
  12. package/docs/components/base/xt-text.md +212 -0
  13. package/docs/components/extend/ex-bar.md +68 -0
  14. package/docs/components/extend/ex-button.md +62 -0
  15. package/docs/components/extend/ex-card.md +86 -0
  16. package/docs/components/extend/ex-chart.md +463 -0
  17. package/docs/components/extend/ex-icon.md +189 -0
  18. package/docs/components/extend/ex-line.md +71 -0
  19. package/docs/components/extend/ex-multi.md +156 -0
  20. package/docs/components/extend/ex-page.md +0 -0
  21. package/docs/components/extend/ex-pie.md +70 -0
  22. package/docs/components/extend/ex-select-tree.md +210 -0
  23. package/docs/components/extend/ex-table.md +591 -0
  24. package/docs/components/extend/ex-upload.md +134 -0
  25. package/docs/components/utils/size.md +148 -0
  26. package/docs/components/utils/theme.md +183 -0
  27. package/lib/index.common.js +640 -758
  28. package/lib/index.css +1 -1
  29. package/lib/index.umd.js +640 -758
  30. package/lib/index.umd.min.js +5 -5
  31. package/package.json +80 -39
  32. package/src/components/ex-chart/ExBar.vue +35 -29
  33. package/src/components/ex-chart/ExLine.vue +23 -14
  34. package/src/components/ex-chart/ExMulti.vue +66 -76
  35. package/src/components/ex-chart/ExPie.vue +26 -18
  36. package/src/components/ex-chart/index.vue +1 -4
  37. package/src/components/ex-chart/utils.js +149 -8
  38. package/src/components/ex-icon/index.js +2 -0
  39. package/src/components/ex-icon/index.vue +168 -0
  40. package/src/components/ex-icon/style/index.scss +7 -0
  41. package/src/components/ex-table/index.vue +3 -3
  42. package/src/components/index.scss +4 -1
  43. package/src/components/xt-card-item/images/bar.svg +1 -0
  44. package/src/components/xt-card-item/images/line.svg +1 -0
  45. package/src/components/xt-card-item/images/pie.svg +1 -0
  46. package/src/index.js +3 -0
  47. package/src/components/ex-chart/ExTrend.vue +0 -124
  48. package/src/components/ex-chart/theme/blue.js +0 -91
  49. package/src/components/ex-chart/theme/orange.js +0 -92
  50. package/src/components/ex-chart/theme/starry.js +0 -106
@@ -0,0 +1,104 @@
1
+ ## XtCardItem 卡片项组件
2
+
3
+ 卡片项组件用于在卡片内展示一行数据,支持标签、数值和单位的展示。
4
+
5
+ ## 基本用法
6
+
7
+ ::: demo 基本用法
8
+ ```vue
9
+ <template>
10
+ <XtCardItem label="销售额" value="12345" unit="元"></XtCardItem>
11
+ </template>
12
+ ```
13
+ :::
14
+
15
+ ## 属性说明
16
+ | 属性 | 类型 | 默认值 | 可选值 | 说明 |
17
+ |------|------|--------|--------|------|
18
+ | `iconType` | String | border | `border`、`icon` | 图标类型 |
19
+ | `type` | String | primary | `primary`、`success`、`warning`、`danger` | 颜色类型 |
20
+ | `label` | String | - | - | 标签文本 |
21
+ | `value` | String / Number | - | - | 数值内容 |
22
+ | `unit` | String | - | - | 数值单位 |
23
+ | `icon` | String | - | - | Element Plus 图标名称 |
24
+ | `iconAt` | String | right | `left`、`right`、`top`、`bottom` | 图标位置 |
25
+ | `color` | String | - | - | 自定义颜色 |
26
+
27
+ ## 插槽说明
28
+
29
+ | 插槽名 | 说明 |
30
+ |--------|------|
31
+ | `label` | 自定义标签区域 |
32
+ | `value` | 自定义数值区域 |
33
+ | `unit` | 自定义单位区域 |
34
+ | `icon` | 自定义图标区域 |
35
+
36
+ ## 示例
37
+
38
+ ### 边框型卡片项(默认)
39
+
40
+ ::: demo 边框型卡片项
41
+ ```vue
42
+ <template>
43
+ <XtCardItem label="销售额" value="12345" unit="元" type="primary"></XtCardItem>
44
+ </template>
45
+ ```
46
+ :::
47
+
48
+ ### 不同类型的边框卡片项
49
+
50
+ ::: demo 不同类型的边框卡片项
51
+ ```vue
52
+ <template>
53
+ <div style="display: flex; flex-direction: column; gap: 8px;">
54
+ <XtCardItem label="成功" value="OK" type="success"></XtCardItem>
55
+ <XtCardItem label="警告" value="Warning" type="warning"></XtCardItem>
56
+ <XtCardItem label="危险" value="Error" type="danger"></XtCardItem>
57
+ </div>
58
+ </template>
59
+ ```
60
+ :::
61
+
62
+ ### 自定义颜色
63
+ ::: demo 自定义颜色
64
+ ```vue
65
+ <template>
66
+ <XtCardItem label="自定义颜色" value="100%" color="#722ed1"></XtCardItem>
67
+ </template>
68
+ ```
69
+ :::
70
+
71
+ ### 自定义插槽
72
+ ::: demo 自定义插槽
73
+ ```vue
74
+ <template>
75
+ <XtCardItem>
76
+ <template #label>
77
+ <span style="color: #1890ff; font-weight: bold;">自定义标签</span>
78
+ </template>
79
+ <template #value>
80
+ <span style="font-size: 18px;">9999</span>
81
+ </template>
82
+ <template #unit>
83
+ <span style="color: #999;">自定义单位</span>
84
+ </template>
85
+ </XtCardItem>
86
+ </template>
87
+ ```
88
+ :::
89
+
90
+ ### 在卡片中使用
91
+
92
+ ::: demo 在卡片中使用
93
+ ```vue
94
+ <template>
95
+ <XtCard title="统计数据">
96
+ <div style="display: flex; flex-direction: column; gap: 8px;">
97
+ <XtCardItem label="总销售额" value="123456" unit="元"></XtCardItem>
98
+ <XtCardItem label="订单数量" value="520" unit="单" type="success"></XtCardItem>
99
+ <XtCardItem label="转化率" value="23.5" unit="%" type="warning"></XtCardItem>
100
+ </div>
101
+ </XtCard>
102
+ </template>
103
+ ```
104
+ :::
@@ -0,0 +1,108 @@
1
+ ## XtCard 卡片组件
2
+
3
+ 卡片组件用于展示信息,通常包含标题和内容区域。
4
+
5
+ ## 基本用法
6
+
7
+ ::: demo 基本用法
8
+ ```vue
9
+ <template>
10
+ <XtCard title="卡片标题" value="123" unit="元"></XtCard>
11
+ </template>
12
+ ```
13
+ :::
14
+
15
+ ## 属性说明
16
+
17
+ | 属性 | 类型 | 默认值 | 说明 |
18
+ |------|------|--------|------|
19
+ | `title` | String | - | 卡片标题 |
20
+ | `value` | String / Number | - | 卡片数值 |
21
+ | `unit` | String | - | 数值单位 |
22
+ | `noPadding` | Boolean | false | 是否取消内边距 |
23
+
24
+ ## 插槽说明
25
+
26
+ | 插槽名 | 说明 |
27
+ |--------|------|
28
+ | `default` | 自定义内容区域 |
29
+ | `title` | 自定义标题区域 |
30
+ | `value` | 自定义数值区域 |
31
+
32
+ ## 示例
33
+
34
+ ### 基础卡片
35
+
36
+ ::: demo 基础卡片
37
+ ```vue
38
+ <template>
39
+ <XtCard title="今日销售额" :value="123456" unit="元"></XtCard>
40
+ </template>
41
+ ```
42
+ :::
43
+
44
+ ### 自定义内容
45
+
46
+ ::: demo 自定义内容
47
+ ```vue
48
+ <template>
49
+ <XtCard title="用户统计">
50
+ <div style="display: flex; justify-content: space-around;">
51
+ <div style="text-align: center;">
52
+ <span style="display: block; font-size: 12px; color: #999;">新增用户</span>
53
+ <span style="font-size: 24px; font-weight: bold; color: #1890ff;">520</span>
54
+ </div>
55
+ <div style="text-align: center;">
56
+ <span style="display: block; font-size: 12px; color: #999;">活跃用户</span>
57
+ <span style="font-size: 24px; font-weight: bold; color: #52c41a;">3840</span>
58
+ </div>
59
+ </div>
60
+ </XtCard>
61
+ </template>
62
+ ```
63
+ :::
64
+
65
+ ### 自定义标题和数值
66
+
67
+ ::: demo 自定义标题和数值
68
+ ```vue
69
+ <template>
70
+ <XtCard>
71
+ <template #title>
72
+ <span style="color: #1890ff;">📊 数据分析</span>
73
+ </template>
74
+ <template #value>
75
+ <span style="font-size: 32px; color: #52c41a;">98.5%</span>
76
+ </template>
77
+ </XtCard>
78
+ </template>
79
+ ```
80
+ :::
81
+
82
+ ### 无边距卡片
83
+
84
+ ::: demo 无边距卡片
85
+ ```vue
86
+ <template>
87
+ <XtCard title="紧凑卡片" :value="100" noPadding>
88
+ <div style="padding: 8px;">
89
+ <p>内容区域没有额外内边距</p>
90
+ </div>
91
+ </XtCard>
92
+ </template>
93
+ ```
94
+ :::
95
+
96
+ ### 卡片组
97
+
98
+ ::: demo 卡片组
99
+ ```vue
100
+ <template>
101
+ <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;">
102
+ <XtCard title="销售额" value="12345" unit="元"></XtCard>
103
+ <XtCard title="订单数" value="520" unit="单"></XtCard>
104
+ <XtCard title="转化率" value="23.5" unit="%"></XtCard>
105
+ </div>
106
+ </template>
107
+ ```
108
+ :::
@@ -0,0 +1,199 @@
1
+ ## XtConfigProvider 配置提供者
2
+
3
+ 配置提供者组件用于全局配置主题和样式变量。
4
+
5
+ ## 基本用法
6
+
7
+ ::: demo 基本用法
8
+ ```vue
9
+ <template>
10
+ <XtConfigProvider :theme="theme" proxyElement="body">
11
+ <div>
12
+ <XtButton type="primary" @click="handleSwitchTheme">主题按钮</XtButton>
13
+ </div>
14
+ </XtConfigProvider>
15
+ </template>
16
+ <script>
17
+ export default {
18
+ data(){
19
+ return {
20
+ theme: 'white'
21
+ }
22
+ },
23
+ methods: {
24
+ handleSwitchTheme() {
25
+ this.theme = this.theme == 'dark' ? 'white': 'dark'
26
+ }
27
+ }
28
+ }
29
+ </script>
30
+ ```
31
+ :::
32
+
33
+ ## 属性说明
34
+ | 属性 | 类型 | 默认值 | 可选值 | 说明 |
35
+ |------|------|--------|--------|------|
36
+ | `primaryColor` | String | - | - | 自定义主题色 |
37
+ | `theme` | String | - | `dark`、`light` | 主题模式 |
38
+ | `size` | String | - | `small`、`medium`、`large` | 组件尺寸 |
39
+ | `injectBackground` | Boolean | - | - | 是否注入背景色到根元素 |
40
+ | `injectColor` | Boolean | - | - | 是否注入文字颜色到根元素 |
41
+ | `tag` | String | 'div' | - | 根元素标签 |
42
+ | `proxyElement` | HTMLElement / String | - | - | 代理元素 |
43
+ | `vars` | Object | - | - | 自定义 CSS 变量 |
44
+
45
+ ## 示例
46
+
47
+ ### 自定义主题色
48
+
49
+ ::: demo 自定义主题色
50
+ ```vue
51
+ <template>
52
+ <XtConfigProvider :primaryColor="'#722ed1'">
53
+ <div>
54
+ <XtButton type="primary">紫色主题按钮</XtButton>
55
+ <XtCard title="自定义主题卡片">
56
+ <XtText type="primary">主题色文本</XtText>
57
+ </XtCard>
58
+ </div>
59
+ </XtConfigProvider>
60
+ </template>
61
+ ```
62
+ :::
63
+
64
+ ### 亮色主题
65
+
66
+ ::: demo 亮色主题
67
+ ```vue
68
+ <template>
69
+ <XtConfigProvider theme="light" injectBackground>
70
+ <div style="min-height: 100px; padding: 16px;">
71
+ <XtCard title="亮色模式卡片">
72
+ <XtText type="primary">亮色主题内容</XtText>
73
+ </XtCard>
74
+ <XtButton type="primary">亮色主题按钮</XtButton>
75
+ </div>
76
+ </XtConfigProvider>
77
+ </template>
78
+ ```
79
+ :::
80
+
81
+ ### 自定义 CSS 变量
82
+
83
+ ::: demo 自定义 CSS 变量
84
+ ```vue
85
+ <template>
86
+ <XtConfigProvider :vars="{
87
+ '--xt-color-primary': '#52c41a',
88
+ '--xt-color-success': '#13c2c2',
89
+ '--xt-flex-box-gap': '20px'
90
+ }">
91
+ <XtFlexBox>
92
+ <XtButton type="primary">绿色主题按钮</XtButton>
93
+ <XtButton type="success">青色成功按钮</XtButton>
94
+ </XtFlexBox>
95
+ </XtConfigProvider>
96
+ </template>
97
+ ```
98
+ :::
99
+
100
+ ### 组合配置
101
+
102
+ ::: demo 组合配置
103
+ ```vue
104
+ <template>
105
+ <XtConfigProvider
106
+ :primaryColor="'#1890ff'"
107
+ size="medium"
108
+ >
109
+ <div style="padding: 16px;">
110
+ <XtCard title="综合配置示例">
111
+ <XtText type="primary">主题色: #1890ff</XtText>
112
+ <XtText type="success">尺寸: medium</XtText>
113
+ </XtCard>
114
+ <XtFlexBox gap="16px" style="margin-top: 16px;">
115
+ <XtButton type="primary">主要按钮</XtButton>
116
+ <XtButton type="success">成功按钮</XtButton>
117
+ <XtButton type="warning">警告按钮</XtButton>
118
+ </XtFlexBox>
119
+ </div>
120
+ </XtConfigProvider>
121
+ </template>
122
+ ```
123
+ :::
124
+
125
+ ### 动态主题切换
126
+ ::: demo 动态主题切换
127
+ ```vue
128
+ <template>
129
+ <XtConfigProvider
130
+ :primaryColor="primaryColor"
131
+ :theme="currentTheme"
132
+ injectBackground
133
+ >
134
+ <div style="min-height: 120px; padding: 16px;">
135
+ <XtFlexBox content="space-between" style="margin-bottom: 16px;">
136
+ <span>当前主题: {{ currentTheme }}</span>
137
+ <XtFlexBox gap="8px">
138
+ <XtButton
139
+ type="primary"
140
+ plain
141
+ @click="switchTheme"
142
+ >
143
+ 切换主题
144
+ </XtButton>
145
+ <XtButton
146
+ type="success"
147
+ plain
148
+ @click="changeColor"
149
+ >
150
+ 更换主题色
151
+ </XtButton>
152
+ </XtFlexBox>
153
+ </XtFlexBox>
154
+ <XtCard title="动态主题示例">
155
+ <XtText type="primary">当前主题色: {{ primaryColor }}</XtText>
156
+ </XtCard>
157
+ </div>
158
+ </XtConfigProvider>
159
+ </template>
160
+
161
+ <script>
162
+ export default {
163
+ data() {
164
+ return {
165
+ primaryColor: '#1890ff',
166
+ currentTheme: 'light',
167
+ colors: ['#1890ff', '#52c41a', '#faad14', '#f5222d', '#722ed1']
168
+ }
169
+ },
170
+ methods: {
171
+ switchTheme() {
172
+ this.currentTheme = this.currentTheme === 'light' ? 'dark' : 'light'
173
+ },
174
+ changeColor() {
175
+ const randomIndex = Math.floor(Math.random() * this.colors.length)
176
+ this.primaryColor = this.colors[randomIndex]
177
+ }
178
+ }
179
+ }
180
+ </script>
181
+ ```
182
+ :::
183
+
184
+ ## 支持的 CSS 变量
185
+
186
+ | CSS 变量 | 说明 |
187
+ |----------|------|
188
+ | `--xt-color-primary` | 主色 |
189
+ | `--xt-color-success` | 成功色 |
190
+ | `--xt-color-warning` | 警告色 |
191
+ | `--xt-color-danger` | 危险色 |
192
+ | `--xt-color-info` | 信息色 |
193
+ | `--xt-text-color-primary` | 主要文字颜色 |
194
+ | `--xt-text-color-regular` | 常规文字颜色 |
195
+ | `--xt-text-color-secondary` | 次要文字颜色 |
196
+ | `--xt-bg-color` | 背景颜色 |
197
+ | `--xt-bg-color-page` | 页面背景颜色 |
198
+ | `--xt-border-color` | 边框颜色 |
199
+ | `--xt-flex-box-gap` | FlexBox 默认间距 |
@@ -0,0 +1,115 @@
1
+ ## XtFlexBox 弹性布局组件
2
+
3
+ 弹性布局组件,基于 CSS Flexbox 实现,提供便捷的布局能力。
4
+
5
+ ## 基本用法
6
+
7
+ ::: demo 基本用法
8
+ ```vue
9
+ <template>
10
+ <XtFlexBox gap="16px">
11
+ <div style="width: 80px; height: 40px; background: #f0f0f0; display: flex; align-items: center; justify-content: center;">子元素1</div>
12
+ <div style="width: 80px; height: 40px; background: #f0f0f0; display: flex; align-items: center; justify-content: center;">子元素2</div>
13
+ <div style="width: 80px; height: 40px; background: #f0f0f0; display: flex; align-items: center; justify-content: center;">子元素3</div>
14
+ </XtFlexBox>
15
+ </template>
16
+ ```
17
+ :::
18
+
19
+ ## 属性说明
20
+ | 属性 | 类型 | 默认值 | 可选值 | 说明 |
21
+ |------|------|--------|--------|------|
22
+ | `type` | String | flex | - | 布局类型 |
23
+ | `align` | String | center | `start`、`center`、`end`、`stretch`、`baseline` | 交叉轴对齐方式 |
24
+ | `content` | String | start | `start`、`center`、`end`、`between`、`around`、`evenly` | 主轴对齐方式 |
25
+ | `direction` | String | row | `row`、`row-reverse`、`column`、`column-reverse` | 排列方向 |
26
+ | `wrap` | String | unset | `wrap`、`nowrap`、`wrap-reverse` | 是否换行 |
27
+ | `gap` | String | - | - | 子元素间距 |
28
+
29
+ ## 示例
30
+
31
+ ### 水平居中且两端对齐
32
+ ::: demo 水平居中且两端对齐
33
+ ```vue
34
+ <template>
35
+ <XtFlexBox content="space-between" align="center">
36
+ <span>左侧内容</span>
37
+ <span>右侧内容</span>
38
+ </XtFlexBox>
39
+ </template>
40
+ ```
41
+ :::
42
+
43
+ ### 垂直布局
44
+
45
+ ::: demo 垂直布局
46
+ ```vue
47
+ <template>
48
+ <XtFlexBox direction="column" gap="12px">
49
+ <div style="background: #1890ff; color: white; padding: 8px;">顶部</div>
50
+ <div style="background: #52c41a; color: white; padding: 8px;">中部</div>
51
+ <div style="background: #faad14; color: white; padding: 8px;">底部</div>
52
+ </XtFlexBox>
53
+ </template>
54
+ ```
55
+ :::
56
+
57
+ ### 均匀分布
58
+
59
+ ::: demo 均匀分布
60
+ ```vue
61
+ <template>
62
+ <XtFlexBox content="space-around">
63
+ <div style="width: 60px; height: 60px; background: #e6f7ff; border-radius: 8px; display: flex; align-items: center; justify-content: center;">1</div>
64
+ <div style="width: 60px; height: 60px; background: #e6f7ff; border-radius: 8px; display: flex; align-items: center; justify-content: center;">2</div>
65
+ <div style="width: 60px; height: 60px; background: #e6f7ff; border-radius: 8px; display: flex; align-items: center; justify-content: center;">3</div>
66
+ <div style="width: 60px; height: 60px; background: #e6f7ff; border-radius: 8px; display: flex; align-items: center; justify-content: center;">4</div>
67
+ </XtFlexBox>
68
+ </template>
69
+ ```
70
+ :::
71
+
72
+ ### 自动换行
73
+
74
+ ::: demo 自动换行
75
+ ```vue
76
+ <template>
77
+ <XtFlexBox wrap="wrap" gap="8px">
78
+ <div v-for="i in 10" :key="i" style="width: 80px; height: 80px; background: #f0f0f0; border-radius: 8px; display: flex; align-items: center; justify-content: center;">{{ i }}</div>
79
+ </XtFlexBox>
80
+ </template>
81
+ ```
82
+ :::
83
+
84
+ ### 反向排列
85
+
86
+ ::: demo 反向排列
87
+ ```vue
88
+ <template>
89
+ <XtFlexBox direction="row-reverse">
90
+ <span style="padding: 8px; background: #f5f5f5;">第一</span>
91
+ <span style="padding: 8px; background: #f5f5f5;">第二</span>
92
+ <span style="padding: 8px; background: #f5f5f5;">第三</span>
93
+ </XtFlexBox>
94
+ </template>
95
+ ```
96
+ :::
97
+
98
+ ### 嵌套使用
99
+
100
+ ::: demo 嵌套使用
101
+ ```vue
102
+ <template>
103
+ <XtFlexBox direction="column" gap="16px">
104
+ <XtFlexBox content="space-between">
105
+ <span>头部左侧</span>
106
+ <span>头部右侧</span>
107
+ </XtFlexBox>
108
+ <XtFlexBox>
109
+ <div style="flex: 1; background: #e6f7ff; padding: 16px;">主内容区</div>
110
+ <div style="width: 200px; background: #f6ffed; padding: 16px;">侧边栏</div>
111
+ </XtFlexBox>
112
+ </XtFlexBox>
113
+ </template>
114
+ ```
115
+ :::