@vyr/design 0.0.33 → 0.0.35
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 +8 -3
- package/src/components/Card.vue +8 -66
- package/src/components/Dialog.vue +0 -1
- package/src/components/DynamicDialog.vue +8 -4
- package/src/components/DynamicLayouter.vue +1 -1
- package/src/components/Input.vue +12 -10
- package/src/components/Notify.vue +2 -2
- package/src/components/Popover.vue +3 -2
- package/src/components/Scroll.vue +4 -2
- package/src/components/common/ResizeListener.ts +1 -1
- package/src/components/composables/useScroll.ts +3 -2
- package/src/components/composables/useTimer.ts +1 -1
- package/src/components/singleton/confirm.ts +9 -2
- package/src/components/utils/Confirm.ts +2 -0
- package/src/components/utils/DynamicDialog.ts +4 -0
- package/src/font/demo_index.html +59 -82
- package/src/font/iconfont.css +15 -19
- package/src/font/iconfont.js +1 -1
- package/src/font/iconfont.json +24 -31
- package/src/font/iconfont.ttf +0 -0
- package/src/font/iconfont.woff +0 -0
- package/src/font/iconfont.woff2 +0 -0
- package/src/index.ts +4 -2
- package/src/theme/ThemeService.ts +55 -0
- package/src/theme/index.ts +10 -2
- package/src/tool/copy.ts +24 -0
- package/src/tool/index.ts +2 -1
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyr/design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"main": "./src/index.ts",
|
|
5
5
|
"dependencies": {
|
|
6
|
+
"devui-theme": "^0.1.0",
|
|
7
|
+
"async-validator": "4.2.5",
|
|
6
8
|
"@popperjs/core": "2.11.7",
|
|
7
|
-
"ag-grid-community": "
|
|
8
|
-
"ag-grid-vue3": "
|
|
9
|
+
"ag-grid-community": "35.0.0",
|
|
10
|
+
"ag-grid-vue3": "35.0.0",
|
|
9
11
|
"tinycolor2": "1.6.0",
|
|
10
12
|
"vue": "3.5.22"
|
|
11
13
|
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"sass": "^1.32.0"
|
|
16
|
+
},
|
|
12
17
|
"files": [
|
|
13
18
|
"package.json",
|
|
14
19
|
"src/"
|
package/src/components/Card.vue
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="vyr-card"
|
|
3
|
-
<div class="card-header" :class="{ 'handle': arrow }"
|
|
2
|
+
<div class="vyr-card">
|
|
3
|
+
<div class="card-header" :class="{ 'handle': arrow }">
|
|
4
4
|
<div class="header-title">
|
|
5
5
|
<slot v-if="$slots.title" name="title"></slot>
|
|
6
6
|
<div v-else class="title-text">
|
|
7
7
|
{{ title }}
|
|
8
8
|
</div>
|
|
9
9
|
</div>
|
|
10
|
-
<div class="header-icon"
|
|
10
|
+
<div class="header-icon">
|
|
11
11
|
<slot name="icon">
|
|
12
12
|
<i v-if="arrow" class="vyrfont vyr-arrow-down-bold"></i>
|
|
13
13
|
</slot>
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
16
|
-
<div class="card-body"
|
|
16
|
+
<div class="card-body" ref="refBody">
|
|
17
17
|
<template v-if="scroll">
|
|
18
18
|
<vyr-scroll :margin="8" :padding="8">
|
|
19
19
|
<slot></slot>
|
|
20
20
|
</vyr-scroll>
|
|
21
21
|
</template>
|
|
22
|
-
<
|
|
23
|
-
<div class="body-wrapper" ref="refWrapper">
|
|
24
|
-
<slot></slot>
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
22
|
+
<slot v-else></slot>
|
|
27
23
|
</div>
|
|
28
24
|
<div class="card-tool" v-if="$slots.tool">
|
|
29
25
|
<slot name="tool"></slot>
|
|
@@ -42,52 +38,6 @@ const props = defineProps({
|
|
|
42
38
|
scroll: { default: false }
|
|
43
39
|
})
|
|
44
40
|
|
|
45
|
-
const refBody = useTemplateRef('refBody')
|
|
46
|
-
const refWrapper = useTemplateRef('refWrapper')
|
|
47
|
-
const state = ref({
|
|
48
|
-
visible: true,
|
|
49
|
-
style: '',
|
|
50
|
-
showing: false,
|
|
51
|
-
})
|
|
52
|
-
const showBodyEnd = () => {
|
|
53
|
-
state.value.showing = false
|
|
54
|
-
state.value.style = ''
|
|
55
|
-
}
|
|
56
|
-
const showBody = () => {
|
|
57
|
-
if (!refWrapper.value) return
|
|
58
|
-
let height = refWrapper.value.clientHeight
|
|
59
|
-
state.value.style = `height:${height}px;overflow:hidden;`
|
|
60
|
-
setTimeout(showBodyEnd, Theme.config.animationTime.value)
|
|
61
|
-
}
|
|
62
|
-
const hideBodyEnd = () => {
|
|
63
|
-
state.value.showing = false
|
|
64
|
-
state.value.style = 'display:none;'
|
|
65
|
-
}
|
|
66
|
-
const hideBody = () => {
|
|
67
|
-
if (!refBody.value) return
|
|
68
|
-
state.value.style = `height:${refBody.value.clientHeight}px;overflow:hidden;`
|
|
69
|
-
requestAnimationFrame(() => state.value.style = `height:0px;overflow:hidden;`)
|
|
70
|
-
setTimeout(hideBodyEnd, Theme.config.animationTime.value)
|
|
71
|
-
}
|
|
72
|
-
const watchVisible = () => {
|
|
73
|
-
state.value.showing = true
|
|
74
|
-
if (state.value.visible === true) {
|
|
75
|
-
state.value.style = 'height:0px;overflow:hidden;'
|
|
76
|
-
requestAnimationFrame(showBody)
|
|
77
|
-
} else {
|
|
78
|
-
hideBody()
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
watch(() => state.value.visible, watchVisible)
|
|
82
|
-
|
|
83
|
-
const style = computed(() => {
|
|
84
|
-
return props.scroll ? 'height:100%;' : ''
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
const changeVisible = () => {
|
|
88
|
-
if (props.arrow === false || state.value.showing === true) return
|
|
89
|
-
state.value.visible = !state.value.visible
|
|
90
|
-
}
|
|
91
41
|
</script>
|
|
92
42
|
|
|
93
43
|
<style lang="less" scoped>
|
|
@@ -99,6 +49,7 @@ const changeVisible = () => {
|
|
|
99
49
|
.vyr-card {
|
|
100
50
|
.vyr-font-family;
|
|
101
51
|
width: 100%;
|
|
52
|
+
height: 100%;
|
|
102
53
|
font-size: var(--vyr-font-size);
|
|
103
54
|
color: var(--vyr-font-color);
|
|
104
55
|
border: 1px solid var(--vyr-border-color);
|
|
@@ -154,16 +105,12 @@ const changeVisible = () => {
|
|
|
154
105
|
color: var(--vyr-helper-color);
|
|
155
106
|
}
|
|
156
107
|
}
|
|
157
|
-
|
|
158
|
-
.header-icon.expand {
|
|
159
|
-
.vyrfont {
|
|
160
|
-
transform: rotate(-180deg);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
108
|
}
|
|
164
109
|
|
|
165
110
|
.card-body {
|
|
166
111
|
width: 100%;
|
|
112
|
+
height: 100%;
|
|
113
|
+
overflow: hidden;
|
|
167
114
|
box-sizing: border-box;
|
|
168
115
|
background-color: var(--vyr-topic-color);
|
|
169
116
|
border-top: var(--vyr-border-size) solid var(--vyr-border-color);
|
|
@@ -177,11 +124,6 @@ const changeVisible = () => {
|
|
|
177
124
|
}
|
|
178
125
|
}
|
|
179
126
|
|
|
180
|
-
.card-body.scroll {
|
|
181
|
-
height: 100%;
|
|
182
|
-
overflow: hidden;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
127
|
.card-tool {
|
|
186
128
|
border-top: var(--vyr-border-size) solid var(--vyr-border-color);
|
|
187
129
|
padding: @card-pad-size;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<vyr-dialog v-model="state.visible" :mask="state.mask" :draggable="true" :width="state.width"
|
|
2
|
+
<vyr-dialog v-model="state.visible" :mask="state.mask" :draggable="true" :width="state.width" :height="state.height"
|
|
3
3
|
:maxHeight="state.maxHeight" @close="close">
|
|
4
4
|
<template #title>
|
|
5
5
|
<template v-if="state.type === 'warning'">
|
|
6
6
|
<i class="vyrfont vyr-warning tips-type"></i>
|
|
7
7
|
</template>{{ state.title }}
|
|
8
8
|
</template>
|
|
9
|
-
<template v-if="state.component">
|
|
9
|
+
<template #[slotName] v-if="state.component">
|
|
10
10
|
<component :is="state.component" v-bind="state.props"></component>
|
|
11
11
|
</template>
|
|
12
|
-
<template v-else>
|
|
12
|
+
<template #[slotName] v-else>
|
|
13
13
|
<vyr-form>
|
|
14
14
|
<div class="dynamic-item" v-for="(option, i) in state.options" :key="i">
|
|
15
15
|
<div class="item-label">{{ option.label }}</div>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
48
|
<script setup lang="ts">
|
|
49
|
-
import { ref } from 'vue';
|
|
49
|
+
import { computed, ref } from 'vue';
|
|
50
50
|
import { DialogOptions, useDialogState } from './utils';
|
|
51
51
|
import { language } from '../locale'
|
|
52
52
|
import VyrDialog from './Dialog.vue';
|
|
@@ -68,6 +68,10 @@ const privateState = ref({
|
|
|
68
68
|
flag: false,
|
|
69
69
|
})
|
|
70
70
|
|
|
71
|
+
const slotName = computed(() => {
|
|
72
|
+
return state.value.scroll === true ? 'default' : 'scroll'
|
|
73
|
+
})
|
|
74
|
+
|
|
71
75
|
const currentData = (option: DialogOptions[number]) => {
|
|
72
76
|
if (option.componentData === undefined) return []
|
|
73
77
|
return Array.isArray(option.componentData) ? option.componentData : option.componentData(privateState.value.data)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<slot></slot>
|
|
5
5
|
</div>
|
|
6
6
|
<div class="dynamic-sidebar" :style="sidebarStyle">
|
|
7
|
-
<div :class="`vyr-${mode}-bar ${state.enable ? 'enable' : ''}`" @mousedown.
|
|
7
|
+
<div :class="`vyr-${mode}-bar ${state.enable ? 'enable' : ''}`" @mousedown.prevent="start"></div>
|
|
8
8
|
<slot name="sidebar"></slot>
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
package/src/components/Input.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="vyr-input" :class="{ 'clearable': curClearable, 'icon': $slots.icon }" :style="`width:${curInputWidth};`"
|
|
3
3
|
@click="e => emit('click', e)" @mouseenter="mouseenter" @mouseleave="mouseleave" @mouseup="mouseup">
|
|
4
|
-
<input ref="refInput" class="input-wrapper"
|
|
4
|
+
<input ref="refInput" class="input-wrapper" v-focus="curReadonly ? false : autofocus"
|
|
5
5
|
:class="{ 'readonly': curReadonly, 'icon': curClearable, 'draggable': drag.draggable }" :type="type"
|
|
6
6
|
:placeholder="placeholder" :value="currentValue" :readonly="curReadonly" @input="inputValue" @focus="focus"
|
|
7
7
|
@blur="blurValue" @compositionstart="compositionstart" @compositionend="compositionend" />
|
|
@@ -58,10 +58,11 @@ const compositionend = (e: CompositionEvent) => {
|
|
|
58
58
|
inputValue()
|
|
59
59
|
}
|
|
60
60
|
const focus = () => {
|
|
61
|
-
if (curReadonly.value ===
|
|
62
|
-
|
|
61
|
+
if (curReadonly.value === false) {
|
|
62
|
+
emit('focus')
|
|
63
|
+
isFocus.value = true
|
|
64
|
+
}
|
|
63
65
|
window.addEventListener('keydown', confirm)
|
|
64
|
-
isFocus.value = true
|
|
65
66
|
}
|
|
66
67
|
const inputValue = () => {
|
|
67
68
|
if (composition.value === true) return
|
|
@@ -72,12 +73,13 @@ const inputValue = () => {
|
|
|
72
73
|
const validateProvider = useValidateItemProvider()
|
|
73
74
|
const blurValue = () => {
|
|
74
75
|
composition.value = false
|
|
75
|
-
if (curReadonly.value ===
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
if (curReadonly.value === false) {
|
|
77
|
+
currentValue.value = refInput.value?.value ?? ''
|
|
78
|
+
if (props.trigger === 'blur') emit('update:modelValue', currentValue.value)
|
|
79
|
+
emit('blur', currentValue.value)
|
|
80
|
+
validateProvider.value.validate(currentValue.value)
|
|
81
|
+
isFocus.value = false
|
|
82
|
+
}
|
|
81
83
|
window.removeEventListener('keydown', confirm)
|
|
82
84
|
}
|
|
83
85
|
const clear = (e: MouseEvent) => {
|
|
@@ -28,7 +28,7 @@ const remove = () => {
|
|
|
28
28
|
ArrayUtils.remove(NotifySetting.collection.value, setting.value)
|
|
29
29
|
}
|
|
30
30
|
const close = () => {
|
|
31
|
-
setTimeout(remove, Theme.config.animationTime.value)
|
|
31
|
+
window.setTimeout(remove, Theme.config.animationTime.value)
|
|
32
32
|
setting.value.visible = false
|
|
33
33
|
}
|
|
34
34
|
const show = (set: NotifySetting) => {
|
|
@@ -38,7 +38,7 @@ const show = (set: NotifySetting) => {
|
|
|
38
38
|
setting.value.visible = true
|
|
39
39
|
|
|
40
40
|
if (set.duration === Infinity) return
|
|
41
|
-
setTimeout(close, set.duration)
|
|
41
|
+
window.setTimeout(close, set.duration)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
defineExpose<NotifyVue>({ show })
|
|
@@ -129,7 +129,7 @@ const delayShow = () => {
|
|
|
129
129
|
const delayDispatch = () => {
|
|
130
130
|
if (props.disabled === true || props.trigger !== 'hover' || state.value.needOpen === false) return
|
|
131
131
|
state.value.delayCount++
|
|
132
|
-
setTimeout(delayShow, 200)
|
|
132
|
+
window.setTimeout(delayShow, 200)
|
|
133
133
|
}
|
|
134
134
|
const mouseenter = () => {
|
|
135
135
|
if (props.disabled === true || props.trigger !== 'hover') return
|
|
@@ -146,7 +146,7 @@ const mouseleave = () => {
|
|
|
146
146
|
state.value.needOpen = false
|
|
147
147
|
if (state.value.needClose === true) return
|
|
148
148
|
state.value.needClose = true
|
|
149
|
-
setTimeout(close, 300)
|
|
149
|
+
window.setTimeout(close, 300)
|
|
150
150
|
}
|
|
151
151
|
const rightClick = () => {
|
|
152
152
|
state.value.needOpen = false
|
|
@@ -190,6 +190,7 @@ defineExpose(expose)
|
|
|
190
190
|
position: relative;
|
|
191
191
|
left: 0;
|
|
192
192
|
top: 0;
|
|
193
|
+
border-radius: var(--vyr-radius-size);
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
.popover-wrapper.flex {
|
|
@@ -22,7 +22,7 @@ import { language } from '../locale'
|
|
|
22
22
|
const props = defineProps(scrollCommonDefaultProps)
|
|
23
23
|
const { marginStyle, paddingStyle } = useMarginStyle(props)
|
|
24
24
|
|
|
25
|
-
const emit = defineEmits(['resize'])
|
|
25
|
+
const emit = defineEmits(['resize', 'wheel'])
|
|
26
26
|
const refWrapper = useTemplateRef('refWrapper')
|
|
27
27
|
const refBody = useTemplateRef('refBody')
|
|
28
28
|
const state = ref({
|
|
@@ -58,7 +58,9 @@ const unlisten = () => {
|
|
|
58
58
|
onMounted(listen)
|
|
59
59
|
onBeforeUnmount(unlisten)
|
|
60
60
|
|
|
61
|
-
const { opacity, layout, move, leave } = useScroll(computeTop, refWrapper as Ref<HTMLElement>)
|
|
61
|
+
const { opacity, layout, move, leave } = useScroll(computeTop, emit, refWrapper as Ref<HTMLElement>)
|
|
62
|
+
|
|
63
|
+
defineExpose({ wrapper: refWrapper })
|
|
62
64
|
</script>
|
|
63
65
|
|
|
64
66
|
<style lang="less" scoped>
|
|
@@ -16,7 +16,7 @@ class ResizeListener {
|
|
|
16
16
|
//防止回调形成无限循环
|
|
17
17
|
if (this.debounce === true) return
|
|
18
18
|
this.debounce = true
|
|
19
|
-
setTimeout(() => this.callback(entrys), 0)
|
|
19
|
+
window.setTimeout(() => this.callback(entrys), 0)
|
|
20
20
|
}
|
|
21
21
|
private callback = (entrys: ResizeObserverEntry[]) => {
|
|
22
22
|
this.debounce = false
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref, Ref } from "vue"
|
|
2
2
|
|
|
3
|
-
const useScroll = (computeTop: () => void, wrapper: Ref<HTMLElement>) => {
|
|
3
|
+
const useScroll = (computeTop: () => void, emit: (...arsg: any[]) => void, wrapper: Ref<HTMLElement>) => {
|
|
4
4
|
const scroll = {
|
|
5
5
|
tick: 0,
|
|
6
6
|
count: 0,
|
|
@@ -22,10 +22,11 @@ const useScroll = (computeTop: () => void, wrapper: Ref<HTMLElement>) => {
|
|
|
22
22
|
stop()
|
|
23
23
|
}
|
|
24
24
|
const layout = (e: WheelEvent) => {
|
|
25
|
+
emit('wheel', e)
|
|
25
26
|
if (scroll.stopWheel === true) e.preventDefault()
|
|
26
27
|
if (scroll.tick === 0) loop()
|
|
27
28
|
scroll.count++
|
|
28
|
-
setTimeout(delay, 300);
|
|
29
|
+
window.setTimeout(delay, 300);
|
|
29
30
|
}
|
|
30
31
|
const move = () => {
|
|
31
32
|
opacity.value = 0.75
|
|
@@ -6,13 +6,20 @@ const confirm = (config: Partial<Confirm> = {}) => {
|
|
|
6
6
|
const app = createApp(ConfirmVue)
|
|
7
7
|
|
|
8
8
|
const promise = new Promise<Confirm>((resolve) => {
|
|
9
|
-
|
|
9
|
+
let id = -1
|
|
10
|
+
const close = (success: boolean) => {
|
|
10
11
|
state.value.visible = false
|
|
11
12
|
app.unmount()
|
|
12
13
|
config.value = state.value.value
|
|
13
14
|
config.success = success
|
|
15
|
+
clearTimeout(id)
|
|
14
16
|
resolve(config as Confirm)
|
|
15
|
-
}
|
|
17
|
+
}
|
|
18
|
+
const state = getConfirmState(config, close)
|
|
19
|
+
|
|
20
|
+
if (state.value.timeout > 0) {
|
|
21
|
+
id = window.setTimeout(() => close(false), config.timeout)
|
|
22
|
+
}
|
|
16
23
|
|
|
17
24
|
app.provide(confirmKey, state)
|
|
18
25
|
app.mount(document.createElement('div'))
|
|
@@ -12,6 +12,7 @@ interface Confirm {
|
|
|
12
12
|
options: ConfirmOptions
|
|
13
13
|
mode: string
|
|
14
14
|
placeholder: string
|
|
15
|
+
timeout: number
|
|
15
16
|
success: boolean
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -27,6 +28,7 @@ const getConfirmState = (config: Partial<Confirm>, close = (state: boolean) => {
|
|
|
27
28
|
mode: config.mode,
|
|
28
29
|
value: config.value,
|
|
29
30
|
placeholder: config.placeholder,
|
|
31
|
+
timeout: config.timeout ?? 0,
|
|
30
32
|
success: false,
|
|
31
33
|
close
|
|
32
34
|
})
|
|
@@ -16,10 +16,12 @@ interface Dialog {
|
|
|
16
16
|
value: { [k: string]: any }
|
|
17
17
|
options: DialogOptions
|
|
18
18
|
width?: string
|
|
19
|
+
height?: string
|
|
19
20
|
maxHeight?: string
|
|
20
21
|
component?: DefineComponent<any, any, any>
|
|
21
22
|
props?: { [k: string]: any }
|
|
22
23
|
mask?: boolean
|
|
24
|
+
scroll?: boolean
|
|
23
25
|
success: boolean
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -33,10 +35,12 @@ const getDialogState = (config: Partial<Dialog>, close = (state: boolean) => { }
|
|
|
33
35
|
options: config.options ?? [],
|
|
34
36
|
value: config.value,
|
|
35
37
|
width: config.width ?? '720px',
|
|
38
|
+
height: config.height,
|
|
36
39
|
maxHeight: config.maxHeight ?? '70%',
|
|
37
40
|
component: config.component ? markRaw(config.component) : undefined,
|
|
38
41
|
props: config.props ?? {},
|
|
39
42
|
mask: config.mask ?? false,
|
|
43
|
+
scroll: config.scroll ?? true,
|
|
40
44
|
success: false,
|
|
41
45
|
close
|
|
42
46
|
})
|