@ebiz/designer-components 0.0.18 → 0.0.19
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/package.json +3 -2
- package/src/apiService/mockDataService.js +116 -0
- package/src/apiService/simpleDataService.js +186 -80
- package/src/components/Button.vue +72 -22
- package/src/components/EbizAvatar.vue +116 -0
- package/src/components/EbizCheckbox.vue +94 -0
- package/src/components/EbizCheckboxGroup.vue +70 -0
- package/src/components/EbizDetailBlock.vue +82 -0
- package/src/components/EbizDialog.vue +244 -56
- package/src/components/EbizEmployeeInfo.vue +139 -0
- package/src/components/EbizFileUpload.vue +202 -0
- package/src/components/EbizPageHeader.vue +96 -0
- package/src/components/EbizPagination.vue +163 -0
- package/src/components/EbizRadio.vue +87 -0
- package/src/components/EbizRadioGroup.vue +84 -0
- package/src/components/EbizRemoteSelect.vue +118 -40
- package/src/components/EbizSpace.vue +101 -0
- package/src/components/EbizStatistic.vue +150 -0
- package/src/components/EbizSwiper.vue +114 -0
- package/src/components/EbizSwiperItem.vue +14 -0
- package/src/components/EbizSwitch.vue +86 -0
- package/src/components/EbizTabHeader.vue +145 -0
- package/src/components/EbizTabPanel.vue +23 -0
- package/src/components/EbizTable.vue +466 -0
- package/src/components/EbizTableColumn.vue +117 -0
- package/src/components/EbizTableSort.vue +181 -0
- package/src/components/EbizTabs.vue +133 -91
- package/src/components/EbizTimePicker.vue +144 -0
- package/src/components/EbizTitle.vue +3 -10
- package/src/components/EbizTree.vue +153 -0
- package/src/components/EbizTreeSelector.vue +423 -0
- package/src/components/Home.vue +8 -0
- package/src/components/TdesignAlert.vue +116 -0
- package/src/components/TdesignButton.vue +130 -0
- package/src/components/TdesignCalendar/index.vue +146 -0
- package/src/components/TdesignCard.vue +196 -0
- package/src/components/TdesignCol.vue +102 -0
- package/src/components/TdesignCollapse.vue +143 -0
- package/src/components/TdesignCollapsePanel.vue +80 -0
- package/src/components/TdesignDatePicker.vue +125 -0
- package/src/components/TdesignDialog.vue +226 -0
- package/src/components/TdesignForm.vue +134 -0
- package/src/components/TdesignFormItem.vue +106 -0
- package/src/components/TdesignGrid.vue +56 -0
- package/src/components/TdesignIcon.vue +68 -0
- package/src/components/TdesignImage.vue +163 -0
- package/src/components/TdesignImageViewer.vue +201 -0
- package/src/components/TdesignInput.vue +243 -0
- package/src/components/TdesignSelect.vue +445 -0
- package/src/components/TdesignTag.vue +118 -0
- package/src/components/TdesignTextarea.vue +143 -0
- package/src/components/TdesignTimeline.vue +58 -0
- package/src/components/TdesignTimelineItem.vue +72 -0
- package/src/components/TdesignUpload.vue +757 -0
- package/src/components/TdesignWatermark.vue +108 -0
- package/src/index.js +130 -0
- package/src/main.js +20 -4
- package/src/router/index.js +244 -5
- package/src/views/Button.vue +7 -3
- package/src/views/CheckboxDemo.vue +105 -0
- package/src/views/DialogDemo.vue +126 -0
- package/src/views/EbizAvatar.vue +224 -0
- package/src/views/EbizDetailBlockDemo.vue +31 -0
- package/src/views/EbizEmployeeInfo.vue +250 -0
- package/src/views/EbizRadioDemo.vue +152 -0
- package/src/views/EbizSpace.vue +186 -0
- package/src/views/EbizSwiper.vue +158 -0
- package/src/views/GridDemo.vue +239 -0
- package/src/views/Home.vue +63 -2
- package/src/views/PageHeaderDemo.vue +105 -0
- package/src/views/PaginationDemo.vue +97 -0
- package/src/views/RemoteSelect.vue +336 -5
- package/src/views/StatisticDemo.vue +191 -0
- package/src/views/SwitchDemo.vue +80 -0
- package/src/views/TableDemo.vue +335 -0
- package/src/views/TableSortDemo.vue +144 -0
- package/src/views/TableView.vue +69 -0
- package/src/views/TabsDemo.vue +283 -0
- package/src/views/TagDemo.vue +102 -0
- package/src/views/TdesignAlert.vue +99 -0
- package/src/views/TdesignButton.vue +191 -0
- package/src/views/TdesignCalendar.vue +95 -0
- package/src/views/TdesignCard.vue +297 -0
- package/src/views/TdesignCollapse.vue +294 -0
- package/src/views/TdesignDatePicker.vue +188 -0
- package/src/views/TdesignForm.vue +249 -0
- package/src/views/TdesignIcon.vue +204 -0
- package/src/views/TdesignImage.vue +216 -0
- package/src/views/TdesignImageViewer.vue +199 -0
- package/src/views/TdesignInput.vue +253 -0
- package/src/views/TdesignSelect.vue +474 -0
- package/src/views/TdesignSwiper.vue +158 -0
- package/src/views/TextareaDemo.vue +94 -0
- package/src/views/TimePickerDemo.vue +147 -0
- package/src/views/TimelineDemo.vue +161 -0
- package/src/views/TreeDemo.vue +255 -0
- package/src/views/TreeSelectorDemo.vue +246 -0
- package/src/views/UploadDemo.vue +122 -0
- package/src/views/WatermarkDemo.vue +86 -0
@@ -0,0 +1,246 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="tree-selector-demo">
|
3
|
+
<h2>树选择器组件演示</h2>
|
4
|
+
|
5
|
+
<div class="demo-section">
|
6
|
+
<h3>基础用法</h3>
|
7
|
+
<t-button @click="showBasicSelector">打开基础树选择器</t-button>
|
8
|
+
<div class="selected-data">
|
9
|
+
已选择: {{ selectedBasicData.length }} 项
|
10
|
+
<t-tag v-for="item in selectedBasicData" :key="item.value" class="selected-tag" closable @close="removeItem(item, 'basic')">
|
11
|
+
{{ item.label }}
|
12
|
+
</t-tag>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="demo-section">
|
17
|
+
<h3>预选中用法</h3>
|
18
|
+
<t-button @click="showPreselectedSelector">打开预选中树选择器</t-button>
|
19
|
+
<div class="selected-data">
|
20
|
+
已选择: {{ selectedPreData.length }} 项
|
21
|
+
<t-tag v-for="item in selectedPreData" :key="item.value" class="selected-tag" closable @close="removeItem(item, 'pre')">
|
22
|
+
{{ item.label }}
|
23
|
+
</t-tag>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="demo-section">
|
28
|
+
<h3>自定义禁用规则</h3>
|
29
|
+
<t-button @click="showCustomDisabledSelector">打开禁用员工选择树选择器</t-button>
|
30
|
+
<div class="selected-data">
|
31
|
+
已选择: {{ selectedDisabledData.length }} 项
|
32
|
+
<t-tag v-for="item in selectedDisabledData" :key="item.value" class="selected-tag" closable @close="removeItem(item, 'disabled')">
|
33
|
+
{{ item.label }}
|
34
|
+
</t-tag>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<!-- 基础树选择器 -->
|
39
|
+
<EbizTreeSelector
|
40
|
+
v-model="selectedBasicData"
|
41
|
+
:data="treeData"
|
42
|
+
title="选择人员/部门"
|
43
|
+
@change="handleChange"
|
44
|
+
/>
|
45
|
+
|
46
|
+
<!-- 预选中树选择器 -->
|
47
|
+
<EbizTreeSelector
|
48
|
+
v-model="selectedPreData"
|
49
|
+
:data="treeData"
|
50
|
+
title="预选中的树选择器"
|
51
|
+
/>
|
52
|
+
|
53
|
+
<!-- 自定义禁用规则树选择器 -->
|
54
|
+
<EbizTreeSelector
|
55
|
+
v-model="selectedDisabledData"
|
56
|
+
:data="treeData"
|
57
|
+
title="仅选择部门和岗位"
|
58
|
+
:disable-check="disableEmployeeCheck"
|
59
|
+
/>
|
60
|
+
</div>
|
61
|
+
</template>
|
62
|
+
|
63
|
+
<script setup>
|
64
|
+
import { ref } from 'vue';
|
65
|
+
import { MessagePlugin } from 'tdesign-vue-next';
|
66
|
+
import EbizTreeSelector from '../components/EbizTreeSelector.vue';
|
67
|
+
|
68
|
+
// 树形数据
|
69
|
+
const treeData = {
|
70
|
+
organization: [
|
71
|
+
{
|
72
|
+
label: "强瑞科技",
|
73
|
+
value: "1",
|
74
|
+
children: [
|
75
|
+
{
|
76
|
+
label: "总经办",
|
77
|
+
value: "1.1",
|
78
|
+
type: "department"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
label: "研发部",
|
82
|
+
value: "1.2",
|
83
|
+
type: "department",
|
84
|
+
children: [
|
85
|
+
{
|
86
|
+
label: "前端组",
|
87
|
+
value: "1.2.1",
|
88
|
+
type: "department"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
label: "后端组",
|
92
|
+
value: "1.2.2",
|
93
|
+
type: "department"
|
94
|
+
}
|
95
|
+
]
|
96
|
+
}
|
97
|
+
]
|
98
|
+
}
|
99
|
+
],
|
100
|
+
department: [
|
101
|
+
{
|
102
|
+
label: "总经办",
|
103
|
+
value: "1.1",
|
104
|
+
type: "department"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
label: "研发部",
|
108
|
+
value: "1.2",
|
109
|
+
type: "department",
|
110
|
+
children: [
|
111
|
+
{
|
112
|
+
label: "前端组",
|
113
|
+
value: "1.2.1",
|
114
|
+
type: "department"
|
115
|
+
},
|
116
|
+
{
|
117
|
+
label: "后端组",
|
118
|
+
value: "1.2.2",
|
119
|
+
type: "department"
|
120
|
+
}
|
121
|
+
]
|
122
|
+
},
|
123
|
+
{
|
124
|
+
label: "人事部",
|
125
|
+
value: "1.3",
|
126
|
+
type: "department"
|
127
|
+
}
|
128
|
+
],
|
129
|
+
position: [
|
130
|
+
{
|
131
|
+
label: "工程师",
|
132
|
+
value: "pos1",
|
133
|
+
type: "position",
|
134
|
+
children: [
|
135
|
+
{
|
136
|
+
label: "前端工程师",
|
137
|
+
value: "pos1.1",
|
138
|
+
type: "position"
|
139
|
+
},
|
140
|
+
{
|
141
|
+
label: "后端工程师",
|
142
|
+
value: "pos1.2",
|
143
|
+
type: "position"
|
144
|
+
}
|
145
|
+
]
|
146
|
+
},
|
147
|
+
{
|
148
|
+
label: "设计师",
|
149
|
+
value: "pos2",
|
150
|
+
type: "position"
|
151
|
+
}
|
152
|
+
],
|
153
|
+
employee: [
|
154
|
+
{
|
155
|
+
label: "张三",
|
156
|
+
value: "emp1",
|
157
|
+
type: "employee"
|
158
|
+
},
|
159
|
+
{
|
160
|
+
label: "李四",
|
161
|
+
value: "emp2",
|
162
|
+
type: "employee"
|
163
|
+
},
|
164
|
+
{
|
165
|
+
label: "王五",
|
166
|
+
value: "emp3",
|
167
|
+
type: "employee"
|
168
|
+
}
|
169
|
+
]
|
170
|
+
};
|
171
|
+
|
172
|
+
// 已选择数据
|
173
|
+
const selectedBasicData = ref([]);
|
174
|
+
const selectedPreData = ref([
|
175
|
+
{
|
176
|
+
label: "研发部",
|
177
|
+
value: "1.2",
|
178
|
+
type: "department"
|
179
|
+
},
|
180
|
+
{
|
181
|
+
label: "张三",
|
182
|
+
value: "emp1",
|
183
|
+
type: "employee"
|
184
|
+
}
|
185
|
+
]);
|
186
|
+
const selectedDisabledData = ref([]);
|
187
|
+
|
188
|
+
// 打开选择器
|
189
|
+
const showBasicSelector = () => {
|
190
|
+
document.querySelectorAll('.t-dialog')[0]?.classList.add('show-dialog');
|
191
|
+
};
|
192
|
+
|
193
|
+
const showPreselectedSelector = () => {
|
194
|
+
document.querySelectorAll('.t-dialog')[1]?.classList.add('show-dialog');
|
195
|
+
};
|
196
|
+
|
197
|
+
const showCustomDisabledSelector = () => {
|
198
|
+
document.querySelectorAll('.t-dialog')[2]?.classList.add('show-dialog');
|
199
|
+
};
|
200
|
+
|
201
|
+
// 自定义禁用检查(禁用员工选择)
|
202
|
+
const disableEmployeeCheck = (node) => {
|
203
|
+
return node.type === 'employee';
|
204
|
+
};
|
205
|
+
|
206
|
+
// 移除已选项
|
207
|
+
const removeItem = (item, type) => {
|
208
|
+
if (type === 'basic') {
|
209
|
+
selectedBasicData.value = selectedBasicData.value.filter(i => i.value !== item.value);
|
210
|
+
} else if (type === 'pre') {
|
211
|
+
selectedPreData.value = selectedPreData.value.filter(i => i.value !== item.value);
|
212
|
+
} else if (type === 'disabled') {
|
213
|
+
selectedDisabledData.value = selectedDisabledData.value.filter(i => i.value !== item.value);
|
214
|
+
}
|
215
|
+
};
|
216
|
+
|
217
|
+
// 监听变更
|
218
|
+
const handleChange = (value) => {
|
219
|
+
MessagePlugin.success(`选择变更,已选择 ${value.length} 项`);
|
220
|
+
};
|
221
|
+
</script>
|
222
|
+
|
223
|
+
<style scoped>
|
224
|
+
.tree-selector-demo {
|
225
|
+
padding: 20px;
|
226
|
+
}
|
227
|
+
|
228
|
+
.demo-section {
|
229
|
+
margin-bottom: 30px;
|
230
|
+
padding: 20px;
|
231
|
+
border: 1px solid #e0e0e0;
|
232
|
+
border-radius: 4px;
|
233
|
+
}
|
234
|
+
|
235
|
+
.selected-data {
|
236
|
+
margin-top: 16px;
|
237
|
+
padding: 10px;
|
238
|
+
background-color: #f5f5f5;
|
239
|
+
border-radius: 4px;
|
240
|
+
min-height: 40px;
|
241
|
+
}
|
242
|
+
|
243
|
+
.selected-tag {
|
244
|
+
margin: 4px;
|
245
|
+
}
|
246
|
+
</style>
|
@@ -0,0 +1,122 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="upload-demo-container">
|
3
|
+
<h2>上传组件示例</h2>
|
4
|
+
|
5
|
+
<div class="demo-section">
|
6
|
+
<h3>基础用法</h3>
|
7
|
+
<EbizUpload
|
8
|
+
:useInternalUpload="true"
|
9
|
+
:auto-upload="true"
|
10
|
+
tips="请选择文件上传"
|
11
|
+
>
|
12
|
+
<template #default>
|
13
|
+
<t-button>点击选择文件</t-button>
|
14
|
+
</template>
|
15
|
+
</EbizUpload>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="demo-section">
|
19
|
+
<h3>拖拽上传</h3>
|
20
|
+
<EbizUpload
|
21
|
+
:useInternalUpload="true"
|
22
|
+
:draggable="true"
|
23
|
+
:auto-upload="true"
|
24
|
+
tips="将文件拖拽到此区域即可上传"
|
25
|
+
/>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="demo-section">
|
29
|
+
<h3>多文件上传</h3>
|
30
|
+
<EbizUpload
|
31
|
+
:useInternalUpload="true"
|
32
|
+
:multiple="true"
|
33
|
+
:auto-upload="true"
|
34
|
+
tips="可选择多个文件上传"
|
35
|
+
/>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="demo-section">
|
39
|
+
<h3>图片上传</h3>
|
40
|
+
<EbizUpload
|
41
|
+
:useInternalUpload="true"
|
42
|
+
theme="image"
|
43
|
+
accept="image/*"
|
44
|
+
:auto-upload="true"
|
45
|
+
tips="请选择图片上传"
|
46
|
+
/>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div class="demo-section">
|
50
|
+
<h3>手动上传</h3>
|
51
|
+
<EbizUpload
|
52
|
+
:useInternalUpload="true"
|
53
|
+
:auto-upload="false"
|
54
|
+
tips="选择文件后需手动点击上传按钮"
|
55
|
+
/>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div class="demo-section">
|
59
|
+
<h3>文件大小限制</h3>
|
60
|
+
<EbizUpload
|
61
|
+
:useInternalUpload="true"
|
62
|
+
:size-limit="{ size: 1024, unit: 'KB' }"
|
63
|
+
:auto-upload="true"
|
64
|
+
tips="文件大小不能超过1MB"
|
65
|
+
/>
|
66
|
+
</div>
|
67
|
+
|
68
|
+
<div class="demo-section">
|
69
|
+
<h3>自定义上传按钮</h3>
|
70
|
+
<EbizUpload
|
71
|
+
:useInternalUpload="true"
|
72
|
+
:auto-upload="true"
|
73
|
+
theme="custom"
|
74
|
+
>
|
75
|
+
<template #default>
|
76
|
+
<t-button>点击选择文件</t-button>
|
77
|
+
</template>
|
78
|
+
</EbizUpload>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<div class="demo-section">
|
82
|
+
<h3>使用外部上传服务</h3>
|
83
|
+
<EbizUpload
|
84
|
+
:useInternalUpload="false"
|
85
|
+
action="https://service-bv448zsw-1257786608.gz.apigw.tencentcs.com/api/upload-demo"
|
86
|
+
:auto-upload="true"
|
87
|
+
tips="使用自定义上传地址"
|
88
|
+
/>
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
</template>
|
92
|
+
|
93
|
+
<script>
|
94
|
+
export default {
|
95
|
+
name: 'UploadDemo'
|
96
|
+
};
|
97
|
+
</script>
|
98
|
+
|
99
|
+
<script setup>
|
100
|
+
import { EbizUpload } from '../index.js';
|
101
|
+
import { Button as TButton } from 'tdesign-vue-next';
|
102
|
+
</script>
|
103
|
+
|
104
|
+
<style lang="less" scoped>
|
105
|
+
.upload-demo-container {
|
106
|
+
padding: 20px;
|
107
|
+
|
108
|
+
.demo-section {
|
109
|
+
margin-bottom: 30px;
|
110
|
+
padding: 20px;
|
111
|
+
border: 1px solid #eaeaea;
|
112
|
+
border-radius: 4px;
|
113
|
+
|
114
|
+
h3 {
|
115
|
+
margin-top: 0;
|
116
|
+
margin-bottom: 16px;
|
117
|
+
font-size: 16px;
|
118
|
+
font-weight: 500;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
122
|
+
</style>
|
@@ -0,0 +1,86 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="watermark-demo">
|
3
|
+
<h1>水印组件演示</h1>
|
4
|
+
<div class="demo-section">
|
5
|
+
<h2>基础用法</h2>
|
6
|
+
<div class="demo-card">
|
7
|
+
<EbizWatermark :watermarkContent="{ text: 'TDesign 水印示例' }">
|
8
|
+
<div class="content-box">
|
9
|
+
<p>这是被水印覆盖的内容</p>
|
10
|
+
<p>水印会显示在此内容之上</p>
|
11
|
+
</div>
|
12
|
+
</EbizWatermark>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<t-watermark :watermark-content="{ text: '文字水印' }" :y="120" :x="80" :width="120" :height="60">
|
17
|
+
<div style="width: 100%; height: 300px" />
|
18
|
+
</t-watermark>
|
19
|
+
|
20
|
+
<div class="demo-section">
|
21
|
+
<h2>自定义透明度和角度</h2>
|
22
|
+
<div class="demo-card">
|
23
|
+
<EbizWatermark :watermarkContent="{ text: 'TDesign 水印' }" :alpha="0.2" :rotate="0">
|
24
|
+
<div class="content-box">
|
25
|
+
<p>此水印透明度为0.2且角度为0</p>
|
26
|
+
</div>
|
27
|
+
</EbizWatermark>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="demo-section">
|
32
|
+
<h2>自定义间距和大小</h2>
|
33
|
+
<div class="demo-card">
|
34
|
+
<EbizWatermark :watermarkContent="{ text: '自定义水印' }" :width="150" :height="80" :gapX="100" :gapY="100">
|
35
|
+
<div class="content-box">
|
36
|
+
<p>此水印设置了自定义的宽高和间距</p>
|
37
|
+
</div>
|
38
|
+
</EbizWatermark>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div class="demo-section">
|
43
|
+
<h2>可移动水印</h2>
|
44
|
+
<div class="demo-card">
|
45
|
+
<EbizWatermark :watermarkContent="{ text: '可移动水印' }" :movable="true">
|
46
|
+
<div class="content-box">
|
47
|
+
<p>此水印可以随着页面滚动而移动</p>
|
48
|
+
</div>
|
49
|
+
</EbizWatermark>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</template>
|
54
|
+
|
55
|
+
<script setup>
|
56
|
+
import { EbizWatermark } from '../index.js';
|
57
|
+
import { Watermark as TWatermark } from 'tdesign-vue-next';
|
58
|
+
</script>
|
59
|
+
|
60
|
+
<style scoped>
|
61
|
+
.watermark-demo {
|
62
|
+
padding: 20px;
|
63
|
+
}
|
64
|
+
|
65
|
+
.demo-section {
|
66
|
+
margin-bottom: 30px;
|
67
|
+
}
|
68
|
+
|
69
|
+
.demo-card {
|
70
|
+
border: 1px solid #eee;
|
71
|
+
border-radius: 8px;
|
72
|
+
margin-top: 10px;
|
73
|
+
background-color: #fafafa;
|
74
|
+
overflow: hidden;
|
75
|
+
}
|
76
|
+
|
77
|
+
.content-box {
|
78
|
+
padding: 40px;
|
79
|
+
height: 200px;
|
80
|
+
display: flex;
|
81
|
+
flex-direction: column;
|
82
|
+
justify-content: center;
|
83
|
+
align-items: center;
|
84
|
+
text-align: center;
|
85
|
+
}
|
86
|
+
</style>
|