@tmagic/tdesign-vue-next-adapter 1.7.0-beta.0 → 1.7.0-beta.2
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 +126 -28
- package/dist/tmagic-tdesign-vue-next-adapter.umd.cjs +124 -26
- package/package.json +2 -2
- package/src/DatePicker.vue +4 -0
- package/src/Input.vue +33 -3
- package/src/Pagination.vue +43 -0
- package/src/index.ts +46 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, createBlock, openBlock, unref, createSlots, withCtx, renderSlot, computed, createElementBlock, createVNode, createElementVNode,
|
|
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,
|
|
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, 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,32 +216,55 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
212
216
|
placeholder: {},
|
|
213
217
|
rows: {},
|
|
214
218
|
type: {},
|
|
215
|
-
size: {}
|
|
216
|
-
row: {}
|
|
219
|
+
size: {}
|
|
217
220
|
},
|
|
218
|
-
emits: ["change", "input", "update:modelValue"],
|
|
221
|
+
emits: ["change", "input", "blur", "focus", "update:modelValue"],
|
|
219
222
|
setup(__props, { emit: __emit }) {
|
|
223
|
+
const props = __props;
|
|
220
224
|
const emit = __emit;
|
|
225
|
+
const textareaRef = useTemplateRef("textarea");
|
|
226
|
+
watch(
|
|
227
|
+
[textareaRef, () => props.rows],
|
|
228
|
+
([val, rows]) => {
|
|
229
|
+
if (val && rows) {
|
|
230
|
+
const el = val.$el.querySelector("textarea");
|
|
231
|
+
if (el) {
|
|
232
|
+
el.rows = rows;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
{ immediate: true }
|
|
237
|
+
);
|
|
221
238
|
const changeHandler = (...args) => {
|
|
222
239
|
emit("change", ...args);
|
|
223
240
|
};
|
|
224
241
|
const inputHandler = (...args) => {
|
|
225
242
|
emit("input", ...args);
|
|
226
243
|
};
|
|
244
|
+
const blurHandler = (...args) => {
|
|
245
|
+
emit("blur", ...args);
|
|
246
|
+
};
|
|
247
|
+
const focusHandler = (...args) => {
|
|
248
|
+
emit("focus", ...args);
|
|
249
|
+
};
|
|
227
250
|
const updateModelValue = (...args) => {
|
|
228
251
|
emit("update:modelValue", ...args);
|
|
229
252
|
};
|
|
230
253
|
return (_ctx, _cache) => {
|
|
231
254
|
return __props.type === "textarea" ? (openBlock(), createBlock(unref(Textarea), {
|
|
232
255
|
key: 0,
|
|
256
|
+
ref: "textarea",
|
|
233
257
|
modelValue: __props.modelValue,
|
|
234
258
|
size: __props.size === "default" ? "medium" : __props.size,
|
|
235
259
|
disabled: __props.disabled,
|
|
236
260
|
placeholder: __props.placeholder,
|
|
237
|
-
|
|
261
|
+
rows: __props.rows,
|
|
238
262
|
onKeypress: inputHandler,
|
|
239
|
-
onChange: changeHandler
|
|
240
|
-
|
|
263
|
+
onChange: changeHandler,
|
|
264
|
+
onBlur: blurHandler,
|
|
265
|
+
onFocus: focusHandler,
|
|
266
|
+
"onUpdate:modelValue": updateModelValue
|
|
267
|
+
}, null, 8, ["modelValue", "size", "disabled", "placeholder", "rows"])) : (openBlock(), createBlock(
|
|
241
268
|
unref(InputAdornment),
|
|
242
269
|
{ key: 1 },
|
|
243
270
|
createSlots({
|
|
@@ -250,6 +277,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
250
277
|
placeholder: __props.placeholder,
|
|
251
278
|
onKeypress: inputHandler,
|
|
252
279
|
onChange: changeHandler,
|
|
280
|
+
onBlur: blurHandler,
|
|
281
|
+
onFocus: focusHandler,
|
|
253
282
|
"onUpdate:modelValue": updateModelValue
|
|
254
283
|
}, createSlots({
|
|
255
284
|
_: 2
|
|
@@ -296,6 +325,51 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
296
325
|
}
|
|
297
326
|
});
|
|
298
327
|
|
|
328
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
329
|
+
...{
|
|
330
|
+
name: "TTDesignAdapterPagination"
|
|
331
|
+
},
|
|
332
|
+
__name: "Pagination",
|
|
333
|
+
props: {
|
|
334
|
+
layout: {},
|
|
335
|
+
hideOnSinglePage: { type: Boolean },
|
|
336
|
+
curPage: {},
|
|
337
|
+
pageSizes: {},
|
|
338
|
+
pageSize: {},
|
|
339
|
+
total: {},
|
|
340
|
+
size: {}
|
|
341
|
+
},
|
|
342
|
+
emits: ["size-change", "current-change", "update:current-page", "update:page-size"],
|
|
343
|
+
setup(__props, { emit: __emit }) {
|
|
344
|
+
const emit = __emit;
|
|
345
|
+
const handleCurrentChange = (...args) => {
|
|
346
|
+
emit("current-change", ...args);
|
|
347
|
+
};
|
|
348
|
+
const handleSizeChange = (...args) => {
|
|
349
|
+
emit("size-change", ...args);
|
|
350
|
+
};
|
|
351
|
+
const updateCurrentPage = (...args) => {
|
|
352
|
+
emit("update:current-page", ...args);
|
|
353
|
+
};
|
|
354
|
+
const updatePageSize = (...args) => {
|
|
355
|
+
emit("update:page-size", ...args);
|
|
356
|
+
};
|
|
357
|
+
return (_ctx, _cache) => {
|
|
358
|
+
return openBlock(), createBlock(unref(Pagination), {
|
|
359
|
+
total: __props.total,
|
|
360
|
+
current: __props.curPage,
|
|
361
|
+
size: __props.size === "small" ? "small" : "medium",
|
|
362
|
+
"page-size": __props.pageSize,
|
|
363
|
+
"page-size-options": __props.pageSizes,
|
|
364
|
+
onCurrentChange: handleCurrentChange,
|
|
365
|
+
onPageSizeChange: handleSizeChange,
|
|
366
|
+
"onUpdate:current": updateCurrentPage,
|
|
367
|
+
"onUpdate:pageSize": updatePageSize
|
|
368
|
+
}, null, 8, ["total", "current", "size", "page-size", "page-size-options"]);
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
|
|
299
373
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
300
374
|
...{
|
|
301
375
|
name: "TTDesignAdapterPopconfirm"
|
|
@@ -602,8 +676,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
602
676
|
}
|
|
603
677
|
});
|
|
604
678
|
|
|
679
|
+
const messageBox = (options) => MessagePlugin(options.type || "info", {
|
|
680
|
+
duration: options.duration || 3e3,
|
|
681
|
+
content: options.message
|
|
682
|
+
});
|
|
683
|
+
messageBox.success = MessagePlugin.success;
|
|
684
|
+
messageBox.error = MessagePlugin.error;
|
|
685
|
+
messageBox.warning = MessagePlugin.warning;
|
|
686
|
+
messageBox.info = MessagePlugin.info;
|
|
687
|
+
const zIndex = ref(0);
|
|
688
|
+
const DEFAULT_INITIAL_Z_INDEX = 2500;
|
|
689
|
+
const useZIndex = (zIndexOverrides) => {
|
|
690
|
+
const zIndexInjection = zIndexOverrides;
|
|
691
|
+
const initialZIndex = computed(() => {
|
|
692
|
+
const zIndexFromInjection = unref(zIndexInjection);
|
|
693
|
+
return zIndexFromInjection ?? DEFAULT_INITIAL_Z_INDEX;
|
|
694
|
+
});
|
|
695
|
+
const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
|
|
696
|
+
const nextZIndex = () => {
|
|
697
|
+
zIndex.value += 1;
|
|
698
|
+
return currentZIndex.value;
|
|
699
|
+
};
|
|
700
|
+
return {
|
|
701
|
+
initialZIndex,
|
|
702
|
+
currentZIndex,
|
|
703
|
+
nextZIndex
|
|
704
|
+
};
|
|
705
|
+
};
|
|
605
706
|
const adapter = {
|
|
606
|
-
|
|
707
|
+
adapterType: "tdesign-vue-next",
|
|
708
|
+
message: messageBox,
|
|
607
709
|
messageBox: {
|
|
608
710
|
alert: (msg, title) => {
|
|
609
711
|
return new Promise((resolve, reject) => {
|
|
@@ -655,7 +757,7 @@ const adapter = {
|
|
|
655
757
|
props: (props) => ({
|
|
656
758
|
theme: props.type,
|
|
657
759
|
size: props.size === "default" ? "medium" : props.size,
|
|
658
|
-
icon: props.icon ? () => h(_sfc_main$
|
|
760
|
+
icon: props.icon ? () => h(_sfc_main$8, null, { default: () => h(props.icon) }) : void 0,
|
|
659
761
|
variant: props.link || props.text ? "text" : props.variant || "base",
|
|
660
762
|
shape: props.circle ? "circle" : "rectangle"
|
|
661
763
|
})
|
|
@@ -688,7 +790,7 @@ const adapter = {
|
|
|
688
790
|
})
|
|
689
791
|
},
|
|
690
792
|
checkbox: {
|
|
691
|
-
component: _sfc_main$
|
|
793
|
+
component: _sfc_main$b,
|
|
692
794
|
props: (props) => props
|
|
693
795
|
},
|
|
694
796
|
checkboxGroup: {
|
|
@@ -731,11 +833,11 @@ const adapter = {
|
|
|
731
833
|
})
|
|
732
834
|
},
|
|
733
835
|
datePicker: {
|
|
734
|
-
component: _sfc_main$
|
|
836
|
+
component: _sfc_main$a,
|
|
735
837
|
props: (props) => props
|
|
736
838
|
},
|
|
737
839
|
dialog: {
|
|
738
|
-
component: _sfc_main$
|
|
840
|
+
component: _sfc_main$9,
|
|
739
841
|
props: (props) => props
|
|
740
842
|
},
|
|
741
843
|
divider: {
|
|
@@ -808,11 +910,11 @@ const adapter = {
|
|
|
808
910
|
})
|
|
809
911
|
},
|
|
810
912
|
icon: {
|
|
811
|
-
component: _sfc_main$
|
|
913
|
+
component: _sfc_main$8,
|
|
812
914
|
props: (props) => props
|
|
813
915
|
},
|
|
814
916
|
input: {
|
|
815
|
-
component: _sfc_main$
|
|
917
|
+
component: _sfc_main$7,
|
|
816
918
|
props: (props) => props
|
|
817
919
|
},
|
|
818
920
|
inputNumber: {
|
|
@@ -841,13 +943,8 @@ const adapter = {
|
|
|
841
943
|
props: (props) => props
|
|
842
944
|
},
|
|
843
945
|
pagination: {
|
|
844
|
-
component:
|
|
845
|
-
props: (props) =>
|
|
846
|
-
current: props.curPage,
|
|
847
|
-
pageSizeOptions: props.pageSizes,
|
|
848
|
-
pageSize: props.pagesize,
|
|
849
|
-
total: props.total
|
|
850
|
-
})
|
|
946
|
+
component: _sfc_main$6,
|
|
947
|
+
props: (props) => props
|
|
851
948
|
},
|
|
852
949
|
radio: {
|
|
853
950
|
component: _sfc_main$4,
|
|
@@ -963,7 +1060,8 @@ const adapter = {
|
|
|
963
1060
|
props: (props) => props
|
|
964
1061
|
}
|
|
965
1062
|
},
|
|
966
|
-
loading: LoadingDirective
|
|
1063
|
+
loading: LoadingDirective,
|
|
1064
|
+
useZIndex
|
|
967
1065
|
};
|
|
968
1066
|
|
|
969
1067
|
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,32 +219,55 @@
|
|
|
215
219
|
placeholder: {},
|
|
216
220
|
rows: {},
|
|
217
221
|
type: {},
|
|
218
|
-
size: {}
|
|
219
|
-
row: {}
|
|
222
|
+
size: {}
|
|
220
223
|
},
|
|
221
|
-
emits: ["change", "input", "update:modelValue"],
|
|
224
|
+
emits: ["change", "input", "blur", "focus", "update:modelValue"],
|
|
222
225
|
setup(__props, { emit: __emit }) {
|
|
226
|
+
const props = __props;
|
|
223
227
|
const emit = __emit;
|
|
228
|
+
const textareaRef = vue.useTemplateRef("textarea");
|
|
229
|
+
vue.watch(
|
|
230
|
+
[textareaRef, () => props.rows],
|
|
231
|
+
([val, rows]) => {
|
|
232
|
+
if (val && rows) {
|
|
233
|
+
const el = val.$el.querySelector("textarea");
|
|
234
|
+
if (el) {
|
|
235
|
+
el.rows = rows;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{ immediate: true }
|
|
240
|
+
);
|
|
224
241
|
const changeHandler = (...args) => {
|
|
225
242
|
emit("change", ...args);
|
|
226
243
|
};
|
|
227
244
|
const inputHandler = (...args) => {
|
|
228
245
|
emit("input", ...args);
|
|
229
246
|
};
|
|
247
|
+
const blurHandler = (...args) => {
|
|
248
|
+
emit("blur", ...args);
|
|
249
|
+
};
|
|
250
|
+
const focusHandler = (...args) => {
|
|
251
|
+
emit("focus", ...args);
|
|
252
|
+
};
|
|
230
253
|
const updateModelValue = (...args) => {
|
|
231
254
|
emit("update:modelValue", ...args);
|
|
232
255
|
};
|
|
233
256
|
return (_ctx, _cache) => {
|
|
234
257
|
return __props.type === "textarea" ? (vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.Textarea), {
|
|
235
258
|
key: 0,
|
|
259
|
+
ref: "textarea",
|
|
236
260
|
modelValue: __props.modelValue,
|
|
237
261
|
size: __props.size === "default" ? "medium" : __props.size,
|
|
238
262
|
disabled: __props.disabled,
|
|
239
263
|
placeholder: __props.placeholder,
|
|
240
|
-
|
|
264
|
+
rows: __props.rows,
|
|
241
265
|
onKeypress: inputHandler,
|
|
242
|
-
onChange: changeHandler
|
|
243
|
-
|
|
266
|
+
onChange: changeHandler,
|
|
267
|
+
onBlur: blurHandler,
|
|
268
|
+
onFocus: focusHandler,
|
|
269
|
+
"onUpdate:modelValue": updateModelValue
|
|
270
|
+
}, null, 8, ["modelValue", "size", "disabled", "placeholder", "rows"])) : (vue.openBlock(), vue.createBlock(
|
|
244
271
|
vue.unref(tdesignVueNext.InputAdornment),
|
|
245
272
|
{ key: 1 },
|
|
246
273
|
vue.createSlots({
|
|
@@ -253,6 +280,8 @@
|
|
|
253
280
|
placeholder: __props.placeholder,
|
|
254
281
|
onKeypress: inputHandler,
|
|
255
282
|
onChange: changeHandler,
|
|
283
|
+
onBlur: blurHandler,
|
|
284
|
+
onFocus: focusHandler,
|
|
256
285
|
"onUpdate:modelValue": updateModelValue
|
|
257
286
|
}, vue.createSlots({
|
|
258
287
|
_: 2
|
|
@@ -299,6 +328,51 @@
|
|
|
299
328
|
}
|
|
300
329
|
});
|
|
301
330
|
|
|
331
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
332
|
+
...{
|
|
333
|
+
name: "TTDesignAdapterPagination"
|
|
334
|
+
},
|
|
335
|
+
__name: "Pagination",
|
|
336
|
+
props: {
|
|
337
|
+
layout: {},
|
|
338
|
+
hideOnSinglePage: { type: Boolean },
|
|
339
|
+
curPage: {},
|
|
340
|
+
pageSizes: {},
|
|
341
|
+
pageSize: {},
|
|
342
|
+
total: {},
|
|
343
|
+
size: {}
|
|
344
|
+
},
|
|
345
|
+
emits: ["size-change", "current-change", "update:current-page", "update:page-size"],
|
|
346
|
+
setup(__props, { emit: __emit }) {
|
|
347
|
+
const emit = __emit;
|
|
348
|
+
const handleCurrentChange = (...args) => {
|
|
349
|
+
emit("current-change", ...args);
|
|
350
|
+
};
|
|
351
|
+
const handleSizeChange = (...args) => {
|
|
352
|
+
emit("size-change", ...args);
|
|
353
|
+
};
|
|
354
|
+
const updateCurrentPage = (...args) => {
|
|
355
|
+
emit("update:current-page", ...args);
|
|
356
|
+
};
|
|
357
|
+
const updatePageSize = (...args) => {
|
|
358
|
+
emit("update:page-size", ...args);
|
|
359
|
+
};
|
|
360
|
+
return (_ctx, _cache) => {
|
|
361
|
+
return vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.Pagination), {
|
|
362
|
+
total: __props.total,
|
|
363
|
+
current: __props.curPage,
|
|
364
|
+
size: __props.size === "small" ? "small" : "medium",
|
|
365
|
+
"page-size": __props.pageSize,
|
|
366
|
+
"page-size-options": __props.pageSizes,
|
|
367
|
+
onCurrentChange: handleCurrentChange,
|
|
368
|
+
onPageSizeChange: handleSizeChange,
|
|
369
|
+
"onUpdate:current": updateCurrentPage,
|
|
370
|
+
"onUpdate:pageSize": updatePageSize
|
|
371
|
+
}, null, 8, ["total", "current", "size", "page-size", "page-size-options"]);
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
|
|
302
376
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
303
377
|
...{
|
|
304
378
|
name: "TTDesignAdapterPopconfirm"
|
|
@@ -605,8 +679,36 @@
|
|
|
605
679
|
}
|
|
606
680
|
});
|
|
607
681
|
|
|
682
|
+
const messageBox = (options) => tdesignVueNext.MessagePlugin(options.type || "info", {
|
|
683
|
+
duration: options.duration || 3e3,
|
|
684
|
+
content: options.message
|
|
685
|
+
});
|
|
686
|
+
messageBox.success = tdesignVueNext.MessagePlugin.success;
|
|
687
|
+
messageBox.error = tdesignVueNext.MessagePlugin.error;
|
|
688
|
+
messageBox.warning = tdesignVueNext.MessagePlugin.warning;
|
|
689
|
+
messageBox.info = tdesignVueNext.MessagePlugin.info;
|
|
690
|
+
const zIndex = vue.ref(0);
|
|
691
|
+
const DEFAULT_INITIAL_Z_INDEX = 2500;
|
|
692
|
+
const useZIndex = (zIndexOverrides) => {
|
|
693
|
+
const zIndexInjection = zIndexOverrides;
|
|
694
|
+
const initialZIndex = vue.computed(() => {
|
|
695
|
+
const zIndexFromInjection = vue.unref(zIndexInjection);
|
|
696
|
+
return zIndexFromInjection ?? DEFAULT_INITIAL_Z_INDEX;
|
|
697
|
+
});
|
|
698
|
+
const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
|
|
699
|
+
const nextZIndex = () => {
|
|
700
|
+
zIndex.value += 1;
|
|
701
|
+
return currentZIndex.value;
|
|
702
|
+
};
|
|
703
|
+
return {
|
|
704
|
+
initialZIndex,
|
|
705
|
+
currentZIndex,
|
|
706
|
+
nextZIndex
|
|
707
|
+
};
|
|
708
|
+
};
|
|
608
709
|
const adapter = {
|
|
609
|
-
|
|
710
|
+
adapterType: "tdesign-vue-next",
|
|
711
|
+
message: messageBox,
|
|
610
712
|
messageBox: {
|
|
611
713
|
alert: (msg, title) => {
|
|
612
714
|
return new Promise((resolve, reject) => {
|
|
@@ -658,7 +760,7 @@
|
|
|
658
760
|
props: (props) => ({
|
|
659
761
|
theme: props.type,
|
|
660
762
|
size: props.size === "default" ? "medium" : props.size,
|
|
661
|
-
icon: props.icon ? () => vue.h(_sfc_main$
|
|
763
|
+
icon: props.icon ? () => vue.h(_sfc_main$8, null, { default: () => vue.h(props.icon) }) : void 0,
|
|
662
764
|
variant: props.link || props.text ? "text" : props.variant || "base",
|
|
663
765
|
shape: props.circle ? "circle" : "rectangle"
|
|
664
766
|
})
|
|
@@ -691,7 +793,7 @@
|
|
|
691
793
|
})
|
|
692
794
|
},
|
|
693
795
|
checkbox: {
|
|
694
|
-
component: _sfc_main$
|
|
796
|
+
component: _sfc_main$b,
|
|
695
797
|
props: (props) => props
|
|
696
798
|
},
|
|
697
799
|
checkboxGroup: {
|
|
@@ -734,11 +836,11 @@
|
|
|
734
836
|
})
|
|
735
837
|
},
|
|
736
838
|
datePicker: {
|
|
737
|
-
component: _sfc_main$
|
|
839
|
+
component: _sfc_main$a,
|
|
738
840
|
props: (props) => props
|
|
739
841
|
},
|
|
740
842
|
dialog: {
|
|
741
|
-
component: _sfc_main$
|
|
843
|
+
component: _sfc_main$9,
|
|
742
844
|
props: (props) => props
|
|
743
845
|
},
|
|
744
846
|
divider: {
|
|
@@ -811,11 +913,11 @@
|
|
|
811
913
|
})
|
|
812
914
|
},
|
|
813
915
|
icon: {
|
|
814
|
-
component: _sfc_main$
|
|
916
|
+
component: _sfc_main$8,
|
|
815
917
|
props: (props) => props
|
|
816
918
|
},
|
|
817
919
|
input: {
|
|
818
|
-
component: _sfc_main$
|
|
920
|
+
component: _sfc_main$7,
|
|
819
921
|
props: (props) => props
|
|
820
922
|
},
|
|
821
923
|
inputNumber: {
|
|
@@ -844,13 +946,8 @@
|
|
|
844
946
|
props: (props) => props
|
|
845
947
|
},
|
|
846
948
|
pagination: {
|
|
847
|
-
component:
|
|
848
|
-
props: (props) =>
|
|
849
|
-
current: props.curPage,
|
|
850
|
-
pageSizeOptions: props.pageSizes,
|
|
851
|
-
pageSize: props.pagesize,
|
|
852
|
-
total: props.total
|
|
853
|
-
})
|
|
949
|
+
component: _sfc_main$6,
|
|
950
|
+
props: (props) => props
|
|
854
951
|
},
|
|
855
952
|
radio: {
|
|
856
953
|
component: _sfc_main$4,
|
|
@@ -966,7 +1063,8 @@
|
|
|
966
1063
|
props: (props) => props
|
|
967
1064
|
}
|
|
968
1065
|
},
|
|
969
|
-
loading: tdesignVueNext.LoadingDirective
|
|
1066
|
+
loading: tdesignVueNext.LoadingDirective,
|
|
1067
|
+
useZIndex
|
|
970
1068
|
};
|
|
971
1069
|
|
|
972
1070
|
return adapter;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.7.0-beta.
|
|
2
|
+
"version": "1.7.0-beta.2",
|
|
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.2"
|
|
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
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<TTextarea
|
|
3
3
|
v-if="type === 'textarea'"
|
|
4
|
+
ref="textarea"
|
|
4
5
|
:modelValue="modelValue"
|
|
5
6
|
:size="size === 'default' ? 'medium' : size"
|
|
6
7
|
:disabled="disabled"
|
|
7
8
|
:placeholder="placeholder"
|
|
8
|
-
:
|
|
9
|
+
:rows="rows"
|
|
9
10
|
@keypress="inputHandler"
|
|
10
11
|
@change="changeHandler"
|
|
12
|
+
@blur="blurHandler"
|
|
13
|
+
@focus="focusHandler"
|
|
14
|
+
@update:modelValue="updateModelValue"
|
|
11
15
|
></TTextarea>
|
|
12
16
|
<TInputAdornment v-else>
|
|
13
17
|
<template #prepend v-if="$slots.prepend">
|
|
@@ -24,6 +28,8 @@
|
|
|
24
28
|
:placeholder="placeholder"
|
|
25
29
|
@keypress="inputHandler"
|
|
26
30
|
@change="changeHandler"
|
|
31
|
+
@blur="blurHandler"
|
|
32
|
+
@focus="focusHandler"
|
|
27
33
|
@update:modelValue="updateModelValue"
|
|
28
34
|
>
|
|
29
35
|
<template #prefix-icon v-if="$slots.prefix">
|
|
@@ -37,6 +43,7 @@
|
|
|
37
43
|
</template>
|
|
38
44
|
|
|
39
45
|
<script lang="ts" setup>
|
|
46
|
+
import { useTemplateRef, watch } from 'vue';
|
|
40
47
|
import { Input as TInput, InputAdornment as TInputAdornment, Textarea as TTextarea } from 'tdesign-vue-next';
|
|
41
48
|
|
|
42
49
|
import type { InputProps } from '@tmagic/design';
|
|
@@ -45,13 +52,28 @@ defineOptions({
|
|
|
45
52
|
name: 'TTDesignAdapterInput',
|
|
46
53
|
});
|
|
47
54
|
|
|
48
|
-
defineProps<
|
|
55
|
+
const props = defineProps<
|
|
49
56
|
InputProps & {
|
|
50
57
|
modelValue: string;
|
|
51
58
|
}
|
|
52
59
|
>();
|
|
53
60
|
|
|
54
|
-
const emit = defineEmits(['change', 'input', 'update:modelValue']);
|
|
61
|
+
const emit = defineEmits(['change', 'input', 'blur', 'focus', 'update:modelValue']);
|
|
62
|
+
|
|
63
|
+
const textareaRef = useTemplateRef('textarea');
|
|
64
|
+
|
|
65
|
+
watch(
|
|
66
|
+
[textareaRef, () => props.rows],
|
|
67
|
+
([val, rows]) => {
|
|
68
|
+
if (val && rows) {
|
|
69
|
+
const el = val.$el.querySelector('textarea');
|
|
70
|
+
if (el) {
|
|
71
|
+
el.rows = rows;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{ immediate: true },
|
|
76
|
+
);
|
|
55
77
|
|
|
56
78
|
const changeHandler = (...args: any[]) => {
|
|
57
79
|
emit('change', ...args);
|
|
@@ -61,6 +83,14 @@ const inputHandler = (...args: any[]) => {
|
|
|
61
83
|
emit('input', ...args);
|
|
62
84
|
};
|
|
63
85
|
|
|
86
|
+
const blurHandler = (...args: any[]) => {
|
|
87
|
+
emit('blur', ...args);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const focusHandler = (...args: any[]) => {
|
|
91
|
+
emit('focus', ...args);
|
|
92
|
+
};
|
|
93
|
+
|
|
64
94
|
const updateModelValue = (...args: any[]) => {
|
|
65
95
|
emit('update:modelValue', ...args);
|
|
66
96
|
};
|
|
@@ -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) => {
|
|
@@ -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;
|