@teamix/pro 1.2.21 → 1.2.26
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/pro.css +1 -1
- package/dist/pro.js +4849 -2339
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog.js +14 -24
- package/es/actions/index.d.ts +22 -8
- package/es/actions/index.js +69 -29
- package/es/actions/index.scss +12 -1
- package/es/form/Components/SelectTable/index.d.ts +24 -0
- package/es/form/Components/SelectTable/index.js +135 -0
- package/es/form/Components/SelectTable/index.scss +28 -0
- package/es/form/Components/SelectTable/table.d.ts +6 -0
- package/es/form/Components/SelectTable/table.js +64 -0
- package/es/form/Filter/AdvancedFilter.js +1 -0
- package/es/form/ProForm/index.scss +37 -6
- package/es/form/SchemaForm/index.js +8 -6
- package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/es/form/SchemaForm/initializeDataSource.js +2 -2
- package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/es/form/SchemaForm/initializeRequest.js +2 -2
- package/es/form/SchemaForm/initializeRules.d.ts +1 -1
- package/es/form/SchemaForm/initializeRules.js +3 -3
- package/es/form/global.scss +1 -0
- package/es/form/utils.d.ts +2 -2
- package/es/form/utils.js +2 -2
- package/es/index.d.ts +5 -2
- package/es/index.js +6 -3
- package/es/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/HozStepItem/index.js +235 -0
- package/es/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/es/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/es/step/ProStepItem/components/VerStepItem/index.js +295 -0
- package/es/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/es/step/ProStepItem/index.d.ts +4 -0
- package/es/step/ProStepItem/index.js +57 -0
- package/es/step/index.d.ts +9 -0
- package/es/step/index.js +101 -0
- package/es/step/typing.d.ts +96 -0
- package/es/step/typing.js +1 -0
- package/es/table/components/Filter/index.js +2 -17
- package/es/table/components/Layout/index.js +22 -12
- package/es/table/components/Pagination/index.d.ts +5 -1
- package/es/table/components/Pagination/index.js +179 -17
- package/es/table/components/Pagination/index.scss +55 -0
- package/es/table/components/ToolBar/FilterColumnIcon.js +24 -3
- package/es/table/components/ToolBar/index.scss +9 -4
- package/es/table/index.js +84 -27
- package/es/table/index.scss +5 -5
- package/es/table/typing.d.ts +11 -2
- package/es/table/utils/columnRender.js +2 -1
- package/es/table/utils/index.d.ts +14 -0
- package/es/table/utils/index.js +74 -4
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/lib/actions/dialog.js +13 -23
- package/lib/actions/index.d.ts +22 -8
- package/lib/actions/index.js +69 -29
- package/lib/actions/index.scss +12 -1
- package/lib/form/Components/SelectTable/index.d.ts +24 -0
- package/lib/form/Components/SelectTable/index.js +157 -0
- package/lib/form/Components/SelectTable/index.scss +28 -0
- package/lib/form/Components/SelectTable/table.d.ts +6 -0
- package/lib/form/Components/SelectTable/table.js +76 -0
- package/lib/form/Filter/AdvancedFilter.js +1 -0
- package/lib/form/ProForm/index.scss +37 -6
- package/lib/form/SchemaForm/index.js +8 -6
- package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
- package/lib/form/SchemaForm/initializeDataSource.js +2 -2
- package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRequest.js +2 -2
- package/lib/form/SchemaForm/initializeRules.d.ts +1 -1
- package/lib/form/SchemaForm/initializeRules.js +3 -3
- package/lib/form/global.scss +1 -0
- package/lib/form/utils.d.ts +2 -2
- package/lib/form/utils.js +2 -2
- package/lib/index.d.ts +5 -2
- package/lib/index.js +35 -3
- package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.js +258 -0
- package/lib/step/ProStepItem/components/HozStepItem/index.scss +279 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +5 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.js +315 -0
- package/lib/step/ProStepItem/components/VerStepItem/index.scss +287 -0
- package/lib/step/ProStepItem/index.d.ts +4 -0
- package/lib/step/ProStepItem/index.js +69 -0
- package/lib/step/index.d.ts +9 -0
- package/lib/step/index.js +124 -0
- package/lib/step/typing.d.ts +96 -0
- package/lib/step/typing.js +5 -0
- package/lib/table/components/Filter/index.js +2 -17
- package/lib/table/components/Layout/index.js +21 -11
- package/lib/table/components/Pagination/index.d.ts +5 -1
- package/lib/table/components/Pagination/index.js +186 -17
- package/lib/table/components/Pagination/index.scss +55 -0
- package/lib/table/components/ToolBar/FilterColumnIcon.js +23 -2
- package/lib/table/components/ToolBar/index.scss +9 -4
- package/lib/table/index.js +84 -25
- package/lib/table/index.scss +5 -5
- package/lib/table/typing.d.ts +11 -2
- package/lib/table/utils/columnRender.js +2 -1
- package/lib/table/utils/index.d.ts +14 -0
- package/lib/table/utils/index.js +84 -4
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/package.json +1 -1
@@ -0,0 +1,124 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.ProStep = void 0;
|
9
|
+
Object.defineProperty(exports, "ProStepItem", {
|
10
|
+
enumerable: true,
|
11
|
+
get: function get() {
|
12
|
+
return _ProStepItem.default;
|
13
|
+
}
|
14
|
+
});
|
15
|
+
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
17
|
+
|
18
|
+
var _components = require("@alicloudfe/components");
|
19
|
+
|
20
|
+
var _ProStepItem = _interopRequireDefault(require("./ProStepItem"));
|
21
|
+
|
22
|
+
var _excluded = ["mode", "items", "shape", "children"];
|
23
|
+
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
|
+
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
27
|
+
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
29
|
+
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
31
|
+
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
33
|
+
|
34
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
35
|
+
|
36
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
37
|
+
|
38
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
39
|
+
|
40
|
+
var ProStep = function ProStep(props) {
|
41
|
+
var mode = props.mode,
|
42
|
+
items = props.items,
|
43
|
+
shape = props.shape,
|
44
|
+
children = props.children,
|
45
|
+
others = _objectWithoutProperties(props, _excluded);
|
46
|
+
|
47
|
+
var current = props.current,
|
48
|
+
labelPlacement = props.labelPlacement,
|
49
|
+
readOnly = props.readOnly,
|
50
|
+
animation = props.animation,
|
51
|
+
size = props.size;
|
52
|
+
var fold = props.fold; // 判断渲染组件是不是 ProStepItem, 并返回筛选后的children
|
53
|
+
|
54
|
+
var renderChildren = (0, _react.useMemo)(function () {
|
55
|
+
return _react.default.Children.map(children, function (child, index) {
|
56
|
+
var childElement = child;
|
57
|
+
var displayName = childElement.type.displayName;
|
58
|
+
|
59
|
+
if (displayName === 'ProStepItem') {
|
60
|
+
return /*#__PURE__*/_react.default.cloneElement(childElement, {
|
61
|
+
_size: size,
|
62
|
+
_mode: mode,
|
63
|
+
_index: index,
|
64
|
+
_current: current,
|
65
|
+
_shape: shape
|
66
|
+
});
|
67
|
+
} // 如果不是 ProStepItem
|
68
|
+
|
69
|
+
|
70
|
+
console.error('Warning: ProStep has a child which is not a ProStepItem component');
|
71
|
+
});
|
72
|
+
}, [children]); // 设置circle, 覆盖 dot 阻止重新渲染节点样式
|
73
|
+
|
74
|
+
var shapeMap = function shapeMap() {
|
75
|
+
if (shape === 'arrow') return 'arrow';
|
76
|
+
return 'circle';
|
77
|
+
}; // 渲染 ProStepItem
|
78
|
+
|
79
|
+
|
80
|
+
var renderItem = function renderItem() {
|
81
|
+
// 传递了 item 采用 item 渲染数组的方式
|
82
|
+
if (items) {
|
83
|
+
return items.map(function (item, index) {
|
84
|
+
return /*#__PURE__*/_react.default.createElement(_ProStepItem.default, _objectSpread({
|
85
|
+
key: index,
|
86
|
+
_mode: mode,
|
87
|
+
_shape: shape,
|
88
|
+
_index: index,
|
89
|
+
_current: current,
|
90
|
+
_size: size
|
91
|
+
}, item));
|
92
|
+
});
|
93
|
+
} else {
|
94
|
+
return renderChildren;
|
95
|
+
}
|
96
|
+
}; // 渲染 ProStep
|
97
|
+
|
98
|
+
|
99
|
+
var renderProStep = function renderProStep() {
|
100
|
+
if (mode === 'ver') {
|
101
|
+
return /*#__PURE__*/_react.default.createElement(_components.Timeline, _objectSpread({
|
102
|
+
fold: fold
|
103
|
+
}, others), renderItem());
|
104
|
+
}
|
105
|
+
|
106
|
+
return /*#__PURE__*/_react.default.createElement(_components.Step, _objectSpread({
|
107
|
+
current: current,
|
108
|
+
shape: shapeMap(),
|
109
|
+
labelPlacement: labelPlacement,
|
110
|
+
readOnly: readOnly,
|
111
|
+
animation: animation
|
112
|
+
}, others), renderItem());
|
113
|
+
};
|
114
|
+
|
115
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
116
|
+
className: "teamix-pro-step"
|
117
|
+
}, renderProStep());
|
118
|
+
};
|
119
|
+
|
120
|
+
exports.ProStep = ProStep;
|
121
|
+
ProStep.Item = _ProStepItem.default;
|
122
|
+
ProStep.defaultProps = {
|
123
|
+
mode: 'hoz'
|
124
|
+
};
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import { ItemProps as StepItemProps } from '@alicloudfe/components/types/step';
|
2
|
+
import { ItemProps as TimeLineItemProps } from '@alicloudfe/components/types/timeline';
|
3
|
+
import { ReactNode } from 'react';
|
4
|
+
import { ProTagItem } from '@teamix/utils';
|
5
|
+
export declare type ProStepItemStatus = 'success' | 'fail' | 'process' | 'warning' | 'wait';
|
6
|
+
export declare type ModeStatusFromProStep = {
|
7
|
+
_mode?: string | 'hoz' | 'ver';
|
8
|
+
};
|
9
|
+
export declare type FoldProps = {
|
10
|
+
foldArea: [number, number];
|
11
|
+
foldShow: boolean;
|
12
|
+
};
|
13
|
+
export declare type ProStepProps = HozStepProps | VerTimeLineProps;
|
14
|
+
export declare type ProStepBaseProps = {
|
15
|
+
/** 步骤条:节点展示类型*/
|
16
|
+
shape?: 'icon' | 'arrow' | 'dot' | 'number';
|
17
|
+
/** style */
|
18
|
+
style?: React.CSSProperties;
|
19
|
+
/** className */
|
20
|
+
className?: string;
|
21
|
+
} & React.HTMLAttributes<HTMLElement>;
|
22
|
+
export interface HozStepProps extends ProStepBaseProps {
|
23
|
+
/** 当前组件的展示形式 */
|
24
|
+
mode?: 'hoz';
|
25
|
+
/** 内部渲染自组件 */
|
26
|
+
items?: HozStepItemProps[];
|
27
|
+
/** 步骤条:当前步骤 */
|
28
|
+
current?: number;
|
29
|
+
/** 步骤条: 横向布局时( direction 为 hoz )的内容排列*/
|
30
|
+
labelPlacement?: 'hoz' | 'ver';
|
31
|
+
/** 步骤条: 是否可读模式 */
|
32
|
+
readOnly?: boolean;
|
33
|
+
/** 步骤条: 是否开启动效 */
|
34
|
+
animation?: boolean;
|
35
|
+
/**dot 形态下切换size */
|
36
|
+
size?: 'normal' | 'small';
|
37
|
+
}
|
38
|
+
export interface VerTimeLineProps extends ProStepBaseProps {
|
39
|
+
/** 当前组件的展示形式 */
|
40
|
+
mode?: 'ver';
|
41
|
+
/** 内部渲染自组件 */
|
42
|
+
items?: VerStepItemProps[];
|
43
|
+
/** 时间线: 自定义折叠选项 */
|
44
|
+
fold?: FoldProps[];
|
45
|
+
}
|
46
|
+
export interface ProStepItemBaseProps {
|
47
|
+
/**步骤条:节点展示类型 */
|
48
|
+
_shape?: 'icon' | 'arrow' | 'dot' | 'number';
|
49
|
+
/**节点索引 */
|
50
|
+
_index?: number;
|
51
|
+
/**活跃节点 */
|
52
|
+
_current?: number;
|
53
|
+
/**节点状态 */
|
54
|
+
status?: string | ProStepItemStatus;
|
55
|
+
/**节点设置为 icon 图标 */
|
56
|
+
icon?: string;
|
57
|
+
/**节点的内容 */
|
58
|
+
content?: ReactNode;
|
59
|
+
/**节点标题 */
|
60
|
+
title?: ReactNode;
|
61
|
+
/**自定义渲染 */
|
62
|
+
dotRender?: (index?: number, status?: string) => ReactNode;
|
63
|
+
/**点击事件 */
|
64
|
+
onClick?: (index: number) => void;
|
65
|
+
/**百分比展示 */
|
66
|
+
percent?: number;
|
67
|
+
/**是否禁用当前节点 */
|
68
|
+
disabled?: boolean;
|
69
|
+
}
|
70
|
+
export interface HozStepItemProps extends ProStepItemBaseProps {
|
71
|
+
/**dot 形态下切换size */
|
72
|
+
_size?: 'normal' | 'small';
|
73
|
+
}
|
74
|
+
export interface VerStepItemProps extends ProStepItemBaseProps {
|
75
|
+
/**节点副标题,在 timeline 可以展示格式化后的时间 */
|
76
|
+
subTitle?: ReactNode;
|
77
|
+
/**节点对应描述 */
|
78
|
+
discription?: ReactNode;
|
79
|
+
/**节点的 tag */
|
80
|
+
tags?: ProTagItem[] | ReactNode;
|
81
|
+
/**左侧展示内容 */
|
82
|
+
timeLeft?: ReactNode;
|
83
|
+
/**头像 */
|
84
|
+
image?: string | ReactNode;
|
85
|
+
/**是否需要 animation 动画 */
|
86
|
+
animation?: boolean;
|
87
|
+
/**卡片是否可折叠 */
|
88
|
+
collapsible?: boolean;
|
89
|
+
/**默认是否折叠,用于非受控模式 */
|
90
|
+
defaultCollapsed?: boolean;
|
91
|
+
/**是否折叠,受控模式 */
|
92
|
+
collapsed?: boolean;
|
93
|
+
/**折叠状态改变的回调函数 */
|
94
|
+
onCollapse?: (collapsed: boolean) => void;
|
95
|
+
}
|
96
|
+
export declare type ProStepItemProps = (HozStepItemProps | VerStepItemProps) & React.HTMLAttributes<HTMLElement> & StepItemProps & TimeLineItemProps;
|
@@ -169,8 +169,6 @@ var Filter = function Filter(props) {
|
|
169
169
|
setVisible(!visible);
|
170
170
|
}
|
171
171
|
}),
|
172
|
-
//@ts-ignore
|
173
|
-
v2: true,
|
174
172
|
triggerType: ['click'],
|
175
173
|
align: "tl bl",
|
176
174
|
visible: visible,
|
@@ -208,20 +206,7 @@ var Filter = function Filter(props) {
|
|
208
206
|
} // 需要带上其他所有的信息
|
209
207
|
|
210
208
|
|
211
|
-
var rules = (_actionRef$current$ge5 = (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : (_actionRef$current3$g2 = _actionRef$current3$g.call(_actionRef$current3)) === null || _actionRef$current3$g2 === void 0 ? void 0 : _actionRef$current3$g2.filterRules) !== null && _actionRef$current$ge5 !== void 0 ? _actionRef$current$ge5 : {};
|
212
|
-
var params = Object.fromEntries([].concat(_toConsumableArray(Object.entries(rules).map(function (_ref5) {
|
213
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
214
|
-
k = _ref6[0],
|
215
|
-
v = _ref6[1];
|
216
|
-
|
217
|
-
if (v) {
|
218
|
-
return [k, v.params];
|
219
|
-
}
|
220
|
-
|
221
|
-
return null;
|
222
|
-
})), [[column.dataIndex, param]]).filter(function (item) {
|
223
|
-
return item && (item === null || item === void 0 ? void 0 : item[1]);
|
224
|
-
})); // 再设置所有的列筛选状态
|
209
|
+
var rules = (_actionRef$current$ge5 = (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : (_actionRef$current3$g2 = _actionRef$current3$g.call(_actionRef$current3)) === null || _actionRef$current3$g2 === void 0 ? void 0 : _actionRef$current3$g2.filterRules) !== null && _actionRef$current$ge5 !== void 0 ? _actionRef$current$ge5 : {}; // 再设置所有的列筛选状态
|
225
210
|
|
226
211
|
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
227
212
|
rules: selected,
|
@@ -239,7 +224,7 @@ var Filter = function Filter(props) {
|
|
239
224
|
} // 发送请求
|
240
225
|
|
241
226
|
|
242
|
-
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6,
|
227
|
+
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6, _defineProperty({}, targetPageKey, 1));
|
243
228
|
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7); // 清空表格选择
|
244
229
|
|
245
230
|
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
@@ -70,7 +70,7 @@ var Layout = function Layout(props) {
|
|
70
70
|
rowSelection = props.rowSelection,
|
71
71
|
otherProps = _objectWithoutProperties(props, _excluded);
|
72
72
|
|
73
|
-
var mode =
|
73
|
+
var mode = dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.mode;
|
74
74
|
|
75
75
|
var _useState = (0, _react.useState)((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.expand) || false),
|
76
76
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -129,17 +129,27 @@ var Layout = function Layout(props) {
|
|
129
129
|
|
130
130
|
|
131
131
|
var renderPanelFilter = function renderPanelFilter() {
|
132
|
-
|
132
|
+
if (dataFilter) {
|
133
|
+
var _dataFilter$schema2;
|
133
134
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
}
|
135
|
+
if ( /*#__PURE__*/(0, _react.isValidElement)(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.content)) {
|
136
|
+
// 自定义渲染内容,当 `schema=[]` 时生效
|
137
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
138
|
+
className: cls('panel-filter'),
|
139
|
+
style: {
|
140
|
+
display: expand ? 'block' : 'none'
|
141
|
+
}
|
142
|
+
}, dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.content);
|
143
|
+
} else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length) >= 0) {
|
144
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
145
|
+
className: cls('panel-filter'),
|
146
|
+
style: {
|
147
|
+
display: expand ? 'block' : 'none'
|
148
|
+
}
|
149
|
+
}, /*#__PURE__*/_react.default.createElement(_form.AdvancedFilter, _objectSpread({
|
150
|
+
form: dataFilterForm
|
151
|
+
}, dataFilter)));
|
152
|
+
}
|
143
153
|
}
|
144
154
|
}; // 渲染过滤器按钮
|
145
155
|
|
@@ -1,3 +1,7 @@
|
|
1
1
|
import { PaginationProps } from '@alicloudfe/components/types/pagination';
|
2
|
-
|
2
|
+
import { responsivePaginationType } from '../../typing';
|
3
|
+
import './index.scss';
|
4
|
+
declare const _default: (props: PaginationProps & {
|
5
|
+
responsivePaginationType?: responsivePaginationType;
|
6
|
+
}) => JSX.Element;
|
3
7
|
export default _default;
|
@@ -1,19 +1,27 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
+
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
4
6
|
value: true
|
5
7
|
});
|
6
8
|
exports.default = void 0;
|
7
9
|
|
8
|
-
var _react =
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
11
|
|
10
12
|
var _components = require("@alicloudfe/components");
|
11
13
|
|
14
|
+
var _utils = require("@teamix/utils");
|
15
|
+
|
12
16
|
var _hooks = require("@teamix/hooks");
|
13
17
|
|
14
|
-
|
18
|
+
require("./index.scss");
|
19
|
+
|
20
|
+
var _excluded = ["className", "onChange", "total", "totalRender", "pageSize", "current", "pageSizeList", "pageSizeSelector", "onPageSizeChange", "responsivePaginationType"];
|
15
21
|
|
16
|
-
function
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
23
|
+
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
17
25
|
|
18
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
19
27
|
|
@@ -21,61 +29,222 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
21
29
|
|
22
30
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
23
31
|
|
32
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
33
|
+
|
34
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
35
|
+
|
36
|
+
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); }
|
37
|
+
|
38
|
+
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; }
|
39
|
+
|
40
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
41
|
+
|
42
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
43
|
+
|
24
44
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
25
45
|
|
26
46
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
27
47
|
|
48
|
+
var cls = (0, _utils.baseClass)('teamix-pro-pagination');
|
49
|
+
|
28
50
|
var _default = function _default(props) {
|
29
51
|
var className = props.className,
|
30
|
-
|
52
|
+
propsOnChange = props.onChange,
|
31
53
|
total = props.total,
|
32
54
|
totalRender = props.totalRender,
|
33
55
|
pageSize = props.pageSize,
|
34
56
|
current = props.current,
|
35
57
|
pageSizeList = props.pageSizeList,
|
36
58
|
pageSizeSelector = props.pageSizeSelector,
|
37
|
-
type = props.type,
|
38
59
|
onPageSizeChange = props.onPageSizeChange,
|
60
|
+
responsivePaginationType = props.responsivePaginationType,
|
39
61
|
otherProps = _objectWithoutProperties(props, _excluded);
|
40
62
|
|
41
|
-
var _useResponsiveProps = (0, _hooks.useResponsiveProps)([480,
|
63
|
+
var _useResponsiveProps = (0, _hooks.useResponsiveProps)([480, 590, 700], ['mini', 'small', 'simple', 'normal']),
|
42
64
|
responsiveProps = _useResponsiveProps.responsiveProps,
|
43
65
|
paginationWrapperRef = _useResponsiveProps.ref;
|
44
66
|
|
67
|
+
var _useState = (0, _react.useState)(false),
|
68
|
+
_useState2 = _slicedToArray(_useState, 2),
|
69
|
+
visible = _useState2[0],
|
70
|
+
setVisible = _useState2[1];
|
71
|
+
|
72
|
+
var _useState3 = (0, _react.useState)(current),
|
73
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
74
|
+
currentPage = _useState4[0],
|
75
|
+
setCurrentPage = _useState4[1];
|
76
|
+
|
45
77
|
var commonPaginationProps = {
|
46
78
|
className: className,
|
47
|
-
onChange:
|
79
|
+
onChange: propsOnChange,
|
48
80
|
total: total,
|
49
81
|
pageSize: pageSize,
|
50
|
-
current: current,
|
51
82
|
shape: 'arrow-only',
|
52
83
|
pageSizeList: pageSizeList,
|
53
84
|
pageSizeSelector: pageSizeSelector,
|
54
85
|
pageSizePosition: 'end',
|
55
86
|
onPageSizeChange: onPageSizeChange
|
87
|
+
}; // 自定义总数,用于 small、mini
|
88
|
+
|
89
|
+
var customTotalRender = function customTotalRender(total) {
|
90
|
+
return /*#__PURE__*/_react.default.createElement(_components.Balloon, {
|
91
|
+
visible: visible,
|
92
|
+
closable: false,
|
93
|
+
onVisibleChange: function onVisibleChange(visible) {
|
94
|
+
return setVisible(visible);
|
95
|
+
},
|
96
|
+
align: "t",
|
97
|
+
// triggerType="click"
|
98
|
+
trigger: /*#__PURE__*/_react.default.createElement(_components.Button, {
|
99
|
+
text: true,
|
100
|
+
onMouseEnter: function onMouseEnter() {
|
101
|
+
return setVisible(true);
|
102
|
+
}
|
103
|
+
}, (0, _utils.getMessage)('total', {
|
104
|
+
total: total
|
105
|
+
}))
|
106
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
107
|
+
className: cls('custom-total-content')
|
108
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
109
|
+
className: "title"
|
110
|
+
}, (0, _utils.getMessage)('pageSize')), /*#__PURE__*/_react.default.createElement(_components.Select, {
|
111
|
+
className: cls('custom-page-size-selector'),
|
112
|
+
dataSource: pageSizeList,
|
113
|
+
defaultValue: pageSize,
|
114
|
+
followTrigger: true,
|
115
|
+
menuProps: {
|
116
|
+
hasSelectedIcon: false
|
117
|
+
},
|
118
|
+
onChange: function onChange(value) {
|
119
|
+
setVisible(false);
|
120
|
+
setCurrentPage(1);
|
121
|
+
onPageSizeChange === null || onPageSizeChange === void 0 ? void 0 : onPageSizeChange(value);
|
122
|
+
}
|
123
|
+
})));
|
124
|
+
}; // 获取页总数
|
125
|
+
|
126
|
+
|
127
|
+
function getTotalPage(total, currentPageSize) {
|
128
|
+
var totalPage = Math.ceil(total / currentPageSize);
|
129
|
+
return totalPage <= 0 ? 1 : totalPage;
|
130
|
+
} // 自定义翻页,用于 mini
|
131
|
+
|
132
|
+
|
133
|
+
var customJumpRender = function customJumpRender() {
|
134
|
+
var handleInputChange = function handleInputChange(value, e) {
|
135
|
+
setCurrentPage(value);
|
136
|
+
}; // 回车触发跳转
|
137
|
+
|
138
|
+
|
139
|
+
var handleJump = function handleJump(e) {
|
140
|
+
var totalPage = getTotalPage(total, pageSize);
|
141
|
+
var value = Number(currentPage);
|
142
|
+
|
143
|
+
if (isNaN(value)) {
|
144
|
+
value = '';
|
145
|
+
} else if (value < 1) {
|
146
|
+
value = 1;
|
147
|
+
} else if (value > totalPage) {
|
148
|
+
value = totalPage;
|
149
|
+
}
|
150
|
+
|
151
|
+
if (value && value !== current) {
|
152
|
+
setCurrentPage(value);
|
153
|
+
propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(value, e);
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
var handlePrevClick = function handlePrevClick(e) {
|
158
|
+
setCurrentPage(currentPage - 1);
|
159
|
+
propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(currentPage - 1, e);
|
160
|
+
};
|
161
|
+
|
162
|
+
var handleNextClick = function handleNextClick(e) {
|
163
|
+
setCurrentPage(currentPage + 1);
|
164
|
+
propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(currentPage + 1, e);
|
165
|
+
};
|
166
|
+
|
167
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
168
|
+
className: cls('custom-jumper')
|
169
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Button, {
|
170
|
+
className: "next-prev next-pagination-item",
|
171
|
+
onClick: handlePrevClick,
|
172
|
+
disabled: Number(currentPage) <= 1
|
173
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Icon, {
|
174
|
+
size: "small",
|
175
|
+
type: "arrow-left"
|
176
|
+
})), /*#__PURE__*/_react.default.createElement(_components.Input, {
|
177
|
+
className: "jump-input",
|
178
|
+
value: currentPage,
|
179
|
+
onChange: handleInputChange,
|
180
|
+
onKeyDown: function onKeyDown(e) {
|
181
|
+
if (e.keyCode === 13) {
|
182
|
+
handleJump(e);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
186
|
+
className: "total"
|
187
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
188
|
+
style: {
|
189
|
+
marginRight: 4
|
190
|
+
}
|
191
|
+
}, "/"), getTotalPage(total, pageSize)), /*#__PURE__*/_react.default.createElement(_components.Button, {
|
192
|
+
className: "next-next next-pagination-item",
|
193
|
+
onClick: handleNextClick,
|
194
|
+
//@ts-ignore
|
195
|
+
disabled: total && Number(currentPage) >= getTotalPage(total, pageSize)
|
196
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Icon, {
|
197
|
+
size: "small",
|
198
|
+
type: "arrow-right"
|
199
|
+
})));
|
200
|
+
};
|
201
|
+
|
202
|
+
var renderMiniPagination = function renderMiniPagination() {
|
203
|
+
if (total && pageSize) {
|
204
|
+
if (total / pageSize <= 2) {
|
205
|
+
return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
|
206
|
+
type: "simple"
|
207
|
+
}, otherProps));
|
208
|
+
} else {
|
209
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
210
|
+
className: "".concat(cls('custom-mini-pagination'), " next-pagination")
|
211
|
+
}, customTotalRender(total), customJumpRender());
|
212
|
+
}
|
213
|
+
}
|
56
214
|
};
|
57
215
|
|
58
216
|
var renderPagination = function renderPagination() {
|
59
|
-
switch (responsiveProps) {
|
217
|
+
switch (responsivePaginationType || responsiveProps) {
|
60
218
|
case 'normal':
|
61
|
-
return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps),
|
219
|
+
return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
|
220
|
+
totalRender: function totalRender(total) {
|
221
|
+
return (0, _utils.getMessage)('total', {
|
222
|
+
total: total
|
223
|
+
});
|
224
|
+
}
|
225
|
+
}, otherProps));
|
62
226
|
|
63
227
|
case 'simple':
|
64
228
|
return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
|
65
|
-
pageShowCount: 3
|
229
|
+
pageShowCount: 3,
|
230
|
+
totalRender: function totalRender(total) {
|
231
|
+
return (0, _utils.getMessage)('total', {
|
232
|
+
total: total
|
233
|
+
});
|
234
|
+
}
|
66
235
|
}, otherProps));
|
67
236
|
|
68
237
|
case 'small':
|
69
238
|
return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
|
239
|
+
pageShowCount: 3,
|
70
240
|
pageSizeSelector: false,
|
71
|
-
|
241
|
+
totalRender: function totalRender(total) {
|
242
|
+
return customTotalRender(total);
|
243
|
+
}
|
72
244
|
}, otherProps));
|
73
245
|
|
74
246
|
case 'mini':
|
75
|
-
return
|
76
|
-
pageSizeSelector: false,
|
77
|
-
type: "mini"
|
78
|
-
}, otherProps));
|
247
|
+
return renderMiniPagination();
|
79
248
|
|
80
249
|
default:
|
81
250
|
return /*#__PURE__*/_react.default.createElement(_components.Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), otherProps));
|
@@ -87,7 +256,7 @@ var _default = function _default(props) {
|
|
87
256
|
// 用于获取翻页器响应式 ref
|
88
257
|
_react.default.createElement("div", {
|
89
258
|
ref: paginationWrapperRef,
|
90
|
-
className:
|
259
|
+
className: cls('wrapper')
|
91
260
|
}, renderPagination())
|
92
261
|
);
|
93
262
|
};
|
@@ -0,0 +1,55 @@
|
|
1
|
+
$prefix: 'teamix-pro-pagination';
|
2
|
+
|
3
|
+
.#{$prefix} {
|
4
|
+
&-wrapper {
|
5
|
+
display: flex;
|
6
|
+
justify-content: flex-end;
|
7
|
+
width: 100%;
|
8
|
+
}
|
9
|
+
&-custom-total {
|
10
|
+
&-content {
|
11
|
+
display: flex;
|
12
|
+
align-items: center;
|
13
|
+
.next-menu {
|
14
|
+
min-width: 56px !important;
|
15
|
+
.next-menu-item.next-select-menu-item {
|
16
|
+
padding: 0 8px !important;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
&-custom-mini-pagination {
|
22
|
+
display: flex;
|
23
|
+
align-items: center;
|
24
|
+
}
|
25
|
+
&-custom-jumper {
|
26
|
+
display: flex;
|
27
|
+
align-items: center;
|
28
|
+
.jump-input {
|
29
|
+
width: 36px;
|
30
|
+
input {
|
31
|
+
padding: 0 3px;
|
32
|
+
text-align: center;
|
33
|
+
line-height: 30px;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
.total {
|
37
|
+
margin-left: 8px;
|
38
|
+
margin-right: 4px;
|
39
|
+
color: var(--color-text1-2);
|
40
|
+
}
|
41
|
+
.next-prev {
|
42
|
+
margin-left: 8px;
|
43
|
+
margin-right: 4px;
|
44
|
+
}
|
45
|
+
.next-pagination-item:disabled i {
|
46
|
+
color: var(--btn-pure-normal-color-disabled, #CCCCCC) !important;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
&-custom-page-size-selector.next-select-trigger {
|
50
|
+
min-width: 56px;
|
51
|
+
.next-select-inner {
|
52
|
+
min-width: 56px;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|