@ebiz/designer-components 0.0.18-beta.1 → 0.0.18-beta.3

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.
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <t-alert
3
+ :theme="theme"
4
+ :title="title"
5
+ :message="message"
6
+ :icon="icon"
7
+ :close="close"
8
+ :maxLine="maxLine"
9
+ :operation="operation"
10
+ :description="description"
11
+ :close-btn="closeBtn"
12
+ :default-open="defaultOpen"
13
+ @close="handleClose"
14
+ >
15
+ <!-- 标题插槽 -->
16
+ <template v-if="$slots.title" #title>
17
+ <slot name="title"></slot>
18
+ </template>
19
+
20
+ <!-- 内容插槽 -->
21
+ <template v-if="$slots.default">
22
+ <slot></slot>
23
+ </template>
24
+
25
+ <!-- 操作区插槽 -->
26
+ <template v-if="$slots.operation" #operation>
27
+ <slot name="operation"></slot>
28
+ </template>
29
+
30
+ <!-- 关闭按钮插槽 -->
31
+ <template v-if="$slots['close-btn']" #close-btn>
32
+ <slot name="close-btn"></slot>
33
+ </template>
34
+
35
+ <!-- 图标插槽 -->
36
+ <template v-if="$slots.icon" #icon>
37
+ <slot name="icon"></slot>
38
+ </template>
39
+ </t-alert>
40
+ </template>
41
+
42
+ <script>
43
+ export default {
44
+ name: "EbizAlert"
45
+ }
46
+ </script>
47
+
48
+ <script setup>
49
+ import { defineProps, defineEmits } from 'vue';
50
+ import { Alert as TAlert } from 'tdesign-vue-next';
51
+
52
+ const props = defineProps({
53
+ // 主题
54
+ theme: {
55
+ type: String,
56
+ default: 'info',
57
+ validator: (val) => ['success', 'info', 'warning', 'error'].includes(val)
58
+ },
59
+ // 标题
60
+ title: {
61
+ type: String,
62
+ default: ''
63
+ },
64
+ // 内容
65
+ message: {
66
+ type: String,
67
+ default: ''
68
+ },
69
+ // 图标
70
+ icon: {
71
+ type: [Boolean, Function],
72
+ default: true
73
+ },
74
+ // 关闭按钮
75
+ close: {
76
+ type: Boolean,
77
+ default: false
78
+ },
79
+ // 内容显示最大行数
80
+ maxLine: {
81
+ type: Number,
82
+ default: 0
83
+ },
84
+ // 操作区内容
85
+ operation: {
86
+ type: [String, Function],
87
+ default: ''
88
+ },
89
+ // 描述内容
90
+ description: {
91
+ type: String,
92
+ default: ''
93
+ },
94
+ // 关闭按钮内容
95
+ closeBtn: {
96
+ type: [String, Function, Boolean],
97
+ default: undefined
98
+ },
99
+ // 默认是否显示打开
100
+ defaultOpen: {
101
+ type: Boolean,
102
+ default: true
103
+ }
104
+ });
105
+
106
+ const emit = defineEmits(['close']);
107
+
108
+ // 关闭事件
109
+ const handleClose = (e) => {
110
+ emit('close', e);
111
+ };
112
+ </script>
113
+
114
+ <style lang="less" scoped>
115
+ /* 自定义样式 */
116
+ </style>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <t-timeline
3
+ :layout="layout"
4
+ :labelAlign="labelAlign"
5
+ :mode="mode"
6
+ :reverse="reverse"
7
+ :theme="theme"
8
+ >
9
+ <slot></slot>
10
+ </t-timeline>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: "EbizTimeline"
16
+ }
17
+ </script>
18
+
19
+ <script setup>
20
+ import { defineProps, defineEmits } from 'vue';
21
+ import { Timeline as TTimeline } from 'tdesign-vue-next';
22
+
23
+ defineProps({
24
+ // 布局方向
25
+ layout: {
26
+ type: String,
27
+ default: 'vertical',
28
+ validator: (val) => ['horizontal', 'vertical'].includes(val)
29
+ },
30
+ // 标签位置
31
+ labelAlign: {
32
+ type: String,
33
+ default: 'auto',
34
+ validator: (val) => ['left', 'right', 'top', 'bottom', 'auto'].includes(val)
35
+ },
36
+ // 展示类型
37
+ mode: {
38
+ type: String,
39
+ default: 'alternate',
40
+ validator: (val) => ['alternate', 'same', 'left', 'right'].includes(val)
41
+ },
42
+ // 是否倒序排列
43
+ reverse: {
44
+ type: Boolean,
45
+ default: false
46
+ },
47
+ // 主题风格
48
+ theme: {
49
+ type: String,
50
+ default: 'default',
51
+ validator: (val) => ['default', 'dot'].includes(val)
52
+ }
53
+ });
54
+ </script>
55
+
56
+ <style lang="less" scoped>
57
+ /* 自定义样式 */
58
+ </style>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <t-timeline-item
3
+ :content="content"
4
+ :dot="dot"
5
+ :dotColor="dotColor"
6
+ :label="label"
7
+ :labelAlign="labelAlign"
8
+ :loading="loading"
9
+ >
10
+ <!-- 时间轴点内容插槽 -->
11
+ <template v-if="$slots.dot" #dot>
12
+ <slot name="dot"></slot>
13
+ </template>
14
+
15
+ <!-- 标签内容插槽 -->
16
+ <template v-if="$slots.label" #label>
17
+ <slot name="label"></slot>
18
+ </template>
19
+
20
+ <!-- 默认插槽 -->
21
+ <slot>{{ content }}</slot>
22
+ </t-timeline-item>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: "EbizTimelineItem"
28
+ }
29
+ </script>
30
+
31
+ <script setup>
32
+ import { defineProps } from 'vue';
33
+ import { TimelineItem as TTimelineItem } from 'tdesign-vue-next';
34
+
35
+ defineProps({
36
+ // 内容
37
+ content: {
38
+ type: String,
39
+ default: ''
40
+ },
41
+ // 时间轴点内容,可以是组件
42
+ dot: {
43
+ type: [String, Function],
44
+ default: ''
45
+ },
46
+ // 时间轴点颜色,内置 primary/warning/error/default 四种色值
47
+ dotColor: {
48
+ type: String,
49
+ default: ''
50
+ },
51
+ // 标签文本内容
52
+ label: {
53
+ type: String,
54
+ default: ''
55
+ },
56
+ // 标签位置,优先级高于 Timeline 中的 labelAlign
57
+ labelAlign: {
58
+ type: String,
59
+ default: '',
60
+ validator: (val) => ['left', 'right', 'top', 'bottom', 'auto', ''].includes(val)
61
+ },
62
+ // 是否处于加载状态
63
+ loading: {
64
+ type: Boolean,
65
+ default: false
66
+ }
67
+ });
68
+ </script>
69
+
70
+ <style lang="less" scoped>
71
+ /* 自定义样式 */
72
+ </style>
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <t-watermark
3
+ :alpha="alpha"
4
+ :watermark-content="watermarkContent"
5
+ :width="width"
6
+ :height="height"
7
+ :x="x"
8
+ :y="y"
9
+ :rotate="rotate"
10
+ :zIndex="zIndex"
11
+ :isRepeat="isRepeat"
12
+ :movable="movable"
13
+ :gapX="gapX"
14
+ :gapY="gapY"
15
+ :offset="offset"
16
+ :lineSpace="lineSpace"
17
+ >
18
+ <slot></slot>
19
+ </t-watermark>
20
+ </template>
21
+
22
+ <script>
23
+ export default {
24
+ name: "EbizWatermark"
25
+ }
26
+ </script>
27
+
28
+ <script setup>
29
+ import { defineProps } from 'vue';
30
+ import { Watermark as TWatermark } from 'tdesign-vue-next';
31
+
32
+ defineProps({
33
+ // 水印透明度
34
+ alpha: {
35
+ type: Number,
36
+ default: 1
37
+ },
38
+ // 水印内容
39
+ watermarkContent: {
40
+ type: [String, Object],
41
+ default: () => ({ text: '' })
42
+ },
43
+ // 水印宽度
44
+ width: {
45
+ type: Number,
46
+ default: 120
47
+ },
48
+ // 水印高度
49
+ height: {
50
+ type: Number,
51
+ default: 64
52
+ },
53
+ // 水印x轴偏移量
54
+ x: {
55
+ type: Number,
56
+ default: 0
57
+ },
58
+ // 水印y轴偏移量
59
+ y: {
60
+ type: Number,
61
+ default: 0
62
+ },
63
+ // 水印旋转角度
64
+ rotate: {
65
+ type: Number,
66
+ default: -22
67
+ },
68
+ // 水印层级
69
+ zIndex: {
70
+ type: Number,
71
+ default: 9
72
+ },
73
+ // 水印是否重复铺满整个页面
74
+ isRepeat: {
75
+ type: Boolean,
76
+ default: true
77
+ },
78
+ // 水印是否可移动
79
+ movable: {
80
+ type: Boolean,
81
+ default: false
82
+ },
83
+ // 水印之间的水平间距
84
+ gapX: {
85
+ type: Number,
86
+ default: 212
87
+ },
88
+ // 水印之间的垂直间距
89
+ gapY: {
90
+ type: Number,
91
+ default: 222
92
+ },
93
+ // 水印整体的偏移量
94
+ offset: {
95
+ type: Array,
96
+ default: () => [0, 0]
97
+ },
98
+ // 多行水印的行间距
99
+ lineSpace: {
100
+ type: Number,
101
+ default: 16
102
+ }
103
+ });
104
+ </script>
105
+
106
+ <style lang="less" scoped>
107
+ /* 自定义样式 */
108
+ </style>
package/src/index.js CHANGED
@@ -39,6 +39,14 @@ import EbizTextarea from "./components/TdesignTextarea.vue";
39
39
  import EbizUpload from "./components/TdesignUpload.vue";
