@tmagic/tdesign-vue-next-adapter 1.3.14 → 1.3.16

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,7 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, unref, createElementBlock, renderSlot, createSlots, withCtx, createElementVNode, ref, h } from 'vue';
2
- import { DateRangePicker, DatePicker, Textarea, Input, LoadingPlugin, Tree, MessagePlugin, DialogPlugin, Badge, Button, Card, Cascader, Checkbox, CheckboxGroup, Col, Collapse, CollapsePanel, ColorPicker, Dialog, Divider, Drawer, Dropdown, DropdownItem, Form, FormItem, InputNumber, Option, OptionGroup, Pagination, Popup, Radio, RadioButton, RadioGroup, Row, Select, StepItem, Steps, Switch, Table, TabPanel, Tabs, Tag, TimePicker, Tooltip, Upload } from 'tdesign-vue-next';
2
+ import { DateRangePicker, DatePicker, Textarea, Input, Popup, Tree, MessagePlugin, DialogPlugin, Badge, Button, Card, Cascader, Checkbox, CheckboxGroup, Col, Collapse, CollapsePanel, ColorPicker, Dialog, Divider, Drawer, Dropdown, DropdownItem, Form, FormItem, InputNumber, Option, OptionGroup, Pagination, Radio, RadioButton, RadioGroup, Row, Select, StepItem, Steps, Switch, Table, TabPanel, Tabs, Tag, TimePicker, Tooltip, Upload } from 'tdesign-vue-next';
3
3
 
4
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
5
5
  __name: "DatePicker",
6
6
  props: {
7
7
  type: { default: "date" },
@@ -74,7 +74,7 @@ const _export_sfc = (sfc, props) => {
74
74
  return target;
75
75
  };
76
76
 
77
- const _sfc_main$4 = {};
77
+ const _sfc_main$5 = {};
78
78
 
79
79
  const _hoisted_1$1 = { style: {"width":"1em","height":"1em"} };
80
80
 
@@ -83,9 +83,9 @@ function _sfc_render$2(_ctx, _cache) {
83
83
  renderSlot(_ctx.$slots, "default")
84
84
  ]))
85
85
  }
86
- const Icon = /*#__PURE__*/_export_sfc(_sfc_main$4, [['render',_sfc_render$2]]);
86
+ const Icon = /*#__PURE__*/_export_sfc(_sfc_main$5, [['render',_sfc_render$2]]);
87
87
 
88
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
88
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
89
89
  __name: "Input",
90
90
  props: {
91
91
  modelValue: {},
@@ -147,35 +147,42 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
147
147
  }
148
148
  });
149
149
 
150
- const INSTANCE_KEY = Symbol("TdesignLoading");
151
- const createInstance = (el) => el[INSTANCE_KEY] = {
152
- instance: LoadingPlugin({
153
- attach: () => el,
154
- showOverlay: true,
155
- size: "20px"
156
- })
157
- };
158
- const vLoading = {
159
- mounted(el, binding) {
160
- const { value } = binding;
161
- if (value) {
162
- createInstance(el);
163
- }
164
- },
165
- updated(el, binding) {
166
- const instance = el[INSTANCE_KEY];
167
- if (binding.oldValue !== binding.value) {
168
- if (binding.value && !binding.oldValue) {
169
- createInstance(el);
170
- } else {
171
- instance?.instance.hide();
172
- }
173
- }
150
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
151
+ __name: "Popover",
152
+ props: {
153
+ placement: {},
154
+ width: {},
155
+ title: {},
156
+ trigger: {},
157
+ effect: {},
158
+ content: {},
159
+ disabled: { type: Boolean },
160
+ popperClass: {},
161
+ visible: { type: [Boolean, null] }
174
162
  },
175
- unmounted(el) {
176
- el[INSTANCE_KEY]?.instance.hide();
163
+ setup(__props) {
164
+ const props = __props;
165
+ const placement = computed(() => props.placement);
166
+ const trigger = computed(() => props.trigger);
167
+ return (_ctx, _cache) => {
168
+ return openBlock(), createBlock(unref(Popup), {
169
+ placement: placement.value,
170
+ trigger: trigger.value,
171
+ disabled: _ctx.disabled,
172
+ visible: _ctx.visible,
173
+ overlayClassName: _ctx.popperClass
174
+ }, {
175
+ content: withCtx(() => [
176
+ renderSlot(_ctx.$slots, "default")
177
+ ]),
178
+ default: withCtx(() => [
179
+ renderSlot(_ctx.$slots, "reference")
180
+ ]),
181
+ _: 3
182
+ }, 8, ["placement", "trigger", "disabled", "visible", "overlayClassName"]);
183
+ };
177
184
  }
178
- };
185
+ });
179
186
 
