@tmagic/tdesign-vue-next-adapter 1.7.0-beta.3 → 1.7.0-beta.4
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 +150 -6
- package/dist/tmagic-tdesign-vue-next-adapter.umd.cjs +148 -4
- package/package.json +3 -3
- package/src/AutoComplete.vue +102 -0
- package/src/Dialog.vue +1 -0
- package/src/Input.vue +7 -1
- package/src/Table.vue +6 -0
- package/src/Tabs.vue +1 -0
- package/src/index.ts +9 -1
|
@@ -1,5 +1,130 @@
|
|
|
1
|
-
import { defineComponent, ref,
|
|
2
|
-
import { Checkbox, DateRangePicker, DatePicker, Dialog, Textarea, InputAdornment, Input, Pagination, Popconfirm, Radio, RadioButton, Table, Tabs, MessagePlugin, LoadingDirective, Upload, Tooltip, TimePicker, Tag, TabPanel, Switch, Steps, StepItem, Select, Row, RadioGroup, OptionGroup, Option, InputNumber, FormItem, Form, Dropdown, DropdownItem, Drawer, Divider, ColorPicker, CollapsePanel, Collapse, Col, CheckboxGroup, Cascader, Card, Button, Badge, DialogPlugin } from 'tdesign-vue-next';
|
|
1
|
+
import { defineComponent, ref, onMounted, createBlock, openBlock, unref, createSlots, withCtx, renderSlot, watch, computed, createElementBlock, useTemplateRef, createVNode, createElementVNode, h } from 'vue';
|
|
2
|
+
import { AutoComplete, Checkbox, DateRangePicker, DatePicker, Dialog, Textarea, InputAdornment, Input, Pagination, Popconfirm, Radio, RadioButton, Table, Tabs, MessagePlugin, LoadingDirective, Upload, Tooltip, TimePicker, Tag, TabPanel, Switch, Steps, StepItem, Select, Row, RadioGroup, OptionGroup, Option, InputNumber, FormItem, Form, Dropdown, DropdownItem, Drawer, Divider, ColorPicker, CollapsePanel, Collapse, Col, CheckboxGroup, Cascader, Card, Button, Badge, DialogPlugin } from 'tdesign-vue-next';
|
|
3
|
+
|
|
4
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
5
|
+
...{
|
|
6
|
+
name: "TTDesignAdapterAutoComplete"
|
|
7
|
+
},
|
|
8
|
+
__name: "AutoComplete",
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {},
|
|
11
|
+
placeholder: {},
|
|
12
|
+
clearable: { type: Boolean },
|
|
13
|
+
disabled: { type: Boolean },
|
|
14
|
+
triggerOnFocus: { type: Boolean },
|
|
15
|
+
valueKey: {},
|
|
16
|
+
debounce: {},
|
|
17
|
+
size: {},
|
|
18
|
+
placement: {},
|
|
19
|
+
fetchSuggestions: { type: Function }
|
|
20
|
+
},
|
|
21
|
+
emits: ["change", "input", "blur", "focus", "click", "update:modelValue"],
|
|
22
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
23
|
+
const emit = __emit;
|
|
24
|
+
const props = __props;
|
|
25
|
+
const options = ref([]);
|
|
26
|
+
onMounted(() => {
|
|
27
|
+
if (typeof props.fetchSuggestions === "function") {
|
|
28
|
+
props.fetchSuggestions("", (data) => {
|
|
29
|
+
options.value = data;
|
|
30
|
+
});
|
|
31
|
+
} else if (Array.isArray(props.fetchSuggestions)) {
|
|
32
|
+
options.value = props.fetchSuggestions;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const filterHandler = (keyword, _option) => {
|
|
36
|
+
if (typeof props.fetchSuggestions === "function") {
|
|
37
|
+
props.fetchSuggestions(keyword, (data) => {
|
|
38
|
+
options.value = data;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
const changeHandler = (...args) => {
|
|
44
|
+
emit("change", ...args);
|
|
45
|
+
};
|
|
46
|
+
const inputHandler = (...args) => {
|
|
47
|
+
emit("input", ...args);
|
|
48
|
+
};
|
|
49
|
+
const blurHandler = (...args) => {
|
|
50
|
+
emit("blur", ...args);
|
|
51
|
+
};
|
|
52
|
+
const focusHandler = (...args) => {
|
|
53
|
+
emit("focus", ...args);
|
|
54
|
+
};
|
|
55
|
+
const clickHandler = (...args) => {
|
|
56
|
+
emit("click", ...args);
|
|
57
|
+
};
|
|
58
|
+
const updateModelValue = (...args) => {
|
|
59
|
+
emit("update:modelValue", ...args);
|
|
60
|
+
};
|
|
61
|
+
__expose({
|
|
62
|
+
blur: () => {
|
|
63
|
+
},
|
|
64
|
+
focus: () => {
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return (_ctx, _cache) => {
|
|
68
|
+
return openBlock(), createBlock(unref(AutoComplete), {
|
|
69
|
+
ref: "autocomplete",
|
|
70
|
+
"model-value": __props.modelValue,
|
|
71
|
+
options: options.value,
|
|
72
|
+
disabled: __props.disabled,
|
|
73
|
+
placeholder: __props.placeholder,
|
|
74
|
+
size: __props.size === "default" ? "medium" : __props.size,
|
|
75
|
+
popupProps: {
|
|
76
|
+
trigger: props.triggerOnFocus ? "focus" : "hover"
|
|
77
|
+
},
|
|
78
|
+
filter: filterHandler,
|
|
79
|
+
onKeypress: inputHandler,
|
|
80
|
+
onChange: changeHandler,
|
|
81
|
+
onBlur: blurHandler,
|
|
82
|
+
onFocus: focusHandler,
|
|
83
|
+
onClick: clickHandler,
|
|
84
|
+
"onUpdate:modelValue": updateModelValue
|
|
85
|
+
}, createSlots({
|
|
86
|
+
_: 2
|
|
87
|
+
/* DYNAMIC */
|
|
88
|
+
}, [
|
|
89
|
+
_ctx.$slots.default ? {
|
|
90
|
+
name: "option",
|
|
91
|
+
fn: withCtx(({ option }) => [
|
|
92
|
+
renderSlot(_ctx.$slots, "default", { item: option })
|
|
93
|
+
]),
|
|
94
|
+
key: "0"
|
|
95
|
+
} : void 0,
|
|
96
|
+
_ctx.$slots.prepend ? {
|
|
97
|
+
name: "prepend",
|
|
98
|
+
fn: withCtx(() => [
|
|
99
|
+
renderSlot(_ctx.$slots, "prepend")
|
|
100
|
+
]),
|
|
101
|
+
key: "1"
|
|
102
|
+
} : void 0,
|
|
103
|
+
_ctx.$slots.append ? {
|
|
104
|
+
name: "append",
|
|
105
|
+
fn: withCtx(() => [
|
|
106
|
+
renderSlot(_ctx.$slots, "append")
|
|
107
|
+
]),
|
|
108
|
+
key: "2"
|
|
109
|
+
} : void 0,
|
|
110
|
+
_ctx.$slots.prefix ? {
|
|
111
|
+
name: "prefix",
|
|
112
|
+
fn: withCtx(() => [
|
|
113
|
+
renderSlot(_ctx.$slots, "prefix")
|
|
114
|
+
]),
|
|
115
|
+
key: "3"
|
|
116
|
+
} : void 0,
|
|
117
|
+
_ctx.$slots.suffix ? {
|
|
118
|
+
name: "suffix",
|
|
119
|
+
fn: withCtx(() => [
|
|
120
|
+
renderSlot(_ctx.$slots, "suffix")
|
|
121
|
+
]),
|
|
122
|
+
key: "4"
|
|
123
|
+
} : void 0
|
|
124
|
+
]), 1032, ["model-value", "options", "disabled", "placeholder", "size", "popupProps"]);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
});
|
|
3
128
|
|
|
4
129
|
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
5
130
|
...{
|
|
@@ -151,7 +276,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
151
276
|
fullscreen: { type: Boolean },
|
|
152
277
|
closeOnClickModal: { type: Boolean },
|
|
153
278
|
closeOnPressEscape: { type: Boolean },
|
|
154
|
-
destroyOnClose: { type: Boolean }
|
|
279
|
+
destroyOnClose: { type: Boolean },
|
|
280
|
+
showClose: { type: Boolean }
|
|
155
281
|
},
|
|
156
282
|
emits: ["close", "update:modelValue"],
|
|
157
283
|
setup(__props, { emit: __emit }) {
|
|
@@ -169,6 +295,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
169
295
|
header: __props.title,
|
|
170
296
|
width: __props.width,
|
|
171
297
|
mode: __props.fullscreen ? "full-screen" : "modal",
|
|
298
|
+
"close-btn": __props.showClose,
|
|
172
299
|
"close-on-overlay-click": __props.closeOnClickModal,
|
|
173
300
|
"close-on-esc-keydown": __props.closeOnPressEscape,
|
|
174
301
|
"destroy-on-close": __props.destroyOnClose,
|
|
@@ -184,7 +311,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
184
311
|
]),
|
|
185
312
|
_: 3
|
|
186
313
|
/* FORWARDED */
|
|
187
|
-
}, 8, ["visible", "attach", "header", "width", "mode", "close-on-overlay-click", "close-on-esc-keydown", "destroy-on-close", "onBeforeOpen"]);
|
|
314
|
+
}, 8, ["visible", "attach", "header", "width", "mode", "close-btn", "close-on-overlay-click", "close-on-esc-keydown", "destroy-on-close", "onBeforeOpen"]);
|
|
188
315
|
};
|
|
189
316
|
}
|
|
190
317
|
});
|
|
@@ -219,7 +346,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
219
346
|
size: {},
|
|
220
347
|
autosize: { type: [Boolean, Object] }
|
|
221
348
|
},
|
|
222
|
-
emits: ["change", "input", "blur", "focus", "update:modelValue"],
|
|
349
|
+
emits: ["change", "input", "blur", "focus", "click", "update:modelValue"],
|
|
223
350
|
setup(__props, { emit: __emit }) {
|
|
224
351
|
const props = __props;
|
|
225
352
|
const emit = __emit;
|
|
@@ -248,6 +375,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
248
375
|
const focusHandler = (...args) => {
|
|
249
376
|
emit("focus", ...args);
|
|
250
377
|
};
|
|
378
|
+
const clickHandler = (...args) => {
|
|
379
|
+
emit("click", ...args);
|
|
380
|
+
};
|
|
251
381
|
const updateModelValue = (...args) => {
|
|
252
382
|
emit("update:modelValue", ...args);
|
|
253
383
|
};
|
|
@@ -265,6 +395,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
265
395
|
onChange: changeHandler,
|
|
266
396
|
onBlur: blurHandler,
|
|
267
397
|
onFocus: focusHandler,
|
|
398
|
+
onClick: clickHandler,
|
|
268
399
|
"onUpdate:modelValue": updateModelValue
|
|
269
400
|
}, null, 8, ["modelValue", "size", "disabled", "placeholder", "rows", "autosize"])) : (openBlock(), createBlock(
|
|
270
401
|
unref(InputAdornment),
|
|
@@ -281,6 +412,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
281
412
|
onChange: changeHandler,
|
|
282
413
|
onBlur: blurHandler,
|
|
283
414
|
onFocus: focusHandler,
|
|
415
|
+
onClick: clickHandler,
|
|
284
416
|
"onUpdate:modelValue": updateModelValue
|
|
285
417
|
}, createSlots({
|
|
286
418
|
_: 2
|
|
@@ -563,6 +695,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
563
695
|
return item.cell?.({ row, $index: rowIndex });
|
|
564
696
|
};
|
|
565
697
|
}
|
|
698
|
+
if (item.title) {
|
|
699
|
+
column.title = (h, data) => {
|
|
700
|
+
return item.title?.(data);
|
|
701
|
+
};
|
|
702
|
+
}
|
|
566
703
|
columns.push(column);
|
|
567
704
|
}
|
|
568
705
|
return columns;
|
|
@@ -655,6 +792,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
655
792
|
addable: __props.editable,
|
|
656
793
|
theme: __props.type === "card" ? "card" : "normal",
|
|
657
794
|
placement: __props.tabPosition,
|
|
795
|
+
"scroll-position": "auto",
|
|
658
796
|
onAdd: onTabAdd,
|
|
659
797
|
onChange: tabClickHandler,
|
|
660
798
|
onRemove: onTabRemove,
|
|
@@ -746,6 +884,10 @@ const adapter = {
|
|
|
746
884
|
}
|
|
747
885
|
},
|
|
748
886
|
components: {
|
|
887
|
+
autocomplete: {
|
|
888
|
+
component: _sfc_main$c,
|
|
889
|
+
props: (props) => props
|
|
890
|
+
},
|
|
749
891
|
badge: {
|
|
750
892
|
component: Badge,
|
|
751
893
|
props: (props) => ({
|
|
@@ -908,7 +1050,8 @@ const adapter = {
|
|
|
908
1050
|
labelWidth: props.labelWidth,
|
|
909
1051
|
name: props.prop,
|
|
910
1052
|
rules: props.rules,
|
|
911
|
-
help: props.extra
|
|
1053
|
+
help: () => h("div", { innerHTML: props.extra }),
|
|
1054
|
+
labelAlign: props.labelPosition
|
|
912
1055
|
})
|
|
913
1056
|
},
|
|
914
1057
|
icon: {
|
|
@@ -982,6 +1125,7 @@ const adapter = {
|
|
|
982
1125
|
multiple: props.multiple,
|
|
983
1126
|
valueType: props.valueKey,
|
|
984
1127
|
remoteMethod: props.onSearch,
|
|
1128
|
+
creatable: props.allowCreate,
|
|
985
1129
|
size: props.size === "default" ? "medium" : props.size,
|
|
986
1130
|
popupProps: {
|
|
987
1131
|
overlayClassName: props.popperClass
|
|
@@ -4,6 +4,131 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.TMagicTdesignVueNextAdapter = factory(global.Vue, global.tdesignVueNext));
|
|
5
5
|
})(this, (function (vue, tdesignVueNext) { 'use strict';
|
|
6
6
|
|
|
7
|
+
const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
8
|
+
...{
|
|
9
|
+
name: "TTDesignAdapterAutoComplete"
|
|
10
|
+
},
|
|
11
|
+
__name: "AutoComplete",
|
|
12
|
+
props: {
|
|
13
|
+
modelValue: {},
|
|
14
|
+
placeholder: {},
|
|
15
|
+
clearable: { type: Boolean },
|
|
16
|
+
disabled: { type: Boolean },
|
|
17
|
+
triggerOnFocus: { type: Boolean },
|
|
18
|
+
valueKey: {},
|
|
19
|
+
debounce: {},
|
|
20
|
+
size: {},
|
|
21
|
+
placement: {},
|
|
22
|
+
fetchSuggestions: { type: Function }
|
|
23
|
+
},
|
|
24
|
+
emits: ["change", "input", "blur", "focus", "click", "update:modelValue"],
|
|
25
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
26
|
+
const emit = __emit;
|
|
27
|
+
const props = __props;
|
|
28
|
+
const options = vue.ref([]);
|
|
29
|
+
vue.onMounted(() => {
|
|
30
|
+
if (typeof props.fetchSuggestions === "function") {
|
|
31
|
+
props.fetchSuggestions("", (data) => {
|
|
32
|
+
options.value = data;
|
|
33
|
+
});
|
|
34
|
+
} else if (Array.isArray(props.fetchSuggestions)) {
|
|
35
|
+
options.value = props.fetchSuggestions;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const filterHandler = (keyword, _option) => {
|
|
39
|
+
if (typeof props.fetchSuggestions === "function") {
|
|
40
|
+
props.fetchSuggestions(keyword, (data) => {
|
|
41
|
+
options.value = data;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
};
|
|
46
|
+
const changeHandler = (...args) => {
|
|
47
|
+
emit("change", ...args);
|
|
48
|
+
};
|
|
49
|
+
const inputHandler = (...args) => {
|
|
50
|
+
emit("input", ...args);
|
|
51
|
+
};
|
|
52
|
+
const blurHandler = (...args) => {
|
|
53
|
+
emit("blur", ...args);
|
|
54
|
+
};
|
|
55
|
+
const focusHandler = (...args) => {
|
|
56
|
+
emit("focus", ...args);
|
|
57
|
+
};
|
|
58
|
+
const clickHandler = (...args) => {
|
|
59
|
+
emit("click", ...args);
|
|
60
|
+
};
|
|
61
|
+
const updateModelValue = (...args) => {
|
|
62
|
+
emit("update:modelValue", ...args);
|
|
63
|
+
};
|
|
64
|
+
__expose({
|
|
65
|
+
blur: () => {
|
|
66
|
+
},
|
|
67
|
+
focus: () => {
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return (_ctx, _cache) => {
|
|
71
|
+
return vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.AutoComplete), {
|
|
72
|
+
ref: "autocomplete",
|
|
73
|
+
"model-value": __props.modelValue,
|
|
74
|
+
options: options.value,
|
|
75
|
+
disabled: __props.disabled,
|
|
76
|
+
placeholder: __props.placeholder,
|
|
77
|
+
size: __props.size === "default" ? "medium" : __props.size,
|
|
78
|
+
popupProps: {
|
|
79
|
+
trigger: props.triggerOnFocus ? "focus" : "hover"
|
|
80
|
+
},
|
|
81
|
+
filter: filterHandler,
|
|
82
|
+
onKeypress: inputHandler,
|
|
83
|
+
onChange: changeHandler,
|
|
84
|
+
onBlur: blurHandler,
|
|
85
|
+
onFocus: focusHandler,
|
|
86
|
+
onClick: clickHandler,
|
|
87
|
+
"onUpdate:modelValue": updateModelValue
|
|
88
|
+
}, vue.createSlots({
|
|
89
|
+
_: 2
|
|
90
|
+
/* DYNAMIC */
|
|
91
|
+
}, [
|
|
92
|
+
_ctx.$slots.default ? {
|
|
93
|
+
name: "option",
|
|
94
|
+
fn: vue.withCtx(({ option }) => [
|
|
95
|
+
vue.renderSlot(_ctx.$slots, "default", { item: option })
|
|
96
|
+
]),
|
|
97
|
+
key: "0"
|
|
98
|
+
} : void 0,
|
|
99
|
+
_ctx.$slots.prepend ? {
|
|
100
|
+
name: "prepend",
|
|
101
|
+
fn: vue.withCtx(() => [
|
|
102
|
+
vue.renderSlot(_ctx.$slots, "prepend")
|
|
103
|
+
]),
|
|
104
|
+
key: "1"
|
|
105
|
+
} : void 0,
|
|
106
|
+
_ctx.$slots.append ? {
|
|
107
|
+
name: "append",
|
|
108
|
+
fn: vue.withCtx(() => [
|
|
109
|
+
vue.renderSlot(_ctx.$slots, "append")
|
|
110
|
+
]),
|
|
111
|
+
key: "2"
|
|
112
|
+
} : void 0,
|
|
113
|
+
_ctx.$slots.prefix ? {
|
|
114
|
+
name: "prefix",
|
|
115
|
+
fn: vue.withCtx(() => [
|
|
116
|
+
vue.renderSlot(_ctx.$slots, "prefix")
|
|
117
|
+
]),
|
|
118
|
+
key: "3"
|
|
119
|
+
} : void 0,
|
|
120
|
+
_ctx.$slots.suffix ? {
|
|
121
|
+
name: "suffix",
|
|
122
|
+
fn: vue.withCtx(() => [
|
|
123
|
+
vue.renderSlot(_ctx.$slots, "suffix")
|
|
124
|
+
]),
|
|
125
|
+
key: "4"
|
|
126
|
+
} : void 0
|
|
127
|
+
]), 1032, ["model-value", "options", "disabled", "placeholder", "size", "popupProps"]);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
7
132
|
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
8
133
|
...{
|
|
9
134
|
name: "TTDesignAdapterCheckbox"
|
|
@@ -154,7 +279,8 @@
|
|
|
154
279
|
fullscreen: { type: Boolean },
|
|
155
280
|
closeOnClickModal: { type: Boolean },
|
|
156
281
|
closeOnPressEscape: { type: Boolean },
|
|
157
|
-
destroyOnClose: { type: Boolean }
|
|
282
|
+
destroyOnClose: { type: Boolean },
|
|
283
|
+
showClose: { type: Boolean }
|
|
158
284
|
},
|
|
159
285
|
emits: ["close", "update:modelValue"],
|
|
160
286
|
setup(__props, { emit: __emit }) {
|
|
@@ -172,6 +298,7 @@
|
|
|
172
298
|
header: __props.title,
|
|
173
299
|
width: __props.width,
|
|
174
300
|
mode: __props.fullscreen ? "full-screen" : "modal",
|
|
301
|
+
"close-btn": __props.showClose,
|
|
175
302
|
"close-on-overlay-click": __props.closeOnClickModal,
|
|
176
303
|
"close-on-esc-keydown": __props.closeOnPressEscape,
|
|
177
304
|
"destroy-on-close": __props.destroyOnClose,
|
|
@@ -187,7 +314,7 @@
|
|
|
187
314
|
]),
|
|
188
315
|
_: 3
|
|
189
316
|
/* FORWARDED */
|
|
190
|
-
}, 8, ["visible", "attach", "header", "width", "mode", "close-on-overlay-click", "close-on-esc-keydown", "destroy-on-close", "onBeforeOpen"]);
|
|
317
|
+
}, 8, ["visible", "attach", "header", "width", "mode", "close-btn", "close-on-overlay-click", "close-on-esc-keydown", "destroy-on-close", "onBeforeOpen"]);
|
|
191
318
|
};
|
|
192
319
|
}
|
|
193
320
|
});
|
|
@@ -222,7 +349,7 @@
|
|
|
222
349
|
size: {},
|
|
223
350
|
autosize: { type: [Boolean, Object] }
|
|
224
351
|
},
|
|
225
|
-
emits: ["change", "input", "blur", "focus", "update:modelValue"],
|
|
352
|
+
emits: ["change", "input", "blur", "focus", "click", "update:modelValue"],
|
|
226
353
|
setup(__props, { emit: __emit }) {
|
|
227
354
|
const props = __props;
|
|
228
355
|
const emit = __emit;
|
|
@@ -251,6 +378,9 @@
|
|
|
251
378
|
const focusHandler = (...args) => {
|
|
252
379
|
emit("focus", ...args);
|
|
253
380
|
};
|
|
381
|
+
const clickHandler = (...args) => {
|
|
382
|
+
emit("click", ...args);
|
|
383
|
+
};
|
|
254
384
|
const updateModelValue = (...args) => {
|
|
255
385
|
emit("update:modelValue", ...args);
|
|
256
386
|
};
|
|
@@ -268,6 +398,7 @@
|
|
|
268
398
|
onChange: changeHandler,
|
|
269
399
|
onBlur: blurHandler,
|
|
270
400
|
onFocus: focusHandler,
|
|
401
|
+
onClick: clickHandler,
|
|
271
402
|
"onUpdate:modelValue": updateModelValue
|
|
272
403
|
}, null, 8, ["modelValue", "size", "disabled", "placeholder", "rows", "autosize"])) : (vue.openBlock(), vue.createBlock(
|
|
273
404
|
vue.unref(tdesignVueNext.InputAdornment),
|
|
@@ -284,6 +415,7 @@
|
|
|
284
415
|
onChange: changeHandler,
|
|
285
416
|
onBlur: blurHandler,
|
|
286
417
|
onFocus: focusHandler,
|
|
418
|
+
onClick: clickHandler,
|
|
287
419
|
"onUpdate:modelValue": updateModelValue
|
|
288
420
|
}, vue.createSlots({
|
|
289
421
|
_: 2
|
|
@@ -566,6 +698,11 @@
|
|
|
566
698
|
return item.cell?.({ row, $index: rowIndex });
|
|
567
699
|
};
|
|
568
700
|
}
|
|
701
|
+
if (item.title) {
|
|
702
|
+
column.title = (h, data) => {
|
|
703
|
+
return item.title?.(data);
|
|
704
|
+
};
|
|
705
|
+
}
|
|
569
706
|
columns.push(column);
|
|
570
707
|
}
|
|
571
708
|
return columns;
|
|
@@ -658,6 +795,7 @@
|
|
|
658
795
|
addable: __props.editable,
|
|
659
796
|
theme: __props.type === "card" ? "card" : "normal",
|
|
660
797
|
placement: __props.tabPosition,
|
|
798
|
+
"scroll-position": "auto",
|
|
661
799
|
onAdd: onTabAdd,
|
|
662
800
|
onChange: tabClickHandler,
|
|
663
801
|
onRemove: onTabRemove,
|
|
@@ -749,6 +887,10 @@
|
|
|
749
887
|
}
|
|
750
888
|
},
|
|
751
889
|
components: {
|
|
890
|
+
autocomplete: {
|
|
891
|
+
component: _sfc_main$c,
|
|
892
|
+
props: (props) => props
|
|
893
|
+
},
|
|
752
894
|
badge: {
|
|
753
895
|
component: tdesignVueNext.Badge,
|
|
754
896
|
props: (props) => ({
|
|
@@ -911,7 +1053,8 @@
|
|
|
911
1053
|
labelWidth: props.labelWidth,
|
|
912
1054
|
name: props.prop,
|
|
913
1055
|
rules: props.rules,
|
|
914
|
-
help: props.extra
|
|
1056
|
+
help: () => vue.h("div", { innerHTML: props.extra }),
|
|
1057
|
+
labelAlign: props.labelPosition
|
|
915
1058
|
})
|
|
916
1059
|
},
|
|
917
1060
|
icon: {
|
|
@@ -985,6 +1128,7 @@
|
|
|
985
1128
|
multiple: props.multiple,
|
|
986
1129
|
valueType: props.valueKey,
|
|
987
1130
|
remoteMethod: props.onSearch,
|
|
1131
|
+
creatable: props.allowCreate,
|
|
988
1132
|
size: props.size === "default" ? "medium" : props.size,
|
|
989
1133
|
popupProps: {
|
|
990
1134
|
overlayClassName: props.popperClass
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.7.0-beta.
|
|
2
|
+
"version": "1.7.0-beta.4",
|
|
3
3
|
"name": "@tmagic/tdesign-vue-next-adapter",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/tmagic-tdesign-vue-next-adapter.umd.cjs",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"tdesign-vue-next": "^1.17.1",
|
|
39
|
-
"vue": "^3.5.
|
|
39
|
+
"vue": "^3.5.24",
|
|
40
40
|
"typescript": "^5.9.3",
|
|
41
|
-
"@tmagic/design": "1.7.0-beta.
|
|
41
|
+
"@tmagic/design": "1.7.0-beta.4"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"typescript": {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TAutoComplete
|
|
3
|
+
ref="autocomplete"
|
|
4
|
+
:model-value="modelValue"
|
|
5
|
+
:options="options"
|
|
6
|
+
:disabled="disabled"
|
|
7
|
+
:placeholder="placeholder"
|
|
8
|
+
:size="size === 'default' ? 'medium' : size"
|
|
9
|
+
:popupProps="{
|
|
10
|
+
trigger: props.triggerOnFocus ? 'focus' : 'hover',
|
|
11
|
+
}"
|
|
12
|
+
:filter="filterHandler"
|
|
13
|
+
@keypress="inputHandler"
|
|
14
|
+
@change="changeHandler"
|
|
15
|
+
@blur="blurHandler"
|
|
16
|
+
@focus="focusHandler"
|
|
17
|
+
@click="clickHandler"
|
|
18
|
+
@update:modelValue="updateModelValue"
|
|
19
|
+
>
|
|
20
|
+
<template #option="{ option }" v-if="$slots.default">
|
|
21
|
+
<slot name="default" :item="option"></slot>
|
|
22
|
+
</template>
|
|
23
|
+
<template #prepend v-if="$slots.prepend">
|
|
24
|
+
<slot name="prepend"></slot>
|
|
25
|
+
</template>
|
|
26
|
+
<template #append v-if="$slots.append">
|
|
27
|
+
<slot name="append"></slot>
|
|
28
|
+
</template>
|
|
29
|
+
<template #prefix v-if="$slots.prefix">
|
|
30
|
+
<slot name="prefix"></slot>
|
|
31
|
+
</template>
|
|
32
|
+
<template #suffix v-if="$slots.suffix">
|
|
33
|
+
<slot name="suffix"></slot>
|
|
34
|
+
</template>
|
|
35
|
+
</TAutoComplete>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { onMounted, ref } from 'vue';
|
|
40
|
+
import { AutoComplete as TAutoComplete, type AutoCompleteOption } from 'tdesign-vue-next';
|
|
41
|
+
|
|
42
|
+
import type { AutocompleteProps } from '@tmagic/design';
|
|
43
|
+
|
|
44
|
+
defineOptions({
|
|
45
|
+
name: 'TTDesignAdapterAutoComplete',
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const emit = defineEmits(['change', 'input', 'blur', 'focus', 'click', 'update:modelValue']);
|
|
49
|
+
|
|
50
|
+
const props = defineProps<AutocompleteProps>();
|
|
51
|
+
|
|
52
|
+
const options = ref<any[]>([]);
|
|
53
|
+
|
|
54
|
+
onMounted(() => {
|
|
55
|
+
if (typeof props.fetchSuggestions === 'function') {
|
|
56
|
+
props.fetchSuggestions('', (data: any[]) => {
|
|
57
|
+
options.value = data;
|
|
58
|
+
});
|
|
59
|
+
} else if (Array.isArray(props.fetchSuggestions)) {
|
|
60
|
+
options.value = props.fetchSuggestions;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const filterHandler = (keyword: string, _option: AutoCompleteOption) => {
|
|
65
|
+
if (typeof props.fetchSuggestions === 'function') {
|
|
66
|
+
props.fetchSuggestions(keyword, (data: any[]) => {
|
|
67
|
+
options.value = data;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return true;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const changeHandler = (...args: any[]) => {
|
|
75
|
+
emit('change', ...args);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const inputHandler = (...args: any[]) => {
|
|
79
|
+
emit('input', ...args);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const blurHandler = (...args: any[]) => {
|
|
83
|
+
emit('blur', ...args);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const focusHandler = (...args: any[]) => {
|
|
87
|
+
emit('focus', ...args);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const clickHandler = (...args: any[]) => {
|
|
91
|
+
emit('click', ...args);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const updateModelValue = (...args: any[]) => {
|
|
95
|
+
emit('update:modelValue', ...args);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
defineExpose({
|
|
99
|
+
blur: () => {},
|
|
100
|
+
focus: () => {},
|
|
101
|
+
});
|
|
102
|
+
</script>
|
package/src/Dialog.vue
CHANGED
package/src/Input.vue
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
@change="changeHandler"
|
|
13
13
|
@blur="blurHandler"
|
|
14
14
|
@focus="focusHandler"
|
|
15
|
+
@click="clickHandler"
|
|
15
16
|
@update:modelValue="updateModelValue"
|
|
16
17
|
></TTextarea>
|
|
17
18
|
<TInputAdornment v-else>
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
@change="changeHandler"
|
|
32
33
|
@blur="blurHandler"
|
|
33
34
|
@focus="focusHandler"
|
|
35
|
+
@click="clickHandler"
|
|
34
36
|
@update:modelValue="updateModelValue"
|
|
35
37
|
>
|
|
36
38
|
<template #prefix-icon v-if="$slots.prefix">
|
|
@@ -59,7 +61,7 @@ const props = defineProps<
|
|
|
59
61
|
}
|
|
60
62
|
>();
|
|
61
63
|
|
|
62
|
-
const emit = defineEmits(['change', 'input', 'blur', 'focus', 'update:modelValue']);
|
|
64
|
+
const emit = defineEmits(['change', 'input', 'blur', 'focus', 'click', 'update:modelValue']);
|
|
63
65
|
|
|
64
66
|
const textareaRef = useTemplateRef('textarea');
|
|
65
67
|
|
|
@@ -92,6 +94,10 @@ const focusHandler = (...args: any[]) => {
|
|
|
92
94
|
emit('focus', ...args);
|
|
93
95
|
};
|
|
94
96
|
|
|
97
|
+
const clickHandler = (...args: any[]) => {
|
|
98
|
+
emit('click', ...args);
|
|
99
|
+
};
|
|
100
|
+
|
|
95
101
|
const updateModelValue = (...args: any[]) => {
|
|
96
102
|
emit('update:modelValue', ...args);
|
|
97
103
|
};
|
package/src/Table.vue
CHANGED
package/src/Tabs.vue
CHANGED
package/src/index.ts
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
} from 'tdesign-vue-next';
|
|
36
36
|
|
|
37
37
|
import type {
|
|
38
|
+
AutocompleteProps,
|
|
38
39
|
BadgeProps,
|
|
39
40
|
ButtonProps,
|
|
40
41
|
CardProps,
|
|
@@ -75,6 +76,7 @@ import type {
|
|
|
75
76
|
UploadProps,
|
|
76
77
|
} from '@tmagic/design';
|
|
77
78
|
|
|
79
|
+
import AutoComplete from './AutoComplete.vue';
|
|
78
80
|
import Checkbox from './Checkbox.vue';
|
|
79
81
|
import DatePicker from './DatePicker.vue';
|
|
80
82
|
import Dialog from './Dialog.vue';
|
|
@@ -168,6 +170,10 @@ const adapter: any = {
|
|
|
168
170
|
},
|
|
169
171
|
},
|
|
170
172
|
components: {
|
|
173
|
+
autocomplete: {
|
|
174
|
+
component: AutoComplete,
|
|
175
|
+
props: (props: AutocompleteProps) => props,
|
|
176
|
+
},
|
|
171
177
|
badge: {
|
|
172
178
|
component: TBadge,
|
|
173
179
|
props: (props: BadgeProps) => ({
|
|
@@ -348,7 +354,8 @@ const adapter: any = {
|
|
|
348
354
|
labelWidth: props.labelWidth,
|
|
349
355
|
name: props.prop,
|
|
350
356
|
rules: props.rules,
|
|
351
|
-
help: props.extra,
|
|
357
|
+
help: () => h('div', { innerHTML: props.extra }),
|
|
358
|
+
labelAlign: props.labelPosition,
|
|
352
359
|
}),
|
|
353
360
|
},
|
|
354
361
|
|
|
@@ -434,6 +441,7 @@ const adapter: any = {
|
|
|
434
441
|
multiple: props.multiple,
|
|
435
442
|
valueType: props.valueKey,
|
|
436
443
|
remoteMethod: props.onSearch,
|
|
444
|
+
creatable: props.allowCreate,
|
|
437
445
|
size: props.size === 'default' ? 'medium' : props.size,
|
|
438
446
|
popupProps: {
|
|
439
447
|
overlayClassName: props.popperClass,
|