40
40
  import EbizGrid from "./components/TdesignGrid.vue";
41
41
  import EbizCol from "./components/TdesignCol.vue";
42
+ import EbizTabs from "./components/EbizTabs.vue";
43
+ import EbizTabPanel from "./components/EbizTabPanel.vue";
44
+ import EbizStatistic from "./components/EbizStatistic.vue";
45
+ import EbizWatermark from "./components/TdesignWatermark.vue";
46
+ import EbizAvatar from "./components/EbizAvatar.vue";
47
+ import EbizEmployeeInfo from "./components/EbizEmployeeInfo.vue";
48
+ import EbizAlert from "./components/TdesignAlert.vue";
49
+ import { MessagePlugin as EbizMessage } from 'tdesign-vue-next';
42
50
 
43
51
  // 导入简洁数据服务
44
52
  import dataService from "./apiService/simpleDataService";
@@ -48,6 +56,10 @@ import "tdesign-vue-next/es/style/index.css";
48
56
  // 导入图表样式
49
57
  import "./assets/styles/charts/main.less";
50
58
 
59
+ // 时间轴组件
60
+ import EbizTimeline from "./components/TdesignTimeline.vue";
61
+ import {TimelineItem as EbizTimelineItem} from 'tdesign-vue-next';
62
+
51
63
  // 导出组件