180
187
  const _sfc_main$2 = {};
181
188
 
@@ -328,7 +335,6 @@ const adapter = {
328
335
  console.log(msg);
329
336
  }
330
337
  },
331
- loading: vLoading,
332
338
  components: {
333
339
  badge: {
334
340
  component: Badge,
@@ -421,7 +427,7 @@ const adapter = {
421
427
  })
422
428
  },
423
429
  datePicker: {
424
- component: _sfc_main$5,
430
+ component: _sfc_main$6,
425
431
  props: (props) => props
426
432
  },
427
433
  dialog: {
@@ -446,7 +452,7 @@ const adapter = {
446
452
  component: Drawer,
447
453
  props: (props) => ({
448
454
  visible: props.modelValue,
449
- size: props.size,
455
+ size: typeof props.size === "number" ? `${props.size}px` : props.size,
450
456
  closeOnEscKeydown: props.closeOnPressEscape,
451
457
  closeOnOverlayClick: props.closeOnClickModal,
452
458
  attach: props.appendToBody ? "body" : void 0,
@@ -508,7 +514,7 @@ const adapter = {
508
514
  props: () => ({})
509
515
  },
510
516
  input: {
511
- component: _sfc_main$3,
517
+ component: _sfc_main$4,
512
518
  props: (props) => props
513
519
  },
514
520
  inputNumber: {
@@ -546,14 +552,8 @@ const adapter = {
546
552
  })
547
553
  },
548
554
  popover: {
549
- component: Popup,
550
- props: (props) => ({
551
- placement: props.placement,
552
- trigger: props.trigger,
553
- content: props.content,
554
- disabled: props.disabled,
555
- overlayClassName: props.popperClass
556
- })
555
+ component: _sfc_main$3,
556
+ props: (props) => props
557
557
  },
558
558
  radio: {
559
559
  component: Radio,
@@ -664,6 +664,7 @@ const adapter = {
664
664
  tooltip: {
665
665
  component: Tooltip,
666
666
  props: (props) => ({
667
+ ...props,
667
668
  placement: props.placement,
668
669
  content: props.content
669
670
  })
@@ -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$5 = /* @__PURE__ */ vue.defineComponent({
7
+ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
8
8
  __name: "DatePicker",
9
9
  props: {
10
10
  type: { default: "date" },
@@ -77,7 +77,7 @@
77
77
  return target;
78
78
  };
79
79
 
80
- const _sfc_main$4 = {};
80
+ const _sfc_main$5 = {};
81
81
 
82
82
  const _hoisted_1$1 = { style: {"width":"1em","height":"1em"} };
83
83
 
@@ -86,9 +86,9 @@
86
86
  vue.renderSlot(_ctx.$slots, "default")
87
87
  ]))
88
88
  }
89
- const Icon = /*#__PURE__*/_export_sfc(_sfc_main$4, [['render',_sfc_render$2]]);
89
+ const Icon = /*#__PURE__*/_export_sfc(_sfc_main$5, [['render',_sfc_render$2]]);
90
90
 
91
- const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
91
+ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
92
92
  __name: "Input",
93
93
  props: {
94
94
  modelValue: {},
@@ -150,35 +150,42 @@
150
150
  }
151
151
  });
152
152
 
153
- const INSTANCE_KEY = Symbol("TdesignLoading");
154
- const createInstance = (el) => el[INSTANCE_KEY] = {
155
- instance: tdesignVueNext.LoadingPlugin({
156
- attach: () => el,
157
- showOverlay: true,
158
- size: "20px"
159
- })
160
- };
161
- const vLoading = {
162
- mounted(el, binding) {
163
- const { value } = binding;
164
- if (value) {
165
- createInstance(el);
166
- }
167
- },
168
- updated(el, binding) {
169
- const instance = el[INSTANCE_KEY];
170
- if (binding.oldValue !== binding.value) {
171
- if (binding.value && !binding.oldValue) {
172
- createInstance(el);
173
- } else {
174
- instance?.instance.hide();
175
- }
176
- }
153
+ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
154
+ __name: "Popover",
155
+ props: {
156
+ placement: {},
157
+ width: {},
158
+ title: {},
159
+ trigger: {},
160
+ effect: {},
161
+ content: {},
162
+ disabled: { type: Boolean },
163
+ popperClass: {},
164
+ visible: { type: [Boolean, null] }
177
165
  },
178
- unmounted(el) {
179
- el[INSTANCE_KEY]?.instance.hide();
166
+ setup(__props) {
167
+ const props = __props;
168
+ const placement = vue.computed(() => props.placement);
169
+ const trigger = vue.computed(() => props.trigger);
170
+ return (_ctx, _cache) => {
171
+ return vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.Popup), {
172
+ placement: placement.value,
173
+ trigger: trigger.value,
174
+ disabled: _ctx.disabled,
175
+ visible: _ctx.visible,
176
+ overlayClassName: _ctx.popperClass
177
+ }, {
178
+ content: vue.withCtx(() => [
179
+ vue.renderSlot(_ctx.$slots, "default")
180
+ ]),
181
+ default: vue.withCtx(() => [
182
+ vue.renderSlot(_ctx.$slots, "reference")
183
+ ]),
184
+ _: 3
185
+ }, 8, ["placement", "trigger", "disabled", "visible", "overlayClassName"]);
186
+ };
180
187
  }
181
- };
188
+ });
182
189
 
