@meethive/components 0.0.2 → 0.0.4
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/es/AutoComplete/AutoComplete.js +71 -80
- package/es/BadgeStatus/Badge.js +38 -47
- package/es/CardSelect/CardSelect.js +115 -137
- package/es/CheckButton/CheckButton.js +102 -118
- package/es/ConfigProvider/ConfigProvider.js +44 -68
- package/es/DragModal/DragModal.js +191 -212
- package/es/EditTable/Body.js +158 -189
- package/es/EditTable/CellRender.js +10 -12
- package/es/EditTable/EditTable.js +385 -434
- package/es/EditTable/FormItem.js +140 -169
- package/es/EditTable/Group.js +171 -204
- package/es/EditTable/Header.js +57 -63
- package/es/EditTable/HeaderRender.js +10 -12
- package/es/EditTable/components/ContextMenu/Menu.js +78 -86
- package/es/EditTable/components/Search/Search.js +151 -163
- package/es/EditTable/components/Search/Sort.js +104 -119
- package/es/Ellipsis/Ellipsis.js +144 -148
- package/es/Empty/Empty.js +51 -57
- package/es/FullPage/FullPage.js +20 -19
- package/es/Icon/Icon.js +42 -49
- package/es/LocaleProvider/LocaleProvider.js +38 -31
- package/es/Markdown/Markdown.js +101 -118
- package/es/PermissionButton/PermissionButton.js +118 -118
- package/es/ProLayout/Basic/BasicLayout.js +301 -418
- package/es/ProLayout/Basic/Header.js +91 -111
- package/es/ProLayout/PageContainer/index.js +267 -344
- package/es/ProLayout/SiderMenu/BaseMenu.js +186 -240
- package/es/ProTable/Alert.js +39 -40
- package/es/ProTable/Content.js +84 -97
- package/es/ProTable/Header.js +32 -33
- package/es/ProTable/Pagination.js +56 -55
- package/es/ProTable/ProTable.js +256 -276
- package/es/RadioButton/RadioButton.js +48 -53
- package/es/Scrollbar/Bar.js +65 -76
- package/es/Scrollbar/Scrollbar.js +129 -161
- package/es/Scrollbar/Thumb.js +101 -150
- package/es/Search/Item.js +208 -236
- package/es/Search/Search.js +90 -90
- package/es/Skeleton/Skeleton.js +26 -27
- package/es/Skeleton/components/DashBoardCard.js +26 -27
- package/es/Skeleton/components/DashBoardChart.js +26 -27
- package/es/Skeleton/components/Detail.js +26 -27
- package/es/Skeleton/components/Drawer.js +26 -27
- package/es/Skeleton/components/Item.js +55 -54
- package/es/Skeleton/components/List.js +29 -27
- package/es/Skeleton/components/ListCard.js +28 -28
- package/es/Skeleton/components/ListCardItem.js +20 -20
- package/es/Skeleton/components/ListTable.js +26 -27
- package/es/Skeleton/components/Page.js +27 -26
- package/es/Skeleton/components/Search.js +16 -16
- package/es/Skeleton/components/Tree.js +26 -27
- package/es/TimeFormat/TimeFormat.js +32 -36
- package/es/Title/Title.js +23 -26
- package/es/ValueItem/ValueItem.js +100 -113
- package/es/VirtualTable/VirtualTable.js +235 -271
- package/lib/AutoComplete/AutoComplete.js +71 -80
- package/lib/BadgeStatus/Badge.js +38 -47
- package/lib/CardSelect/CardSelect.js +115 -137
- package/lib/CheckButton/CheckButton.js +102 -118
- package/lib/ConfigProvider/ConfigProvider.js +44 -68
- package/lib/DragModal/DragModal.js +191 -212
- package/lib/EditTable/Body.js +158 -189
- package/lib/EditTable/CellRender.js +10 -12
- package/lib/EditTable/EditTable.js +385 -434
- package/lib/EditTable/FormItem.js +140 -169
- package/lib/EditTable/Group.js +171 -204
- package/lib/EditTable/Header.js +57 -63
- package/lib/EditTable/HeaderRender.js +10 -12
- package/lib/EditTable/components/ContextMenu/Menu.js +78 -86
- package/lib/EditTable/components/Search/Search.js +151 -163
- package/lib/EditTable/components/Search/Sort.js +104 -119
- package/lib/Ellipsis/Ellipsis.js +144 -148
- package/lib/Empty/Empty.js +51 -57
- package/lib/FullPage/FullPage.js +20 -19
- package/lib/Icon/Icon.js +42 -49
- package/lib/LocaleProvider/LocaleProvider.js +38 -31
- package/lib/Markdown/Markdown.js +101 -118
- package/lib/PermissionButton/PermissionButton.js +118 -118
- package/lib/ProLayout/Basic/BasicLayout.js +301 -418
- package/lib/ProLayout/Basic/Header.js +91 -111
- package/lib/ProLayout/PageContainer/index.js +267 -344
- package/lib/ProLayout/SiderMenu/BaseMenu.js +186 -240
- package/lib/ProTable/Alert.js +39 -40
- package/lib/ProTable/Content.js +84 -97
- package/lib/ProTable/Header.js +32 -33
- package/lib/ProTable/Pagination.js +56 -55
- package/lib/ProTable/ProTable.js +256 -276
- package/lib/RadioButton/RadioButton.js +48 -53
- package/lib/Scrollbar/Bar.js +65 -76
- package/lib/Scrollbar/Scrollbar.js +129 -161
- package/lib/Scrollbar/Thumb.js +101 -150
- package/lib/Search/Item.js +208 -236
- package/lib/Search/Search.js +90 -90
- package/lib/Skeleton/Skeleton.js +26 -27
- package/lib/Skeleton/components/DashBoardCard.js +26 -27
- package/lib/Skeleton/components/DashBoardChart.js +26 -27
- package/lib/Skeleton/components/Detail.js +26 -27
- package/lib/Skeleton/components/Drawer.js +26 -27
- package/lib/Skeleton/components/Item.js +55 -54
- package/lib/Skeleton/components/List.js +29 -27
- package/lib/Skeleton/components/ListCard.js +28 -28
- package/lib/Skeleton/components/ListCardItem.js +20 -20
- package/lib/Skeleton/components/ListTable.js +26 -27
- package/lib/Skeleton/components/Page.js +27 -26
- package/lib/Skeleton/components/Search.js +16 -16
- package/lib/Skeleton/components/Tree.js +26 -27
- package/lib/TimeFormat/TimeFormat.js +32 -36
- package/lib/Title/Title.js +23 -26
- package/lib/ValueItem/ValueItem.js +100 -113
- package/lib/VirtualTable/VirtualTable.js +235 -271
- package/package.json +1 -1
package/es/Scrollbar/Bar.js
CHANGED
|
@@ -1,76 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
props: {
|
|
11
|
-
always: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: true
|
|
14
|
-
},
|
|
15
|
-
minSize: {
|
|
16
|
-
type: Number,
|
|
17
|
-
required: true
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
setup(props, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const handleScroll =
|
|
31
|
-
if (wrap) {
|
|
32
|
-
const offsetHeight = wrap.offsetHeight - GAP
|
|
33
|
-
const offsetWidth = wrap.offsetWidth - GAP
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
sizeWidth
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
moveX,
|
|
69
|
-
moveY,
|
|
70
|
-
sizeWidth,
|
|
71
|
-
sizeHeight,
|
|
72
|
-
ratioY,
|
|
73
|
-
ratioX
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
})
|
|
1
|
+
import { defineComponent, inject, ref } from 'vue';
|
|
2
|
+
import { GAP } from './util';
|
|
3
|
+
import Thumb from './Thumb.js';
|
|
4
|
+
import { scrollbarContextKey } from './constants';
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
name: 'ScrollbarBar',
|
|
7
|
+
components: {
|
|
8
|
+
Thumb
|
|
9
|
+
},
|
|
10
|
+
props: {
|
|
11
|
+
always: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: true
|
|
14
|
+
},
|
|
15
|
+
minSize: {
|
|
16
|
+
type: Number,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(props, {
|
|
21
|
+
expose
|
|
22
|
+
}) {
|
|
23
|
+
const scrollbar = inject(scrollbarContextKey);
|
|
24
|
+
const moveX = ref(0);
|
|
25
|
+
const moveY = ref(0);
|
|
26
|
+
const sizeWidth = ref('');
|
|
27
|
+
const sizeHeight = ref('');
|
|
28
|
+
const ratioY = ref(1);
|
|
29
|
+
const ratioX = ref(1);
|
|
30
|
+
const handleScroll = wrap => {
|
|
31
|
+
if (wrap) {
|
|
32
|
+
const offsetHeight = wrap.offsetHeight - GAP;
|
|
33
|
+
const offsetWidth = wrap.offsetWidth - GAP;
|
|
34
|
+
moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
|
|
35
|
+
moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const update = () => {
|
|
39
|
+
const wrap = scrollbar?.wrapElement;
|
|
40
|
+
if (!wrap) return;
|
|
41
|
+
const offsetHeight = wrap.offsetHeight - GAP;
|
|
42
|
+
const offsetWidth = wrap.offsetWidth - GAP;
|
|
43
|
+
const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
|
|
44
|
+
const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
|
|
45
|
+
const height = Math.max(originalHeight, props.minSize);
|
|
46
|
+
const width = Math.max(originalWidth, props.minSize);
|
|
47
|
+
ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
|
|
48
|
+
ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
|
|
49
|
+
sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : '';
|
|
50
|
+
sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : '';
|
|
51
|
+
};
|
|
52
|
+
expose({
|
|
53
|
+
handleScroll,
|
|
54
|
+
update
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
moveX,
|
|
58
|
+
moveY,
|
|
59
|
+
sizeWidth,
|
|
60
|
+
sizeHeight,
|
|
61
|
+
ratioY,
|
|
62
|
+
ratioX
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -1,161 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
onUpdated(() => update())
|
|
133
|
-
|
|
134
|
-
expose({
|
|
135
|
-
/** @description scrollbar wrap ref */
|
|
136
|
-
wrapRef,
|
|
137
|
-
/** @description update scrollbar state manually */
|
|
138
|
-
update,
|
|
139
|
-
/** @description scrolls to a particular set of coordinates */
|
|
140
|
-
scrollTo,
|
|
141
|
-
/** @description set distance to scroll top */
|
|
142
|
-
setScrollTop,
|
|
143
|
-
/** @description set distance to scroll left */
|
|
144
|
-
setScrollLeft,
|
|
145
|
-
/** @description handle scroll event */
|
|
146
|
-
handleScroll
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
hashId,
|
|
151
|
-
scrollbarRef,
|
|
152
|
-
wrapRef,
|
|
153
|
-
resizeRef,
|
|
154
|
-
barRef,
|
|
155
|
-
wrapStyle,
|
|
156
|
-
wrapKls,
|
|
157
|
-
resizeKls,
|
|
158
|
-
handleScroll
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
})
|
|
1
|
+
import { defineComponent, computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch } from 'vue';
|
|
2
|
+
import { useEventListener, useResizeObserver } from '@vueuse/core';
|
|
3
|
+
import { isNumber, isObject } from '@meethive/utils';
|
|
4
|
+
import Bar from './Bar.js';
|
|
5
|
+
import { scrollbarContextKey } from './constants';
|
|
6
|
+
import { scrollbarEmits, scrollbarProps } from './scrollbarProps';
|
|
7
|
+
import useScrollbarStyle from './style';
|
|
8
|
+
const COMPONENT_NAME = 'JScrollbar';
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: COMPONENT_NAME,
|
|
11
|
+
components: {
|
|
12
|
+
Bar
|
|
13
|
+
},
|
|
14
|
+
props: scrollbarProps,
|
|
15
|
+
emits: scrollbarEmits,
|
|
16
|
+
setup(props, {
|
|
17
|
+
expose,
|
|
18
|
+
emit
|
|
19
|
+
}) {
|
|
20
|
+
const prefixCls = computed(() => 'j-scrollbar');
|
|
21
|
+
const [wrapSSR, hashId] = useScrollbarStyle(prefixCls);
|
|
22
|
+
let stopResizeObserver = undefined;
|
|
23
|
+
let stopResizeListener = undefined;
|
|
24
|
+
const scrollbarRef = ref();
|
|
25
|
+
const wrapRef = ref();
|
|
26
|
+
const resizeRef = ref();
|
|
27
|
+
const barRef = ref();
|
|
28
|
+
const wrapStyle = computed(() => {
|
|
29
|
+
const style = {};
|
|
30
|
+
if (props.height) style.height = `${props.height}px`;
|
|
31
|
+
if (props.maxHeight) style.maxHeight = `${props.maxHeight}px`;
|
|
32
|
+
return [props.wrapStyle, style];
|
|
33
|
+
});
|
|
34
|
+
const wrapKls = computed(() => {
|
|
35
|
+
return ['j-scrollbar__wrap', 'j-scrollbar__wrap--hidden-default'];
|
|
36
|
+
});
|
|
37
|
+
const resizeKls = computed(() => {
|
|
38
|
+
return ['j-scrollbar__view', props.viewClass];
|
|
39
|
+
});
|
|
40
|
+
const handleScroll = () => {
|
|
41
|
+
if (wrapRef.value) {
|
|
42
|
+
barRef.value?.handleScroll(wrapRef.value);
|
|
43
|
+
emit('scroll', {
|
|
44
|
+
scrollTop: wrapRef.value.scrollTop,
|
|
45
|
+
scrollLeft: wrapRef.value.scrollLeft
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
function scrollTo(arg1, arg2) {
|
|
50
|
+
if (isObject(arg1)) {
|
|
51
|
+
wrapRef.value.scrollTo(arg1);
|
|
52
|
+
} else if (isNumber(arg1) && isNumber(arg2)) {
|
|
53
|
+
wrapRef.value.scrollTo(arg1, arg2);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const setScrollTop = value => {
|
|
57
|
+
if (!isNumber(value)) {
|
|
58
|
+
throw new Error('value must be a number');
|
|
59
|
+
}
|
|
60
|
+
wrapRef.value.scrollTop = value;
|
|
61
|
+
};
|
|
62
|
+
const setScrollLeft = value => {
|
|
63
|
+
if (!isNumber(value)) {
|
|
64
|
+
throw new Error(`[${COMPONENT_NAME}] value must be a number`);
|
|
65
|
+
}
|
|
66
|
+
wrapRef.value.scrollLeft = value;
|
|
67
|
+
};
|
|
68
|
+
const update = () => {
|
|
69
|
+
barRef.value?.update();
|
|
70
|
+
};
|
|
71
|
+
watch(() => props.noresize, noResize => {
|
|
72
|
+
if (noResize) {
|
|
73
|
+
stopResizeObserver?.();
|
|
74
|
+
stopResizeListener?.();
|
|
75
|
+
} else {
|
|
76
|
+
;
|
|
77
|
+
({
|
|
78
|
+
stop: stopResizeObserver
|
|
79
|
+
} = useResizeObserver(resizeRef, update));
|
|
80
|
+
stopResizeListener = useEventListener('resize', update);
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
immediate: true
|
|
84
|
+
});
|
|
85
|
+
watch(() => [props.maxHeight, props.height], () => {
|
|
86
|
+
if (!props.native) nextTick(() => {
|
|
87
|
+
update();
|
|
88
|
+
if (wrapRef.value) {
|
|
89
|
+
barRef.value?.handleScroll(wrapRef.value);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
provide(scrollbarContextKey, reactive({
|
|
94
|
+
scrollbarElement: scrollbarRef,
|
|
95
|
+
wrapElement: wrapRef
|
|
96
|
+
}));
|
|
97
|
+
onMounted(() => {
|
|
98
|
+
if (!props.native) nextTick(() => {
|
|
99
|
+
update();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
onUpdated(() => update());
|
|
103
|
+
expose({
|
|
104
|
+
/** @description scrollbar wrap ref */
|
|
105
|
+
wrapRef,
|
|
106
|
+
/** @description update scrollbar state manually */
|
|
107
|
+
update,
|
|
108
|
+
/** @description scrolls to a particular set of coordinates */
|
|
109
|
+
scrollTo,
|
|
110
|
+
/** @description set distance to scroll top */
|
|
111
|
+
setScrollTop,
|
|
112
|
+
/** @description set distance to scroll left */
|
|
113
|
+
setScrollLeft,
|
|
114
|
+
/** @description handle scroll event */
|
|
115
|
+
handleScroll
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
hashId,
|
|
119
|
+
scrollbarRef,
|
|
120
|
+
wrapRef,
|
|
121
|
+
resizeRef,
|
|
122
|
+
barRef,
|
|
123
|
+
wrapStyle,
|
|
124
|
+
wrapKls,
|
|
125
|
+
resizeKls,
|
|
126
|
+
handleScroll
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|