@tmagic/tdesign-vue-next-adapter 1.6.0 → 1.7.0-beta.0

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.
@@ -1,7 +1,71 @@
1
- import { defineComponent, computed, createBlock, openBlock, unref, createElementBlock, renderSlot, createSlots, withCtx, createElementVNode, h } from 'vue';
2
- import { DateRangePicker, DatePicker, Textarea, Input, Upload, Tooltip, TimePicker, Tag, Tabs, TabPanel, Table, Switch, Steps, StepItem, Select, Row, RadioGroup, RadioButton, Radio, Pagination, OptionGroup, Option, InputNumber, FormItem, Form, Dropdown, DropdownItem, Drawer, Divider, Dialog, ColorPicker, CollapsePanel, Collapse, Col, CheckboxGroup, Checkbox, Cascader, Card, Button, Badge, MessagePlugin, DialogPlugin } from 'tdesign-vue-next';
1
+ import { defineComponent, ref, watch, createBlock, openBlock, unref, createSlots, withCtx, renderSlot, computed, createElementBlock, createVNode, createElementVNode, useTemplateRef, 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, Pagination, OptionGroup, Option, InputNumber, FormItem, Form, Dropdown, DropdownItem, Drawer, Divider, ColorPicker, CollapsePanel, Collapse, Col, CheckboxGroup, Cascader, Card, Button, Badge, MessagePlugin, DialogPlugin } from 'tdesign-vue-next';
3
3
 
4
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
5
+ ...{
6
+ name: "TTDesignAdapterCheckbox"
7
+ },
8
+ __name: "Checkbox",
9
+ props: {
10
+ modelValue: { type: [String, Number, Boolean] },
11
+ value: { type: [String, Number, Boolean] },
12
+ label: {},
13
+ trueValue: {},
14
+ falseValue: {},
15
+ disabled: { type: Boolean },
16
+ size: {}
17
+ },
18
+ emits: ["change", "update:modelValue"],
19
+ setup(__props, { emit: __emit }) {
20
+ const props = __props;
21
+ const emit = __emit;
22
+ const checked = ref(false);
23
+ watch(
24
+ () => props.modelValue,
25
+ (v) => {
26
+ if (typeof props.trueValue !== "undefined") {
27
+ checked.value = v === props.trueValue;
28
+ } else if (typeof props.falseValue !== "undefined") {
29
+ checked.value = v !== props.falseValue;
30
+ } else {
31
+ checked.value = Boolean(v);
32
+ }
33
+ },
34
+ {
35
+ immediate: true
36
+ }
37
+ );
38
+ const changeHandler = (v) => {
39
+ updateModelValue(v);
40
+ emit("change", v ? props.trueValue ?? true : props.falseValue ?? false);
41
+ };
42
+ const updateModelValue = (v) => {
43
+ emit("update:modelValue", v ? props.trueValue ?? true : props.falseValue ?? false);
44
+ };
45
+ return (_ctx, _cache) => {
46
+ return openBlock(), createBlock(unref(Checkbox), {
47
+ modelValue: checked.value,
48
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => checked.value = $event),
49
+ disabled: __props.disabled,
50
+ value: __props.value,
51
+ onChange: changeHandler
52
+ }, createSlots({
53
+ _: 2
54
+ /* DYNAMIC */
55
+ }, [
56
+ _ctx.$slots.default ? {
57
+ name: "default",
58
+ fn: withCtx(() => [
59
+ renderSlot(_ctx.$slots, "default")
60
+ ]),
61
+ key: "0"
62
+ } : void 0
63
+ ]), 1032, ["modelValue", "disabled", "value"]);
64
+ };
65
+ }
66
+ });
67
+
68
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5
69
  __name: "DatePicker",
6
70
  props: {
7
71
  type: { default: "date" },
@@ -31,6 +95,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
31
95
  };
32
96
  return map[props.type] || props.type;
33
97
  });