52
64
  export {
53
65
  MyComponent,
@@ -110,4 +122,23 @@ export {
110
122
  EbizGrid,
111
123
  // 栅格列组件
112
124
  EbizCol,
125
+ // 选项卡组件
126
+ EbizTabs,
127
+ // 选项卡面板组件
128
+ EbizTabPanel,
129
+ // 统计数值组件
130
+ EbizStatistic,
131
+ // 消息插件
132
+ EbizMessage,
133
+ // 时间轴组件
134
+ EbizTimeline,
135
+ EbizTimelineItem,
136
+ // 水印组件
137
+ EbizWatermark,
138
+ // 头像组件
139
+ EbizAvatar,
140
+ // 员工信息组件
141
+ EbizEmployeeInfo,
142
+ // 提示组件
143
+ EbizAlert
113
144
  };
@@ -186,6 +186,48 @@ const routes = [
186
186
  name: 'Grid',
187
187
  component: () => import('../views/GridDemo.vue'),
188
188
  meta: { title: 'TDesign栅格组件示例' }
189
+ },
190
+ {
191
+ path: '/tabs',
192
+ name: 'Tabs',
193
+ component: () => import('../views/TabsDemo.vue'),
194
+ meta: { title: 'Ebiz选项卡组件示例' }
195
+ },
196
+ {
197
+ path: '/statistic',
198
+ name: 'Statistic',
199
+ component: () => import('../views/StatisticDemo.vue'),
200
+ meta: { title: 'Ebiz统计数值组件示例' }
201
+ },
202
+ {
203
+ path: '/timeline',
204
+ name: 'Timeline',
205
+ component: () => import('../views/TimelineDemo.vue'),
206
+ meta: { title: 'Ebiz时间轴组件示例' }
207
+ },
208
+ {
209
+ path: '/watermark',
210
+ name: 'Watermark',
211
+ component: () => import('../views/WatermarkDemo.vue'),
212
+ meta: { title: 'TDesign水印组件示例' }
213
+ },
214
+ {
215
+ path: '/ebiz-avatar',
216
+ name: 'EbizAvatar',
217
+ component: () => import('../views/EbizAvatar.vue'),
218
+ meta: { title: 'Ebiz头像组件示例' }
219
+ },
220
+ {
221
+ path: '/ebiz-employee-info',
222
+ name: 'EbizEmployeeInfo',
223
+ component: () => import('../views/EbizEmployeeInfo.vue'),
224
+ meta: { title: 'Ebiz员工信息组件示例' }
225
+ },
226
+ {
227
+ path: '/tdesign-alert',
228
+ name: 'TdesignAlert',
229
+ component: () => import('../views/TdesignAlert.vue'),
230
+ meta: { title: 'TDesign提示组件示例' }
189
231
  }
190
232
  ]
