@jetlinks-web/components 2.0.32 → 2.0.33

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.
Files changed (38) hide show
  1. package/es/FullPage/FullPage.js +1 -1
  2. package/es/ProTable/Alert.js +73 -0
  3. package/es/ProTable/Content.js +122 -0
  4. package/es/ProTable/Header.js +73 -0
  5. package/es/ProTable/Pagination.js +46 -0
  6. package/es/ProTable/ProTable.js +310 -0
  7. package/es/ProTable/index.js +1 -410
  8. package/es/ProTable/setting.js +119 -0
  9. package/es/ProTable/style/ProTable.less +83 -0
  10. package/es/ProTable/style/index.js +1 -1
  11. package/es/Search/Advanced/SaveHistory.js +1 -1
  12. package/es/Search/Item.js +1 -1
  13. package/es/Search/Search.js +1 -1
  14. package/es/style/index.css +20 -20
  15. package/es/style/index.less +7 -7
  16. package/lib/FullPage/FullPage.js +1 -1
  17. package/lib/ProTable/Alert.js +73 -0
  18. package/lib/ProTable/Content.js +122 -0
  19. package/lib/ProTable/Header.js +73 -0
  20. package/lib/ProTable/Pagination.js +46 -0
  21. package/lib/ProTable/ProTable.js +310 -0
  22. package/lib/ProTable/index.js +4 -412
  23. package/lib/ProTable/setting.js +126 -0
  24. package/lib/ProTable/style/ProTable.less +83 -0
  25. package/lib/ProTable/style/index.js +1 -1
  26. package/lib/Search/Advanced/SaveHistory.js +1 -1
  27. package/lib/Search/Item.js +1 -1
  28. package/lib/Search/Search.js +1 -1
  29. package/lib/style/components.less +0 -1
  30. package/lib/style/index.css +20 -20
  31. package/lib/style/index.less +7 -7
  32. package/package.json +1 -1
  33. package/es/ProTable/proTableTypes.js +0 -11
  34. package/es/ProTable/style/index.css +0 -69
  35. package/es/ProTable/style/index.less +0 -92
  36. package/lib/ProTable/proTableTypes.js +0 -17
  37. package/lib/ProTable/style/index.css +0 -69
  38. package/lib/ProTable/style/index.less +0 -92
@@ -6,7 +6,7 @@
6
6
  } */
7
7
  import { defineComponent as _defineComponent } from 'vue';
8
8
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
9
- const _withScopeId = n => (_pushScopeId("data-v-1716194136622"), n = n(), _popScopeId(), n);
9
+ const _withScopeId = n => (_pushScopeId("data-v-1716520751726"), n = n(), _popScopeId(), n);
10
10
  const _hoisted_1 = { class: "full-page-warp-content" };
11
11
  import { ref } from 'vue';
12
12
  import { useElementBounding } from '@vueuse/core';