183
190
  const _sfc_main$2 = {};
184
191
 
@@ -331,7 +338,6 @@
331
338
  console.log(msg);
332
339
  }
333
340
  },
334
- loading: vLoading,
335
341
  components: {
336
342
  badge: {
337
343
  component: tdesignVueNext.Badge,
@@ -424,7 +430,7 @@
424
430
  })
425
431
  },
426
432
  datePicker: {
427
- component: _sfc_main$5,
433
+ component: _sfc_main$6,
428
434
  props: (props) => props
429
435
  },
430
436
  dialog: {
@@ -449,7 +455,7 @@
449
455
  component: tdesignVueNext.Drawer,
450
456
  props: (props) => ({
451
457
  visible: props.modelValue,
452
- size: props.size,
458
+ size: typeof props.size === "number" ? `${props.size}px` : props.size,
453
459
  closeOnEscKeydown: props.closeOnPressEscape,
454
460
  closeOnOverlayClick: props.closeOnClickModal,
455
461
  attach: props.appendToBody ? "body" : void 0,
@@ -511,7 +517,7 @@
511
517
  props: () => ({})
512
518
  },
513
519
  input: {
514
- component: _sfc_main$3,
520
+ component: _sfc_main$4,
515
521
  props: (props) => props
516
522
  },
517
523
  inputNumber: {
@@ -549,14 +555,8 @@
549
555
  })
550
556
  },
551
557
  popover: {
552
- component: tdesignVueNext.Popup,
553
- props: (props) => ({
554
- placement: props.placement,
555
- trigger: props.trigger,
556
- content: props.content,
557
- disabled: props.disabled,
558
- overlayClassName: props.popperClass
559
- })
558
+ component: _sfc_main$3,
559
+ props: (props) => props
560
560
  },
