@tmagic/tdesign-vue-next-adapter 1.4.8 → 1.4.9
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 +4 -6
- package/src/DatePicker.vue +66 -0
- package/src/Icon.vue +7 -0
- package/src/Input.vue +55 -0
- package/src/Popover.vue +27 -0
- package/src/Scrollbar.vue +11 -0
- package/src/TableColumn.vue +5 -0
- package/src/Tree.vue +103 -0
- package/src/index.ts +527 -0
- package/src/shims-vue.d.ts +6 -0
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.4.
|
|
2
|
+
"version": "1.4.9",
|
|
3
3
|
"name": "@tmagic/tdesign-vue-next-adapter",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"sideEffects": [
|
|
6
|
-
"dist/*"
|
|
7
|
-
],
|
|
8
5
|
"main": "dist/tmagic-tdesign-vue-next-adapter.umd.cjs",
|
|
9
6
|
"module": "dist/tmagic-tdesign-vue-next-adapter.js",
|
|
10
7
|
"types": "types/index.d.ts",
|
|
@@ -18,7 +15,8 @@
|
|
|
18
15
|
},
|
|
19
16
|
"files": [
|
|
20
17
|
"dist",
|
|
21
|
-
"types"
|
|
18
|
+
"types",
|
|
19
|
+
"src"
|
|
22
20
|
],
|
|
23
21
|
"license": "Apache-2.0",
|
|
24
22
|
"engines": {
|
|
@@ -47,7 +45,7 @@
|
|
|
47
45
|
"tdesign-vue-next": "^1.8.1",
|
|
48
46
|
"vue": "^3.4.27",
|
|
49
47
|
"typescript": "*",
|
|
50
|
-
"@tmagic/design": "1.4.
|
|
48
|
+
"@tmagic/design": "1.4.9"
|
|
51
49
|
},
|
|
52
50
|
"peerDependenciesMeta": {
|
|
53
51
|
"typescript": {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TDateRangePicker
|
|
3
|
+
v-if="type.endsWith('range')"
|
|
4
|
+
:modelValue="modelValue"
|
|
5
|
+
:mode="mode"
|
|
6
|
+
:placeholder="[startPlaceholder || '', endPlaceholder || '']"
|
|
7
|
+
:disabled="disabled"
|
|
8
|
+
:size="size === 'default' ? 'medium' : size"
|
|
9
|
+
:separator="rangeSeparator"
|
|
10
|
+
:format="format"
|
|
11
|
+
:valueType="valueFormat === 's' ? 'time-stamp' : valueFormat"
|
|
12
|
+
@change="changeHandler"
|
|
13
|
+
@update:modelValue="updateModelValue"
|
|
14
|
+
/>
|
|
15
|
+
<TDatePicker
|
|
16
|
+
v-else
|
|
17
|
+
:modelValue="modelValue"
|
|
18
|
+
:mode="mode"
|
|
19
|
+
:placeholder="placeholder"
|
|
20
|
+
:disabled="disabled"
|
|
21
|
+
:size="size === 'default' ? 'medium' : size"
|
|
22
|
+
:format="format"
|
|
23
|
+
:enableTimePicker="type.includes('time')"
|
|
24
|
+
:valueType="valueFormat === 's' ? 'time-stamp' : valueFormat"
|
|
25
|
+
@change="changeHandler"
|
|
26
|
+
@update:modelValue="updateModelValue"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script lang="ts" setup>
|
|
31
|
+
import { computed } from 'vue';
|
|
32
|
+
import { DatePicker as TDatePicker, DateRangePicker as TDateRangePicker } from 'tdesign-vue-next';
|
|
33
|
+
|
|
34
|
+
import type { DatePickerProps } from '@tmagic/design';
|
|
35
|
+
|
|
36
|
+
const props = withDefaults(
|
|
37
|
+
defineProps<
|
|
38
|
+
DatePickerProps & {
|
|
39
|
+
valueFormat: any;
|
|
40
|
+
}
|
|
41
|
+
>(),
|
|
42
|
+
{
|
|
43
|
+
type: 'date',
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const mode = computed(() => {
|
|
48
|
+
const map: any = {
|
|
49
|
+
datetime: 'date',
|
|
50
|
+
daterange: 'date',
|
|
51
|
+
monthrange: 'month',
|
|
52
|
+
datetimerange: 'date',
|
|
53
|
+
};
|
|
54
|
+
return map[props.type] || props.type;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const emit = defineEmits(['change', 'update:modelValue']);
|
|
58
|
+
|
|
59
|
+
const changeHandler = (v: any) => {
|
|
60
|
+
emit('change', v);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const updateModelValue = (...args: any[]) => {
|
|
64
|
+
emit('update:modelValue', ...args);
|
|
65
|
+
};
|
|
66
|
+
</script>
|
package/src/Icon.vue
ADDED
package/src/Input.vue
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TTextarea
|
|
3
|
+
v-if="type === 'textarea'"
|
|
4
|
+
:modelValue="modelValue"
|
|
5
|
+
:size="size === 'default' ? 'medium' : size"
|
|
6
|
+
:disabled="disabled"
|
|
7
|
+
:placeholder="placeholder"
|
|
8
|
+
@keypress="inputHandler"
|
|
9
|
+
@change="changeHandler"
|
|
10
|
+
></TTextarea>
|
|
11
|
+
<TInput
|
|
12
|
+
v-else
|
|
13
|
+
:modelValue="modelValue"
|
|
14
|
+
:size="size === 'default' ? 'medium' : size"
|
|
15
|
+
:clearable="clearable"
|
|
16
|
+
:disabled="disabled"
|
|
17
|
+
:placeholder="placeholder"
|
|
18
|
+
@keypress="inputHandler"
|
|
19
|
+
@change="changeHandler"
|
|
20
|
+
@update:modelValue="updateModelValue"
|
|
21
|
+
>
|
|
22
|
+
<template #prefix-icon v-if="$slots.prefix">
|
|
23
|
+
<slot name="prefix"></slot>
|
|
24
|
+
</template>
|
|
25
|
+
<template #suffix v-if="$slots.suffix">
|
|
26
|
+
<slot name="suffix"></slot>
|
|
27
|
+
</template>
|
|
28
|
+
</TInput>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts" setup>
|
|
32
|
+
import { Input as TInput, Textarea as TTextarea } from 'tdesign-vue-next';
|
|
33
|
+
|
|
34
|
+
import type { InputProps } from '@tmagic/design';
|
|
35
|
+
|
|
36
|
+
defineProps<
|
|
37
|
+
InputProps & {
|
|
38
|
+
modelValue: string;
|
|
39
|
+
}
|
|
40
|
+
>();
|
|
41
|
+
|
|
42
|
+
const emit = defineEmits(['change', 'input', 'update:modelValue']);
|
|
43
|
+
|
|
44
|
+
const changeHandler = (...args: any[]) => {
|
|
45
|
+
emit('change', ...args);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const inputHandler = (...args: any[]) => {
|
|
49
|
+
emit('input', ...args);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const updateModelValue = (...args: any[]) => {
|
|
53
|
+
emit('update:modelValue', ...args);
|
|
54
|
+
};
|
|
55
|
+
</script>
|
package/src/Popover.vue
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TPopup
|
|
3
|
+
:placement="placement"
|
|
4
|
+
:trigger="trigger"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:visible="visible"
|
|
7
|
+
:overlayClassName="popperClass"
|
|
8
|
+
>
|
|
9
|
+
<slot name="reference"></slot>
|
|
10
|
+
|
|
11
|
+
<template #content>
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</template>
|
|
14
|
+
</TPopup>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { computed } from 'vue';
|
|
19
|
+
import { Popup as TPopup, type PopupPlacement } from 'tdesign-vue-next';
|
|
20
|
+
|
|
21
|
+
import type { PopoverProps } from '@tmagic/design';
|
|
22
|
+
|
|
23
|
+
const props = defineProps<PopoverProps>();
|
|
24
|
+
|
|
25
|
+
const placement = computed(() => props.placement as PopupPlacement);
|
|
26
|
+
const trigger = computed(() => props.trigger as 'click' | 'focus' | 'mousedown' | 'context-menu' | 'hover');
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tdesign-scrollbar" style="overflow: hidden; position: relative; height: 100%">
|
|
3
|
+
<div class="tdesign-scrollbar-wrap" style="overflow: auto; height: 100%">
|
|
4
|
+
<div class="tdesign-scrollbar-view">
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts"></script>
|
package/src/Tree.vue
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TTree
|
|
3
|
+
ref="tree"
|
|
4
|
+
:data="data"
|
|
5
|
+
:empty="emptyText"
|
|
6
|
+
:keys="nodeKeys"
|
|
7
|
+
:load="loadChildren"
|
|
8
|
+
:activable="highlightCurrent"
|
|
9
|
+
:expandAll="defaultExpandAll"
|
|
10
|
+
:expandParent="autoExpandParent"
|
|
11
|
+
:defaultExpanded="defaultExpandedKeys"
|
|
12
|
+
:actived="currentNodeKey"
|
|
13
|
+
:filter="filterNode"
|
|
14
|
+
:expandMutex="accordion"
|
|
15
|
+
:draggable="draggable"
|
|
16
|
+
:icon="iconRender"
|
|
17
|
+
:lazy="lazy"
|
|
18
|
+
:allowDrag="allowDrag"
|
|
19
|
+
:allowDrop="allowDrop"
|
|
20
|
+
:onClick="nodeClickHandler"
|
|
21
|
+
:onExpand="handleExpand"
|
|
22
|
+
@contextmenu="contextmenu"
|
|
23
|
+
></TTree>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import { computed, h, ref } from 'vue';
|
|
28
|
+
import { Tree as TTree, TreeNodeModel, TreeNodeValue } from 'tdesign-vue-next';
|
|
29
|
+
|
|
30
|
+
import type { TreeProps } from '@tmagic/design';
|
|
31
|
+
|
|
32
|
+
const props = defineProps<TreeProps>();
|
|
33
|
+
|
|
34
|
+
const nodeKeys = computed(() => ({
|
|
35
|
+
value: props.props?.value || 'value',
|
|
36
|
+
label: props.props?.label || 'label',
|
|
37
|
+
children: props.props?.children || 'children',
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
const loadChildren = (node: TreeNodeModel<any>) =>
|
|
41
|
+
props.load
|
|
42
|
+
? new Promise((resolve) => {
|
|
43
|
+
props.load(node, resolve);
|
|
44
|
+
})
|
|
45
|
+
: undefined;
|
|
46
|
+
|
|
47
|
+
let filterValue: any;
|
|
48
|
+
|
|
49
|
+
const filterNode = (node: TreeNodeModel<any>) => props.filterNodeMethod?.(filterValue, node.data, node);
|
|
50
|
+
|
|
51
|
+
const iconRender = () => props.icon && h(props.icon);
|
|
52
|
+
|
|
53
|
+
const emit = defineEmits([
|
|
54
|
+
'node-click',
|
|
55
|
+
'node-contextmenu',
|
|
56
|
+
'node-drag-end',
|
|
57
|
+
'node-collapse',
|
|
58
|
+
'node-expand',
|
|
59
|
+
'check',
|
|
60
|
+
'mousedown',
|
|
61
|
+
'mouseup',
|
|
62
|
+
]);
|
|
63
|
+
|
|
64
|
+
const nodeClickHandler = (context: { node: TreeNodeModel<any>; e: MouseEvent }) => {
|
|
65
|
+
emit('node-click', context.node.data, context.node, context, context.e);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const contextmenu = (...args: any[]) => {
|
|
69
|
+
emit('node-contextmenu', ...args);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleExpand = (value: Array<TreeNodeValue>, context: { node: TreeNodeModel<any>; e: MouseEvent }) => {
|
|
73
|
+
emit('node-expand', context.node.data, context.node);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const tree = ref<InstanceType<typeof TTree>>();
|
|
77
|
+
|
|
78
|
+
defineExpose({
|
|
79
|
+
getData() {
|
|
80
|
+
return tree.value?.data;
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
getStore() {
|
|
84
|
+
return tree.value?.store;
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
filter(value: any) {
|
|
88
|
+
filterValue = value;
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
getNode(...args: any[]) {
|
|
92
|
+
return tree.value?.getNode(...args);
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
setCheckedKeys(...args: any[]) {
|
|
96
|
+
console.log(args);
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
setCurrentKey(...args: any[]) {
|
|
100
|
+
console.log(args);
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
</script>
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
import { h } from 'vue';
|
|
2
|
+
import {
|
|
3
|
+
Badge as TBadge,
|
|
4
|
+
Button as TButton,
|
|
5
|
+
Card as TCard,
|
|
6
|
+
Cascader as TCascader,
|
|
7
|
+
Checkbox as TCheckbox,
|
|
8
|
+
CheckboxGroup as TCheckboxGroup,
|
|
9
|
+
Col as TCol,
|
|
10
|
+
Collapse as TCollapse,
|
|
11
|
+
CollapsePanel as TCollapsePanel,
|
|
12
|
+
ColorPicker as TColorPicker,
|
|
13
|
+
Dialog as TDialog,
|
|
14
|
+
DialogPlugin,
|
|
15
|
+
Divider as TDivider,
|
|
16
|
+
Drawer as TDrawer,
|
|
17
|
+
Dropdown as TDropdown,
|
|
18
|
+
DropdownItem as TDropdownItem,
|
|
19
|
+
Form as TForm,
|
|
20
|
+
FormItem as TFormItem,
|
|
21
|
+
InputNumber as TInputNumber,
|
|
22
|
+
MessagePlugin,
|
|
23
|
+
Option as TOption,
|
|
24
|
+
OptionGroup as TOptionGroup,
|
|
25
|
+
Pagination as TPagination,
|
|
26
|
+
Radio as TRadio,
|
|
27
|
+
RadioButton as TRadioButton,
|
|
28
|
+
RadioGroup as TRadioGroup,
|
|
29
|
+
Row as TRow,
|
|
30
|
+
Select as TSelect,
|
|
31
|
+
StepItem as TStepItem,
|
|
32
|
+
Steps as TSteps,
|
|
33
|
+
Switch as TSwitch,
|
|
34
|
+
Table as TTable,
|
|
35
|
+
TabPanel as TTabPanel,
|
|
36
|
+
Tabs as TTabs,
|
|
37
|
+
Tag as TTag,
|
|
38
|
+
TimePicker as TTimePicker,
|
|
39
|
+
Tooltip as TTooltip,
|
|
40
|
+
TreeNodeModel,
|
|
41
|
+
Upload as TUpload,
|
|
42
|
+
} from 'tdesign-vue-next';
|
|
43
|
+
|
|
44
|
+
import type {
|
|
45
|
+
BadgeProps,
|
|
46
|
+
ButtonProps,
|
|
47
|
+
CardProps,
|
|
48
|
+
CascaderProps,
|
|
49
|
+
CheckboxGroupProps,
|
|
50
|
+
CheckboxProps,
|
|
51
|
+
CollapseItemProps,
|
|
52
|
+
CollapseProps,
|
|
53
|
+
ColorPickerProps,
|
|
54
|
+
ColProps,
|
|
55
|
+
DatePickerProps,
|
|
56
|
+
DialogProps,
|
|
57
|
+
DrawerProps,
|
|
58
|
+
DropdownItemProps,
|
|
59
|
+
DropdownProps,
|
|
60
|
+
FormItemProps,
|
|
61
|
+
FormProps,
|
|
62
|
+
IconProps,
|
|
63
|
+
InputNumberProps,
|
|
64
|
+
InputProps,
|
|
65
|
+
OptionGroupProps,
|
|
66
|
+
OptionProps,
|
|
67
|
+
PaginationProps,
|
|
68
|
+
PopoverProps,
|
|
69
|
+
RadioButtonProps,
|
|
70
|
+
RadioGroupProps,
|
|
71
|
+
RadioProps,
|
|
72
|
+
SelectProps,
|
|
73
|
+
StepProps,
|
|
74
|
+
StepsProps,
|
|
75
|
+
SwitchProps,
|
|
76
|
+
TableColumnProps,
|
|
77
|
+
TableProps,
|
|
78
|
+
TabPaneProps,
|
|
79
|
+
TabsProps,
|
|
80
|
+
TagProps,
|
|
81
|
+
TimePickerProps,
|
|
82
|
+
TooltipProps,
|
|
83
|
+
TreeProps,
|
|
84
|
+
UploadProps,
|
|
85
|
+
} from '@tmagic/design';
|
|
86
|
+
|
|
87
|
+
import DatePicker from './DatePicker.vue';
|
|
88
|
+
import Icon from './Icon.vue';
|
|
89
|
+
import Input from './Input.vue';
|
|
90
|
+
import Popover from './Popover.vue';
|
|
91
|
+
import Scrollbar from './Scrollbar.vue';
|
|
92
|
+
import TableColumn from './TableColumn.vue';
|
|
93
|
+
import Tree from './Tree.vue';
|
|
94
|
+
|
|
95
|
+
const adapter: any = {
|
|
96
|
+
message: MessagePlugin,
|
|
97
|
+
messageBox: {
|
|
98
|
+
alert: (msg: string) => {
|
|
99
|
+
DialogPlugin.alert({
|
|
100
|
+
body: msg,
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
confirm: (msg: string) => {
|
|
104
|
+
DialogPlugin.confirm({
|
|
105
|
+
body: msg,
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
close: (msg: string) => {
|
|
109
|
+
console.log(msg);
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
components: {
|
|
113
|
+
badge: {
|
|
114
|
+
component: TBadge,
|
|
115
|
+
props: (props: BadgeProps) => ({
|
|
116
|
+
count: props.value,
|
|
117
|
+
dot: props.isDot,
|
|
118
|
+
maxCount: props.max,
|
|
119
|
+
}),
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
button: {
|
|
123
|
+
component: TButton,
|
|
124
|
+
props: (props: ButtonProps) => ({
|
|
125
|
+
theme: props.type,
|
|
126
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
127
|
+
icon: () => (props.icon ? h(props.icon) : null),
|
|
128
|
+
variant: props.link || props.text ? 'text' : 'base',
|
|
129
|
+
shape: props.circle ? 'circle' : 'rectangle',
|
|
130
|
+
}),
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
card: {
|
|
134
|
+
component: TCard,
|
|
135
|
+
props: (props: CardProps) => ({
|
|
136
|
+
shadow: props.shadow !== 'never',
|
|
137
|
+
hoverShadow: props.shadow === 'hover',
|
|
138
|
+
header: props.header,
|
|
139
|
+
}),
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
cascader: {
|
|
143
|
+
component: TCascader,
|
|
144
|
+
props: (props: CascaderProps) => ({
|
|
145
|
+
modelValue: props.modelValue,
|
|
146
|
+
placeholder: props.placeholder,
|
|
147
|
+
disabled: props.disabled,
|
|
148
|
+
clearable: props.clearable,
|
|
149
|
+
filterable: props.filterable,
|
|
150
|
+
options: props.options,
|
|
151
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
152
|
+
trigger: props.props.expandTrigger,
|
|
153
|
+
multiple: props.props.multiple,
|
|
154
|
+
checkStrictly: props.props.checkStrictly,
|
|
155
|
+
valueType: typeof props.props.emitPath === 'undefined' || props.props.emitPath === true ? 'full' : 'single',
|
|
156
|
+
lazy: props.props.lazy,
|
|
157
|
+
}),
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
checkbox: {
|
|
161
|
+
component: TCheckbox,
|
|
162
|
+
props: (props: CheckboxProps) => ({
|
|
163
|
+
modelValue: props.modelValue,
|
|
164
|
+
label: props.label,
|
|
165
|
+
value: props.value,
|
|
166
|
+
disabled: props.disabled,
|
|
167
|
+
}),
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
checkboxGroup: {
|
|
171
|
+
component: TCheckboxGroup,
|
|
172
|
+
props: (props: CheckboxGroupProps) => ({
|
|
173
|
+
modelValue: props.modelValue,
|
|
174
|
+
label: props.label,
|
|
175
|
+
disabled: props.disabled,
|
|
176
|
+
}),
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
col: {
|
|
180
|
+
component: TCol,
|
|
181
|
+
props: (props: ColProps) => ({
|
|
182
|
+
span: props.span,
|
|
183
|
+
}),
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
collapse: {
|
|
187
|
+
component: TCollapse,
|
|
188
|
+
props: (props: CollapseProps) => ({
|
|
189
|
+
value: props.modelValue,
|
|
190
|
+
expandIconPlacement: 'right',
|
|
191
|
+
}),
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
collapseItem: {
|
|
195
|
+
component: TCollapsePanel,
|
|
196
|
+
props: (props: CollapseItemProps) => ({
|
|
197
|
+
value: props.name,
|
|
198
|
+
header: props.title,
|
|
199
|
+
disabled: props.disabled,
|
|
200
|
+
}),
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
colorPicker: {
|
|
204
|
+
component: TColorPicker,
|
|
205
|
+
props: (props: ColorPickerProps) => ({
|
|
206
|
+
modelValue: props.modelValue,
|
|
207
|
+
disabled: props.disabled,
|
|
208
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
209
|
+
enableAlpha: props.showAlpha,
|
|
210
|
+
formate: props.showAlpha ? 'RGBA' : 'RGB',
|
|
211
|
+
}),
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
datePicker: {
|
|
215
|
+
component: DatePicker,
|
|
216
|
+
props: (props: DatePickerProps) => props,
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
dialog: {
|
|
220
|
+
component: TDialog,
|
|
221
|
+
props: (props: DialogProps) => ({
|
|
222
|
+
visible: props.modelValue,
|
|
223
|
+
attach: props.appendToBody ? 'body' : '',
|
|
224
|
+
header: props.title,
|
|
225
|
+
width: props.width,
|
|
226
|
+
mode: props.fullscreen ? 'full-screen' : 'modal',
|
|
227
|
+
closeOnOverlayClick: props.closeOnClickModal,
|
|
228
|
+
}),
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
divider: {
|
|
232
|
+
component: TDivider,
|
|
233
|
+
props: (props: any) => ({
|
|
234
|
+
layout: props.direction,
|
|
235
|
+
content: props.contentPosition,
|
|
236
|
+
}),
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
drawer: {
|
|
240
|
+
component: TDrawer,
|
|
241
|
+
props: (props: DrawerProps) => ({
|
|
242
|
+
visible: props.modelValue,
|
|
243
|
+
size: typeof props.size === 'number' ? `${props.size}px` : props.size,
|
|
244
|
+
closeOnEscKeydown: props.closeOnPressEscape,
|
|
245
|
+
closeOnOverlayClick: props.closeOnClickModal,
|
|
246
|
+
attach: props.appendToBody ? 'body' : undefined,
|
|
247
|
+
placement: {
|
|
248
|
+
rtl: 'right',
|
|
249
|
+
ltr: 'left',
|
|
250
|
+
ttb: 'top',
|
|
251
|
+
bt: 'bottom',
|
|
252
|
+
}[props.direction as string],
|
|
253
|
+
}),
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
dropdown: {
|
|
257
|
+
component: TDropdown,
|
|
258
|
+
props: (props: DropdownProps) => ({
|
|
259
|
+
maxHeight: props.maxHeight,
|
|
260
|
+
disabled: props.disable,
|
|
261
|
+
direction: props.placement,
|
|
262
|
+
trigger: props.trigger,
|
|
263
|
+
hideAfterItemClick: props.hideOnClick,
|
|
264
|
+
popupProps: {
|
|
265
|
+
overlayClassName: props.popperClass,
|
|
266
|
+
...(props.popperOptions || {}),
|
|
267
|
+
},
|
|
268
|
+
}),
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
dropdownItem: {
|
|
272
|
+
component: TDropdownItem,
|
|
273
|
+
props: (props: DropdownItemProps) => ({
|
|
274
|
+
disabled: props.disabled,
|
|
275
|
+
divider: props.divided,
|
|
276
|
+
prefixIcon: props.icon && (() => h(props.icon)),
|
|
277
|
+
onClick: props.command?.(),
|
|
278
|
+
}),
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
dropdownMenu: {
|
|
282
|
+
component: TDropdown,
|
|
283
|
+
props: () => ({}),
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
form: {
|
|
287
|
+
component: TForm,
|
|
288
|
+
props: (props: FormProps) => ({
|
|
289
|
+
data: props.model,
|
|
290
|
+
labelWidth: props.labelWidth,
|
|
291
|
+
disabled: props.disabled,
|
|
292
|
+
labelAlign: props.labelPosition,
|
|
293
|
+
layout: props.inline ? 'inline' : 'vertical',
|
|
294
|
+
}),
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
formItem: {
|
|
298
|
+
component: TFormItem,
|
|
299
|
+
props: (props: FormItemProps) => ({
|
|
300
|
+
labelWidth: props.labelWidth,
|
|
301
|
+
name: props.prop,
|
|
302
|
+
rules: props.rules,
|
|
303
|
+
}),
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
icon: {
|
|
307
|
+
component: Icon,
|
|
308
|
+
props: (props: IconProps) => props,
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
input: {
|
|
312
|
+
component: Input,
|
|
313
|
+
props: (props: InputProps) => props,
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
inputNumber: {
|
|
317
|
+
component: TInputNumber,
|
|
318
|
+
props: (props: InputNumberProps) => ({
|
|
319
|
+
modelValue: props.modelValue,
|
|
320
|
+
align: props.controlsPosition,
|
|
321
|
+
disabled: props.disabled,
|
|
322
|
+
placeholder: props.placeholder,
|
|
323
|
+
step: props.step,
|
|
324
|
+
min: props.min,
|
|
325
|
+
max: props.max,
|
|
326
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
327
|
+
}),
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
option: {
|
|
331
|
+
component: TOption,
|
|
332
|
+
props: (props: OptionProps) => ({
|
|
333
|
+
value: props.value,
|
|
334
|
+
label: props.label,
|
|
335
|
+
disabled: props.disabled,
|
|
336
|
+
}),
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
optionGroup: {
|
|
340
|
+
component: TOptionGroup,
|
|
341
|
+
props: (props: OptionGroupProps) => props,
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
pagination: {
|
|
345
|
+
component: TPagination,
|
|
346
|
+
props: (props: PaginationProps) => ({
|
|
347
|
+
current: props.curPage,
|
|
348
|
+
pageSizeOptions: props.pageSizes,
|
|
349
|
+
pageSize: props.pagesize,
|
|
350
|
+
total: props.total,
|
|
351
|
+
}),
|
|
352
|
+
},
|
|
353
|
+
|
|
354
|
+
popover: {
|
|
355
|
+
component: Popover,
|
|
356
|
+
props: (props: PopoverProps) => props,
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
radio: {
|
|
360
|
+
component: TRadio,
|
|
361
|
+
props: (props: RadioProps) => ({
|
|
362
|
+
label: props.label,
|
|
363
|
+
value: props.value,
|
|
364
|
+
}),
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
radioButton: {
|
|
368
|
+
component: TRadioButton,
|
|
369
|
+
props: (props: RadioButtonProps) => ({
|
|
370
|
+
label: props.label,
|
|
371
|
+
}),
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
radioGroup: {
|
|
375
|
+
component: TRadioGroup,
|
|
376
|
+
props: (props: RadioGroupProps) => ({
|
|
377
|
+
modelValue: props.modelValue,
|
|
378
|
+
disabled: props.disabled,
|
|
379
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
380
|
+
}),
|
|
381
|
+
},
|
|
382
|
+
|
|
383
|
+
row: {
|
|
384
|
+
component: TRow,
|
|
385
|
+
},
|
|
386
|
+
|
|
387
|
+
scrollbar: {
|
|
388
|
+
component: Scrollbar,
|
|
389
|
+
props: () => ({}),
|
|
390
|
+
},
|
|
391
|
+
|
|
392
|
+
select: {
|
|
393
|
+
component: TSelect,
|
|
394
|
+
props: (props: SelectProps) => ({
|
|
395
|
+
modelValue: props.modelValue,
|
|
396
|
+
clearable: props.clearable,
|
|
397
|
+
filterable: props.filterable,
|
|
398
|
+
disabled: props.disabled,
|
|
399
|
+
placeholder: props.placeholder,
|
|
400
|
+
multiple: props.multiple,
|
|
401
|
+
valueType: props.valueKey,
|
|
402
|
+
remoteMethod: props.onSearch,
|
|
403
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
404
|
+
popupProps: {
|
|
405
|
+
overlayClassName: props.popperClass,
|
|
406
|
+
},
|
|
407
|
+
}),
|
|
408
|
+
},
|
|
409
|
+
|
|
410
|
+
step: {
|
|
411
|
+
component: TStepItem,
|
|
412
|
+
props: (props: StepProps) => ({
|
|
413
|
+
title: props.props,
|
|
414
|
+
value: props.status,
|
|
415
|
+
}),
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
steps: {
|
|
419
|
+
component: TSteps,
|
|
420
|
+
props: (props: StepsProps) => ({
|
|
421
|
+
current: props.active,
|
|
422
|
+
}),
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
switch: {
|
|
426
|
+
component: TSwitch,
|
|
427
|
+
props: (props: SwitchProps) => ({
|
|
428
|
+
modelValue: props.modelValue,
|
|
429
|
+
disabled: props.disabled,
|
|
430
|
+
label: props.label,
|
|
431
|
+
customValue: [props.activeValue ?? true, props.inactiveValue ?? false],
|
|
432
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
433
|
+
}),
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
table: {
|
|
437
|
+
component: TTable,
|
|
438
|
+
props: (props: TableProps) => props,
|
|
439
|
+
},
|
|
440
|
+
|
|
441
|
+
tableColumn: {
|
|
442
|
+
component: TableColumn,
|
|
443
|
+
props: (props: TableColumnProps) => props,
|
|
444
|
+
},
|
|
445
|
+
|
|
446
|
+
tabPane: {
|
|
447
|
+
component: TTabPanel,
|
|
448
|
+
props: (props: TabPaneProps) => ({
|
|
449
|
+
label: props.label,
|
|
450
|
+
value: props.name,
|
|
451
|
+
}),
|
|
452
|
+
},
|
|
453
|
+
|
|
454
|
+
tabs: {
|
|
455
|
+
component: TTabs,
|
|
456
|
+
props: (props: TabsProps) => ({
|
|
457
|
+
addable: props.editable,
|
|
458
|
+
theme: props.type === 'card' ? 'card' : 'normal',
|
|
459
|
+
placement: props.tabPosition,
|
|
460
|
+
value: props.modelValue,
|
|
461
|
+
}),
|
|
462
|
+
},
|
|
463
|
+
|
|
464
|
+
tag: {
|
|
465
|
+
component: TTag,
|
|
466
|
+
props: (props: TagProps) => ({
|
|
467
|
+
theme: props.type ? props.type : 'default',
|
|
468
|
+
}),
|
|
469
|
+
},
|
|
470
|
+
|
|
471
|
+
timePicker: {
|
|
472
|
+
component: TTimePicker,
|
|
473
|
+
props: (props: TimePickerProps) => ({
|
|
474
|
+
modelValue: props.modelValue,
|
|
475
|
+
disabled: props.disabled,
|
|
476
|
+
size: props.size === 'default' ? 'medium' : props.size,
|
|
477
|
+
placeholder: props.placeholder,
|
|
478
|
+
}),
|
|
479
|
+
},
|
|
480
|
+
|
|
481
|
+
tooltip: {
|
|
482
|
+
component: TTooltip,
|
|
483
|
+
props: (props: TooltipProps) => ({
|
|
484
|
+
...props,
|
|
485
|
+
placement: props.placement,
|
|
486
|
+
content: props.content,
|
|
487
|
+
}),
|
|
488
|
+
},
|
|
489
|
+
|
|
490
|
+
tree: {
|
|
491
|
+
component: Tree,
|
|
492
|
+
props: (props: TreeProps) => ({
|
|
493
|
+
...props,
|
|
494
|
+
data: props.data,
|
|
495
|
+
draggable: props.draggable,
|
|
496
|
+
activable: props.highlightCurrent,
|
|
497
|
+
activeMultiple: props.highlightCurrent,
|
|
498
|
+
defaultActived: props.defaultCheckedKeys,
|
|
499
|
+
checkable: props.showCheckbox,
|
|
500
|
+
empty: props.emptyText,
|
|
501
|
+
expandAll: props.defaultExpandAll,
|
|
502
|
+
checkStrictly: props.checkStrictly,
|
|
503
|
+
load: props.load,
|
|
504
|
+
keys: props.props,
|
|
505
|
+
}),
|
|
506
|
+
listeners: {
|
|
507
|
+
click(context: { node: TreeNodeModel<any>; e: MouseEvent }) {
|
|
508
|
+
return {
|
|
509
|
+
node: context.node,
|
|
510
|
+
data: context.node.data,
|
|
511
|
+
};
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
|
|
516
|
+
upload: {
|
|
517
|
+
component: TUpload,
|
|
518
|
+
props: (props: UploadProps) => ({
|
|
519
|
+
action: props.action,
|
|
520
|
+
disabled: props.disabled,
|
|
521
|
+
autoUpload: props.autoUpload,
|
|
522
|
+
}),
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
export default adapter;
|