@meethive/components 0.0.9 → 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/EditTable/props.js +1 -1
- package/es/ProLayout/SiderMenu/SiderMenu.js +133 -147
- package/es/ProLayout/TopHeader/index.js +91 -99
- 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/ProTable/setting.js +1 -1
- package/es/Search/Advanced/History.js +142 -0
- package/es/Search/Advanced/SaveHistory.js +124 -0
- package/es/Search/Advanced/index.js +369 -0
- package/es/Search/Item.js +70 -21
- package/es/Search/Search.js +81 -24
- package/es/Search/index.js +3 -3
- package/es/VirtualTable/VirtualTable.js +4 -4
- package/es/components.js +1 -1
- package/lib/EditTable/props.js +1 -1
- package/lib/ProLayout/SiderMenu/SiderMenu.js +133 -147
- package/lib/ProLayout/TopHeader/index.js +91 -99
- 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/ProTable/setting.js +1 -1
- package/lib/Search/Advanced/History.js +142 -0
- package/lib/Search/Advanced/SaveHistory.js +124 -0
- package/lib/Search/Advanced/index.js +369 -0
- package/lib/Search/Item.js +70 -21
- package/lib/Search/Search.js +81 -24
- package/lib/Search/index.js +3 -3
- package/lib/VirtualTable/VirtualTable.js +4 -4
- package/lib/components.js +1 -1
- package/package.json +1 -1
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/ProTable/setting.js
CHANGED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
2
|
+
import { unref as _unref, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, withModifiers as _withModifiers } from "vue";
|
|
3
|
+
const _hoisted_1 = ["onClick"];
|
|
4
|
+
const _hoisted_2 = {
|
|
5
|
+
class: "delete"
|
|
6
|
+
};
|
|
7
|
+
const _hoisted_3 = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "search-history-empty"
|
|
10
|
+
};
|
|
11
|
+
import { computed, ref } from 'vue';
|
|
12
|
+
import { isFunction } from 'lodash-es';
|
|
13
|
+
import { AIcon, Empty, Ellipsis } from '../../';
|
|
14
|
+
import { Popconfirm, Button, FormItemRest, Popover, message } from 'ant-design-vue';
|
|
15
|
+
import { useLocaleReceiver } from '../../LocaleReciver';
|
|
16
|
+
import useSearchStyle from '../style';
|
|
17
|
+
const __sfc_main__ = _defineComponent({
|
|
18
|
+
__name: 'History',
|
|
19
|
+
props: {
|
|
20
|
+
target: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: '',
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
request: {
|
|
26
|
+
type: Function,
|
|
27
|
+
default: null
|
|
28
|
+
},
|
|
29
|
+
deleteRequest: {
|
|
30
|
+
type: Function,
|
|
31
|
+
default: null
|
|
32
|
+
},
|
|
33
|
+
deleteKey: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'key'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
emits: ['click', 'itemClick'],
|
|
39
|
+
setup(__props, {
|
|
40
|
+
emit: __emit
|
|
41
|
+
}) {
|
|
42
|
+
const props = __props;
|
|
43
|
+
const emit = __emit;
|
|
44
|
+
const prefixCls = computed(() => 'JSearch');
|
|
45
|
+
const [wrapSSR, hashId] = useSearchStyle(prefixCls);
|
|
46
|
+
const [contextLocale] = useLocaleReceiver('Search');
|
|
47
|
+
const historyList = ref([]);
|
|
48
|
+
const historyVisible = ref(false);
|
|
49
|
+
const showEmpty = computed(() => {
|
|
50
|
+
return historyList.value.length === 0;
|
|
51
|
+
});
|
|
52
|
+
const showHistoryList = async () => {
|
|
53
|
+
if (props.request) {
|
|
54
|
+
const resp = await props.request(props.target);
|
|
55
|
+
if (resp.success && resp.result.length) {
|
|
56
|
+
historyList.value = resp.result.filter(item => item.content);
|
|
57
|
+
} else {
|
|
58
|
+
historyList.value = [];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const visibleChange = async v => {
|
|
63
|
+
historyVisible.value = v;
|
|
64
|
+
};
|
|
65
|
+
const click = () => {
|
|
66
|
+
emit('click');
|
|
67
|
+
};
|
|
68
|
+
const itemClick = content => {
|
|
69
|
+
historyVisible.value = false;
|
|
70
|
+
emit('itemClick', content);
|
|
71
|
+
};
|
|
72
|
+
const deleteHistory = async item => {
|
|
73
|
+
if (props.deleteRequest && isFunction(props.deleteRequest)) {
|
|
74
|
+
const resp = await props.deleteRequest(props.target, item[props.deleteKey]);
|
|
75
|
+
historyVisible.value = false;
|
|
76
|
+
if (resp.success || resp.status === 200 || resp.code === 200) {
|
|
77
|
+
message.success(contextLocale.value.advanced.saveHistory.success);
|
|
78
|
+
} else {
|
|
79
|
+
message.error(contextLocale.value.advanced.saveHistory.fail);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return (_ctx, _cache) => {
|
|
84
|
+
return _openBlock(), _createElementBlock("div", {
|
|
85
|
+
class: _normalizeClass(['search-history-warp', _unref(hashId)])
|
|
86
|
+
}, [_createVNode(_unref(FormItemRest), null, {
|
|
87
|
+
default: _withCtx(() => [_createVNode(_unref(Button), {
|
|
88
|
+
class: "search-history-button",
|
|
89
|
+
type: "primary",
|
|
90
|
+
"html-type": "submit"
|
|
91
|
+
}, {
|
|
92
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).advanced.history.search), 1 /* TEXT */)]),
|
|
93
|
+
_: 1 /* STABLE */
|
|
94
|
+
})]),
|
|
95
|
+
_: 1 /* STABLE */
|
|
96
|
+
}), _createVNode(_unref(Popover), {
|
|
97
|
+
placement: "bottom",
|
|
98
|
+
trigger: "click",
|
|
99
|
+
"overlay-class-name": "search-history-list-pop",
|
|
100
|
+
open: historyVisible.value,
|
|
101
|
+
onVisibleChange: visibleChange
|
|
102
|
+
}, {
|
|
103
|
+
content: _withCtx(() => [!showEmpty.value ? (_openBlock(), _createElementBlock("div", {
|
|
104
|
+
key: 0,
|
|
105
|
+
class: _normalizeClass(['search-history-items', _unref(hashId)])
|
|
106
|
+
}, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(historyList.value, item => {
|
|
107
|
+
return _openBlock(), _createElementBlock("div", {
|
|
108
|
+
key: item.id,
|
|
109
|
+
class: "search-history-item"
|
|
110
|
+
}, [_createElementVNode("div", {
|
|
111
|
+
class: "history-item--title",
|
|
112
|
+
onClick: $event => itemClick(item.content)
|
|
113
|
+
}, [_createVNode(_unref(Ellipsis), {
|
|
114
|
+
style: {
|
|
115
|
+
"width": "100%"
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
default: _withCtx(() => [_createTextVNode(_toDisplayString(item.name), 1 /* TEXT */)]),
|
|
119
|
+
_: 2 /* DYNAMIC */
|
|
120
|
+
}, 1024 /* DYNAMIC_SLOTS */)], 8 /* PROPS */, _hoisted_1), _createVNode(_unref(Popconfirm), {
|
|
121
|
+
title: _unref(contextLocale).advanced.history.confirmDelete,
|
|
122
|
+
placement: "top",
|
|
123
|
+
onConfirm: $event => deleteHistory(item)
|
|
124
|
+
}, {
|
|
125
|
+
default: _withCtx(() => [_createElementVNode("span", _hoisted_2, [_createVNode(_unref(AIcon), {
|
|
126
|
+
type: "DeleteOutlined"
|
|
127
|
+
})])]),
|
|
128
|
+
_: 1 /* STABLE */
|
|
129
|
+
}, 8 /* PROPS */, ["title", "onConfirm"])]);
|
|
130
|
+
}), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */)) : (_openBlock(), _createElementBlock("div", _hoisted_3, [_createVNode(_unref(Empty))]))]),
|
|
131
|
+
default: _withCtx(() => [_createElementVNode("div", {
|
|
132
|
+
class: "search-history-button-icon",
|
|
133
|
+
onClick: _withModifiers(showHistoryList, ["stop"])
|
|
134
|
+
}, [_createVNode(_unref(AIcon), {
|
|
135
|
+
type: "DownOutlined"
|
|
136
|
+
})])]),
|
|
137
|
+
_: 1 /* STABLE */
|
|
138
|
+
}, 8 /* PROPS */, ["open"])], 2 /* CLASS */);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
export default __sfc_main__;
|