@meethive/components 0.0.10 → 0.0.11
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/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/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/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__;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, renderSlot as _renderSlot, mergeProps as _mergeProps, createVNode as _createVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
3
|
+
import { computed, h } from 'vue';
|
|
2
4
|
import { Pagination, Spin } from 'ant-design-vue';
|
|
3
5
|
import { _paginationProps } from './setting';
|
|
4
6
|
import { useLocaleReceiver } from '../LocaleReciver';
|
|
5
7
|
import useProTableStyle from './style';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Pagination
|
|
8
|
+
const __sfc_main__ = _defineComponent({
|
|
9
|
+
...{
|
|
10
|
+
name: 'JPagination'
|
|
10
11
|
},
|
|
12
|
+
__name: 'Pagination',
|
|
11
13
|
props: {
|
|
12
14
|
..._paginationProps
|
|
13
15
|
},
|
|
14
16
|
emits: ['change'],
|
|
15
|
-
setup(
|
|
16
|
-
emit
|
|
17
|
+
setup(__props, {
|
|
18
|
+
emit: __emit
|
|
17
19
|
}) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const emit = __emit;
|
|
18
22
|
const [contextLocale] = useLocaleReceiver('ProTable');
|
|
19
23
|
const prefixCls = computed(() => 'pro-table');
|
|
20
24
|
const [wrapSSR, hashId] = useProTableStyle(prefixCls);
|
|
@@ -23,7 +27,7 @@ export default defineComponent({
|
|
|
23
27
|
'hide-content': !props.isShowContent
|
|
24
28
|
};
|
|
25
29
|
});
|
|
26
|
-
const
|
|
30
|
+
const showTotal = num => {
|
|
27
31
|
const minSize = props.pageIndex * props.pageSize + 1;
|
|
28
32
|
const MaxSize = (props.pageIndex + 1) * props.pageSize;
|
|
29
33
|
let localePage = contextLocale.value.pagination?.page || '';
|
|
@@ -46,11 +50,18 @@ export default defineComponent({
|
|
|
46
50
|
const onChange = (page, size) => {
|
|
47
51
|
emit('change', page, size);
|
|
48
52
|
};
|
|
49
|
-
return {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
return (_ctx, _cache) => {
|
|
54
|
+
return _openBlock(), _createElementBlock("div", {
|
|
55
|
+
class: _normalizeClass(['jtable-pagination', _unref(hashId)])
|
|
56
|
+
}, [_renderSlot(_ctx.$slots, "default", {}, () => [_createVNode(_unref(Pagination), _mergeProps(props, {
|
|
57
|
+
total: _ctx.total,
|
|
58
|
+
pageSize: _ctx.pageSize,
|
|
59
|
+
current: _ctx.pageIndex + 1,
|
|
60
|
+
"show-total": num => showTotal(num),
|
|
61
|
+
class: className.value,
|
|
62
|
+
onChange: onChange
|
|
63
|
+
}), null, 16 /* FULL_PROPS */, ["total", "pageSize", "current", "show-total", "class"])])], 2 /* CLASS */);
|
|
54
64
|
};
|
|
55
65
|
}
|
|
56
|
-
});
|
|
66
|
+
});
|
|
67
|
+
export default __sfc_main__;
|
package/es/ProTable/ProTable.js
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, renderSlot as _renderSlot, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, normalizeProps as _normalizeProps, mergeProps as _mergeProps, renderList as _renderList, createSlots as _createSlots, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementBlock as _createElementBlock } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
class: "jtable-body"
|
|
5
|
+
};
|
|
6
|
+
import { useSlots, watch, onMounted, onUnmounted, computed, ref, reactive, inject } from 'vue';
|
|
2
7
|
import { Spin } from 'ant-design-vue';
|
|
3
8
|
import { debounce } from 'lodash-es';
|
|
4
9
|
import Header from './Header.js';
|
|
5
10
|
import Alert from './Alert.js';
|
|
6
11
|
import Content from './Content.js';
|
|
7
|
-
import
|
|
12
|
+
import Pagination from './Pagination.js';
|
|
8
13
|
import { proTableProps } from './setting';
|
|
9
14
|
import { TableConfig } from '../utils/constants';
|
|
10
15
|
import { useTableInject } from './hooks';
|
|
11
16
|
import useProTableStyle from './style';
|
|
12
17
|
import { onlyMessage } from '@meethive/utils';
|
|
13
18
|
import { useLocaleReceiver } from '../LocaleReciver';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Spin,
|
|
18
|
-
Header,
|
|
19
|
-
Alert,
|
|
20
|
-
Content,
|
|
21
|
-
JPagination
|
|
19
|
+
const __sfc_main__ = _defineComponent({
|
|
20
|
+
...{
|
|
21
|
+
name: 'JProTable'
|
|
22
22
|
},
|
|
23
|
+
__name: 'ProTable',
|
|
23
24
|
props: {
|
|
24
25
|
...proTableProps
|
|
25
26
|
},
|
|
26
|
-
setup(
|
|
27
|
-
expose
|
|
27
|
+
setup(__props, {
|
|
28
|
+
expose: __expose
|
|
28
29
|
}) {
|
|
30
|
+
const props = __props;
|
|
29
31
|
const tableConfig = inject(TableConfig, {
|
|
30
32
|
pagination: {}
|
|
31
33
|
});
|
|
@@ -234,26 +236,71 @@ export default defineComponent({
|
|
|
234
236
|
onUnmounted(() => {
|
|
235
237
|
window.onresize = null;
|
|
236
238
|
});
|
|
237
|
-
|
|
239
|
+
__expose({
|
|
238
240
|
reload,
|
|
239
241
|
dataSource: _dataSource
|
|
240
242
|
});
|
|
241
|
-
return {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
243
|
+
return (_ctx, _cache) => {
|
|
244
|
+
return _openBlock(), _createElementBlock("div", {
|
|
245
|
+
class: _normalizeClass(['jtable-body-spin', _unref(hashId)]),
|
|
246
|
+
style: _normalizeStyle(_ctx.bodyStyle),
|
|
247
|
+
id: "jtable-body-spin"
|
|
248
|
+
}, [_createVNode(_unref(Spin), {
|
|
249
|
+
spinning: loading.value
|
|
250
|
+
}, {
|
|
251
|
+
default: _withCtx(() => [_createElementVNode("div", _hoisted_1, [_createVNode(Header, {
|
|
252
|
+
initMode: _ctx.mode,
|
|
253
|
+
mode: _mode.value,
|
|
254
|
+
modeValue: _ctx.modeValue,
|
|
255
|
+
onChange: onCheck
|
|
256
|
+
}, {
|
|
257
|
+
headerLeftRender: _withCtx(() => [_renderSlot(_ctx.$slots, "headerLeftRender")]),
|
|
258
|
+
headerRightRender: _withCtx(() => [_renderSlot(_ctx.$slots, "headerRightRender")]),
|
|
259
|
+
_: 3 /* FORWARDED */
|
|
260
|
+
}, 8 /* PROPS */, ["initMode", "mode", "modeValue"]), showAlert.value ? (_openBlock(), _createBlock(Alert, {
|
|
261
|
+
key: 0,
|
|
262
|
+
rowSelection: _ctx.rowSelection || _unref(_rowSelection),
|
|
263
|
+
onClose: onClose
|
|
264
|
+
}, {
|
|
265
|
+
default: _withCtx(() => [_renderSlot(_ctx.$slots, "alertRender", {
|
|
266
|
+
rowSelection: _ctx.rowSelection || _unref(_rowSelection),
|
|
267
|
+
onClose: onClose
|
|
268
|
+
})]),
|
|
269
|
+
_: 3 /* FORWARDED */
|
|
270
|
+
}, 8 /* PROPS */, ["rowSelection"])) : _createCommentVNode("v-if", true), _createVNode(Content, _mergeProps(props, {
|
|
271
|
+
mode: _mode.value,
|
|
272
|
+
dataSource: _dataSource.value,
|
|
273
|
+
column: column.value
|
|
274
|
+
}), _createSlots({
|
|
275
|
+
_: 2 /* DYNAMIC */
|
|
276
|
+
}, [_renderList(_unref(slots), (_, key) => {
|
|
277
|
+
return {
|
|
278
|
+
name: key,
|
|
279
|
+
fn: _withCtx(slotProps => [!extraSlots.includes(key) ? _renderSlot(_ctx.$slots, key, _normalizeProps(_mergeProps({
|
|
280
|
+
key: 0
|
|
281
|
+
}, slotProps))) : _createCommentVNode("v-if", true)])
|
|
282
|
+
};
|
|
283
|
+
})]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["mode", "dataSource", "column"]), showPagination.value ? (_openBlock(), _createBlock(Pagination, _mergeProps({
|
|
284
|
+
key: 1
|
|
285
|
+
}, myPagination.value, {
|
|
286
|
+
total: page.total,
|
|
287
|
+
pageIndex: page.pageIndex,
|
|
288
|
+
pageSize: page.pageSize,
|
|
289
|
+
totalLoading: page.loading,
|
|
290
|
+
totalRequest: _ctx.totalRequest,
|
|
291
|
+
onChange: onPageChange
|
|
292
|
+
}), {
|
|
293
|
+
default: _withCtx(() => [_renderSlot(_ctx.$slots, "paginationRender", {
|
|
294
|
+
total: page.total,
|
|
295
|
+
pageSize: page.pageSize,
|
|
296
|
+
current: page.pageIndex + 1,
|
|
297
|
+
onChange: onPageChange
|
|
298
|
+
})]),
|
|
299
|
+
_: 3 /* FORWARDED */
|
|
300
|
+
}, 16 /* FULL_PROPS */, ["total", "pageIndex", "pageSize", "totalLoading", "totalRequest"])) : _createCommentVNode("v-if", true)])]),
|
|
301
|
+
_: 3 /* FORWARDED */
|
|
302
|
+
}, 8 /* PROPS */, ["spinning"])], 6 /* CLASS, STYLE */);
|
|
257
303
|
};
|
|
258
304
|
}
|
|
259
|
-
});
|
|
305
|
+
});
|
|
306
|
+
export default __sfc_main__;
|
package/es/Search/Item.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import { defineComponent
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, createVNode as _createVNode, Fragment as _Fragment, resolveDynamicComponent as _resolveDynamicComponent, mergeProps as _mergeProps, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass } from "vue";
|
|
3
|
+
const _hoisted_1 = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "JSearch-item--type"
|
|
6
|
+
};
|
|
7
|
+
const _hoisted_2 = {
|
|
8
|
+
key: 1
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_3 = {
|
|
11
|
+
class: "JSearch-item--value"
|
|
12
|
+
};
|
|
13
|
+
import { computed, ref, reactive, watch, isRef } from 'vue';
|
|
2
14
|
import { Select } from 'ant-design-vue';
|
|
3
15
|
import { componentProps, componentType, typeOptions } from './setting';
|
|
4
16
|
import { getTermOptions, getItemDefaultValue } from './util';
|
|
@@ -6,11 +18,11 @@ import { useLocaleReceiver } from '../LocaleReciver';
|
|
|
6
18
|
import { useColumnsMap, useDefaultValue, useOptionMap } from './hooks';
|
|
7
19
|
import { isArray, isFunction } from 'lodash-es';
|
|
8
20
|
import useSearchStyle from './style';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Select
|
|
21
|
+
const __sfc_main__ = _defineComponent({
|
|
22
|
+
...{
|
|
23
|
+
name: 'JSearchItem'
|
|
13
24
|
},
|
|
25
|
+
__name: 'Item',
|
|
14
26
|
props: {
|
|
15
27
|
column: {
|
|
16
28
|
type: String
|
|
@@ -44,9 +56,11 @@ export default defineComponent({
|
|
|
44
56
|
}
|
|
45
57
|
},
|
|
46
58
|
emits: ['update:value', 'update:termType', 'update:type', 'update:column'],
|
|
47
|
-
setup(
|
|
48
|
-
emit
|
|
59
|
+
setup(__props, {
|
|
60
|
+
emit: __emit
|
|
49
61
|
}) {
|
|
62
|
+
const props = __props;
|
|
63
|
+
const emit = __emit;
|
|
50
64
|
const termsModel = reactive({
|
|
51
65
|
type: props.type || 'or',
|
|
52
66
|
value: props.value || '',
|
|
@@ -193,19 +207,54 @@ export default defineComponent({
|
|
|
193
207
|
termsModel.column = props.column;
|
|
194
208
|
termsModel.type = props.type;
|
|
195
209
|
});
|
|
196
|
-
return {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
210
|
+
return (_ctx, _cache) => {
|
|
211
|
+
return _openBlock(), _createElementBlock("div", {
|
|
212
|
+
class: _normalizeClass(['JSearch-item', _unref(hashId)])
|
|
213
|
+
}, [_createCommentVNode(" onlyValue 为 true 时显示 label "), __props.onlyValue ? (_openBlock(), _createElementBlock("div", {
|
|
214
|
+
key: 0,
|
|
215
|
+
class: "JSearch-item--label",
|
|
216
|
+
style: _normalizeStyle({
|
|
217
|
+
minWidth: `${__props.labelWidth}px`
|
|
218
|
+
})
|
|
219
|
+
}, _toDisplayString(targetComponents.value.label), 5 /* TEXT, STYLE */)) : (_openBlock(), _createElementBlock(_Fragment, {
|
|
220
|
+
key: 1
|
|
221
|
+
}, [_createCommentVNode(" onlyValue 为 false 时显示更多选项 "), _createCommentVNode(" 展开模式下显示类型选择 "), __props.expand ? (_openBlock(), _createElementBlock("div", _hoisted_1, [__props.index !== 1 && __props.index !== 4 ? (_openBlock(), _createBlock(_unref(Select), {
|
|
222
|
+
key: 0,
|
|
223
|
+
value: termsModel.type,
|
|
224
|
+
"onUpdate:value": _cache[0] || (_cache[0] = $event => termsModel.type = $event),
|
|
225
|
+
options: _unref(typeOptions)(_unref(contextLocale)),
|
|
226
|
+
style: {
|
|
227
|
+
"width": "100%"
|
|
228
|
+
},
|
|
229
|
+
onChange: onTypeChange
|
|
230
|
+
}, null, 8 /* PROPS */, ["value", "options"])) : (_openBlock(), _createElementBlock("span", _hoisted_2, _toDisplayString(__props.index === 1 ? _unref(contextLocale).item.firstGroup : _unref(contextLocale).item.secondGroup), 1 /* TEXT */))])) : _createCommentVNode("v-if", true), _createCommentVNode(" 列选择 "), _createVNode(_unref(Select), {
|
|
231
|
+
value: termsModel.column,
|
|
232
|
+
"onUpdate:value": _cache[1] || (_cache[1] = $event => termsModel.column = $event),
|
|
233
|
+
placeholder: _unref(contextLocale).item.placeholder,
|
|
234
|
+
class: "JSearch-item--column",
|
|
235
|
+
options: columnOptions.value,
|
|
236
|
+
onChange: onColumnChange
|
|
237
|
+
}, null, 8 /* PROPS */, ["value", "placeholder", "options"]), _createCommentVNode(" 条件类型选择 "), _createVNode(_unref(Select), {
|
|
238
|
+
value: termsModel.termType,
|
|
239
|
+
"onUpdate:value": _cache[2] || (_cache[2] = $event => termsModel.termType = $event),
|
|
240
|
+
placeholder: _unref(contextLocale).item.placeholder,
|
|
241
|
+
class: "JSearch-item--termType",
|
|
242
|
+
options: termTypeOptions.value,
|
|
243
|
+
onChange: onTermTypeChange
|
|
244
|
+
}, null, 8 /* PROPS */, ["value", "placeholder", "options"])], 64 /* STABLE_FRAGMENT */)), _createCommentVNode(" 值输入 "), _createElementVNode("div", _hoisted_3, [(_openBlock(), _createBlock(_resolveDynamicComponent(targetComponents.value.name), _mergeProps({
|
|
245
|
+
"allow-clear": "",
|
|
246
|
+
style: {
|
|
247
|
+
"width": "100%",
|
|
248
|
+
"min-width": "80px"
|
|
249
|
+
}
|
|
250
|
+
}, targetComponents.value.props, {
|
|
251
|
+
options: !['treeSelect', 'tree'].includes(targetComponents.value.type) && valueOptions.value,
|
|
252
|
+
treeData: ['treeSelect', 'tree'].includes(targetComponents.value.type) && valueOptions.value,
|
|
253
|
+
value: termsModel.value,
|
|
254
|
+
"onUpdate:value": _cache[3] || (_cache[3] = $event => termsModel.value = $event),
|
|
255
|
+
onChange: onValueChange
|
|
256
|
+
}), null, 16 /* FULL_PROPS */, ["options", "treeData", "value"]))])], 2 /* CLASS */);
|
|
209
257
|
};
|
|
210
258
|
}
|
|
211
|
-
});
|
|
259
|
+
});
|
|
260
|
+
export default __sfc_main__;
|