98
+ const valueType = computed(() => props.valueFormat === "s" ? "time-stamp" : props.valueFormat.replace(/\//g, "-"));
34
99
  const emit = __emit;
35
100
  const changeHandler = (v) => {
36
101
  emit("change", v);
@@ -39,28 +104,28 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
39
104
  emit("update:modelValue", ...args);
40
105
  };
41
106
  return (_ctx, _cache) => {
42
- return _ctx.type.endsWith("range") ? (openBlock(), createBlock(unref(DateRangePicker), {
107
+ return __props.type.endsWith("range") ? (openBlock(), createBlock(unref(DateRangePicker), {
43
108
  key: 0,
44
- modelValue: _ctx.modelValue,
109
+ modelValue: __props.modelValue,
45
110
  mode: mode.value,
46
- placeholder: [_ctx.startPlaceholder || "", _ctx.endPlaceholder || ""],
47
- disabled: _ctx.disabled,
48
- size: _ctx.size === "default" ? "medium" : _ctx.size,
49
- separator: _ctx.rangeSeparator,
50
- format: _ctx.format,
51
- valueType: _ctx.valueFormat === "s" ? "time-stamp" : _ctx.valueFormat,
111
+ placeholder: [__props.startPlaceholder || "", __props.endPlaceholder || ""],
112
+ disabled: __props.disabled,
113
+ size: __props.size === "default" ? "medium" : __props.size,
114
+ separator: __props.rangeSeparator,
115
+ format: __props.format,
116
+ valueType: valueType.value,
52
117
  onChange: changeHandler,
53
118
  "onUpdate:modelValue": updateModelValue
54
119
  }, null, 8, ["modelValue", "mode", "placeholder", "disabled", "size", "separator", "format", "valueType"])) : (openBlock(), createBlock(unref(DatePicker), {
55
120
  key: 1,
56
- modelValue: _ctx.modelValue,
121
+ modelValue: __props.modelValue,
57
122
  mode: mode.value,
58
- placeholder: _ctx.placeholder,
59
- disabled: _ctx.disabled,
60
- size: _ctx.size === "default" ? "medium" : _ctx.size,
61
- format: _ctx.format,
62
- enableTimePicker: _ctx.type.includes("time"),
63
- valueType: _ctx.valueFormat === "s" ? "time-stamp" : _ctx.valueFormat,
123
+ placeholder: __props.placeholder,
124
+ disabled: __props.disabled,
125
+ size: __props.size === "default" ? "medium" : __props.size,
126
+ format: __props.format,
127
+ enableTimePicker: __props.type.includes("time"),
128
+ valueType: valueType.value,
64
129
  onChange: changeHandler,
65
130
  "onUpdate:modelValue": updateModelValue
66
131
  }, null, 8, ["modelValue", "mode", "placeholder", "disabled", "size", "format", "enableTimePicker", "valueType"]));
@@ -68,24 +133,77 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
68
133
  }
69
134
  });
70
135
 
71
- const _export_sfc = (sfc, props) => {
72
- const target = sfc.__vccOpts || sfc;
73
- for (const [key, val] of props) {
74
- target[key] = val;
136
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
137
+ ...{
138
+ name: "TTDesignAdapterDialog"
139
+ },
140
+ __name: "Dialog",
141
+ props: {
142
+ modelValue: { type: Boolean },
143
+ appendToBody: { type: Boolean },
144
+ beforeClose: {},
145
+ title: {},
146
+ width: {},
147
+ fullscreen: { type: Boolean },
148
+ closeOnClickModal: { type: Boolean },
149
+ closeOnPressEscape: { type: Boolean },
150
+ destroyOnClose: { type: Boolean }
151
+ },
152
+ emits: ["close", "update:modelValue"],
153
+ setup(__props, { emit: __emit }) {
154
+ const emit = __emit;
155
+ const closeHandler = (...args) => {
156
+ emit("close", ...args);
157
+ };
158
+ const updateModelValue = (v) => {
159
+ emit("update:modelValue", v);
160
+ };
161
+ return (_ctx, _cache) => {
162
+ return openBlock(), createBlock(unref(Dialog), {
163
+ visible: __props.modelValue,
164
+ attach: __props.appendToBody ? "body" : void 0,
165
+ header: __props.title,
166
+ width: __props.width,
167
+ mode: __props.fullscreen ? "full-screen" : "modal",
168
+ "close-on-overlay-click": __props.closeOnClickModal,
169
+ "close-on-esc-keydown": __props.closeOnPressEscape,
170
+ "destroy-on-close": __props.destroyOnClose,
171
+ onBeforeOpen: __props.beforeClose,
172
+ onClose: closeHandler,
173
+ "onUpdate:visible": updateModelValue
174
+ }, {
175
+ footer: withCtx(() => [
176
+ renderSlot(_ctx.$slots, "footer")
177
+ ]),
178
+ default: withCtx(() => [
179
+ renderSlot(_ctx.$slots, "default")
180
+ ]),
181
+ _: 3
182
+ /* FORWARDED */
183
+ }, 8, ["visible", "attach", "header", "width", "mode", "close-on-overlay-click", "close-on-esc-keydown", "destroy-on-close", "onBeforeOpen"]);
184
+ };
75
185
  }
76
- return target;
77
- };
78
-
79
- const _sfc_main$3 = { };
186
+ });
80
187
 
81
- function _sfc_render$2(_ctx, _cache) {
82
- return (openBlock(), createElementBlock("i", null, [
83
- renderSlot(_ctx.$slots, "default")
84
- ]))
85
- }
86
- const Icon = /*#__PURE__*/_export_sfc(_sfc_main$3, [['render',_sfc_render$2]]);
188
+ const _hoisted_1$1 = { class: "t-t-design-adapter-icon t-icon" };
189
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
190
+ ...{
191
+ name: "TTDesignAdapterIcon"
192
+ },
193
+ __name: "Icon",
194
+ setup(__props) {
195
+ return (_ctx, _cache) => {
196
+ return openBlock(), createElementBlock("i", _hoisted_1$1, [
197
+ renderSlot(_ctx.$slots, "default")
198
+ ]);
199
+ };
200
+ }
201
+ });
87
202
 
