@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
package/es/card/index.js
CHANGED
@@ -1,65 +1,155 @@
|
|
1
|
+
var _excluded = ["context"],
|
2
|
+
_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"];
|
3
|
+
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
5
|
+
|
6
|
+
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."); }
|
7
|
+
|
8
|
+
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); }
|
9
|
+
|
10
|
+
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; }
|
11
|
+
|
12
|
+
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; }
|
13
|
+
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
15
|
+
|
1
16
|
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; }
|
2
17
|
|
3
18
|
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; }
|
4
19
|
|
5
20
|
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; }
|
6
21
|
|
22
|
+
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; }
|
23
|
+
|
24
|
+
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; }
|
25
|
+
|
7
26
|
import React from 'react';
|
8
27
|
import classnames from 'classnames';
|
9
|
-
import { Card as BasicCard } from '@alicloudfe/components';
|
28
|
+
import { Card as BasicCard, Balloon } from '@alicloudfe/components';
|
29
|
+
import TeamixIcon from '@teamix/icon';
|
10
30
|
import { baseClass } from '@teamix/utils';
|
11
31
|
import { ProSkeletonRaw } from '../skeleton';
|
12
32
|
import { ProActionGroup } from '../actions';
|
33
|
+
import { formatSpacing, getColClassAndStyle } from './utils';
|
34
|
+
import ProCardDivider from './divider';
|
35
|
+
import ProCardSelectable from './selectable';
|
13
36
|
import './index.scss';
|
37
|
+
export * from './card-container';
|
14
38
|
var cls = baseClass('teamix-pro-card');
|
15
39
|
|
16
|
-
function
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
40
|
+
var renderActionGroup = function renderActionGroup(extra, context) {
|
41
|
+
if (!extra) {
|
42
|
+
return null;
|
43
|
+
}
|
44
|
+
|
45
|
+
if (extra.actions instanceof Array) {
|
46
|
+
var userContext = extra.context,
|
47
|
+
others = _objectWithoutProperties(extra, _excluded);
|
48
|
+
|
49
|
+
var mergedContext = _objectSpread(_objectSpread({}, context), userContext);
|
23
50
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
};
|
51
|
+
return /*#__PURE__*/React.createElement(ProActionGroup, _objectSpread(_objectSpread({
|
52
|
+
context: mergedContext
|
53
|
+
}, others), {}, {
|
54
|
+
type: "text"
|
55
|
+
}));
|
29
56
|
}
|
30
57
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
58
|
+
return extra;
|
59
|
+
};
|
60
|
+
|
61
|
+
var getFlexDirectionClassName = function getFlexDirectionClassName(direction, split) {
|
62
|
+
if (split) {
|
63
|
+
return "flex-direction-".concat(split === 'horizontal' ? 'row' : 'column');
|
36
64
|
}
|
37
65
|
|
38
|
-
return
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
};
|
44
|
-
}
|
66
|
+
return "flex-direction-".concat(direction);
|
67
|
+
};
|
68
|
+
|
69
|
+
export var ProCard = function ProCard(props) {
|
70
|
+
var _classnames, _classnames2;
|
45
71
|
|
46
|
-
export var ProCardContainer = function ProCardContainer(props) {
|
47
72
|
var children = props.children,
|
73
|
+
title = props.title,
|
74
|
+
subTitle = props.subTitle,
|
75
|
+
tooltip = props.tooltip,
|
76
|
+
tooltipIcon = props.tooltipIcon,
|
77
|
+
description = props.description,
|
78
|
+
extra = props.extra,
|
79
|
+
actions = props.actions,
|
48
80
|
style = props.style,
|
49
81
|
className = props.className,
|
50
|
-
|
82
|
+
image = props.image,
|
83
|
+
hoveredShadow = props.hoveredShadow,
|
84
|
+
divider = props.divider,
|
85
|
+
bordered = props.bordered,
|
86
|
+
compacted = props.compacted,
|
87
|
+
centered = props.centered,
|
88
|
+
loading = props.loading,
|
89
|
+
borderColor = props.borderColor,
|
90
|
+
backgroundColor = props.backgroundColor,
|
91
|
+
contentClassName = props.contentClassName,
|
92
|
+
contentStyle = props.contentStyle,
|
51
93
|
direction = props.direction,
|
52
|
-
wrap = props.wrap
|
94
|
+
wrap = props.wrap,
|
95
|
+
spacing = props.spacing,
|
96
|
+
split = props.split,
|
97
|
+
collapsible = props.collapsible,
|
98
|
+
defaultCollapsed = props.defaultCollapsed,
|
99
|
+
collapsed = props.collapsed,
|
100
|
+
onCollapse = props.onCollapse,
|
101
|
+
context = props.context,
|
102
|
+
others = _objectWithoutProperties(props, _excluded2);
|
103
|
+
|
104
|
+
var _React$useState = React.useState(defaultCollapsed !== undefined ? defaultCollapsed : false),
|
105
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
106
|
+
innerCollapseState = _React$useState2[0],
|
107
|
+
setInnerCollapseState = _React$useState2[1];
|
53
108
|
|
54
109
|
var _formatSpacing = formatSpacing(spacing),
|
55
110
|
horizonal = _formatSpacing.horizonal,
|
56
|
-
vertical = _formatSpacing.vertical;
|
111
|
+
vertical = _formatSpacing.vertical;
|
112
|
+
|
113
|
+
var hasDivider = (divider || !!split) && (title || extra);
|
114
|
+
var hasCollapse = collapsible === true || defaultCollapsed !== undefined || collapsed !== undefined;
|
115
|
+
var collapseState = collapsed !== undefined ? collapsed : innerCollapseState;
|
116
|
+
var showContent = hasCollapse ? !collapseState : true;
|
117
|
+
|
118
|
+
var onCollapseChanged = function onCollapseChanged() {
|
119
|
+
onCollapse && onCollapse(!collapseState);
|
120
|
+
|
121
|
+
if (collapsed !== undefined) {
|
122
|
+
return;
|
123
|
+
}
|
124
|
+
|
125
|
+
setInnerCollapseState(!collapseState);
|
126
|
+
};
|
57
127
|
|
128
|
+
var childCardStyle = split ? {} : {
|
129
|
+
paddingRight: horizonal,
|
130
|
+
paddingLeft: horizonal,
|
131
|
+
paddingTop: vertical,
|
132
|
+
paddingBottom: vertical
|
133
|
+
};
|
134
|
+
var dividerStyle = direction === 'row' || direction === 'row-reverse' ? {
|
135
|
+
marginTop: vertical,
|
136
|
+
marginBottom: vertical,
|
137
|
+
marginLeft: 20 - horizonal,
|
138
|
+
marginRight: 20 - horizonal
|
139
|
+
} : {
|
140
|
+
marginTop: 20 - vertical,
|
141
|
+
marginBottom: 20 - vertical,
|
142
|
+
marginLeft: horizonal,
|
143
|
+
marginRight: horizonal
|
144
|
+
}; // 判断是否套了卡片,如果套了的话,为自身卡片内容区设置负间距,以适配栅格系统
|
145
|
+
|
146
|
+
var containProCard = false; // 如果嵌套了 ProCard,为其添加一层栅格化的 col 和 padding
|
58
147
|
|
59
148
|
var childrenModified = React.Children.map(children, function (element, index) {
|
60
|
-
var _element$type;
|
149
|
+
var _element$type, _element$type2;
|
61
150
|
|
62
151
|
if (element === null || element === void 0 ? void 0 : (_element$type = element.type) === null || _element$type === void 0 ? void 0 : _element$type.isProCard) {
|
152
|
+
containProCard = true;
|
63
153
|
var col = element.props.col;
|
64
154
|
|
65
155
|
var _getColClassAndStyle = getColClassAndStyle(col),
|
@@ -67,97 +157,94 @@ export var ProCardContainer = function ProCardContainer(props) {
|
|
67
157
|
colStyle = _getColClassAndStyle.style;
|
68
158
|
|
69
159
|
return /*#__PURE__*/React.createElement("div", {
|
70
|
-
style: _objectSpread({
|
71
|
-
paddingRight: horizonal,
|
72
|
-
paddingLeft: horizonal,
|
73
|
-
paddingTop: vertical,
|
74
|
-
paddingBottom: vertical
|
75
|
-
}, colStyle),
|
160
|
+
style: _objectSpread(_objectSpread({}, childCardStyle), colStyle),
|
76
161
|
className: classnames(cls('col'), colClassName),
|
77
162
|
key: "pro-card-col-".concat(index)
|
78
163
|
}, /*#__PURE__*/React.cloneElement(element));
|
79
164
|
}
|
80
165
|
|
166
|
+
if (element === null || element === void 0 ? void 0 : (_element$type2 = element.type) === null || _element$type2 === void 0 ? void 0 : _element$type2.isProCardDivider) {
|
167
|
+
console.log('isProCardDivider');
|
168
|
+
return /*#__PURE__*/React.cloneElement(element, {
|
169
|
+
style: dividerStyle
|
170
|
+
});
|
171
|
+
}
|
172
|
+
|
81
173
|
return element;
|
82
174
|
});
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
};
|
97
|
-
|
98
|
-
var
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
return /*#__PURE__*/React.createElement(
|
105
|
-
|
106
|
-
}
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
175
|
+
var cardClassName = classnames(cls(), className, backgroundColor, (_classnames = {
|
176
|
+
'border-none': !bordered
|
177
|
+
}, _defineProperty(_classnames, "border-".concat(borderColor), borderColor), _defineProperty(_classnames, "compacted", compacted), _defineProperty(_classnames, "hoverable", hoveredShadow), _classnames));
|
178
|
+
var cardContentClassName = classnames(cls('content'), contentClassName, getFlexDirectionClassName(direction, split), (_classnames2 = {
|
179
|
+
'contain-pro-card': containProCard
|
180
|
+
}, _defineProperty(_classnames2, "split-".concat(split), split), _defineProperty(_classnames2, 'flex-wrap', wrap), _defineProperty(_classnames2, "centered", centered), _classnames2));
|
181
|
+
var cardContentMargin = containProCard && !split ? {
|
182
|
+
marginRight: -horizonal,
|
183
|
+
marginLeft: -horizonal,
|
184
|
+
marginTop: -vertical,
|
185
|
+
marginBottom: -vertical
|
186
|
+
} : {};
|
187
|
+
|
188
|
+
var cardContentStyle = _objectSpread(_objectSpread({}, cardContentMargin), contentStyle);
|
189
|
+
|
190
|
+
var renderTitle = function renderTitle() {
|
191
|
+
var icon = tooltipIcon || 'info-circle-line';
|
192
|
+
var tooltipTrigger = typeof icon === 'string' ? /*#__PURE__*/React.createElement(TeamixIcon, {
|
193
|
+
size: "small",
|
194
|
+
type: icon
|
195
|
+
}) : icon;
|
196
|
+
return /*#__PURE__*/React.createElement("div", {
|
197
|
+
className: cls('title')
|
198
|
+
}, hasCollapse && /*#__PURE__*/React.createElement("div", {
|
199
|
+
className: classnames(cls('title-collapse'), {
|
200
|
+
collapsed: collapseState
|
201
|
+
}),
|
202
|
+
onClick: onCollapseChanged
|
203
|
+
}, /*#__PURE__*/React.createElement(TeamixIcon, {
|
204
|
+
size: "small",
|
205
|
+
type: "down-fill"
|
206
|
+
}), /*#__PURE__*/React.createElement("div", {
|
207
|
+
className: cls('title-name')
|
208
|
+
}, title)), !hasCollapse && /*#__PURE__*/React.createElement("div", {
|
209
|
+
className: cls('title-name')
|
210
|
+
}, title), tooltip && /*#__PURE__*/React.createElement("div", {
|
211
|
+
className: cls('title-tooltip')
|
212
|
+
}, /*#__PURE__*/React.createElement(Balloon.Tooltip, {
|
213
|
+
align: "t",
|
214
|
+
trigger: tooltipTrigger
|
215
|
+
}, tooltip)), description && /*#__PURE__*/React.createElement("div", {
|
216
|
+
className: cls('title-description')
|
217
|
+
}, description));
|
218
|
+
};
|
111
219
|
|
112
|
-
|
113
|
-
var children = props.children,
|
114
|
-
title = props.title,
|
115
|
-
subTitle = props.subTitle,
|
116
|
-
extra = props.extra,
|
117
|
-
style = props.style,
|
118
|
-
className = props.className,
|
119
|
-
image = props.image,
|
120
|
-
divider = props.divider,
|
121
|
-
bordered = props.bordered,
|
122
|
-
hoveredShadow = props.hoveredShadow,
|
123
|
-
compacted = props.compacted,
|
124
|
-
centered = props.centered,
|
125
|
-
loading = props.loading,
|
126
|
-
backgroundColor = props.backgroundColor,
|
127
|
-
contentClassName = props.contentClassName,
|
128
|
-
contentStyle = props.contentStyle;
|
129
|
-
return /*#__PURE__*/React.createElement(BasicCard, {
|
220
|
+
return /*#__PURE__*/React.createElement(BasicCard, _objectSpread({
|
130
221
|
free: true,
|
131
|
-
className:
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
}),
|
136
|
-
style: style
|
137
|
-
}, !loading && image && /*#__PURE__*/React.createElement(BasicCard.Media, {
|
222
|
+
className: cardClassName,
|
223
|
+
style: style,
|
224
|
+
actions: renderActionGroup(actions, context)
|
225
|
+
}, others), !loading && image && /*#__PURE__*/React.createElement(BasicCard.Media, {
|
138
226
|
component: "img",
|
139
227
|
src: image
|
140
228
|
}), (title || extra) && /*#__PURE__*/React.createElement(BasicCard.Header, {
|
141
|
-
title: loading ? /*#__PURE__*/React.createElement(ProSkeletonRaw.Card.Title, null) :
|
229
|
+
title: loading ? /*#__PURE__*/React.createElement(ProSkeletonRaw.Card.Title, null) : renderTitle(),
|
142
230
|
subTitle: !loading && subTitle,
|
143
|
-
extra: !loading &&
|
144
|
-
}),
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
}, loading && /*#__PURE__*/React.createElement(ProSkeletonRaw.Card.Content, null), !loading &&
|
231
|
+
extra: !loading && renderActionGroup(extra, context)
|
232
|
+
}), hasDivider && /*#__PURE__*/React.createElement(BasicCard.Divider, null), showContent && /*#__PURE__*/React.createElement(BasicCard.Content, {
|
233
|
+
style: split ? {
|
234
|
+
padding: 0,
|
235
|
+
margin: 0
|
236
|
+
} : {}
|
237
|
+
}, loading && /*#__PURE__*/React.createElement(ProSkeletonRaw.Card.Content, null), !loading && /*#__PURE__*/React.createElement("div", {
|
238
|
+
className: cardContentClassName,
|
239
|
+
style: cardContentStyle
|
240
|
+
}, childrenModified)));
|
150
241
|
};
|
151
|
-
|
152
242
|
ProCard.defaultProps = {
|
153
243
|
bordered: true,
|
154
|
-
|
155
|
-
|
156
|
-
|
244
|
+
spacing: 16,
|
245
|
+
direction: 'row'
|
246
|
+
};
|
247
|
+
ProCard.Divider = ProCardDivider;
|
248
|
+
ProCard.Selectable = ProCardSelectable;
|
157
249
|
ProCard.isProCard = true;
|
158
|
-
export default ProCard;
|
159
|
-
/**
|
160
|
-
* @deprecated 建议使用 ProCardContainer 代替
|
161
|
-
*/
|
162
|
-
|
163
|
-
export var CardContainer = ProCardContainer;
|
250
|
+
export default ProCard;
|
package/es/card/index.scss
CHANGED
@@ -40,31 +40,196 @@
|
|
40
40
|
}
|
41
41
|
}
|
42
42
|
|
43
|
+
&-title {
|
44
|
+
display: flex;
|
45
|
+
align-items: center;
|
46
|
+
|
47
|
+
& > div {
|
48
|
+
display: flex;
|
49
|
+
align-items: center;
|
50
|
+
&:not(:last-child) {
|
51
|
+
margin-right: var(--s-2, 8px);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
&-collapse {
|
56
|
+
cursor: pointer;
|
57
|
+
|
58
|
+
& > i {
|
59
|
+
transition: transform 0.2s;
|
60
|
+
color: var(--color-text1-8, #848484);
|
61
|
+
margin-right: var(--s-2, 8px);
|
62
|
+
}
|
63
|
+
|
64
|
+
&.collapsed {
|
65
|
+
& > i {
|
66
|
+
transform: rotate(-90deg);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
&-description,
|
72
|
+
&-tooltip {
|
73
|
+
color: var(--color-text1-8, #848484);
|
74
|
+
font-weight: normal;
|
75
|
+
}
|
76
|
+
|
77
|
+
&-description {
|
78
|
+
font-size: 12px;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
&-divider {
|
83
|
+
flex: none;
|
84
|
+
background-color: var(--color-line1-1, #eaeaea);
|
85
|
+
}
|
86
|
+
|
43
87
|
&-content {
|
44
88
|
&.centered {
|
45
89
|
display: flex;
|
46
90
|
align-items: center;
|
47
91
|
justify-content: center;
|
48
92
|
}
|
93
|
+
|
94
|
+
&.contain-pro-card {
|
95
|
+
display: flex;
|
96
|
+
|
97
|
+
&.flex-wrap {
|
98
|
+
flex-wrap: wrap;
|
99
|
+
}
|
100
|
+
|
101
|
+
&.flex-direction {
|
102
|
+
&-row {
|
103
|
+
flex-direction: row;
|
104
|
+
|
105
|
+
.teamix-pro-card-divider {
|
106
|
+
width: 1px;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
&-row-reverse {
|
111
|
+
flex-direction: row-reverse;
|
112
|
+
.teamix-pro-card-divider {
|
113
|
+
width: 1px;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
&-column {
|
118
|
+
flex-direction: column;
|
119
|
+
.teamix-pro-card-divider {
|
120
|
+
height: 1px;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
&-column-reverse {
|
125
|
+
flex-direction: column-reverse;
|
126
|
+
.teamix-pro-card-divider {
|
127
|
+
height: 1px;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
&.split-horizontal,
|
133
|
+
&.split-vertical {
|
134
|
+
& > .teamix-pro-card-col > .teamix-pro-card {
|
135
|
+
border: none;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
&.split-horizontal {
|
140
|
+
& > .teamix-pro-card-col {
|
141
|
+
&:not(:last-child) {
|
142
|
+
border-right: 1px solid var(--color-line1-1, #eaeaea);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
&.split-vertical {
|
147
|
+
& > .teamix-pro-card-col {
|
148
|
+
&:not(:last-child) {
|
149
|
+
border-bottom: 1px solid var(--color-line1-1, #eaeaea);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
49
154
|
}
|
50
155
|
|
51
|
-
|
52
|
-
|
156
|
+
& > .next-card-actions {
|
157
|
+
& > .teamix-pro-actions {
|
158
|
+
& > .next-btn {
|
159
|
+
margin-right: 0;
|
160
|
+
flex-grow: 1;
|
161
|
+
}
|
162
|
+
|
163
|
+
& > .next-divider {
|
164
|
+
margin: 0;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
&.hoverable {
|
170
|
+
&:hover {
|
171
|
+
box-shadow: var(--shadow-3, 0px 6px 24px 0px rgba(0, 0, 0, 0.1));
|
172
|
+
}
|
53
173
|
}
|
54
174
|
|
55
175
|
&.compacted {
|
56
176
|
border: none;
|
57
|
-
--card-body-padding-bottom: 0px;
|
58
|
-
--card-padding-lr: 0px;
|
59
177
|
|
60
|
-
.next-card-
|
61
|
-
|
178
|
+
& > .next-card-header {
|
179
|
+
margin-top: 0;
|
180
|
+
padding: 0;
|
181
|
+
}
|
182
|
+
& > .next-card-content-container {
|
183
|
+
margin: 0;
|
184
|
+
padding: 0;
|
62
185
|
}
|
63
186
|
}
|
64
187
|
|
65
|
-
&.
|
66
|
-
|
67
|
-
|
188
|
+
&.border {
|
189
|
+
&-blue {
|
190
|
+
border-color: var(--color-notice-5);
|
191
|
+
}
|
192
|
+
|
193
|
+
&-orange {
|
194
|
+
border-color: var(--color-warning-5);
|
195
|
+
}
|
196
|
+
|
197
|
+
&-yellow {
|
198
|
+
border-color: var(--color-help-5);
|
199
|
+
}
|
200
|
+
|
201
|
+
&-red {
|
202
|
+
border-color: var(--color-error-5);
|
203
|
+
}
|
204
|
+
|
205
|
+
&-green {
|
206
|
+
border-color: var(--color-success-5);
|
207
|
+
}
|
208
|
+
|
209
|
+
&-grey {
|
210
|
+
border-color: var(--color-line1-1);
|
211
|
+
}
|
212
|
+
|
213
|
+
&-transparent {
|
214
|
+
border-color: transparent;
|
215
|
+
}
|
216
|
+
|
217
|
+
&-none {
|
218
|
+
border: none;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
&-selectable {
|
223
|
+
cursor: pointer;
|
224
|
+
|
225
|
+
&-icon {
|
226
|
+
&-selected {
|
227
|
+
color: var(--color-notice-5);
|
228
|
+
}
|
229
|
+
|
230
|
+
&-unselected {
|
231
|
+
color: var(--color-line1-1);
|
232
|
+
}
|
68
233
|
}
|
69
234
|
}
|
70
235
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ProCardProps } from './index';
|
2
|
+
export interface ProCardSelectableProps extends Omit<ProCardProps, 'onSelect'> {
|
3
|
+
selected?: boolean;
|
4
|
+
onSelect?: (selected: boolean) => void;
|
5
|
+
}
|
6
|
+
declare const ProCardSelectable: {
|
7
|
+
(props: ProCardSelectableProps): JSX.Element;
|
8
|
+
defaultProps: {
|
9
|
+
hoveredShadow: boolean;
|
10
|
+
};
|
11
|
+
isProCard: boolean;
|
12
|
+
};
|
13
|
+
export default ProCardSelectable;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
var _excluded = ["selected", "onSelect", "className", "onClick"];
|
2
|
+
|
3
|
+
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; }
|
4
|
+
|
5
|
+
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; }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
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; }
|
10
|
+
|
11
|
+
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; }
|
12
|
+
|
13
|
+
import React from 'react';
|
14
|
+
import classnames from 'classnames';
|
15
|
+
import TeamixIcon from '@teamix/icon';
|
16
|
+
import { baseClass } from '@teamix/utils';
|
17
|
+
import { ProCard } from './index';
|
18
|
+
var cls = baseClass('teamix-pro-card-selectable');
|
19
|
+
|
20
|
+
var ProCardSelectable = function ProCardSelectable(props) {
|
21
|
+
var selected = props.selected,
|
22
|
+
onSelect = props.onSelect,
|
23
|
+
className = props.className,
|
24
|
+
_onClick = props.onClick,
|
25
|
+
others = _objectWithoutProperties(props, _excluded);
|
26
|
+
|
27
|
+
return /*#__PURE__*/React.createElement(ProCard, _objectSpread({
|
28
|
+
className: classnames(cls(), className),
|
29
|
+
borderColor: selected ? 'blue' : 'grey',
|
30
|
+
extra: /*#__PURE__*/React.createElement(TeamixIcon, {
|
31
|
+
className: cls('icon', selected ? 'icon-selected' : 'icon-unselected'),
|
32
|
+
type: selected ? 'success-fill' : 'circle-line'
|
33
|
+
}),
|
34
|
+
onClick: function onClick(e) {
|
35
|
+
_onClick && _onClick(e);
|
36
|
+
onSelect && onSelect(!selected);
|
37
|
+
}
|
38
|
+
}, others));
|
39
|
+
};
|
40
|
+
|
41
|
+
ProCardSelectable.defaultProps = {
|
42
|
+
hoveredShadow: true
|
43
|
+
};
|
44
|
+
ProCardSelectable.isProCard = true;
|
45
|
+
export default ProCardSelectable;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare function formatSpacing(spacing?: [number, number] | number): {
|
3
|
+
horizonal: number;
|
4
|
+
vertical: number;
|
5
|
+
};
|
6
|
+
export declare function getColClassAndStyle(col?: number | string): {
|
7
|
+
className?: string;
|
8
|
+
style: React.CSSProperties;
|
9
|
+
};
|
package/es/card/utils.js
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
import { baseClass } from '@teamix/utils';
|
2
|
+
var cls = baseClass('teamix-pro-card');
|
3
|
+
export function formatSpacing(spacing) {
|
4
|
+
var spacingArray = spacing instanceof Array ? spacing : [spacing || 0, spacing || 0];
|
5
|
+
return {
|
6
|
+
horizonal: spacingArray[0] / 2,
|
7
|
+
vertical: spacingArray[1] / 2
|
8
|
+
};
|
9
|
+
}
|
10
|
+
export function getColClassAndStyle(col) {
|
11
|
+
if (!col) {
|
12
|
+
return {
|
13
|
+
style: {}
|
14
|
+
};
|
15
|
+
}
|
16
|
+
|
17
|
+
if (typeof col === 'number') {
|
18
|
+
return {
|
19
|
+
className: cls("col-".concat(col)),
|
20
|
+
style: {}
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
return {
|
25
|
+
style: {
|
26
|
+
width: col,
|
27
|
+
flexShrink: 0
|
28
|
+
}
|
29
|
+
};
|
30
|
+
}
|