@luanlu/mk-motion 1.1.0 → 1.2.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.
- package/package.json +16 -2
- package/src/nuxt/module.ts +46 -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luanlu/mk-motion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A lightweight, modern frontend animation library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/mk-motion.umd.cjs",
|
|
@@ -23,11 +23,25 @@
|
|
|
23
23
|
"types": "./src/vue/index.ts",
|
|
24
24
|
"default": "./src/vue/index.ts"
|
|
25
25
|
}
|
|
26
|
+
},
|
|
27
|
+
"./nuxt": {
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./src/nuxt/module.ts",
|
|
30
|
+
"default": "./src/nuxt/module.ts"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"./vite": {
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./src/vite/plugin.ts",
|
|
36
|
+
"default": "./src/vite/plugin.ts"
|
|
37
|
+
}
|
|
26
38
|
}
|
|
27
39
|
},
|
|
28
40
|
"files": [
|
|
29
41
|
"dist",
|
|
30
|
-
"src/vue"
|
|
42
|
+
"src/vue",
|
|
43
|
+
"src/nuxt",
|
|
44
|
+
"src/vite"
|
|
31
45
|
],
|
|
32
46
|
"publishConfig": {
|
|
33
47
|
"access": "public"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { defineNuxtModule, addComponent, addImportsDir, createResolver } from '@nuxt/kit'
|
|
2
|
+
|
|
3
|
+
export interface ModuleOptions {
|
|
4
|
+
prefix?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default defineNuxtModule<ModuleOptions>({
|
|
8
|
+
meta: {
|
|
9
|
+
name: 'mk-motion',
|
|
10
|
+
configKey: 'mkMotion',
|
|
11
|
+
compatibility: {
|
|
12
|
+
nuxt: '^3.0.0',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaults: {
|
|
16
|
+
prefix: 'Mk',
|
|
17
|
+
},
|
|
18
|
+
setup(options, nuxt) {
|
|
19
|
+
const resolver = createResolver(import.meta.url)
|
|
20
|
+
const runtimeDir = resolver.resolve('./runtime')
|
|
21
|
+
|
|
22
|
+
// Auto-import components from src/vue/
|
|
23
|
+
const components = [
|
|
24
|
+
'Button',
|
|
25
|
+
'Card',
|
|
26
|
+
'Dialog',
|
|
27
|
+
'Input',
|
|
28
|
+
'Radio',
|
|
29
|
+
'Slider',
|
|
30
|
+
'Switch',
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
for (const name of components) {
|
|
34
|
+
addComponent({
|
|
35
|
+
name: `${options.prefix}${name}`,
|
|
36
|
+
filePath: resolver.resolve('../../vue', `${name.toLowerCase()}.ts`),
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Auto-import composables
|
|
41
|
+
addImportsDir(resolver.resolve('../../vue/composables'))
|
|
42
|
+
|
|
43
|
+
// Inject CSS
|
|
44
|
+
nuxt.options.css.push('@luanlu/mk-motion/css')
|
|
45
|
+
},
|
|
46
|
+
})
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Plugin } from 'vite'
|
|
2
|
+
|
|
3
|
+
export interface MkMotionOptions {
|
|
4
|
+
components?: string[]
|
|
5
|
+
motion?: boolean
|
|
6
|
+
theme?: 'dark' | 'light' | 'auto'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function mkMotion(options: MkMotionOptions = {}): Plugin {
|
|
10
|
+
const components = options.components || [
|
|
11
|
+
'Button', 'Card', 'Dialog', 'Input', 'Radio', 'Slider', 'Switch',
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
const cssImports: string[] = []
|
|
15
|
+
if (options.theme === 'dark') {
|
|
16
|
+
cssImports.push(`import '@luanlu/mk-motion/css'`)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
name: 'mk-motion',
|
|
21
|
+
enforce: 'pre',
|
|
22
|
+
transform(code, id) {
|
|
23
|
+
// Only process Vue SFC script blocks
|
|
24
|
+
if (!id.endsWith('.vue')) return code
|
|
25
|
+
|
|
26
|
+
// If component is used but not imported, add auto-import
|
|
27
|
+
const used = components.filter((name) => {
|
|
28
|
+
const tag = `Mk${name}`
|
|
29
|
+
return code.includes(`<${tag}`) || code.includes(`<${tag} `)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
if (used.length === 0) return code
|
|
33
|
+
|
|
34
|
+
const imports = used
|
|
35
|
+
.map((name) => `import { Mk${name} } from '@luanlu/mk-motion/vue'`)
|
|
36
|
+
.join('\n')
|
|
37
|
+
|
|
38
|
+
if (code.includes('import { ' + used.map((n) => `Mk${n}`).join(', ') + ' }')) {
|
|
39
|
+
return code
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return imports + '\n' + code
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/vue/button.ts
CHANGED
|
@@ -5,31 +5,50 @@ import type { ButtonOptions } from '../components/button/button.js'
|
|
|
5
5
|
export const MkButton = defineComponent({
|
|
6
6
|
name: 'MkButton',
|
|
7
7
|
props: {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type: { type: String as () => ButtonOptions['type'], default: 'default' },
|
|
9
|
+
size: { type: String as () => ButtonOptions['size'], default: 'default' },
|
|
10
|
+
plain: { type: Boolean, default: false },
|
|
11
|
+
round: { type: Boolean, default: false },
|
|
12
|
+
circle: { type: Boolean, default: false },
|
|
13
|
+
disabled: { type: Boolean, default: false },
|
|
14
|
+
loading: { type: Boolean, default: false },
|
|
15
|
+
icon: { type: String, default: '' },
|
|
16
|
+
motion: { type: Object as () => ButtonOptions['motion'], default: undefined },
|
|
10
17
|
},
|
|
11
|
-
|
|
18
|
+
emits: ['click'],
|
|
12
19
|
setup(props, { emit, slots }) {
|
|
13
20
|
const container = ref<HTMLDivElement>()
|
|
14
21
|
let instance: ReturnType<typeof createButton> | null = null
|
|
15
22
|
|
|
23
|
+
const getText = () => {
|
|
24
|
+
const slotContent = slots.default?.()[0]?.children
|
|
25
|
+
return (typeof slotContent === 'string' ? slotContent : '') || ''
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
const create = () => {
|
|
17
29
|
if (!container.value) return
|
|
18
30
|
instance?.destroy()
|
|
19
31
|
instance = createButton(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
32
|
+
type: props.type,
|
|
33
|
+
size: props.size,
|
|
34
|
+
plain: props.plain,
|
|
35
|
+
round: props.round,
|
|
36
|
+
circle: props.circle,
|
|
37
|
+
disabled: props.disabled,
|
|
38
|
+
loading: props.loading,
|
|
39
|
+
text: getText(),
|
|
40
|
+
icon: props.icon || undefined,
|
|
41
|
+
motion: props.motion,
|
|
42
|
+
onClick: (e) => emit('click', e),
|
|
23
43
|
})
|
|
24
44
|
}
|
|
25
45
|
|
|
26
46
|
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.timeout, (v) => instance?.setTimeout(v))
|
|
47
|
+
watch(() => [props.type, props.size, props.plain, props.round, props.circle, props.icon, props.motion], create, { deep: true })
|
|
29
48
|
watch(() => props.loading, (v) => instance?.setLoading(v))
|
|
30
49
|
watch(() => props.disabled, (v) => instance?.setDisabled(v))
|
|
31
50
|
onUnmounted(() => instance?.destroy())
|
|
32
51
|
|
|
33
|
-
return () => h('div', { ref: container })
|
|
52
|
+
return () => h('div', { ref: container, style: 'display:inline-block' })
|
|
34
53
|
},
|
|
35
54
|
})
|
package/src/vue/card.ts
CHANGED
|
@@ -5,26 +5,46 @@ import type { CardOptions } from '../components/card/card.js'
|
|
|
5
5
|
export const MkCard = defineComponent({
|
|
6
6
|
name: 'MkCard',
|
|
7
7
|
props: {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
shadow: { type: String as () => CardOptions['shadow'], default: undefined },
|
|
9
|
+
loading: { type: Boolean, default: false },
|
|
10
|
+
image: { type: String, default: '' },
|
|
11
|
+
motion: { type: Object as () => CardOptions['motion'], default: undefined },
|
|
10
12
|
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
+
setup(props, { slots }) {
|
|
13
14
|
const container = ref<HTMLDivElement>()
|
|
14
15
|
let instance: ReturnType<typeof createCard> | null = null
|
|
15
16
|
|
|
17
|
+
const getTitle = () => {
|
|
18
|
+
const slot = slots.header?.()[0]?.children
|
|
19
|
+
return typeof slot === 'string' ? slot : ''
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const getBody = () => {
|
|
23
|
+
const slot = slots.default?.()[0]?.children
|
|
24
|
+
return typeof slot === 'string' ? slot : ''
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const getFooter = () => {
|
|
28
|
+
const slot = slots.footer?.()[0]?.children
|
|
29
|
+
return typeof slot === 'string' ? slot : ''
|
|
30
|
+
}
|
|
31
|
+
|
|
16
32
|
const create = () => {
|
|
17
33
|
if (!container.value) return
|
|
18
34
|
instance?.destroy()
|
|
19
35
|
instance = createCard(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
title: getTitle(),
|
|
37
|
+
body: getBody(),
|
|
38
|
+
footer: getFooter(),
|
|
39
|
+
image: props.image || undefined,
|
|
40
|
+
shadow: props.shadow,
|
|
41
|
+
loading: props.loading,
|
|
42
|
+
motion: props.motion,
|
|
23
43
|
})
|
|
24
44
|
}
|
|
25
45
|
|
|
26
46
|
onMounted(create)
|
|
27
|
-
|
|
47
|
+
watch(() => [props.shadow, props.image, props.loading, props.motion], create, { deep: true })
|
|
28
48
|
watch(() => props.loading, (v) => instance?.setLoading(v))
|
|
29
49
|
onUnmounted(() => instance?.destroy())
|
|
30
50
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
showLoading,
|
|
3
|
+
showFullscreenLoading,
|
|
4
|
+
} from '../../components/loading/loading.js'
|
|
5
|
+
import type { LoadingOptions } from '../../components/loading/loading.js'
|
|
6
|
+
|
|
7
|
+
export function useMkLoading() {
|
|
8
|
+
return {
|
|
9
|
+
showLoading: (options?: LoadingOptions) => showLoading(options),
|
|
10
|
+
showFullscreenLoading: (text?: string) => showFullscreenLoading(text),
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
message,
|
|
3
|
+
messageSuccess,
|
|
4
|
+
messageError,
|
|
5
|
+
messageWarning,
|
|
6
|
+
} from '../../components/message/message.js'
|
|
7
|
+
import type { MessageOptions } from '../../components/message/message.js'
|
|
8
|
+
|
|
9
|
+
export function useMkMessage() {
|
|
10
|
+
return {
|
|
11
|
+
message: (msg: string, options?: MessageOptions) => message(msg, options),
|
|
12
|
+
messageSuccess: (msg: string, options?: Omit<MessageOptions, 'type'>) => messageSuccess(msg, options),
|
|
13
|
+
messageError: (msg: string, options?: Omit<MessageOptions, 'type'>) => messageError(msg, options),
|
|
14
|
+
messageWarning: (msg: string, options?: Omit<MessageOptions, 'type'>) => messageWarning(msg, options),
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { onMounted, onUnmounted } from 'vue'
|
|
2
|
+
import type { Ref } from 'vue'
|
|
3
|
+
import { Animator } from '../../core/animator.js'
|
|
4
|
+
import type { MotionOptions } from '../../motion/component-motion.js'
|
|
5
|
+
|
|
6
|
+
export function useMkMotion(elRef: Ref<HTMLElement | undefined>, _options?: MotionOptions) {
|
|
7
|
+
let animator: Animator | null = null
|
|
8
|
+
onMounted(() => {
|
|
9
|
+
if (!elRef.value) return
|
|
10
|
+
animator = new Animator(elRef.value)
|
|
11
|
+
})
|
|
12
|
+
onUnmounted(() => {
|
|
13
|
+
animator?.reset()
|
|
14
|
+
})
|
|
15
|
+
return {
|
|
16
|
+
animate: (name: string, opts?: any) => animator?.animate(name, opts),
|
|
17
|
+
reset: () => animator?.reset(),
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
const isDark = ref(false)
|
|
4
|
+
|
|
5
|
+
export function useMkTheme() {
|
|
6
|
+
const setTheme = (dark: boolean) => {
|
|
7
|
+
isDark.value = dark
|
|
8
|
+
document.documentElement.setAttribute('data-mk-theme', dark ? 'dark' : 'light')
|
|
9
|
+
}
|
|
10
|
+
const toggle = () => setTheme(!isDark.value)
|
|
11
|
+
return { isDark, setTheme, toggle }
|
|
12
|
+
}
|
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
|
-
})
|
package/src/vue/row.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createRow } from '../components/layout/row.js'
|
|
3
|
-
import type { RowOptions } from '../components/layout/row.js'
|
|
4
|
-
|
|
5
|
-
export const MkRow = defineComponent({
|
|
6
|
-
name: 'MkRow',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createRow> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createRow(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/select.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createSelect } from '../components/form/select.js'
|
|
3
|
-
import type { SelectOptions } from '../components/form/select.js'
|
|
4
|
-
|
|
5
|
-
export const MkSelect = defineComponent({
|
|
6
|
-
name: 'MkSelect',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createSelect> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createSelect(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.value, (v) => instance?.setValue(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|
package/src/vue/space.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createSpace } from '../components/layout/space.js'
|
|
3
|
-
import type { SpaceOptions } from '../components/layout/space.js'
|
|
4
|
-
|
|
5
|
-
export const MkSpace = defineComponent({
|
|
6
|
-
name: 'MkSpace',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createSpace> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createSpace(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/steps.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createSteps } from '../components/steps/steps.js'
|
|
3
|
-
import type { StepsOptions } from '../components/steps/steps.js'
|
|
4
|
-
|
|
5
|
-
export const MkSteps = defineComponent({
|
|
6
|
-
name: 'MkSteps',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createSteps> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createSteps(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.current, (v) => instance?.setCurrent(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|
package/src/vue/table.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createTable } from '../components/table/table.js'
|
|
3
|
-
import type { TableOptions } from '../components/table/table.js'
|
|
4
|
-
|
|
5
|
-
export const MkTable = defineComponent({
|
|
6
|
-
name: 'MkTable',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createTable> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createTable(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.data, (v) => instance?.setData(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|
package/src/vue/tabs.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createTabs } from '../components/tabs/tabs.js'
|
|
3
|
-
import type { TabsOptions } from '../components/tabs/tabs.js'
|
|
4
|
-
|
|
5
|
-
export const MkTabs = defineComponent({
|
|
6
|
-
name: 'MkTabs',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createTabs> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createTabs(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.active, (v) => instance?.setActive(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|
package/src/vue/tag.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createTag } from '../components/tag/tag.js'
|
|
3
|
-
import type { TagOptions } from '../components/tag/tag.js'
|
|
4
|
-
|
|
5
|
-
export const MkTag = defineComponent({
|
|
6
|
-
name: 'MkTag',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createTag> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createTag(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.text, (v) => instance?.setText(v))
|
|
29
|
-
onUnmounted(() => instance?.destroy())
|
|
30
|
-
|
|
31
|
-
return () => h('div', { ref: container })
|
|
32
|
-
},
|
|
33
|
-
})
|
package/src/vue/tooltip.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { defineComponent, h, ref, onMounted, onUnmounted, watch } from 'vue'
|
|
2
|
-
import { createTooltip } from '../components/tooltip/tooltip.js'
|
|
3
|
-
import type { TooltipOptions } from '../components/tooltip/tooltip.js'
|
|
4
|
-
|
|
5
|
-
export const MkTooltip = defineComponent({
|
|
6
|
-
name: 'MkTooltip',
|
|
7
|
-
props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
setup(props, { emit, slots }) {
|
|
13
|
-
const container = ref<HTMLDivElement>()
|
|
14
|
-
let instance: ReturnType<typeof createTooltip> | null = null
|
|
15
|
-
|
|
16
|
-
const create = () => {
|
|
17
|
-
if (!container.value) return
|
|
18
|
-
instance?.destroy()
|
|
19
|
-
instance = createTooltip(container.value, {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
onMounted(create)
|
|
27
|
-
|
|
28
|
-
watch(() => props.tooltipContent, (v) => instance?.setTooltipContent(v))
|
|
29
|
-
watch(() => props.timeout, (v) => instance?.setTimeout(v))
|
|
30
|
-
onUnmounted(() => instance?.destroy())
|
|
31
|
-
|
|
32
|
-
return () => h('div', { ref: container })
|
|
33
|
-
},
|
|
34
|
-
})
|