88
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
203
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
204
+ ...{
205
+ name: "TTDesignAdapterInput"
206
+ },
89
207
  __name: "Input",
90
208
  props: {
91
209
  modelValue: {},
@@ -94,7 +212,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
94
212
  placeholder: {},
95
213
  rows: {},
96
214
  type: {},
97
- size: {}
215
+ size: {},
216
+ row: {}
98
217
  },
99
218
  emits: ["change", "input", "update:modelValue"],
100
219
  setup(__props, { emit: __emit }) {
@@ -109,48 +228,192 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
109
228
  emit("update:modelValue", ...args);
110
229
  };
111
230
  return (_ctx, _cache) => {
112
- return _ctx.type === "textarea" ? (openBlock(), createBlock(unref(Textarea), {
231
+ return __props.type === "textarea" ? (openBlock(), createBlock(unref(Textarea), {
113
232
  key: 0,
114
- modelValue: _ctx.modelValue,
115
- size: _ctx.size === "default" ? "medium" : _ctx.size,
116
- disabled: _ctx.disabled,
117
- placeholder: _ctx.placeholder,
233
+ modelValue: __props.modelValue,
234
+ size: __props.size === "default" ? "medium" : __props.size,
235
+ disabled: __props.disabled,
236
+ placeholder: __props.placeholder,
237
+ row: __props.row,
118
238
  onKeypress: inputHandler,
119
239
  onChange: changeHandler
120
- }, null, 8, ["modelValue", "size", "disabled", "placeholder"])) : (openBlock(), createBlock(unref(Input), {
121
- key: 1,
122
- modelValue: _ctx.modelValue,
123
- size: _ctx.size === "default" ? "medium" : _ctx.size,
124
- clearable: _ctx.clearable,
125
- disabled: _ctx.disabled,
126
- placeholder: _ctx.placeholder,
127
- onKeypress: inputHandler,
128
- onChange: changeHandler,
129
- "onUpdate:modelValue": updateModelValue
240
+ }, null, 8, ["modelValue", "size", "disabled", "placeholder", "row"])) : (openBlock(), createBlock(
241
+ unref(InputAdornment),
242
+ { key: 1 },
243
+ createSlots({
244
+ default: withCtx(() => [
245
+ createVNode(unref(Input), {
246
+ modelValue: __props.modelValue,
247
+ size: __props.size === "default" ? "medium" : __props.size,
248
+ clearable: __props.clearable,
249
+ disabled: __props.disabled,
250
+ placeholder: __props.placeholder,
251
+ onKeypress: inputHandler,
252
+ onChange: changeHandler,
253
+ "onUpdate:modelValue": updateModelValue
254
+ }, createSlots({
255
+ _: 2
256
+ /* DYNAMIC */
257
+ }, [
258
+ _ctx.$slots.prefix ? {
259
+ name: "prefix-icon",
260
+ fn: withCtx(() => [
261
+ renderSlot(_ctx.$slots, "prefix")
262
+ ]),
263
+ key: "0"
264
+ } : void 0,
265
+ _ctx.$slots.suffix ? {
266
+ name: "suffix",
267
+ fn: withCtx(() => [
268
+ renderSlot(_ctx.$slots, "suffix")
269
+ ]),
270
+ key: "1"
271
+ } : void 0
272
+ ]), 1032, ["modelValue", "size", "clearable", "disabled", "placeholder"])
273
+ ]),
274
+ _: 2
275
+ /* DYNAMIC */
276
+ }, [
277
+ _ctx.$slots.prepend ? {
278
+ name: "prepend",
279
+ fn: withCtx(() => [
280
+ renderSlot(_ctx.$slots, "prepend")
281
+ ]),
282
+ key: "0"
283
+ } : void 0,
284
+ _ctx.$slots.append ? {
285
+ name: "append",
286
+ fn: withCtx(() => [
287
+ renderSlot(_ctx.$slots, "append")
288
+ ]),
289
+ key: "1"
290
+ } : void 0
291
+ ]),
292
+ 1024
293
+ /* DYNAMIC_SLOTS */
294
+ ));
295
+ };
296
+ }
297
+ });
298
+
299
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
300
+ ...{
301
+ name: "TTDesignAdapterPopconfirm"
302
+ },
303
+ __name: "Popconfirm",
304
+ props: {
305
+ title: {},
306
+ placement: {}
307
+ },
308
+ emits: ["confirm", "cancel"],
309
+ setup(__props, { emit: __emit }) {
310
+ const emit = __emit;
311
+ const confirmHandler = (...args) => {
312
+ emit("confirm", ...args);
313
+ };
314
+ const cancelHandler = (...args) => {
315
+ emit("cancel", ...args);
316
+ };
317
+ return (_ctx, _cache) => {
318
+ return openBlock(), createBlock(unref(Popconfirm), {
319
+ content: __props.title,
320
+ placement: __props.placement,
321
+ onConfirm: confirmHandler,
322
+ onCancel: cancelHandler
323
+ }, {
324
+ default: withCtx(() => [
325
+ renderSlot(_ctx.$slots, "reference")
326
+ ]),
327
+ _: 3
328
+ /* FORWARDED */
329
+ }, 8, ["content", "placement"]);
330
+ };
331
+ }
332
+ });
333
+
334
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
335
+ ...{
336
+ name: "TTDesignAdapterRadio"
337
+ },
338
+ __name: "Radio",
339
+ props: {
340
+ modelValue: { type: [String, Number, Boolean] },
341
+ value: { type: [String, Number, Boolean] },
342
+ label: { type: [String, Number, Boolean] }
343
+ },
344
+ emits: ["click"],
345
+ setup(__props, { emit: __emit }) {
346
+ const emit = __emit;
347
+ const clickHandler = () => {
348
+ emit("click");
349
+ };
350
+ return (_ctx, _cache) => {
351
+ return openBlock(), createBlock(unref(Radio), {
352
+ value: __props.value,
353
+ onClick: clickHandler
130
354
  }, createSlots({
131
355
  _: 2
132
356
  /* DYNAMIC */
133
357
  }, [
134
- _ctx.$slots.prefix ? {
135
- name: "prefix-icon",
358
+ _ctx.$slots.default ? {
359
+ name: "default",
136
360
  fn: withCtx(() => [
137
- renderSlot(_ctx.$slots, "prefix")
361
+ renderSlot(_ctx.$slots, "default")
138
362
  ]),
139
363
  key: "0"
140
- } : void 0,
141
- _ctx.$slots.suffix ? {
142
- name: "suffix",
364
+ } : void 0
365
+ ]), 1032, ["value"]);
366
+ };
367
+ }
368
+ });
369
+
370
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
371
+ ...{
372
+ name: "TTDesignAdapterRadioButton"
373
+ },
374
+ __name: "RadioButton",
375
+ props: {
376
+ value: { type: [String, Number, Boolean] },
377
+ label: { type: [String, Number, Boolean] },
378
+ disabled: { type: Boolean },
379
+ name: {}
380
+ },
381
+ emits: ["click"],
382
+ setup(__props, { emit: __emit }) {
383
+ const emit = __emit;
384
+ const clickHandler = () => {
385
+ emit("click");
386
+ };
387
+ return (_ctx, _cache) => {
388
+ return openBlock(), createBlock(unref(RadioButton), {
389
+ value: __props.value,
390
+ disabled: __props.disabled,
391
+ onClick: clickHandler
392
+ }, createSlots({
393
+ _: 2
394
+ /* DYNAMIC */
395
+ }, [
396
+ _ctx.$slots.default ? {
397
+ name: "default",
143
398
  fn: withCtx(() => [
144
- renderSlot(_ctx.$slots, "suffix")
399
+ renderSlot(_ctx.$slots, "default")
145
400
  ]),
146
- key: "1"
401
+ key: "0"
147
402
  } : void 0
148
- ]), 1032, ["modelValue", "size", "clearable", "disabled", "placeholder"]));
403
+ ]), 1032, ["value", "disabled"]);
149
404
  };
