@meethive/components 0.0.11 → 0.0.13
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/DragModal/DragModal.js +74 -22
- package/es/Ellipsis/Ellipsis.js +35 -19
- package/es/PermissionButton/PermissionButton.js +111 -63
- package/es/Scrollbar/Bar.js +26 -16
- package/es/Scrollbar/Scrollbar.js +44 -20
- package/es/Scrollbar/Thumb.js +33 -14
- package/es/VirtualTable/VirtualTable.js +108 -27
- package/lib/DragModal/DragModal.js +74 -22
- package/lib/Ellipsis/Ellipsis.js +35 -19
- package/lib/PermissionButton/PermissionButton.js +111 -63
- package/lib/Scrollbar/Bar.js +26 -16
- package/lib/Scrollbar/Scrollbar.js +44 -20
- package/lib/Scrollbar/Thumb.js +33 -14
- package/lib/VirtualTable/VirtualTable.js +108 -27
- package/package.json +1 -1
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, withModifiers as _withModifiers, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, createTextVNode as _createTextVNode, Transition as _Transition, normalizeClass as _normalizeClass } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "header"
|
|
6
|
+
};
|
|
7
|
+
const _hoisted_2 = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "jetlinks-drag-modal-footer"
|
|
10
|
+
};
|
|
11
|
+
import { ref, useSlots, computed, onMounted, watch } from 'vue';
|
|
2
12
|
import { Button } from 'ant-design-vue';
|
|
3
13
|
import { useLocaleReceiver } from '../LocaleReciver/index';
|
|
4
14
|
import genDragModalStyle from './style';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Button
|
|
15
|
+
const __sfc_main__ = _defineComponent({
|
|
16
|
+
...{
|
|
17
|
+
name: 'JDragModal'
|
|
9
18
|
},
|
|
19
|
+
__name: 'DragModal',
|
|
10
20
|
props: {
|
|
11
21
|
title: {
|
|
12
22
|
type: [String, Boolean],
|
|
@@ -34,9 +44,11 @@ export default defineComponent({
|
|
|
34
44
|
}
|
|
35
45
|
},
|
|
36
46
|
emits: ['cancel', 'heightChange', 'ok', 'visibleChange'],
|
|
37
|
-
setup(
|
|
38
|
-
emit
|
|
47
|
+
setup(__props, {
|
|
48
|
+
emit: __emit
|
|
39
49
|
}) {
|
|
50
|
+
const props = __props;
|
|
51
|
+
const emits = __emit;
|
|
40
52
|
const slots = useSlots();
|
|
41
53
|
const [contextLocale] = useLocaleReceiver('DragModal');
|
|
42
54
|
const ele = document.body;
|
|
@@ -149,18 +161,18 @@ export default defineComponent({
|
|
|
149
161
|
}
|
|
150
162
|
const height = baseHeight.value + calc;
|
|
151
163
|
baseHeight.value = height <= props.dragRang[1] ? props.dragRang[1] : height;
|
|
152
|
-
|
|
164
|
+
emits('heightChange', baseHeight.value);
|
|
153
165
|
}
|
|
154
166
|
};
|
|
155
167
|
handleClear();
|
|
156
168
|
};
|
|
157
169
|
const onCancel = () => {
|
|
158
|
-
|
|
159
|
-
|
|
170
|
+
emits('cancel');
|
|
171
|
+
emits('visibleChange', false);
|
|
160
172
|
};
|
|
161
173
|
const onOk = () => {
|
|
162
|
-
|
|
163
|
-
|
|
174
|
+
emits('ok');
|
|
175
|
+
emits('visibleChange', true);
|
|
164
176
|
};
|
|
165
177
|
onMounted(() => {
|
|
166
178
|
if (dialog.value && header.value) {
|
|
@@ -177,15 +189,55 @@ export default defineComponent({
|
|
|
177
189
|
baseHeight.value = props.height;
|
|
178
190
|
}
|
|
179
191
|
});
|
|
180
|
-
return {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
192
|
+
return (_ctx, _cache) => {
|
|
193
|
+
const _component_AIcon = _resolveComponent("AIcon");
|
|
194
|
+
const _component_a_button = _resolveComponent("a-button");
|
|
195
|
+
const _component_a_space = _resolveComponent("a-space");
|
|
196
|
+
return _openBlock(), _createElementBlock("div", {
|
|
197
|
+
ref_key: "dialog",
|
|
198
|
+
ref: dialog,
|
|
199
|
+
style: _normalizeStyle(styles.value),
|
|
200
|
+
class: _normalizeClass(['jetlinks-drag-modal', _unref(hashId)])
|
|
201
|
+
}, [_createVNode(_Transition, {
|
|
202
|
+
name: "dialog"
|
|
203
|
+
}, {
|
|
204
|
+
default: _withCtx(() => [_createElementVNode("div", {
|
|
205
|
+
class: "jetlinks-drag-modal-sprite",
|
|
206
|
+
ref_key: "header",
|
|
207
|
+
ref: header
|
|
208
|
+
}, [__props.title !== false ? (_openBlock(), _createElementBlock("div", _hoisted_1, [_createElementVNode("span", null, _toDisplayString(__props.title), 1 /* TEXT */), _createVNode(_component_a_button, {
|
|
209
|
+
size: "small",
|
|
210
|
+
type: "text",
|
|
211
|
+
onClick: _withModifiers(onCancel, ["stop"])
|
|
212
|
+
}, {
|
|
213
|
+
default: _withCtx(() => [_createVNode(_component_AIcon, {
|
|
214
|
+
type: "CloseOutlined"
|
|
215
|
+
})]),
|
|
216
|
+
_: 1 /* STABLE */
|
|
217
|
+
})])) : _createCommentVNode("v-if", true), _createElementVNode("div", {
|
|
218
|
+
class: "jetlinks-drag-modal-body",
|
|
219
|
+
style: _normalizeStyle(__props.bodyStyle)
|
|
220
|
+
}, [_renderSlot(_ctx.$slots, "default")], 4 /* STYLE */), __props.footer !== false ? (_openBlock(), _createElementBlock("div", _hoisted_2, [_renderSlot(_ctx.$slots, "footer", {}, () => [_createVNode(_component_a_space, null, {
|
|
221
|
+
default: _withCtx(() => [_createVNode(_unref(Button), {
|
|
222
|
+
onClick: _withModifiers(onCancel, ["stop"])
|
|
223
|
+
}, {
|
|
224
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).cancel), 1 /* TEXT */)]),
|
|
225
|
+
_: 1 /* STABLE */
|
|
226
|
+
}), _createVNode(_unref(Button), {
|
|
227
|
+
type: "primary",
|
|
228
|
+
onClick: _withModifiers(onOk, ["stop"])
|
|
229
|
+
}, {
|
|
230
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).confirm), 1 /* TEXT */)]),
|
|
231
|
+
_: 1 /* STABLE */
|
|
232
|
+
})]),
|
|
233
|
+
_: 1 /* STABLE */
|
|
234
|
+
})])])) : _createCommentVNode("v-if", true)], 512 /* NEED_PATCH */)]),
|
|
235
|
+
_: 3 /* FORWARDED */
|
|
236
|
+
}), _createElementVNode("div", {
|
|
237
|
+
class: _normalizeClass(['jetlinks-drag-modal-range', 'drag-bottom-right']),
|
|
238
|
+
onMousedown: _cache[0] || (_cache[0] = _withModifiers($event => rangeMove($event, 'drag-bottom-right'), ["stop"]))
|
|
239
|
+
}, null, 32 /* NEED_HYDRATION */)], 6 /* CLASS, STYLE */);
|
|
189
240
|
};
|
|
190
241
|
}
|
|
191
|
-
});
|
|
242
|
+
});
|
|
243
|
+
export default __sfc_main__;
|
package/es/Ellipsis/Ellipsis.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { renderSlot as _renderSlot, mergeProps as _mergeProps, createElementVNode as _createElementVNode, unref as _unref, normalizeClass as _normalizeClass, withCtx as _withCtx, createSlots as _createSlots, openBlock as _openBlock, createBlock as _createBlock } from "vue";
|
|
3
|
+
import { computed, ref, useAttrs, mergeProps } from 'vue';
|
|
2
4
|
import { Tooltip } from 'ant-design-vue';
|
|
3
5
|
import useEllipsisStyle from './style';
|
|
4
6
|
const jEllipsis = 'j-ellipsis';
|
|
5
7
|
const jEllipsisCursorClass = 'j-ellipsis-cursor';
|
|
6
8
|
const jEllipsisLineClampClass = 'j-ellipsis-line-clamp';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Tooltip
|
|
9
|
+
const __sfc_main__ = _defineComponent({
|
|
10
|
+
...{
|
|
11
|
+
name: 'JEllipsis'
|
|
11
12
|
},
|
|
13
|
+
__name: 'Ellipsis',
|
|
12
14
|
props: {
|
|
13
15
|
expandTrigger: {
|
|
14
16
|
type: String,
|
|
@@ -24,7 +26,8 @@ export default defineComponent({
|
|
|
24
26
|
default: true
|
|
25
27
|
}
|
|
26
28
|
},
|
|
27
|
-
setup(
|
|
29
|
+
setup(__props) {
|
|
30
|
+
const props = __props;
|
|
28
31
|
const prefixCls = computed(() => 'j-ellipsis');
|
|
29
32
|
const [wrapSSR, hashId] = useEllipsisStyle(prefixCls);
|
|
30
33
|
|
|
@@ -127,18 +130,31 @@ export default defineComponent({
|
|
|
127
130
|
}
|
|
128
131
|
return tooltipDisabled;
|
|
129
132
|
};
|
|
130
|
-
return {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
133
|
+
return (_ctx, _cache) => {
|
|
134
|
+
return _openBlock(), _createBlock(_unref(Tooltip), _mergeProps({
|
|
135
|
+
ref_key: "tooltipRef",
|
|
136
|
+
ref: tooltipRef,
|
|
137
|
+
placement: "top"
|
|
138
|
+
}, __props.tooltip, {
|
|
139
|
+
open: visible.value && __props.tooltip !== false
|
|
140
|
+
}), _createSlots({
|
|
141
|
+
default: _withCtx(() => [_createElementVNode("span", _mergeProps({
|
|
142
|
+
ref_key: "triggerRef",
|
|
143
|
+
ref: triggerRef
|
|
144
|
+
}, triggerAttrs(), {
|
|
145
|
+
onClick: _cache[0] || (_cache[0] = $event => handleClickRef.value && handleClickRef.value()),
|
|
146
|
+
onMouseleave: _cache[1] || (_cache[1] = $event => visible.value = false),
|
|
147
|
+
onMouseenter: _cache[2] || (_cache[2] = $event => __props.expandTrigger === 'click' ? getTooltipDisabled() : showTooltip())
|
|
148
|
+
}), [_renderSlot(_ctx.$slots, "default")], 16 /* FULL_PROPS */)]),
|
|
149
|
+
_: 2 /* DYNAMIC */
|
|
150
|
+
}, [__props.tooltip ? {
|
|
151
|
+
name: "title",
|
|
152
|
+
fn: _withCtx(() => [_createElementVNode("div", {
|
|
153
|
+
class: _normalizeClass([jEllipsisLineClampClass, jEllipsis, 'j-ellipsis-deep', _unref(hashId)])
|
|
154
|
+
}, [_renderSlot(_ctx.$slots, "default"), _renderSlot(_ctx.$slots, "tooltip")], 2 /* CLASS */)]),
|
|
155
|
+
key: "0"
|
|
156
|
+
} : undefined]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["open"]);
|
|
142
157
|
};
|
|
143
158
|
}
|
|
144
|
-
});
|
|
159
|
+
});
|
|
160
|
+
export default __sfc_main__;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, unref as _unref, mergeProps as _mergeProps, withCtx as _withCtx, createSlots as _createSlots, openBlock as _openBlock, createBlock as _createBlock, normalizeProps as _normalizeProps, Fragment as _Fragment, createElementBlock as _createElementBlock, createVNode as _createVNode } from "vue";
|
|
3
|
+
import { computed, inject, toRefs } from 'vue';
|
|
2
4
|
import { Button, Tooltip, Modal } from 'ant-design-vue';
|
|
3
5
|
import { omit } from 'lodash-es';
|
|
4
6
|
import { buttonProps } from 'ant-design-vue/es/button/button';
|
|
@@ -6,39 +8,35 @@ import { usePermission } from '@meethive/hooks';
|
|
|
6
8
|
import confirm from './confirm';
|
|
7
9
|
import { PermissionButtonConfig } from '../utils/constants';
|
|
8
10
|
import { useLocaleReceiver } from '../LocaleReciver';
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
const __sfc_main__ = _defineComponent({
|
|
12
|
+
...{
|
|
13
|
+
name: 'JPermissionButton'
|
|
12
14
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
__name: 'PermissionButton',
|
|
16
|
+
props: {
|
|
17
|
+
tooltip: {
|
|
18
|
+
type: Object
|
|
19
|
+
},
|
|
20
|
+
popConfirm: {
|
|
21
|
+
type: Object
|
|
22
|
+
},
|
|
23
|
+
hasPermission: {
|
|
24
|
+
type: [String, Array, Boolean],
|
|
25
|
+
default: undefined
|
|
26
|
+
},
|
|
27
|
+
style: {
|
|
28
|
+
type: Object
|
|
29
|
+
},
|
|
30
|
+
noPermissionTitle: {
|
|
31
|
+
type: String
|
|
32
|
+
},
|
|
33
|
+
popConfirmBefore: {
|
|
34
|
+
type: Function
|
|
35
|
+
},
|
|
36
|
+
...omit(buttonProps(), 'icon')
|
|
15
37
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
default: undefined
|
|
19
|
-
},
|
|
20
|
-
style: {
|
|
21
|
-
type: Object
|
|
22
|
-
},
|
|
23
|
-
noPermissionTitle: {
|
|
24
|
-
type: String
|
|
25
|
-
},
|
|
26
|
-
popConfirmBefore: {
|
|
27
|
-
type: Function
|
|
28
|
-
},
|
|
29
|
-
...omit(buttonProps(), 'icon')
|
|
30
|
-
};
|
|
31
|
-
export default defineComponent({
|
|
32
|
-
name: 'JPermissionButton',
|
|
33
|
-
components: {
|
|
34
|
-
Button,
|
|
35
|
-
Tooltip
|
|
36
|
-
},
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
slots: ['button', 'icon'],
|
|
39
|
-
props: definedProps,
|
|
40
|
-
setup(props) {
|
|
41
|
-
const instance = getCurrentInstance();
|
|
38
|
+
setup(__props) {
|
|
39
|
+
const props = __props;
|
|
42
40
|
const propsRef = toRefs(props);
|
|
43
41
|
const {
|
|
44
42
|
hasPerm
|
|
@@ -61,6 +59,28 @@ export default defineComponent({
|
|
|
61
59
|
});
|
|
62
60
|
const hasTooltip = computed(() => !!props.tooltip); // 是否包含文字提示
|
|
63
61
|
|
|
62
|
+
// popConfirm 点击处理
|
|
63
|
+
const handleClick = async () => {
|
|
64
|
+
const _popConfirm = (await props.popConfirmBefore?.()) || props.popConfirm;
|
|
65
|
+
if (context.components) {
|
|
66
|
+
confirm({
|
|
67
|
+
..._popConfirm,
|
|
68
|
+
danger: props.danger
|
|
69
|
+
}, context.components);
|
|
70
|
+
} else {
|
|
71
|
+
Modal.confirm({
|
|
72
|
+
title: _popConfirm.title,
|
|
73
|
+
content: _popConfirm.content,
|
|
74
|
+
onOk: () => {
|
|
75
|
+
return _popConfirm.onConfirm?.();
|
|
76
|
+
},
|
|
77
|
+
onCancel: () => {
|
|
78
|
+
_popConfirm.onCancel?.();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
64
84
|
// 排除不传递给 Button 的属性 (与 ES 原版 _excluded 一致)
|
|
65
85
|
const computedButtonProps = computed(() => {
|
|
66
86
|
const {
|
|
@@ -83,36 +103,64 @@ export default defineComponent({
|
|
|
83
103
|
disabled: isPermission.value
|
|
84
104
|
});
|
|
85
105
|
});
|
|
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
|
-
|
|
106
|
+
return (_ctx, _cache) => {
|
|
107
|
+
return _openBlock(), _createElementBlock(_Fragment, null, [_createCommentVNode(" 有权限 "), permission.value ? (_openBlock(), _createElementBlock(_Fragment, {
|
|
108
|
+
key: 0
|
|
109
|
+
}, [_createCommentVNode(" 有 tooltip "), hasTooltip.value ? (_openBlock(), _createBlock(_unref(Tooltip), _normalizeProps(_mergeProps({
|
|
110
|
+
key: 0
|
|
111
|
+
}, tooltipProps.value)), {
|
|
112
|
+
default: _withCtx(() => [_ctx.$slots.button ? _renderSlot(_ctx.$slots, "button", {
|
|
113
|
+
key: 0
|
|
114
|
+
}) : (_openBlock(), _createBlock(_unref(Button), _mergeProps({
|
|
115
|
+
key: 1
|
|
116
|
+
}, computedButtonProps.value, {
|
|
117
|
+
disabled: isPermission.value
|
|
118
|
+
}), _createSlots({
|
|
119
|
+
default: _withCtx(() => [_renderSlot(_ctx.$slots, "default")]),
|
|
120
|
+
_: 2 /* DYNAMIC */
|
|
121
|
+
}, [_ctx.$slots.icon ? {
|
|
122
|
+
name: "icon",
|
|
123
|
+
fn: _withCtx(() => [_renderSlot(_ctx.$slots, "icon")]),
|
|
124
|
+
key: "0"
|
|
125
|
+
} : undefined]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["disabled"]))]),
|
|
126
|
+
_: 3 /* FORWARDED */
|
|
127
|
+
}, 16 /* FULL_PROPS */)) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
128
|
+
key: 1
|
|
129
|
+
}, [_createCommentVNode(" 无 tooltip "), _ctx.$slots.button ? _renderSlot(_ctx.$slots, "button", {
|
|
130
|
+
key: 0
|
|
131
|
+
}) : (_openBlock(), _createBlock(_unref(Button), _mergeProps({
|
|
132
|
+
key: 1
|
|
133
|
+
}, computedButtonProps.value, {
|
|
134
|
+
disabled: isPermission.value
|
|
135
|
+
}), _createSlots({
|
|
136
|
+
default: _withCtx(() => [_renderSlot(_ctx.$slots, "default")]),
|
|
137
|
+
_: 2 /* DYNAMIC */
|
|
138
|
+
}, [_ctx.$slots.icon ? {
|
|
139
|
+
name: "icon",
|
|
140
|
+
fn: _withCtx(() => [_renderSlot(_ctx.$slots, "icon")]),
|
|
141
|
+
key: "0"
|
|
142
|
+
} : undefined]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["disabled"]))], 64 /* STABLE_FRAGMENT */))], 64 /* STABLE_FRAGMENT */)) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
143
|
+
key: 1
|
|
144
|
+
}, [_createCommentVNode(" 无权限 "), _createVNode(_unref(Tooltip), {
|
|
145
|
+
title: _ctx.noPermissionTitle || _unref(contextLocale)?.hasPermission
|
|
146
|
+
}, {
|
|
147
|
+
default: _withCtx(() => [_ctx.$slots.button ? _renderSlot(_ctx.$slots, "button", {
|
|
148
|
+
key: 0
|
|
149
|
+
}) : (_openBlock(), _createBlock(_unref(Button), _mergeProps({
|
|
150
|
+
key: 1
|
|
151
|
+
}, computedButtonProps.value, {
|
|
152
|
+
disabled: isPermission.value
|
|
153
|
+
}), _createSlots({
|
|
154
|
+
default: _withCtx(() => [_renderSlot(_ctx.$slots, "default")]),
|
|
155
|
+
_: 2 /* DYNAMIC */
|
|
156
|
+
}, [_ctx.$slots.icon ? {
|
|
157
|
+
name: "icon",
|
|
158
|
+
fn: _withCtx(() => [_renderSlot(_ctx.$slots, "icon")]),
|
|
159
|
+
key: "0"
|
|
160
|
+
} : undefined]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["disabled"]))]),
|
|
161
|
+
_: 3 /* FORWARDED */
|
|
162
|
+
}, 8 /* PROPS */, ["title"])], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */))], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */);
|
|
116
163
|
};
|
|
117
164
|
}
|
|
118
|
-
});
|
|
165
|
+
});
|
|
166
|
+
export default __sfc_main__;
|
package/es/Scrollbar/Bar.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { createVNode as _createVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
3
|
+
import { inject, ref } from 'vue';
|
|
2
4
|
import { GAP } from './util';
|
|
3
5
|
import Thumb from './Thumb.js';
|
|
4
6
|
import { scrollbarContextKey } from './constants';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Thumb
|
|
7
|
+
const __sfc_main__ = _defineComponent({
|
|
8
|
+
...{
|
|
9
|
+
name: 'ScrollbarBar'
|
|
9
10
|
},
|
|
11
|
+
__name: 'Bar',
|
|
10
12
|
props: {
|
|
11
13
|
always: {
|
|
12
14
|
type: Boolean,
|
|
@@ -17,9 +19,10 @@ export default defineComponent({
|
|
|
17
19
|
required: true
|
|
18
20
|
}
|
|
19
21
|
},
|
|
20
|
-
setup(
|
|
21
|
-
expose
|
|
22
|
+
setup(__props, {
|
|
23
|
+
expose: __expose
|
|
22
24
|
}) {
|
|
25
|
+
const props = __props;
|
|
23
26
|
const scrollbar = inject(scrollbarContextKey);
|
|
24
27
|
const moveX = ref(0);
|
|
25
28
|
const moveY = ref(0);
|
|
@@ -49,17 +52,24 @@ export default defineComponent({
|
|
|
49
52
|
sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : '';
|
|
50
53
|
sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : '';
|
|
51
54
|
};
|
|
52
|
-
|
|
55
|
+
__expose({
|
|
53
56
|
handleScroll,
|
|
54
57
|
update
|
|
55
58
|
});
|
|
56
|
-
return {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
return (_ctx, _cache) => {
|
|
60
|
+
return _openBlock(), _createElementBlock(_Fragment, null, [_createVNode(Thumb, {
|
|
61
|
+
move: moveX.value,
|
|
62
|
+
ratio: ratioX.value,
|
|
63
|
+
size: sizeWidth.value,
|
|
64
|
+
always: __props.always
|
|
65
|
+
}, null, 8 /* PROPS */, ["move", "ratio", "size", "always"]), _createVNode(Thumb, {
|
|
66
|
+
move: moveY.value,
|
|
67
|
+
ratio: ratioY.value,
|
|
68
|
+
size: sizeHeight.value,
|
|
69
|
+
vertical: "",
|
|
70
|
+
always: __props.always
|
|
71
|
+
}, null, 8 /* PROPS */, ["move", "ratio", "size", "always"])], 64 /* STABLE_FRAGMENT */);
|
|
63
72
|
};
|
|
64
73
|
}
|
|
65
|
-
});
|
|
74
|
+
});
|
|
75
|
+
export default __sfc_main__;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, 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";
|
|
3
|
+
import { computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch } from 'vue';
|
|
2
4
|
import { useEventListener, useResizeObserver } from '@vueuse/core';
|
|
3
5
|
import { isNumber, isObject } from '@meethive/utils';
|
|
4
6
|
import Bar from './Bar.js';
|
|
@@ -6,17 +8,19 @@ import { scrollbarContextKey } from './constants';
|
|
|
6
8
|
import { scrollbarEmits, scrollbarProps } from './scrollbarProps';
|
|
7
9
|
import useScrollbarStyle from './style';
|
|
8
10
|
const COMPONENT_NAME = 'JScrollbar';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Bar
|
|
11
|
+
const __sfc_main__ = _defineComponent({
|
|
12
|
+
...{
|
|
13
|
+
name: COMPONENT_NAME
|
|
13
14
|
},
|
|
15
|
+
__name: 'Scrollbar',
|
|
14
16
|
props: scrollbarProps,
|
|
15
17
|
emits: scrollbarEmits,
|
|
16
|
-
setup(
|
|
17
|
-
expose,
|
|
18
|
-
emit
|
|
18
|
+
setup(__props, {
|
|
19
|
+
expose: __expose,
|
|
20
|
+
emit: __emit
|
|
19
21
|
}) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const emit = __emit;
|
|
20
24
|
const prefixCls = computed(() => 'j-scrollbar');
|
|
21
25
|
const [wrapSSR, hashId] = useScrollbarStyle(prefixCls);
|
|
22
26
|
let stopResizeObserver = undefined;
|
|
@@ -100,7 +104,7 @@ export default defineComponent({
|
|
|
100
104
|
});
|
|
101
105
|
});
|
|
102
106
|
onUpdated(() => update());
|
|
103
|
-
|
|
107
|
+
__expose({
|
|
104
108
|
/** @description scrollbar wrap ref */
|
|
105
109
|
wrapRef,
|
|
106
110
|
/** @description update scrollbar state manually */
|
|
@@ -114,16 +118,36 @@ export default defineComponent({
|
|
|
114
118
|
/** @description handle scroll event */
|
|
115
119
|
handleScroll
|
|
116
120
|
});
|
|
117
|
-
return {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
return (_ctx, _cache) => {
|
|
122
|
+
return _openBlock(), _createElementBlock("div", {
|
|
123
|
+
ref_key: "scrollbarRef",
|
|
124
|
+
ref: scrollbarRef,
|
|
125
|
+
class: _normalizeClass(['j-scrollbar', _unref(hashId)])
|
|
126
|
+
}, [_createElementVNode("div", {
|
|
127
|
+
ref_key: "wrapRef",
|
|
128
|
+
ref: wrapRef,
|
|
129
|
+
class: _normalizeClass(wrapKls.value),
|
|
130
|
+
style: _normalizeStyle(wrapStyle.value),
|
|
131
|
+
onScroll: handleScroll
|
|
132
|
+
}, [(_openBlock(), _createBlock(_resolveDynamicComponent(_ctx.tag), {
|
|
133
|
+
id: _ctx.id,
|
|
134
|
+
ref_key: "resizeRef",
|
|
135
|
+
ref: resizeRef,
|
|
136
|
+
class: _normalizeClass(resizeKls.value),
|
|
137
|
+
role: _ctx.role,
|
|
138
|
+
"aria-label": _ctx.ariaLabel,
|
|
139
|
+
"aria-orientation": _ctx.ariaOrientation
|
|
140
|
+
}, {
|
|
141
|
+
default: _withCtx(() => [_renderSlot(_ctx.$slots, "default")]),
|
|
142
|
+
_: 3 /* FORWARDED */
|
|
143
|
+
}, 8 /* PROPS */, ["id", "class", "role", "aria-label", "aria-orientation"]))], 38 /* CLASS, STYLE, NEED_HYDRATION */), !_ctx.native ? (_openBlock(), _createBlock(Bar, {
|
|
144
|
+
key: 0,
|
|
145
|
+
ref_key: "barRef",
|
|
146
|
+
ref: barRef,
|
|
147
|
+
always: _ctx.always,
|
|
148
|
+
"min-size": _ctx.minSize
|
|
149
|
+
}, null, 8 /* PROPS */, ["always", "min-size"])) : _createCommentVNode("v-if", true)], 2 /* CLASS */);
|
|
127
150
|
};
|
|
128
151
|
}
|
|
129
|
-
});
|
|
152
|
+
});
|
|
153
|
+
export default __sfc_main__;
|
package/es/Scrollbar/Thumb.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, vShow as _vShow, normalizeClass as _normalizeClass, withDirectives as _withDirectives, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
3
|
+
import { computed, inject, onBeforeUnmount, ref, toRef } from 'vue';
|
|
2
4
|
import { useEventListener } from '@vueuse/core';
|
|
3
5
|
import { isClient } from '@meethive/utils';
|
|
4
6
|
import { scrollbarContextKey } from './constants';
|
|
5
7
|
import { BAR_MAP, renderThumbStyle } from './util';
|
|
6
8
|
import { thumbProps } from './thumbProps';
|
|
7
9
|
import useScrollbarStyle from './style';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
const __sfc_main__ = _defineComponent({
|
|
11
|
+
...{
|
|
12
|
+
name: 'ScrollbarThumb'
|
|
13
|
+
},
|
|
14
|
+
__name: 'Thumb',
|
|
10
15
|
props: thumbProps,
|
|
11
|
-
setup(
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const props = __props;
|
|
12
18
|
const scrollbar = inject(scrollbarContextKey);
|
|
13
19
|
if (!scrollbar) throw new Error('can not inject scrollbar context');
|
|
14
20
|
const instance = ref();
|
|
@@ -87,15 +93,28 @@ export default defineComponent({
|
|
|
87
93
|
};
|
|
88
94
|
useEventListener(toRef(scrollbar, 'scrollbarElement'), 'mousemove', mouseMoveScrollbarHandler);
|
|
89
95
|
useEventListener(toRef(scrollbar, 'scrollbarElement'), 'mouseleave', mouseLeaveScrollbarHandler);
|
|
90
|
-
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
return (_ctx, _cache) => {
|
|
97
|
+
return _openBlock(), _createElementBlock("div", {
|
|
98
|
+
class: _normalizeClass([_unref(hashId)])
|
|
99
|
+
}, [_createVNode(_Transition, {
|
|
100
|
+
name: "j-scrollbar-fade",
|
|
101
|
+
persisted: ""
|
|
102
|
+
}, {
|
|
103
|
+
default: _withCtx(() => [_withDirectives(_createElementVNode("div", {
|
|
104
|
+
ref_key: "instance",
|
|
105
|
+
ref: instance,
|
|
106
|
+
class: _normalizeClass(['j-scrollbar__bar', props.vertical ? 'is-vertical' : 'is-horizontal']),
|
|
107
|
+
onMousedown: clickTrackHandler
|
|
108
|
+
}, [_createElementVNode("div", {
|
|
109
|
+
ref_key: "thumb",
|
|
110
|
+
ref: thumb,
|
|
111
|
+
class: "j-scrollbar__thumb",
|
|
112
|
+
style: _normalizeStyle(thumbStyle.value),
|
|
113
|
+
onMousedown: clickThumbHandler
|
|
114
|
+
}, null, 36 /* STYLE, NEED_HYDRATION */)], 34 /* CLASS, NEED_HYDRATION */), [[_vShow, _ctx.always || visible.value]])]),
|
|
115
|
+
_: 1 /* STABLE */
|
|
116
|
+
})], 2 /* CLASS */);
|
|
99
117
|
};
|
|
100
118
|
}
|
|
101
|
-
});
|
|
119
|
+
});
|
|
120
|
+
export default __sfc_main__;
|