@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,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/lib/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__;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, createElementBlock as _createElementBlock, renderSlot as _renderSlot, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeStyle as _normalizeStyle, Fragment as _Fragment, normalizeClass as _normalizeClass } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
class: "virtual-table-header"
|
|
5
|
+
};
|
|
6
|
+
const _hoisted_2 = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "virtual-table-all-selected"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_3 = ["onClick"];
|
|
11
|
+
import { computed, ref, watch, onMounted, nextTick, h } from 'vue';
|
|
2
12
|
import { Table, Checkbox } from 'ant-design-vue';
|
|
3
13
|
import { isNumber, map, omit } from 'lodash-es';
|
|
4
14
|
import AIcon from '../Icon';
|
|
@@ -6,13 +16,11 @@ import useVirtualTableStyle from './style';
|
|
|
6
16
|
import { useLocaleReceiver } from '../LocaleReciver';
|
|
7
17
|
import { findAllChildren, flattenTree } from './data';
|
|
8
18
|
const buffer = 5;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Table,
|
|
13
|
-
Checkbox,
|
|
14
|
-
AIcon
|
|
19
|
+
const __sfc_main__ = _defineComponent({
|
|
20
|
+
...{
|
|
21
|
+
name: 'JVirtualTable'
|
|
15
22
|
},
|
|
23
|
+
__name: 'VirtualTable',
|
|
16
24
|
props: {
|
|
17
25
|
dataSource: {
|
|
18
26
|
type: Array,
|
|
@@ -27,7 +35,7 @@ export default defineComponent({
|
|
|
27
35
|
default: () => []
|
|
28
36
|
},
|
|
29
37
|
rowSelection: {
|
|
30
|
-
type:
|
|
38
|
+
type: Object
|
|
31
39
|
},
|
|
32
40
|
rowKey: {
|
|
33
41
|
type: [String, Function],
|
|
@@ -39,9 +47,11 @@ export default defineComponent({
|
|
|
39
47
|
}
|
|
40
48
|
},
|
|
41
49
|
emits: ['update:expandedRowKeys'],
|
|
42
|
-
setup(
|
|
43
|
-
emit
|
|
50
|
+
setup(__props, {
|
|
51
|
+
emit: __emit
|
|
44
52
|
}) {
|
|
53
|
+
const props = __props;
|
|
54
|
+
const emits = __emit;
|
|
45
55
|
const prefixCls = computed(() => 'virtual-table');
|
|
46
56
|
const [wrapSSR, hashId] = useVirtualTableStyle(prefixCls);
|
|
47
57
|
const [contextLocale] = useLocaleReceiver('ProTable');
|
|
@@ -214,22 +224,93 @@ export default defineComponent({
|
|
|
214
224
|
onMounted(() => {
|
|
215
225
|
updateVisibleNodes();
|
|
216
226
|
});
|
|
217
|
-
return {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
227
|
+
return (_ctx, _cache) => {
|
|
228
|
+
return _openBlock(), _createElementBlock("div", {
|
|
229
|
+
class: _normalizeClass(['virtual-table-wrapper', _unref(hashId)])
|
|
230
|
+
}, [_createElementVNode("div", _hoisted_1, [_createVNode(_unref(Table), {
|
|
231
|
+
columns: _columns.value,
|
|
232
|
+
pagination: false,
|
|
233
|
+
rowKey: __props.rowKey,
|
|
234
|
+
"data-source": [],
|
|
235
|
+
components: {
|
|
236
|
+
body: {
|
|
237
|
+
wrapper: () => h('div')
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}, {
|
|
241
|
+
headerCell: _withCtx(({
|
|
242
|
+
column,
|
|
243
|
+
title
|
|
244
|
+
}) => [column.key === '__selection__' ? (_openBlock(), _createElementBlock("span", _hoisted_2, [__props.rowSelection?.type !== 'radio' && !__props.rowSelection?.hideSelectAll ? (_openBlock(), _createBlock(_unref(Checkbox), {
|
|
245
|
+
key: 0,
|
|
246
|
+
checked: selectedAll.value,
|
|
247
|
+
"onUpdate:checked": _cache[0] || (_cache[0] = $event => selectedAll.value = $event),
|
|
248
|
+
onChange: onSelectedAllChange,
|
|
249
|
+
indeterminate: _indeterminate.value,
|
|
250
|
+
disabled: visibleRows.value.length === 0
|
|
251
|
+
}, null, 8 /* PROPS */, ["checked", "indeterminate", "disabled"])) : _createCommentVNode("v-if", true), _createElementVNode("span", null, _toDisplayString(__props.rowSelection?.columnTitle), 1 /* TEXT */)])) : _renderSlot(_ctx.$slots, "headerCell", {
|
|
252
|
+
key: 1,
|
|
253
|
+
title: title,
|
|
254
|
+
column: column
|
|
255
|
+
}, () => [_createTextVNode(_toDisplayString(title), 1 /* TEXT */)])]),
|
|
256
|
+
_: 3 /* FORWARDED */
|
|
257
|
+
}, 8 /* PROPS */, ["columns", "rowKey", "components"])]), _createElementVNode("div", {
|
|
258
|
+
class: "virtual-table-body",
|
|
259
|
+
ref_key: "container",
|
|
260
|
+
ref: container,
|
|
261
|
+
onScroll: onScroll,
|
|
262
|
+
style: _normalizeStyle({
|
|
263
|
+
height: `${viewportHeight.value}px`
|
|
264
|
+
})
|
|
265
|
+
}, [_createElementVNode("div", {
|
|
266
|
+
class: "virtual-table-height",
|
|
267
|
+
style: _normalizeStyle({
|
|
268
|
+
height: totalHeight.value + 'px'
|
|
269
|
+
})
|
|
270
|
+
}, null, 4 /* STYLE */), _createElementVNode("div", {
|
|
271
|
+
class: "virtual-table-visible-box",
|
|
272
|
+
style: _normalizeStyle({
|
|
273
|
+
transform: `translateY(${offsetY.value}px)`,
|
|
274
|
+
position: 'absolute',
|
|
275
|
+
top: 0,
|
|
276
|
+
left: 0,
|
|
277
|
+
right: 0
|
|
278
|
+
})
|
|
279
|
+
}, [_createVNode(_unref(Table), {
|
|
280
|
+
columns: __props.columns,
|
|
281
|
+
rowKey: __props.rowKey,
|
|
282
|
+
"data-source": visibleRows.value,
|
|
283
|
+
showHeader: false,
|
|
284
|
+
pagination: false,
|
|
285
|
+
rowSelection: _rowSelection.value
|
|
286
|
+
}, {
|
|
287
|
+
bodyCell: _withCtx(({
|
|
288
|
+
text,
|
|
289
|
+
record,
|
|
290
|
+
index,
|
|
291
|
+
column
|
|
292
|
+
}) => [column.dataIndex === firstColumn.value?.dataIndex || column.key === firstColumn.value?.key ? (_openBlock(), _createElementBlock(_Fragment, {
|
|
293
|
+
key: 0
|
|
294
|
+
}, [_createElementVNode("span", {
|
|
295
|
+
class: "ant-table-row-indent indent-level-3",
|
|
296
|
+
style: _normalizeStyle({
|
|
297
|
+
paddingLeft: `${record.level * 15}px`
|
|
298
|
+
})
|
|
299
|
+
}, null, 4 /* STYLE */), _createElementVNode("span", {
|
|
300
|
+
class: "virtual-table-row-expand-icon",
|
|
301
|
+
onClick: $event => toggleExpand(record)
|
|
302
|
+
}, [record.hasChildren ? (_openBlock(), _createBlock(_unref(AIcon), {
|
|
303
|
+
key: 0,
|
|
304
|
+
type: !record.expanded ? 'PlusSquareOutlined' : 'MinusSquareOutlined'
|
|
305
|
+
}, null, 8 /* PROPS */, ["type"])) : _createCommentVNode("v-if", true)], 8 /* PROPS */, _hoisted_3)], 64 /* STABLE_FRAGMENT */)) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "bodyCell", {
|
|
306
|
+
text: text,
|
|
307
|
+
record: record,
|
|
308
|
+
index: index,
|
|
309
|
+
column: column
|
|
310
|
+
}, () => [_createTextVNode(_toDisplayString(text || '--'), 1 /* TEXT */)])]),
|
|
311
|
+
_: 3 /* FORWARDED */
|
|
312
|
+
}, 8 /* PROPS */, ["columns", "rowKey", "data-source", "rowSelection"])], 4 /* STYLE */)], 36 /* STYLE, NEED_HYDRATION */)], 2 /* CLASS */);
|
|
233
313
|
};
|
|
234
314
|
}
|
|
235
|
-
});
|
|
315
|
+
});
|
|
316
|
+
export default __sfc_main__;
|