561
561
  radio: {
562
562
  component: tdesignVueNext.Radio,
@@ -667,6 +667,7 @@
667
667
  tooltip: {
668
668
  component: tdesignVueNext.Tooltip,
669
669
  props: (props) => ({
670
+ ...props,
670
671
  placement: props.placement,
671
672
  content: props.content
672
673
  })
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.14",
2
+ "version": "1.3.16",
3
3
  "name": "@tmagic/tdesign-vue-next-adapter",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -32,13 +32,13 @@
32
32
  "typescript"
33
33
  ],
34
34
  "dependencies": {
35
- "@tmagic/design": "1.3.14",
36
- "tdesign-vue-next": "^1.3.4",
35
+ "@tmagic/design": "1.3.16",
36
+ "tdesign-vue-next": "^1.8.1",
37
37
  "vue": "^3.3.8"
38
38
  },
39
39
  "peerDependencies": {
40
- "@tmagic/design": "1.3.14",
41
- "tdesign-vue-next": "^1.3.4",
40
+ "@tmagic/design": "1.3.16",
41
+ "tdesign-vue-next": "^1.8.1",
42
42
  "vue": "^3.3.8"
43
43
  },
44
44
  "devDependencies": {
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <TPopup
3
+ :placement="placement"
4
+ :trigger="trigger"
5
+ :disabled="disabled"
6
+ :visible="visible"
7
+ :overlayClassName="popperClass"
8
+ >
9
+ <slot name="reference"></slot>
10
+
11
+ <template #content>
12
+ <slot></slot>
13
+ </template>
14
+ </TPopup>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ import { computed } from 'vue';
19
+ import { Popup as TPopup, type PopupPlacement } from 'tdesign-vue-next';
20
+
21
+ import type { PopoverProps } from '@tmagic/design';
22
+
23
+ const props = defineProps<PopoverProps>();
24
+
25
+ const placement = computed(() => props.placement as PopupPlacement);
26
+ const trigger = computed(() => props.trigger as 'click' | 'focus' | 'mousedown' | 'context-menu' | 'hover');
27
+ </script>
package/src/index.ts CHANGED
@@ -23,7 +23,6 @@ import {
23
23
  Option as TOption,
24
24
  OptionGroup as TOptionGroup,
25
25
  Pagination as TPagination,
26
- Popup as TPopup,
27
26
  Radio as TRadio,
28
27
  RadioButton as TRadioButton,
29
28
  RadioGroup as TRadioGroup,
@@ -87,7 +86,7 @@ import type {
87
86
  import DatePicker from './DatePicker.vue';
88
87
  import Icon from './Icon.vue';
89
88
  import Input from './Input.vue';
90
- import { vLoading } from './loading';
89
+ import Popover from './Popover.vue';
91
90
  import Scrollbar from './Scrollbar.vue';
92
91
  import TableColumn from './TableColumn.vue';
93
92
  import Tree from './Tree.vue';
@@ -109,7 +108,6 @@ const adapter: any = {
109
108
  console.log(msg);
110
109
  },
111
110
  },
112
- loading: vLoading,
113
111
  components: {
114
112
  badge: {
115
113
  component: TBadge,
@@ -240,7 +238,7 @@ const adapter: any = {
240
238
  component: TDrawer,
241
239
  props: (props: DrawerProps) => ({
242
240
  visible: props.modelValue,
243
- size: props.size,
241
+ size: typeof props.size === 'number' ? `${props.size}px` : props.size,
244
242
  closeOnEscKeydown: props.closeOnPressEscape,
245
243
  closeOnOverlayClick: props.closeOnClickModal,
246
244
  attach: props.appendToBody ? 'body' : undefined,
@@ -352,14 +350,8 @@ const adapter: any = {
352
350
  },
353
351
 
354
352
  popover: {
355
- component: TPopup,
356
- props: (props: PopoverProps) => ({
357
- placement: props.placement,
358
- trigger: props.trigger,
359
- content: props.content,
360
- disabled: props.disabled,
361
- overlayClassName: props.popperClass,
362
- }),
353
+ component: Popover,
354
+ props: (props: PopoverProps) => props,
363
355
  },
364
356
 
365
357
  radio: {
@@ -486,6 +478,7 @@ const adapter: any = {
486
478
  tooltip: {
487
479
  component: TTooltip,
488
480
  props: (props: TooltipProps) => ({
481
+ ...props,
489
482
  placement: props.placement,
490
483
  content: props.content,
491
484
  }),
package/src/loading.ts DELETED
@@ -1,45 +0,0 @@
1
- import type { Directive } from 'vue';
2
- import { LoadingInstance, LoadingPlugin } from 'tdesign-vue-next';
3
-
4
- export type LoadingBinding = boolean;
5
-
6
- const INSTANCE_KEY = Symbol('TdesignLoading');
7
-
8
- export interface ElementLoading extends HTMLElement {
9
- [INSTANCE_KEY]?: {
10
- instance: LoadingInstance;
11
- };
12
- }
13
-
14
- const createInstance = (el: ElementLoading) =>
15
- (el[INSTANCE_KEY] = {
16
- instance: LoadingPlugin({
17
- attach: () => el,
18
- showOverlay: true,
19
- size: '20px',
20
- }),
21
- });
22
-
23
- export const vLoading: Directive<ElementLoading, LoadingBinding> = {
24
- mounted(el, binding) {
25
- const { value } = binding;
26
- if (value) {
27
- createInstance(el);
28
- }
29
- },
30
-
31
- updated(el, binding) {
32
- const instance = el[INSTANCE_KEY];
33
- if (binding.oldValue !== binding.value) {
34
- if (binding.value && !binding.oldValue) {
35
- createInstance(el);
36
- } else {
37
- instance?.instance.hide();
38
- }
39
- }
40
- },
41
-
42
- unmounted(el) {
43
- el[INSTANCE_KEY]?.instance.hide();
44
- },
45
- };
@@ -1,11 +0,0 @@
1
- import type { Directive } from 'vue';
2
- import { LoadingInstance } from 'tdesign-vue-next';
3
- export type LoadingBinding = boolean;
4
- declare const INSTANCE_KEY: unique symbol;
5
- export interface ElementLoading extends HTMLElement {
6
- [INSTANCE_KEY]?: {
7
- instance: LoadingInstance;
8
- };
9
- }
10
- export declare const vLoading: Directive<ElementLoading, LoadingBinding>;
11
- export {};