@tmagic/tdesign-vue-next-adapter 1.7.0-beta.1 → 1.7.0-beta.3
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 +99 -24
- package/dist/tmagic-tdesign-vue-next-adapter.umd.cjs +98 -23
- package/package.json +2 -2
- package/src/DatePicker.vue +4 -0
- package/src/Input.vue +1 -0
- package/src/Pagination.vue +43 -0
- package/src/index.ts +47 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, watch, createBlock, openBlock, unref, createSlots, withCtx, renderSlot, computed, createElementBlock, useTemplateRef, createVNode, createElementVNode, h } from 'vue';
|
|
2
|
-
import { Checkbox, DateRangePicker, DatePicker, Dialog, Textarea, InputAdornment, Input, Popconfirm, Radio, RadioButton, Table, Tabs, LoadingDirective, Upload, Tooltip, TimePicker, Tag, TabPanel, Switch, Steps, StepItem, Select, Row, RadioGroup,
|
|
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';
|
|
3
3
|
|
|
4
|
-
const _sfc_main$
|
|
4
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
5
5
|
...{
|
|
6
6
|
name: "TTDesignAdapterCheckbox"
|
|
7
7
|
},
|
|
@@ -65,7 +65,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const _sfc_main$
|
|
68
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
69
69
|
__name: "DatePicker",
|
|
70
70
|
props: {
|
|
71
71
|
type: { default: "date" },
|
|
@@ -106,6 +106,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
106
106
|
return (_ctx, _cache) => {
|
|
107
107
|
return __props.type.endsWith("range") ? (openBlock(), createBlock(unref(DateRangePicker), {
|
|
108
108
|
key: 0,
|
|
109
|
+
"allow-input": "",
|
|
110
|
+
clearable: "",
|
|
111
|
+
"enable-time-picker": "",
|
|
109
112
|
modelValue: __props.modelValue,
|
|
110
113
|
mode: mode.value,
|
|
111
114
|
placeholder: [__props.startPlaceholder || "", __props.endPlaceholder || ""],
|
|
@@ -118,6 +121,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
118
121
|
"onUpdate:modelValue": updateModelValue
|
|
119
122
|
}, null, 8, ["modelValue", "mode", "placeholder", "disabled", "size", "separator", "format", "valueType"])) : (openBlock(), createBlock(unref(DatePicker), {
|
|
120
123
|
key: 1,
|
|
124
|
+
clearable: "",
|
|
121
125
|
modelValue: __props.modelValue,
|
|
122
126
|
mode: mode.value,
|
|
123
127
|
placeholder: __props.placeholder,
|
|
@@ -133,7 +137,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
133
137
|
}
|
|
134
138
|
});
|
|
135
139
|
|
|
136
|
-
const _sfc_main$
|
|
140
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
137
141
|
...{
|
|
138
142
|
name: "TTDesignAdapterDialog"
|
|
139
143
|
},
|
|
@@ -186,7 +190,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
186
190
|
});
|
|
187
191
|
|
|
188
192
|
const _hoisted_1$1 = { class: "t-t-design-adapter-icon t-icon" };
|
|
189
|
-
const _sfc_main$
|
|
193
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
190
194
|
...{
|
|
191
195
|
name: "TTDesignAdapterIcon"
|
|
192
196
|
},
|
|
@@ -200,7 +204,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
200
204
|
}
|
|
201
205
|
});
|
|
202
206
|
|
|
203
|
-
const _sfc_main$
|
|
207
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
204
208
|
...{
|
|
205
209
|
name: "TTDesignAdapterInput"
|
|
206
210
|
},
|
|
@@ -212,7 +216,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
212
216
|
placeholder: {},
|
|
213
217
|
rows: {},
|
|
214
218
|
type: {},
|
|
215
|
-
size: {}
|
|
219
|
+
size: {},
|
|
220
|
+
autosize: { type: [Boolean, Object] }
|
|
216
221
|
},
|
|
217
222
|
emits: ["change", "input", "blur", "focus", "update:modelValue"],
|
|
218
223
|
setup(__props, { emit: __emit }) {
|
|
@@ -255,12 +260,13 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
255
260
|
disabled: __props.disabled,
|
|
256
261
|
placeholder: __props.placeholder,
|
|
257
262
|
rows: __props.rows,
|
|
263
|
+
autosize: __props.autosize,
|
|
258
264
|
onKeypress: inputHandler,
|
|
259
265
|
onChange: changeHandler,
|
|
260
266
|
onBlur: blurHandler,
|
|
261
267
|
onFocus: focusHandler,
|
|
262
268
|
"onUpdate:modelValue": updateModelValue
|
|
263
|
-
}, null, 8, ["modelValue", "size", "disabled", "placeholder", "rows"])) : (openBlock(), createBlock(
|
|
269
|
+
}, null, 8, ["modelValue", "size", "disabled", "placeholder", "rows", "autosize"])) : (openBlock(), createBlock(
|
|
264
270
|
unref(InputAdornment),
|
|
265
271
|
{ key: 1 },
|
|
266
272
|
createSlots({
|
|
@@ -321,6 +327,51 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
321
327
|
}
|
|
322
328
|
});
|
|
323
329
|
|
|
330
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
331
|
+
...{
|
|
332
|
+
name: "TTDesignAdapterPagination"
|
|
333
|
+
},
|
|
334
|
+
__name: "Pagination",
|
|
335
|
+
props: {
|
|
336
|
+
layout: {},
|
|
337
|
+
hideOnSinglePage: { type: Boolean },
|
|
338
|
+
curPage: {},
|
|
339
|
+
pageSizes: {},
|
|
340
|
+
pageSize: {},
|
|
341
|
+
total: {},
|
|
342
|
+
size: {}
|
|
343
|
+
},
|
|
344
|
+
emits: ["size-change", "current-change", "update:current-page", "update:page-size"],
|
|
345
|
+
setup(__props, { emit: __emit }) {
|
|
346
|
+
const emit = __emit;
|
|
347
|
+
const handleCurrentChange = (...args) => {
|
|
348
|
+
emit("current-change", ...args);
|
|
349
|
+
};
|
|
350
|
+
const handleSizeChange = (...args) => {
|
|
351
|
+
emit("size-change", ...args);
|
|
352
|
+
};
|
|
353
|
+
const updateCurrentPage = (...args) => {
|
|
354
|
+
emit("update:current-page", ...args);
|
|
355
|
+
};
|
|
356
|
+
const updatePageSize = (...args) => {
|
|
357
|
+
emit("update:page-size", ...args);
|
|
358
|
+
};
|
|
359
|
+
return (_ctx, _cache) => {
|
|
360
|
+
return openBlock(), createBlock(unref(Pagination), {
|
|
361
|
+
total: __props.total,
|
|
362
|
+
current: __props.curPage,
|
|
363
|
+
size: __props.size === "small" ? "small" : "medium",
|
|
364
|
+
"page-size": __props.pageSize,
|
|
365
|
+
"page-size-options": __props.pageSizes,
|
|
366
|
+
onCurrentChange: handleCurrentChange,
|
|
367
|
+
onPageSizeChange: handleSizeChange,
|
|
368
|
+
"onUpdate:current": updateCurrentPage,
|
|
369
|
+
"onUpdate:pageSize": updatePageSize
|
|
370
|
+
}, null, 8, ["total", "current", "size", "page-size", "page-size-options"]);
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
|
|
324
375
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
325
376
|
...{
|
|
326
377
|
name: "TTDesignAdapterPopconfirm"
|
|
@@ -627,8 +678,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
627
678
|
}
|
|
628
679
|
});
|
|
629
680
|
|
|
681
|
+
const messageBox = (options) => MessagePlugin(options.type || "info", {
|
|
682
|
+
duration: options.duration || 3e3,
|
|
683
|
+
content: options.message
|
|
684
|
+
});
|
|
685
|
+
messageBox.success = MessagePlugin.success;
|
|
686
|
+
messageBox.error = MessagePlugin.error;
|
|
687
|
+
messageBox.warning = MessagePlugin.warning;
|
|
688
|
+
messageBox.info = MessagePlugin.info;
|
|
689
|
+
const zIndex = ref(0);
|
|
690
|
+
const DEFAULT_INITIAL_Z_INDEX = 2500;
|
|
691
|
+
const useZIndex = (zIndexOverrides) => {
|
|
692
|
+
const zIndexInjection = zIndexOverrides;
|
|
693
|
+
const initialZIndex = computed(() => {
|
|
694
|
+
const zIndexFromInjection = unref(zIndexInjection);
|
|
695
|
+
return zIndexFromInjection ?? DEFAULT_INITIAL_Z_INDEX;
|
|
696
|
+
});
|
|
697
|
+
const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
|
|
698
|
+
const nextZIndex = () => {
|
|
699
|
+
zIndex.value += 1;
|
|
700
|
+
return currentZIndex.value;
|
|
701
|
+
};
|
|
702
|
+
return {
|
|
703
|
+
initialZIndex,
|
|
704
|
+
currentZIndex,
|
|
705
|
+
nextZIndex
|
|
706
|
+
};
|
|
707
|
+
};
|
|
630
708
|
const adapter = {
|
|
631
|
-
|
|
709
|
+
adapterType: "tdesign-vue-next",
|
|
710
|
+
message: messageBox,
|
|
632
711
|
messageBox: {
|
|
633
712
|
alert: (msg, title) => {
|
|
634
713
|
return new Promise((resolve, reject) => {
|
|
@@ -678,9 +757,9 @@ const adapter = {
|
|
|
678
757
|
button: {
|
|
679
758
|
component: Button,
|
|
680
759
|
props: (props) => ({
|
|
681
|
-
theme: props.type,
|
|
760
|
+
theme: props.type ? props.type : "default",
|
|
682
761
|
size: props.size === "default" ? "medium" : props.size,
|
|
683
|
-
icon: props.icon ? () => h(_sfc_main$
|
|
762
|
+
icon: props.icon ? () => h(_sfc_main$8, null, { default: () => h(props.icon) }) : void 0,
|
|
684
763
|
variant: props.link || props.text ? "text" : props.variant || "base",
|
|
685
764
|
shape: props.circle ? "circle" : "rectangle"
|
|
686
765
|
})
|
|
@@ -713,7 +792,7 @@ const adapter = {
|
|
|
713
792
|
})
|
|
714
793
|
},
|
|
715
794
|
checkbox: {
|
|
716
|
-
component: _sfc_main$
|
|
795
|
+
component: _sfc_main$b,
|
|
717
796
|
props: (props) => props
|
|
718
797
|
},
|
|
719
798
|
checkboxGroup: {
|
|
@@ -756,11 +835,11 @@ const adapter = {
|
|
|
756
835
|
})
|
|
757
836
|
},
|
|
758
837
|
datePicker: {
|
|
759
|
-
component: _sfc_main$
|
|
838
|
+
component: _sfc_main$a,
|
|
760
839
|
props: (props) => props
|
|
761
840
|
},
|
|
762
841
|
dialog: {
|
|
763
|
-
component: _sfc_main$
|
|
842
|
+
component: _sfc_main$9,
|
|
764
843
|
props: (props) => props
|
|
765
844
|
},
|
|
766
845
|
divider: {
|
|
@@ -833,11 +912,11 @@ const adapter = {
|
|
|
833
912
|
})
|
|
834
913
|
},
|
|
835
914
|
icon: {
|
|
836
|
-
component: _sfc_main$
|
|
915
|
+
component: _sfc_main$8,
|
|
837
916
|
props: (props) => props
|
|
838
917
|
},
|
|
839
918
|
input: {
|
|
840
|
-
component: _sfc_main$
|
|
919
|
+
component: _sfc_main$7,
|
|
841
920
|
props: (props) => props
|
|
842
921
|
},
|
|
843
922
|
inputNumber: {
|
|
@@ -866,13 +945,8 @@ const adapter = {
|
|
|
866
945
|
props: (props) => props
|
|
867
946
|
},
|
|
868
947
|
pagination: {
|
|
869
|
-
component:
|
|
870
|
-
props: (props) =>
|
|
871
|
-
current: props.curPage,
|
|
872
|
-
pageSizeOptions: props.pageSizes,
|
|
873
|
-
pageSize: props.pagesize,
|
|
874
|
-
total: props.total
|
|
875
|
-
})
|
|
948
|
+
component: _sfc_main$6,
|
|
949
|
+
props: (props) => props
|
|
876
950
|
},
|
|
877
951
|
radio: {
|
|
878
952
|
component: _sfc_main$4,
|
|
@@ -988,7 +1062,8 @@ const adapter = {
|
|
|
988
1062
|
props: (props) => props
|
|
989
1063
|
}
|
|
990
1064
|
},
|
|
991
|
-
loading: LoadingDirective
|
|
1065
|
+
loading: LoadingDirective,
|
|
1066
|
+
useZIndex
|
|
992
1067
|
};
|
|
993
1068
|
|
|
994
1069
|
export { adapter as default };
|
|
@@ -4,7 +4,7 @@
|
|
|
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$
|
|
7
|
+
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
8
8
|
...{
|
|
9
9
|
name: "TTDesignAdapterCheckbox"
|
|
10
10
|
},
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
const _sfc_main$
|
|
71
|
+
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
72
72
|
__name: "DatePicker",
|
|
73
73
|
props: {
|
|
74
74
|
type: { default: "date" },
|
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
return (_ctx, _cache) => {
|
|
110
110
|
return __props.type.endsWith("range") ? (vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.DateRangePicker), {
|
|
111
111
|
key: 0,
|
|
112
|
+
"allow-input": "",
|
|
113
|
+
clearable: "",
|
|
114
|
+
"enable-time-picker": "",
|
|
112
115
|
modelValue: __props.modelValue,
|
|
113
116
|
mode: mode.value,
|
|
114
117
|
placeholder: [__props.startPlaceholder || "", __props.endPlaceholder || ""],
|
|
@@ -121,6 +124,7 @@
|
|
|
121
124
|
"onUpdate:modelValue": updateModelValue
|
|
122
125
|
}, null, 8, ["modelValue", "mode", "placeholder", "disabled", "size", "separator", "format", "valueType"])) : (vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.DatePicker), {
|
|
123
126
|
key: 1,
|
|
127
|
+
clearable: "",
|
|
124
128
|
modelValue: __props.modelValue,
|
|
125
129
|
mode: mode.value,
|
|
126
130
|
placeholder: __props.placeholder,
|
|
@@ -136,7 +140,7 @@
|
|
|
136
140
|
}
|
|
137
141
|
});
|
|
138
142
|
|
|
139
|
-
const _sfc_main$
|
|
143
|
+
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
140
144
|
...{
|
|
141
145
|
name: "TTDesignAdapterDialog"
|
|
142
146
|
},
|
|
@@ -189,7 +193,7 @@
|
|
|
189
193
|
});
|
|
190
194
|
|
|
191
195
|
const _hoisted_1$1 = { class: "t-t-design-adapter-icon t-icon" };
|
|
192
|
-
const _sfc_main$
|
|
196
|
+
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
193
197
|
...{
|
|
194
198
|
name: "TTDesignAdapterIcon"
|
|
195
199
|
},
|
|
@@ -203,7 +207,7 @@
|
|
|
203
207
|
}
|
|
204
208
|
});
|
|
205
209
|
|
|
206
|
-
const _sfc_main$
|
|
210
|
+
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
207
211
|
...{
|
|
208
212
|
name: "TTDesignAdapterInput"
|
|
209
213
|
},
|
|
@@ -215,7 +219,8 @@
|
|
|
215
219
|
placeholder: {},
|
|
216
220
|
rows: {},
|
|
217
221
|
type: {},
|
|
218
|
-
size: {}
|
|
222
|
+
size: {},
|
|
223
|
+
autosize: { type: [Boolean, Object] }
|
|
219
224
|
},
|
|
220
225
|
emits: ["change", "input", "blur", "focus", "update:modelValue"],
|
|
221
226
|
setup(__props, { emit: __emit }) {
|
|
@@ -258,12 +263,13 @@
|
|
|
258
263
|
disabled: __props.disabled,
|
|
259
264
|
placeholder: __props.placeholder,
|
|
260
265
|
rows: __props.rows,
|
|
266
|
+
autosize: __props.autosize,
|
|
261
267
|
onKeypress: inputHandler,
|
|
262
268
|
onChange: changeHandler,
|
|
263
269
|
onBlur: blurHandler,
|
|
264
270
|
onFocus: focusHandler,
|
|
265
271
|
"onUpdate:modelValue": updateModelValue
|
|
266
|
-
}, null, 8, ["modelValue", "size", "disabled", "placeholder", "rows"])) : (vue.openBlock(), vue.createBlock(
|
|
272
|
+
}, null, 8, ["modelValue", "size", "disabled", "placeholder", "rows", "autosize"])) : (vue.openBlock(), vue.createBlock(
|
|
267
273
|
vue.unref(tdesignVueNext.InputAdornment),
|
|
268
274
|
{ key: 1 },
|
|
269
275
|
vue.createSlots({
|
|
@@ -324,6 +330,51 @@
|
|
|
324
330
|
}
|
|
325
331
|
});
|
|
326
332
|
|
|
333
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
334
|
+
...{
|
|
335
|
+
name: "TTDesignAdapterPagination"
|
|
336
|
+
},
|
|
337
|
+
__name: "Pagination",
|
|
338
|
+
props: {
|
|
339
|
+
layout: {},
|
|
340
|
+
hideOnSinglePage: { type: Boolean },
|
|
341
|
+
curPage: {},
|
|
342
|
+
pageSizes: {},
|
|
343
|
+
pageSize: {},
|
|
344
|
+
total: {},
|
|
345
|
+
size: {}
|
|
346
|
+
},
|
|
347
|
+
emits: ["size-change", "current-change", "update:current-page", "update:page-size"],
|
|
348
|
+
setup(__props, { emit: __emit }) {
|
|
349
|
+
const emit = __emit;
|
|
350
|
+
const handleCurrentChange = (...args) => {
|
|
351
|
+
emit("current-change", ...args);
|
|
352
|
+
};
|
|
353
|
+
const handleSizeChange = (...args) => {
|
|
354
|
+
emit("size-change", ...args);
|
|
355
|
+
};
|
|
356
|
+
const updateCurrentPage = (...args) => {
|
|
357
|
+
emit("update:current-page", ...args);
|
|
358
|
+
};
|
|
359
|
+
const updatePageSize = (...args) => {
|
|
360
|
+
emit("update:page-size", ...args);
|
|
361
|
+
};
|
|
362
|
+
return (_ctx, _cache) => {
|
|
363
|
+
return vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.Pagination), {
|
|
364
|
+
total: __props.total,
|
|
365
|
+
current: __props.curPage,
|
|
366
|
+
size: __props.size === "small" ? "small" : "medium",
|
|
367
|
+
"page-size": __props.pageSize,
|
|
368
|
+
"page-size-options": __props.pageSizes,
|
|
369
|
+
onCurrentChange: handleCurrentChange,
|
|
370
|
+
onPageSizeChange: handleSizeChange,
|
|
371
|
+
"onUpdate:current": updateCurrentPage,
|
|
372
|
+
"onUpdate:pageSize": updatePageSize
|
|
373
|
+
}, null, 8, ["total", "current", "size", "page-size", "page-size-options"]);
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
|
|
327
378
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
328
379
|
...{
|
|
329
380
|
name: "TTDesignAdapterPopconfirm"
|
|
@@ -630,8 +681,36 @@
|
|
|
630
681
|
}
|
|
631
682
|
});
|
|
632
683
|
|
|
684
|
+
const messageBox = (options) => tdesignVueNext.MessagePlugin(options.type || "info", {
|
|
685
|
+
duration: options.duration || 3e3,
|
|
686
|
+
content: options.message
|
|
687
|
+
});
|
|
688
|
+
messageBox.success = tdesignVueNext.MessagePlugin.success;
|
|
689
|
+
messageBox.error = tdesignVueNext.MessagePlugin.error;
|
|
690
|
+
messageBox.warning = tdesignVueNext.MessagePlugin.warning;
|
|
691
|
+
messageBox.info = tdesignVueNext.MessagePlugin.info;
|
|
692
|
+
const zIndex = vue.ref(0);
|
|
693
|
+
const DEFAULT_INITIAL_Z_INDEX = 2500;
|
|
694
|
+
const useZIndex = (zIndexOverrides) => {
|
|
695
|
+
const zIndexInjection = zIndexOverrides;
|
|
696
|
+
const initialZIndex = vue.computed(() => {
|
|
697
|
+
const zIndexFromInjection = vue.unref(zIndexInjection);
|
|
698
|
+
return zIndexFromInjection ?? DEFAULT_INITIAL_Z_INDEX;
|
|
699
|
+
});
|
|
700
|
+
const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
|
|
701
|
+
const nextZIndex = () => {
|
|
702
|
+
zIndex.value += 1;
|
|
703
|
+
return currentZIndex.value;
|
|
704
|
+
};
|
|
705
|
+
return {
|
|
706
|
+
initialZIndex,
|
|
707
|
+
currentZIndex,
|
|
708
|
+
nextZIndex
|
|
709
|
+
};
|
|
710
|
+
};
|
|
633
711
|
const adapter = {
|
|
634
|
-
|
|
712
|
+
adapterType: "tdesign-vue-next",
|
|
713
|
+
message: messageBox,
|
|
635
714
|
messageBox: {
|
|
636
715
|
alert: (msg, title) => {
|
|
637
716
|
return new Promise((resolve, reject) => {
|
|
@@ -681,9 +760,9 @@
|
|
|
681
760
|
button: {
|
|
682
761
|
component: tdesignVueNext.Button,
|
|
683
762
|
props: (props) => ({
|
|
684
|
-
theme: props.type,
|
|
763
|
+
theme: props.type ? props.type : "default",
|
|
685
764
|
size: props.size === "default" ? "medium" : props.size,
|
|
686
|
-
icon: props.icon ? () => vue.h(_sfc_main$
|
|
765
|
+
icon: props.icon ? () => vue.h(_sfc_main$8, null, { default: () => vue.h(props.icon) }) : void 0,
|
|
687
766
|
variant: props.link || props.text ? "text" : props.variant || "base",
|
|
688
767
|
shape: props.circle ? "circle" : "rectangle"
|
|
689
768
|
})
|
|
@@ -716,7 +795,7 @@
|
|
|
716
795
|
})
|
|
717
796
|
},
|
|
718
797
|
checkbox: {
|
|
719
|
-
component: _sfc_main$
|
|
798
|
+
component: _sfc_main$b,
|
|
720
799
|
props: (props) => props
|
|
721
800
|
},
|
|
722
801
|
checkboxGroup: {
|
|
@@ -759,11 +838,11 @@
|
|
|
759
838
|
})
|
|
760
839
|
},
|
|
761
840
|
datePicker: {
|
|
762
|
-
component: _sfc_main$
|
|
841
|
+
component: _sfc_main$a,
|
|
763
842
|
props: (props) => props
|
|
764
843
|
},
|
|
765
844
|
dialog: {
|
|
766
|
-
component: _sfc_main$
|
|
845
|
+
component: _sfc_main$9,
|
|
767
846
|
props: (props) => props
|
|
768
847
|
},
|
|
769
848
|
divider: {
|
|
@@ -836,11 +915,11 @@
|
|
|
836
915
|
})
|
|
837
916
|
},
|
|
838
917
|
icon: {
|
|
839
|
-
component: _sfc_main$
|
|
918
|
+
component: _sfc_main$8,
|
|
840
919
|
props: (props) => props
|
|
841
920
|
},
|
|
842
921
|
input: {
|
|
843
|
-
component: _sfc_main$
|
|
922
|
+
component: _sfc_main$7,
|
|
844
923
|
props: (props) => props
|
|
845
924
|
},
|
|
846
925
|
inputNumber: {
|
|
@@ -869,13 +948,8 @@
|
|
|
869
948
|
props: (props) => props
|
|
870
949
|
},
|
|
871
950
|
pagination: {
|
|
872
|
-
component:
|
|
873
|
-
props: (props) =>
|
|
874
|
-
current: props.curPage,
|
|
875
|
-
pageSizeOptions: props.pageSizes,
|
|
876
|
-
pageSize: props.pagesize,
|
|
877
|
-
total: props.total
|
|
878
|
-
})
|
|
951
|
+
component: _sfc_main$6,
|
|
952
|
+
props: (props) => props
|
|
879
953
|
},
|
|
880
954
|
radio: {
|
|
881
955
|
component: _sfc_main$4,
|
|
@@ -991,7 +1065,8 @@
|
|
|
991
1065
|
props: (props) => props
|
|
992
1066
|
}
|
|
993
1067
|
},
|
|
994
|
-
loading: tdesignVueNext.LoadingDirective
|
|
1068
|
+
loading: tdesignVueNext.LoadingDirective,
|
|
1069
|
+
useZIndex
|
|
995
1070
|
};
|
|
996
1071
|
|
|
997
1072
|
return adapter;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.7.0-beta.
|
|
2
|
+
"version": "1.7.0-beta.3",
|
|
3
3
|
"name": "@tmagic/tdesign-vue-next-adapter",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/tmagic-tdesign-vue-next-adapter.umd.cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"tdesign-vue-next": "^1.17.1",
|
|
39
39
|
"vue": "^3.5.22",
|
|
40
40
|
"typescript": "^5.9.3",
|
|
41
|
-
"@tmagic/design": "1.7.0-beta.
|
|
41
|
+
"@tmagic/design": "1.7.0-beta.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"typescript": {
|
package/src/DatePicker.vue
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<TDateRangePicker
|
|
3
3
|
v-if="type.endsWith('range')"
|
|
4
|
+
allow-input
|
|
5
|
+
clearable
|
|
6
|
+
enable-time-picker
|
|
4
7
|
:modelValue="modelValue"
|
|
5
8
|
:mode="mode"
|
|
6
9
|
:placeholder="[startPlaceholder || '', endPlaceholder || '']"
|
|
@@ -14,6 +17,7 @@
|
|
|
14
17
|
/>
|
|
15
18
|
<TDatePicker
|
|
16
19
|
v-else
|
|
20
|
+
clearable
|
|
17
21
|
:modelValue="modelValue"
|
|
18
22
|
:mode="mode"
|
|
19
23
|
:placeholder="placeholder"
|
package/src/Input.vue
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TPagination
|
|
3
|
+
:total="total"
|
|
4
|
+
:current="curPage"
|
|
5
|
+
:size="size === 'small' ? 'small' : 'medium'"
|
|
6
|
+
:page-size="pageSize"
|
|
7
|
+
:page-size-options="pageSizes"
|
|
8
|
+
@current-change="handleCurrentChange"
|
|
9
|
+
@page-size-change="handleSizeChange"
|
|
10
|
+
@update:current="updateCurrentPage"
|
|
11
|
+
@update:page-size="updatePageSize"
|
|
12
|
+
></TPagination>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { Pagination as TPagination } from 'tdesign-vue-next';
|
|
17
|
+
|
|
18
|
+
import type { PaginationProps } from '@tmagic/design';
|
|
19
|
+
|
|
20
|
+
defineOptions({
|
|
21
|
+
name: 'TTDesignAdapterPagination',
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
defineProps<PaginationProps>();
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits(['size-change', 'current-change', 'update:current-page', 'update:page-size']);
|
|
27
|
+
|
|
28
|
+
const handleCurrentChange = (...args: any[]) => {
|
|
29
|
+
emit('current-change', ...args);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const handleSizeChange = (...args: any[]) => {
|
|
33
|
+
emit('size-change', ...args);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const updateCurrentPage = (...args: any[]) => {
|
|
37
|
+
emit('update:current-page', ...args);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const updatePageSize = (...args: any[]) => {
|
|
41
|
+
emit('update:page-size', ...args);
|
|
42
|
+
};
|
|
43
|
+
</script>
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h } from 'vue';
|
|
1
|
+
import { computed, h, Ref, ref, unref } from 'vue';
|
|
2
2
|
import {
|
|
3
3
|
Badge as TBadge,
|
|
4
4
|
Button as TButton,
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
MessagePlugin,
|
|
22
22
|
Option as TOption,
|
|
23
23
|
OptionGroup as TOptionGroup,
|
|
24
|
-
Pagination as TPagination,
|
|
25
24
|
RadioGroup as TRadioGroup,
|
|
26
25
|
Row as TRow,
|
|
27
26
|
Select as TSelect,
|
|
@@ -81,6 +80,7 @@ import DatePicker from './DatePicker.vue';
|
|
|
81
80
|
import Dialog from './Dialog.vue';
|
|
82
81
|
import Icon from './Icon.vue';
|
|
83
82
|
import Input from './Input.vue';
|
|
83
|
+
import Pagination from './Pagination.vue';
|
|
84
84
|
import Popconfirm from './Popconfirm.vue';
|
|
85
85
|
import Radio from './Radio.vue';
|
|
86
86
|
import RadioButton from './RadioButton.vue';
|
|
@@ -88,8 +88,48 @@ import Scrollbar from './Scrollbar.vue';
|
|
|
88
88
|
import Table from './Table.vue';
|
|
89
89
|
import Tabs from './Tabs.vue';
|
|
90
90
|
|
|
91
|
+
const messageBox = (options: {
|
|
92
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
|
93
|
+
message?: string;
|
|
94
|
+
dangerouslyUseHTMLString?: boolean;
|
|
95
|
+
duration?: number;
|
|
96
|
+
}) =>
|
|
97
|
+
MessagePlugin(options.type || 'info', {
|
|
98
|
+
duration: options.duration || 3000,
|
|
99
|
+
content: options.message,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
messageBox.success = MessagePlugin.success;
|
|
103
|
+
messageBox.error = MessagePlugin.error;
|
|
104
|
+
messageBox.warning = MessagePlugin.warning;
|
|
105
|
+
messageBox.info = MessagePlugin.info;
|
|
106
|
+
|
|
107
|
+
const zIndex = ref(0);
|
|
108
|
+
const DEFAULT_INITIAL_Z_INDEX = 2500;
|
|
109
|
+
|
|
110
|
+
const useZIndex = (zIndexOverrides?: Ref<number>) => {
|
|
111
|
+
const zIndexInjection = zIndexOverrides;
|
|
112
|
+
const initialZIndex = computed(() => {
|
|
113
|
+
const zIndexFromInjection = unref(zIndexInjection);
|
|
114
|
+
return zIndexFromInjection ?? DEFAULT_INITIAL_Z_INDEX;
|
|
115
|
+
});
|
|
116
|
+
const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
|
|
117
|
+
|
|
118
|
+
const nextZIndex = () => {
|
|
119
|
+
zIndex.value += 1;
|
|
120
|
+
return currentZIndex.value;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
initialZIndex,
|
|
125
|
+
currentZIndex,
|
|
126
|
+
nextZIndex,
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
|
|
91
130
|
const adapter: any = {
|
|
92
|
-
|
|
131
|
+
adapterType: 'tdesign-vue-next',
|
|
132
|
+
message: messageBox,
|
|
93
133
|
messageBox: {
|
|
94
134
|
alert: (msg: string, title?: string) => {
|
|
95
135
|
return new Promise((resolve, reject) => {
|
|
@@ -140,7 +180,7 @@ const adapter: any = {
|
|
|
140
180
|
button: {
|
|
141
181
|
component: TButton,
|
|
142
182
|
props: (props: ButtonProps) => ({
|
|
143
|
-
theme: props.type,
|
|
183
|
+
theme: props.type ? props.type : 'default',
|
|
144
184
|
size: props.size === 'default' ? 'medium' : props.size,
|
|
145
185
|
icon: props.icon ? () => h(Icon, null, { default: () => h(props.icon) }) : undefined,
|
|
146
186
|
variant: props.link || props.text ? 'text' : props.variant || 'base',
|
|
@@ -351,13 +391,8 @@ const adapter: any = {
|
|
|
351
391
|
},
|
|
352
392
|
|
|
353
393
|
pagination: {
|
|
354
|
-
component:
|
|
355
|
-
props: (props: PaginationProps) =>
|
|
356
|
-
current: props.curPage,
|
|
357
|
-
pageSizeOptions: props.pageSizes,
|
|
358
|
-
pageSize: props.pagesize,
|
|
359
|
-
total: props.total,
|
|
360
|
-
}),
|
|
394
|
+
component: Pagination,
|
|
395
|
+
props: (props: PaginationProps) => props,
|
|
361
396
|
},
|
|
362
397
|
|
|
363
398
|
radio: {
|
|
@@ -491,6 +526,7 @@ const adapter: any = {
|
|
|
491
526
|
},
|
|
492
527
|
},
|
|
493
528
|
loading: LoadingDirective,
|
|
529
|
+
useZIndex,
|
|
494
530
|
};
|
|
495
531
|
|
|
496
532
|
export default adapter;
|