@ebiz/designer-components 0.0.18-tj.1 → 0.0.19-beta.1

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 (70) hide show
  1. package/dist/designer-components.css +1 -1
  2. package/dist/index.mjs +66100 -52710
  3. package/package.json +1 -1
  4. package/src/apiService/mockDataService.js +116 -0
  5. package/src/apiService/simpleDataService.js +186 -80
  6. package/src/components/Button.vue +72 -22
  7. package/src/components/EbizAvatar.vue +116 -0
  8. package/src/components/EbizCheckbox.vue +94 -0
  9. package/src/components/EbizCheckboxGroup.vue +70 -0
  10. package/src/components/EbizDetailBlock.vue +82 -0
  11. package/src/components/EbizDialog.vue +249 -0
  12. package/src/components/EbizEmployeeInfo.vue +139 -0
  13. package/src/components/EbizPageHeader.vue +96 -0
  14. package/src/components/EbizPagination.vue +163 -0
  15. package/src/components/EbizRadio.vue +87 -0
  16. package/src/components/EbizRadioGroup.vue +84 -0
  17. package/src/components/EbizRemoteSelect.vue +107 -41
  18. package/src/components/EbizStatistic.vue +150 -0
  19. package/src/components/EbizSwiper.vue +3 -3
  20. package/src/components/EbizSwitch.vue +86 -0
  21. package/src/components/EbizTabHeader.vue +6 -10
  22. package/src/components/EbizTabPanel.vue +23 -0
  23. package/src/components/EbizTable.vue +466 -0
  24. package/src/components/EbizTableColumn.vue +117 -0
  25. package/src/components/EbizTableSort.vue +181 -0
  26. package/src/components/EbizTabs.vue +143 -0
  27. package/src/components/EbizTimePicker.vue +144 -0
  28. package/src/components/EbizTitle.vue +36 -37
  29. package/src/components/EbizTree.vue +153 -0
  30. package/src/components/EbizTreeSelector.vue +418 -0
  31. package/src/components/TdesignAlert.vue +116 -0
  32. package/src/components/TdesignCalendar/index.vue +6 -3
  33. package/src/components/TdesignCol.vue +102 -0
  34. package/src/components/TdesignDialog.vue +226 -0
  35. package/src/components/TdesignGrid.vue +56 -0
  36. package/src/components/TdesignInput.vue +23 -23
  37. package/src/components/TdesignTextarea.vue +143 -0
  38. package/src/components/TdesignTimeline.vue +58 -0
  39. package/src/components/TdesignTimelineItem.vue +72 -0
  40. package/src/components/TdesignUpload.vue +757 -0
  41. package/src/components/TdesignWatermark.vue +108 -0
  42. package/src/index.js +85 -0
  43. package/src/main.js +2 -2
  44. package/src/router/index.js +160 -5
  45. package/src/views/Button.vue +7 -3
  46. package/src/views/CheckboxDemo.vue +105 -0
  47. package/src/views/DialogDemo.vue +126 -0
  48. package/src/views/EbizAvatar.vue +224 -0
  49. package/src/views/EbizDetailBlockDemo.vue +31 -0
  50. package/src/views/EbizEmployeeInfo.vue +250 -0
  51. package/src/views/EbizRadioDemo.vue +152 -0
  52. package/src/views/GridDemo.vue +239 -0
  53. package/src/views/Home.vue +49 -2
  54. package/src/views/PageHeaderDemo.vue +105 -0
  55. package/src/views/PaginationDemo.vue +97 -0
  56. package/src/views/RemoteSelect.vue +336 -5
  57. package/src/views/StatisticDemo.vue +191 -0
  58. package/src/views/SwitchDemo.vue +80 -0
  59. package/src/views/TableDemo.vue +335 -0
  60. package/src/views/TableSortDemo.vue +144 -0
  61. package/src/views/TableView.vue +69 -0
  62. package/src/views/TabsDemo.vue +283 -0
  63. package/src/views/TdesignAlert.vue +99 -0
  64. package/src/views/TextareaDemo.vue +94 -0
  65. package/src/views/TimePickerDemo.vue +147 -0
  66. package/src/views/TimelineDemo.vue +161 -0
  67. package/src/views/TreeDemo.vue +255 -0
  68. package/src/views/TreeSelectorDemo.vue +246 -0
  69. package/src/views/UploadDemo.vue +122 -0
  70. package/src/views/WatermarkDemo.vue +86 -0
