@luanlu/mk-motion 1.1.0 → 1.2.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/package.json +14 -2
- package/src/a11y/focus-trap.ts +64 -0
- package/src/a11y/keyboard.ts +43 -0
- package/src/components/alert/alert.css +111 -0
- package/src/components/alert/alert.ts +107 -0
- package/src/components/avatar/avatar.css +112 -0
- package/src/components/avatar/avatar.ts +175 -0
- package/src/components/breadcrumb/breadcrumb.css +31 -0
- package/src/components/breadcrumb/breadcrumb.ts +71 -0
- package/src/components/button/button.css +108 -0
- package/src/components/button/button.ts +140 -0
- package/src/components/card/card.css +52 -0
- package/src/components/card/card.ts +87 -0
- package/src/components/collapse/collapse.css +76 -0
- package/src/components/collapse/collapse.ts +168 -0
- package/src/components/dialog/dialog.css +78 -0
- package/src/components/dialog/dialog.ts +164 -0
- package/src/components/drawer/drawer.css +73 -0
- package/src/components/drawer/drawer.ts +131 -0
- package/src/components/empty/empty.css +36 -0
- package/src/components/empty/empty.ts +85 -0
- package/src/components/form/checkbox.css +56 -0
- package/src/components/form/checkbox.ts +119 -0
- package/src/components/form/radio.css +57 -0
- package/src/components/form/radio.ts +153 -0
- package/src/components/form/select.css +91 -0
- package/src/components/form/select.ts +174 -0
- package/src/components/form/slider.css +56 -0
- package/src/components/form/slider.ts +148 -0
- package/src/components/input/input.css +92 -0
- package/src/components/input/input.ts +162 -0
- package/src/components/layout/divider.css +32 -0
- package/src/components/layout/divider.ts +42 -0
- package/src/components/layout/row.css +64 -0
- package/src/components/layout/row.ts +57 -0
- package/src/components/layout/space.css +14 -0
- package/src/components/layout/space.ts +48 -0
- package/src/components/loading/loading.css +37 -0
- package/src/components/loading/loading.ts +46 -0
- package/src/components/menu/menu.css +121 -0
- package/src/components/menu/menu.ts +187 -0
- package/src/components/message/message.css +64 -0
- package/src/components/message/message.ts +96 -0
- package/src/components/popover/popover.css +73 -0
- package/src/components/popover/popover.ts +279 -0
- package/src/components/progress/progress.css +112 -0
- package/src/components/progress/progress.ts +171 -0
- package/src/components/steps/steps.css +127 -0
- package/src/components/steps/steps.ts +102 -0
- package/src/components/styles/components.css +28 -0
- package/src/components/styles/reset.css +24 -0
- package/src/components/styles/tokens.css +248 -0
- package/src/components/styles/variables.css +24 -0
- package/src/components/switch/switch.css +53 -0
- package/src/components/switch/switch.ts +103 -0
- package/src/components/table/table.css +192 -0
- package/src/components/table/table.ts +370 -0
- package/src/components/tabs/tabs.css +138 -0
- package/src/components/tabs/tabs.ts +211 -0
- package/src/components/tag/tag.css +123 -0
- package/src/components/tag/tag.ts +112 -0
- package/src/components/tooltip/tooltip.css +66 -0
- package/src/components/tooltip/tooltip.ts +185 -0
- package/src/core/animator.ts +124 -0
- package/src/core/timeline.ts +128 -0
- package/src/core/utils.ts +47 -0
- package/src/effects/glitch.ts +99 -0
- package/src/effects/particle.ts +134 -0
- package/src/effects/text-split.ts +95 -0
- package/src/effects/wave-text.ts +88 -0
- package/src/gesture/draggable.ts +130 -0
- package/src/gesture/spring.ts +152 -0
- package/src/index.ts +162 -0
- package/src/interactive/coverflow.ts +100 -0
- package/src/interactive/cursor-trail.ts +113 -0
- package/src/interactive/flip-card.ts +114 -0
- package/src/interactive/magnetic.ts +121 -0
- package/src/micro/hover-lift.ts +94 -0
- package/src/micro/ripple.ts +130 -0
- package/src/motion/component-motion.ts +177 -0
- package/src/nuxt/module.ts +46 -0
- package/src/presets/index.ts +69 -0
- package/src/scroll/scroll-trigger.ts +104 -0
- package/src/styles/animations.css +135 -0
- package/src/styles/element-plus.css +174 -0
- package/src/text/count-up.ts +108 -0
- package/src/text/typewriter.ts +109 -0
- package/src/theme/dark.css +19 -0
- package/src/theme/light.css +19 -0
- package/src/theme/theme.ts +65 -0
- package/src/transitions/blur-reveal.ts +92 -0
- package/src/transitions/collapse.ts +112 -0
- package/src/transitions/lazy-image.ts +87 -0
- package/src/transitions/list.ts +75 -0
- package/src/transitions/loading.ts +95 -0
- package/src/transitions/parallax.ts +60 -0
- package/src/transitions/shimmer.ts +105 -0
- package/src/transitions/toast.ts +151 -0
- package/src/types.d.ts +4 -0
- package/src/vite/plugin.ts +45 -0
- package/src/vue/button.ts +28 -9
- package/src/vue/card.ts +28 -8
- package/src/vue/composables/index.ts +4 -0
- package/src/vue/composables/useLoading.ts +12 -0
- package/src/vue/composables/useMessage.ts +16 -0
- package/src/vue/composables/useMotion.ts +19 -0
- package/src/vue/composables/useTheme.ts +12 -0
- package/src/vue/dialog.ts +69 -17
- package/src/vue/index.ts +4 -21
- package/src/vue/input.ts +35 -11
- package/src/vue/slider.ts +22 -4
- package/src/vue/switch.ts +16 -9
- package/src/vue/alert.ts +0 -32
- package/src/vue/avatar.ts +0 -34
- package/src/vue/breadcrumb.ts +0 -32
- package/src/vue/checkbox.ts +0 -32
- package/src/vue/collapse.ts +0 -33
- package/src/vue/divider.ts +0 -32
- package/src/vue/drawer.ts +0 -33
- package/src/vue/empty.ts +0 -33
- package/src/vue/menu.ts +0 -33
- package/src/vue/popover.ts +0 -34
- package/src/vue/progress.ts +0 -33
- package/src/vue/row.ts +0 -32
- package/src/vue/select.ts +0 -33
- package/src/vue/space.ts +0 -32
- package/src/vue/steps.ts +0 -33
- package/src/vue/table.ts +0 -33
- package/src/vue/tabs.ts +0 -33
- package/src/vue/tag.ts +0 -33
- package/src/vue/tooltip.ts +0 -34
package/src/vue/dialog.ts
CHANGED
|
@@ -1,33 +1,85 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted,
|
|
2
|
-
import { createDialog } from '../components/dialog/dialog.js'
|
|
3
|
-
import type { DialogOptions } from '../components/dialog/dialog.js'
|
|
1
|
+
import { defineComponent, h, ref, watch, onMounted, onUnmounted, Teleport, Transition } from 'vue'
|
|
4
2
|
|
|
5
3
|
export const MkDialog = defineComponent({
|
|
6
4
|
name: 'MkDialog',
|
|
7
5
|
props: {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
modelValue: { type: Boolean, default: false },
|
|
7
|
+
title: { type: String, default: '' },
|
|
8
|
+
showClose: { type: Boolean, default: true },
|
|
9
|
+
showCancel: { type: Boolean, default: true },
|
|
10
|
+
center: { type: Boolean, default: false },
|
|
11
|
+
cancelText: { type: String, default: '取消' },
|
|
12
|
+
confirmText: { type: String, default: '确定' },
|
|
10
13
|
},
|
|
11
|
-
|
|
14
|
+
emits: ['update:modelValue', 'confirm', 'cancel', 'close'],
|
|
12
15
|
setup(props, { emit, slots }) {
|
|
13
|
-
const
|
|
14
|
-
|
|
16
|
+
const visible = ref(props.modelValue)
|
|
17
|
+
const overlayRef = ref<HTMLDivElement>()
|
|
18
|
+
|
|
19
|
+
watch(() => props.modelValue, (v) => {
|
|
20
|
+
visible.value = v
|
|
21
|
+
})
|
|
15
22
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
const close = () => {
|
|
24
|
+
visible.value = false
|
|
25
|
+
emit('update:modelValue', false)
|
|
26
|
+
emit('close')
|
|
27
|
+
}
|
|
20
28
|
|
|
29
|
+
const onConfirm = () => {
|
|
30
|
+
emit('confirm')
|
|
31
|
+
close()
|
|
32
|
+
}
|
|
21
33
|
|
|
34
|
+
const onCancel = () => {
|
|
35
|
+
emit('cancel')
|
|
36
|
+
close()
|
|
37
|
+
}
|
|
22
38
|
|
|
23
|
-
|
|
39
|
+
const onOverlayClick = (e: MouseEvent) => {
|
|
40
|
+
if (e.target === overlayRef.value) close()
|
|
24
41
|
}
|
|
25
42
|
|
|
26
|
-
|
|
43
|
+
const onKeydown = (e: KeyboardEvent) => {
|
|
44
|
+
if (e.key === 'Escape') close()
|
|
45
|
+
}
|
|
27
46
|
|
|
28
|
-
|
|
29
|
-
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
if (props.modelValue) visible.value = true
|
|
49
|
+
})
|
|
30
50
|
|
|
31
|
-
return () => h(
|
|
51
|
+
return () => h(Teleport, { to: 'body' }, [
|
|
52
|
+
h(Transition, { name: 'mk-dialog' }, {
|
|
53
|
+
default: () => visible.value
|
|
54
|
+
? h('div', {
|
|
55
|
+
ref: overlayRef,
|
|
56
|
+
class: 'mk-dialog-overlay',
|
|
57
|
+
tabindex: -1,
|
|
58
|
+
onClick: onOverlayClick,
|
|
59
|
+
onKeydown,
|
|
60
|
+
}, [
|
|
61
|
+
h('div', {
|
|
62
|
+
class: ['mk-dialog', { 'is-center': props.center }],
|
|
63
|
+
role: 'dialog',
|
|
64
|
+
'aria-modal': 'true',
|
|
65
|
+
}, [
|
|
66
|
+
h('div', { class: 'mk-dialog__header' }, [
|
|
67
|
+
h('span', { class: 'mk-dialog__title' }, props.title),
|
|
68
|
+
props.showClose
|
|
69
|
+
? h('span', { class: 'mk-dialog__close', onClick: close }, '✕')
|
|
70
|
+
: null,
|
|
71
|
+
]),
|
|
72
|
+
h('div', { class: 'mk-dialog__body' }, slots.default?.()),
|
|
73
|
+
h('div', { class: 'mk-dialog__footer' }, [
|
|
74
|
+
props.showCancel
|
|
75
|
+
? h('button', { class: 'mk-button', onClick: onCancel }, props.cancelText)
|
|
76
|
+
: null,
|
|
77
|
+
h('button', { class: 'mk-button mk-button--primary', onClick: onConfirm }, props.confirmText),
|
|
78
|
+
]),
|
|
79
|
+
]),
|
|
80
|
+
])
|
|
81
|
+
: null,
|
|
82
|
+
}),
|
|
83
|
+
])
|
|
32
84
|
},
|
|
33
85
|
})
|
package/src/vue/index.ts
CHANGED
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export { MkAvatar } from './avatar.js'
|
|
3
|
-
export { MkBreadcrumb } from './breadcrumb.js'
|
|
1
|
+
// Components
|
|
4
2
|
export { MkButton } from './button.js'
|
|
5
3
|
export { MkCard } from './card.js'
|
|
6
|
-
export { MkCheckbox } from './checkbox.js'
|
|
7
|
-
export { MkCollapse } from './collapse.js'
|
|
8
4
|
export { MkDialog } from './dialog.js'
|
|
9
|
-
export { MkDivider } from './divider.js'
|
|
10
|
-
export { MkDrawer } from './drawer.js'
|
|
11
|
-
export { MkEmpty } from './empty.js'
|
|
12
5
|
export { MkInput } from './input.js'
|
|
13
|
-
export { useMkLoading } from './loading.js'
|
|
14
|
-
export { MkMenu } from './menu.js'
|
|
15
|
-
export { useMkMessage } from './message.js'
|
|
16
|
-
export { MkPopover } from './popover.js'
|
|
17
|
-
export { MkProgress } from './progress.js'
|
|
18
6
|
export { MkRadio } from './radio.js'
|
|
19
|
-
export { MkRow } from './row.js'
|
|
20
|
-
export { MkSelect } from './select.js'
|
|
21
7
|
export { MkSlider } from './slider.js'
|
|
22
|
-
export { MkSpace } from './space.js'
|
|
23
|
-
export { MkSteps } from './steps.js'
|
|
24
8
|
export { MkSwitch } from './switch.js'
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
export { MkTooltip } from './tooltip.js'
|
|
9
|
+
|
|
10
|
+
// Composables
|
|
11
|
+
export { useMkTheme, useMkMotion, useMkLoading, useMkMessage } from './composables/index.js'
|
package/src/vue/input.ts
CHANGED
|
@@ -5,25 +5,49 @@ import type { InputOptions } from '../components/input/input.js'
|
|
|
5
5
|
export const MkInput = defineComponent({
|
|
6
6
|
name: 'MkInput',
|
|
7
7
|
props: {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
modelValue: { type: String, default: '' },
|
|
9
|
+
type: { type: String, default: 'text' },
|
|
10
|
+
placeholder: { type: String, default: '' },
|
|
11
|
+
disabled: { type: Boolean, default: false },
|
|
12
|
+
clearable: { type: Boolean, default: false },
|
|
13
|
+
showPassword: { type: Boolean, default: false },
|
|
14
|
+
maxlength: { type: Number, default: undefined },
|
|
15
|
+
rows: { type: Number, default: undefined },
|
|
16
|
+
motion: { type: Object as () => InputOptions['motion'], default: undefined },
|
|
10
17
|
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit
|
|
18
|
+
emits: ['update:modelValue', 'enter', 'focus', 'blur'],
|
|
19
|
+
setup(props, { emit }) {
|
|
13
20
|
const container = ref<HTMLDivElement>()
|
|
14
21
|
let instance: ReturnType<typeof createInput> | null = null
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
onMounted(() => {
|
|
17
24
|
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
25
|
instance = createInput(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
type: props.type as InputOptions['type'],
|
|
27
|
+
placeholder: props.placeholder,
|
|
28
|
+
value: props.modelValue,
|
|
29
|
+
disabled: props.disabled,
|
|
30
|
+
clearable: props.clearable,
|
|
31
|
+
showPassword: props.showPassword,
|
|
32
|
+
maxlength: props.maxlength,
|
|
33
|
+
rows: props.rows,
|
|
34
|
+
motion: props.motion,
|
|
35
|
+
onInput: (v) => emit('update:modelValue', v),
|
|
36
|
+
onEnter: (v) => emit('enter', v),
|
|
37
|
+
onFocus: () => emit('focus'),
|
|
38
|
+
onBlur: () => emit('blur'),
|
|
23
39
|
})
|
|
24
|
-
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
watch(() => props.modelValue, (v) => {
|
|
43
|
+
if (instance && instance.input.value !== v) {
|
|
44
|
+
instance.input.value = v
|
|
45
|
+
}
|
|
46
|
+
})
|
|
25
47
|
|
|
26
|
-
|
|
48
|
+
watch(() => props.disabled, (v) => {
|
|
49
|
+
if (instance) instance.input.disabled = v
|
|
50
|
+
})
|
|
27
51
|
|
|
28
52
|
onUnmounted(() => instance?.destroy())
|
|
29
53
|
|
package/src/vue/slider.ts
CHANGED
|
@@ -5,13 +5,13 @@ import type { SliderOptions } from '../components/form/slider.js'
|
|
|
5
5
|
export const MkSlider = defineComponent({
|
|
6
6
|
name: 'MkSlider',
|
|
7
7
|
props: {
|
|
8
|
+
modelValue: { type: Number, default: 0 },
|
|
8
9
|
min: { type: Number, default: 0 },
|
|
9
10
|
max: { type: Number, default: 100 },
|
|
10
11
|
step: { type: Number, default: 1 },
|
|
11
|
-
modelValue: { type: Number, default: 0 },
|
|
12
12
|
showValue: { type: Boolean, default: true },
|
|
13
13
|
},
|
|
14
|
-
emits: ['
|
|
14
|
+
emits: ['update:modelValue', 'change'],
|
|
15
15
|
setup(props, { emit }) {
|
|
16
16
|
const container = ref<HTMLDivElement>()
|
|
17
17
|
let instance: InstanceType<typeof MkSliderClass> | null = null
|
|
@@ -25,14 +25,32 @@ export const MkSlider = defineComponent({
|
|
|
25
25
|
value: props.modelValue,
|
|
26
26
|
showValue: props.showValue,
|
|
27
27
|
onChange: (v) => {
|
|
28
|
-
emit('change', v)
|
|
29
28
|
emit('update:modelValue', v)
|
|
29
|
+
emit('change', v)
|
|
30
30
|
},
|
|
31
31
|
})
|
|
32
32
|
})
|
|
33
33
|
|
|
34
34
|
watch(() => props.modelValue, (v) => {
|
|
35
|
-
if (instance
|
|
35
|
+
if (instance && instance.value !== v) {
|
|
36
|
+
instance.value = v
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
watch(() => [props.min, props.max, props.step], () => {
|
|
41
|
+
if (!container.value) return
|
|
42
|
+
instance?.destroy()
|
|
43
|
+
instance = new MkSliderClass(container.value, {
|
|
44
|
+
min: props.min,
|
|
45
|
+
max: props.max,
|
|
46
|
+
step: props.step,
|
|
47
|
+
value: props.modelValue,
|
|
48
|
+
showValue: props.showValue,
|
|
49
|
+
onChange: (v) => {
|
|
50
|
+
emit('update:modelValue', v)
|
|
51
|
+
emit('change', v)
|
|
52
|
+
},
|
|
53
|
+
})
|
|
36
54
|
})
|
|
37
55
|
|
|
38
56
|
onUnmounted(() => instance?.destroy())
|
package/src/vue/switch.ts
CHANGED
|
@@ -5,11 +5,13 @@ import type { SwitchOptions } from '../components/switch/switch.js'
|
|
|
5
5
|
export const MkSwitch = defineComponent({
|
|
6
6
|
name: 'MkSwitch',
|
|
7
7
|
props: {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
modelValue: { type: Boolean, default: false },
|
|
9
|
+
disabled: { type: Boolean, default: false },
|
|
10
|
+
activeText: { type: String, default: '' },
|
|
11
|
+
inactiveText: { type: String, default: '' },
|
|
10
12
|
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit
|
|
13
|
+
emits: ['update:modelValue', 'change'],
|
|
14
|
+
setup(props, { emit }) {
|
|
13
15
|
const container = ref<HTMLDivElement>()
|
|
14
16
|
let instance: ReturnType<typeof createSwitch> | null = null
|
|
15
17
|
|
|
@@ -17,16 +19,21 @@ export const MkSwitch = defineComponent({
|
|
|
17
19
|
if (!container.value) return
|
|
18
20
|
instance?.destroy()
|
|
19
21
|
instance = createSwitch(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
value: props.modelValue,
|
|
23
|
+
disabled: props.disabled,
|
|
24
|
+
activeText: props.activeText,
|
|
25
|
+
inactiveText: props.inactiveText,
|
|
26
|
+
onChange: (v) => {
|
|
27
|
+
emit('update:modelValue', v)
|
|
28
|
+
emit('change', v)
|
|
29
|
+
},
|
|
23
30
|
})
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
onMounted(create)
|
|
27
|
-
|
|
34
|
+
watch(() => [props.modelValue, props.disabled, props.activeText, props.inactiveText], create, { deep: true })
|
|
28
35
|
onUnmounted(() => instance?.destroy())
|
|
29
36
|
|
|
30
|
-
return () => h('div', { ref: container })
|
|
37
|
+
return () => h('div', { ref: container, style: 'display:inline-block' })
|
|
31
38
|
},
|
|
32
39
|
})
|
package/src/vue/alert.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createAlert } from '../components/alert/alert.js'
|
|
3
|
-
import type { AlertOptions } from '../components/alert/alert.js'
|
|
4
|
-
|
|
5
|
-
export const MkAlert = defineComponent({
|
|
6
|
-
name: 'MkAlert',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createAlert> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createAlert(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
onUnmounted(() => instance?.destroy())
|
|
29
|
-
|
|
30
|
-
return () => h('div', { ref: container })
|
|
31
|
-
},
|
|
32
|
-
})
|
package/src/vue/avatar.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createAvatar } from '../components/avatar/avatar.js'
|
|
3
|
-
import type { AvatarOptions } from '../components/avatar/avatar.js'
|
|
4
|
-
|
|
5
|
-
export const MkAvatar = defineComponent({
|
|
6
|
-
name: 'MkAvatar',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createAvatar> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createAvatar(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.src, (v) => instance?.setSrc(v))
|
|
29
|
-
watch(() => props.text, (v) => instance?.setText(v))
|
|
30
|
-
onUnmounted(() => instance?.destroy())
|
|
31
|
-
|
|
32
|
-
return () => h('div', { ref: container })
|
|
33
|
-
},
|
|
34
|
-
})
|
package/src/vue/breadcrumb.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createBreadcrumb } from '../components/breadcrumb/breadcrumb.js'
|
|
3
|
-
import type { BreadcrumbOptions } from '../components/breadcrumb/breadcrumb.js'
|
|
4
|
-
|
|
5
|
-
export const MkBreadcrumb = defineComponent({
|
|
6
|
-
name: 'MkBreadcrumb',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createBreadcrumb> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createBreadcrumb(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
onUnmounted(() => instance?.destroy())
|
|
29
|
-
|
|
30
|
-
return () => h('div', { ref: container })
|
|
31
|
-
},
|
|
32
|
-
})
|
package/src/vue/checkbox.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createCheckbox } from '../components/form/checkbox.js'
|
|
3
|
-
import type { CheckboxOptions } from '../components/form/checkbox.js'
|
|
4
|
-
|
|
5
|
-
export const MkCheckbox = defineComponent({
|
|
6
|
-
name: 'MkCheckbox',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createCheckbox> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createCheckbox(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
onUnmounted(() => instance?.destroy())
|
|
29
|
-
|
|
30
|
-
return () => h('div', { ref: container })
|
|
31
|
-
},
|
|
32
|
-
})
|
package/src/vue/collapse.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createCollapse } from '../components/collapse/collapse.js'
|
|
3
|
-
import type { CollapsePanelOptions } from '../components/collapse/collapse.js'
|
|
4
|
-
|
|
5
|
-
export const MkCollapse = defineComponent({
|
|
6
|
-
name: 'MkCollapse',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createCollapse> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createCollapse(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.activeKeys, (v) => instance?.setActiveKeys(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|
package/src/vue/divider.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createDivider } from '../components/layout/divider.js'
|
|
3
|
-
import type { DividerOptions } from '../components/layout/divider.js'
|
|
4
|
-
|
|
5
|
-
export const MkDivider = defineComponent({
|
|
6
|
-
name: 'MkDivider',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createDivider> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createDivider(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
onUnmounted(() => instance?.destroy())
|
|
29
|
-
|
|
30
|
-
return () => h('div', { ref: container })
|
|
31
|
-
},
|
|
32
|
-
})
|
package/src/vue/drawer.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createDrawer } from '../components/drawer/drawer.js'
|
|
3
|
-
import type { DrawerOptions } from '../components/drawer/drawer.js'
|
|
4
|
-
|
|
5
|
-
export const MkDrawer = defineComponent({
|
|
6
|
-
name: 'MkDrawer',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createDrawer> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createDrawer(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.timeout, (v) => instance?.setTimeout(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|
package/src/vue/empty.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createEmpty } from '../components/empty/empty.js'
|
|
3
|
-
import type { EmptyOptions } from '../components/empty/empty.js'
|
|
4
|
-
|
|
5
|
-
export const MkEmpty = defineComponent({
|
|
6
|
-
name: 'MkEmpty',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createEmpty> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createEmpty(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.description, (v) => instance?.setDescription(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|
package/src/vue/menu.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createMenu } from '../components/menu/menu.js'
|
|
3
|
-
import type { MenuOptions } from '../components/menu/menu.js'
|
|
4
|
-
|
|
5
|
-
export const MkMenu = defineComponent({
|
|
6
|
-
name: 'MkMenu',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createMenu> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createMenu(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.upKeyboard, (v) => instance?.setupKeyboard(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|
package/src/vue/popover.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createPopover } from '../components/popover/popover.js'
|
|
3
|
-
import type { PopoverOptions } from '../components/popover/popover.js'
|
|
4
|
-
|
|
5
|
-
export const MkPopover = defineComponent({
|
|
6
|
-
name: 'MkPopover',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createPopover> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createPopover(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.timeout, (v) => instance?.setTimeout(v))
|
|
29
|
-
watch(() => props.content, (v) => instance?.setContent(v))
|
|
30
|
-
onUnmounted(() => instance?.destroy())
|
|
31
|
-
|
|
32
|
-
return () => h('div', { ref: container })
|
|
33
|
-
},
|
|
34
|
-
})
|
package/src/vue/progress.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createProgress } from '../components/progress/progress.js'
|
|
3
|
-
import type { ProgressOptions } from '../components/progress/progress.js'
|
|
4
|
-
|
|
5
|
-
export const MkProgress = defineComponent({
|
|
6
|
-
name: 'MkProgress',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createProgress> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createProgress(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.percent, (v) => instance?.setPercent(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|