@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,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__;
|
|
@@ -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/lib/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/lib/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__;
|