@@ -1,14 +1,15 @@
1
1
  <template>
2
- <tiny-select ref="selectRef" v-model="selectedValue" :options="options" :loading="loading" :remote="true"
3
- :remote-method="handleRemoteSearch" :multiple="multiple" :placeholder="placeholder" :clearable="clearable"
4
- :disabled="disabled" @change="handleChange" @focus="handleRemoteSearch">
5
- <template #prefix>
2
+ <t-select ref="selectRef" v-model="selectedValue" :options="options" :loading="loading" :filterable="true"
3
+ @search="handleRemoteSearch" :multiple="multiple" :placeholder="placeholder" :clearable="clearable"
4
+ :disabled="disabled" :size="size" :empty="emptyText" :popupProps="popupProps" @change="handleChange"
5
+ @focus="handleFocus" @blur="handleBlur">
6
+ <template #prefixIcon v-if="$slots.prefix">
6
7
  <slot name="prefix"></slot>
7
8
  </template>
8
- <template #suffix>
9
+ <template #suffixIcon v-if="$slots.suffix">
9
10
  <slot name="suffix"></slot>
10
11
  </template>
11
- </tiny-select>
12
+ </t-select>
12
13
  </template>
13
14
 
14
15
  <script>
@@ -19,8 +20,8 @@ export default {
19
20
 
20
21
  <script setup>
21
22
  import { ref, onMounted, toRefs, computed } from 'vue';
22
- import { Select as TinySelect } from '@opentiny/vue';
23
- import dataService from "../apiService/simpleDataService";
23
+ import { Select as TSelect } from 'tdesign-vue-next';
24
+ import dataService from '../apiService/simpleDataService';
24
25
 
25
26
  const props = defineProps({
26
27
  /**
@@ -30,6 +31,7 @@ const props = defineProps({
30
31
  type: Object,
31
32
  required: true,
32
33
  default: () => ({
34
+ key: null,
33
35
  apiId: null,
34
36
  apiType: ''
35
37
  })
@@ -39,7 +41,9 @@ const props = defineProps({
39
41
  */
40
42
  queryParams: {
41
43
  type: Object,
42
- default: {}
44
+ default: () => ({
45
+ name: ''
46
+ })
43
47
  },
44
48
  /**
45
49
  * 是否多选
@@ -73,21 +77,54 @@ const props = defineProps({
73
77
  * 默认值
74
78
  */
75
79
  modelValue: {
76
- type: [String, Number],
80
+ type: [String, Number, Array],
77
81
  default: ''
78
82
  },
83
+ /**
84
+ * 选项配置
85
+ */
79
86
  optionsConfig: {
80
- labelField: '',//作为label的字段
81
- valueField: ''//作为value的字段
87
+ type: Object,
88
+ default: () => ({
89
+ labelField: '',
90
+ valueField: ''
91
+ })
92
+ },
93
+ /**
94
+ * 组件尺寸
95
+ */
96
+ size: {
97
+ type: String,
98
+ default: 'medium',
99
+ validator: (val) => ['small', 'medium', 'large'].includes(val)
100
+ },
101
+ /**
102
+ * 空数据文本
103
+ */
104
+ emptyText: {
105
+ type: String,
106
+ default: '暂无数据'
107
+ },
108
+ /**
109
+ * 弹出层配置
110
+ */
111
+ popupProps: {
112
+ type: Object,
113
+ default: () => ({})
82
114
  }
83
115
  });
84
116
 
85
117
  const { modelValue, apiConfig, queryParams } = toRefs(props)
86
118
 
87
- const emit = defineEmits(['update:modelValue', 'change']);
119
+ const emit = defineEmits(['update:modelValue', 'change', 'focus', 'blur']);
88
120
 
89
121
  // 选中的值
90
- const selectedValue = computed(() => modelValue.value)
122
+ const selectedValue = computed({
123
+ get: () => modelValue.value,
124
+ set: (val) => {
125
+ emit('update:modelValue', val);
126
+ }
127
+ });
91
128
 
92
129
  // 选项列表
93
130
  const options = ref([]);
@@ -104,37 +141,60 @@ const focus = () => {
104
141
  };
105
142
 
106
143
  defineExpose({
107
- focus
144
+ focus,
145
+ selectRef,
146
+ options
108
147
  });
109
148
 
110
149
  // 远程搜索处理函数
111
- const handleRemoteSearch = async () => {
112
- //if (options.value?.length > 0) return
113
-
150
+ const handleRemoteSearch = async (keyword) => {
114
151
  loading.value = true;
115
- if (apiConfig.value.apiId && apiConfig.value.apiType >= 0) {
116
- try {
117
- const params = {
118
- queryParams: queryParams.value
119
- };
120
- const res = await dataService.fetch(params, { apiId: props.apiConfig.apiId, apiType: 'MULTIPLE_DATA_SEARCH' });
121
- options.value = res.data.map(item => ({
122
- label: item.label || item.name,
123
- value: item.value || item.id
124
- }));
125
- } catch (error) {
126
- console.error('远程搜索失败:', error);
127
- options.value = [];
128
- } finally {
129
- loading.value = false;
130
- }
152
+ try {
153
+ const params = {
154
+ queryParams: {
155
+ ...queryParams.value,
156
+ name: keyword
157
+ }
158
+ };
159
+ const res = await dataService.fetch(params, {
160
+ key: props.apiConfig.key,
161
+ apiId: props.apiConfig.apiId,
162
+ apiType: 'MULTIPLE_DATA_SEARCH'
163
+ });
164
+ const { labelField, valueField } = props.optionsConfig;
165
+
166
+ options.value = res.data.map(item => ({
167
+ ...item,
168
+ label: labelField ? item[labelField] : (item.label || item.name),
169
+ value: valueField ? item[valueField] : (item.value || item.id)
170
+ }));
171
+ } catch (error) {
172
+ console.error('远程搜索失败:', error);
173
+ options.value = [];
174
+ } finally {
175
+ loading.value = false;
176
+ }
177
+
178
+ };
179
+
180
+ // 处理获取焦点事件
181
+ const handleFocus = (value, context) => {
182
+ emit('focus', value, context);
183
+ // 当选项为空时,初始加载数据
184
+ if (options.value.length === 0) {
185
+ handleRemoteSearch('');
131
186
  }
132
187
  };
133
188
 
189
+ // 处理失去焦点事件
190
+ const handleBlur = (value, context) => {
191
+ emit('blur', value, context);
192
+ };
193
+
134
194
  // 值变化处理函数
135
- const handleChange = (value) => {
195
+ const handleChange = (value, context) => {
136
196
  emit('update:modelValue', value);
137
- emit('change', value);
197
+ emit('change', value, context);
138
198
  };
139
199
 
140
200
  // 组件挂载时,如果有默认值则加载对应的选项
@@ -145,10 +205,17 @@ onMounted(async () => {
145
205
  const params = {
146
206
  queryParams: queryParams.value
147
207
  };
148
- const res = await dataService.fetch(params, { apiId: props.apiConfig.apiId, apiType: 'MULTIPLE_DATA_SEARCH' });
208
+ const res = await dataService.fetch(params, {
209
+ key: props.apiConfig.key,
210
+ apiId: props.apiConfig.apiId,
211
+ apiType: 'MULTIPLE_DATA_SEARCH'
212
+ });
213
+ const { labelField, valueField } = props.optionsConfig;
214
+
149
215
  options.value = res.data.map(item => ({
150
- label: item.label || item.name,
151
- value: item.value || item.id
216
+ ...item,
217
+ label: labelField ? item[labelField] : (item.label || item.name),
218
+ value: valueField ? item[valueField] : (item.value || item.id)
152
219
  }));
153
220
  } catch (error) {
154
221
  console.error('加载默认选项失败:', error);
@@ -156,12 +223,11 @@ onMounted(async () => {
156
223
  loading.value = false;
157
224
  }
158
225
  }
159
-
160
226
  });
161
227
  </script>
162
228
 
163
229
  <style scoped>
164
- .tiny-select {
230
+ .t-select {
165
231
  width: 100%;
166
232
  }
167
233
  </style>
@@ -0,0 +1,150 @@
1
+ <template>
2
+ <t-statistic
3
+ ref="statisticRef"
4
+ :animation="animation"
5
+ :animation-start="animationStart"
6
+ :color="color"
7
+ :decimalPlaces="decimalPlaces"
8
+ :loading="loading"
9
+ :prefix="prefix"
10
+ :suffix="suffix"
11
+ :title="title"
12
+ :trend="trend"
13
+ :trend-placement="trendPlacement"
14
+ :unit="unit"
15
+ :value="value"
16
+ @click="handleClick"
17
+ >
18
+ <!-- 加载中状态插槽 -->
19
+ <template v-if="$slots.loading" #loading>
20
+ <slot name="loading"></slot>
21
+ </template>
22
+
23
+ <!-- 前缀插槽 -->
24
+ <template v-if="$slots.prefix" #prefix>
25
+ <slot name="prefix"></slot>
26
+ </template>
27
+
28
+ <!-- 后缀插槽 -->
29
+ <template v-if="$slots.suffix" #suffix>
30
+ <slot name="suffix"></slot>
31
+ </template>
32
+
33
+ <!-- 标题插槽 -->
34
+ <template v-if="$slots.title" #title>
35
+ <slot name="title"></slot>
36
+ </template>
37
+
38
+ <!-- 趋势插槽 -->
39
+ <template v-if="$slots.trend" #trend>
40
+ <slot name="trend"></slot>
41
+ </template>
42
+
43
+ <!-- 单位插槽 -->
44
+ <template v-if="$slots.unit" #unit>
45
+ <slot name="unit"></slot>
46
+ </template>
47
+
48
+ <!-- 默认插槽 -->
49
+ <slot></slot>
50
+ </t-statistic>
51
+ </template>
52
+
53
+ <script>
54
+ export default {
55
+ name: "EbizStatistic"
56
+ }
57
+ </script>
58
+
59
+ <script setup>
60
+ import { defineProps, defineEmits, ref, onMounted } from 'vue';
61
+ import { Statistic as TStatistic } from 'tdesign-vue-next';
62
+
63
+ const props = defineProps({
64
+ // 数值动画配置
65
+ animation: {
66
+ type: Object,
67
+ default: () => ({}),
68
+ },
69
+ // 数值动画开始时间,单位:毫秒
70
+ animationStart: {
71
+ type: Boolean,
72
+ default: false,
73
+ },
74
+ // 颜色
75
+ color: {
76
+ type: String,
77
+ default: '',
78
+ },
79
+ // 小数位数
80
+ decimalPlaces: {
81
+ type: Number,
82
+ default: 0,
83
+ },
84
+ // 加载中状态
85
+ loading: {
86
+ type: Boolean,
87
+ default: false,
88
+ },
89
+ // 前缀内容
90
+ prefix: {
91
+ type: [String, Function],
92
+ default: '',
93
+ },
94
+ // 后缀内容
95
+ suffix: {
96
+ type: [String, Function],
97
+ default: '',
98
+ },
99
+ // 数值显示的标题
100
+ title: {
101
+ type: [String, Function],
102
+ default: '',
103
+ },
104
+ // 趋势
105
+ trend: {
106
+ type: String,
107
+ default: '',
108
+ validator: (val) => ['', 'increase', 'decrease'].includes(val)
109
+ },
110
+ // 趋势展示位置
111
+ trendPlacement: {
112
+ type: String,
113
+ default: 'left',
114
+ validator: (val) => ['left', 'right'].includes(val)
115
+ },
116
+ // 单位内容
117
+ unit: {
118
+ type: [String, Function],
119
+ default: '',
120
+ },
121
+ // 数值
122
+ value: {
123
+ type: Number,
124
+ default: 0,
125
+ },
126
+ });
127
+
128
+ const emit = defineEmits(['click']);
129
+
130
+ // 引用实例,用于调用组件的start方法
131
+ const statisticRef = ref(null);
132
+
133
+ // 点击事件
134
+ const handleClick = (e) => {
135
+ emit('click', e);
136
+ };
137
+
138
+ // 暴露start方法,用于手动开始动画
139
+ defineExpose({
140
+ start: () => {
141
+ if (statisticRef.value) {
142
+ statisticRef.value.start();
143
+ }
144
+ }
145
+ });
146
+ </script>
147
+
148
+ <style lang="less" scoped>
149
+ /* 自定义样式 */
150
+ </style>
@@ -1,19 +1,19 @@
1
1
  <template>
2
2
  <div>
3
- <t-swiper v-model="innerCurrent" :animation="animation" :autoplay="autoplay" :direction="direction"
3
+ <swiper v-model="innerCurrent" :animation="animation" :autoplay="autoplay" :direction="direction"
4
4
  :duration="duration" :height="height" :interval="interval" :loop="loop" :navigation="navigationConfig"
5
5
  :stop-on-hover="stopOnHover" :theme="theme" @change="handleChange">
6
6
  <slot></slot>
7
7
  <template v-if="$slots.navigation" #navigation>
8
8
  <slot name="navigation"></slot>
9
9
  </template>
10
- </t-swiper>
10
+ </swiper>
11
11
  </div>
12
12
  </template>
13
13
 
14
14
  <script setup>
15
15
  import { ref, computed, watch } from 'vue';
16
- // import { Swiper as TSwiper } from 'tdesign-vue-next';
16
+ import { Swiper } from 'tdesign-vue-next';
17
17
 
18
18
  const props = defineProps({
19
19
  // 轮播切换动画效果类型
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <t-switch
3
+ :modelValue="modelValue"
4
+ :customValue="customValue"
5
+ :disabled="disabled"
6
+ :label="label"
7
+ :loading="loading"
8
+ :size="size"
9
+ :theme="theme"
10
+ @change="handleChange"
11
+ @click="handleClick"
12
+ >
13
+ <!-- 标签插槽 -->
14
+ <template v-if="$slots.label" #label>
15
+ <slot name="label"></slot>
16
+ </template>
17
+ </t-switch>
18
+ </template>
19
+
20
+ <script>
21
+ export default {
22
+ name: "EbizSwitch"
23
+ }
24
+ </script>
25
+
26
+ <script setup>
27
+ import { defineProps, defineEmits } from 'vue';
28
+ import { Switch as TSwitch } from 'tdesign-vue-next';
29
+
30
+ const props = defineProps({
31
+ // 开关值,支持v-model
32
+ modelValue: {
33
+ type: [String, Number, Boolean],
34
+ default: false
35
+ },
36
+ // 自定义值
37
+ customValue: {
38
+ type: Array,
39
+ default: () => [true, false]
40
+ },
41
+ // 是否禁用组件
42
+ disabled: {
43
+ type: Boolean,
44
+ default: false
45
+ },
46
+ // 开关标签
47
+ label: {
48
+ type: [String, Array, Function],
49
+ default: undefined
50
+ },
51
+ // 是否处于加载中状态
52
+ loading: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ // 开关尺寸
57
+ size: {
58
+ type: String,
59
+ default: 'medium',
60
+ validator: (val) => ['small', 'medium', 'large'].includes(val)
61
+ },
62
+ // 开关风格
63
+ theme: {
64
+ type: String,
65
+ default: 'primary',
66
+ validator: (val) => ['primary', 'success', 'warning', 'danger'].includes(val)
67
+ }
68
+ });
69
+
70
+ const emit = defineEmits(['update:modelValue', 'change', 'click']);
71
+
72
+ // 值变化事件
73
+ const handleChange = (value, context) => {
74
+ emit('update:modelValue', value);
75
+ emit('change', value, context);
76
+ };
77
+
78
+ // 点击事件
79
+ const handleClick = (e) => {
80
+ emit('click', e);
81
+ };
82
+ </script>
83
+
84
+ <style lang="less" scoped>
85
+ /* 自定义样式 */
86
+ </style>
@@ -1,12 +1,7 @@
1
1
  <template>
2
2
  <tiny-tabs v-model="showTab" :tab-style="props.tabStyle" activeColor="#5e7ce0" @click="tabChange">
3
- <tiny-tab-item
4
- activeColor="#5e7ce0"
5
- v-for="i in showTabs"
6
- :key="i.value"
7
- :title="i.label"
8
- :name="i.value.toString()"
9
- />
3
+ <tiny-tab-item activeColor="#5e7ce0" v-for="i in showTabs" :key="i.value" :title="i.label"
4
+ :name="i.value.toString()" />
10
5
  </tiny-tabs>
11
6
  </template>
12
7
 
@@ -22,6 +17,7 @@ const props = defineProps({
22
17
  apiConfig: {
23
18
  type: Object,
24
19
  default: () => ({
20
+ key: null,
25
21
  apiId: null,
26
22
  apiType: 'MULTIPLE_DATA_SEARCH',
27
23
  }),
@@ -63,7 +59,7 @@ const remoteTabs = ref([])
63
59
 
64
60
  // 展示的tabs
65
61
  const showTabs = computed(() => {
66
- console.log(props.tabs,66, 110)
62
+ console.log(props.tabs, 66, 110)
67
63
  if (remoteTabs.value.length) return [{ label: '全部', value: '0' }, ...remoteTabs.value];
68
64
  if (props.tabs.length) return props.tabs
69
65
  return [{ label: '全部', value: '0' }]
@@ -87,7 +83,7 @@ watch(() => showTabs.value, () => {
87
83
 
88
84
  watch(() => props.apiConfig, (nVal) => {
89
85
  if (!nVal?.apiId) return
90
- dataService.fetch({ }, { apiId: nVal.apiId, apiType: 'MULTIPLE_DATA_SEARCH' }).then(res => {
86
+ dataService.fetch({}, { key: nVal.key, apiId: nVal.apiId, apiType: 'MULTIPLE_DATA_SEARCH' }).then(res => {
91
87
  remoteTabs.value = (res.data ?? []).map(i => ({
92
88
  label: i[props.labelKey],
93
89
  value: i[props.valueKey],
@@ -146,4 +142,4 @@ watch(() => props.apiConfig, (nVal) => {
146
142
  overflow: hidden;
147
143
  white-space: nowrap;
148
144
  }
149
- </style>
145
+ </style>
@@ -0,0 +1,23 @@
1
+ <template>
2
+ <tab-panel
3
+ :value="value"
4
+ :label="label"
5
+ :disabled="disabled"
6
+ :removable="removable"
7
+ :destroyOnHide="destroyOnHide"
8
+ :draggable="draggable"
9
+ @remove="handleRemove"
10
+ >
11
+ <slot></slot>
12
+ </tab-panel>
13
+ </template>
14
+
15
+ <script>
16
+ import { TabPanel } from 'tdesign-vue-next';
17
+
18
+ export default TabPanel;
19
+ </script>
20
+
21
+ <style lang="less" scoped>
22
+ /* 自定义样式 */
23
+ </style>