musae 1.3.1-beta.22 → 1.3.1-beta.24
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/dist/components/pagination/pagination.cjs +7 -2
- package/dist/components/pagination/pagination.mjs +7 -2
- package/dist/components/pagination/styles.cjs +6 -1
- package/dist/components/pagination/styles.d.ts +4 -0
- package/dist/components/pagination/styles.mjs +6 -1
- package/dist/components/table/hooks/use-pagination.hook.cjs +2 -2
- package/dist/components/table/hooks/use-pagination.hook.d.ts +1 -0
- package/dist/components/table/hooks/use-pagination.hook.mjs +2 -2
- package/dist/components/table/table.cjs +5 -3
- package/dist/components/table/table.mjs +5 -3
- package/dist/locale/locales/en_US.cjs +3 -0
- package/dist/locale/locales/en_US.mjs +3 -0
- package/dist/locale/locales/zh_CN.cjs +3 -0
- package/dist/locale/locales/zh_CN.mjs +3 -0
- package/dist/types/locale.d.ts +1 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ var relax = require('@aiszlab/relax');
|
|
|
14
14
|
var className = require('@aiszlab/relax/class-name');
|
|
15
15
|
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
16
16
|
var context = require('./context.cjs');
|
|
17
|
+
var theme = require('../theme/theme.cjs');
|
|
17
18
|
|
|
18
19
|
var Pagination = function Pagination(_ref) {
|
|
19
20
|
var _ref$total = _ref.total,
|
|
@@ -50,7 +51,8 @@ var Pagination = function Pagination(_ref) {
|
|
|
50
51
|
onPageSizeChange = _usePagiantion.onPageSizeChange;
|
|
51
52
|
var styled = {
|
|
52
53
|
pagination: stylex.props(styles.default.pagination.base),
|
|
53
|
-
sizer: stylex.props(styles.default.pagination.sizer)
|
|
54
|
+
sizer: stylex.props(styles.default.pagination.sizer),
|
|
55
|
+
range: stylex.props(styles.default.pagination.range, theme.$body.small)
|
|
54
56
|
};
|
|
55
57
|
var pages = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
56
58
|
var sizeOptions = React.useMemo(function () {
|
|
@@ -67,7 +69,10 @@ var Pagination = function Pagination(_ref) {
|
|
|
67
69
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
68
70
|
className: styled.pagination.className,
|
|
69
71
|
style: styled.pagination.style
|
|
70
|
-
},
|
|
72
|
+
}, /*#__PURE__*/React.createElement("li", {
|
|
73
|
+
className: styled.range.className,
|
|
74
|
+
style: styled.range.style
|
|
75
|
+
}, locale.range(total === 0 ? 0 : Math.min(total, (at - 1) * pageSize + 1), Math.min(at * pageSize, total), total)), paginationItems.map(function (item$1) {
|
|
71
76
|
return /*#__PURE__*/React.createElement("li", {
|
|
72
77
|
key: item$1
|
|
73
78
|
}, /*#__PURE__*/React.createElement(item.default, {
|
|
@@ -10,6 +10,7 @@ import { unique, toFunction } from '@aiszlab/relax';
|
|
|
10
10
|
import { stringify } from '@aiszlab/relax/class-name';
|
|
11
11
|
import { useClassNames } from '../../hooks/use-class-names.mjs';
|
|
12
12
|
import { CLASS_NAMES } from './context.mjs';
|
|
13
|
+
import { $body } from '../theme/theme.mjs';
|
|
13
14
|
|
|
14
15
|
var Pagination = function Pagination(_ref) {
|
|
15
16
|
var _ref$total = _ref.total,
|
|
@@ -46,7 +47,8 @@ var Pagination = function Pagination(_ref) {
|
|
|
46
47
|
onPageSizeChange = _usePagiantion.onPageSizeChange;
|
|
47
48
|
var styled = {
|
|
48
49
|
pagination: props(styles.pagination.base),
|
|
49
|
-
sizer: props(styles.pagination.sizer)
|
|
50
|
+
sizer: props(styles.pagination.sizer),
|
|
51
|
+
range: props(styles.pagination.range, $body.small)
|
|
50
52
|
};
|
|
51
53
|
var pages = Math.max(1, Math.ceil(total / Math.max(1, pageSize)));
|
|
52
54
|
var sizeOptions = useMemo(function () {
|
|
@@ -63,7 +65,10 @@ var Pagination = function Pagination(_ref) {
|
|
|
63
65
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
64
66
|
className: styled.pagination.className,
|
|
65
67
|
style: styled.pagination.style
|
|
66
|
-
},
|
|
68
|
+
}, /*#__PURE__*/React.createElement("li", {
|
|
69
|
+
className: styled.range.className,
|
|
70
|
+
style: styled.range.style
|
|
71
|
+
}, locale.range(total === 0 ? 0 : Math.min(total, (at - 1) * pageSize + 1), Math.min(at * pageSize, total), total)), paginationItems.map(function (item) {
|
|
67
72
|
return /*#__PURE__*/React.createElement("li", {
|
|
68
73
|
key: item
|
|
69
74
|
}, /*#__PURE__*/React.createElement(Item, {
|
|
@@ -15,7 +15,7 @@ var pagination = {
|
|
|
15
15
|
base: {
|
|
16
16
|
k1xSpc: "musaex-78zum5",
|
|
17
17
|
kGNEyG: "musaex-6s0dn4",
|
|
18
|
-
k1C7PZ: "musaex-
|
|
18
|
+
k1C7PZ: "musaex-1bu9cvf",
|
|
19
19
|
kH6xsr: "musaex-3ct3a4",
|
|
20
20
|
kogj98: "musaex-q3gua8",
|
|
21
21
|
kmVPX3: "musaex-1n775ky",
|
|
@@ -25,6 +25,11 @@ var pagination = {
|
|
|
25
25
|
k1xSpc: "musaex-78zum5",
|
|
26
26
|
kGNEyG: "musaex-6s0dn4",
|
|
27
27
|
$$css: true
|
|
28
|
+
},
|
|
29
|
+
range: {
|
|
30
|
+
kMwMTN: "musaex-bq1wot",
|
|
31
|
+
khDVqt: "musaex-uxw1ft",
|
|
32
|
+
$$css: true
|
|
28
33
|
}
|
|
29
34
|
};
|
|
30
35
|
var styles = {
|
|
@@ -32,6 +32,10 @@ declare const styles: {
|
|
|
32
32
|
readonly display: import("@stylexjs/stylex").StyleXClassNameFor<"display", "flex">;
|
|
33
33
|
readonly alignItems: import("@stylexjs/stylex").StyleXClassNameFor<"alignItems", "center">;
|
|
34
34
|
}>;
|
|
35
|
+
readonly range: Readonly<{
|
|
36
|
+
readonly color: import("@stylexjs/stylex").StyleXClassNameFor<"color", "var(--color-on-surface-variant)">;
|
|
37
|
+
readonly whiteSpace: import("@stylexjs/stylex").StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
38
|
+
}>;
|
|
35
39
|
}>;
|
|
36
40
|
};
|
|
37
41
|
export default styles;
|
|
@@ -11,7 +11,7 @@ var pagination = {
|
|
|
11
11
|
base: {
|
|
12
12
|
k1xSpc: "musaex-78zum5",
|
|
13
13
|
kGNEyG: "musaex-6s0dn4",
|
|
14
|
-
k1C7PZ: "musaex-
|
|
14
|
+
k1C7PZ: "musaex-1bu9cvf",
|
|
15
15
|
kH6xsr: "musaex-3ct3a4",
|
|
16
16
|
kogj98: "musaex-q3gua8",
|
|
17
17
|
kmVPX3: "musaex-1n775ky",
|
|
@@ -21,6 +21,11 @@ var pagination = {
|
|
|
21
21
|
k1xSpc: "musaex-78zum5",
|
|
22
22
|
kGNEyG: "musaex-6s0dn4",
|
|
23
23
|
$$css: true
|
|
24
|
+
},
|
|
25
|
+
range: {
|
|
26
|
+
kMwMTN: "musaex-bq1wot",
|
|
27
|
+
khDVqt: "musaex-uxw1ft",
|
|
28
|
+
$$css: true
|
|
24
29
|
}
|
|
25
30
|
};
|
|
26
31
|
var styles = {
|
|
@@ -45,7 +45,6 @@ var usePagination = function usePagination(_ref) {
|
|
|
45
45
|
var changePageSize = relax.useEvent(function (_pageSize) {
|
|
46
46
|
var _pagination$onPageSiz;
|
|
47
47
|
setPageSize(_pageSize);
|
|
48
|
-
console.log("_pageSize=======", _pageSize);
|
|
49
48
|
if (_pageSize === pageSize) {
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
@@ -55,7 +54,8 @@ var usePagination = function usePagination(_ref) {
|
|
|
55
54
|
pagination: paginationState,
|
|
56
55
|
changeAt: changeAt,
|
|
57
56
|
changePageSize: changePageSize,
|
|
58
|
-
isPaginationHidden: isPaginationHidden
|
|
57
|
+
isPaginationHidden: isPaginationHidden,
|
|
58
|
+
paginationProps: _pagination
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
|
|
@@ -6,5 +6,6 @@ declare const usePagination: ({ pagination }: UsingPagination) => {
|
|
|
6
6
|
changeAt: (_at: number) => void;
|
|
7
7
|
changePageSize: (_pageSize: number) => void;
|
|
8
8
|
isPaginationHidden: boolean;
|
|
9
|
+
paginationProps: import("../../../types/pagination").PagiantionProps | null;
|
|
9
10
|
};
|
|
10
11
|
export { usePagination };
|
|
@@ -43,7 +43,6 @@ var usePagination = function usePagination(_ref) {
|
|
|
43
43
|
var changePageSize = useEvent(function (_pageSize) {
|
|
44
44
|
var _pagination$onPageSiz;
|
|
45
45
|
setPageSize(_pageSize);
|
|
46
|
-
console.log("_pageSize=======", _pageSize);
|
|
47
46
|
if (_pageSize === pageSize) {
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
@@ -53,7 +52,8 @@ var usePagination = function usePagination(_ref) {
|
|
|
53
52
|
pagination: paginationState,
|
|
54
53
|
changeAt: changeAt,
|
|
55
54
|
changePageSize: changePageSize,
|
|
56
|
-
isPaginationHidden: isPaginationHidden
|
|
55
|
+
isPaginationHidden: isPaginationHidden,
|
|
56
|
+
paginationProps: _pagination
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
|
|
@@ -20,6 +20,7 @@ var pagination = require('../pagination/pagination.cjs');
|
|
|
20
20
|
var usePagination_hook = require('./hooks/use-pagination.hook.cjs');
|
|
21
21
|
|
|
22
22
|
var Table = function Table(_ref) {
|
|
23
|
+
var _paginationProps$tota;
|
|
23
24
|
var _ref$bordered = _ref.bordered,
|
|
24
25
|
bordered = _ref$bordered === void 0 ? false : _ref$bordered,
|
|
25
26
|
_ref$dataSource = _ref.dataSource,
|
|
@@ -59,7 +60,8 @@ var Table = function Table(_ref) {
|
|
|
59
60
|
pagination$1 = _usePagination.pagination,
|
|
60
61
|
isPaginationHidden = _usePagination.isPaginationHidden,
|
|
61
62
|
changeAt = _usePagination.changeAt,
|
|
62
|
-
changePageSize = _usePagination.changePageSize
|
|
63
|
+
changePageSize = _usePagination.changePageSize,
|
|
64
|
+
paginationProps = _usePagination.paginationProps;
|
|
63
65
|
var expanded = React.useMemo(function () {
|
|
64
66
|
return relax.isUndefined(expandedKeys) ? uncontrolledExpanded : Object.fromEntries(expandedKeys.map(function (key) {
|
|
65
67
|
return [String(key), true];
|
|
@@ -119,11 +121,11 @@ var Table = function Table(_ref) {
|
|
|
119
121
|
}, /*#__PURE__*/React.createElement("table", {
|
|
120
122
|
className: className.stringify(classNames.table, className$1, styled.table.className),
|
|
121
123
|
style: _objectSpread(_objectSpread({}, styled.table.style), style)
|
|
122
|
-
}, /*#__PURE__*/React.createElement(header.default, null), /*#__PURE__*/React.createElement(body.default, null)),
|
|
124
|
+
}, /*#__PURE__*/React.createElement(header.default, null), /*#__PURE__*/React.createElement(body.default, null)), !isPaginationHidden && (/*#__PURE__*/React.createElement("div", {
|
|
123
125
|
className: styled.pagination.className,
|
|
124
126
|
style: styled.pagination.style
|
|
125
127
|
}, /*#__PURE__*/React.createElement(pagination.default, {
|
|
126
|
-
total: dataSource.length,
|
|
128
|
+
total: (_paginationProps$tota = paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.total) !== null && _paginationProps$tota !== void 0 ? _paginationProps$tota : dataSource.length,
|
|
127
129
|
at: pagination$1.pageIndex - 1,
|
|
128
130
|
pageSize: pagination$1.pageSize,
|
|
129
131
|
onChange: changeAt,
|
|
@@ -16,6 +16,7 @@ import Pagination from '../pagination/pagination.mjs';
|
|
|
16
16
|
import { usePagination } from './hooks/use-pagination.hook.mjs';
|
|
17
17
|
|
|
18
18
|
var Table = function Table(_ref) {
|
|
19
|
+
var _paginationProps$tota;
|
|
19
20
|
var _ref$bordered = _ref.bordered,
|
|
20
21
|
bordered = _ref$bordered === void 0 ? false : _ref$bordered,
|
|
21
22
|
_ref$dataSource = _ref.dataSource,
|
|
@@ -55,7 +56,8 @@ var Table = function Table(_ref) {
|
|
|
55
56
|
pagination = _usePagination.pagination,
|
|
56
57
|
isPaginationHidden = _usePagination.isPaginationHidden,
|
|
57
58
|
changeAt = _usePagination.changeAt,
|
|
58
|
-
changePageSize = _usePagination.changePageSize
|
|
59
|
+
changePageSize = _usePagination.changePageSize,
|
|
60
|
+
paginationProps = _usePagination.paginationProps;
|
|
59
61
|
var expanded = useMemo(function () {
|
|
60
62
|
return isUndefined(expandedKeys) ? uncontrolledExpanded : Object.fromEntries(expandedKeys.map(function (key) {
|
|
61
63
|
return [String(key), true];
|
|
@@ -115,11 +117,11 @@ var Table = function Table(_ref) {
|
|
|
115
117
|
}, /*#__PURE__*/React.createElement("table", {
|
|
116
118
|
className: stringify(classNames.table, className, styled.table.className),
|
|
117
119
|
style: _objectSpread(_objectSpread({}, styled.table.style), style)
|
|
118
|
-
}, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(Body, null)),
|
|
120
|
+
}, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(Body, null)), !isPaginationHidden && (/*#__PURE__*/React.createElement("div", {
|
|
119
121
|
className: styled.pagination.className,
|
|
120
122
|
style: styled.pagination.style
|
|
121
123
|
}, /*#__PURE__*/React.createElement(Pagination, {
|
|
122
|
-
total: dataSource.length,
|
|
124
|
+
total: (_paginationProps$tota = paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.total) !== null && _paginationProps$tota !== void 0 ? _paginationProps$tota : dataSource.length,
|
|
123
125
|
at: pagination.pageIndex - 1,
|
|
124
126
|
pageSize: pagination.pageSize,
|
|
125
127
|
onChange: changeAt,
|
|
@@ -14,6 +14,9 @@ var zh_CN = {
|
|
|
14
14
|
pagination: {
|
|
15
15
|
size: function size(_size) {
|
|
16
16
|
return "".concat(_size, " \u6761/\u9875");
|
|
17
|
+
},
|
|
18
|
+
range: function range(from, to, total) {
|
|
19
|
+
return "".concat(from, "\u2013").concat(to, " \u6761\uFF0C\u5171 ").concat(total, " \u6761");
|
|
17
20
|
}
|
|
18
21
|
},
|
|
19
22
|
popconfirm: {
|
|
@@ -10,6 +10,9 @@ var zh_CN = {
|
|
|
10
10
|
pagination: {
|
|
11
11
|
size: function size(_size) {
|
|
12
12
|
return "".concat(_size, " \u6761/\u9875");
|
|
13
|
+
},
|
|
14
|
+
range: function range(from, to, total) {
|
|
15
|
+
return "".concat(from, "\u2013").concat(to, " \u6761\uFF0C\u5171 ").concat(total, " \u6761");
|
|
13
16
|
}
|
|
14
17
|
},
|
|
15
18
|
popconfirm: {
|
package/dist/types/locale.d.ts
CHANGED