191
233
 
@@ -0,0 +1,224 @@
1
+ <template>
2
+ <div class="container">
3
+ <h1>EbizAvatar 头像组件示例</h1>
4
+
5
+ <div class="section">
6
+ <h2>基础用法</h2>
7
+ <div class="example-block">
8
+ <ebiz-avatar content="用户" />
9
+ </div>
10
+ <div class="code-block">
11
+ <pre><code>&lt;ebiz-avatar content="用户" /&gt;</code></pre>
12
+ </div>
13
+ </div>
14
+
15
+ <div class="section">
16
+ <h2>不同形状</h2>
17
+ <div class="example-block avatar-shape-container">
18
+ <div v-for="shape in shapeList" :key="shape" class="avatar-shape-item">
19
+ <ebiz-avatar
20
+ content="用户"
21
+ :shape="shape"
22
+ />
23
+ <div class="avatar-shape-text">shape: {{ shape }}</div>
24
+ </div>
25
+ </div>
26
+ <div class="code-block">
27
+ <pre><code>// 可选值: circle(默认), round
28
+ &lt;ebiz-avatar
29
+ content="用户"
30
+ shape="round"
31
+ /&gt;</code></pre>
32
+ </div>
33
+ </div>
34
+
35
+ <div class="section">
36
+ <h2>不同尺寸</h2>
37
+ <div class="example-block avatar-size-container">
38
+ <div v-for="size in sizeList" :key="size" class="avatar-size-item">
39
+ <ebiz-avatar
40
+ content="用户"
41
+ :size="size"
42
+ />
43
+ <div class="avatar-size-text">size: {{ size }}</div>
44
+ </div>
45
+ </div>
46
+ <div class="code-block">
47
+ <pre><code>// 可选值: small, medium(默认), large
48
+ &lt;ebiz-avatar
49
+ content="用户"
50
+ size="large"
51
+ /&gt;</code></pre>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="section">
56
+ <h2>图片头像</h2>
57
+ <div class="example-block">
58
+ <ebiz-avatar
59
+ image="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
60
+ alt="用户头像"
61
+ />
62
+ </div>
63
+ <div class="code-block">
64
+ <pre><code>&lt;ebiz-avatar
65
+ image="https://tdesign.tencent.com/vue-next/assets/image1.jpg"
66
+ alt="用户头像"
67
+ /&gt;</code></pre>
68
+ </div>
69
+ </div>
70
+
71
+ <div class="section">
72
+ <h2>自定义尺寸</h2>
73
+ <div class="example-block">
74
+ <ebiz-avatar
75
+ content="用户"
76
+ width="100px"
77
+ height="100px"
78
+ />
79
+ </div>
80
+ <div class="code-block">
81
+ <pre><code>&lt;ebiz-avatar
82
+ content="用户"
83
+ width="100px"
84
+ height="100px"
85
+ /&gt;</code></pre>
86
+ </div>
87
+ </div>
88
+
89
+ <div class="section">
90
+ <h2>带徽标的头像</h2>
91
+ <div class="example-block">
92
+ <ebiz-avatar
93
+ content="用户"
94
+ :badge-props="{ count: 5 }"
95
+ />
96
+ </div>
97
+ <div class="code-block">
98
+ <pre><code>&lt;ebiz-avatar
99
+ content="用户"
100
+ :badge-props="{ count: 5 }"
101
+ /&gt;</code></pre>
102
+ </div>
103
+ </div>
104
+
105
+ <div class="section">
106
+ <h2>图标头像</h2>
107
+ <div class="example-block">
108
+ <ebiz-avatar>
109
+ <template #icon>
110
+ <t-icon name="user" />
111
+ </template>
112
+ </ebiz-avatar>
113
+ </div>
114
+ <div class="code-block">
115
+ <pre><code>&lt;ebiz-avatar&gt;
116
+ &lt;template #icon&gt;
117
+ &lt;t-icon name="user" /&gt;
118
+ &lt;/template&gt;
119
+ &lt;/ebiz-avatar&gt;</code></pre>
120
+ </div>
121
+ </div>
122
+
123
+ <div class="section">
124
+ <h2>图片加载失败处理</h2>
125
+ <div class="example-block">
126
+ <ebiz-avatar
127
+ image="https://non-existent-image.jpg"
128
+ content="用户"
129
+ :hide-on-load-error="false"
130
+ @error="handleError"
131
+ />
132
+ </div>
133
+ <div class="code-block">
134
+ <pre><code>&lt;ebiz-avatar
135
+ image="https://non-existent-image.jpg"
136
+ content="用户"
137
+ :hide-on-load-error="false"
138
+ @error="handleError"
139
+ /&gt;</code></pre>
140
+ </div>
141
+ </div>
142
+ </div>
143
+ </template>
144
+
145
+ <script>
146
+ import { EbizAvatar } from '../index.js'
147
+ import { Icon as TIcon } from 'tdesign-vue-next'
148
+
149
+ export default {
150
+ name: 'EbizAvatarDemo',
151
+ components: {
152
+ EbizAvatar,
153
+ TIcon
154
+ },
155
+ data() {
156
+ return {
157
+ shapeList: ['circle', 'round'],
158
+ sizeList: ['small', 'medium', 'large']
159
+ }
160
+ },
161
+ methods: {
162
+ handleError(context) {
163
+ console.log('图片加载失败', context)
164
+ }
165
+ }
166
+ }
167
+ </script>
168
+
169
+ <style lang="less" scoped>
170
+ .container {
171
+ padding: 20px;
172
+
173
+ h1 {
174
+ margin-bottom: 20px;
175
+ }
176
+
177
+ .section {
178
+ margin-bottom: 30px;
179
+
180
+ h2 {
181
+ margin-bottom: 15px;
182
+ }
183
+
184
+ .example-block {
185
+ margin-bottom: 15px;
186
+ padding: 20px;
187
+ border: 1px solid #eee;
188
+ border-radius: 4px;
189
+ }
190
+
191
+ .code-block {
192
+ background-color: #f5f5f5;
193
+ padding: 15px;
194
+ border-radius: 4px;
195
+
196
+ pre {
197
+ margin: 0;
198
+ white-space: pre-wrap;
199
+ }
200
+ }
201
+ }
202
+
203
+ .avatar-shape-container,
204
+ .avatar-size-container {
205
+ display: flex;
206
+ flex-wrap: wrap;
207
+ gap: 20px;
208
+ }
209
+
210
+ .avatar-shape-item,
211
+ .avatar-size-item {
212
+ display: flex;
213
+ flex-direction: column;
214
+ align-items: center;
215
+ }
216
+
217
+ .avatar-shape-text,
218
+ .avatar-size-text {
219
+ margin-top: 10px;
220
+ font-size: 14px;
221
+ color: #666;
222
+ }
223
+ }
224
+ </style>