@jetlinks-web/components 3.0.1-rc → 3.1.0
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/AutoComplete/AutoComplete.js +13 -9
- package/es/BadgeStatus/Badge.js +1 -2
- package/es/BadgeStatus/color.js +3 -3
- package/es/CardSelect/CardSelect.js +23 -13
- package/es/CardSelect/style/index.js +25 -1
- package/es/CheckButton/CheckButton.js +12 -4
- package/es/CheckButton/style/index.js +41 -1
- package/es/DragModal/DragModal.js +14 -8
- package/es/DragModal/style/index.js +64 -1
- package/es/EditTable/Body.js +10 -3
- package/es/EditTable/EditTable.js +13 -7
- package/es/EditTable/FormItem.js +18 -19
- package/es/EditTable/Header.js +16 -6
- package/es/EditTable/components/ContextMenu/Menu.js +11 -5
- package/es/EditTable/components/Search/search.js +1 -2
- package/es/EditTable/components/Search/sort.js +1 -3
- package/es/EditTable/group.js +23 -18
- package/es/EditTable/hooks/useValidate.js +1 -1
- package/es/EditTable/style/body.js +53 -0
- package/es/EditTable/style/form.js +24 -0
- package/es/EditTable/style/group.js +25 -0
- package/es/EditTable/style/header.js +58 -0
- package/es/EditTable/style/index.js +42 -1
- package/es/EditTable/style/menu.js +27 -0
- package/es/EditTable/style/table.js +46 -0
- package/es/EditTable/utils.js +30 -3
- package/es/Ellipsis/Ellipsis.js +10 -2
- package/es/Ellipsis/style/index.js +24 -1
- package/es/FullPage/FullPage.js +1 -2
- package/es/LocaleProvider/index.js +1 -2
- package/es/PermissionButton/index.js +6 -7
- package/es/ProLayout/Basic/BasicLayout.js +45 -41
- package/es/ProLayout/Basic/BasicLayoutStyle.js +39 -0
- package/es/ProLayout/Basic/Header.js +3 -7
- package/es/ProLayout/Basic/HeaderStyle.js +10 -0
- package/es/ProLayout/PageContainer/index.js +21 -17
- package/es/ProLayout/PageContainer/style.js +46 -0
- package/es/ProLayout/SiderMenu/BaseMenu.js +18 -42
- package/es/ProLayout/SiderMenu/SiderMenu.js +24 -36
- package/es/ProLayout/SiderMenu/style.js +166 -0
- package/es/ProLayout/TopHeader/index.js +13 -12
- package/es/ProLayout/TopHeader/style.js +126 -0
- package/es/ProLayout/style/index.js +7 -1
- package/es/ProLayout/util.js +5 -5
- package/es/ProTable/Alert.js +12 -4
- package/es/ProTable/Content.js +166 -45
- package/es/ProTable/Header.js +21 -11
- package/es/ProTable/Pagination.js +28 -11
- package/es/ProTable/ProTable.js +104 -46
- package/es/ProTable/hooks/index.js +2 -0
- package/es/ProTable/hooks/useTableInject.js +5 -0
- package/es/ProTable/hooks/useTableSelection.js +95 -0
- package/es/ProTable/setting.js +24 -1
- package/es/ProTable/style/index.js +109 -1
- package/es/RadioButton/RadioButton.js +10 -4
- package/es/RadioButton/style/index.js +23 -1
- package/es/Scrollbar/Scrollbar.js +10 -3
- package/es/Scrollbar/Thumb.js +36 -25
- package/es/Scrollbar/style/index.js +63 -1
- package/es/Search/Advanced/History.js +23 -16
- package/es/Search/Advanced/SaveHistory.js +1 -2
- package/es/Search/Advanced/index.js +212 -292
- package/es/Search/Item.js +175 -415
- package/es/Search/Search.js +78 -172
- package/es/Search/hooks/index.js +108 -1
- package/es/Search/hooks/useRouteQuery.js +57 -0
- package/es/Search/setting.js +132 -14
- package/es/Search/style/index.js +4 -2
- package/es/Search/style/item.js +28 -0
- package/es/Search/style/search.js +133 -0
- package/es/Search/util.js +116 -124
- package/es/Skeleton/components/DashBoardCard.js +19 -12
- package/es/Skeleton/components/DashBoardChart.js +48 -45
- package/es/Skeleton/components/Detail.js +27 -21
- package/es/Skeleton/components/Drawer.js +23 -14
- package/es/Skeleton/components/Item.js +9 -1
- package/es/Skeleton/components/List.js +0 -1
- package/es/Skeleton/components/ListCard.js +20 -13
- package/es/Skeleton/components/ListCardItem.js +12 -13
- package/es/Skeleton/components/ListTable.js +19 -10
- package/es/Skeleton/components/Page.js +0 -1
- package/es/Skeleton/components/Tree.js +21 -14
- package/es/Skeleton/skeleton.js +17 -8
- package/es/Skeleton/style/index.js +132 -1
- package/es/Title/style/index.js +29 -1
- package/es/Title/title.js +13 -5
- package/es/ValueItem/ValueItem.js +44 -39
- package/es/VirtualTable/VirtualTable.js +398 -0
- package/es/VirtualTable/data.js +36 -0
- package/es/VirtualTable/index.js +5 -0
- package/es/VirtualTable/style/index.js +32 -0
- package/es/components.js +1 -4
- package/es/locale/en-US.js +6 -8
- package/es/locale/zh-CN.js +6 -8
- package/es/style/index.js +0 -3
- package/es/style/styleRegister.js +21 -0
- package/es/style/variable.js +4 -0
- package/es/style.js +0 -13
- package/lib/AutoComplete/AutoComplete.js +13 -9
- package/lib/BadgeStatus/Badge.js +1 -2
- package/lib/BadgeStatus/color.js +3 -3
- package/lib/CardSelect/CardSelect.js +23 -13
- package/lib/CardSelect/style/index.js +30 -1
- package/lib/CheckButton/CheckButton.js +12 -4
- package/lib/CheckButton/style/index.js +46 -1
- package/lib/DragModal/DragModal.js +14 -8
- package/lib/DragModal/style/index.js +69 -1
- package/lib/EditTable/Body.js +10 -3
- package/lib/EditTable/EditTable.js +13 -7
- package/lib/EditTable/FormItem.js +18 -19
- package/lib/EditTable/Header.js +16 -6
- package/lib/EditTable/components/ContextMenu/Menu.js +11 -5
- package/lib/EditTable/components/Search/search.js +1 -2
- package/lib/EditTable/components/Search/sort.js +1 -3
- package/lib/EditTable/group.js +23 -18
- package/lib/EditTable/hooks/useValidate.js +1 -1
- package/lib/EditTable/style/body.js +60 -0
- package/lib/EditTable/style/form.js +31 -0
- package/lib/EditTable/style/group.js +32 -0
- package/lib/EditTable/style/header.js +65 -0
- package/lib/EditTable/style/index.js +47 -1
- package/lib/EditTable/style/menu.js +33 -0
- package/lib/EditTable/style/table.js +52 -0
- package/lib/EditTable/utils.js +31 -3
- package/lib/Ellipsis/Ellipsis.js +10 -2
- package/lib/Ellipsis/style/index.js +29 -1
- package/lib/FullPage/FullPage.js +1 -2
- package/lib/Icon/icon.js +1 -2
- package/lib/LocaleProvider/index.js +1 -2
- package/lib/PermissionButton/index.js +6 -7
- package/lib/ProLayout/Basic/BasicLayout.js +45 -42
- package/lib/ProLayout/Basic/BasicLayoutStyle.js +46 -0
- package/lib/ProLayout/Basic/Header.js +2 -6
- package/lib/ProLayout/Basic/HeaderStyle.js +17 -0
- package/lib/ProLayout/PageContainer/index.js +19 -15
- package/lib/ProLayout/PageContainer/style.js +53 -0
- package/lib/ProLayout/SiderMenu/BaseMenu.js +19 -42
- package/lib/ProLayout/SiderMenu/SiderMenu.js +24 -37
- package/lib/ProLayout/SiderMenu/style.js +173 -0
- package/lib/ProLayout/TopHeader/index.js +14 -12
- package/lib/ProLayout/TopHeader/style.js +133 -0
- package/lib/ProLayout/style/index.js +12 -1
- package/lib/ProLayout/util.js +5 -5
- package/lib/ProTable/Alert.js +12 -4
- package/lib/ProTable/Content.js +166 -45
- package/lib/ProTable/Header.js +21 -11
- package/lib/ProTable/Pagination.js +28 -11
- package/lib/ProTable/ProTable.js +104 -46
- package/lib/ProTable/hooks/index.js +27 -0
- package/lib/ProTable/hooks/useTableInject.js +11 -0
- package/lib/ProTable/hooks/useTableSelection.js +102 -0
- package/lib/ProTable/setting.js +24 -1
- package/lib/ProTable/style/index.js +114 -1
- package/lib/RadioButton/RadioButton.js +10 -4
- package/lib/RadioButton/style/index.js +28 -1
- package/lib/Scrollbar/Scrollbar.js +10 -3
- package/lib/Scrollbar/Thumb.js +36 -25
- package/lib/Scrollbar/style/index.js +68 -1
- package/lib/Search/Advanced/History.js +23 -16
- package/lib/Search/Advanced/SaveHistory.js +1 -2
- package/lib/Search/Advanced/index.js +212 -292
- package/lib/Search/Item.js +175 -415
- package/lib/Search/Search.js +78 -172
- package/lib/Search/hooks/index.js +130 -1
- package/lib/Search/hooks/useRouteQuery.js +64 -0
- package/lib/Search/setting.js +133 -15
- package/lib/Search/style/index.js +9 -2
- package/lib/Search/style/item.js +35 -0
- package/lib/Search/style/search.js +140 -0
- package/lib/Search/util.js +116 -124
- package/lib/Skeleton/components/DashBoardCard.js +19 -12
- package/lib/Skeleton/components/DashBoardChart.js +48 -45
- package/lib/Skeleton/components/Detail.js +27 -21
- package/lib/Skeleton/components/Drawer.js +23 -14
- package/lib/Skeleton/components/Item.js +9 -1
- package/lib/Skeleton/components/List.js +0 -1
- package/lib/Skeleton/components/ListCard.js +20 -13
- package/lib/Skeleton/components/ListCardItem.js +12 -13
- package/lib/Skeleton/components/ListTable.js +19 -10
- package/lib/Skeleton/components/Page.js +0 -1
- package/lib/Skeleton/components/Tree.js +21 -14
- package/lib/Skeleton/skeleton.js +17 -8
- package/lib/Skeleton/style/index.js +137 -1
- package/lib/Title/style/index.js +34 -1
- package/lib/Title/title.js +13 -5
- package/lib/ValueItem/ValueItem.js +44 -39
- package/lib/VirtualTable/VirtualTable.js +398 -0
- package/lib/VirtualTable/data.js +43 -0
- package/lib/VirtualTable/index.js +12 -0
- package/lib/VirtualTable/style/index.js +39 -0
- package/lib/components.js +8 -30
- package/lib/index.js +1 -2
- package/lib/locale/en-US.js +6 -8
- package/lib/locale/zh-CN.js +6 -8
- package/lib/style/components.less +0 -1
- package/lib/style/index.js +1 -4
- package/lib/style/styleRegister.js +28 -0
- package/lib/style/variable.js +10 -0
- package/lib/style.js +1 -15
- package/package.json +170 -173
- package/es/AMap/Map.js +0 -133
- package/es/AMap/index.js +0 -5
- package/es/AMap/util.js +0 -56
- package/es/CardSelect/style/index.css +0 -24
- package/es/CardSelect/style/index.less +0 -26
- package/es/CheckButton/style/index.css +0 -37
- package/es/CheckButton/style/index.less +0 -40
- package/es/DragModal/style/index.css +0 -82
- package/es/DragModal/style/index.less +0 -97
- package/es/Echarts/Echarts.js +0 -48
- package/es/Echarts/index.js +0 -5
- package/es/EditTable/style/body.less +0 -66
- package/es/EditTable/style/form.less +0 -33
- package/es/EditTable/style/group.less +0 -32
- package/es/EditTable/style/header.less +0 -77
- package/es/EditTable/style/index.css +0 -267
- package/es/EditTable/style/index.less +0 -41
- package/es/EditTable/style/menu.less +0 -25
- package/es/EditTable/style/table.less +0 -47
- package/es/Ellipsis/style/index.css +0 -17
- package/es/Ellipsis/style/index.less +0 -20
- package/es/FlameGraph/FlameGraph.js +0 -136
- package/es/FlameGraph/index.js +0 -5
- package/es/FlameGraph/style/index.css +0 -43
- package/es/FlameGraph/style/index.js +0 -1
- package/es/FlameGraph/style/index.less +0 -52
- package/es/ProLayout/Basic/BasicLayout.less +0 -66
- package/es/ProLayout/Basic/Header.less +0 -8
- package/es/ProLayout/PageContainer/index.less +0 -103
- package/es/ProLayout/SiderMenu/index.less +0 -231
- package/es/ProLayout/TopHeader/index.less +0 -174
- package/es/ProLayout/style/default.less +0 -4
- package/es/ProLayout/style/style.less +0 -7
- package/es/ProTable/style/ProTable.less +0 -139
- package/es/RadioButton/style/index.css +0 -20
- package/es/RadioButton/style/index.less +0 -19
- package/es/Scrollbar/style/index.css +0 -65
- package/es/Scrollbar/style/index.less +0 -83
- package/es/Search/style/Item.less +0 -33
- package/es/Search/style/Search.less +0 -179
- package/es/Skeleton/style/Skeleton.less +0 -166
- package/es/Title/style/index.css +0 -27
- package/es/Title/style/index.less +0 -27
- package/es/style/index.css +0 -5375
- package/es/style/index.less +0 -14
- package/es/style/variable.css +0 -4
- package/es/style/variable.less +0 -4
- package/lib/AMap/Map.js +0 -133
- package/lib/AMap/index.js +0 -12
- package/lib/AMap/util.js +0 -62
- package/lib/CardSelect/style/index.css +0 -24
- package/lib/CardSelect/style/index.less +0 -26
- package/lib/CheckButton/style/index.css +0 -37
- package/lib/CheckButton/style/index.less +0 -40
- package/lib/DragModal/style/index.css +0 -82
- package/lib/DragModal/style/index.less +0 -97
- package/lib/Echarts/Echarts.js +0 -48
- package/lib/Echarts/index.js +0 -12
- package/lib/EditTable/style/body.less +0 -66
- package/lib/EditTable/style/form.less +0 -33
- package/lib/EditTable/style/group.less +0 -32
- package/lib/EditTable/style/header.less +0 -77
- package/lib/EditTable/style/index.css +0 -267
- package/lib/EditTable/style/index.less +0 -41
- package/lib/EditTable/style/menu.less +0 -25
- package/lib/EditTable/style/table.less +0 -47
- package/lib/Ellipsis/style/index.css +0 -17
- package/lib/Ellipsis/style/index.less +0 -20
- package/lib/FlameGraph/FlameGraph.js +0 -136
- package/lib/FlameGraph/index.js +0 -12
- package/lib/FlameGraph/style/index.css +0 -43
- package/lib/FlameGraph/style/index.js +0 -3
- package/lib/FlameGraph/style/index.less +0 -52
- package/lib/ProLayout/Basic/BasicLayout.less +0 -66
- package/lib/ProLayout/Basic/Header.less +0 -8
- package/lib/ProLayout/PageContainer/index.less +0 -103
- package/lib/ProLayout/SiderMenu/index.less +0 -231
- package/lib/ProLayout/TopHeader/index.less +0 -174
- package/lib/ProLayout/style/default.less +0 -4
- package/lib/ProLayout/style/style.less +0 -7
- package/lib/ProTable/style/ProTable.less +0 -139
- package/lib/RadioButton/style/index.css +0 -20
- package/lib/RadioButton/style/index.less +0 -19
- package/lib/Scrollbar/style/index.css +0 -65
- package/lib/Scrollbar/style/index.less +0 -83
- package/lib/Search/style/Item.less +0 -33
- package/lib/Search/style/Search.less +0 -179
- package/lib/Skeleton/style/Skeleton.less +0 -166
- package/lib/Title/style/index.css +0 -27
- package/lib/Title/style/index.less +0 -27
- package/lib/style/index.css +0 -5375
- package/lib/style/index.less +0 -14
- package/lib/style/variable.css +0 -4
- package/lib/style/variable.less +0 -4
package/lib/ProTable/Header.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
/* Analyzed bindings: {
|
|
2
2
|
"initMode": "props",
|
|
3
|
+
"computed": "setup-const",
|
|
3
4
|
"RadioGroup": "setup-maybe-ref",
|
|
4
5
|
"RadioButton": "setup-maybe-ref",
|
|
5
6
|
"AIcon": "setup-maybe-ref",
|
|
6
7
|
"_headerProps": "setup-maybe-ref",
|
|
8
|
+
"useProTableStyle": "setup-maybe-ref",
|
|
7
9
|
"props": "setup-reactive-const",
|
|
8
|
-
"emits": "setup-const"
|
|
10
|
+
"emits": "setup-const",
|
|
11
|
+
"prefixCls": "setup-ref",
|
|
12
|
+
"wrapSSR": "setup-maybe-ref",
|
|
13
|
+
"hashId": "setup-maybe-ref"
|
|
9
14
|
} */
|
|
10
15
|
import { defineComponent as _defineComponent } from 'vue';
|
|
11
|
-
import {
|
|
12
|
-
const _hoisted_1 = { class: "jtable-body-header" };
|
|
13
|
-
const _hoisted_2 = { class: "jtable-body-header-
|
|
14
|
-
const _hoisted_3 = {
|
|
15
|
-
const _hoisted_4 = {
|
|
16
|
+
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";
|
|
17
|
+
const _hoisted_1 = { class: "jtable-body-header-left" };
|
|
18
|
+
const _hoisted_2 = { class: "jtable-body-header-right" };
|
|
19
|
+
const _hoisted_3 = {
|
|
16
20
|
key: 0,
|
|
17
21
|
class: "table-body-header-right-button"
|
|
18
22
|
};
|
|
23
|
+
import { computed } from 'vue';
|
|
19
24
|
import { RadioGroup, RadioButton } from 'ant-design-vue';
|
|
20
25
|
import AIcon from '../Icon';
|
|
21
26
|
import { _headerProps } from './setting';
|
|
27
|
+
import useProTableStyle from './style';
|
|
22
28
|
const __sfc_main__ = _defineComponent({
|
|
23
29
|
...{
|
|
24
30
|
name: 'Header'
|
|
@@ -34,15 +40,19 @@ const __sfc_main__ = _defineComponent({
|
|
|
34
40
|
setup(__props, { emit: __emit }) {
|
|
35
41
|
const props = __props;
|
|
36
42
|
const emits = __emit;
|
|
43
|
+
const prefixCls = computed(() => 'pro-table');
|
|
44
|
+
const [wrapSSR, hashId] = useProTableStyle(prefixCls);
|
|
37
45
|
return (_ctx, _cache) => {
|
|
38
|
-
return (_openBlock(), _createElementBlock("div",
|
|
39
|
-
|
|
46
|
+
return (_openBlock(), _createElementBlock("div", {
|
|
47
|
+
class: _normalizeClass(['jtable-body-header', _unref(hashId)])
|
|
48
|
+
}, [
|
|
49
|
+
_createElementVNode("div", _hoisted_1, [
|
|
40
50
|
_renderSlot(_ctx.$slots, "headerLeftRender")
|
|
41
51
|
]),
|
|
42
|
-
_createElementVNode("div",
|
|
52
|
+
_createElementVNode("div", _hoisted_2, [
|
|
43
53
|
_renderSlot(_ctx.$slots, "headerRightRender"),
|
|
44
54
|
(!__props.initMode)
|
|
45
|
-
? (_openBlock(), _createElementBlock("div",
|
|
55
|
+
? (_openBlock(), _createElementBlock("div", _hoisted_3, [
|
|
46
56
|
_createVNode(_unref(RadioGroup), {
|
|
47
57
|
value: _ctx.mode,
|
|
48
58
|
onChange: _cache[0] || (_cache[0] = (e) => emits('change', e))
|
|
@@ -66,7 +76,7 @@ const __sfc_main__ = _defineComponent({
|
|
|
66
76
|
]))
|
|
67
77
|
: _createCommentVNode("v-if", true)
|
|
68
78
|
])
|
|
69
|
-
]));
|
|
79
|
+
], 2 /* CLASS */));
|
|
70
80
|
};
|
|
71
81
|
}
|
|
72
82
|
});
|
|
@@ -16,23 +16,29 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
16
16
|
} return value; }
|
|
17
17
|
/* Analyzed bindings: {
|
|
18
18
|
"Pagination": "setup-maybe-ref",
|
|
19
|
+
"Spin": "setup-maybe-ref",
|
|
19
20
|
"_paginationProps": "setup-maybe-ref",
|
|
20
21
|
"computed": "setup-const",
|
|
22
|
+
"h": "setup-const",
|
|
21
23
|
"useLocaleReceiver": "setup-maybe-ref",
|
|
24
|
+
"useProTableStyle": "setup-maybe-ref",
|
|
22
25
|
"props": "setup-reactive-const",
|
|
23
26
|
"emits": "setup-const",
|
|
24
27
|
"contextLocale": "setup-maybe-ref",
|
|
28
|
+
"prefixCls": "setup-ref",
|
|
29
|
+
"wrapSSR": "setup-maybe-ref",
|
|
30
|
+
"hashId": "setup-maybe-ref",
|
|
25
31
|
"className": "setup-ref",
|
|
26
32
|
"_showTotal": "setup-const",
|
|
27
33
|
"onChange": "setup-const"
|
|
28
34
|
} */
|
|
29
35
|
import { defineComponent as _defineComponent } from 'vue';
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
import { Pagination } from 'ant-design-vue';
|
|
36
|
+
import { unref as _unref, renderSlot as _renderSlot, mergeProps as _mergeProps, createVNode as _createVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
37
|
+
import { Pagination, Spin } from 'ant-design-vue';
|
|
33
38
|
import { _paginationProps } from "./setting";
|
|
34
|
-
import { computed } from 'vue';
|
|
39
|
+
import { computed, h } from 'vue';
|
|
35
40
|
import { useLocaleReceiver } from "../LocaleReciver";
|
|
41
|
+
import useProTableStyle from './style';
|
|
36
42
|
const __sfc_main__ = _defineComponent({
|
|
37
43
|
...{
|
|
38
44
|
name: 'JPagination'
|
|
@@ -43,6 +49,8 @@ const __sfc_main__ = _defineComponent({
|
|
|
43
49
|
const props = __props;
|
|
44
50
|
const emits = __emit;
|
|
45
51
|
const [contextLocale] = useLocaleReceiver('ProTable');
|
|
52
|
+
const prefixCls = computed(() => 'pro-table');
|
|
53
|
+
const [wrapSSR, hashId] = useProTableStyle(prefixCls);
|
|
46
54
|
const className = computed(() => {
|
|
47
55
|
return {
|
|
48
56
|
'hide-content': !props.isShowContent,
|
|
@@ -51,18 +59,27 @@ const __sfc_main__ = _defineComponent({
|
|
|
51
59
|
const _showTotal = (num) => {
|
|
52
60
|
const minSize = props.pageIndex * props.pageSize + 1;
|
|
53
61
|
const MaxSize = (props.pageIndex + 1) * props.pageSize;
|
|
54
|
-
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
let localePage = _optionalChain([contextLocale, 'access', _ => _.value, 'access', _2 => _2.pagination, 'optionalAccess', _3 => _3.page]) || '';
|
|
63
|
+
let localeTotal = _optionalChain([contextLocale, 'access', _4 => _4.value, 'access', _5 => _5.pagination, 'optionalAccess', _6 => _6.total]) || '';
|
|
64
|
+
const _maxSize = props.totalLoading ? MaxSize : (MaxSize > num ? num : MaxSize);
|
|
65
|
+
[minSize, _maxSize].forEach((item, index) => {
|
|
66
|
+
localePage = localePage.replace(`{${index}}`, item);
|
|
58
67
|
});
|
|
59
|
-
return
|
|
68
|
+
return h('span', {}, [
|
|
69
|
+
localePage,
|
|
70
|
+
props.totalLoading
|
|
71
|
+
? h(Spin, { size: 'small', style: { margin: '0 4px' } })
|
|
72
|
+
: h('span', { style: { margin: '0 4px' } }, num),
|
|
73
|
+
localeTotal
|
|
74
|
+
]);
|
|
60
75
|
};
|
|
61
76
|
const onChange = (page, size) => {
|
|
62
77
|
emits('change', page, size);
|
|
63
78
|
};
|
|
64
79
|
return (_ctx, _cache) => {
|
|
65
|
-
return (_openBlock(), _createElementBlock("div",
|
|
80
|
+
return (_openBlock(), _createElementBlock("div", {
|
|
81
|
+
class: _normalizeClass(['jtable-pagination', _unref(hashId)])
|
|
82
|
+
}, [
|
|
66
83
|
_renderSlot(_ctx.$slots, "default", {}, () => [
|
|
67
84
|
_createVNode(_unref(Pagination), _mergeProps(props, {
|
|
68
85
|
total: _ctx.total,
|
|
@@ -73,7 +90,7 @@ const __sfc_main__ = _defineComponent({
|
|
|
73
90
|
onChange: onChange
|
|
74
91
|
}), null, 16 /* FULL_PROPS */, ["total", "pageSize", "current", "show-total", "class"])
|
|
75
92
|
])
|
|
76
|
-
]));
|
|
93
|
+
], 2 /* CLASS */));
|
|
77
94
|
};
|
|
78
95
|
}
|
|
79
96
|
});
|
package/lib/ProTable/ProTable.js
CHANGED
|
@@ -22,6 +22,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
22
22
|
} return value; }
|
|
23
23
|
/* Analyzed bindings: {
|
|
24
24
|
"proTableProps": "setup-maybe-ref",
|
|
25
|
+
"Spin": "setup-maybe-ref",
|
|
25
26
|
"Header": "setup-const",
|
|
26
27
|
"Alert": "setup-const",
|
|
27
28
|
"Content": "setup-const",
|
|
@@ -36,7 +37,10 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
36
37
|
"inject": "setup-const",
|
|
37
38
|
"debounce": "setup-maybe-ref",
|
|
38
39
|
"TableConfig": "setup-maybe-ref",
|
|
39
|
-
"
|
|
40
|
+
"useTableInject": "setup-maybe-ref",
|
|
41
|
+
"useProTableStyle": "setup-maybe-ref",
|
|
42
|
+
"onlyMessage": "setup-maybe-ref",
|
|
43
|
+
"useLocaleReceiver": "setup-maybe-ref",
|
|
40
44
|
"tableConfig": "setup-maybe-ref",
|
|
41
45
|
"props": "setup-reactive-const",
|
|
42
46
|
"slots": "setup-maybe-ref",
|
|
@@ -46,7 +50,13 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
46
50
|
"_mode": "setup-ref",
|
|
47
51
|
"column": "setup-ref",
|
|
48
52
|
"page": "setup-reactive-const",
|
|
53
|
+
"prefixCls": "setup-ref",
|
|
54
|
+
"wrapSSR": "setup-maybe-ref",
|
|
55
|
+
"hashId": "setup-maybe-ref",
|
|
56
|
+
"contextLocale": "setup-maybe-ref",
|
|
57
|
+
"currentRequestId": "setup-let",
|
|
49
58
|
"extraSlots": "setup-const",
|
|
59
|
+
"_rowSelection": "setup-maybe-ref",
|
|
50
60
|
"showAlert": "setup-ref",
|
|
51
61
|
"showPagination": "setup-ref",
|
|
52
62
|
"onCheck": "setup-const",
|
|
@@ -60,9 +70,10 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
|
|
|
60
70
|
"windowChange": "setup-const"
|
|
61
71
|
} */
|
|
62
72
|
import { defineComponent as _defineComponent } from 'vue';
|
|
63
|
-
import { renderSlot as _renderSlot, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode,
|
|
73
|
+
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";
|
|
64
74
|
const _hoisted_1 = { class: "jtable-body" };
|
|
65
75
|
import { proTableProps } from "./setting";
|
|
76
|
+
import { Spin } from 'ant-design-vue';
|
|
66
77
|
import Header from './Header.js';
|
|
67
78
|
import Alert from './Alert.js';
|
|
68
79
|
import Content from './Content.js';
|
|
@@ -70,7 +81,10 @@ import Pagination from './Pagination.js';
|
|
|
70
81
|
import { useSlots, watch, onMounted, onUnmounted, computed, ref, reactive, inject } from "vue";
|
|
71
82
|
import { debounce } from 'lodash-es';
|
|
72
83
|
import { TableConfig } from "../utils/constants";
|
|
73
|
-
import {
|
|
84
|
+
import { useTableInject } from "./hooks";
|
|
85
|
+
import useProTableStyle from "./style";
|
|
86
|
+
import { onlyMessage } from "@jetlinks-web/utils";
|
|
87
|
+
import { useLocaleReceiver } from "../LocaleReciver";
|
|
74
88
|
const __sfc_main__ = _defineComponent({
|
|
75
89
|
...{
|
|
76
90
|
name: 'JProTable'
|
|
@@ -98,16 +112,22 @@ const __sfc_main__ = _defineComponent({
|
|
|
98
112
|
});
|
|
99
113
|
const loading = ref(false);
|
|
100
114
|
const _dataSource = ref([]);
|
|
101
|
-
const _mode = ref(
|
|
115
|
+
const _mode = ref(props.mode || props.modeValue || 'CARD');
|
|
102
116
|
const column = ref(4);
|
|
103
117
|
const page = reactive({
|
|
104
118
|
pageIndex: 0,
|
|
105
119
|
pageSize: 12,
|
|
106
|
-
total: 0
|
|
120
|
+
total: 0,
|
|
121
|
+
loading: false
|
|
107
122
|
});
|
|
123
|
+
const prefixCls = computed(() => 'pro-table');
|
|
124
|
+
const [wrapSSR, hashId] = useProTableStyle(prefixCls);
|
|
125
|
+
const [contextLocale] = useLocaleReceiver('ProTable');
|
|
126
|
+
let currentRequestId = 0;
|
|
108
127
|
const extraSlots = ['headerRightRender', 'headerLeftRender', 'paginationRender', 'alertRender'];
|
|
128
|
+
const _rowSelection = useTableInject();
|
|
109
129
|
const showAlert = computed(() => {
|
|
110
|
-
return props.alertShow && _optionalChain([props, '
|
|
130
|
+
return props.alertShow && (_optionalChain([props, 'access', _2 => _2.rowSelection, 'optionalAccess', _3 => _3.selectedRowKeys, 'optionalAccess', _4 => _4.length]) || _optionalChain([_rowSelection, 'optionalAccess', _5 => _5.value, 'optionalAccess', _6 => _6.selectedRowKeys, 'optionalAccess', _7 => _7.length]));
|
|
111
131
|
});
|
|
112
132
|
const showPagination = computed(() => {
|
|
113
133
|
return !!_dataSource.value.length && !props.noPagination && props.type === 'PAGE';
|
|
@@ -115,20 +135,34 @@ const __sfc_main__ = _defineComponent({
|
|
|
115
135
|
const onCheck = (e) => {
|
|
116
136
|
_mode.value = e.target.value;
|
|
117
137
|
};
|
|
118
|
-
const handleData = (result) => {
|
|
138
|
+
const handleData = (result, _params) => {
|
|
119
139
|
if (props.type === 'PAGE') {
|
|
120
140
|
// 判断如果是最后一页且最后一页为空,就跳转到前一页
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
141
|
+
// 判断条件:如果是total分开查询,判断result的长度;如果不分开查询就判断result.data的长度
|
|
142
|
+
if (props.totalRequest) {
|
|
143
|
+
if (result.length === 0) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
_dataSource.value = result || [];
|
|
148
|
+
page.pageIndex = _optionalChain([_params, 'optionalAccess', _8 => _8.pageIndex]) || 0;
|
|
149
|
+
page.pageSize = _optionalChain([_params, 'optionalAccess', _9 => _9.pageSize]) || 12;
|
|
150
|
+
page.total = page.pageSize * (page.pageIndex + 1) + 1;
|
|
151
|
+
}
|
|
126
152
|
}
|
|
127
153
|
else {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
154
|
+
if (_optionalChain([result, 'optionalAccess', _10 => _10.total]) &&
|
|
155
|
+
_optionalChain([result, 'optionalAccess', _11 => _11.pageSize]) &&
|
|
156
|
+
_optionalChain([result, 'optionalAccess', _12 => _12.pageIndex]) &&
|
|
157
|
+
_optionalChain([result, 'optionalAccess', _13 => _13.data, 'optionalAccess', _14 => _14.length]) === 0) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
_dataSource.value = _optionalChain([result, 'optionalAccess', _15 => _15.data]) || [];
|
|
162
|
+
page.pageIndex = _optionalChain([result, 'optionalAccess', _16 => _16.pageIndex]) || 0;
|
|
163
|
+
page.pageSize = _optionalChain([result, 'optionalAccess', _17 => _17.pageSize]) || 12;
|
|
164
|
+
page.total = _optionalChain([result, 'optionalAccess', _18 => _18.total]) || 0;
|
|
165
|
+
}
|
|
132
166
|
}
|
|
133
167
|
}
|
|
134
168
|
else {
|
|
@@ -147,8 +181,8 @@ const __sfc_main__ = _defineComponent({
|
|
|
147
181
|
...props.defaultParams,
|
|
148
182
|
..._params,
|
|
149
183
|
terms: [
|
|
150
|
-
...(_optionalChain([props, 'access',
|
|
151
|
-
...(_optionalChain([_params, 'optionalAccess',
|
|
184
|
+
...(_optionalChain([props, 'access', _19 => _19.defaultParams, 'optionalAccess', _20 => _20.terms]) || []),
|
|
185
|
+
...(_optionalChain([_params, 'optionalAccess', _21 => _21.terms]) || []),
|
|
152
186
|
],
|
|
153
187
|
};
|
|
154
188
|
loading.value = true;
|
|
@@ -156,19 +190,40 @@ const __sfc_main__ = _defineComponent({
|
|
|
156
190
|
loading.value = false;
|
|
157
191
|
});
|
|
158
192
|
if (resp.success) {
|
|
159
|
-
const flag = handleData(resp.result || {});
|
|
193
|
+
const flag = handleData(resp.result || {}, _params);
|
|
160
194
|
if (flag) { // 判断如果是最后一页且最后一页为空,就跳转到前一页
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
pageSize
|
|
165
|
-
|
|
166
|
-
|
|
195
|
+
if (props.totalRequest) {
|
|
196
|
+
onlyMessage(_optionalChain([contextLocale, 'access', _22 => _22.value, 'access', _23 => _23.pagination, 'optionalAccess', _24 => _24.lastPage]) || '', 'error');
|
|
197
|
+
// 置灰下一页
|
|
198
|
+
page.total = page.pageSize * (page.pageIndex > 0 ? page.pageIndex : 1);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
page.pageIndex = page.pageIndex > 0 ? page.pageIndex - 1 : 0;
|
|
202
|
+
handleSearch({
|
|
203
|
+
..._params,
|
|
204
|
+
pageSize: page.pageSize,
|
|
205
|
+
pageIndex: page.pageIndex,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
167
208
|
}
|
|
168
209
|
}
|
|
169
210
|
else {
|
|
170
211
|
_dataSource.value = [];
|
|
171
212
|
}
|
|
213
|
+
if (props.totalRequest) {
|
|
214
|
+
currentRequestId++;
|
|
215
|
+
const requestId = currentRequestId;
|
|
216
|
+
page.loading = true;
|
|
217
|
+
props.totalRequest(__params).then((res) => {
|
|
218
|
+
if (res.success) {
|
|
219
|
+
page.total = res.result || 0;
|
|
220
|
+
}
|
|
221
|
+
}).finally(() => {
|
|
222
|
+
if (requestId === currentRequestId) {
|
|
223
|
+
page.loading = false;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
172
227
|
}
|
|
173
228
|
else {
|
|
174
229
|
_dataSource.value = [];
|
|
@@ -183,8 +238,13 @@ const __sfc_main__ = _defineComponent({
|
|
|
183
238
|
});
|
|
184
239
|
};
|
|
185
240
|
const onClose = () => {
|
|
186
|
-
|
|
187
|
-
|
|
241
|
+
if (props.rowSelection) {
|
|
242
|
+
_optionalChain([props, 'access', _25 => _25.rowSelection, 'access', _26 => _26.onChange, 'optionalCall', _27 => _27([], [])]);
|
|
243
|
+
_optionalChain([props, 'access', _28 => _28.rowSelection, 'access', _29 => _29.onSelectNone, 'optionalCall', _30 => _30()]);
|
|
244
|
+
}
|
|
245
|
+
else if (_optionalChain([_rowSelection, 'optionalAccess', _31 => _31.value])) {
|
|
246
|
+
_optionalChain([_rowSelection, 'access', _32 => _32.value, 'optionalAccess', _33 => _33.onSelectNone, 'optionalCall', _34 => _34()]);
|
|
247
|
+
}
|
|
188
248
|
};
|
|
189
249
|
/**
|
|
190
250
|
* 刷新数据
|
|
@@ -199,10 +259,10 @@ const __sfc_main__ = _defineComponent({
|
|
|
199
259
|
});
|
|
200
260
|
};
|
|
201
261
|
const _gridColumns = computed(() => {
|
|
202
|
-
if (_optionalChain([props, 'access',
|
|
262
|
+
if (_optionalChain([props, 'access', _35 => _35.gridColumns, 'optionalAccess', _36 => _36.length])) {
|
|
203
263
|
const arr = props.gridColumns;
|
|
204
|
-
const lastValue = _optionalChain([arr, 'access',
|
|
205
|
-
if (_optionalChain([arr, 'optionalAccess',
|
|
264
|
+
const lastValue = _optionalChain([arr, 'access', _37 => _37.slice, 'call', _38 => _38(-1), 'optionalAccess', _39 => _39[0]]);
|
|
265
|
+
if (_optionalChain([arr, 'optionalAccess', _40 => _40.length]) < 4) {
|
|
206
266
|
while (arr.length < 4) {
|
|
207
267
|
arr.push(lastValue);
|
|
208
268
|
}
|
|
@@ -223,16 +283,16 @@ const __sfc_main__ = _defineComponent({
|
|
|
223
283
|
const styles = window.getComputedStyle(ele);
|
|
224
284
|
const width = parseFloat(styles.width);
|
|
225
285
|
if (width <= 992) {
|
|
226
|
-
column.value = _optionalChain([_gridColumns, 'access',
|
|
286
|
+
column.value = _optionalChain([_gridColumns, 'access', _41 => _41.value, 'optionalAccess', _42 => _42[0]]) || 1;
|
|
227
287
|
}
|
|
228
288
|
else if (width > 992 && width <= 1440) {
|
|
229
|
-
column.value = _optionalChain([_gridColumns, 'access',
|
|
289
|
+
column.value = _optionalChain([_gridColumns, 'access', _43 => _43.value, 'optionalAccess', _44 => _44[1]]) || 2;
|
|
230
290
|
}
|
|
231
291
|
else if (width > 1440 && width <= 1600) {
|
|
232
|
-
column.value = _optionalChain([_gridColumns, 'access',
|
|
292
|
+
column.value = _optionalChain([_gridColumns, 'access', _45 => _45.value, 'optionalAccess', _46 => _46[2]]) || 3;
|
|
233
293
|
}
|
|
234
294
|
else if (width > 1600) {
|
|
235
|
-
column.value = _optionalChain([_gridColumns, 'access',
|
|
295
|
+
column.value = _optionalChain([_gridColumns, 'access', _47 => _47.value, 'optionalAccess', _48 => _48[3]]) || 4;
|
|
236
296
|
}
|
|
237
297
|
}
|
|
238
298
|
};
|
|
@@ -256,15 +316,11 @@ const __sfc_main__ = _defineComponent({
|
|
|
256
316
|
__expose({ reload, dataSource: _dataSource });
|
|
257
317
|
return (_ctx, _cache) => {
|
|
258
318
|
return (_openBlock(), _createElementBlock("div", {
|
|
259
|
-
class:
|
|
319
|
+
class: _normalizeClass(['jtable-body-spin', _unref(hashId)]),
|
|
260
320
|
style: _normalizeStyle(_ctx.bodyStyle),
|
|
261
321
|
id: "jtable-body-spin"
|
|
262
322
|
}, [
|
|
263
|
-
_createVNode(_unref(
|
|
264
|
-
loading: loading.value,
|
|
265
|
-
active: true,
|
|
266
|
-
mode: _mode.value
|
|
267
|
-
}, {
|
|
323
|
+
_createVNode(_unref(Spin), { spinning: loading.value }, {
|
|
268
324
|
default: _withCtx(() => [
|
|
269
325
|
_createElementVNode("div", _hoisted_1, [
|
|
270
326
|
_createVNode(Header, {
|
|
@@ -284,12 +340,12 @@ const __sfc_main__ = _defineComponent({
|
|
|
284
340
|
(showAlert.value)
|
|
285
341
|
? (_openBlock(), _createBlock(Alert, {
|
|
286
342
|
key: 0,
|
|
287
|
-
rowSelection: _ctx.rowSelection,
|
|
343
|
+
rowSelection: _ctx.rowSelection || _unref(_rowSelection),
|
|
288
344
|
onClose: onClose
|
|
289
345
|
}, {
|
|
290
346
|
default: _withCtx(() => [
|
|
291
347
|
_renderSlot(_ctx.$slots, "alertRender", {
|
|
292
|
-
rowSelection: _ctx.rowSelection,
|
|
348
|
+
rowSelection: _ctx.rowSelection || _unref(_rowSelection),
|
|
293
349
|
onClose: onClose
|
|
294
350
|
})
|
|
295
351
|
]),
|
|
@@ -319,7 +375,9 @@ const __sfc_main__ = _defineComponent({
|
|
|
319
375
|
}, myPagination.value, {
|
|
320
376
|
total: page.total,
|
|
321
377
|
pageIndex: page.pageIndex,
|
|
322
|
-
pageSize: page.pageSize
|
|
378
|
+
pageSize: page.pageSize,
|
|
379
|
+
totalLoading: page.loading,
|
|
380
|
+
totalRequest: _ctx.totalRequest
|
|
323
381
|
}), {
|
|
324
382
|
default: _withCtx(() => [
|
|
325
383
|
_renderSlot(_ctx.$slots, "paginationRender", {
|
|
@@ -330,13 +388,13 @@ const __sfc_main__ = _defineComponent({
|
|
|
330
388
|
})
|
|
331
389
|
]),
|
|
332
390
|
_: 3 /* FORWARDED */
|
|
333
|
-
}, 16 /* FULL_PROPS */, ["total", "pageIndex", "pageSize"]))
|
|
391
|
+
}, 16 /* FULL_PROPS */, ["total", "pageIndex", "pageSize", "totalLoading", "totalRequest"]))
|
|
334
392
|
: _createCommentVNode("v-if", true)
|
|
335
393
|
])
|
|
336
394
|
]),
|
|
337
395
|
_: 3 /* FORWARDED */
|
|
338
|
-
}, 8 /* PROPS */, ["
|
|
339
|
-
],
|
|
396
|
+
}, 8 /* PROPS */, ["spinning"])
|
|
397
|
+
], 6 /* CLASS, STYLE */));
|
|
340
398
|
};
|
|
341
399
|
}
|
|
342
400
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _useTableSelection = require("./useTableSelection");
|
|
7
|
+
Object.keys(_useTableSelection).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _useTableSelection[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _useTableSelection[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _useTableInject = require("./useTableInject");
|
|
18
|
+
Object.keys(_useTableInject).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _useTableInject[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _useTableInject[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTableInject = void 0;
|
|
7
|
+
var _useTableSelection = require("./useTableSelection");
|
|
8
|
+
var _vue = require("vue");
|
|
9
|
+
var useTableInject = exports.useTableInject = function useTableInject() {
|
|
10
|
+
return (0, _vue.inject)(_useTableSelection.PROTABLE_ROW_SELECTION_KEY, null);
|
|
11
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useTableSelection = exports.PROTABLE_ROW_SELECTION_KEY = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _vue = require("vue");
|
|
11
|
+
var _lodashEs = require("lodash");
|
|
12
|
+
var PROTABLE_ROW_SELECTION_KEY = exports.PROTABLE_ROW_SELECTION_KEY = Symbol('protable-row-selection-key');
|
|
13
|
+
var useTableSelection = exports.useTableSelection = function useTableSelection() {
|
|
14
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
15
|
+
type: 'checkbox',
|
|
16
|
+
rowKey: "id",
|
|
17
|
+
isCheck: true
|
|
18
|
+
};
|
|
19
|
+
var _options$type = options.type,
|
|
20
|
+
type = _options$type === void 0 ? 'checkbox' : _options$type,
|
|
21
|
+
_options$rowKey = options.rowKey,
|
|
22
|
+
rowKey = _options$rowKey === void 0 ? 'id' : _options$rowKey;
|
|
23
|
+
var selectedRowKeys = (0, _vue.ref)([]);
|
|
24
|
+
var selectedRows = (0, _vue.ref)([]);
|
|
25
|
+
var selectionObj = (0, _vue.ref)(null);
|
|
26
|
+
var isCheckRef = (0, _vue.computed)(function () {
|
|
27
|
+
return (0, _vue.unref)(options.isCheck);
|
|
28
|
+
});
|
|
29
|
+
var onSelect = function onSelect(record, selected) {
|
|
30
|
+
if (type === 'checkbox') {
|
|
31
|
+
if (selected) {
|
|
32
|
+
selectedRows.value.push(record);
|
|
33
|
+
} else {
|
|
34
|
+
selectedRows.value = selectedRows.value.filter(function (i) {
|
|
35
|
+
return i[rowKey] !== record[rowKey];
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
selectedRowKeys.value = selectedRows.value.map(function (i) {
|
|
39
|
+
return i[rowKey];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
// 单选
|
|
44
|
+
var onChange = function onChange(_selectedRowKeys, _selectedRows) {
|
|
45
|
+
if (type === 'radio') {
|
|
46
|
+
selectedRowKeys.value = _selectedRowKeys;
|
|
47
|
+
selectedRows.value = _selectedRows;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var onSelectAll = function onSelectAll(selected, _selectedRows, changeRows) {
|
|
51
|
+
if (selected) {
|
|
52
|
+
var _selectedRows$value;
|
|
53
|
+
(_selectedRows$value = selectedRows.value).push.apply(_selectedRows$value, (0, _toConsumableArray2.default)(changeRows));
|
|
54
|
+
} else {
|
|
55
|
+
var arr = changeRows.map(function (item) {
|
|
56
|
+
return item[rowKey];
|
|
57
|
+
});
|
|
58
|
+
selectedRows.value = selectedRows.value.filter(function (i) {
|
|
59
|
+
return !arr.includes(i[rowKey]);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
selectedRowKeys.value = selectedRows.value.map(function (i) {
|
|
63
|
+
return i[rowKey];
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
var onSelectNone = function onSelectNone() {
|
|
67
|
+
selectedRowKeys.value = [];
|
|
68
|
+
selectedRows.value = [];
|
|
69
|
+
};
|
|
70
|
+
var updateSelection = function updateSelection() {
|
|
71
|
+
if (isCheckRef.value) {
|
|
72
|
+
// 提供选择上下文
|
|
73
|
+
selectionObj.value = type === 'checkbox' ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodashEs.omit)(options, ['isCheck'])), {}, {
|
|
74
|
+
selectedRowKeys: selectedRowKeys,
|
|
75
|
+
onSelect: onSelect,
|
|
76
|
+
onSelectAll: onSelectAll,
|
|
77
|
+
onSelectNone: onSelectNone
|
|
78
|
+
}) : (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodashEs.omit)(options, ['isCheck'])), {}, {
|
|
79
|
+
selectedRowKeys: selectedRowKeys,
|
|
80
|
+
onChange: onChange,
|
|
81
|
+
onSelectNone: onSelectNone
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
// 清空选择状态
|
|
85
|
+
onSelectNone();
|
|
86
|
+
selectionObj.value = null;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
(0, _vue.watch)(isCheckRef, function () {
|
|
90
|
+
updateSelection();
|
|
91
|
+
}, {
|
|
92
|
+
immediate: true,
|
|
93
|
+
deep: false
|
|
94
|
+
} // 注意:deep 设为 false
|
|
95
|
+
);
|
|
96
|
+
(0, _vue.provide)(PROTABLE_ROW_SELECTION_KEY, selectionObj);
|
|
97
|
+
return {
|
|
98
|
+
selectedRowKeys: selectedRowKeys,
|
|
99
|
+
selectedRows: selectedRows,
|
|
100
|
+
onSelectNone: onSelectNone
|
|
101
|
+
};
|
|
102
|
+
};
|
package/lib/ProTable/setting.js
CHANGED
|
@@ -55,7 +55,7 @@ var _contentProps = exports._contentProps = (0, _objectSpread2.default)((0, _obj
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
scroll: {
|
|
58
|
-
type: Object,
|
|
58
|
+
type: [Object, Boolean],
|
|
59
59
|
default: function _default() {
|
|
60
60
|
return {};
|
|
61
61
|
} // x: 1366
|
|
@@ -63,6 +63,14 @@ var _contentProps = exports._contentProps = (0, _objectSpread2.default)((0, _obj
|
|
|
63
63
|
rowKey: {
|
|
64
64
|
type: [String, Function],
|
|
65
65
|
default: 'id'
|
|
66
|
+
},
|
|
67
|
+
type: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'PAGE'
|
|
70
|
+
},
|
|
71
|
+
height: {
|
|
72
|
+
type: Number,
|
|
73
|
+
default: 500
|
|
66
74
|
}
|
|
67
75
|
});
|
|
68
76
|
var _paginationProps = exports._paginationProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodashEs.omit)((0, _Pagination.paginationProps)(), ['onChange'])), {}, {
|
|
@@ -83,6 +91,17 @@ var _paginationProps = exports._paginationProps = (0, _objectSpread2.default)((0
|
|
|
83
91
|
*/
|
|
84
92
|
isShowContent: {
|
|
85
93
|
type: Boolean
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* 总数loading状态
|
|
97
|
+
*/
|
|
98
|
+
totalLoading: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false
|
|
101
|
+
},
|
|
102
|
+
totalRequest: {
|
|
103
|
+
type: Function,
|
|
104
|
+
default: undefined
|
|
86
105
|
}
|
|
87
106
|
});
|
|
88
107
|
var proTableProps = exports.proTableProps = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, _contentProps), _alertProps), {}, {
|
|
@@ -98,6 +117,10 @@ var proTableProps = exports.proTableProps = (0, _objectSpread2.default)((0, _obj
|
|
|
98
117
|
type: Function,
|
|
99
118
|
default: undefined
|
|
100
119
|
},
|
|
120
|
+
totalRequest: {
|
|
121
|
+
type: Function,
|
|
122
|
+
default: undefined
|
|
123
|
+
},
|
|
101
124
|
params: {
|
|
102
125
|
type: Object,
|
|
103
126
|
default: function _default() {
|