@jetlinks-web/components 2.0.2-2 → 2.0.2-5
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/AMap/Map.js +124 -0
- package/es/AMap/index.js +2 -0
- package/es/AMap/util.js +56 -0
- package/es/BadgeStatus/Badge.js +54 -0
- package/es/BadgeStatus/color.js +21 -0
- package/es/BadgeStatus/index.js +3 -0
- package/es/CardSelect/CardSelect.js +123 -0
- package/es/CardSelect/index.js +2 -0
- package/es/CheckButton/CheckButton.js +121 -0
- package/es/CheckButton/index.js +2 -0
- package/es/ConfigProvider/context.js +12 -0
- package/es/ConfigProvider/index.js +31 -0
- package/es/Echarts/Echarts.js +47 -0
- package/es/Echarts/index.js +2 -0
- package/es/Ellipsis/Ellipsis.js +189 -0
- package/es/Ellipsis/index.js +2 -0
- package/es/Empty/Empty.js +56 -0
- package/es/Empty/image.js +2 -0
- package/es/Empty/index.js +2 -0
- package/es/FullPage/FullPage.js +31 -0
- package/es/FullPage/index.js +2 -0
- package/es/Icon/icon.js +43 -0
- package/{src/Icon/index.ts → es/Icon/index.js} +2 -3
- package/es/MonacoEditor/Monaco.js +238 -0
- package/es/MonacoEditor/index.js +2 -0
- package/es/PermissionButton/index.js +117 -0
- package/es/ProLayout/Basic/BasicLayout.js +255 -0
- package/es/ProLayout/Basic/Header.js +93 -0
- package/es/ProLayout/PageContainer/index.js +318 -0
- package/es/ProLayout/PageContainer/typings.js +1 -0
- package/es/ProLayout/RouteContext.js +22 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +262 -0
- package/es/ProLayout/SiderMenu/SiderMenu.js +258 -0
- package/es/ProLayout/SiderMenu/index.js +2 -0
- package/es/ProLayout/SiderMenu/typings.js +1 -0
- package/es/ProLayout/TopHeader/index.js +155 -0
- package/es/ProLayout/defaultSettings.js +66 -0
- package/{src/ProLayout/index.ts → es/ProLayout/index.js} +4 -6
- package/{src → es}/ProLayout/style/default.less +4 -4
- package/es/ProLayout/style/index.js +1 -0
- package/es/ProLayout/typings.js +1 -0
- package/es/ProLayout/util.js +61 -0
- package/es/ProTable/index.js +406 -0
- package/es/ProTable/proTableTypes.js +11 -0
- package/es/ProTable/style/index.css +65 -0
- package/es/ProTable/style/index.js +1 -0
- package/es/Scrollbar/Bar.js +114 -0
- package/es/Scrollbar/Scrollbar.js +212 -0
- package/es/Scrollbar/Thumb.js +10 -0
- package/es/Scrollbar/constants.js +1 -0
- package/es/Scrollbar/index.js +2 -0
- package/es/Scrollbar/scrollbarProps.js +100 -0
- package/es/Scrollbar/util.js +30 -0
- package/es/Search/Advanced/History.js +183 -0
- package/es/Search/Advanced/SaveHistory.js +153 -0
- package/es/Search/Advanced/index.js +520 -0
- package/es/Search/Item.js +497 -0
- package/es/Search/Search.js +249 -0
- package/es/Search/hooks/index.js +1 -0
- package/es/Search/hooks/useSearchItems.js +40 -0
- package/es/Search/index.js +4 -0
- package/es/Search/setting.js +91 -0
- package/es/Search/typing.js +1 -0
- package/es/Search/util.js +234 -0
- package/es/ValueItem/ValueItem.js +233 -0
- package/es/ValueItem/index.js +2 -0
- package/es/ValueItem/util.js +16 -0
- package/es/index.js +24 -0
- package/es/style/index.js +3 -0
- package/es/style/variable.css +0 -0
- package/{src → es}/style/variable.less +0 -2
- package/lib/AMap/Map.js +124 -0
- package/lib/AMap/index.js +9 -0
- package/lib/AMap/util.js +62 -0
- package/lib/BadgeStatus/Badge.js +54 -0
- package/lib/BadgeStatus/color.js +27 -0
- package/lib/BadgeStatus/index.js +22 -0
- package/lib/CardSelect/CardSelect.js +123 -0
- package/lib/CardSelect/index.js +9 -0
- package/lib/CheckButton/CheckButton.js +121 -0
- package/lib/CheckButton/index.js +9 -0
- package/lib/ConfigProvider/context.js +19 -0
- package/lib/ConfigProvider/index.js +37 -0
- package/lib/Echarts/Echarts.js +47 -0
- package/lib/Echarts/index.js +9 -0
- package/lib/Ellipsis/Ellipsis.js +189 -0
- package/lib/Ellipsis/index.js +9 -0
- package/lib/Empty/Empty.js +56 -0
- package/lib/Empty/image.js +8 -0
- package/lib/Empty/index.js +9 -0
- package/lib/FullPage/FullPage.js +31 -0
- package/lib/FullPage/index.js +9 -0
- package/lib/Icon/icon.js +52 -0
- package/lib/Icon/index.js +9 -0
- package/lib/MonacoEditor/Monaco.js +238 -0
- package/lib/MonacoEditor/index.js +9 -0
- package/lib/PermissionButton/index.js +124 -0
- package/lib/ProLayout/Basic/BasicLayout.js +264 -0
- package/lib/ProLayout/Basic/BasicLayout.less +66 -0
- package/lib/ProLayout/Basic/Header.js +99 -0
- package/lib/ProLayout/Basic/Header.less +8 -0
- package/lib/ProLayout/PageContainer/index.js +323 -0
- package/lib/ProLayout/PageContainer/index.less +103 -0
- package/lib/ProLayout/PageContainer/typings.js +5 -0
- package/lib/ProLayout/RouteContext.js +28 -0
- package/lib/ProLayout/SiderMenu/BaseMenu.js +268 -0
- package/lib/ProLayout/SiderMenu/SiderMenu.js +267 -0
- package/lib/ProLayout/SiderMenu/index.js +20 -0
- package/lib/ProLayout/SiderMenu/index.less +212 -0
- package/lib/ProLayout/SiderMenu/typings.js +5 -0
- package/lib/ProLayout/TopHeader/index.js +161 -0
- package/lib/ProLayout/TopHeader/index.less +174 -0
- package/lib/ProLayout/defaultSettings.js +72 -0
- package/lib/ProLayout/index.js +16 -0
- package/lib/ProLayout/style/default.less +4 -0
- package/lib/ProLayout/style/index.js +3 -0
- package/lib/ProLayout/style/style.less +7 -0
- package/lib/ProLayout/typings.js +5 -0
- package/lib/ProLayout/util.js +72 -0
- package/lib/ProTable/index.js +412 -0
- package/lib/ProTable/proTableTypes.js +17 -0
- package/lib/ProTable/style/index.css +65 -0
- package/lib/ProTable/style/index.js +3 -0
- package/lib/ProTable/style/index.less +92 -0
- package/lib/Scrollbar/Bar.js +114 -0
- package/lib/Scrollbar/Scrollbar.js +212 -0
- package/lib/Scrollbar/Thumb.js +16 -0
- package/lib/Scrollbar/constants.js +7 -0
- package/lib/Scrollbar/index.js +9 -0
- package/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/scrollbarProps.js} +106 -108
- package/lib/Scrollbar/util.js +37 -0
- package/lib/Search/Advanced/History.js +183 -0
- package/lib/Search/Advanced/SaveHistory.js +153 -0
- package/lib/Search/Advanced/index.js +520 -0
- package/lib/Search/Item.js +497 -0
- package/lib/Search/Search.js +249 -0
- package/lib/Search/hooks/index.js +16 -0
- package/lib/Search/hooks/useSearchItems.js +47 -0
- package/lib/Search/index.js +16 -0
- package/lib/Search/setting.js +97 -0
- package/lib/Search/typing.js +5 -0
- package/lib/Search/util.js +241 -0
- package/lib/ValueItem/ValueItem.js +233 -0
- package/lib/ValueItem/index.js +9 -0
- package/lib/ValueItem/util.js +22 -0
- package/lib/index.js +158 -0
- package/lib/style/components.less +1 -0
- package/lib/style/index.js +4 -0
- package/lib/style/variable.css +0 -0
- package/lib/style/variable.less +2 -0
- package/package.json +120 -11
- package/index.ts +0 -64
- package/src/AMap/Map.vue +0 -110
- package/src/AMap/index.ts +0 -1
- package/src/AMap/util.ts +0 -56
- package/src/BadgeStatus/Badge.vue +0 -41
- package/src/BadgeStatus/color.ts +0 -25
- package/src/BadgeStatus/index.ts +0 -4
- package/src/CardSelect/CardSelect.vue +0 -136
- package/src/CardSelect/index.ts +0 -3
- package/src/CheckButton/CheckButton.vue +0 -146
- package/src/CheckButton/index.md +0 -27
- package/src/CheckButton/index.ts +0 -3
- package/src/ConfigProvider/context.ts +0 -17
- package/src/ConfigProvider/index.tsx +0 -40
- package/src/Echarts/Echarts.vue +0 -43
- package/src/Echarts/index.ts +0 -3
- package/src/Ellipsis/Ellipsis.vue +0 -182
- package/src/Ellipsis/index.ts +0 -3
- package/src/Empty/Empty.vue +0 -43
- package/src/Empty/image.ts +0 -3
- package/src/Empty/index.ts +0 -2
- package/src/FullPage/FullPage.vue +0 -30
- package/src/FullPage/index.ts +0 -3
- package/src/Icon/icon.tsx +0 -40
- package/src/MonacoEditor/Monaco.vue +0 -242
- package/src/MonacoEditor/index.md +0 -26
- package/src/MonacoEditor/index.ts +0 -2
- package/src/PermissionButton/index.tsx +0 -110
- package/src/ProLayout/Basic/BasicLayout.tsx +0 -395
- package/src/ProLayout/Basic/Header.tsx +0 -115
- package/src/ProLayout/PageContainer/index.tsx +0 -441
- package/src/ProLayout/PageContainer/typings.ts +0 -56
- package/src/ProLayout/RouteContext.ts +0 -87
- package/src/ProLayout/SiderMenu/BaseMenu.tsx +0 -296
- package/src/ProLayout/SiderMenu/SiderMenu.tsx +0 -320
- package/src/ProLayout/SiderMenu/index.ts +0 -2
- package/src/ProLayout/SiderMenu/typings.ts +0 -49
- package/src/ProLayout/TopHeader/index.tsx +0 -210
- package/src/ProLayout/defaultSettings.ts +0 -106
- package/src/ProLayout/style/index.ts +0 -1
- package/src/ProLayout/typings.ts +0 -87
- package/src/ProLayout/util.ts +0 -64
- package/src/ProTable/index.md +0 -53
- package/src/ProTable/index.tsx +0 -551
- package/src/ProTable/proTableTypes.ts +0 -70
- package/src/ProTable/style/index.ts +0 -1
- package/src/Scrollbar/Bar.vue +0 -75
- package/src/Scrollbar/Scrollbar.vue +0 -260
- package/src/Scrollbar/Thumb.vue +0 -163
- package/src/Scrollbar/constants.ts +0 -10
- package/src/Scrollbar/index.ts +0 -4
- package/src/Scrollbar/thumb.ts +0 -16
- package/src/Scrollbar/util.ts +0 -38
- package/src/Search/Advanced/History.vue +0 -140
- package/src/Search/Advanced/SaveHistory.vue +0 -108
- package/src/Search/Advanced/index.vue +0 -435
- package/src/Search/Item.vue +0 -525
- package/src/Search/Search.vue +0 -398
- package/src/Search/hooks/index.ts +0 -1
- package/src/Search/hooks/useSearchItems.ts +0 -68
- package/src/Search/index.md +0 -57
- package/src/Search/index.ts +0 -5
- package/src/Search/setting.ts +0 -55
- package/src/Search/typing.ts +0 -76
- package/src/Search/util.ts +0 -263
- package/src/ValueItem/ValueItem.vue +0 -192
- package/src/ValueItem/index.ts +0 -3
- package/src/ValueItem/util.ts +0 -16
- package/src/style/index.ts +0 -3
- /package/{src → es}/ProLayout/Basic/BasicLayout.less +0 -0
- /package/{src → es}/ProLayout/Basic/Header.less +0 -0
- /package/{src → es}/ProLayout/PageContainer/index.less +0 -0
- /package/{src → es}/ProLayout/SiderMenu/index.less +0 -0
- /package/{src → es}/ProLayout/TopHeader/index.less +0 -0
- /package/{src → es}/ProLayout/style/style.less +0 -0
- /package/{src → es}/ProTable/style/index.less +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
|
|
2
|
+
const op = ops[i];
|
|
3
|
+
const fn = ops[i + 1];
|
|
4
|
+
i += 2;
|
|
5
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
9
|
+
lastAccessLHS = value;
|
|
10
|
+
value = fn(value);
|
|
11
|
+
}
|
|
12
|
+
else if (op === 'call' || op === 'optionalCall') {
|
|
13
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
14
|
+
lastAccessLHS = undefined;
|
|
15
|
+
}
|
|
16
|
+
} return value; }
|
|
17
|
+
/* Analyzed bindings: {
|
|
18
|
+
"always": "props",
|
|
19
|
+
"minSize": "props",
|
|
20
|
+
"inject": "setup-const",
|
|
21
|
+
"ref": "setup-const",
|
|
22
|
+
"GAP": "setup-maybe-ref",
|
|
23
|
+
"Thumb": "setup-const",
|
|
24
|
+
"scrollbarContextKey": "setup-maybe-ref",
|
|
25
|
+
"props": "setup-reactive-const",
|
|
26
|
+
"scrollbar": "setup-maybe-ref",
|
|
27
|
+
"moveX": "setup-ref",
|
|
28
|
+
"moveY": "setup-ref",
|
|
29
|
+
"sizeWidth": "setup-ref",
|
|
30
|
+
"sizeHeight": "setup-ref",
|
|
31
|
+
"ratioY": "setup-ref",
|
|
32
|
+
"ratioX": "setup-ref",
|
|
33
|
+
"handleScroll": "setup-const",
|
|
34
|
+
"update": "setup-const"
|
|
35
|
+
} */
|
|
36
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
37
|
+
import { createVNode as _createVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
38
|
+
import { inject, ref } from 'vue';
|
|
39
|
+
import { GAP } from './util';
|
|
40
|
+
import Thumb from './Thumb.js';
|
|
41
|
+
import { scrollbarContextKey } from './constants';
|
|
42
|
+
const __sfc_main__ = _defineComponent({
|
|
43
|
+
props: {
|
|
44
|
+
always: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: true,
|
|
47
|
+
},
|
|
48
|
+
minSize: {
|
|
49
|
+
type: Number,
|
|
50
|
+
required: true,
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
setup(__props, { expose: __expose }) {
|
|
54
|
+
const props = __props;
|
|
55
|
+
const scrollbar = inject(scrollbarContextKey);
|
|
56
|
+
const moveX = ref(0);
|
|
57
|
+
const moveY = ref(0);
|
|
58
|
+
const sizeWidth = ref('');
|
|
59
|
+
const sizeHeight = ref('');
|
|
60
|
+
const ratioY = ref(1);
|
|
61
|
+
const ratioX = ref(1);
|
|
62
|
+
const handleScroll = (wrap) => {
|
|
63
|
+
if (wrap) {
|
|
64
|
+
const offsetHeight = wrap.offsetHeight - GAP;
|
|
65
|
+
const offsetWidth = wrap.offsetWidth - GAP;
|
|
66
|
+
moveY.value = ((wrap.scrollTop * 100) / offsetHeight) * ratioY.value;
|
|
67
|
+
moveX.value = ((wrap.scrollLeft * 100) / offsetWidth) * ratioX.value;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const update = () => {
|
|
71
|
+
const wrap = _optionalChain([scrollbar, 'optionalAccess', _ => _.wrapElement]);
|
|
72
|
+
if (!wrap)
|
|
73
|
+
return;
|
|
74
|
+
const offsetHeight = wrap.offsetHeight - GAP;
|
|
75
|
+
const offsetWidth = wrap.offsetWidth - GAP;
|
|
76
|
+
const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
|
|
77
|
+
const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
|
|
78
|
+
const height = Math.max(originalHeight, props.minSize);
|
|
79
|
+
const width = Math.max(originalWidth, props.minSize);
|
|
80
|
+
ratioY.value =
|
|
81
|
+
originalHeight /
|
|
82
|
+
(offsetHeight - originalHeight) /
|
|
83
|
+
(height / (offsetHeight - height));
|
|
84
|
+
ratioX.value =
|
|
85
|
+
originalWidth /
|
|
86
|
+
(offsetWidth - originalWidth) /
|
|
87
|
+
(width / (offsetWidth - width));
|
|
88
|
+
sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : '';
|
|
89
|
+
sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : '';
|
|
90
|
+
};
|
|
91
|
+
__expose({
|
|
92
|
+
handleScroll,
|
|
93
|
+
update,
|
|
94
|
+
});
|
|
95
|
+
return (_ctx, _cache) => {
|
|
96
|
+
return (_openBlock(), _createElementBlock(_Fragment, null, [
|
|
97
|
+
_createVNode(Thumb, {
|
|
98
|
+
move: moveX.value,
|
|
99
|
+
ratio: ratioX.value,
|
|
100
|
+
size: sizeWidth.value,
|
|
101
|
+
always: __props.always
|
|
102
|
+
}, null, 8 /* PROPS */, ["move", "ratio", "size", "always"]),
|
|
103
|
+
_createVNode(Thumb, {
|
|
104
|
+
move: moveY.value,
|
|
105
|
+
ratio: ratioY.value,
|
|
106
|
+
size: sizeHeight.value,
|
|
107
|
+
vertical: "",
|
|
108
|
+
always: __props.always
|
|
109
|
+
}, null, 8 /* PROPS */, ["move", "ratio", "size", "always"])
|
|
110
|
+
], 64 /* STABLE_FRAGMENT */));
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
export default __sfc_main__;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
|
|
2
|
+
const op = ops[i];
|
|
3
|
+
const fn = ops[i + 1];
|
|
4
|
+
i += 2;
|
|
5
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
9
|
+
lastAccessLHS = value;
|
|
10
|
+
value = fn(value);
|
|
11
|
+
}
|
|
12
|
+
else if (op === 'call' || op === 'optionalCall') {
|
|
13
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
14
|
+
lastAccessLHS = undefined;
|
|
15
|
+
}
|
|
16
|
+
} return value; }
|
|
17
|
+
/* Analyzed bindings: {
|
|
18
|
+
"computed": "setup-const",
|
|
19
|
+
"nextTick": "setup-const",
|
|
20
|
+
"onMounted": "setup-const",
|
|
21
|
+
"onUpdated": "setup-const",
|
|
22
|
+
"provide": "setup-const",
|
|
23
|
+
"reactive": "setup-const",
|
|
24
|
+
"ref": "setup-const",
|
|
25
|
+
"watch": "setup-const",
|
|
26
|
+
"useEventListener": "setup-maybe-ref",
|
|
27
|
+
"useResizeObserver": "setup-maybe-ref",
|
|
28
|
+
"isNumber": "setup-maybe-ref",
|
|
29
|
+
"isObject": "setup-maybe-ref",
|
|
30
|
+
"Bar": "setup-const",
|
|
31
|
+
"scrollbarContextKey": "setup-maybe-ref",
|
|
32
|
+
"scrollbarEmits": "setup-maybe-ref",
|
|
33
|
+
"scrollbarProps": "setup-maybe-ref",
|
|
34
|
+
"BarInstance": "setup-maybe-ref",
|
|
35
|
+
"COMPONENT_NAME": "literal-const",
|
|
36
|
+
"props": "setup-reactive-const",
|
|
37
|
+
"emit": "setup-const",
|
|
38
|
+
"stopResizeObserver": "setup-let",
|
|
39
|
+
"stopResizeListener": "setup-let",
|
|
40
|
+
"scrollbarRef": "setup-ref",
|
|
41
|
+
"wrapRef": "setup-ref",
|
|
42
|
+
"resizeRef": "setup-ref",
|
|
43
|
+
"barRef": "setup-ref",
|
|
44
|
+
"wrapStyle": "setup-ref",
|
|
45
|
+
"wrapKls": "setup-ref",
|
|
46
|
+
"resizeKls": "setup-ref",
|
|
47
|
+
"handleScroll": "setup-const",
|
|
48
|
+
"scrollTo": "setup-const",
|
|
49
|
+
"setScrollTop": "setup-const",
|
|
50
|
+
"setScrollLeft": "setup-const",
|
|
51
|
+
"update": "setup-const"
|
|
52
|
+
} */
|
|
53
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
54
|
+
import { renderSlot as _renderSlot, resolveDynamicComponent as _resolveDynamicComponent, normalizeClass as _normalizeClass, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, createElementBlock as _createElementBlock } from "vue";
|
|
55
|
+
import { computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch, } from 'vue';
|
|
56
|
+
import { useEventListener, useResizeObserver } from '@vueuse/core';
|
|
57
|
+
import { isNumber, isObject } from '@jetlinks-web/utils';
|
|
58
|
+
import Bar from './Bar.js';
|
|
59
|
+
import { scrollbarContextKey } from './constants';
|
|
60
|
+
import { scrollbarEmits, scrollbarProps, } from './scrollbar';
|
|
61
|
+
const COMPONENT_NAME = 'JScrollbar';
|
|
62
|
+
const __sfc_main__ = _defineComponent({
|
|
63
|
+
...{
|
|
64
|
+
name: COMPONENT_NAME,
|
|
65
|
+
},
|
|
66
|
+
props: scrollbarProps,
|
|
67
|
+
emits: scrollbarEmits,
|
|
68
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
69
|
+
const props = __props;
|
|
70
|
+
const emit = __emit;
|
|
71
|
+
let stopResizeObserver = undefined;
|
|
72
|
+
let stopResizeListener = undefined;
|
|
73
|
+
const scrollbarRef = ref();
|
|
74
|
+
const wrapRef = ref();
|
|
75
|
+
const resizeRef = ref();
|
|
76
|
+
const barRef = ref();
|
|
77
|
+
const wrapStyle = computed(() => {
|
|
78
|
+
const style = {};
|
|
79
|
+
if (props.height)
|
|
80
|
+
style.height = `${props.height}px`;
|
|
81
|
+
if (props.maxHeight)
|
|
82
|
+
style.maxHeight = `${props.maxHeight}px`;
|
|
83
|
+
return [props.wrapStyle, style];
|
|
84
|
+
});
|
|
85
|
+
const wrapKls = computed(() => {
|
|
86
|
+
return [
|
|
87
|
+
'j-scrollbar__wrap',
|
|
88
|
+
'j-scrollbar__wrap--hidden-default'
|
|
89
|
+
];
|
|
90
|
+
});
|
|
91
|
+
const resizeKls = computed(() => {
|
|
92
|
+
return ['j-scrollbar__view', props.viewClass];
|
|
93
|
+
});
|
|
94
|
+
const handleScroll = () => {
|
|
95
|
+
if (wrapRef.value) {
|
|
96
|
+
_optionalChain([barRef, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.handleScroll, 'call', _4 => _4(wrapRef.value)]);
|
|
97
|
+
emit('scroll', {
|
|
98
|
+
scrollTop: wrapRef.value.scrollTop,
|
|
99
|
+
scrollLeft: wrapRef.value.scrollLeft,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
function scrollTo(arg1, arg2) {
|
|
104
|
+
if (isObject(arg1)) {
|
|
105
|
+
wrapRef.value.scrollTo(arg1);
|
|
106
|
+
}
|
|
107
|
+
else if (isNumber(arg1) && isNumber(arg2)) {
|
|
108
|
+
wrapRef.value.scrollTo(arg1, arg2);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const setScrollTop = (value) => {
|
|
112
|
+
if (!isNumber(value)) {
|
|
113
|
+
throw new Error('value must be a number');
|
|
114
|
+
}
|
|
115
|
+
wrapRef.value.scrollTop = value;
|
|
116
|
+
};
|
|
117
|
+
const setScrollLeft = (value) => {
|
|
118
|
+
if (!isNumber(value)) {
|
|
119
|
+
throw new Error(`[${COMPONENT_NAME}] value must be a number`);
|
|
120
|
+
}
|
|
121
|
+
wrapRef.value.scrollLeft = value;
|
|
122
|
+
};
|
|
123
|
+
const update = () => {
|
|
124
|
+
_optionalChain([barRef, 'access', _5 => _5.value, 'optionalAccess', _6 => _6.update, 'call', _7 => _7()]);
|
|
125
|
+
};
|
|
126
|
+
watch(() => props.noresize, (noResize) => {
|
|
127
|
+
if (noResize) {
|
|
128
|
+
_optionalChain([stopResizeObserver, 'optionalCall', _8 => _8()]);
|
|
129
|
+
_optionalChain([stopResizeListener, 'optionalCall', _9 => _9()]);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
;
|
|
133
|
+
({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
|
|
134
|
+
stopResizeListener = useEventListener('resize', update);
|
|
135
|
+
}
|
|
136
|
+
}, { immediate: true });
|
|
137
|
+
watch(() => [props.maxHeight, props.height], () => {
|
|
138
|
+
if (!props.native)
|
|
139
|
+
nextTick(() => {
|
|
140
|
+
update();
|
|
141
|
+
if (wrapRef.value) {
|
|
142
|
+
_optionalChain([barRef, 'access', _10 => _10.value, 'optionalAccess', _11 => _11.handleScroll, 'call', _12 => _12(wrapRef.value)]);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
provide(scrollbarContextKey, reactive({
|
|
147
|
+
scrollbarElement: scrollbarRef,
|
|
148
|
+
wrapElement: wrapRef,
|
|
149
|
+
}));
|
|
150
|
+
onMounted(() => {
|
|
151
|
+
if (!props.native)
|
|
152
|
+
nextTick(() => {
|
|
153
|
+
update();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
onUpdated(() => update());
|
|
157
|
+
__expose({
|
|
158
|
+
/** @description scrollbar wrap ref */
|
|
159
|
+
wrapRef,
|
|
160
|
+
/** @description update scrollbar state manually */
|
|
161
|
+
update,
|
|
162
|
+
/** @description scrolls to a particular set of coordinates */
|
|
163
|
+
scrollTo,
|
|
164
|
+
/** @description set distance to scroll top */
|
|
165
|
+
setScrollTop,
|
|
166
|
+
/** @description set distance to scroll left */
|
|
167
|
+
setScrollLeft,
|
|
168
|
+
/** @description handle scroll event */
|
|
169
|
+
handleScroll,
|
|
170
|
+
});
|
|
171
|
+
return (_ctx, _cache) => {
|
|
172
|
+
return (_openBlock(), _createElementBlock("div", {
|
|
173
|
+
ref_key: "scrollbarRef",
|
|
174
|
+
ref: scrollbarRef,
|
|
175
|
+
class: "j-scrollbar"
|
|
176
|
+
}, [
|
|
177
|
+
_createElementVNode("div", {
|
|
178
|
+
ref_key: "wrapRef",
|
|
179
|
+
ref: wrapRef,
|
|
180
|
+
class: _normalizeClass(wrapKls.value),
|
|
181
|
+
style: _normalizeStyle(wrapStyle.value),
|
|
182
|
+
onScroll: handleScroll
|
|
183
|
+
}, [
|
|
184
|
+
(_openBlock(), _createBlock(_resolveDynamicComponent(_ctx.tag), {
|
|
185
|
+
id: _ctx.id,
|
|
186
|
+
ref_key: "resizeRef",
|
|
187
|
+
ref: resizeRef,
|
|
188
|
+
class: _normalizeClass(resizeKls.value),
|
|
189
|
+
role: _ctx.role,
|
|
190
|
+
"aria-label": _ctx.ariaLabel,
|
|
191
|
+
"aria-orientation": _ctx.ariaOrientation
|
|
192
|
+
}, {
|
|
193
|
+
default: _withCtx(() => [
|
|
194
|
+
_renderSlot(_ctx.$slots, "default")
|
|
195
|
+
]),
|
|
196
|
+
_: 3 /* FORWARDED */
|
|
197
|
+
}, 8 /* PROPS */, ["id", "class", "role", "aria-label", "aria-orientation"]))
|
|
198
|
+
], 38 /* CLASS, STYLE, NEED_HYDRATION */),
|
|
199
|
+
(!_ctx.native)
|
|
200
|
+
? (_openBlock(), _createBlock(Bar, {
|
|
201
|
+
key: 0,
|
|
202
|
+
ref_key: "barRef",
|
|
203
|
+
ref: barRef,
|
|
204
|
+
always: _ctx.always,
|
|
205
|
+
"min-size": _ctx.minSize
|
|
206
|
+
}, null, 8 /* PROPS */, ["always", "min-size"]))
|
|
207
|
+
: _createCommentVNode("v-if", true)
|
|
208
|
+
], 512 /* NEED_PATCH */));
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
export default __sfc_main__;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.thumbProps = void 0;
|
|
7
|
+
var thumbProps = exports.thumbProps = {
|
|
8
|
+
vertical: Boolean,
|
|
9
|
+
size: String,
|
|
10
|
+
move: Number,
|
|
11
|
+
ratio: {
|
|
12
|
+
type: Number,
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
always: Boolean
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _Scrollbar = _interopRequireDefault(require("./Scrollbar.js"));
|
|
9
|
+
var _default = exports.default = _Scrollbar.default;
|
|
@@ -1,108 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
scrollLeft
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export type BarInstance = InstanceType<typeof Bar>
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.scrollbarProps = exports.scrollbarEmits = void 0;
|
|
7
|
+
var _utils = require("@jetlinks-web/utils");
|
|
8
|
+
var scrollbarProps = exports.scrollbarProps = {
|
|
9
|
+
/**
|
|
10
|
+
* @description height of scrollbar
|
|
11
|
+
*/
|
|
12
|
+
height: {
|
|
13
|
+
type: [String, Number],
|
|
14
|
+
default: ''
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* @description max height of scrollbar
|
|
18
|
+
*/
|
|
19
|
+
maxHeight: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* @description whether to use the native scrollbar
|
|
25
|
+
*/
|
|
26
|
+
native: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* @description style of wrap
|
|
32
|
+
*/
|
|
33
|
+
wrapStyle: {
|
|
34
|
+
type: [String, Object, Array],
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* @description class of wrap
|
|
39
|
+
*/
|
|
40
|
+
wrapClass: {
|
|
41
|
+
type: [String, Array],
|
|
42
|
+
default: ''
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* @description class of view
|
|
46
|
+
*/
|
|
47
|
+
viewClass: {
|
|
48
|
+
type: [String, Array],
|
|
49
|
+
default: ''
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* @description style of view
|
|
53
|
+
*/
|
|
54
|
+
viewStyle: {
|
|
55
|
+
type: [String, Array, Object],
|
|
56
|
+
default: ''
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance
|
|
60
|
+
*/
|
|
61
|
+
noresize: Boolean,
|
|
62
|
+
/**
|
|
63
|
+
* @description element tag of the view
|
|
64
|
+
*/
|
|
65
|
+
tag: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: 'div'
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* @description always show
|
|
71
|
+
*/
|
|
72
|
+
always: Boolean,
|
|
73
|
+
/**
|
|
74
|
+
* @description minimum size of scrollbar
|
|
75
|
+
*/
|
|
76
|
+
minSize: {
|
|
77
|
+
type: Number,
|
|
78
|
+
default: 20
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* @description id of view
|
|
82
|
+
*/
|
|
83
|
+
id: String,
|
|
84
|
+
/**
|
|
85
|
+
* @description role of view
|
|
86
|
+
*/
|
|
87
|
+
role: String,
|
|
88
|
+
/**
|
|
89
|
+
* @description aria-label of view
|
|
90
|
+
*/
|
|
91
|
+
ariaLabel: String,
|
|
92
|
+
/**
|
|
93
|
+
* @description aria-orientation of view
|
|
94
|
+
*/
|
|
95
|
+
ariaOrientation: {
|
|
96
|
+
type: String,
|
|
97
|
+
values: ['horizontal', 'vertical']
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var scrollbarEmits = exports.scrollbarEmits = {
|
|
101
|
+
scroll: function scroll(_ref) {
|
|
102
|
+
var scrollTop = _ref.scrollTop,
|
|
103
|
+
scrollLeft = _ref.scrollLeft;
|
|
104
|
+
return [scrollTop, scrollLeft].every(_utils.isNumber);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.renderThumbStyle = exports.GAP = exports.BAR_MAP = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var GAP = exports.GAP = 4; // top 2 + bottom 2 of bar instance
|
|
10
|
+
var BAR_MAP = exports.BAR_MAP = {
|
|
11
|
+
vertical: {
|
|
12
|
+
offset: 'offsetHeight',
|
|
13
|
+
scroll: 'scrollTop',
|
|
14
|
+
scrollSize: 'scrollHeight',
|
|
15
|
+
size: 'height',
|
|
16
|
+
key: 'vertical',
|
|
17
|
+
axis: 'Y',
|
|
18
|
+
client: 'clientY',
|
|
19
|
+
direction: 'top'
|
|
20
|
+
},
|
|
21
|
+
horizontal: {
|
|
22
|
+
offset: 'offsetWidth',
|
|
23
|
+
scroll: 'scrollLeft',
|
|
24
|
+
scrollSize: 'scrollWidth',
|
|
25
|
+
size: 'width',
|
|
26
|
+
key: 'horizontal',
|
|
27
|
+
axis: 'X',
|
|
28
|
+
client: 'clientX',
|
|
29
|
+
direction: 'left'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var renderThumbStyle = exports.renderThumbStyle = function renderThumbStyle(_ref) {
|
|
33
|
+
var move = _ref.move,
|
|
34
|
+
size = _ref.size,
|
|
35
|
+
bar = _ref.bar;
|
|
36
|
+
return (0, _defineProperty2.default)((0, _defineProperty2.default)({}, bar.size, size), "transform", "translate".concat(bar.axis, "(").concat(move, "%)"));
|
|
37
|
+
};
|