@@ -0,0 +1,73 @@
1
+ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
+ const op = ops[i];
3
+ const fn = ops[i + 1];
4
+ i += 2;
5
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
+ return undefined;
7
+ }
8
+ if (op === 'access' || op === 'optionalAccess') {
9
+ lastAccessLHS = value;
10
+ value = fn(value);
11
+ }
12
+ else if (op === 'call' || op === 'optionalCall') {
13
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
14
+ lastAccessLHS = undefined;
15
+ }
16
+ } return value; }
17
+ /* Analyzed bindings: {
18
+ "Alert": "setup-maybe-ref",
19
+ "Button": "setup-maybe-ref",
20
+ "computed": "setup-const",
21
+ "_alertProps": "setup-maybe-ref",
22
+ "props": "setup-reactive-const",
23
+ "emits": "setup-const",
24
+ "_message": "setup-ref",
25
+ "onClose": "setup-const"
26
+ } */
27
+ import { defineComponent as _defineComponent } from 'vue';
28
+ import { renderSlot as _renderSlot, createTextVNode as _createTextVNode, unref as _unref, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
29
+ const _hoisted_1 = { class: "jtable-alert" };
30
+ import { Alert, Button } from 'ant-design-vue';
31
+ import { computed } from "vue";
32
+ import { _alertProps } from "./setting";
33
+ const __sfc_main__ = _defineComponent({
34
+ ...{
35
+ name: 'Alert'
36
+ },
37
+ props: { ..._alertProps },
38
+ emits: ['close'],
39
+ setup(__props, { emit: __emit }) {
40
+ const props = __props;
41
+ const emits = __emit;
42
+ const _message = computed(() => {
43
+ return '已选择' + (_optionalChain([props, 'access', _2 => _2.rowSelection, 'optionalAccess', _3 => _3.selectedRowKeys, 'optionalAccess', _4 => _4.length]) || 0) + '项';
44
+ });
45
+ const onClose = () => {
46
+ emits('close');
47
+ };
48
+ return (_ctx, _cache) => {
49
+ return (_openBlock(), _createElementBlock("div", _hoisted_1, [
50
+ _renderSlot(_ctx.$slots, "default", {}, () => [
51
+ _createVNode(_unref(Alert), {
52
+ type: "info",
53
+ message: _message.value
54
+ }, {
55
+ closeText: _withCtx(() => [
56
+ _createVNode(_unref(Button), {
57
+ type: "link",
58
+ onClick: onClose
59
+ }, {
60
+ default: _withCtx(() => [
61
+ _createTextVNode("取消选择")
62
+ ]),
63
+ _: 1 /* STABLE */
64
+ })
65
+ ]),
66
+ _: 1 /* STABLE */
67
+ }, 8 /* PROPS */, ["message"])
68
+ ])
69
+ ]));
70
+ };
71
+ }
72
+ });
73
+ export default __sfc_main__;
@@ -0,0 +1,122 @@
1
+ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
+ const op = ops[i];
3
+ const fn = ops[i + 1];
4
+ i += 2;
5
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
+ return undefined;
7
+ }
8
+ if (op === 'access' || op === 'optionalAccess') {
9
+ lastAccessLHS = value;
10
+ value = fn(value);
11
+ }
12
+ else if (op === 'call' || op === 'optionalCall') {
13
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
14
+ lastAccessLHS = undefined;
15
+ }
16
+ } return value; }
17
+ /* Analyzed bindings: {
18
+ "column": "props",
19
+ "useSlots": "setup-const",
20
+ "computed": "setup-const",
21
+ "_contentProps": "setup-maybe-ref",
22
+ "Table": "setup-maybe-ref",
23
+ "get": "setup-maybe-ref",
24
+ "isString": "setup-maybe-ref",
25
+ "Empty": "setup-maybe-ref",
26
+ "props": "setup-reactive-const",
27
+ "slots": "setup-maybe-ref",
28
+ "_columns": "setup-ref",
29
+ "cardStyle": "setup-ref",
30
+ "gridTemplateColumns": "setup-ref"
31
+ } */
32
+ import { defineComponent as _defineComponent } from 'vue';
33
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, unref as _unref, createVNode as _createVNode, mergeProps as _mergeProps, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createBlock as _createBlock } from "vue";
34
+ const _hoisted_1 = { class: "jtable-box" };
35
+ const _hoisted_2 = {
36
+ key: 1,
37
+ class: "j-table-empty"
38
+ };
39
+ import { useSlots, computed } from 'vue';
40
+ import { _contentProps } from "./setting";
41
+ import { Table } from 'ant-design-vue';
42
+ import { get, isString } from 'lodash-es';
43
+ import Empty from '../Empty';
44
+ const __sfc_main__ = _defineComponent({
45
+ ...{
46
+ name: 'Content'
47
+ },
48
+ props: {
49
+ ..._contentProps,
50
+ column: {
51
+ type: Number,
52
+ default: 4
53
+ }
54
+ },
55
+ setup(__props) {
56
+ const props = __props;
57
+ const slots = useSlots();
58
+ const _columns = computed(() => props.columns.filter((i) => !_optionalChain([i, 'optionalAccess', _2 => _2.hideInTable])));
59
+ const cardStyle = computed(() => props.scroll && props.scroll.y ? {
60
+ maxHeight: isString(props.scroll.y) ? props.scroll.y : props.scroll.y + 'px',
61
+ overflow: 'auto',
62
+ }
63
+ : undefined);
64
+ const gridTemplateColumns = computed(() => {
65
+ return `repeat(${props.column}, 1fr)`;
66
+ });
67
+ return (_ctx, _cache) => {
68
+ return (_openBlock(), _createElementBlock("div", _hoisted_1, [
69
+ (_ctx.mode === 'CARD')
70
+ ? (_openBlock(), _createElementBlock("div", {
71
+ key: 0,
72
+ class: "jtable-card",
73
+ style: _normalizeStyle(cardStyle.value)
74
+ }, [
75
+ (_ctx.dataSource.length)
76
+ ? (_openBlock(), _createElementBlock("div", {
77
+ key: 0,
78
+ class: "jtable-card-items",
79
+ style: _normalizeStyle({ gridTemplateColumns: gridTemplateColumns.value })
80
+ }, [
81
+ (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.dataSource, (item) => {
82
+ return (_openBlock(), _createElementBlock("div", {
83
+ class: _normalizeClass(['jtable-card-item', props.cardBodyClass]),
84
+ key: item[_ctx.rowKey]
85
+ }, [
86
+ _renderSlot(_ctx.$slots, "card", _normalizeProps(_guardReactiveProps(item)))
87
+ ], 2 /* CLASS */));
88
+ }), 128 /* KEYED_FRAGMENT */))
89
+ ], 4 /* STYLE */))
90
+ : (_openBlock(), _createElementBlock("div", _hoisted_2, [
91
+ _renderSlot(_ctx.$slots, "emptyText", {}, () => [
92
+ _createVNode(_unref(Empty))
93
+ ])
94
+ ]))
95
+ ], 4 /* STYLE */))
96
+ : (_openBlock(), _createBlock(_unref(Table), _mergeProps({ key: 1 }, props, {
97
+ dataSource: _ctx.dataSource,
98
+ columns: _columns.value,
99
+ pagination: false
100
+ }), {
101
+ headerCell: _withCtx(({ column, title }) => [
102
+ _renderSlot(_ctx.$slots, "headerCell", _normalizeProps(_guardReactiveProps({ column, title })))
103
+ ]),
104
+ bodyCell: _withCtx(({ column, record }) => [
105
+ ((_optionalChain([column, 'optionalAccess', _3 => _3.key]) || _optionalChain([column, 'optionalAccess', _4 => _4.dataIndex])) && _optionalChain([column, 'optionalAccess', _5 => _5.scopedSlots]) && (_optionalChain([_unref, 'call', _6 => _6(slots), 'optionalAccess', _7 => _7[_optionalChain([column, 'optionalAccess', _8 => _8.dataIndex])]]) || _optionalChain([_unref, 'call', _9 => _9(slots), 'optionalAccess', _10 => _10[_optionalChain([column, 'optionalAccess', _11 => _11.key])]])))
106
+ ? _renderSlot(_ctx.$slots, _optionalChain([column, 'optionalAccess', _12 => _12.key]) || _optionalChain([column, 'optionalAccess', _13 => _13.dataIndex]), _normalizeProps(_mergeProps({ key: 0 }, record)))
107
+ : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
108
+ _createTextVNode(_toDisplayString(_unref(get)(record, _optionalChain([column, 'optionalAccess', _14 => _14.dataIndex]) || _optionalChain([column, 'optionalAccess', _15 => _15.key]))), 1 /* TEXT */)
109
+ ], 64 /* STABLE_FRAGMENT */))
110
+ ]),
111
+ emptyText: _withCtx(() => [
112
+ _renderSlot(_ctx.$slots, "emptyText", {}, () => [
113
+ _createVNode(_unref(Empty))
114
+ ])
115
+ ]),
116
+ _: 3 /* FORWARDED */
117
+ }, 16 /* FULL_PROPS */, ["dataSource", "columns"]))
118
+ ]));
119
+ };
120
+ }
121
+ });
122
+ export default __sfc_main__;
@@ -0,0 +1,73 @@
1
+ /* Analyzed bindings: {
2
+ "initMode": "props",
3
+ "RadioGroup": "setup-maybe-ref",
4
+ "RadioButton": "setup-maybe-ref",
5
+ "AIcon": "setup-maybe-ref",
6
+ "_headerProps": "setup-maybe-ref",
7
+ "props": "setup-reactive-const",
8
+ "emits": "setup-const"
9
+ } */
10
+ import { defineComponent as _defineComponent } from 'vue';
11
+ import { renderSlot as _renderSlot, createElementVNode as _createElementVNode, unref as _unref, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode } from "vue";
12
+ const _hoisted_1 = { class: "jtable-body-header" };
13
+ const _hoisted_2 = { class: "jtable-body-header-left" };
14
+ const _hoisted_3 = { class: "jtable-body-header-right" };
15
+ const _hoisted_4 = {
16
+ key: 0,
17
+ class: "table-body-header-right-button"
18
+ };
19
+ import { RadioGroup, RadioButton } from 'ant-design-vue';
20
+ import AIcon from '../Icon';
21
+ import { _headerProps } from './setting';
22
+ const __sfc_main__ = _defineComponent({
23
+ ...{
24
+ name: 'Header'
25
+ },
26
+ props: {
27
+ ..._headerProps,
28
+ initMode: {
29
+ type: [String, undefined],
30
+ default: undefined
31
+ }
32
+ },
33
+ emits: ['change'],
34
+ setup(__props, { emit: __emit }) {
35
+ const props = __props;
36
+ const emits = __emit;
37
+ return (_ctx, _cache) => {
38
+ return (_openBlock(), _createElementBlock("div", _hoisted_1, [
39
+ _createElementVNode("div", _hoisted_2, [
40
+ _renderSlot(_ctx.$slots, "headerLeftRender")
41
+ ]),
42
+ _createElementVNode("div", _hoisted_3, [
43
+ _renderSlot(_ctx.$slots, "headerRightRender"),
44
+ (!__props.initMode)
45
+ ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
46
+ _createVNode(_unref(RadioGroup), {
47
+ value: _ctx.mode,
48
+ onChange: _cache[0] || (_cache[0] = (e) => emits('change', e))
49
+ }, {
50
+ default: _withCtx(() => [
51
+ _createVNode(_unref(RadioButton), { value: "TABLE" }, {
52
+ default: _withCtx(() => [
53
+ _createVNode(_unref(AIcon), { type: "UnorderedListOutlined" })
54
+ ]),
55
+ _: 1 /* STABLE */
56
+ }),
57
+ _createVNode(_unref(RadioButton), { value: "CARD" }, {
58
+ default: _withCtx(() => [
59
+ _createVNode(_unref(AIcon), { type: "AppstoreOutlined" })
60
+ ]),
61
+ _: 1 /* STABLE */
62
+ })
63
+ ]),
64
+ _: 1 /* STABLE */
65
+ }, 8 /* PROPS */, ["value"])
66
+ ]))
67
+ : _createCommentVNode("v-if", true)
68
+ ])
69
+ ]));
70
+ };
71
+ }
72
+ });
73
+ export default __sfc_main__;
@@ -0,0 +1,46 @@
1
+ /* Analyzed bindings: {
2
+ "Pagination": "setup-maybe-ref",
3
+ "paginationProps": "setup-maybe-ref",
4
+ "props": "setup-reactive-const",
5
+ "emits": "setup-const",
6
+ "_showTotal": "setup-const",
7
+ "onChange": "setup-const"
8
+ } */
9
+ import { defineComponent as _defineComponent } from 'vue';
10
+ import { renderSlot as _renderSlot, unref as _unref, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
11
+ const _hoisted_1 = { class: "jtable-pagination" };
12
+ import { Pagination } from 'ant-design-vue';
13
+ import { paginationProps } from "./setting";
14
+ const __sfc_main__ = _defineComponent({
15
+ ...{
16
+ name: 'Pagination'
17
+ },
18
+ props: { ...paginationProps },
19
+ emits: ['change'],
20
+ setup(__props, { emit: __emit }) {
21
+ const props = __props;
22
+ const emits = __emit;
23
+ const _showTotal = (num) => {
24
+ const minSize = props.pageIndex * props.pageSize + 1;
25
+ const MaxSize = (props.pageIndex + 1) * props.pageSize;
26
+ return `第 ${minSize} - ${MaxSize > num ? num : MaxSize} 条/总共 ${num} 条`;
27
+ };
28
+ const onChange = (page, size) => {
29
+ emits('change', page, size);
30
+ };
31
+ return (_ctx, _cache) => {
32
+ return (_openBlock(), _createElementBlock("div", _hoisted_1, [
33
+ _renderSlot(_ctx.$slots, "default", {}, () => [
34
+ _createVNode(_unref(Pagination), {
35
+ total: _ctx.total,
36
+ pageSize: _ctx.pageSize,
37
+ current: _ctx.pageIndex + 1,
38
+ "show-total": (num) => _showTotal(num),
39
+ onChange: onChange
40
+ }, null, 8 /* PROPS */, ["total", "pageSize", "current", "show-total"])
41
+ ])
42
+ ]));
43
+ };
44
+ }
45
+ });
46
+ export default __sfc_main__;
@@ -0,0 +1,310 @@
1
+ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
+ const op = ops[i];
3
+ const fn = ops[i + 1];
4
+ i += 2;
5
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
+ return undefined;
7
+ }
8
+ if (op === 'access' || op === 'optionalAccess') {
9
+ lastAccessLHS = value;
10
+ value = fn(value);
11
+ }
12
+ else if (op === 'call' || op === 'optionalCall') {
13
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
14
+ lastAccessLHS = undefined;
15
+ }
16
+ } return value; }
17
+ /* Analyzed bindings: {
18
+ "proTableProps": "setup-maybe-ref",
19
+ "Spin": "setup-maybe-ref",
20
+ "Header": "setup-const",
21
+ "Alert": "setup-const",
22
+ "Content": "setup-const",
23
+ "Pagination": "setup-const",
24
+ "useSlots": "setup-const",
25
+ "watch": "setup-const",
26
+ "onMounted": "setup-const",
27
+ "onUnmounted": "setup-const",
28
+ "computed": "setup-const",
29
+ "ref": "setup-const",
30
+ "reactive": "setup-const",
31
+ "debounce": "setup-maybe-ref",
32
+ "props": "setup-reactive-const",
33
+ "slots": "setup-maybe-ref",
34
+ "loading": "setup-ref",
35
+ "_dataSource": "setup-ref",
36
+ "_mode": "setup-ref",
37
+ "column": "setup-ref",
38
+ "page": "setup-reactive-const",
39
+ "extraSlots": "setup-const",
40
+ "showAlert": "setup-ref",
41
+ "showPagination": "setup-ref",
42
+ "onCheck": "setup-const",
43
+ "handleData": "setup-const",
44
+ "handleSearch": "setup-const",
45
+ "_debounceFn": "setup-maybe-ref",
46
+ "onPageChange": "setup-const",
47
+ "onClose": "setup-const",
48
+ "reload": "setup-const",
49
+ "_gridColumns": "setup-ref",
50
+ "windowChange": "setup-const"
51
+ } */
52
+ import { defineComponent as _defineComponent } from 'vue';
53
+ import { renderSlot as _renderSlot, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, unref as _unref, normalizeProps as _normalizeProps, mergeProps as _mergeProps, renderList as _renderList, createSlots as _createSlots, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, createElementBlock as _createElementBlock } from "vue";
54
+ const _hoisted_1 = { class: "jtable-body" };
55
+ import { proTableProps } from "./setting";
56
+ import { Spin } from 'ant-design-vue';
57
+ import Header from './Header.js';
58
+ import Alert from './Alert.js';
59
+ import Content from './Content.js';
60
+ import Pagination from './Pagination.js';
61
+ import { useSlots, watch, onMounted, onUnmounted, computed, ref, reactive } from "vue";
62
+ import { debounce } from 'lodash-es';
63
+ const __sfc_main__ = _defineComponent({
64
+ ...{
65
+ name: 'JProTable'
66
+ },
67
+ props: {
68
+ ...proTableProps
69
+ },
70
+ setup(__props, { expose: __expose }) {
71
+ const props = __props;
72
+ const slots = useSlots();
73
+ const loading = ref(false);
74
+ const _dataSource = ref([]);
75
+ const _mode = ref(!props.mode ? (props.modeValue || 'CARD') : props.mode);
76
+ const column = ref(4);
77
+ const page = reactive({
78
+ pageIndex: 0,
79
+ pageSize: 12,
80
+ total: 0
81
+ });
82
+ const extraSlots = ['headerRightRender', 'headerLeftRender', 'paginationRender', 'alertRender'];
83
+ const showAlert = computed(() => {
84
+ return props.alertShow && _optionalChain([props, 'optionalAccess', _2 => _2.rowSelection, 'optionalAccess', _3 => _3.selectedRowKeys, 'optionalAccess', _4 => _4.length]);
85
+ });
86
+ const showPagination = computed(() => {
87
+ return !!_dataSource.value.length && !props.noPagination && props.type === 'PAGE';
88
+ });
89
+ const onCheck = (e) => {
90
+ _mode.value = e.target.value;
91
+ };
92
+ const handleData = (result) => {
93
+ if (props.type === 'PAGE') {
94
+ // 判断如果是最后一页且最后一页为空,就跳转到前一页
95
+ if (_optionalChain([result, 'optionalAccess', _5 => _5.total]) &&
96
+ _optionalChain([result, 'optionalAccess', _6 => _6.pageSize]) &&
97
+ _optionalChain([result, 'optionalAccess', _7 => _7.pageIndex]) &&
98
+ _optionalChain([result, 'optionalAccess', _8 => _8.data, 'optionalAccess', _9 => _9.length]) === 0) {
99
+ return true;
100
+ }
101
+ else {
102
+ _dataSource.value = _optionalChain([result, 'optionalAccess', _10 => _10.data]) || [];
103
+ page.pageIndex = _optionalChain([result, 'optionalAccess', _11 => _11.pageIndex]) || 0;
104
+ page.pageSize = _optionalChain([result, 'optionalAccess', _12 => _12.pageSize]) || 12;
105
+ page.total = _optionalChain([result, 'optionalAccess', _13 => _13.total]) || 0;
106
+ }
107
+ }
108
+ else {
109
+ _dataSource.value = result || [];
110
+ }
111
+ return false;
112
+ };
113
+ const handleSearch = async (_params) => {
114
+ if (Array.isArray(props.dataSource)) {
115
+ _dataSource.value = [];
116
+ }
117
+ else if (props.request) {
118
+ const __params = {
119
+ pageIndex: page.pageIndex,
120
+ pageSize: Number(page.pageSize),
121
+ ...props.defaultParams,
122
+ ..._params,
123
+ terms: [
124
+ ...(_optionalChain([props, 'access', _14 => _14.defaultParams, 'optionalAccess', _15 => _15.terms]) || []),
125
+ ...(_optionalChain([_params, 'optionalAccess', _16 => _16.terms]) || []),
126
+ ],
127
+ };
128
+ loading.value = true;
129
+ const resp = await props.request(__params).finally(() => {
130
+ loading.value = false;
131
+ });
132
+ if (resp.success) {
133
+ const flag = handleData(resp.result || {});
134
+ if (flag) { // 判断如果是最后一页且最后一页为空,就跳转到前一页
135
+ page.pageIndex = page.pageIndex > 0 ? page.pageIndex - 1 : 0;
136
+ handleSearch({
137
+ ..._params,
138
+ pageSize: page.pageSize,
139
+ pageIndex: page.pageIndex,
140
+ });
141
+ }
142
+ }
143
+ else {
144
+ _dataSource.value = [];
145
+ }
146
+ }
147
+ else {
148
+ _dataSource.value = [];
149
+ }
150
+ };
151
+ const _debounceFn = debounce(handleSearch, 300);
152
+ watch(() => props.params, (newValue) => {
153
+ _debounceFn(newValue || {});
154
+ }, { deep: true, immediate: true });
155
+ watch(() => props.dataSource, () => {
156
+ handleSearch(props.params);
157
+ }, { deep: true, immediate: true });
158
+ const onPageChange = (_page, size) => {
159
+ handleSearch({
160
+ ...props.params,
161
+ pageSize: size,
162
+ pageIndex: page.pageSize === size ? (_page ? _page - 1 : 0) : 0
163
+ });
164
+ };
165
+ const onClose = () => {
166
+ _optionalChain([props, 'access', _17 => _17.rowSelection, 'optionalAccess', _18 => _18.onChange, 'optionalCall', _19 => _19([], [])]);
167
+ _optionalChain([props, 'access', _20 => _20.rowSelection, 'optionalAccess', _21 => _21.onSelectNone, 'optionalCall', _22 => _22()]);
168
+ };
169
+ /**
170
+ * 刷新数据
171
+ * @param _params
172
+ */
173
+ const reload = (_params) => {
174
+ handleSearch({
175
+ ...props.params,
176
+ ..._params,
177
+ pageSize: page.pageSize || 12,
178
+ pageIndex: page.pageIndex || 0,
179
+ });
180
+ };
181
+ const _gridColumns = computed(() => {
182
+ if (_optionalChain([props, 'access', _23 => _23.gridColumns, 'optionalAccess', _24 => _24.length])) {
183
+ const arr = props.gridColumns;
184
+ const lastValue = _optionalChain([arr, 'access', _25 => _25.slice, 'call', _26 => _26(-1), 'optionalAccess', _27 => _27[0]]);
185
+ if (_optionalChain([arr, 'optionalAccess', _28 => _28.length]) < 4) {
186
+ while (arr.length < 4) {
187
+ arr.push(lastValue);
188
+ }
189
+ return arr;
190
+ }
191
+ else {
192
+ return props.gridColumns.slice(0, 4);
193
+ }
194
+ }
195
+ else {
196
+ return [1, 2, 3, 4];
197
+ }
198
+ });
199
+ // 监听宽度,计算显示卡片个数
200
+ const windowChange = () => {
201
+ const ele = document.getElementById('jtable-body-spin');
202
+ if (ele) {
203
+ const styles = window.getComputedStyle(ele);
204
+ const width = parseFloat(styles.width);
205
+ if (width <= 992) {
206
+ column.value = _optionalChain([_gridColumns, 'access', _29 => _29.value, 'optionalAccess', _30 => _30[0]]) || 1;
207
+ }
208
+ else if (width > 992 && width <= 1440) {
209
+ column.value = _optionalChain([_gridColumns, 'access', _31 => _31.value, 'optionalAccess', _32 => _32[1]]) || 2;
210
+ }
211
+ else if (width > 1440 && width <= 1600) {
212
+ column.value = _optionalChain([_gridColumns, 'access', _33 => _33.value, 'optionalAccess', _34 => _34[2]]) || 3;
213
+ }
214
+ else if (width > 1600) {
215
+ column.value = _optionalChain([_gridColumns, 'access', _35 => _35.value, 'optionalAccess', _36 => _36[3]]) || 4;
216
+ }
217
+ }
218
+ };
219
+ onMounted(() => {
220
+ windowChange(); // 初始化
221
+ window.onresize = () => {
222
+ windowChange();
223
+ };
224
+ });
225
+ onUnmounted(() => {
226
+ window.onresize = null;
227
+ });
228
+ __expose({ reload, dataSource: _dataSource });
229
+ return (_ctx, _cache) => {
230
+ return (_openBlock(), _createElementBlock("div", {
231
+ class: "jtable-body-spin",
232
+ style: _normalizeStyle(_ctx.bodyStyle),
233
+ id: "jtable-body-spin"
234
+ }, [
235
+ _createVNode(_unref(Spin), { spinning: loading.value }, {
236
+ default: _withCtx(() => [
237
+ _createElementVNode("div", _hoisted_1, [
238
+ _createVNode(Header, {
239
+ initMode: _ctx.mode,
240
+ mode: _mode.value,
241
+ modeValue: _ctx.modeValue,
242
+ onChange: onCheck
243
+ }, {
244
+ headerLeftRender: _withCtx(() => [
245
+ _renderSlot(_ctx.$slots, "headerLeftRender")
246
+ ]),
247
+ headerRightRender: _withCtx(() => [
248
+ _renderSlot(_ctx.$slots, "headerRightRender")
249
+ ]),
250
+ _: 3 /* FORWARDED */
251
+ }, 8 /* PROPS */, ["initMode", "mode", "modeValue"]),
252
+ (showAlert.value)
253
+ ? (_openBlock(), _createBlock(Alert, {
254
+ key: 0,
255
+ rowSelection: _ctx.rowSelection,
256
+ onClose: onClose
257
+ }, {
258
+ default: _withCtx(() => [
259
+ _renderSlot(_ctx.$slots, "alertRender", {
260
+ rowSelection: _ctx.rowSelection,
261
+ onClose: onClose
262
+ })
263
+ ]),
264
+ _: 3 /* FORWARDED */
265
+ }, 8 /* PROPS */, ["rowSelection"]))
266
+ : _createCommentVNode("v-if", true),
267
+ _createVNode(Content, _mergeProps(props, {
268
+ mode: _mode.value,
269
+ dataSource: _dataSource.value,
270
+ column: column.value
271
+ }), _createSlots({ _: 2 /* DYNAMIC */ }, [
272
+ _renderList(_unref(slots), (_, key) => {
273
+ return {
274
+ name: key,
275
+ fn: _withCtx((slotProps) => [
276
+ (!extraSlots.includes(key))
277
+ ? _renderSlot(_ctx.$slots, key, _normalizeProps(_mergeProps({ key: 0 }, slotProps)))
278
+ : _createCommentVNode("v-if", true)
279
+ ])
280
+ };
281
+ })
282
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["mode", "dataSource", "column"]),
283
+ (showPagination.value)
284
+ ? (_openBlock(), _createBlock(Pagination, {
285
+ key: 1,
286
+ onChange: onPageChange,
287
+ total: page.total,
288
+ pageIndex: page.pageIndex,
289
+ pageSize: page.pageSize
290
+ }, {
291
+ default: _withCtx(() => [
292
+ _renderSlot(_ctx.$slots, "paginationRender", {
293
+ total: page.total,
294
+ pageSize: page.pageSize,
295
+ current: page.pageIndex + 1,
296
+ onChange: onPageChange
297
+ })
298
+ ]),
299
+ _: 3 /* FORWARDED */
300
+ }, 8 /* PROPS */, ["total", "pageIndex", "pageSize"]))
301
+ : _createCommentVNode("v-if", true)
302
+ ])
303
+ ]),
304
+ _: 3 /* FORWARDED */
305
+ }, 8 /* PROPS */, ["spinning"])
306
+ ], 4 /* STYLE */));
307
+ };
308
+ }
309
+ });
310
+ export default __sfc_main__;