@aloudata/aloudata-design 2.18.2 → 2.18.4
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/AldSelect/index.js +12 -6
- package/dist/ColorPicker/index.d.ts +2 -1
- package/dist/ColorPicker/index.js +15 -3
- package/dist/ColorPicker/style/index.less +38 -0
- package/dist/InputSearch/index.js +5 -4
- package/dist/InputSearch/style/index.less +21 -7
- package/dist/Pagination/PageSizeChanger.d.ts +10 -0
- package/dist/Pagination/PageSizeChanger.js +50 -0
- package/dist/Pagination/index.js +57 -6
- package/dist/Pagination/style/index.less +13 -0
- package/dist/Pagination/types.d.ts +6 -1
- package/dist/ald.min.css +1 -1
- package/dist/locale/default.d.ts +5 -0
- package/dist/locale/en_US.d.ts +5 -0
- package/dist/locale/en_US.js +7 -0
- package/dist/locale/zh_CN.d.ts +5 -0
- package/dist/locale/zh_CN.js +7 -0
- package/package.json +1 -1
package/dist/AldSelect/index.js
CHANGED
|
@@ -181,17 +181,20 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
|
|
|
181
181
|
};
|
|
182
182
|
// Used for OptionList selection
|
|
183
183
|
var onOptionSelect = function onOptionSelect(val) {
|
|
184
|
+
// Get the original value from keyMenuItems to preserve the type (number/string)
|
|
185
|
+
var menuItem = keyMenuItems.get(toString(val));
|
|
186
|
+
var originalValue = (menuItem === null || menuItem === void 0 ? void 0 : menuItem.value) !== undefined ? menuItem.value : val;
|
|
184
187
|
var selected = displayValues.find(function (item) {
|
|
185
188
|
return toString(item.value) === toString(val);
|
|
186
189
|
});
|
|
187
190
|
if (isMultiple(mode)) {
|
|
188
191
|
if (!selected) {
|
|
189
|
-
triggerSelect(
|
|
192
|
+
triggerSelect(originalValue, true, 'add');
|
|
190
193
|
} else {
|
|
191
|
-
triggerSelect(
|
|
194
|
+
triggerSelect(originalValue, false, 'remove');
|
|
192
195
|
}
|
|
193
196
|
} else {
|
|
194
|
-
triggerSelect(
|
|
197
|
+
triggerSelect(originalValue, true, 'add');
|
|
195
198
|
}
|
|
196
199
|
};
|
|
197
200
|
// ======================= Display Change =======================
|
|
@@ -217,6 +220,9 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
|
|
|
217
220
|
items: (mergedMenu === null || mergedMenu === void 0 ? void 0 : mergedMenu.items) || [],
|
|
218
221
|
onClick: function onClick(menuInfo) {
|
|
219
222
|
var _mergedMenu$onClick;
|
|
223
|
+
// Get the original value from keyMenuItems to preserve the type (number/string)
|
|
224
|
+
var menuItem = keyMenuItems.get(menuInfo.key);
|
|
225
|
+
var originalValue = (menuItem === null || menuItem === void 0 ? void 0 : menuItem.value) !== undefined ? menuItem.value : menuInfo.key;
|
|
220
226
|
if (mode && isMultiple(mode)) {
|
|
221
227
|
if (displayValues.find(function (item) {
|
|
222
228
|
return toString(item.value) === menuInfo.key;
|
|
@@ -227,15 +233,15 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
|
|
|
227
233
|
return item.value;
|
|
228
234
|
}));
|
|
229
235
|
} else {
|
|
230
|
-
triggerChange([].concat(_toConsumableArray(displayValues), [
|
|
236
|
+
triggerChange([].concat(_toConsumableArray(displayValues), [originalValue]));
|
|
231
237
|
}
|
|
232
238
|
} else {
|
|
233
|
-
triggerChange(
|
|
239
|
+
triggerChange(originalValue);
|
|
234
240
|
}
|
|
235
241
|
mergedMenu === null || mergedMenu === void 0 ? void 0 : (_mergedMenu$onClick = mergedMenu.onClick) === null || _mergedMenu$onClick === void 0 ? void 0 : _mergedMenu$onClick.call(mergedMenu, menuInfo);
|
|
236
242
|
}
|
|
237
243
|
});
|
|
238
|
-
}, [mergedMenu, mode, displayValues, triggerChange]);
|
|
244
|
+
}, [mergedMenu, mode, displayValues, triggerChange, keyMenuItems]);
|
|
239
245
|
var displayMenu = useDisplayMenu(selectMenu,
|
|
240
246
|
// 如果用户接管了搜索,则默认不做搜索过滤
|
|
241
247
|
onSearch ? filterOption || noOpFilter : filterOption, innerSearchValue);
|
|
@@ -7,8 +7,9 @@ export interface IColorPickerProps {
|
|
|
7
7
|
localStorageKey?: string;
|
|
8
8
|
onChange?: (color: string) => void;
|
|
9
9
|
icon?: React.ReactNode;
|
|
10
|
+
bordered?: boolean;
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
mode?: 'simple' | 'complex';
|
|
12
13
|
complexModeProps?: ColorPickerProps;
|
|
13
14
|
}
|
|
14
|
-
export default function ColorPicker({ className, value, icon, onChange, defaultColor, localStorageKey, disabled, mode, complexModeProps, }: IColorPickerProps): React.JSX.Element | null;
|
|
15
|
+
export default function ColorPicker({ className, value, icon, onChange, defaultColor, localStorageKey, disabled, mode, complexModeProps, bordered, }: IColorPickerProps): React.JSX.Element | null;
|
|
@@ -45,7 +45,9 @@ export default function ColorPicker(_ref) {
|
|
|
45
45
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
46
46
|
_ref$mode = _ref.mode,
|
|
47
47
|
mode = _ref$mode === void 0 ? 'simple' : _ref$mode,
|
|
48
|
-
complexModeProps = _ref.complexModeProps
|
|
48
|
+
complexModeProps = _ref.complexModeProps,
|
|
49
|
+
_ref$bordered = _ref.bordered,
|
|
50
|
+
bordered = _ref$bordered === void 0 ? true : _ref$bordered;
|
|
49
51
|
var _useContext = useContext(LocaleContext),
|
|
50
52
|
locale = _useContext.locale;
|
|
51
53
|
var t = getTranslator(locale);
|
|
@@ -171,14 +173,24 @@ export default function ColorPicker(_ref) {
|
|
|
171
173
|
}, /*#__PURE__*/React.createElement("div", {
|
|
172
174
|
className: cls('ald-color-picker-wrapper', {
|
|
173
175
|
'ald-color-picker-wrapper-focused': open,
|
|
174
|
-
'ald-color-picker-wrapper-disabled': disabled
|
|
176
|
+
'ald-color-picker-wrapper-disabled': disabled,
|
|
177
|
+
'ald-color-picker-wrapper-borderless': bordered === false
|
|
175
178
|
}),
|
|
176
179
|
onClick: function onClick(e) {
|
|
177
180
|
if (disabled) {
|
|
178
181
|
e.stopPropagation();
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
|
-
}, icon
|
|
184
|
+
}, icon ? /*#__PURE__*/React.createElement("div", {
|
|
185
|
+
className: 'svg'
|
|
186
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
187
|
+
className: 'icon'
|
|
188
|
+
}, icon), /*#__PURE__*/React.createElement("div", {
|
|
189
|
+
className: 'line',
|
|
190
|
+
style: {
|
|
191
|
+
backgroundColor: value !== null && value !== void 0 ? value : '#4B5563'
|
|
192
|
+
}
|
|
193
|
+
})) : /*#__PURE__*/React.createElement("div", {
|
|
182
194
|
className: 'word'
|
|
183
195
|
}, "A", /*#__PURE__*/React.createElement("div", {
|
|
184
196
|
className: 'line',
|
|
@@ -29,11 +29,25 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
.ald-color-picker-wrapper-borderless {
|
|
33
|
+
border: 1px solid transparent;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ald-color-picker-wrapper-borderless:hover {
|
|
37
|
+
border: 1px solid transparent !important;
|
|
38
|
+
box-shadow: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
.ald-color-picker-wrapper-focused {
|
|
33
42
|
border: 1px solid #3271c9;
|
|
34
43
|
box-sizing: border-box;
|
|
35
44
|
}
|
|
36
45
|
|
|
46
|
+
.ald-color-picker-wrapper-borderless.ald-color-picker-wrapper-focused {
|
|
47
|
+
border: 1px solid transparent !important;
|
|
48
|
+
box-shadow: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
37
51
|
.word {
|
|
38
52
|
position: relative;
|
|
39
53
|
top: -1px;
|
|
@@ -47,6 +61,30 @@
|
|
|
47
61
|
bottom: 3px;
|
|
48
62
|
}
|
|
49
63
|
}
|
|
64
|
+
|
|
65
|
+
.svg {
|
|
66
|
+
position: relative;
|
|
67
|
+
top: -1px;
|
|
68
|
+
|
|
69
|
+
.icon {
|
|
70
|
+
margin-bottom: 1px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.icon.bordered {
|
|
74
|
+
border: 1px solid #d1d5db;
|
|
75
|
+
border-radius: 3px;
|
|
76
|
+
padding: 1px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.line {
|
|
80
|
+
width: 10px;
|
|
81
|
+
height: 2px;
|
|
82
|
+
position: absolute;
|
|
83
|
+
bottom: 3px;
|
|
84
|
+
left: 50%;
|
|
85
|
+
transform: translateX(-50%);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
50
88
|
}
|
|
51
89
|
|
|
52
90
|
.ald-dropdown-overlay.ald-color-picker-overlay-wrapper {
|
|
@@ -62,14 +62,14 @@ export default function InputSearch(props) {
|
|
|
62
62
|
}, [locale, size]);
|
|
63
63
|
|
|
64
64
|
// 判断是否为受控模式
|
|
65
|
-
var isControlled = value
|
|
65
|
+
var isControlled = ('value' in props);
|
|
66
66
|
var _useState = useState(defaultValue || ''),
|
|
67
67
|
_useState2 = _slicedToArray(_useState, 2),
|
|
68
68
|
searchValue = _useState2[0],
|
|
69
69
|
setSearchValue = _useState2[1];
|
|
70
70
|
|
|
71
71
|
// 获取当前值:受控模式使用 value,非受控模式使用内部状态
|
|
72
|
-
var currentValue = isControlled ? value : searchValue;
|
|
72
|
+
var currentValue = isControlled ? value !== null && value !== void 0 ? value : '' : searchValue;
|
|
73
73
|
var isComposing = useRef(false);
|
|
74
74
|
var onPressEnter = useCallback(function (e) {
|
|
75
75
|
if (!isComposing.current) {
|
|
@@ -93,7 +93,8 @@ export default function InputSearch(props) {
|
|
|
93
93
|
setSearchValue(newValue);
|
|
94
94
|
}
|
|
95
95
|
if (!isComposing.current) {
|
|
96
|
-
|
|
96
|
+
// 受控的时候debounce不生效
|
|
97
|
+
if (debounce && !isControlled) {
|
|
97
98
|
debounceSearch(newValue);
|
|
98
99
|
} else {
|
|
99
100
|
onSearch(newValue);
|
|
@@ -125,7 +126,7 @@ export default function InputSearch(props) {
|
|
|
125
126
|
'--init-width': (props.initWidth || defaultWidth) + 'px'
|
|
126
127
|
})
|
|
127
128
|
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
128
|
-
className: classnames((_classnames2 = {}, _defineProperty(_classnames2, 'input-search-has-value', currentValue.length !== 0 || inputMode), _defineProperty(_classnames2, 'inputMode', inputMode), _classnames2)),
|
|
129
|
+
className: classnames((_classnames2 = {}, _defineProperty(_classnames2, 'input-search-has-value', currentValue.length !== 0 || inputMode), _defineProperty(_classnames2, 'input-search-has-content', currentValue.length !== 0), _defineProperty(_classnames2, 'inputMode', inputMode), _classnames2)),
|
|
129
130
|
size: size
|
|
130
131
|
// @ts-ignore
|
|
131
132
|
,
|
|
@@ -37,17 +37,32 @@
|
|
|
37
37
|
background-color: var(--alias-colors-bg-skeleton-subtle, #f9fafb);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
&.ant-input-affix-wrapper-focused,
|
|
41
|
-
&:hover,
|
|
42
|
-
&.input-search-has-value {
|
|
40
|
+
&.ant-input-affix-wrapper-focused:not(.inputMode),
|
|
41
|
+
&:hover:not(.inputMode),
|
|
42
|
+
&.input-search-has-value:not(.inputMode) {
|
|
43
43
|
width: 200px !important;
|
|
44
44
|
transition: all 0.2s ease 0.1s !important;
|
|
45
45
|
background-color: var(--alias-colors-bg-skeleton-subtler, #fff);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
input {
|
|
48
|
+
background-color: #fff;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
::placeholder {
|
|
52
|
+
color: var(--alias-colors-text-subtlest, #9ca3af);
|
|
53
|
+
background-color: var(--alias-colors-bg-skeleton-subtler, #fff);
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
font-style: normal;
|
|
56
|
+
font-weight: 400;
|
|
57
|
+
line-height: 16px; /* 133.333% */
|
|
58
|
+
transition: all 0.2s ease 0.1s !important;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.inputMode {
|
|
63
|
+
width: 100% !important;
|
|
64
|
+
background-color: var(--alias-colors-bg-skeleton-subtler, #fff);
|
|
65
|
+
|
|
51
66
|
input {
|
|
52
67
|
background-color: #fff;
|
|
53
68
|
}
|
|
@@ -63,8 +78,7 @@
|
|
|
63
78
|
}
|
|
64
79
|
}
|
|
65
80
|
|
|
66
|
-
&.
|
|
67
|
-
&.inputSearchHasValue {
|
|
81
|
+
&.input-search-has-content {
|
|
68
82
|
.ant-input-suffix {
|
|
69
83
|
display: flex;
|
|
70
84
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface IPageSizeChangerProps {
|
|
3
|
+
pageSize: number;
|
|
4
|
+
pageSizeOptions: (string | number)[];
|
|
5
|
+
onChange: (size: number) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const PageSizeChanger: React.FC<IPageSizeChangerProps>;
|
|
10
|
+
export default PageSizeChanger;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
import React, { useContext } from 'react';
|
|
8
|
+
import AldSelect from "../AldSelect";
|
|
9
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
10
|
+
var PageSizeChanger = function PageSizeChanger(_ref) {
|
|
11
|
+
var pageSize = _ref.pageSize,
|
|
12
|
+
pageSizeOptions = _ref.pageSizeOptions,
|
|
13
|
+
onChange = _ref.onChange,
|
|
14
|
+
className = _ref.className,
|
|
15
|
+
_ref$disabled = _ref.disabled,
|
|
16
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
17
|
+
var _useContext = useContext(LocaleContext),
|
|
18
|
+
locale = _useContext.locale;
|
|
19
|
+
var t = getTranslator(locale);
|
|
20
|
+
|
|
21
|
+
// 将 pageSizeOptions 转换为 Select 可用的选项格式
|
|
22
|
+
// 确保当前 pageSize 值在选项中存在
|
|
23
|
+
var optionSet = new Set([].concat(_toConsumableArray(pageSizeOptions), [pageSize]));
|
|
24
|
+
var allOptions = Array.from(optionSet).sort(function (a, b) {
|
|
25
|
+
return Number(a) - Number(b);
|
|
26
|
+
});
|
|
27
|
+
var selectOptions = allOptions.map(function (option) {
|
|
28
|
+
return {
|
|
29
|
+
label: "".concat(option, " ").concat(t.Pagination.itemsPerPage),
|
|
30
|
+
value: String(option)
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
var handleChange = function handleChange(value) {
|
|
34
|
+
var newSize = parseInt(value, 10);
|
|
35
|
+
if (!isNaN(newSize) && newSize !== pageSize) {
|
|
36
|
+
onChange(newSize);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var selectProps = {
|
|
40
|
+
value: String(pageSize),
|
|
41
|
+
onChange: handleChange,
|
|
42
|
+
options: selectOptions,
|
|
43
|
+
width: 112,
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
className: "ald-pagination-page-size-changer ".concat(className || '').trim(),
|
|
46
|
+
placeholder: t.Pagination.selectPageSize
|
|
47
|
+
};
|
|
48
|
+
return /*#__PURE__*/React.createElement(AldSelect, selectProps);
|
|
49
|
+
};
|
|
50
|
+
export default PageSizeChanger;
|
package/dist/Pagination/index.js
CHANGED
|
@@ -10,16 +10,28 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import _ from 'lodash';
|
|
13
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
13
|
+
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
14
14
|
import Button from "../Button";
|
|
15
15
|
import { ChevronLeftLine, ChevronRightLine, Ellipsis } from "../Icon";
|
|
16
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
17
|
+
import PageSizeChanger from "./PageSizeChanger";
|
|
16
18
|
function Pagination(props) {
|
|
17
19
|
var _props$current = props.current,
|
|
18
20
|
currPage = _props$current === void 0 ? 1 : _props$current,
|
|
19
21
|
pageSize = props.pageSize,
|
|
20
22
|
total = props.total,
|
|
21
23
|
onChange = props.onChange,
|
|
22
|
-
hideOnSinglePage = props.hideOnSinglePage
|
|
24
|
+
hideOnSinglePage = props.hideOnSinglePage,
|
|
25
|
+
_props$showSizeChange = props.showSizeChanger,
|
|
26
|
+
showSizeChanger = _props$showSizeChange === void 0 ? false : _props$showSizeChange,
|
|
27
|
+
_props$pageSizeOption = props.pageSizeOptions,
|
|
28
|
+
pageSizeOptions = _props$pageSizeOption === void 0 ? [10, 20, 30, 50] : _props$pageSizeOption,
|
|
29
|
+
onShowSizeChange = props.onShowSizeChange,
|
|
30
|
+
_props$showTotal = props.showTotal,
|
|
31
|
+
showTotal = _props$showTotal === void 0 ? false : _props$showTotal;
|
|
32
|
+
var _useContext = useContext(LocaleContext),
|
|
33
|
+
locale = _useContext.locale;
|
|
34
|
+
var t = getTranslator(locale);
|
|
23
35
|
var totalPage = getTotalPage(total, pageSize);
|
|
24
36
|
var _useState = useState(getSafeCurrent(totalPage, currPage)),
|
|
25
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -38,17 +50,52 @@ function Pagination(props) {
|
|
|
38
50
|
return;
|
|
39
51
|
}
|
|
40
52
|
setCurrent(page);
|
|
41
|
-
onChange(page);
|
|
53
|
+
onChange(page, pageSize);
|
|
42
54
|
};
|
|
43
|
-
}, [onChange, current]);
|
|
55
|
+
}, [onChange, current, pageSize]);
|
|
56
|
+
var handlePageSizeChange = useCallback(function (newPageSize) {
|
|
57
|
+
var newTotalPage = getTotalPage(total, newPageSize);
|
|
58
|
+
// 确保当前页在有效范围内
|
|
59
|
+
var safeCurrent = getSafeCurrent(newTotalPage, current);
|
|
60
|
+
setCurrent(safeCurrent);
|
|
61
|
+
|
|
62
|
+
// 调用回调函数
|
|
63
|
+
if (onShowSizeChange) {
|
|
64
|
+
onShowSizeChange(safeCurrent, newPageSize);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 也调用 onChange 以保持一致性
|
|
68
|
+
onChange(safeCurrent, newPageSize);
|
|
69
|
+
}, [total, current, onShowSizeChange, onChange]);
|
|
44
70
|
var pageRange = getPaginationRange(totalPage, current);
|
|
45
71
|
if (hideOnSinglePage) {
|
|
46
|
-
if (totalPage <= 1) {
|
|
72
|
+
if (totalPage <= 1 && !showSizeChanger && !showTotal) {
|
|
47
73
|
return null;
|
|
48
74
|
}
|
|
49
75
|
}
|
|
76
|
+
|
|
77
|
+
// 计算当前显示的数据范围
|
|
78
|
+
var startIndex = (current - 1) * pageSize + 1;
|
|
79
|
+
var endIndex = Math.min(current * pageSize, total);
|
|
80
|
+
var range = [startIndex, endIndex];
|
|
81
|
+
var containerClassName = prefixCls('container');
|
|
82
|
+
|
|
83
|
+
// 获取显示总数的函数
|
|
84
|
+
var getShowTotalContent = function getShowTotalContent() {
|
|
85
|
+
if (typeof showTotal === 'function') {
|
|
86
|
+
return showTotal(total, range);
|
|
87
|
+
}
|
|
88
|
+
if (showTotal === true) {
|
|
89
|
+
return t.Pagination.totalItems(total, range);
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
};
|
|
50
93
|
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
-
className:
|
|
94
|
+
className: containerClassName
|
|
95
|
+
}, showTotal && /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: prefixCls('total')
|
|
97
|
+
}, getShowTotalContent()), /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: prefixCls('main')
|
|
52
99
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
53
100
|
icon: /*#__PURE__*/React.createElement(ChevronLeftLine, {
|
|
54
101
|
size: 16
|
|
@@ -76,6 +123,10 @@ function Pagination(props) {
|
|
|
76
123
|
}),
|
|
77
124
|
onClick: onChangePage(current + 1),
|
|
78
125
|
disabled: current >= totalPage
|
|
126
|
+
})), showSizeChanger && /*#__PURE__*/React.createElement(PageSizeChanger, {
|
|
127
|
+
pageSize: pageSize,
|
|
128
|
+
pageSizeOptions: pageSizeOptions,
|
|
129
|
+
onChange: handlePageSizeChange
|
|
79
130
|
}));
|
|
80
131
|
}
|
|
81
132
|
export default Pagination;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
2
|
@import '../../Button/style/index.less';
|
|
3
|
+
@import '../../AldSelect/style/index.less';
|
|
3
4
|
|
|
4
5
|
.ald-pagination-container {
|
|
5
6
|
display: flex;
|
|
@@ -7,6 +8,12 @@
|
|
|
7
8
|
gap: 8px;
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
.ald-pagination-main {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: 8px;
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
.ald-pagination-active.ald-btn.ald-btn.ald-btn-secondary {
|
|
11
18
|
&,
|
|
12
19
|
&:focus,
|
|
@@ -31,3 +38,9 @@
|
|
|
31
38
|
font-size: 12px;
|
|
32
39
|
font-weight: 500;
|
|
33
40
|
}
|
|
41
|
+
|
|
42
|
+
.ald-pagination-total {
|
|
43
|
+
margin-right: 8px;
|
|
44
|
+
color: var(--alias-colors-text-secondary, #666);
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface IPaginationProps {
|
|
2
3
|
current?: number;
|
|
3
4
|
pageSize: number;
|
|
4
5
|
total: number;
|
|
5
|
-
onChange: (current: number) => void;
|
|
6
|
+
onChange: (current: number, pageSize?: number) => void;
|
|
6
7
|
hideOnSinglePage?: boolean;
|
|
8
|
+
showSizeChanger?: boolean;
|
|
9
|
+
pageSizeOptions?: (string | number)[];
|
|
10
|
+
onShowSizeChange?: (current: number, size: number) => void;
|
|
11
|
+
showTotal?: boolean | ((total: number, range: [number, number]) => React.ReactNode);
|
|
7
12
|
}
|