150
405
  }
151
406
  });
152
407
 
153
- const _sfc_main$1 = { };
408
+ const _export_sfc = (sfc, props) => {
409
+ const target = sfc.__vccOpts || sfc;
410
+ for (const [key, val] of props) {
411
+ target[key] = val;
412
+ }
413
+ return target;
414
+ };
415
+
416
+ const _sfc_main$2 = { };
154
417
 
155
418
  const _hoisted_1 = {
156
419
  class: "tdesign-scrollbar",
@@ -162,7 +425,7 @@ const _hoisted_2 = {
162
425
  };
163
426
  const _hoisted_3 = { class: "tdesign-scrollbar-view" };
164
427
 
165
- function _sfc_render$1(_ctx, _cache) {
428
+ function _sfc_render(_ctx, _cache) {
166
429
  return (openBlock(), createElementBlock("div", _hoisted_1, [
167
430
  createElementVNode("div", _hoisted_2, [
168
431
  createElementVNode("div", _hoisted_3, [
@@ -171,26 +434,207 @@ function _sfc_render$1(_ctx, _cache) {
171
434
  ])
172
435
  ]))
173
436
  }
174
- const Scrollbar = /*#__PURE__*/_export_sfc(_sfc_main$1, [['render',_sfc_render$1]]);
437
+ const Scrollbar = /*#__PURE__*/_export_sfc(_sfc_main$2, [['render',_sfc_render]]);
175
438
 
176
- const _sfc_main = { };
439
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
440
+ ...{
441
+ name: "TTDesignAdapterTable"
442
+ },
443
+ __name: "Table",
444
+ props: {
445
+ columns: {},
446
+ data: {},
447
+ border: { type: Boolean },
448
+ maxHeight: {},
449
+ defaultExpandAll: { type: Boolean },
450
+ showHeader: { type: Boolean },
451
+ rowKey: {},
452
+ treeProps: {},
453
+ emptyText: {},
454
+ tooltipEffect: {},
455
+ tooltipOptions: {},
456
+ showOverflowTooltip: { type: Boolean },
457
+ spanMethod: { type: Function }
458
+ },
459
+ emits: ["sort-change", "select", "select-all", "selection-change", "expand-change", "cell-click"],
460
+ setup(__props, { expose: __expose, emit: __emit }) {
461
+ const emit = __emit;
462
+ const props = __props;
463
+ const tableRef = useTemplateRef("table");
464
+ const tableColumns = computed(() => {
465
+ if (!props.columns) return [];
466
+ const columns = [];
467
+ for (const item of props.columns) {
468
+ if (item.props.type === "expand") {
469
+ continue;
470
+ }
471
+ let colKey = item.props?.prop || item.props?.type;
472
+ if (!colKey) {
473
+ colKey = "tmagic_table_operation";
474
+ }
475
+ const column = {
476
+ thClassName: item.props?.class,
477
+ colKey,
478
+ title: item.props?.label,
479
+ width: item.props?.width,
480
+ fixed: item.props?.fixed === true ? "left" : item.props?.fixed || void 0,
481
+ ellipsis: props.showOverflowTooltip,
482
+ sorter: item.props?.sortable,
483
+ align: item.props?.align
484
+ };
485
+ if (item.cell) {
486
+ column.cell = (h, { row, rowIndex }) => {
487
+ return item.cell?.({ row, $index: rowIndex });
488
+ };
489
+ }
490
+ columns.push(column);
491
+ }
492
+ return columns;
493
+ });
494
+ const sortChange = (data) => {
495
+ emit("sort-change", data);
496
+ };
497
+ const selectHandler = (selectedRowKeys, options) => {
498
+ const { selectedRowData, type } = options;
499
+ if (type === "check") {
500
+ emit("select", selectedRowData);
501
+ } else if (type === "uncheck") {
502
+ emit("select", selectedRowData);
503
+ }
504
+ emit("selection-change", selectedRowData);
505
+ };
506
+ const cellClickHandler = (context) => {
507
+ const { row, col, e } = context;
508
+ emit("cell-click", row, col, void 0, e);
509
+ };
510
+ const expandChange = (expandedRowKeys, options) => {
511
+ emit("expand-change", options.expandedRowData, options.currentRowData);
512
+ };
513
+ const toggleRowSelection = (_row, _selected) => {
514
+ console.warn("toggleRowSelection needs to be implemented based on TDesign API");
515
+ };
516
+ const toggleRowExpansion = (_row, _expanded) => {
517
+ console.warn("toggleRowExpansion needs to be implemented based on TDesign API");
518
+ };
519
+ const clearSelection = () => {
520
+ console.warn("clearSelection needs to be implemented based on TDesign API");
521
+ };
522
+ __expose({
523
+ getEl: () => tableRef.value?.$el,
524
+ getTableRef: () => tableRef.value,
525
+ clearSelection,
526
+ toggleRowSelection,
527
+ toggleRowExpansion
528
+ });
529
+ return (_ctx, _cache) => {
530
+ return openBlock(), createBlock(unref(Table), {
531
+ ref: "table",
532
+ data: __props.data,
533
+ bordered: __props.border,
534
+ "max-height": __props.maxHeight,
535
+ "default-expand-all": __props.defaultExpandAll,
536
+ "show-header": __props.showHeader,
537
+ "row-key": __props.rowKey,
538
+ tree: __props.treeProps,
539
+ empty: __props.emptyText,
540
+ columns: tableColumns.value,
541
+ onSortChange: sortChange,
542
+ onSelectChange: selectHandler,
543
+ onCellClick: cellClickHandler,
544
+ onExpandChange: expandChange
545
+ }, null, 8, ["data", "bordered", "max-height", "default-expand-all", "show-header", "row-key", "tree", "empty", "columns"]);
546
+ };
547
+ }
548
+ });
177
549
 
178
- function _sfc_render(_ctx, _cache) {
179
- return (openBlock(), createElementBlock("div"))
180
- }
181
- const TableColumn = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render]]);
550
+ const _sfc_main = /* @__PURE__ */ defineComponent({
551
+ ...{
552
+ name: "TTDesignAdapterTabs"
553
+ },
554
+ __name: "Tabs",
555
+ props: {
556
+ type: {},
557
+ editable: { type: Boolean },
558
+ tabPosition: {},
559
+ modelValue: {}
560
+ },
561
+ emits: ["tab-click", "tab-add", "tab-remove", "update:model-value"],
562
+ setup(__props, { emit: __emit }) {
563
+ const emit = __emit;
564
+ const tabClickHandler = (...args) => {
565
+ emit("tab-click", ...args);
566
+ };
567
+ const onTabAdd = (...args) => {
568
+ emit("tab-add", ...args);
569
+ };
570
+ const onTabRemove = (...args) => {
571
+ emit("tab-remove", ...args);
572
+ };
573
+ const updateModelName = (...args) => {
574
+ emit("update:model-value", ...args);
575
+ };
576
+ return (_ctx, _cache) => {
577
+ return openBlock(), createBlock(unref(Tabs), {
578
+ "model-value": __props.modelValue,
579
+ addable: __props.editable,
580
+ theme: __props.type === "card" ? "card" : "normal",
581
+ placement: __props.tabPosition,
582
+ onAdd: onTabAdd,
583
+ onChange: tabClickHandler,
584
+ onRemove: onTabRemove,
585
+ "onUpdate:modelValue": updateModelName
586
+ }, createSlots({
587
+ default: withCtx(() => [
588
+ renderSlot(_ctx.$slots, "default")
589
+ ]),
590
+ _: 2
591
+ /* DYNAMIC */
592
+ }, [
593
+ _ctx.$slots["add-icon"] ? {
594
+ name: "action",
595
+ fn: withCtx(() => [
596
+ renderSlot(_ctx.$slots, "add-icon")
597
+ ]),
598
+ key: "0"
599
+ } : void 0
600
+ ]), 1032, ["model-value", "addable", "theme", "placement"]);
601
+ };
602
+ }
603
+ });
182
604
 
