@teamix/pro 1.1.34 → 1.1.38
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 +1069 -334
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.d.ts +8 -1
- package/es/actions/dialog-form.js +32 -15
- package/es/actions/dialog-info.d.ts +9 -0
- package/es/actions/dialog-info.js +23 -0
- package/es/actions/dialog.d.ts +11 -0
- package/es/actions/dialog.js +105 -28
- package/es/actions/drawer-info.d.ts +6 -0
- package/es/actions/drawer-info.js +7 -0
- package/es/actions/index.d.ts +11 -5
- package/es/actions/index.js +28 -12
- package/es/actions/index.scss +39 -0
- package/es/actions/link.js +4 -12
- package/es/actions/request.d.ts +1 -1
- package/es/actions/request.js +2 -2
- package/es/form/Components/ProField/index.d.ts +1 -84
- package/es/form/SchemaForm/reactions.js +4 -2
- package/es/form/typing.d.ts +5 -5
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/{headerInfo → HeaderInfo}/index.d.ts +3 -1
- package/es/info/components/HeaderInfo/index.js +68 -0
- package/es/info/components/{headerInfo → HeaderInfo}/index.scss +0 -0
- package/es/info/components/InfoValueItem/index.js +111 -26
- package/es/info/components/{tableInfo → TableInfo}/index.d.ts +0 -0
- package/es/info/components/{tableInfo → TableInfo}/index.js +4 -21
- package/es/info/components/{tableInfo → TableInfo}/index.scss +0 -0
- package/es/info/components/baseInfo/index.d.ts +3 -1
- package/es/info/components/baseInfo/index.js +34 -42
- package/es/info/index.js +69 -26
- package/es/info/index.scss +0 -4
- package/es/info/typing.d.ts +17 -6
- package/es/page-header/index.d.ts +9 -5
- package/es/page-header/index.js +22 -7
- package/es/table/components/Filter/index.js +7 -2
- package/es/table/components/Filter/index.scss +1 -1
- package/es/table/typing.d.ts +2 -0
- package/lib/actions/dialog-form.d.ts +8 -1
- package/lib/actions/dialog-form.js +32 -15
- package/lib/actions/dialog-info.d.ts +9 -0
- package/lib/actions/dialog-info.js +37 -0
- package/lib/actions/dialog.d.ts +11 -0
- package/lib/actions/dialog.js +108 -27
- package/lib/actions/drawer-info.d.ts +6 -0
- package/lib/actions/drawer-info.js +18 -0
- package/lib/actions/index.d.ts +11 -5
- package/lib/actions/index.js +30 -12
- package/lib/actions/index.scss +39 -0
- package/lib/actions/link.js +5 -12
- package/lib/actions/request.d.ts +1 -1
- package/lib/actions/request.js +2 -2
- package/lib/form/Components/ProField/index.d.ts +1 -84
- package/lib/form/SchemaForm/reactions.js +4 -2
- package/lib/form/typing.d.ts +5 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/{headerInfo → HeaderInfo}/index.d.ts +3 -1
- package/lib/info/components/HeaderInfo/index.js +87 -0
- package/lib/info/components/{headerInfo → HeaderInfo}/index.scss +0 -0
- package/lib/info/components/InfoValueItem/index.js +110 -25
- package/lib/info/components/{tableInfo → TableInfo}/index.d.ts +0 -0
- package/lib/info/components/{tableInfo → TableInfo}/index.js +4 -22
- package/lib/info/components/{tableInfo → TableInfo}/index.scss +0 -0
- package/lib/info/components/baseInfo/index.d.ts +3 -1
- package/lib/info/components/baseInfo/index.js +33 -49
- package/lib/info/index.js +70 -25
- package/lib/info/index.scss +0 -4
- package/lib/info/typing.d.ts +17 -6
- package/lib/page-header/index.d.ts +9 -5
- package/lib/page-header/index.js +22 -7
- package/lib/table/components/Filter/index.js +7 -2
- package/lib/table/components/Filter/index.scss +1 -1
- package/lib/table/typing.d.ts +2 -0
- package/package.json +1 -1
- package/es/info/components/headerInfo/index.js +0 -99
- package/lib/info/components/headerInfo/index.js +0 -126
@@ -1,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
-
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
@@ -9,16 +7,12 @@ exports.default = void 0;
|
|
9
7
|
|
10
8
|
var _components = require("@alicloudfe/components");
|
11
9
|
|
12
|
-
var
|
13
|
-
|
14
|
-
var _react = _interopRequireWildcard(require("react"));
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
15
11
|
|
16
12
|
var _ProInfoItem = _interopRequireDefault(require("../ProInfoItem"));
|
17
13
|
|
18
14
|
require("./index.scss");
|
19
15
|
|
20
|
-
var _hooks = require("@teamix/hooks");
|
21
|
-
|
22
16
|
var _utils = require("../../utils/utils");
|
23
17
|
|
24
18
|
var _layout = _interopRequireDefault(require("../../utils/layout"));
|
@@ -27,67 +21,64 @@ var _InfoValueItem = _interopRequireDefault(require("../InfoValueItem"));
|
|
27
21
|
|
28
22
|
var _utils2 = require("../../utils");
|
29
23
|
|
30
|
-
var _excluded = ["header", "columns", "dataSource", "loading", "result", "actionRef", "className", "layout"];
|
31
|
-
|
32
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
25
|
|
34
|
-
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); }
|
35
|
-
|
36
|
-
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; }
|
37
|
-
|
38
|
-
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; }
|
39
|
-
|
40
|
-
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; }
|
41
|
-
|
42
|
-
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; }
|
43
|
-
|
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; }
|
45
|
-
|
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; }
|
47
|
-
|
48
26
|
var Row = _components.Grid.Row,
|
49
27
|
Col = _components.Grid.Col;
|
50
28
|
|
51
29
|
var ProBaseInfo = function ProBaseInfo(props) {
|
52
30
|
var _size$width;
|
53
31
|
|
54
|
-
var
|
55
|
-
columns = props.columns,
|
32
|
+
var columns = props.columns,
|
56
33
|
dataSource = props.dataSource,
|
57
34
|
loading = props.loading,
|
58
35
|
result = props.result,
|
59
36
|
actionRef = props.actionRef,
|
60
|
-
className = props.className,
|
61
37
|
layout = props.layout,
|
62
|
-
|
38
|
+
size = props.size;
|
63
39
|
|
64
|
-
var
|
65
|
-
var ref = (0, _react.useRef)();
|
66
|
-
var size = context.visible ? context.size : (0, _hooks.useSize)(ref);
|
40
|
+
var defaultLayout = _layout.default[(0, _utils.getLayout)((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; // 获取列内的布局参数
|
67
41
|
|
68
|
-
var defaultLayout = _layout.default[(0, _utils.getLayout)((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; // 获取列的布局参数
|
69
42
|
|
43
|
+
var getFormItemLayout = function getFormItemLayout(colspan) {
|
44
|
+
var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout)); // 自定义布局
|
70
45
|
|
71
|
-
var getFormItemLayout = function getFormItemLayout() {
|
72
46
|
if (layout) {
|
73
47
|
var _layout$labelCol, _layout$wrapperCol;
|
74
48
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
49
|
+
var labelCol = (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol;
|
50
|
+
var wrapperCol = (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol;
|
51
|
+
formItemLayout.labelCol = labelCol;
|
52
|
+
formItemLayout.wrapperCol = wrapperCol;
|
53
|
+
}
|
54
|
+
|
55
|
+
var newLabelSpan = formItemLayout.labelCol.span;
|
56
|
+
var newWrapperSpan = formItemLayout.wrapperCol.span; // 计算合并列情况。label与wrapper需要重新计算
|
57
|
+
|
58
|
+
if (colspan) {
|
59
|
+
newLabelSpan = newLabelSpan / colspan;
|
60
|
+
newWrapperSpan = newWrapperSpan + (formItemLayout.labelCol.span - newLabelSpan);
|
79
61
|
}
|
80
62
|
|
81
|
-
|
63
|
+
var newFormItemLayout = {
|
64
|
+
labelCol: {
|
65
|
+
span: newLabelSpan
|
66
|
+
},
|
67
|
+
wrapperCol: {
|
68
|
+
span: newWrapperSpan
|
69
|
+
}
|
70
|
+
};
|
71
|
+
return Object.assign(formItemLayout, newFormItemLayout);
|
82
72
|
};
|
83
73
|
|
84
74
|
var renderContent = function renderContent() {
|
85
75
|
return columns.map(function (item, index) {
|
86
|
-
var _layout$span, _item$title, _item$valueType, _ref;
|
76
|
+
var _layout$span, _layout$span2, _item$title, _item$valueType, _ref, _item$colSpan;
|
87
77
|
|
88
78
|
var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
|
79
|
+
var layoutSpan = item.colSpan ? ((_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : span) * item.colSpan : (_layout$span2 = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span2 !== void 0 ? _layout$span2 : span;
|
89
80
|
return /*#__PURE__*/_react.default.createElement(Col, {
|
90
|
-
span:
|
81
|
+
span: layoutSpan,
|
91
82
|
key: index
|
92
83
|
}, /*#__PURE__*/_react.default.createElement(_ProInfoItem.default, {
|
93
84
|
label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
|
@@ -101,24 +92,17 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
101
92
|
record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
|
102
93
|
actionRef: actionRef
|
103
94
|
}),
|
104
|
-
baseInfoLayout: getFormItemLayout(),
|
95
|
+
baseInfoLayout: getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0),
|
105
96
|
tooltip: item.tooltip,
|
106
97
|
tooltipIcon: item.tooltipIcon
|
107
98
|
}));
|
108
99
|
});
|
109
100
|
};
|
110
101
|
|
111
|
-
return /*#__PURE__*/_react.default.createElement(
|
112
|
-
ref: ref,
|
113
|
-
className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : '')
|
114
|
-
}, others), (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread({
|
115
|
-
compacted: true,
|
116
|
-
hoveredShadow: false,
|
117
|
-
bordered: false
|
118
|
-
}, header), /*#__PURE__*/_react.default.createElement(Row, {
|
102
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/_react.default.createElement(Row, {
|
119
103
|
wrap: true,
|
120
104
|
className: "teamix-pro-info-content-row"
|
121
|
-
}, renderContent()))
|
105
|
+
}, renderContent()));
|
122
106
|
};
|
123
107
|
|
124
108
|
var _default = ProBaseInfo;
|
package/lib/info/index.js
CHANGED
@@ -24,6 +24,10 @@ var _utils = require("./utils");
|
|
24
24
|
|
25
25
|
var _utils2 = require("@teamix/utils");
|
26
26
|
|
27
|
+
var _hooks = require("@teamix/hooks");
|
28
|
+
|
29
|
+
var _ = require("..");
|
30
|
+
|
27
31
|
var _typing = require("./typing");
|
28
32
|
|
29
33
|
Object.keys(_typing).forEach(function (key) {
|
@@ -37,7 +41,7 @@ Object.keys(_typing).forEach(function (key) {
|
|
37
41
|
}
|
38
42
|
});
|
39
43
|
});
|
40
|
-
var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError"];
|
44
|
+
var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError", "className", "style", "columns", "layout", "dataSource", "loading", "extra"];
|
41
45
|
|
42
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
43
47
|
|
@@ -68,7 +72,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
68
72
|
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; }
|
69
73
|
|
70
74
|
var ProInfo = function ProInfo(props) {
|
71
|
-
var type = props.type,
|
75
|
+
var _props$type = props.type,
|
76
|
+
type = _props$type === void 0 ? 'base' : _props$type,
|
72
77
|
url = props.url,
|
73
78
|
_props$method = props.method,
|
74
79
|
method = _props$method === void 0 ? 'post' : _props$method,
|
@@ -78,14 +83,26 @@ var ProInfo = function ProInfo(props) {
|
|
78
83
|
_props$header = props.header,
|
79
84
|
header = _props$header === void 0 ? {} : _props$header,
|
80
85
|
_onError = props.onError,
|
86
|
+
className = props.className,
|
87
|
+
style = props.style,
|
88
|
+
columns = props.columns,
|
89
|
+
layout = props.layout,
|
90
|
+
dataSource = props.dataSource,
|
91
|
+
userLoading = props.loading,
|
92
|
+
extra = props.extra,
|
81
93
|
others = _objectWithoutProperties(props, _excluded);
|
82
94
|
|
83
95
|
var _useContext = (0, _react.useContext)(_utils.ProInfoGroupContext),
|
84
96
|
contextUrl = _useContext.url,
|
85
97
|
contextMethod = _useContext.method,
|
86
98
|
contextParams = _useContext.params,
|
87
|
-
contextFormatResult = _useContext.formatResult
|
99
|
+
contextFormatResult = _useContext.formatResult,
|
100
|
+
contextVisible = _useContext.visible,
|
101
|
+
contextSize = _useContext.size; // 获取容器宽度
|
102
|
+
|
88
103
|
|
104
|
+
var ref = (0, _react.useRef)();
|
105
|
+
var size = contextVisible ? contextSize : (0, _hooks.useSize)(ref); // 请求数据
|
89
106
|
|
90
107
|
var _useState = (0, _react.useState)(false),
|
91
108
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -150,30 +167,58 @@ var ProInfo = function ProInfo(props) {
|
|
150
167
|
}
|
151
168
|
});
|
152
169
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
170
|
+
var getExtra = function getExtra() {
|
171
|
+
if (!extra) {
|
172
|
+
return undefined;
|
173
|
+
}
|
174
|
+
|
175
|
+
if ( /*#__PURE__*/(0, _react.isValidElement)(extra)) {
|
176
|
+
return extra;
|
177
|
+
}
|
178
|
+
|
179
|
+
return _objectSpread(_objectSpread({}, extra), {}, {
|
180
|
+
context: {
|
181
|
+
record: dataSource !== null && dataSource !== void 0 ? dataSource : getDataSource(getData.data)
|
182
|
+
}
|
183
|
+
});
|
184
|
+
};
|
185
|
+
|
186
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
187
|
+
ref: ref,
|
188
|
+
className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : ''),
|
189
|
+
style: style
|
190
|
+
}, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread(_objectSpread(_objectSpread({
|
191
|
+
compacted: true,
|
192
|
+
hoveredShadow: false,
|
193
|
+
bordered: false,
|
194
|
+
backgroundColor: "transparent"
|
195
|
+
}, header), others), {}, {
|
196
|
+
extra: getExtra()
|
197
|
+
}), type === 'table' && /*#__PURE__*/_react.default.createElement(_tableInfo.default, {
|
198
|
+
dataSource: dataSource,
|
199
|
+
columns: columns,
|
200
|
+
loading: userLoading || loading || getData.loading,
|
201
|
+
result: getDataSource(getData.data),
|
202
|
+
actionRef: actionRef,
|
203
|
+
layout: layout
|
204
|
+
}), type === 'header' && /*#__PURE__*/_react.default.createElement(_headerInfo.default, {
|
205
|
+
dataSource: dataSource,
|
206
|
+
columns: columns,
|
172
207
|
header: header,
|
173
|
-
loading: loading || getData.loading,
|
208
|
+
loading: userLoading || loading || getData.loading,
|
209
|
+
result: getDataSource(getData.data),
|
210
|
+
actionRef: actionRef,
|
211
|
+
layout: layout,
|
212
|
+
size: size
|
213
|
+
}), type === 'base' && /*#__PURE__*/_react.default.createElement(_baseInfo.default, {
|
214
|
+
dataSource: dataSource,
|
215
|
+
columns: columns,
|
216
|
+
loading: userLoading || loading || getData.loading,
|
174
217
|
result: getDataSource(getData.data),
|
175
|
-
actionRef: actionRef
|
176
|
-
|
218
|
+
actionRef: actionRef,
|
219
|
+
layout: layout,
|
220
|
+
size: size
|
221
|
+
})));
|
177
222
|
};
|
178
223
|
|
179
224
|
ProInfo.Group = _InfoGroup.default;
|
package/lib/info/index.scss
CHANGED
package/lib/info/typing.d.ts
CHANGED
@@ -3,6 +3,12 @@ import { ActionGroupProps, IActionButton } from '../actions';
|
|
3
3
|
import { Method } from 'axios';
|
4
4
|
import React from 'react';
|
5
5
|
import { CardProps } from '../card';
|
6
|
+
/** 列record函数 */
|
7
|
+
declare type ProInfoCellFunProp = (value: any, record: any) => any;
|
8
|
+
declare type FieldRenderProps = keyof IProFieldFormatterProps;
|
9
|
+
declare type ProInfoCellRender = {
|
10
|
+
[key in FieldRenderProps]?: IProFieldFormatterProps[key] | ProInfoCellFunProp;
|
11
|
+
} | ((...other: any) => React.ReactNode);
|
6
12
|
/** ProInfoBaseProps info 基础定义 */
|
7
13
|
export declare type ProInfoBaseProps = {
|
8
14
|
/** ProColums 定义,取代 Table 的 columns */
|
@@ -27,7 +33,7 @@ export declare type ProInfoBaseProps = {
|
|
27
33
|
onError?: (error: Error) => void;
|
28
34
|
/** ProInfo action 的引用,便于手动触发一些方法 */
|
29
35
|
actionRef?: React.MutableRefObject<ProInfoActionType | undefined>;
|
30
|
-
/** 标题区 */
|
36
|
+
/** 标题区 推荐将header中的内容平铺到ProCard中。即将不支持此写法 */
|
31
37
|
header?: ProInfoHeaderProps;
|
32
38
|
/** info 数据源 */
|
33
39
|
dataSource?: {
|
@@ -35,7 +41,9 @@ export declare type ProInfoBaseProps = {
|
|
35
41
|
};
|
36
42
|
/** 布局值 */
|
37
43
|
layout?: BaseInfoLayoutProps;
|
38
|
-
|
44
|
+
/** 加载动画 */
|
45
|
+
loading?: boolean;
|
46
|
+
} & ProInfoHeaderProps;
|
39
47
|
/** ProInfoItemProps info 单元格 定义 */
|
40
48
|
export interface ProInfoItemProps {
|
41
49
|
/** 标题 */
|
@@ -49,9 +57,9 @@ export interface ProInfoItemProps {
|
|
49
57
|
/** 对应 ProField 里面的 type */
|
50
58
|
valueType?: IProFieldType;
|
51
59
|
/** 渲染单元格内容字段 */
|
52
|
-
render?:
|
60
|
+
render?: ProInfoCellRender;
|
53
61
|
/** 枚举值 */
|
54
|
-
dataSource?: IProFieldOptionItem[];
|
62
|
+
dataSource?: IProFieldOptionItem[] | ProInfoCellFunProp;
|
55
63
|
/** 表头的筛选菜单项,当值为 true 时,自动使用 dataSource 生成 */
|
56
64
|
filters?: boolean;
|
57
65
|
/** 操作组配置 */
|
@@ -138,8 +146,10 @@ export declare type InfoValueItemProps = {
|
|
138
146
|
infoItem: ProInfoItemProps;
|
139
147
|
record: any;
|
140
148
|
actionRef?: React.MutableRefObject<ProInfoActionType | undefined>;
|
141
|
-
|
142
|
-
|
149
|
+
render?: ProInfoCellRender;
|
150
|
+
dataSource?: IProFieldOptionItem[] | ProInfoCellFunProp;
|
151
|
+
} & Omit<IProFieldProps, 'render' | 'dataSource'>;
|
152
|
+
export declare type ProInfoHeaderProps = Omit<CardProps, 'loading'>;
|
143
153
|
/** ProInfoGroupContextProps */
|
144
154
|
export declare type ProInfoGroupContextProps = {
|
145
155
|
/** 因为其他数据都为异步。visible 只用作标识 */
|
@@ -173,3 +183,4 @@ export declare type ProInfoTransparentBase = {
|
|
173
183
|
/** style */
|
174
184
|
style?: React.CSSProperties;
|
175
185
|
};
|
186
|
+
export {};
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
|
2
3
|
import { ActionGroupProps } from '../actions';
|
3
4
|
import { ProInfoProps } from '../info';
|
4
5
|
import './index.scss';
|
@@ -12,11 +13,14 @@ export interface LinkItem {
|
|
12
13
|
text: string;
|
13
14
|
onClick?: (e?: React.MouseEvent<Element, MouseEvent>) => void;
|
14
15
|
}
|
15
|
-
export
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
export declare type TagItem = (TagProps | (CloseableProps & {
|
17
|
+
closable: true;
|
18
|
+
})) & {
|
19
|
+
/**
|
20
|
+
* @deprecated 建议使用 children 代替
|
21
|
+
*/
|
22
|
+
text?: string;
|
23
|
+
};
|
20
24
|
declare type Color = 'blue' | 'green' | 'orange' | 'red' | 'yellow' | string;
|
21
25
|
export interface DataItem {
|
22
26
|
title: string;
|
package/lib/page-header/index.js
CHANGED
@@ -25,7 +25,8 @@ var _info = _interopRequireDefault(require("../info"));
|
|
25
25
|
|
26
26
|
require("./index.scss");
|
27
27
|
|
28
|
-
var _excluded = ["
|
28
|
+
var _excluded = ["text", "children", "closable"],
|
29
|
+
_excluded2 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
|
29
30
|
|
30
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
31
32
|
|
@@ -85,15 +86,29 @@ var renderTags = function renderTags(tags) {
|
|
85
86
|
return /*#__PURE__*/_react.default.createElement(_components.Tag.Group, {
|
86
87
|
className: cls('tags')
|
87
88
|
}, tags.map(function (tag, i) {
|
88
|
-
|
89
|
+
// @ts-ignore
|
90
|
+
var text = tag.text,
|
91
|
+
children = tag.children,
|
92
|
+
closable = tag.closable,
|
93
|
+
others = _objectWithoutProperties(tag, _excluded);
|
94
|
+
|
95
|
+
if (closable) {
|
96
|
+
return /*#__PURE__*/_react.default.createElement(_components.Tag.Closeable, _objectSpread({
|
97
|
+
key: i,
|
98
|
+
size: "large",
|
99
|
+
style: {
|
100
|
+
marginBottom: 0
|
101
|
+
}
|
102
|
+
}, others), text || children);
|
103
|
+
}
|
104
|
+
|
105
|
+
return /*#__PURE__*/_react.default.createElement(_components.Tag, _objectSpread({
|
89
106
|
key: i,
|
90
107
|
size: "large",
|
91
|
-
type: tag.type,
|
92
|
-
color: tag.color,
|
93
108
|
style: {
|
94
109
|
marginBottom: 0
|
95
110
|
}
|
96
|
-
},
|
111
|
+
}, others), text || children);
|
97
112
|
}));
|
98
113
|
};
|
99
114
|
|
@@ -111,7 +126,7 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
|
|
111
126
|
|
112
127
|
var isColorPresetColor = isPresetColor(color);
|
113
128
|
var isBgColorPresetColor = isPresetColor(backgroundColor);
|
114
|
-
var className = (0, _classnames2.default)((_classnames = {}, _defineProperty(_classnames, "".concat(cls("color-".concat(color))), isColorPresetColor), _defineProperty(_classnames, "".concat(cls("color-
|
129
|
+
var className = (0, _classnames2.default)((_classnames = {}, _defineProperty(_classnames, "".concat(cls("color-".concat(color))), isColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-color-".concat(backgroundColor))), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
|
115
130
|
var styleColor = isColorPresetColor ? undefined : color;
|
116
131
|
var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
|
117
132
|
var style = {
|
@@ -178,7 +193,7 @@ var PageHeader = function PageHeader(props) {
|
|
178
193
|
children = props.children,
|
179
194
|
className = props.className,
|
180
195
|
style = props.style,
|
181
|
-
others = _objectWithoutProperties(props,
|
196
|
+
others = _objectWithoutProperties(props, _excluded2);
|
182
197
|
|
183
198
|
var history = (0, _reactRouterDom.useHistory)();
|
184
199
|
var backgroundImage = image ? "url('".concat(image, "')") : undefined;
|
@@ -55,7 +55,9 @@ var RadioItem = _components.Menu.RadioItem;
|
|
55
55
|
|
56
56
|
var Filter = function Filter(props) {
|
57
57
|
var column = props.column,
|
58
|
-
actionRef = props.actionRef;
|
58
|
+
actionRef = props.actionRef;
|
59
|
+
var _column$filtersWidth = column.filtersWidth,
|
60
|
+
filtersWidth = _column$filtersWidth === void 0 ? 130 : _column$filtersWidth; // 选中过滤项
|
59
61
|
|
60
62
|
var _useState = (0, _react.useState)([]),
|
61
63
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -174,7 +176,10 @@ var Filter = function Filter(props) {
|
|
174
176
|
return setVisible(false);
|
175
177
|
}
|
176
178
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
177
|
-
className: cls()
|
179
|
+
className: cls(),
|
180
|
+
style: {
|
181
|
+
width: filtersWidth
|
182
|
+
}
|
178
183
|
}, /*#__PURE__*/_react.default.createElement(_components.Menu, null, renderSelect(), /*#__PURE__*/_react.default.createElement("div", {
|
179
184
|
className: cls({
|
180
185
|
'btn-box': true
|
package/lib/table/typing.d.ts
CHANGED
@@ -47,6 +47,8 @@ export declare type ProColumnProps = {
|
|
47
47
|
filtersMode?: 'single' | 'multiple';
|
48
48
|
/** 表头的过滤菜单项在搜索之前的参数操作 */
|
49
49
|
beforeFilter?: (rules: string[]) => string;
|
50
|
+
/** 表头的过滤菜单宽度 */
|
51
|
+
filtersWidth?: string | number;
|
50
52
|
/** 操作组配置 */
|
51
53
|
actionSchema?: ActionGroupProps;
|
52
54
|
/** 指定列对应的字段,支持`a.b`形式的快速取值 和 数组取值 */
|
package/package.json
CHANGED
@@ -1,99 +0,0 @@
|
|
1
|
-
var _excluded = ["header", "columns", "dataSource", "layout", "loading", "result", "actionRef", "className"];
|
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 { Grid } from '@alicloudfe/components';
|
14
|
-
import ProCard from '../../../card';
|
15
|
-
import React, { useContext, useRef } from 'react';
|
16
|
-
import ProInfoItem from '../ProInfoItem';
|
17
|
-
import './index.scss';
|
18
|
-
import defaultLayoutMap from '../../utils/layout';
|
19
|
-
import { useSize } from '@teamix/hooks';
|
20
|
-
import { getLayout } from '../../utils/utils';
|
21
|
-
import InfoValueItem from '../InfoValueItem';
|
22
|
-
import { getDataIndexValue, ProInfoGroupContext } from '../../utils';
|
23
|
-
var Row = Grid.Row,
|
24
|
-
Col = Grid.Col;
|
25
|
-
|
26
|
-
var ProHeaderInfo = function ProHeaderInfo(props) {
|
27
|
-
var _size$width;
|
28
|
-
|
29
|
-
var header = props.header,
|
30
|
-
columns = props.columns,
|
31
|
-
dataSource = props.dataSource,
|
32
|
-
layout = props.layout,
|
33
|
-
loading = props.loading,
|
34
|
-
result = props.result,
|
35
|
-
actionRef = props.actionRef,
|
36
|
-
className = props.className,
|
37
|
-
others = _objectWithoutProperties(props, _excluded);
|
38
|
-
|
39
|
-
var context = useContext(ProInfoGroupContext);
|
40
|
-
var ref = useRef();
|
41
|
-
var size = context.visible ? context.size : useSize(ref);
|
42
|
-
var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
|
43
|
-
|
44
|
-
var renderContent = function renderContent() {
|
45
|
-
return columns.map(function (item, index) {
|
46
|
-
var _item$title, _item$valueType;
|
47
|
-
|
48
|
-
var span = 24;
|
49
|
-
|
50
|
-
if (layout === null || layout === void 0 ? void 0 : layout.colNum) {
|
51
|
-
var _item$colSpan;
|
52
|
-
|
53
|
-
span = 24 / (layout === null || layout === void 0 ? void 0 : layout.colNum) * ((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 1);
|
54
|
-
} else {
|
55
|
-
var _item$colSpan2;
|
56
|
-
|
57
|
-
span = defaultLayout.span * ((_item$colSpan2 = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan2 !== void 0 ? _item$colSpan2 : 1);
|
58
|
-
}
|
59
|
-
|
60
|
-
return /*#__PURE__*/React.createElement(Col, {
|
61
|
-
span: span,
|
62
|
-
key: index
|
63
|
-
}, /*#__PURE__*/React.createElement(ProInfoItem, {
|
64
|
-
label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
|
65
|
-
loading: loading,
|
66
|
-
value: /*#__PURE__*/React.createElement(InfoValueItem, {
|
67
|
-
type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
|
68
|
-
value: getDataIndexValue(item.dataIndex, dataSource !== null && dataSource !== void 0 ? dataSource : result),
|
69
|
-
render: item.render,
|
70
|
-
dataSource: item.dataSource,
|
71
|
-
infoItem: item,
|
72
|
-
record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
|
73
|
-
actionRef: actionRef
|
74
|
-
}),
|
75
|
-
headerInfoLayout: layout !== null && layout !== void 0 ? layout : defaultLayout,
|
76
|
-
tooltip: item.tooltip,
|
77
|
-
tooltipIcon: item.tooltipIcon
|
78
|
-
}));
|
79
|
-
});
|
80
|
-
};
|
81
|
-
|
82
|
-
return (
|
83
|
-
/*#__PURE__*/
|
84
|
-
// TODO 优化透传方式
|
85
|
-
React.createElement("div", _objectSpread({
|
86
|
-
ref: ref,
|
87
|
-
className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : '')
|
88
|
-
}, others), (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(ProCard, _objectSpread({
|
89
|
-
compacted: true,
|
90
|
-
hoveredShadow: false,
|
91
|
-
bordered: false
|
92
|
-
}, header), /*#__PURE__*/React.createElement(Row, {
|
93
|
-
wrap: true,
|
94
|
-
className: "teamix-pro-info-content-row"
|
95
|
-
}, renderContent())))
|
96
|
-
);
|
97
|
-
};
|
98
|
-
|
99
|
-
export default ProHeaderInfo;
|