@tmagic/tdesign-vue-next-adapter 1.3.15 → 1.4.0-beta.1
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 +47 -45
- package/dist/tmagic-tdesign-vue-next-adapter.umd.cjs +46 -44
- package/package.json +13 -11
- package/src/Popover.vue +27 -0
- package/src/index.ts +6 -12
- package/src/loading.ts +0 -45
- package/types/loading.d.ts +0 -11
|
@@ -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,
|
|
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$
|
|
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$
|
|
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$
|
|
86
|
+
const Icon = /*#__PURE__*/_export_sfc(_sfc_main$5, [['render',_sfc_render$2]]);
|
|
87
87
|
|
|
88
|
-
const _sfc_main$
|
|
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
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
176
|
-
|
|
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$
|
|
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$
|
|
517
|
+
component: _sfc_main$4,
|
|
512
518
|
props: (props) => props
|
|
513
519
|
},
|
|
514
520
|
inputNumber: {
|
|
@@ -546,19 +552,14 @@ const adapter = {
|
|
|
546
552
|
})
|
|
547
553
|
},
|
|
548
554
|
popover: {
|
|
549
|
-
component:
|
|
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,
|
|
560
560
|
props: (props) => ({
|
|
561
|
-
label: props.label
|
|
561
|
+
label: props.label,
|
|
562
|
+
value: props.value
|
|
562
563
|
})
|
|
563
564
|
},
|
|
564
565
|
radioButton: {
|
|
@@ -664,6 +665,7 @@ const adapter = {
|
|
|
664
665
|
tooltip: {
|
|
665
666
|
component: Tooltip,
|
|
666
667
|
props: (props) => ({
|
|
668
|
+
...props,
|
|
667
669
|
placement: props.placement,
|
|
668
670
|
content: props.content
|
|
669
671
|
})
|
|
@@ -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$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$
|
|
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$
|
|
89
|
+
const Icon = /*#__PURE__*/_export_sfc(_sfc_main$5, [['render',_sfc_render$2]]);
|
|
90
90
|
|
|
91
|
-
const _sfc_main$
|
|
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
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
179
|
-
|
|
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$
|
|
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$
|
|
520
|
+
component: _sfc_main$4,
|
|
515
521
|
props: (props) => props
|
|
516
522
|
},
|
|
517
523
|
inputNumber: {
|
|
@@ -549,19 +555,14 @@
|
|
|
549
555
|
})
|
|
550
556
|
},
|
|
551
557
|
popover: {
|
|
552
|
-
component:
|
|
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,
|
|
563
563
|
props: (props) => ({
|
|
564
|
-
label: props.label
|
|
564
|
+
label: props.label,
|
|
565
|
+
value: props.value
|
|
565
566
|
})
|
|
566
567
|
},
|
|
567
568
|
radioButton: {
|
|
@@ -667,6 +668,7 @@
|
|
|
667
668
|
tooltip: {
|
|
668
669
|
component: tdesignVueNext.Tooltip,
|
|
669
670
|
props: (props) => ({
|
|
671
|
+
...props,
|
|
670
672
|
placement: props.placement,
|
|
671
673
|
content: props.content
|
|
672
674
|
})
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.4.0-beta.1",
|
|
3
3
|
"name": "@tmagic/tdesign-vue-next-adapter",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -32,26 +32,28 @@
|
|
|
32
32
|
"typescript"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tmagic/design": "1.
|
|
36
|
-
"tdesign-vue-next": "^1.
|
|
37
|
-
"vue": "^3.
|
|
35
|
+
"@tmagic/design": "1.4.0-beta.1",
|
|
36
|
+
"tdesign-vue-next": "^1.8.1",
|
|
37
|
+
"vue": "^3.4.21"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@tmagic/design": "1.
|
|
41
|
-
"tdesign-vue-next": "^1.
|
|
42
|
-
"vue": "^3.
|
|
40
|
+
"@tmagic/design": "1.4.0-beta.1",
|
|
41
|
+
"tdesign-vue-next": "^1.8.1",
|
|
42
|
+
"vue": "^3.4.21"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@vitejs/plugin-vue": "^4.5.2",
|
|
46
|
-
"@vue/compiler-sfc": "^3.
|
|
46
|
+
"@vue/compiler-sfc": "^3.4.21",
|
|
47
47
|
"@types/node": "^18.19.0",
|
|
48
48
|
"rimraf": "^3.0.2",
|
|
49
|
-
"typescript": "^5.
|
|
50
|
-
"vite": "^5.
|
|
49
|
+
"typescript": "^5.4.2",
|
|
50
|
+
"vite": "^5.1.6",
|
|
51
|
+
"vue-tsc": "^2.0.6"
|
|
51
52
|
},
|
|
52
53
|
"scripts": {
|
|
53
54
|
"build": "npm run build:type && vite build",
|
|
54
55
|
"build:type": "npm run clear:type && tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
|
|
55
|
-
"clear:type": "rimraf ./types"
|
|
56
|
+
"clear:type": "rimraf ./types",
|
|
57
|
+
"type:check": "vue-tsc --noEmit"
|
|
56
58
|
}
|
|
57
59
|
}
|
package/src/Popover.vue
ADDED
|
@@ -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
|
|
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,20 +350,15 @@ const adapter: any = {
|
|
|
352
350
|
},
|
|
353
351
|
|
|
354
352
|
popover: {
|
|
355
|
-
component:
|
|
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: {
|
|
366
358
|
component: TRadio,
|
|
367
359
|
props: (props: RadioProps) => ({
|
|
368
360
|
label: props.label,
|
|
361
|
+
value: props.value,
|
|
369
362
|
}),
|
|
370
363
|
},
|
|
371
364
|
|
|
@@ -486,6 +479,7 @@ const adapter: any = {
|
|
|
486
479
|
tooltip: {
|
|
487
480
|
component: TTooltip,
|
|
488
481
|
props: (props: TooltipProps) => ({
|
|
482
|
+
...props,
|
|
489
483
|
placement: props.placement,
|
|
490
484
|
content: props.content,
|
|
491
485
|
}),
|
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
|
-
};
|
package/types/loading.d.ts
DELETED
|
@@ -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 {};
|