@teamix/pro 1.2.4 → 1.2.8
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/212.js +1 -1
- package/dist/pro.css +1 -1
- package/dist/pro.js +1182 -512
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-component.js +2 -1
- package/es/actions/dialog-form.js +2 -1
- package/es/actions/dialog.js +2 -1
- package/es/actions/index.js +3 -2
- package/es/actions/index.scss +3 -0
- package/es/actions/utils.d.ts +1 -0
- package/es/actions/utils.js +27 -0
- package/es/card/card-container.d.ts +18 -0
- package/es/card/card-container.js +24 -0
- package/es/card/divider.d.ts +6 -0
- package/es/card/divider.js +16 -0
- package/es/card/index.d.ts +68 -32
- package/es/card/index.js +194 -107
- package/es/card/index.scss +174 -9
- package/es/card/selectable.d.ts +13 -0
- package/es/card/selectable.js +45 -0
- package/es/card/utils.d.ts +9 -0
- package/es/card/utils.js +30 -0
- package/es/form/Components/ProField/index.js +2 -7
- package/es/form/Filter/index.js +5 -5
- package/es/form/ProForm/index.js +43 -17
- package/es/form/ProForm/index.scss +0 -1
- package/es/form/ProForm/useAutoSubmit.d.ts +1 -1
- package/es/form/ProForm/useAutoSubmit.js +3 -3
- package/es/form/ProForm/useInitialRequest.d.ts +1 -1
- package/es/form/ProForm/useInitialRequest.js +2 -2
- package/es/form/SchemaForm/initializeDataSource.js +1 -1
- package/es/form/SchemaForm/initializeFormButton.js +3 -2
- package/es/form/SchemaForm/initializeRequest.js +6 -3
- package/es/form/SchemaForm/initializeRules.js +1 -1
- package/es/form/SchemaForm/reactions.d.ts +5 -4
- package/es/form/SchemaForm/reactions.js +20 -11
- package/es/form/locales/validate.d.ts +159 -0
- package/es/form/locales/validate.js +158 -0
- package/es/form/typing.d.ts +4 -3
- package/es/index.d.ts +1 -1
- package/es/index.js +7 -4
- package/es/info/components/InfoGroup/index.js +5 -2
- package/es/info/components/InfoValueItem/index.js +4 -6
- package/es/info/components/baseInfo/index.js +4 -2
- package/es/info/components/tableInfo/index.js +10 -6
- package/es/info/index.js +25 -11
- package/es/info/typing.d.ts +6 -0
- package/es/nocode/configurators/Card.js +39 -12
- package/es/sidebar/components/sidebar-container/index.d.ts +5 -0
- package/es/sidebar/components/sidebar-container/index.js +77 -0
- package/es/sidebar/components/sidebar-container/index.scss +18 -0
- package/es/sidebar/components/tree/index.d.ts +4 -0
- package/es/sidebar/components/tree/index.js +95 -0
- package/es/sidebar/index.d.ts +5 -0
- package/es/sidebar/index.js +66 -0
- package/es/sidebar/index.scss +3 -0
- package/es/sidebar/typing.d.ts +51 -0
- package/es/sidebar/typing.js +1 -0
- package/es/table/components/Layout/index.js +1 -1
- package/es/table/components/ToolBar/FilterColumnIcon.js +2 -24
- package/es/table/components/ToolBar/index.scss +0 -3
- package/es/table/index.js +26 -9
- package/es/table/index.scss +1 -0
- package/es/table/typing.d.ts +6 -4
- package/lib/actions/dialog-component.js +3 -1
- package/lib/actions/dialog-form.js +3 -1
- package/lib/actions/dialog.js +3 -1
- package/lib/actions/index.js +3 -2
- package/lib/actions/index.scss +3 -0
- package/lib/actions/utils.d.ts +1 -0
- package/lib/actions/utils.js +33 -0
- package/lib/card/card-container.d.ts +18 -0
- package/lib/card/card-container.js +37 -0
- package/lib/card/divider.d.ts +6 -0
- package/lib/card/divider.js +26 -0
- package/lib/card/index.d.ts +68 -32
- package/lib/card/index.js +215 -110
- package/lib/card/index.scss +174 -9
- package/lib/card/selectable.d.ts +13 -0
- package/lib/card/selectable.js +60 -0
- package/lib/card/utils.d.ts +9 -0
- package/lib/card/utils.js +41 -0
- package/lib/form/Components/ProField/index.js +1 -6
- package/lib/form/Filter/index.js +5 -6
- package/lib/form/ProForm/index.js +41 -14
- package/lib/form/ProForm/index.scss +0 -1
- package/lib/form/ProForm/useAutoSubmit.d.ts +1 -1
- package/lib/form/ProForm/useAutoSubmit.js +3 -3
- package/lib/form/ProForm/useInitialRequest.d.ts +1 -1
- package/lib/form/ProForm/useInitialRequest.js +2 -2
- package/lib/form/SchemaForm/initializeDataSource.js +1 -1
- package/lib/form/SchemaForm/initializeFormButton.js +5 -2
- package/lib/form/SchemaForm/initializeRequest.js +5 -2
- package/lib/form/SchemaForm/initializeRules.js +1 -1
- package/lib/form/SchemaForm/reactions.d.ts +5 -4
- package/lib/form/SchemaForm/reactions.js +23 -12
- package/lib/form/locales/validate.d.ts +159 -0
- package/lib/form/locales/validate.js +165 -0
- package/lib/form/typing.d.ts +4 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -1
- package/lib/info/components/InfoGroup/index.js +5 -2
- package/lib/info/components/InfoValueItem/index.js +4 -6
- package/lib/info/components/baseInfo/index.js +4 -2
- package/lib/info/components/tableInfo/index.js +10 -6
- package/lib/info/index.js +24 -10
- package/lib/info/typing.d.ts +6 -0
- package/lib/nocode/configurators/Card.js +39 -12
- package/lib/sidebar/components/sidebar-container/index.d.ts +5 -0
- package/lib/sidebar/components/sidebar-container/index.js +93 -0
- package/lib/sidebar/components/sidebar-container/index.scss +18 -0
- package/lib/sidebar/components/tree/index.d.ts +4 -0
- package/lib/sidebar/components/tree/index.js +112 -0
- package/lib/sidebar/index.d.ts +5 -0
- package/lib/sidebar/index.js +87 -0
- package/lib/sidebar/index.scss +3 -0
- package/lib/sidebar/typing.d.ts +51 -0
- package/lib/sidebar/typing.js +5 -0
- package/lib/table/components/Layout/index.js +1 -1
- package/lib/table/components/ToolBar/FilterColumnIcon.js +2 -24
- package/lib/table/components/ToolBar/index.scss +0 -3
- package/lib/table/index.js +27 -9
- package/lib/table/index.scss +1 -0
- package/lib/table/typing.d.ts +6 -4
- package/package.json +4 -4
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
9
|
+
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
|
12
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
13
|
+
|
14
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
15
|
+
|
16
|
+
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; }
|
17
|
+
|
18
|
+
var ProCardDivider = function ProCardDivider(props) {
|
19
|
+
return /*#__PURE__*/_react.default.createElement("div", _objectSpread({
|
20
|
+
className: "teamix-pro-card-divider"
|
21
|
+
}, props));
|
22
|
+
};
|
23
|
+
|
24
|
+
ProCardDivider.isProCardDivider = true;
|
25
|
+
var _default = ProCardDivider;
|
26
|
+
exports.default = _default;
|
package/lib/card/index.d.ts
CHANGED
@@ -1,59 +1,95 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { ProActionGroupProps } from '../actions';
|
3
3
|
import './index.scss';
|
4
|
-
export
|
5
|
-
|
6
|
-
spacing?: [number, number] | number;
|
7
|
-
wrap?: boolean;
|
8
|
-
} & React.HTMLAttributes<HTMLElement>;
|
9
|
-
export declare const ProCardContainer: React.FC<ProCardContainerProps>;
|
10
|
-
export interface ProCardProps {
|
4
|
+
export * from './card-container';
|
5
|
+
export interface ProCardProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
|
11
6
|
/** 内容部分 */
|
12
7
|
children?: React.ReactNode;
|
13
8
|
/**卡片标题 */
|
14
9
|
title?: React.ReactNode;
|
15
10
|
/**卡片副标题 */
|
16
11
|
subTitle?: React.ReactNode;
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
/** 标题右侧图标 hover 提示信息 */
|
13
|
+
tooltip?: React.ReactNode;
|
14
|
+
/** 标题右侧图标 */
|
15
|
+
tooltipIcon?: React.ReactNode;
|
16
|
+
/** 标题右侧描述 */
|
17
|
+
description?: React.ReactNode;
|
18
|
+
/** 额外信息区域,位于卡片右上角,可以配置一些常用轻量操作 */
|
19
|
+
extra?: React.ReactNode | ProActionGroupProps;
|
20
|
+
/** 卡片操作区域,位于卡片最下方,可以配置一些常用轻量操作 */
|
21
|
+
actions?: React.ReactNode | ProActionGroupProps;
|
22
|
+
/** 卡片背景图 */
|
20
23
|
image?: string;
|
21
|
-
|
24
|
+
/** 卡片标题下方是否有分割线 */
|
22
25
|
divider?: boolean;
|
23
|
-
|
26
|
+
/**
|
27
|
+
* @deprecated 建议使用 borderColor = 'none' 代替
|
28
|
+
*/
|
24
29
|
bordered?: boolean;
|
25
|
-
|
30
|
+
/** 卡片在 hover 时拥有阴影效果 */
|
26
31
|
hoveredShadow?: boolean;
|
27
|
-
|
32
|
+
/** 卡片是否为紧凑模式,紧凑模式下卡片没有内边距和边框 */
|
28
33
|
compacted?: boolean;
|
29
|
-
|
34
|
+
/** 卡片内容是否居中展示 */
|
30
35
|
centered?: boolean;
|
31
|
-
|
36
|
+
/** 加载中状态 */
|
32
37
|
loading?: boolean;
|
33
|
-
|
38
|
+
/** 边框颜色 */
|
39
|
+
borderColor?: 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'grey' | 'transparent' | 'none';
|
40
|
+
/** 背景色 */
|
34
41
|
backgroundColor?: 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'grey' | 'transparent';
|
35
|
-
|
42
|
+
/** 内容区栅格排列 flex 方向,仅仅在卡片嵌套模式下生效 */
|
43
|
+
direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
44
|
+
/** 内容区栅格的间距,仅仅在卡片嵌套模式下生效 */
|
45
|
+
spacing?: [number, number] | number;
|
46
|
+
/** 内容区栅格超出部分是否换行展示,仅仅在卡片嵌套模式下生效 */
|
47
|
+
wrap?: boolean;
|
48
|
+
/** 卡片嵌套使用的模式下,子卡片分隔 */
|
49
|
+
split?: 'horizontal' | 'vertical';
|
50
|
+
/** 卡片嵌套使用的模式下,卡片占父卡片内容区域的栅格数量 */
|
36
51
|
col?: number | string;
|
37
|
-
|
52
|
+
/** 卡片是否可折叠 */
|
53
|
+
collapsible?: boolean;
|
54
|
+
/** 默认是否折叠,用于非受控模式 */
|
55
|
+
defaultCollapsed?: boolean;
|
56
|
+
/** 是否折叠,受控模式 */
|
57
|
+
collapsed?: boolean;
|
58
|
+
/** 折叠状态改变的回调函数 */
|
59
|
+
onCollapse?: (collapsed: boolean) => void;
|
60
|
+
/** 卡片 class */
|
38
61
|
className?: string;
|
39
|
-
|
62
|
+
/** 卡片样式 */
|
40
63
|
style?: React.CSSProperties;
|
41
|
-
|
64
|
+
/** 卡片内容 class */
|
42
65
|
contentClassName?: string;
|
43
|
-
|
66
|
+
/** 卡片内容样式 */
|
44
67
|
contentStyle?: React.CSSProperties;
|
68
|
+
/** 上下文 */
|
69
|
+
context?: any;
|
45
70
|
}
|
46
|
-
declare const ProCard:
|
71
|
+
export declare const ProCard: {
|
72
|
+
(props: ProCardProps): JSX.Element;
|
73
|
+
defaultProps: {
|
74
|
+
bordered: boolean;
|
75
|
+
spacing: number;
|
76
|
+
direction: string;
|
77
|
+
};
|
78
|
+
Divider: {
|
79
|
+
(props: React.HTMLAttributes<HTMLElement>): JSX.Element;
|
80
|
+
isProCardDivider: boolean;
|
81
|
+
};
|
82
|
+
Selectable: {
|
83
|
+
(props: import("./selectable").ProCardSelectableProps): JSX.Element;
|
84
|
+
defaultProps: {
|
85
|
+
hoveredShadow: boolean;
|
86
|
+
};
|
87
|
+
isProCard: boolean;
|
88
|
+
};
|
89
|
+
isProCard: boolean;
|
90
|
+
};
|
47
91
|
export default ProCard;
|
48
|
-
/**
|
49
|
-
* @deprecated 建议使用 ProCardContainer 代替
|
50
|
-
*/
|
51
|
-
export declare const CardContainer: React.FC<ProCardContainerProps>;
|
52
92
|
/**
|
53
93
|
* @deprecated 建议使用 ProCardProps 代替
|
54
94
|
*/
|
55
95
|
export declare type CardProps = ProCardProps;
|
56
|
-
/**
|
57
|
-
* @deprecated 建议使用 ProCardContainerProps 代替
|
58
|
-
*/
|
59
|
-
export declare type CardContainerProps = ProCardContainerProps;
|
package/lib/card/index.js
CHANGED
@@ -3,124 +3,89 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
6
|
+
var _exportNames = {
|
7
|
+
ProCard: true
|
8
|
+
};
|
9
|
+
exports.default = exports.ProCard = void 0;
|
7
10
|
|
8
11
|
var _react = _interopRequireDefault(require("react"));
|
9
12
|
|
10
|
-
var
|
13
|
+
var _classnames3 = _interopRequireDefault(require("classnames"));
|
11
14
|
|
12
15
|
var _components = require("@alicloudfe/components");
|
13
16
|
|
17
|
+
var _icon = _interopRequireDefault(require("@teamix/icon"));
|
18
|
+
|
14
19
|
var _utils = require("@teamix/utils");
|
15
20
|
|
16
21
|
var _skeleton = require("../skeleton");
|
17
22
|
|
18
23
|
var _actions = require("../actions");
|
19
24
|
|
20
|
-
require("./
|
25
|
+
var _utils2 = require("./utils");
|
21
26
|
|
22
|
-
|
27
|
+
var _divider = _interopRequireDefault(require("./divider"));
|
23
28
|
|
24
|
-
|
29
|
+
var _selectable = _interopRequireDefault(require("./selectable"));
|
25
30
|
|
26
|
-
|
31
|
+
require("./index.scss");
|
27
32
|
|
28
|
-
|
33
|
+
var _cardContainer = require("./card-container");
|
29
34
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
}
|
35
|
+
Object.keys(_cardContainer).forEach(function (key) {
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
37
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
38
|
+
if (key in exports && exports[key] === _cardContainer[key]) return;
|
39
|
+
Object.defineProperty(exports, key, {
|
40
|
+
enumerable: true,
|
41
|
+
get: function get() {
|
42
|
+
return _cardContainer[key];
|
43
|
+
}
|
44
|
+
});
|
45
|
+
});
|
46
|
+
var _excluded = ["context"],
|
47
|
+
_excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "description", "extra", "actions", "style", "className", "image", "hoveredShadow", "divider", "bordered", "compacted", "centered", "loading", "borderColor", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
|
39
48
|
|
40
|
-
function
|
41
|
-
if (!col) {
|
42
|
-
return {
|
43
|
-
style: {}
|
44
|
-
};
|
45
|
-
}
|
49
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
46
50
|
|
47
|
-
|
48
|
-
return {
|
49
|
-
className: cls("col-".concat(col)),
|
50
|
-
style: {}
|
51
|
-
};
|
52
|
-
}
|
51
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
53
52
|
|
54
|
-
|
55
|
-
style: {
|
56
|
-
width: col,
|
57
|
-
flexShrink: 0
|
58
|
-
}
|
59
|
-
};
|
60
|
-
}
|
53
|
+
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."); }
|
61
54
|
|
62
|
-
var
|
63
|
-
var children = props.children,
|
64
|
-
style = props.style,
|
65
|
-
className = props.className,
|
66
|
-
spacing = props.spacing,
|
67
|
-
direction = props.direction,
|
68
|
-
wrap = props.wrap;
|
55
|
+
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); }
|
69
56
|
|
70
|
-
|
71
|
-
horizonal = _formatSpacing.horizonal,
|
72
|
-
vertical = _formatSpacing.vertical; // 如果嵌套了 ProCard,为其添加一层栅格化的 col 和 padding
|
57
|
+
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; }
|
73
58
|
|
59
|
+
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; }
|
74
60
|
|
75
|
-
|
76
|
-
var _element$type;
|
61
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
77
62
|
|
78
|
-
|
79
|
-
var col = element.props.col;
|
63
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
80
64
|
|
81
|
-
|
82
|
-
colClassName = _getColClassAndStyle.className,
|
83
|
-
colStyle = _getColClassAndStyle.style;
|
65
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
84
66
|
|
85
|
-
|
86
|
-
style: _objectSpread({
|
87
|
-
paddingRight: horizonal,
|
88
|
-
paddingLeft: horizonal,
|
89
|
-
paddingTop: vertical,
|
90
|
-
paddingBottom: vertical
|
91
|
-
}, colStyle),
|
92
|
-
className: (0, _classnames2.default)(cls('col'), colClassName),
|
93
|
-
key: "pro-card-col-".concat(index)
|
94
|
-
}, /*#__PURE__*/_react.default.cloneElement(element));
|
95
|
-
}
|
67
|
+
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; }
|
96
68
|
|
97
|
-
|
98
|
-
});
|
69
|
+
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; }
|
99
70
|
|
100
|
-
|
101
|
-
style: _objectSpread({
|
102
|
-
marginLeft: -horizonal,
|
103
|
-
marginRight: -horizonal,
|
104
|
-
marginTop: -vertical,
|
105
|
-
marginBottom: -vertical
|
106
|
-
}, style),
|
107
|
-
className: (0, _classnames2.default)(className, cls('container'), cls("container-flex-".concat(direction)), _defineProperty({}, cls('container-wrap'), wrap))
|
108
|
-
}, childrenModified);
|
109
|
-
};
|
71
|
+
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; }
|
110
72
|
|
111
|
-
|
112
|
-
ProCardContainer.defaultProps = {
|
113
|
-
spacing: 16,
|
114
|
-
direction: 'column'
|
115
|
-
};
|
73
|
+
var cls = (0, _utils.baseClass)('teamix-pro-card');
|
116
74
|
|
117
|
-
var
|
75
|
+
var renderActionGroup = function renderActionGroup(extra, context) {
|
118
76
|
if (!extra) {
|
119
77
|
return null;
|
120
78
|
}
|
121
79
|
|
122
80
|
if (extra.actions instanceof Array) {
|
123
|
-
|
81
|
+
var userContext = extra.context,
|
82
|
+
others = _objectWithoutProperties(extra, _excluded);
|
83
|
+
|
84
|
+
var mergedContext = _objectSpread(_objectSpread({}, context), userContext);
|
85
|
+
|
86
|
+
return /*#__PURE__*/_react.default.createElement(_actions.ProActionGroup, _objectSpread(_objectSpread({
|
87
|
+
context: mergedContext
|
88
|
+
}, others), {}, {
|
124
89
|
type: "text"
|
125
90
|
}));
|
126
91
|
}
|
@@ -128,57 +93,197 @@ var renderExtra = function renderExtra(extra) {
|
|
128
93
|
return extra;
|
129
94
|
};
|
130
95
|
|
96
|
+
var getFlexDirectionClassName = function getFlexDirectionClassName(direction, split) {
|
97
|
+
if (split) {
|
98
|
+
return "flex-direction-".concat(split === 'horizontal' ? 'row' : 'column');
|
99
|
+
}
|
100
|
+
|
101
|
+
return "flex-direction-".concat(direction);
|
102
|
+
};
|
103
|
+
|
131
104
|
var ProCard = function ProCard(props) {
|
105
|
+
var _classnames, _classnames2;
|
106
|
+
|
132
107
|
var children = props.children,
|
133
108
|
title = props.title,
|
134
109
|
subTitle = props.subTitle,
|
110
|
+
tooltip = props.tooltip,
|
111
|
+
tooltipIcon = props.tooltipIcon,
|
112
|
+
description = props.description,
|
135
113
|
extra = props.extra,
|
114
|
+
actions = props.actions,
|
136
115
|
style = props.style,
|
137
116
|
className = props.className,
|
138
117
|
image = props.image,
|
118
|
+
hoveredShadow = props.hoveredShadow,
|
139
119
|
divider = props.divider,
|
140
120
|
bordered = props.bordered,
|
141
|
-
hoveredShadow = props.hoveredShadow,
|
142
121
|
compacted = props.compacted,
|
143
122
|
centered = props.centered,
|
144
123
|
loading = props.loading,
|
124
|
+
borderColor = props.borderColor,
|
145
125
|
backgroundColor = props.backgroundColor,
|
146
126
|
contentClassName = props.contentClassName,
|
147
|
-
contentStyle = props.contentStyle
|
148
|
-
|
127
|
+
contentStyle = props.contentStyle,
|
128
|
+
direction = props.direction,
|
129
|
+
wrap = props.wrap,
|
130
|
+
spacing = props.spacing,
|
131
|
+
split = props.split,
|
132
|
+
collapsible = props.collapsible,
|
133
|
+
defaultCollapsed = props.defaultCollapsed,
|
134
|
+
collapsed = props.collapsed,
|
135
|
+
onCollapse = props.onCollapse,
|
136
|
+
context = props.context,
|
137
|
+
others = _objectWithoutProperties(props, _excluded2);
|
138
|
+
|
139
|
+
var _React$useState = _react.default.useState(defaultCollapsed !== undefined ? defaultCollapsed : false),
|
140
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
141
|
+
innerCollapseState = _React$useState2[0],
|
142
|
+
setInnerCollapseState = _React$useState2[1];
|
143
|
+
|
144
|
+
var _formatSpacing = (0, _utils2.formatSpacing)(spacing),
|
145
|
+
horizonal = _formatSpacing.horizonal,
|
146
|
+
vertical = _formatSpacing.vertical;
|
147
|
+
|
148
|
+
var hasDivider = (divider || !!split) && (title || extra);
|
149
|
+
var hasCollapse = collapsible === true || defaultCollapsed !== undefined || collapsed !== undefined;
|
150
|
+
var collapseState = collapsed !== undefined ? collapsed : innerCollapseState;
|
151
|
+
var showContent = hasCollapse ? !collapseState : true;
|
152
|
+
|
153
|
+
var onCollapseChanged = function onCollapseChanged() {
|
154
|
+
onCollapse && onCollapse(!collapseState);
|
155
|
+
|
156
|
+
if (collapsed !== undefined) {
|
157
|
+
return;
|
158
|
+
}
|
159
|
+
|
160
|
+
setInnerCollapseState(!collapseState);
|
161
|
+
};
|
162
|
+
|
163
|
+
var childCardStyle = split ? {} : {
|
164
|
+
paddingRight: horizonal,
|
165
|
+
paddingLeft: horizonal,
|
166
|
+
paddingTop: vertical,
|
167
|
+
paddingBottom: vertical
|
168
|
+
};
|
169
|
+
var dividerStyle = direction === 'row' || direction === 'row-reverse' ? {
|
170
|
+
marginTop: vertical,
|
171
|
+
marginBottom: vertical,
|
172
|
+
marginLeft: 20 - horizonal,
|
173
|
+
marginRight: 20 - horizonal
|
174
|
+
} : {
|
175
|
+
marginTop: 20 - vertical,
|
176
|
+
marginBottom: 20 - vertical,
|
177
|
+
marginLeft: horizonal,
|
178
|
+
marginRight: horizonal
|
179
|
+
}; // 判断是否套了卡片,如果套了的话,为自身卡片内容区设置负间距,以适配栅格系统
|
180
|
+
|
181
|
+
var containProCard = false; // 如果嵌套了 ProCard,为其添加一层栅格化的 col 和 padding
|
182
|
+
|
183
|
+
var childrenModified = _react.default.Children.map(children, function (element, index) {
|
184
|
+
var _element$type, _element$type2;
|
185
|
+
|
186
|
+
if (element === null || element === void 0 ? void 0 : (_element$type = element.type) === null || _element$type === void 0 ? void 0 : _element$type.isProCard) {
|
187
|
+
containProCard = true;
|
188
|
+
var col = element.props.col;
|
189
|
+
|
190
|
+
var _getColClassAndStyle = (0, _utils2.getColClassAndStyle)(col),
|
191
|
+
colClassName = _getColClassAndStyle.className,
|
192
|
+
colStyle = _getColClassAndStyle.style;
|
193
|
+
|
194
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
195
|
+
style: _objectSpread(_objectSpread({}, childCardStyle), colStyle),
|
196
|
+
className: (0, _classnames3.default)(cls('col'), colClassName),
|
197
|
+
key: "pro-card-col-".concat(index)
|
198
|
+
}, /*#__PURE__*/_react.default.cloneElement(element));
|
199
|
+
}
|
200
|
+
|
201
|
+
if (element === null || element === void 0 ? void 0 : (_element$type2 = element.type) === null || _element$type2 === void 0 ? void 0 : _element$type2.isProCardDivider) {
|
202
|
+
console.log('isProCardDivider');
|
203
|
+
return /*#__PURE__*/_react.default.cloneElement(element, {
|
204
|
+
style: dividerStyle
|
205
|
+
});
|
206
|
+
}
|
207
|
+
|
208
|
+
return element;
|
209
|
+
});
|
210
|
+
|
211
|
+
var cardClassName = (0, _classnames3.default)(cls(), className, backgroundColor, (_classnames = {
|
212
|
+
'border-none': !bordered
|
213
|
+
}, _defineProperty(_classnames, "border-".concat(borderColor), borderColor), _defineProperty(_classnames, "compacted", compacted), _defineProperty(_classnames, "hoverable", hoveredShadow), _classnames));
|
214
|
+
var cardContentClassName = (0, _classnames3.default)(cls('content'), contentClassName, getFlexDirectionClassName(direction, split), (_classnames2 = {
|
215
|
+
'contain-pro-card': containProCard
|
216
|
+
}, _defineProperty(_classnames2, "split-".concat(split), split), _defineProperty(_classnames2, 'flex-wrap', wrap), _defineProperty(_classnames2, "centered", centered), _classnames2));
|
217
|
+
var cardContentMargin = containProCard && !split ? {
|
218
|
+
marginRight: -horizonal,
|
219
|
+
marginLeft: -horizonal,
|
220
|
+
marginTop: -vertical,
|
221
|
+
marginBottom: -vertical
|
222
|
+
} : {};
|
223
|
+
|
224
|
+
var cardContentStyle = _objectSpread(_objectSpread({}, cardContentMargin), contentStyle);
|
225
|
+
|
226
|
+
var renderTitle = function renderTitle() {
|
227
|
+
var icon = tooltipIcon || 'info-circle-line';
|
228
|
+
var tooltipTrigger = typeof icon === 'string' ? /*#__PURE__*/_react.default.createElement(_icon.default, {
|
229
|
+
size: "small",
|
230
|
+
type: icon
|
231
|
+
}) : icon;
|
232
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
233
|
+
className: cls('title')
|
234
|
+
}, hasCollapse && /*#__PURE__*/_react.default.createElement("div", {
|
235
|
+
className: (0, _classnames3.default)(cls('title-collapse'), {
|
236
|
+
collapsed: collapseState
|
237
|
+
}),
|
238
|
+
onClick: onCollapseChanged
|
239
|
+
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
240
|
+
size: "small",
|
241
|
+
type: "down-fill"
|
242
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
243
|
+
className: cls('title-name')
|
244
|
+
}, title)), !hasCollapse && /*#__PURE__*/_react.default.createElement("div", {
|
245
|
+
className: cls('title-name')
|
246
|
+
}, title), tooltip && /*#__PURE__*/_react.default.createElement("div", {
|
247
|
+
className: cls('title-tooltip')
|
248
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Balloon.Tooltip, {
|
249
|
+
align: "t",
|
250
|
+
trigger: tooltipTrigger
|
251
|
+
}, tooltip)), description && /*#__PURE__*/_react.default.createElement("div", {
|
252
|
+
className: cls('title-description')
|
253
|
+
}, description));
|
254
|
+
};
|
255
|
+
|
256
|
+
return /*#__PURE__*/_react.default.createElement(_components.Card, _objectSpread({
|
149
257
|
free: true,
|
150
|
-
className:
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
}),
|
155
|
-
style: style
|
156
|
-
}, !loading && image && /*#__PURE__*/_react.default.createElement(_components.Card.Media, {
|
258
|
+
className: cardClassName,
|
259
|
+
style: style,
|
260
|
+
actions: renderActionGroup(actions, context)
|
261
|
+
}, others), !loading && image && /*#__PURE__*/_react.default.createElement(_components.Card.Media, {
|
157
262
|
component: "img",
|
158
263
|
src: image
|
159
264
|
}), (title || extra) && /*#__PURE__*/_react.default.createElement(_components.Card.Header, {
|
160
|
-
title: loading ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Card.Title, null) :
|
265
|
+
title: loading ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Card.Title, null) : renderTitle(),
|
161
266
|
subTitle: !loading && subTitle,
|
162
|
-
extra: !loading &&
|
163
|
-
}),
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
}, loading && /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Card.Content, null), !loading &&
|
267
|
+
extra: !loading && renderActionGroup(extra, context)
|
268
|
+
}), hasDivider && /*#__PURE__*/_react.default.createElement(_components.Card.Divider, null), showContent && /*#__PURE__*/_react.default.createElement(_components.Card.Content, {
|
269
|
+
style: split ? {
|
270
|
+
padding: 0,
|
271
|
+
margin: 0
|
272
|
+
} : {}
|
273
|
+
}, loading && /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Card.Content, null), !loading && /*#__PURE__*/_react.default.createElement("div", {
|
274
|
+
className: cardContentClassName,
|
275
|
+
style: cardContentStyle
|
276
|
+
}, childrenModified)));
|
169
277
|
};
|
170
278
|
|
279
|
+
exports.ProCard = ProCard;
|
171
280
|
ProCard.defaultProps = {
|
172
281
|
bordered: true,
|
173
|
-
|
174
|
-
|
175
|
-
|
282
|
+
spacing: 16,
|
283
|
+
direction: 'row'
|
284
|
+
};
|
285
|
+
ProCard.Divider = _divider.default;
|
286
|
+
ProCard.Selectable = _selectable.default;
|
176
287
|
ProCard.isProCard = true;
|
177
288
|
var _default = ProCard;
|
178
|
-
|
179
|
-
* @deprecated 建议使用 ProCardContainer 代替
|
180
|
-
*/
|
181
|
-
|
182
|
-
exports.default = _default;
|
183
|
-
var CardContainer = ProCardContainer;
|
184
|
-
exports.CardContainer = CardContainer;
|
289
|
+
exports.default = _default;
|