@ebiz/designer-components 0.0.18-beta.6 → 0.0.18-beta.8
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 +1 -1
- package/src/apiService/mockDataService.js +116 -0
- package/src/apiService/simpleDataService.js +1 -1
- package/src/apiService/simpleDataServiceAppData.js +278 -0
- package/src/components/Button.vue +2 -2
- package/src/components/EbizRemoteSelect.vue +98 -41
- package/src/components/EbizTabHeader.vue +2 -2
- package/src/components/TdesignCalendar/index.vue +6 -3
- package/src/components/TdesignDialog.vue +249 -0
- package/src/components/TdesignUpload.vue +68 -99
- package/src/index.js +61 -56
- package/src/main.js +5 -3
- package/src/router/index.js +6 -0
- package/src/views/DialogDemo.vue +126 -0
- package/src/views/Home.vue +2 -1
- package/src/views/RemoteSelect.vue +336 -5
@@ -14,7 +14,7 @@
|
|
14
14
|
:month-change="monthChange"
|
15
15
|
:render-cell="renderCell"
|
16
16
|
:theme="theme"
|
17
|
-
:value="
|
17
|
+
:value="modelValue"
|
18
18
|
:year="year"
|
19
19
|
@cell-click="handleCellClick"
|
20
20
|
@cell-double-click="handleCellDoubleClick"
|
@@ -111,7 +111,7 @@ export default {
|
|
111
111
|
default: 'full',
|
112
112
|
validator: (val) => ['full', 'card'].includes(val)
|
113
113
|
},
|
114
|
-
|
114
|
+
modelValue: {
|
115
115
|
type: [String, Number, Array, Date],
|
116
116
|
default: null
|
117
117
|
},
|
@@ -120,10 +120,13 @@ export default {
|
|
120
120
|
default: undefined
|
121
121
|
}
|
122
122
|
},
|
123
|
-
emits: ['cell-click', 'cell-double-click', 'cell-right-click', 'month-change'],
|
123
|
+
emits: ['cell-click', 'cell-double-click', 'cell-right-click', 'month-change', 'update:modelValue'],
|
124
124
|
methods: {
|
125
125
|
handleCellClick(options) {
|
126
126
|
this.$emit('cell-click', options)
|
127
|
+
if (options && options.date) {
|
128
|
+
this.$emit('update:modelValue', options.date)
|
129
|
+
}
|
127
130
|
},
|
128
131
|
handleCellDoubleClick(options) {
|
129
132
|
this.$emit('cell-double-click', options)
|
@@ -0,0 +1,249 @@
|
|
1
|
+
<template>
|
2
|
+
<t-dialog
|
3
|
+
v-model:visible="isVisible"
|
4
|
+
:attach="attach"
|
5
|
+
:body="body"
|
6
|
+
:cancel-btn="cancelBtn"
|
7
|
+
:close-btn="closeBtn"
|
8
|
+
:close-on-esc-keydown="closeOnEscKeydown"
|
9
|
+
:close-on-overlay-click="closeOnOverlayClick"
|
10
|
+
:confirm-btn="confirmBtn"
|
11
|
+
:default-visible="defaultVisible"
|
12
|
+
:destroy-on-close="destroyOnClose"
|
13
|
+
:draggable="draggable"
|
14
|
+
:footer="footer"
|
15
|
+
:header="header"
|
16
|
+
:mode="mode"
|
17
|
+
:placement="placement"
|
18
|
+
:show-overlay="showOverlay"
|
19
|
+
:width="width"
|
20
|
+
:z-index="zIndex"
|
21
|
+
@cancel="handleCancel"
|
22
|
+
@close="handleClose"
|
23
|
+
@close-btn-click="handleCloseBtnClick"
|
24
|
+
@confirm="handleConfirm"
|
25
|
+
@esc-keydown="handleEscKeydown"
|
26
|
+
@overlay-click="handleOverlayClick"
|
27
|
+
@opened="handleOpened"
|
28
|
+
@closed="handleClosed"
|
29
|
+
@update:visible="handleUpdateVisible"
|
30
|
+
>
|
31
|
+
<!-- 头部插槽 -->
|
32
|
+
<template v-if="$slots.header" #header>
|
33
|
+
<slot name="header"></slot>
|
34
|
+
</template>
|
35
|
+
|
36
|
+
<!-- 内容插槽 -->
|
37
|
+
<template v-if="$slots.body" #body>
|
38
|
+
<slot name="body"></slot>
|
39
|
+
</template>
|
40
|
+
|
41
|
+
<!-- 默认插槽 -->
|
42
|
+
<slot></slot>
|
43
|
+
|
44
|
+
<!-- 页脚插槽 -->
|
45
|
+
<template v-if="$slots.footer" #footer>
|
46
|
+
<slot name="footer"></slot>
|
47
|
+
</template>
|
48
|
+
|
49
|
+
<!-- 取消按钮插槽 -->
|
50
|
+
<template v-if="$slots.cancelBtn" #cancel-btn>
|
51
|
+
<slot name="cancelBtn"></slot>
|
52
|
+
</template>
|
53
|
+
|
54
|
+
<!-- 确认按钮插槽 -->
|
55
|
+
<template v-if="$slots.confirmBtn" #confirm-btn>
|
56
|
+
<slot name="confirmBtn"></slot>
|
57
|
+
</template>
|
58
|
+
</t-dialog>
|
59
|
+
</template>
|
60
|
+
|
61
|
+
<script>
|
62
|
+
export default {
|
63
|
+
name: "EbizDialog"
|
64
|
+
}
|
65
|
+
</script>
|
66
|
+
|
67
|
+
<script setup>
|
68
|
+
import { ref, watch } from 'vue';
|
69
|
+
import { Dialog as TDialog } from 'tdesign-vue-next';
|
70
|
+
|
71
|
+
// 定义属性
|
72
|
+
const props = defineProps({
|
73
|
+
// 对话框挂载的节点
|
74
|
+
attach: {
|
75
|
+
type: [String, Function, Element],
|
76
|
+
default: 'body'
|
77
|
+
},
|
78
|
+
// 对话框内容
|
79
|
+
body: {
|
80
|
+
type: [String, Function],
|
81
|
+
default: ''
|
82
|
+
},
|
83
|
+
// 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性
|
84
|
+
cancelBtn: {
|
85
|
+
type: [String, Object, null],
|
86
|
+
default: ''
|
87
|
+
},
|
88
|
+
// 关闭按钮,值为 true 显示默认关闭按钮;值为 false 则不显示关闭按钮;值类型为 string 则直接显示值;值类型为 TNode,则显示自定义按钮
|
89
|
+
closeBtn: {
|
90
|
+
type: [Boolean, String, Function],
|
91
|
+
default: true
|
92
|
+
},
|
93
|
+
// 按下 ESC 时是否触发对话框关闭
|
94
|
+
closeOnEscKeydown: {
|
95
|
+
type: Boolean,
|
96
|
+
default: undefined
|
97
|
+
},
|
98
|
+
// 点击蒙层时是否触发关闭
|
99
|
+
closeOnOverlayClick: {
|
100
|
+
type: Boolean,
|
101
|
+
default: undefined
|
102
|
+
},
|
103
|
+
// 确认按钮,可自定义。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性
|
104
|
+
confirmBtn: {
|
105
|
+
type: [String, Object, null],
|
106
|
+
default: ''
|
107
|
+
},
|
108
|
+
// 对话框默认是否显示
|
109
|
+
defaultVisible: {
|
110
|
+
type: Boolean,
|
111
|
+
default: false
|
112
|
+
},
|
113
|
+
// 是否在关闭弹框的时候销毁子元素
|
114
|
+
destroyOnClose: {
|
115
|
+
type: Boolean,
|
116
|
+
default: false
|
117
|
+
},
|
118
|
+
// 对话框是否可以拖拽
|
119
|
+
draggable: {
|
120
|
+
type: Boolean,
|
121
|
+
default: false
|
122
|
+
},
|
123
|
+
// 底部操作栏,默认会有"确认"和"取消"两个按钮
|
124
|
+
footer: {
|
125
|
+
type: [Boolean, Function],
|
126
|
+
default: true
|
127
|
+
},
|
128
|
+
// 头部内容
|
129
|
+
header: {
|
130
|
+
type: [String, Boolean, Function],
|
131
|
+
default: true
|
132
|
+
},
|
133
|
+
// 对话框类型
|
134
|
+
mode: {
|
135
|
+
type: String,
|
136
|
+
default: 'modal',
|
137
|
+
validator: (val) => ['modal', 'modeless', 'full-screen'].includes(val)
|
138
|
+
},
|
139
|
+
// 对话框位置,类似 CSS 中的 position
|
140
|
+
placement: {
|
141
|
+
type: String,
|
142
|
+
default: 'top',
|
143
|
+
validator: (val) => ['top', 'center'].includes(val)
|
144
|
+
},
|
145
|
+
// 是否显示遮罩层
|
146
|
+
showOverlay: {
|
147
|
+
type: Boolean,
|
148
|
+
default: true
|
149
|
+
},
|
150
|
+
// 控制对话框显示与隐藏
|
151
|
+
visible: {
|
152
|
+
type: Boolean,
|
153
|
+
default: undefined
|
154
|
+
},
|
155
|
+
// 对话框宽度
|
156
|
+
width: {
|
157
|
+
type: [String, Number],
|
158
|
+
default: undefined
|
159
|
+
},
|
160
|
+
// 对话框层级
|
161
|
+
zIndex: {
|
162
|
+
type: Number,
|
163
|
+
default: undefined
|
164
|
+
}
|
165
|
+
});
|
166
|
+
|
167
|
+
// 显示状态
|
168
|
+
const isVisible = ref(props.defaultVisible);
|
169
|
+
|
170
|
+
// 监听visible属性变化
|
171
|
+
watch(() => props.visible, (newValue) => {
|
172
|
+
if (newValue !== undefined) {
|
173
|
+
isVisible.value = newValue;
|
174
|
+
}
|
175
|
+
});
|
176
|
+
|
177
|
+
// 定义事件
|
178
|
+
const emit = defineEmits([
|
179
|
+
'cancel',
|
180
|
+
'close',
|
181
|
+
'close-btn-click',
|
182
|
+
'confirm',
|
183
|
+
'esc-keydown',
|
184
|
+
'overlay-click',
|
185
|
+
'opened',
|
186
|
+
'closed',
|
187
|
+
'update:visible'
|
188
|
+
]);
|
189
|
+
|
190
|
+
// 取消按钮点击事件
|
191
|
+
const handleCancel = (e) => {
|
192
|
+
emit('cancel', { e });
|
193
|
+
emit('close', { trigger: 'cancel', e });
|
194
|
+
emit('update:visible', false);
|
195
|
+
};
|
196
|
+
|
197
|
+
// 关闭事件
|
198
|
+
const handleClose = (context) => {
|
199
|
+
emit('close', context);
|
200
|
+
emit('update:visible', false);
|
201
|
+
};
|
202
|
+
|
203
|
+
// 关闭按钮点击事件
|
204
|
+
const handleCloseBtnClick = (e) => {
|
205
|
+
emit('close-btn-click', { e });
|
206
|
+
emit('close', { trigger: 'close-btn', e });
|
207
|
+
emit('update:visible', false);
|
208
|
+
};
|
209
|
+
|
210
|
+
// 确认按钮点击事件
|
211
|
+
const handleConfirm = (e) => {
|
212
|
+
emit('confirm', { e });
|
213
|
+
emit('update:visible', false);
|
214
|
+
};
|
215
|
+
|
216
|
+
// ESC 按键按下事件
|
217
|
+
const handleEscKeydown = (e) => {
|
218
|
+
emit('esc-keydown', { e });
|
219
|
+
emit('close', { trigger: 'esc', e });
|
220
|
+
emit('update:visible', false);
|
221
|
+
};
|
222
|
+
|
223
|
+
// 遮罩层点击事件
|
224
|
+
const handleOverlayClick = (e) => {
|
225
|
+
emit('overlay-click', { e });
|
226
|
+
emit('close', { trigger: 'overlay', e });
|
227
|
+
emit('update:visible', false);
|
228
|
+
};
|
229
|
+
|
230
|
+
// 对话框打开完成事件
|
231
|
+
const handleOpened = () => {
|
232
|
+
emit('opened');
|
233
|
+
};
|
234
|
+
|
235
|
+
// 对话框关闭完成事件
|
236
|
+
const handleClosed = () => {
|
237
|
+
emit('closed');
|
238
|
+
};
|
239
|
+
|
240
|
+
// 更新可见状态
|
241
|
+
const handleUpdateVisible = (visible) => {
|
242
|
+
isVisible.value = visible;
|
243
|
+
emit('update:visible', visible);
|
244
|
+
};
|
245
|
+
</script>
|
246
|
+
|
247
|
+
<style lang="less" scoped>
|
248
|
+
/* 自定义样式 */
|
249
|
+
</style>
|