@meethive/components 0.0.10 → 0.0.12
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/Ellipsis/Ellipsis.js +35 -19
- package/es/PermissionButton/PermissionButton.js +111 -63
- package/es/ProTable/Alert.js +30 -15
- package/es/ProTable/Content.js +118 -30
- package/es/ProTable/Header.js +47 -14
- package/es/ProTable/Pagination.js +25 -14
- package/es/ProTable/ProTable.js +77 -30
- package/es/Search/Item.js +70 -21
- package/es/Search/Search.js +81 -24
- package/lib/Ellipsis/Ellipsis.js +35 -19
- package/lib/PermissionButton/PermissionButton.js +111 -63
- package/lib/ProTable/Alert.js +30 -15
- package/lib/ProTable/Content.js +118 -30
- package/lib/ProTable/Header.js +47 -14
- package/lib/ProTable/Pagination.js +25 -14
- package/lib/ProTable/ProTable.js +77 -30
- package/lib/Search/Item.js +70 -21
- package/lib/Search/Search.js +81 -24
- package/package.json +1 -1
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/ProTable/Alert.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
3
|
+
import { computed } from 'vue';
|
|
2
4
|
import { Alert, Button } from 'ant-design-vue';
|
|
3
5
|
import { _alertProps } from './setting';
|
|
4
6
|
import { useLocaleReceiver } from '../LocaleReciver';
|
|
5
7
|
import useProTableStyle from './style';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Alert,
|
|
10
|
-
Button
|
|
8
|
+
const __sfc_main__ = _defineComponent({
|
|
9
|
+
...{
|
|
10
|
+
name: 'Alert'
|
|
11
11
|
},
|
|
12
|
+
__name: 'Alert',
|
|
12
13
|
props: {
|
|
13
14
|
..._alertProps
|
|
14
15
|
},
|
|
15
16
|
emits: ['close'],
|
|
16
|
-
setup(
|
|
17
|
-
emit
|
|
17
|
+
setup(__props, {
|
|
18
|
+
emit: __emit
|
|
18
19
|
}) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const emit = __emit;
|
|
19
22
|
const [contextLocale] = useLocaleReceiver('ProTable');
|
|
20
23
|
const prefixCls = computed(() => 'pro-table');
|
|
21
24
|
const [wrapSSR, hashId] = useProTableStyle(prefixCls);
|
|
22
|
-
const
|
|
25
|
+
const alertMessage = computed(() => {
|
|
23
26
|
let locale = contextLocale.value?.alert?.selectItem || '';
|
|
24
27
|
[props.rowSelection?.selectedRowKeys?.length || 0].forEach((item, index) => {
|
|
25
28
|
locale = locale.replace(`{${index}}`, item);
|
|
@@ -29,11 +32,23 @@ export default defineComponent({
|
|
|
29
32
|
const onClose = () => {
|
|
30
33
|
emit('close');
|
|
31
34
|
};
|
|
32
|
-
return {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
return (_ctx, _cache) => {
|
|
36
|
+
return _openBlock(), _createElementBlock("div", {
|
|
37
|
+
class: _normalizeClass(['jtable-alert', _unref(hashId)])
|
|
38
|
+
}, [_renderSlot(_ctx.$slots, "default", {}, () => [_createVNode(_unref(Alert), {
|
|
39
|
+
type: "info",
|
|
40
|
+
message: alertMessage.value
|
|
41
|
+
}, {
|
|
42
|
+
closeText: _withCtx(() => [_createVNode(_unref(Button), {
|
|
43
|
+
type: "link",
|
|
44
|
+
onClick: onClose
|
|
45
|
+
}, {
|
|
46
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).alert?.cancelChoose), 1 /* TEXT */)]),
|
|
47
|
+
_: 1 /* STABLE */
|
|
48
|
+
})]),
|
|
49
|
+
_: 1 /* STABLE */
|
|
50
|
+
}, 8 /* PROPS */, ["message"])])], 2 /* CLASS */);
|
|
37
51
|
};
|
|
38
52
|
}
|
|
39
|
-
});
|
|
53
|
+
});
|
|
54
|
+
export default __sfc_main__;
|
package/es/ProTable/Content.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, renderList as _renderList, Fragment as _Fragment, mergeProps as _mergeProps, renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, createSlots as _createSlots, createBlock as _createBlock } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "jtable-card"
|
|
6
|
+
};
|
|
7
|
+
const _hoisted_2 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
style: {
|
|
10
|
+
"margin-bottom": "10px"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_3 = ["onClick"];
|
|
14
|
+
const _hoisted_4 = {
|
|
15
|
+
key: 2,
|
|
16
|
+
class: "j-table-empty"
|
|
17
|
+
};
|
|
18
|
+
import { computed, useSlots } from 'vue';
|
|
2
19
|
import { Table, Checkbox as ACheckbox } from 'ant-design-vue';
|
|
3
20
|
import { get, omit } from 'lodash-es';
|
|
4
21
|
import Empty from '../Empty';
|
|
@@ -7,14 +24,11 @@ import useProTableStyle from './style';
|
|
|
7
24
|
import { useLocaleReceiver } from '../LocaleReciver';
|
|
8
25
|
import JVirtualTable from '../VirtualTable';
|
|
9
26
|
import { _contentProps } from './setting';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Table,
|
|
14
|
-
ACheckbox,
|
|
15
|
-
Empty,
|
|
16
|
-
JVirtualTable
|
|
27
|
+
const __sfc_main__ = _defineComponent({
|
|
28
|
+
...{
|
|
29
|
+
name: 'Content'
|
|
17
30
|
},
|
|
31
|
+
__name: 'Content',
|
|
18
32
|
props: {
|
|
19
33
|
..._contentProps,
|
|
20
34
|
column: {
|
|
@@ -22,17 +36,18 @@ export default defineComponent({
|
|
|
22
36
|
default: 4
|
|
23
37
|
}
|
|
24
38
|
},
|
|
25
|
-
setup(
|
|
39
|
+
setup(__props) {
|
|
40
|
+
const props = __props;
|
|
26
41
|
const slots = useSlots();
|
|
27
42
|
const [contextLocale] = useLocaleReceiver('ProTable');
|
|
28
43
|
const prefixCls = computed(() => 'pro-table');
|
|
29
44
|
const [wrapSSR, hashId] = useProTableStyle(prefixCls);
|
|
30
45
|
const _rowSelection = useTableInject();
|
|
31
|
-
const
|
|
32
|
-
const
|
|
46
|
+
const tableColumns = computed(() => props.columns.filter(i => !i?.hideInTable));
|
|
47
|
+
const tableSlots = computed(() => {
|
|
33
48
|
return omit(slots, ['emptyText', 'bodyCell']);
|
|
34
49
|
});
|
|
35
|
-
const
|
|
50
|
+
const tableScroll = computed(() => {
|
|
36
51
|
if (props.scroll === false) {
|
|
37
52
|
return {
|
|
38
53
|
x: undefined,
|
|
@@ -47,14 +62,14 @@ export default defineComponent({
|
|
|
47
62
|
const gridTemplateColumns = computed(() => {
|
|
48
63
|
return `repeat(${props.column}, 1fr)`;
|
|
49
64
|
});
|
|
50
|
-
const
|
|
65
|
+
const mergedRowSelection = computed(() => {
|
|
51
66
|
return props.rowSelection || _rowSelection?.value;
|
|
52
67
|
});
|
|
53
68
|
const indeterminate = computed(() => {
|
|
54
|
-
return
|
|
69
|
+
return mergedRowSelection.value?.selectedRowKeys?.length > 0 && mergedRowSelection.value?.selectedRowKeys?.length < props.dataSource.length;
|
|
55
70
|
});
|
|
56
71
|
const checkedAll = computed(() => {
|
|
57
|
-
return
|
|
72
|
+
return mergedRowSelection.value?.selectedRowKeys?.length > 0 && mergedRowSelection.value?.selectedRowKeys?.length === props.dataSource.length;
|
|
58
73
|
});
|
|
59
74
|
const onClick = item => {
|
|
60
75
|
if (_rowSelection && _rowSelection.value) {
|
|
@@ -64,21 +79,94 @@ export default defineComponent({
|
|
|
64
79
|
};
|
|
65
80
|
const handleCheckedAllChange = e => {
|
|
66
81
|
const flag = e.target.checked;
|
|
67
|
-
|
|
82
|
+
mergedRowSelection.value?.onSelectAll?.(flag, props.dataSource, props.dataSource);
|
|
68
83
|
};
|
|
69
|
-
return {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
return (_ctx, _cache) => {
|
|
85
|
+
return _openBlock(), _createElementBlock("div", {
|
|
86
|
+
class: _normalizeClass(['jtable-box', _unref(hashId)])
|
|
87
|
+
}, [_createCommentVNode(" 卡片模式 "), _ctx.mode === 'CARD' ? (_openBlock(), _createElementBlock("div", _hoisted_1, [mergedRowSelection.value && mergedRowSelection.value.type === 'checkbox' ? (_openBlock(), _createElementBlock("div", _hoisted_2, [_createVNode(_unref(ACheckbox), {
|
|
88
|
+
indeterminate: indeterminate.value,
|
|
89
|
+
checked: checkedAll.value,
|
|
90
|
+
onChange: handleCheckedAllChange
|
|
91
|
+
}, {
|
|
92
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).select.all), 1 /* TEXT */)]),
|
|
93
|
+
_: 1 /* STABLE */
|
|
94
|
+
}, 8 /* PROPS */, ["indeterminate", "checked"])])) : _createCommentVNode("v-if", true), _ctx.dataSource.length ? (_openBlock(), _createElementBlock("div", {
|
|
95
|
+
key: 1,
|
|
96
|
+
class: "jtable-card-items",
|
|
97
|
+
style: _normalizeStyle({
|
|
98
|
+
gridTemplateColumns: gridTemplateColumns.value
|
|
99
|
+
})
|
|
100
|
+
}, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.dataSource, item => {
|
|
101
|
+
return _openBlock(), _createElementBlock("div", {
|
|
102
|
+
key: item[_ctx.rowKey],
|
|
103
|
+
class: _normalizeClass(['jtable-card-item', _ctx.cardBodyClass]),
|
|
104
|
+
onClick: $event => onClick(item)
|
|
105
|
+
}, [_renderSlot(_ctx.$slots, "card", _mergeProps({
|
|
106
|
+
ref_for: true
|
|
107
|
+
}, item))], 10 /* CLASS, PROPS */, _hoisted_3);
|
|
108
|
+
}), 128 /* KEYED_FRAGMENT */))], 4 /* STYLE */)) : (_openBlock(), _createElementBlock("div", _hoisted_4, [_renderSlot(_ctx.$slots, "emptyText", {}, () => [_createVNode(_unref(Empty))])]))])) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
109
|
+
key: 1
|
|
110
|
+
}, [_createCommentVNode(" 表格模式 "), _createCommentVNode(" 虚拟表格模式 "), _ctx.type === 'TREE' ? (_openBlock(), _createBlock(_unref(JVirtualTable), {
|
|
111
|
+
key: 0,
|
|
112
|
+
rowKey: _ctx.rowKey,
|
|
113
|
+
"row-selection": mergedRowSelection.value,
|
|
114
|
+
dataSource: _ctx.dataSource,
|
|
115
|
+
columns: tableColumns.value,
|
|
116
|
+
height: _ctx.height
|
|
117
|
+
}, _createSlots({
|
|
118
|
+
bodyCell: _withCtx(({
|
|
119
|
+
column: col,
|
|
120
|
+
record,
|
|
121
|
+
index
|
|
122
|
+
}) => [(col?.key || col?.dataIndex) && col?.scopedSlots && (tableSlots.value[col?.dataIndex] || tableSlots.value[col?.key]) ? _renderSlot(_ctx.$slots, col?.key || col?.dataIndex, _mergeProps({
|
|
123
|
+
key: 0
|
|
124
|
+
}, record, {
|
|
125
|
+
index: index,
|
|
126
|
+
column: col
|
|
127
|
+
})) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
128
|
+
key: 1
|
|
129
|
+
}, [_createTextVNode(_toDisplayString(_unref(get)(record, col?.dataIndex || col?.key) || '--'), 1 /* TEXT */)], 64 /* STABLE_FRAGMENT */))]),
|
|
130
|
+
emptyText: _withCtx(() => [_renderSlot(_ctx.$slots, "emptyText", {}, () => [_createVNode(_unref(Empty))])]),
|
|
131
|
+
_: 2 /* DYNAMIC */
|
|
132
|
+
}, [_renderList(tableSlots.value, (_, slotKey) => {
|
|
133
|
+
return {
|
|
134
|
+
name: slotKey,
|
|
135
|
+
fn: _withCtx(slotProps => [_renderSlot(_ctx.$slots, slotKey, _normalizeProps(_guardReactiveProps(slotProps)))])
|
|
136
|
+
};
|
|
137
|
+
})]), 1032 /* PROPS, DYNAMIC_SLOTS */, ["rowKey", "row-selection", "dataSource", "columns", "height"])) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
138
|
+
key: 1
|
|
139
|
+
}, [_createCommentVNode(" 普通表格模式 "), _createVNode(_unref(Table), _mergeProps(props, {
|
|
140
|
+
"row-selection": mergedRowSelection.value,
|
|
141
|
+
dataSource: _ctx.dataSource,
|
|
142
|
+
columns: tableColumns.value,
|
|
143
|
+
pagination: false,
|
|
144
|
+
scroll: tableScroll.value,
|
|
145
|
+
class: {
|
|
146
|
+
'j-table-scroll': !_ctx.scroll?.y
|
|
147
|
+
}
|
|
148
|
+
}), _createSlots({
|
|
149
|
+
bodyCell: _withCtx(({
|
|
150
|
+
column: col,
|
|
151
|
+
record,
|
|
152
|
+
index
|
|
153
|
+
}) => [(col?.key || col?.dataIndex) && col?.scopedSlots && (tableSlots.value[col?.dataIndex] || tableSlots.value[col?.key]) ? _renderSlot(_ctx.$slots, col?.key || col?.dataIndex, _mergeProps({
|
|
154
|
+
key: 0
|
|
155
|
+
}, record, {
|
|
156
|
+
index: index,
|
|
157
|
+
column: col
|
|
158
|
+
})) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
159
|
+
key: 1
|
|
160
|
+
}, [_createTextVNode(_toDisplayString(_unref(get)(record, col?.dataIndex || col?.key) || '--'), 1 /* TEXT */)], 64 /* STABLE_FRAGMENT */))]),
|
|
161
|
+
emptyText: _withCtx(() => [_renderSlot(_ctx.$slots, "emptyText", {}, () => [_createVNode(_unref(Empty))])]),
|
|
162
|
+
_: 2 /* DYNAMIC */
|
|
163
|
+
}, [_renderList(tableSlots.value, (_, slotKey) => {
|
|
164
|
+
return {
|
|
165
|
+
name: slotKey,
|
|
166
|
+
fn: _withCtx(slotProps => [_renderSlot(_ctx.$slots, slotKey, _normalizeProps(_guardReactiveProps(slotProps)))])
|
|
167
|
+
};
|
|
168
|
+
})]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["row-selection", "dataSource", "columns", "scroll", "class"])], 2112 /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */))], 64 /* STABLE_FRAGMENT */))], 2 /* CLASS */);
|
|
82
169
|
};
|
|
83
170
|
}
|
|
84
|
-
});
|
|
171
|
+
});
|
|
172
|
+
export default __sfc_main__;
|
package/es/ProTable/Header.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
class: "jtable-body-header-left"
|
|
5
|
+
};
|
|
6
|
+
const _hoisted_2 = {
|
|
7
|
+
class: "jtable-body-header-right"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_3 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "table-body-header-right-button"
|
|
12
|
+
};
|
|
13
|
+
import { computed } from 'vue';
|
|
2
14
|
import { RadioGroup, RadioButton } from 'ant-design-vue';
|
|
3
15
|
import AIcon from '../Icon';
|
|
4
16
|
import { _headerProps } from './setting';
|
|
5
17
|
import useProTableStyle from './style';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
RadioGroup,
|
|
10
|
-
RadioButton,
|
|
11
|
-
AIcon
|
|
18
|
+
const __sfc_main__ = _defineComponent({
|
|
19
|
+
...{
|
|
20
|
+
name: 'Header'
|
|
12
21
|
},
|
|
22
|
+
__name: 'Header',
|
|
13
23
|
props: {
|
|
14
24
|
..._headerProps,
|
|
15
25
|
initMode: {
|
|
@@ -18,15 +28,38 @@ export default defineComponent({
|
|
|
18
28
|
}
|
|
19
29
|
},
|
|
20
30
|
emits: ['change'],
|
|
21
|
-
setup(
|
|
22
|
-
emit
|
|
31
|
+
setup(__props, {
|
|
32
|
+
emit: __emit
|
|
23
33
|
}) {
|
|
24
|
-
const
|
|
34
|
+
const props = __props;
|
|
35
|
+
const emit = __emit;
|
|
25
36
|
const prefixCls = computed(() => 'pro-table');
|
|
26
37
|
const [wrapSSR, hashId] = useProTableStyle(prefixCls);
|
|
27
|
-
return {
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
return (_ctx, _cache) => {
|
|
39
|
+
return _openBlock(), _createElementBlock("div", {
|
|
40
|
+
class: _normalizeClass(['jtable-body-header', _unref(hashId)])
|
|
41
|
+
}, [_createElementVNode("div", _hoisted_1, [_renderSlot(_ctx.$slots, "headerLeftRender")]), _createElementVNode("div", _hoisted_2, [_renderSlot(_ctx.$slots, "headerRightRender"), !__props.initMode ? (_openBlock(), _createElementBlock("div", _hoisted_3, [_createVNode(_unref(RadioGroup), {
|
|
42
|
+
value: _ctx.mode,
|
|
43
|
+
onChange: _cache[0] || (_cache[0] = e => emit('change', e))
|
|
44
|
+
}, {
|
|
45
|
+
default: _withCtx(() => [_createVNode(_unref(RadioButton), {
|
|
46
|
+
value: "TABLE"
|
|
47
|
+
}, {
|
|
48
|
+
default: _withCtx(() => [_createVNode(_unref(AIcon), {
|
|
49
|
+
type: "UnorderedListOutlined"
|
|
50
|
+
})]),
|
|
51
|
+
_: 1 /* STABLE */
|
|
52
|
+
}), _createVNode(_unref(RadioButton), {
|
|
53
|
+
value: "CARD"
|
|
54
|
+
}, {
|
|
55
|
+
default: _withCtx(() => [_createVNode(_unref(AIcon), {
|
|
56
|
+
type: "AppstoreOutlined"
|
|
57
|
+
})]),
|
|
58
|
+
_: 1 /* STABLE */
|
|
59
|
+
})]),
|
|
60
|
+
_: 1 /* STABLE */
|
|
61
|
+
}, 8 /* PROPS */, ["value"])])) : _createCommentVNode("v-if", true)])], 2 /* CLASS */);
|
|
30
62
|
};
|
|
31
63
|
}
|
|
32
|
-
});
|
|
64
|
+
});
|
|
65
|
+
export default __sfc_main__;
|