183
605
  const adapter = {
184
606
  message: MessagePlugin,
185
607
  messageBox: {
186
- alert: (msg) => {
187
- DialogPlugin.alert({
188
- body: msg
608
+ alert: (msg, title) => {
609
+ return new Promise((resolve, reject) => {
610
+ const dia = DialogPlugin.alert({
611
+ header: title,
612
+ body: msg,
613
+ onConfirm: (e) => {
614
+ dia.hide();
615
+ resolve(e);
616
+ },
617
+ onClose: (e) => {
618
+ dia.hide();
619
+ reject(e);
620
+ }
621
+ });
189
622
  });
190
623
  },
191
- confirm: (msg) => {
192
- DialogPlugin.confirm({
193
- body: msg
624
+ confirm: (msg, title) => {
625
+ return new Promise((resolve, reject) => {
626
+ const dia = DialogPlugin.confirm({
627
+ header: title,
628
+ body: msg,
629
+ onConfirm: (e) => {
630
+ dia.hide();
631
+ resolve(e);
632
+ },
633
+ onClose: (e) => {
634
+ dia.hide();
635
+ reject(e);
636
+ }
637
+ });
194
638
  });
195
639
  },
196
640
  close: (msg) => {
@@ -211,8 +655,8 @@ const adapter = {
211
655
  props: (props) => ({
212
656
  theme: props.type,
213
657
  size: props.size === "default" ? "medium" : props.size,
214
- icon: () => props.icon ? h(props.icon) : null,
215
- variant: props.link || props.text ? "text" : "base",
658
+ icon: props.icon ? () => h(_sfc_main$7, null, { default: () => h(props.icon) }) : void 0,
659
+ variant: props.link || props.text ? "text" : props.variant || "base",
216
660
  shape: props.circle ? "circle" : "rectangle"
217
661
  })
218
662
  },
@@ -221,7 +665,9 @@ const adapter = {
221
665
  props: (props) => ({
222
666
  shadow: props.shadow !== "never",
223
667
  hoverShadow: props.shadow === "hover",
224
- header: props.header
668
+ header: props.header,
669
+ bodyStyle: props.bodyStyle,
670
+ headerBordered: true
225
671
  })
226
672
  },
227
673
  cascader: {
@@ -242,13 +688,8 @@ const adapter = {
242
688
  })
243
689
  },
244
690
  checkbox: {
245
- component: Checkbox,
246
- props: (props) => ({
247
- modelValue: props.modelValue,
248
- label: props.label,
249
- value: props.value,
250
- disabled: props.disabled
251
- })
691
+ component: _sfc_main$a,
692
+ props: (props) => props
252
693
  },
253
694
  checkboxGroup: {
254
695
  component: CheckboxGroup,
@@ -261,13 +702,13 @@ const adapter = {
261
702
  col: {
262
703
  component: Col,
263
704
  props: (props) => ({
264
- span: props.span
705
+ span: props.span ? props.span / 2 : 12
265
706
  })
266
707
  },
267
708
  collapse: {
268
709
  component: Collapse,
269
710
  props: (props) => ({
270
- value: props.modelValue,
711
+ modelValue: props.modelValue,
271
712
  expandIconPlacement: "right"
272
713
  })
273
714
  },
@@ -290,19 +731,12 @@ const adapter = {
290
731
  })
291
732
  },
292
733
  datePicker: {
293
- component: _sfc_main$4,
734
+ component: _sfc_main$9,
294
735
  props: (props) => props
295
736
  },
296
737
  dialog: {
297
- component: Dialog,
298
- props: (props) => ({
299
- visible: props.modelValue,
300
- attach: props.appendToBody ? "body" : "",
301
- header: props.title,
302
- width: props.width,
303
- mode: props.fullscreen ? "full-screen" : "modal",
304
- closeOnOverlayClick: props.closeOnClickModal
305
- })
738
+ component: _sfc_main$8,
739
+ props: (props) => props
306
740
  },
307
741
  divider: {
308
742
  component: Divider,
@@ -369,15 +803,16 @@ const adapter = {
369
803
  props: (props) => ({
370
804
  labelWidth: props.labelWidth,
371
805
  name: props.prop,
372
- rules: props.rules
806
+ rules: props.rules,
807
+ help: props.extra
373
808
  })
374
809
  },
375
810
  icon: {
376
- component: Icon,
811
+ component: _sfc_main$7,
377
812
  props: (props) => props
378
813
  },
379
814
  input: {
380
- component: _sfc_main$2,
815
+ component: _sfc_main$6,
381
816
  props: (props) => props
382
817
  },
383
818
  inputNumber: {
@@ -415,17 +850,12 @@ const adapter = {
415
850
  })
416
851
  },
417
852
  radio: {
418
- component: Radio,
419
- props: (props) => ({
420
- label: props.label,
421
- value: props.value
422
- })
853
+ component: _sfc_main$4,
854
+ props: (props) => props
423
855
  },
424
856
  radioButton: {
425
- component: RadioButton,
426
- props: (props) => ({
427
- label: props.label
428
- })
857
+ component: _sfc_main$3,
858
+ props: (props) => props
429
859
  },
430
860
  radioGroup: {
431
861
  component: RadioGroup,
@@ -483,11 +913,7 @@ const adapter = {
483
913
  })
484
914
  },
485
915
  table: {
486
- component: Table,
487
- props: (props) => props
488
- },
489
- tableColumn: {
490
- component: TableColumn,
916
+ component: _sfc_main$1,
491
917
  props: (props) => props
492
918
  },
493
919
  tabPane: {
@@ -498,13 +924,8 @@ const adapter = {
498
924
  })
499
925
  },
500
926
  tabs: {
501
- component: Tabs,
502
- props: (props) => ({
503
- addable: props.editable,
504
- theme: props.type === "card" ? "card" : "normal",
505
- placement: props.tabPosition,
506
- value: props.modelValue
507
- })
927
+ component: _sfc_main,
928
+ props: (props) => props
508
929
  },
509
930
  tag: {
510
931
  component: Tag,
@@ -525,7 +946,7 @@ const adapter = {
525
946
  component: Tooltip,
526
947
  props: (props) => ({
527
948
  ...props,
528
- placement: props.placement,
949
+ placement: props.placement?.replace(/\B([A-Z])/g, "-$1").toLowerCase(),
529
950
  content: props.content
530
951
  })
531
952
  },
@@ -536,8 +957,13 @@ const adapter = {
536
957
  disabled: props.disabled,
537
958
  autoUpload: props.autoUpload
538
959
  })
960
+ },
961
+ popconfirm: {
962
+ component: _sfc_main$5,
963
+ props: (props) => props
539
964
  }
540
- }
965
+ },
966
+ loading: LoadingDirective
541
967
  };
542
968
 
543
969
  export { adapter as default };