@tmagic/tdesign-vue-next-adapter 1.2.0-beta.25
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/dist/tmagic-tdesign-vue-next-adapter.js +408 -0
- package/dist/tmagic-tdesign-vue-next-adapter.js.map +1 -0
- package/dist/tmagic-tdesign-vue-next-adapter.umd.cjs +412 -0
- package/dist/tmagic-tdesign-vue-next-adapter.umd.cjs.map +1 -0
- package/package.json +55 -0
- package/src/DatePicker.vue +75 -0
- package/src/Input.vue +49 -0
- package/src/index.ts +383 -0
- package/src/shims-vue.d.ts +6 -0
- package/tsconfig.build.json +13 -0
- package/types/index.d.ts +2 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ElDropdown,
|
|
3
|
+
ElDropdownItem,
|
|
4
|
+
ElDropdownMenu,
|
|
5
|
+
ElIcon,
|
|
6
|
+
ElMessageBox,
|
|
7
|
+
ElPagination,
|
|
8
|
+
ElPopover,
|
|
9
|
+
ElScrollbar,
|
|
10
|
+
ElTable,
|
|
11
|
+
ElTableColumn,
|
|
12
|
+
ElTabPane,
|
|
13
|
+
ElTabs,
|
|
14
|
+
ElTree,
|
|
15
|
+
} from 'element-plus';
|
|
16
|
+
import {
|
|
17
|
+
Button as TButton,
|
|
18
|
+
Card as TCard,
|
|
19
|
+
Cascader as TCascader,
|
|
20
|
+
Checkbox as TCheckbox,
|
|
21
|
+
CheckboxGroup as TCheckboxGroup,
|
|
22
|
+
Col as TCol,
|
|
23
|
+
Collapse as TCollapse,
|
|
24
|
+
CollapsePanel as TCollapsePanel,
|
|
25
|
+
ColorPicker as TColorPicker,
|
|
26
|
+
Dialog as TDialog,
|
|
27
|
+
Divider as TDivider,
|
|
28
|
+
Form as TForm,
|
|
29
|
+
FormItem as TFormItem,
|
|
30
|
+
InputNumber as TInputNumber,
|
|
31
|
+
MessagePlugin,
|
|
32
|
+
Option as TOption,
|
|
33
|
+
OptionGroup as TOptionGroup,
|
|
34
|
+
Radio as TRadio,
|
|
35
|
+
RadioGroup as TRadioGroup,
|
|
36
|
+
Row as TRow,
|
|
37
|
+
Select as TSelect,
|
|
38
|
+
StepItem as TStepItem,
|
|
39
|
+
Steps as TSteps,
|
|
40
|
+
Switch as TSwitch,
|
|
41
|
+
Tag as TTag,
|
|
42
|
+
TimePicker as TTimePicker,
|
|
43
|
+
Tooltip as TTooltip,
|
|
44
|
+
Upload as TUpload,
|
|
45
|
+
} from 'tdesign-vue-next';
|
|
46
|
+
|
|
47
|
+
import DatePicker from './DatePicker.vue';
|
|
48
|
+
import Input from './Input.vue';
|
|
49
|
+
|
|
50
|
+
const adapter: any = {
|
|
51
|
+
message: MessagePlugin,
|
|
52
|
+
messageBox: ElMessageBox,
|
|
53
|
+
components: {
|
|
54
|
+
button: {
|
|
55
|
+
component: TButton,
|
|
56
|
+
props: (props: any) => ({
|
|
57
|
+
theme: props.type,
|
|
58
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
59
|
+
icon: props.icon,
|
|
60
|
+
variant: props.text ? 'text' : 'base',
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
card: {
|
|
65
|
+
component: TCard,
|
|
66
|
+
props: (props: any) => ({
|
|
67
|
+
shadow: props.shadow !== 'never',
|
|
68
|
+
hoverShadow: props.shadow === 'hover',
|
|
69
|
+
header: props.header,
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
cascader: {
|
|
74
|
+
component: TCascader,
|
|
75
|
+
props: (props: any) => ({
|
|
76
|
+
modelValue: props.modelValue,
|
|
77
|
+
placeholder: props.placeholder,
|
|
78
|
+
disabled: props.disabled,
|
|
79
|
+
clearable: props.clearable,
|
|
80
|
+
filterable: props.filterable,
|
|
81
|
+
options: props.options,
|
|
82
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
83
|
+
trigger: props.props.expandTrigger,
|
|
84
|
+
multiple: props.props.multiple,
|
|
85
|
+
checkStrictly: props.props.checkStrictly,
|
|
86
|
+
valueType: typeof props.props.emitPath === 'undefined' || props.props.emitPath === true ? 'full' : 'single',
|
|
87
|
+
lazy: props.props.lazy,
|
|
88
|
+
}),
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
checkbox: {
|
|
92
|
+
component: TCheckbox,
|
|
93
|
+
props: (props: any) => ({
|
|
94
|
+
modelValue: props.modelValue,
|
|
95
|
+
label: props.label,
|
|
96
|
+
value: props.value,
|
|
97
|
+
disabled: props.disabled,
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
checkboxGroup: {
|
|
102
|
+
component: TCheckboxGroup,
|
|
103
|
+
props: (props: any) => ({
|
|
104
|
+
modelValue: props.modelValue,
|
|
105
|
+
label: props.label,
|
|
106
|
+
disabled: props.disabled,
|
|
107
|
+
}),
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
col: {
|
|
111
|
+
component: TCol,
|
|
112
|
+
props: (props: any) => ({
|
|
113
|
+
span: props.span,
|
|
114
|
+
}),
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
collapse: {
|
|
118
|
+
component: TCollapse,
|
|
119
|
+
props: (props: any) => ({
|
|
120
|
+
value: props.modelValue,
|
|
121
|
+
expandIconPlacement: 'right',
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
collapseItem: {
|
|
126
|
+
component: TCollapsePanel,
|
|
127
|
+
props: (props: any) => ({
|
|
128
|
+
value: props.name,
|
|
129
|
+
header: props.title,
|
|
130
|
+
disabled: props.disabled,
|
|
131
|
+
}),
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
colorPicker: {
|
|
135
|
+
component: TColorPicker,
|
|
136
|
+
props: (props: any) => ({
|
|
137
|
+
modelValue: props.modelValue,
|
|
138
|
+
disabled: props.disabled,
|
|
139
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
140
|
+
enableAlpha: props.showAlpha,
|
|
141
|
+
formate: props.showAlpha ? 'RGBA' : 'RGB',
|
|
142
|
+
}),
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
datePicker: {
|
|
146
|
+
component: DatePicker,
|
|
147
|
+
props: (props: any) => props,
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
dialog: {
|
|
151
|
+
component: TDialog,
|
|
152
|
+
props: (props: any) => ({
|
|
153
|
+
visible: props.modelValue,
|
|
154
|
+
attach: props.appendToBody ? 'body' : '',
|
|
155
|
+
header: props.title,
|
|
156
|
+
width: props.width,
|
|
157
|
+
mode: props.fullscreen ? 'full-screen' : 'modal',
|
|
158
|
+
closeOnOverlayClick: props.closeOnClickModal,
|
|
159
|
+
}),
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
divider: {
|
|
163
|
+
component: TDivider,
|
|
164
|
+
props: (props: any) => ({
|
|
165
|
+
layout: props.direction,
|
|
166
|
+
content: props.contentPosition,
|
|
167
|
+
}),
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
dropdown: {
|
|
171
|
+
component: ElDropdown,
|
|
172
|
+
props: (props: any) => props,
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
dropdownItem: {
|
|
176
|
+
component: ElDropdownItem,
|
|
177
|
+
props: (props: any) => props,
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
dropdownMenu: {
|
|
181
|
+
component: ElDropdownMenu,
|
|
182
|
+
props: (props: any) => props,
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
form: {
|
|
186
|
+
component: TForm,
|
|
187
|
+
props: (props: any) => ({
|
|
188
|
+
data: props.model,
|
|
189
|
+
labelWidth: props.labelWidth,
|
|
190
|
+
disabled: props.disabled,
|
|
191
|
+
labelAlign: props.labelPosition,
|
|
192
|
+
layout: props.inline ? 'inline' : 'vertical',
|
|
193
|
+
}),
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
formItem: {
|
|
197
|
+
component: TFormItem,
|
|
198
|
+
props: (props: any) => ({
|
|
199
|
+
labelWidth: props.labelWidth,
|
|
200
|
+
name: props.prop,
|
|
201
|
+
rules: props.rules,
|
|
202
|
+
}),
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
icon: {
|
|
206
|
+
component: ElIcon,
|
|
207
|
+
props: (props: any) => props,
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
input: {
|
|
211
|
+
component: Input,
|
|
212
|
+
props: (props: any) => props,
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
inputNumber: {
|
|
216
|
+
component: TInputNumber,
|
|
217
|
+
props: (props: any) => ({
|
|
218
|
+
modelValue: props.modelValue,
|
|
219
|
+
align: props.controlsPosition,
|
|
220
|
+
disabled: props.disabled,
|
|
221
|
+
placeholder: props.placeholder,
|
|
222
|
+
step: props.step,
|
|
223
|
+
min: props.min,
|
|
224
|
+
max: props.max,
|
|
225
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
226
|
+
}),
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
option: {
|
|
230
|
+
component: TOption,
|
|
231
|
+
props: (props: any) => ({
|
|
232
|
+
value: props.value,
|
|
233
|
+
label: props.label,
|
|
234
|
+
disabled: props.disabled,
|
|
235
|
+
}),
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
optionGroup: {
|
|
239
|
+
component: TOptionGroup,
|
|
240
|
+
props: (props: any) => props,
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
pagination: {
|
|
244
|
+
component: ElPagination,
|
|
245
|
+
props: (props: any) => props,
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
popover: {
|
|
249
|
+
component: ElPopover,
|
|
250
|
+
props: (props: any) => props,
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
radio: {
|
|
254
|
+
component: TRadio,
|
|
255
|
+
props: (props: any) => ({
|
|
256
|
+
label: props.label,
|
|
257
|
+
}),
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
radioGroup: {
|
|
261
|
+
component: TRadioGroup,
|
|
262
|
+
props: (props: any) => ({
|
|
263
|
+
modelValue: props.modelValue,
|
|
264
|
+
disabled: props.disabled,
|
|
265
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
266
|
+
}),
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
row: {
|
|
270
|
+
component: TRow,
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
scrollbar: {
|
|
274
|
+
component: ElScrollbar,
|
|
275
|
+
props: (props: any) => props,
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
select: {
|
|
279
|
+
component: TSelect,
|
|
280
|
+
props: (props: any) => ({
|
|
281
|
+
modelValue: props.modelValue,
|
|
282
|
+
clearable: props.clearable,
|
|
283
|
+
filterable: props.filterable,
|
|
284
|
+
disabled: props.disabled,
|
|
285
|
+
placeholder: props.placeholder,
|
|
286
|
+
multiple: props.multiple,
|
|
287
|
+
valueType: props.valueKey,
|
|
288
|
+
remoteMethod: props.onSearch,
|
|
289
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
290
|
+
popupProps: {
|
|
291
|
+
overlayClassName: props.popperClass,
|
|
292
|
+
},
|
|
293
|
+
}),
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
step: {
|
|
297
|
+
component: TStepItem,
|
|
298
|
+
props: (props: any) => ({
|
|
299
|
+
title: props.props,
|
|
300
|
+
value: props.status,
|
|
301
|
+
}),
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
steps: {
|
|
305
|
+
component: TSteps,
|
|
306
|
+
props: (props: any) => ({
|
|
307
|
+
current: props.active,
|
|
308
|
+
}),
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
switch: {
|
|
312
|
+
component: TSwitch,
|
|
313
|
+
props: (props: any) => ({
|
|
314
|
+
modelValue: props.modelValue,
|
|
315
|
+
disabled: props.disabled,
|
|
316
|
+
label: props.label,
|
|
317
|
+
customValue: [props.activeValue ?? true, props.inactiveValue ?? false],
|
|
318
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
319
|
+
}),
|
|
320
|
+
},
|
|
321
|
+
|
|
322
|
+
table: {
|
|
323
|
+
component: ElTable,
|
|
324
|
+
props: (props: any) => props,
|
|
325
|
+
},
|
|
326
|
+
|
|
327
|
+
tableColumn: {
|
|
328
|
+
component: ElTableColumn,
|
|
329
|
+
props: (props: any) => props,
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
tabPane: {
|
|
333
|
+
component: ElTabPane,
|
|
334
|
+
props: (props: any) => props,
|
|
335
|
+
},
|
|
336
|
+
|
|
337
|
+
tabs: {
|
|
338
|
+
component: ElTabs,
|
|
339
|
+
props: (props: any) => props,
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
tag: {
|
|
343
|
+
component: TTag,
|
|
344
|
+
props: (props: any) => ({
|
|
345
|
+
theme: props.type ? props.type : 'default',
|
|
346
|
+
}),
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
timePicker: {
|
|
350
|
+
component: TTimePicker,
|
|
351
|
+
props: (props: any) => ({
|
|
352
|
+
modelValue: props.modelValue,
|
|
353
|
+
disabled: props.disabled,
|
|
354
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
355
|
+
placeholder: props.placeholder,
|
|
356
|
+
}),
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
tooltip: {
|
|
360
|
+
component: TTooltip,
|
|
361
|
+
props: (props: any) => ({
|
|
362
|
+
placement: props.placement,
|
|
363
|
+
content: props.content,
|
|
364
|
+
}),
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
tree: {
|
|
368
|
+
component: ElTree,
|
|
369
|
+
props: (props: any) => props,
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
upload: {
|
|
373
|
+
component: TUpload,
|
|
374
|
+
props: (props: any) => ({
|
|
375
|
+
action: props.action,
|
|
376
|
+
disabled: props.disabled,
|
|
377
|
+
autoUpload: props.autoUpload,
|
|
378
|
+
}),
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
export default adapter;
|
package/types/index.d.ts
ADDED