@teamix/pro 1.2.0 → 1.2.5
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 +1072 -507
- 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 +1 -1
- 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 +59 -32
- package/es/card/index.js +191 -107
- package/es/card/index.scss +124 -9
- package/es/card/utils.d.ts +9 -0
- package/es/card/utils.js +30 -0
- package/es/form/Components/ProField/index.js +2 -6
- 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 +1 -1
- package/es/info/components/InfoGroup/index.js +5 -2
- package/es/info/components/InfoValueItem/index.js +5 -7
- package/es/info/components/baseInfo/index.js +4 -2
- package/es/info/index.js +25 -11
- package/es/info/typing.d.ts +6 -0
- package/es/nocode/configurators/Card.js +8 -4
- 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 +15 -7
- package/es/table/typing.d.ts +4 -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 +1 -1
- 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 +59 -32
- package/lib/card/index.js +211 -110
- package/lib/card/index.scss +124 -9
- package/lib/card/utils.d.ts +9 -0
- package/lib/card/utils.js +41 -0
- package/lib/form/Components/ProField/index.js +1 -5
- 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 +1 -1
- package/lib/info/components/InfoGroup/index.js +5 -2
- package/lib/info/components/InfoValueItem/index.js +5 -7
- package/lib/info/components/baseInfo/index.js +4 -2
- package/lib/info/index.js +24 -10
- package/lib/info/typing.d.ts +6 -0
- package/lib/nocode/configurators/Card.js +8 -4
- 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 +16 -7
- package/lib/table/typing.d.ts +4 -4
- package/package.json +5 -4
package/lib/card/index.js
CHANGED
@@ -3,7 +3,10 @@
|
|
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
|
|
@@ -11,116 +14,76 @@ var _classnames2 = _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
|
+
require("./index.scss");
|
25
30
|
|
26
|
-
|
31
|
+
var _cardContainer = require("./card-container");
|
27
32
|
|
28
|
-
|
33
|
+
Object.keys(_cardContainer).forEach(function (key) {
|
34
|
+
if (key === "default" || key === "__esModule") return;
|
35
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
36
|
+
if (key in exports && exports[key] === _cardContainer[key]) return;
|
37
|
+
Object.defineProperty(exports, key, {
|
38
|
+
enumerable: true,
|
39
|
+
get: function get() {
|
40
|
+
return _cardContainer[key];
|
41
|
+
}
|
42
|
+
});
|
43
|
+
});
|
44
|
+
var _excluded = ["context"],
|
45
|
+
_excluded2 = ["children", "title", "subTitle", "tooltip", "tooltipIcon", "description", "extra", "actions", "style", "className", "image", "divider", "bordered", "compacted", "centered", "loading", "backgroundColor", "contentClassName", "contentStyle", "direction", "wrap", "spacing", "split", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "context"];
|
29
46
|
|
30
|
-
|
47
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
31
48
|
|
32
|
-
function
|
33
|
-
var spacingArray = spacing instanceof Array ? spacing : [spacing || 0, spacing || 0];
|
34
|
-
return {
|
35
|
-
horizonal: spacingArray[0] / 2,
|
36
|
-
vertical: spacingArray[1] / 2
|
37
|
-
};
|
38
|
-
}
|
49
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
39
50
|
|
40
|
-
function
|
41
|
-
if (!col) {
|
42
|
-
return {
|
43
|
-
style: {}
|
44
|
-
};
|
45
|
-
}
|
51
|
+
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."); }
|
46
52
|
|
47
|
-
|
48
|
-
return {
|
49
|
-
className: cls("col-".concat(col)),
|
50
|
-
style: {}
|
51
|
-
};
|
52
|
-
}
|
53
|
+
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); }
|
53
54
|
|
54
|
-
|
55
|
-
style: {
|
56
|
-
width: col,
|
57
|
-
flexShrink: 0
|
58
|
-
}
|
59
|
-
};
|
60
|
-
}
|
55
|
+
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; }
|
61
56
|
|
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;
|
57
|
+
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; }
|
69
58
|
|
70
|
-
|
71
|
-
horizonal = _formatSpacing.horizonal,
|
72
|
-
vertical = _formatSpacing.vertical; // 如果嵌套了 ProCard,为其添加一层栅格化的 col 和 padding
|
73
|
-
|
74
|
-
|
75
|
-
var childrenModified = _react.default.Children.map(children, function (element, index) {
|
76
|
-
var _element$type;
|
59
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
77
60
|
|
78
|
-
|
79
|
-
var col = element.props.col;
|
61
|
+
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
62
|
|
81
|
-
|
82
|
-
colClassName = _getColClassAndStyle.className,
|
83
|
-
colStyle = _getColClassAndStyle.style;
|
63
|
+
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
64
|
|
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
|
-
}
|
65
|
+
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
66
|
|
97
|
-
|
98
|
-
});
|
67
|
+
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
68
|
|
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
|
-
};
|
69
|
+
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
70
|
|
111
|
-
|
112
|
-
ProCardContainer.defaultProps = {
|
113
|
-
spacing: 16,
|
114
|
-
direction: 'column'
|
115
|
-
};
|
71
|
+
var cls = (0, _utils.baseClass)('teamix-pro-card');
|
116
72
|
|
117
|
-
var
|
73
|
+
var renderActionGroup = function renderActionGroup(extra, context) {
|
118
74
|
if (!extra) {
|
119
75
|
return null;
|
120
76
|
}
|
121
77
|
|
122
78
|
if (extra.actions instanceof Array) {
|
123
|
-
|
79
|
+
var userContext = extra.context,
|
80
|
+
others = _objectWithoutProperties(extra, _excluded);
|
81
|
+
|
82
|
+
var mergedContext = _objectSpread(_objectSpread({}, context), userContext);
|
83
|
+
|
84
|
+
return /*#__PURE__*/_react.default.createElement(_actions.ProActionGroup, _objectSpread(_objectSpread({
|
85
|
+
context: mergedContext
|
86
|
+
}, others), {}, {
|
124
87
|
type: "text"
|
125
88
|
}));
|
126
89
|
}
|
@@ -128,57 +91,195 @@ var renderExtra = function renderExtra(extra) {
|
|
128
91
|
return extra;
|
129
92
|
};
|
130
93
|
|
94
|
+
var getFlexDirectionClassName = function getFlexDirectionClassName(direction, split) {
|
95
|
+
if (split) {
|
96
|
+
return "flex-direction-".concat(split === 'horizontal' ? 'row' : 'column');
|
97
|
+
}
|
98
|
+
|
99
|
+
return "flex-direction-".concat(direction);
|
100
|
+
};
|
101
|
+
|
131
102
|
var ProCard = function ProCard(props) {
|
103
|
+
var _classnames;
|
104
|
+
|
132
105
|
var children = props.children,
|
133
106
|
title = props.title,
|
134
107
|
subTitle = props.subTitle,
|
108
|
+
tooltip = props.tooltip,
|
109
|
+
tooltipIcon = props.tooltipIcon,
|
110
|
+
description = props.description,
|
135
111
|
extra = props.extra,
|
112
|
+
actions = props.actions,
|
136
113
|
style = props.style,
|
137
114
|
className = props.className,
|
138
115
|
image = props.image,
|
139
116
|
divider = props.divider,
|
140
117
|
bordered = props.bordered,
|
141
|
-
hoveredShadow = props.hoveredShadow,
|
142
118
|
compacted = props.compacted,
|
143
119
|
centered = props.centered,
|
144
120
|
loading = props.loading,
|
145
121
|
backgroundColor = props.backgroundColor,
|
146
122
|
contentClassName = props.contentClassName,
|
147
|
-
contentStyle = props.contentStyle
|
148
|
-
|
123
|
+
contentStyle = props.contentStyle,
|
124
|
+
direction = props.direction,
|
125
|
+
wrap = props.wrap,
|
126
|
+
spacing = props.spacing,
|
127
|
+
split = props.split,
|
128
|
+
collapsible = props.collapsible,
|
129
|
+
defaultCollapsed = props.defaultCollapsed,
|
130
|
+
collapsed = props.collapsed,
|
131
|
+
onCollapse = props.onCollapse,
|
132
|
+
context = props.context,
|
133
|
+
others = _objectWithoutProperties(props, _excluded2);
|
134
|
+
|
135
|
+
var _React$useState = _react.default.useState(defaultCollapsed !== undefined ? defaultCollapsed : false),
|
136
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
137
|
+
innerCollapseState = _React$useState2[0],
|
138
|
+
setInnerCollapseState = _React$useState2[1];
|
139
|
+
|
140
|
+
var _formatSpacing = (0, _utils2.formatSpacing)(spacing),
|
141
|
+
horizonal = _formatSpacing.horizonal,
|
142
|
+
vertical = _formatSpacing.vertical;
|
143
|
+
|
144
|
+
var hasDivider = (divider || !!split) && (title || extra);
|
145
|
+
var hasCollapse = collapsible === true || defaultCollapsed !== undefined || collapsed !== undefined;
|
146
|
+
var collapseState = collapsed !== undefined ? collapsed : innerCollapseState;
|
147
|
+
var showContent = hasCollapse ? !collapseState : true;
|
148
|
+
|
149
|
+
var onCollapseChanged = function onCollapseChanged() {
|
150
|
+
onCollapse && onCollapse(!collapseState);
|
151
|
+
|
152
|
+
if (collapsed !== undefined) {
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
|
156
|
+
setInnerCollapseState(!collapseState);
|
157
|
+
};
|
158
|
+
|
159
|
+
var childCardStyle = split ? {} : {
|
160
|
+
paddingRight: horizonal,
|
161
|
+
paddingLeft: horizonal,
|
162
|
+
paddingTop: vertical,
|
163
|
+
paddingBottom: vertical
|
164
|
+
};
|
165
|
+
var dividerStyle = direction === 'row' || direction === 'row-reverse' ? {
|
166
|
+
marginTop: vertical,
|
167
|
+
marginBottom: vertical,
|
168
|
+
marginLeft: 20 - horizonal,
|
169
|
+
marginRight: 20 - horizonal
|
170
|
+
} : {
|
171
|
+
marginTop: 20 - vertical,
|
172
|
+
marginBottom: 20 - vertical,
|
173
|
+
marginLeft: horizonal,
|
174
|
+
marginRight: horizonal
|
175
|
+
}; // 判断是否套了卡片,如果套了的话,为自身卡片内容区设置负间距,以适配栅格系统
|
176
|
+
|
177
|
+
var containProCard = false; // 如果嵌套了 ProCard,为其添加一层栅格化的 col 和 padding
|
178
|
+
|
179
|
+
var childrenModified = _react.default.Children.map(children, function (element, index) {
|
180
|
+
var _element$type, _element$type2;
|
181
|
+
|
182
|
+
if (element === null || element === void 0 ? void 0 : (_element$type = element.type) === null || _element$type === void 0 ? void 0 : _element$type.isProCard) {
|
183
|
+
containProCard = true;
|
184
|
+
var col = element.props.col;
|
185
|
+
|
186
|
+
var _getColClassAndStyle = (0, _utils2.getColClassAndStyle)(col),
|
187
|
+
colClassName = _getColClassAndStyle.className,
|
188
|
+
colStyle = _getColClassAndStyle.style;
|
189
|
+
|
190
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
191
|
+
style: _objectSpread(_objectSpread({}, childCardStyle), colStyle),
|
192
|
+
className: (0, _classnames2.default)(cls('col'), colClassName),
|
193
|
+
key: "pro-card-col-".concat(index)
|
194
|
+
}, /*#__PURE__*/_react.default.cloneElement(element));
|
195
|
+
}
|
196
|
+
|
197
|
+
if (element === null || element === void 0 ? void 0 : (_element$type2 = element.type) === null || _element$type2 === void 0 ? void 0 : _element$type2.isProCardDivider) {
|
198
|
+
console.log('isProCardDivider');
|
199
|
+
return /*#__PURE__*/_react.default.cloneElement(element, {
|
200
|
+
style: dividerStyle
|
201
|
+
});
|
202
|
+
}
|
203
|
+
|
204
|
+
return element;
|
205
|
+
});
|
206
|
+
|
207
|
+
var cardClassName = (0, _classnames2.default)(cls(), className, backgroundColor, {
|
208
|
+
noBorder: !bordered,
|
209
|
+
compacted: compacted
|
210
|
+
});
|
211
|
+
var cardContentClassName = (0, _classnames2.default)(cls('content'), contentClassName, getFlexDirectionClassName(direction, split), (_classnames = {
|
212
|
+
'contain-pro-card': containProCard
|
213
|
+
}, _defineProperty(_classnames, "split-".concat(split), split), _defineProperty(_classnames, 'flex-wrap', wrap), _defineProperty(_classnames, "centered", centered), _classnames));
|
214
|
+
var cardContentMargin = containProCard && !split ? {
|
215
|
+
marginRight: -horizonal,
|
216
|
+
marginLeft: -horizonal,
|
217
|
+
marginTop: -vertical,
|
218
|
+
marginBottom: -vertical
|
219
|
+
} : {};
|
220
|
+
|
221
|
+
var cardContentStyle = _objectSpread(_objectSpread({}, cardContentMargin), contentStyle);
|
222
|
+
|
223
|
+
var renderTitle = function renderTitle() {
|
224
|
+
var icon = tooltipIcon || 'info-circle-line';
|
225
|
+
var tooltipTrigger = typeof icon === 'string' ? /*#__PURE__*/_react.default.createElement(_icon.default, {
|
226
|
+
size: "small",
|
227
|
+
type: icon
|
228
|
+
}) : icon;
|
229
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
230
|
+
className: cls('title')
|
231
|
+
}, hasCollapse && /*#__PURE__*/_react.default.createElement("div", {
|
232
|
+
className: (0, _classnames2.default)(cls('title-collapse'), {
|
233
|
+
collapsed: collapseState
|
234
|
+
}),
|
235
|
+
onClick: onCollapseChanged
|
236
|
+
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
237
|
+
size: "small",
|
238
|
+
type: "down-fill"
|
239
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
240
|
+
className: cls('title-name')
|
241
|
+
}, title)), !hasCollapse && /*#__PURE__*/_react.default.createElement("div", {
|
242
|
+
className: cls('title-name')
|
243
|
+
}, title), tooltip && /*#__PURE__*/_react.default.createElement("div", {
|
244
|
+
className: cls('title-tooltip')
|
245
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Balloon.Tooltip, {
|
246
|
+
align: "t",
|
247
|
+
trigger: tooltipTrigger
|
248
|
+
}, tooltip)), description && /*#__PURE__*/_react.default.createElement("div", {
|
249
|
+
className: cls('title-description')
|
250
|
+
}, description));
|
251
|
+
};
|
252
|
+
|
253
|
+
return /*#__PURE__*/_react.default.createElement(_components.Card, _objectSpread({
|
149
254
|
free: true,
|
150
|
-
className:
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
}),
|
155
|
-
style: style
|
156
|
-
}, !loading && image && /*#__PURE__*/_react.default.createElement(_components.Card.Media, {
|
255
|
+
className: cardClassName,
|
256
|
+
style: style,
|
257
|
+
actions: renderActionGroup(actions, context)
|
258
|
+
}, others), !loading && image && /*#__PURE__*/_react.default.createElement(_components.Card.Media, {
|
157
259
|
component: "img",
|
158
260
|
src: image
|
159
261
|
}), (title || extra) && /*#__PURE__*/_react.default.createElement(_components.Card.Header, {
|
160
|
-
title: loading ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Card.Title, null) :
|
262
|
+
title: loading ? /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Card.Title, null) : renderTitle(),
|
161
263
|
subTitle: !loading && subTitle,
|
162
|
-
extra: !loading &&
|
163
|
-
}),
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
}, loading && /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Card.Content, null), !loading &&
|
264
|
+
extra: !loading && renderActionGroup(extra, context)
|
265
|
+
}), hasDivider && /*#__PURE__*/_react.default.createElement(_components.Card.Divider, null), showContent && /*#__PURE__*/_react.default.createElement(_components.Card.Content, {
|
266
|
+
style: split ? {
|
267
|
+
padding: 0,
|
268
|
+
margin: 0
|
269
|
+
} : {}
|
270
|
+
}, loading && /*#__PURE__*/_react.default.createElement(_skeleton.ProSkeletonRaw.Card.Content, null), !loading && /*#__PURE__*/_react.default.createElement("div", {
|
271
|
+
className: cardContentClassName,
|
272
|
+
style: cardContentStyle
|
273
|
+
}, childrenModified)));
|
169
274
|
};
|
170
275
|
|
276
|
+
exports.ProCard = ProCard;
|
171
277
|
ProCard.defaultProps = {
|
172
278
|
bordered: true,
|
173
|
-
|
174
|
-
|
175
|
-
|
279
|
+
spacing: 16,
|
280
|
+
direction: 'row'
|
281
|
+
};
|
282
|
+
ProCard.Divider = _divider.default;
|
176
283
|
ProCard.isProCard = true;
|
177
284
|
var _default = ProCard;
|
178
|
-
|
179
|
-
* @deprecated 建议使用 ProCardContainer 代替
|
180
|
-
*/
|
181
|
-
|
182
|
-
exports.default = _default;
|
183
|
-
var CardContainer = ProCardContainer;
|
184
|
-
exports.CardContainer = CardContainer;
|
285
|
+
exports.default = _default;
|
package/lib/card/index.scss
CHANGED
@@ -40,12 +40,130 @@
|
|
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
|
+
}
|
154
|
+
}
|
155
|
+
|
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
|
+
}
|
49
167
|
}
|
50
168
|
|
51
169
|
&.noBorder {
|
@@ -54,17 +172,14 @@
|
|
54
172
|
|
55
173
|
&.compacted {
|
56
174
|
border: none;
|
57
|
-
--card-body-padding-bottom: 0px;
|
58
|
-
--card-padding-lr: 0px;
|
59
175
|
|
60
|
-
.next-card-
|
61
|
-
|
176
|
+
& > .next-card-header {
|
177
|
+
margin-top: 0;
|
178
|
+
padding: 0;
|
62
179
|
}
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
&:hover {
|
67
|
-
box-shadow: none;
|
180
|
+
& > .next-card-content-container {
|
181
|
+
margin: 0;
|
182
|
+
padding: 0;
|
68
183
|
}
|
69
184
|
}
|
70
185
|
|
@@ -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
|
+
};
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.formatSpacing = formatSpacing;
|
7
|
+
exports.getColClassAndStyle = getColClassAndStyle;
|
8
|
+
|
9
|
+
var _utils = require("@teamix/utils");
|
10
|
+
|
11
|
+
var cls = (0, _utils.baseClass)('teamix-pro-card');
|
12
|
+
|
13
|
+
function formatSpacing(spacing) {
|
14
|
+
var spacingArray = spacing instanceof Array ? spacing : [spacing || 0, spacing || 0];
|
15
|
+
return {
|
16
|
+
horizonal: spacingArray[0] / 2,
|
17
|
+
vertical: spacingArray[1] / 2
|
18
|
+
};
|
19
|
+
}
|
20
|
+
|
21
|
+
function getColClassAndStyle(col) {
|
22
|
+
if (!col) {
|
23
|
+
return {
|
24
|
+
style: {}
|
25
|
+
};
|
26
|
+
}
|
27
|
+
|
28
|
+
if (typeof col === 'number') {
|
29
|
+
return {
|
30
|
+
className: cls("col-".concat(col)),
|
31
|
+
style: {}
|
32
|
+
};
|
33
|
+
}
|
34
|
+
|
35
|
+
return {
|
36
|
+
style: {
|
37
|
+
width: col,
|
38
|
+
flexShrink: 0
|
39
|
+
}
|
40
|
+
};
|
41
|
+
}
|
@@ -40,11 +40,7 @@ var componentBuilder = function componentBuilder(type) {
|
|
40
40
|
return /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread(_objectSpread({}, props), {}, {
|
41
41
|
type: type
|
42
42
|
}));
|
43
|
-
}, (0, _react2.mapProps)(_utils.mapSize, _utils.mapStatus, _utils.mapDataSource, _utils.mapMode)
|
44
|
-
return /*#__PURE__*/_react.default.createElement(_field.default, _objectSpread(_objectSpread({}, props), {}, {
|
45
|
-
mode: "read"
|
46
|
-
}));
|
47
|
-
}));
|
43
|
+
}, (0, _react2.mapProps)(_utils.mapSize, _utils.mapStatus, _utils.mapDataSource, _utils.mapMode));
|
48
44
|
};
|
49
45
|
|
50
46
|
var _default = function () {
|