@teamix/pro 1.1.34 → 1.1.35
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 +464 -352
- 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 +2 -0
- package/es/actions/dialog.js +11 -4
- 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 +8 -0
- package/es/actions/link.js +2 -12
- package/es/form/SchemaForm/reactions.js +4 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoValueItem/index.js +108 -26
- package/es/info/components/baseInfo/index.d.ts +3 -1
- package/es/info/components/baseInfo/index.js +6 -33
- package/es/info/components/headerInfo/index.d.ts +3 -1
- package/es/info/components/headerInfo/index.js +8 -39
- package/es/info/components/tableInfo/index.js +4 -21
- package/es/info/index.js +50 -28
- package/es/info/index.scss +0 -4
- package/es/info/typing.d.ts +14 -5
- package/es/page-header/index.js +1 -1
- 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 +2 -0
- package/lib/actions/dialog.js +11 -4
- 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 +8 -0
- package/lib/actions/link.js +2 -12
- package/lib/form/SchemaForm/reactions.js +4 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoValueItem/index.js +107 -25
- package/lib/info/components/baseInfo/index.d.ts +3 -1
- package/lib/info/components/baseInfo/index.js +5 -40
- package/lib/info/components/headerInfo/index.d.ts +3 -1
- package/lib/info/components/headerInfo/index.js +7 -46
- package/lib/info/components/tableInfo/index.js +4 -22
- package/lib/info/index.js +52 -28
- package/lib/info/index.scss +0 -4
- package/lib/info/typing.d.ts +14 -5
- package/lib/page-header/index.js +1 -1
- package/package.json +1 -1
@@ -13,8 +13,6 @@ require("./index.scss");
|
|
13
13
|
|
14
14
|
var _components = require("@alicloudfe/components");
|
15
15
|
|
16
|
-
var _card = _interopRequireDefault(require("../../../card"));
|
17
|
-
|
18
16
|
var _utils = require("@teamix/utils");
|
19
17
|
|
20
18
|
var _InfoValueItem = _interopRequireDefault(require("../InfoValueItem"));
|
@@ -23,8 +21,6 @@ var _2 = require("../../..");
|
|
23
21
|
|
24
22
|
var _utils2 = require("../../utils");
|
25
23
|
|
26
|
-
var _excluded = ["header", "columns", "dataSource", "layout", "loading", "result", "actionRef", "className"];
|
27
|
-
|
28
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29
25
|
|
30
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
@@ -49,22 +45,14 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
49
45
|
|
50
46
|
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; }
|
51
47
|
|
52
|
-
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; }
|
53
|
-
|
54
|
-
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; }
|
55
|
-
|
56
48
|
var ProTableInfo = function ProTableInfo(props) {
|
57
|
-
var
|
58
|
-
columns = props.columns,
|
49
|
+
var columns = props.columns,
|
59
50
|
dataSource = props.dataSource,
|
60
51
|
_props$layout = props.layout,
|
61
52
|
layout = _props$layout === void 0 ? {} : _props$layout,
|
62
53
|
loading = props.loading,
|
63
54
|
result = props.result,
|
64
|
-
actionRef = props.actionRef
|
65
|
-
className = props.className,
|
66
|
-
others = _objectWithoutProperties(props, _excluded);
|
67
|
-
|
55
|
+
actionRef = props.actionRef;
|
68
56
|
var _layout$colNum = layout.colNum,
|
69
57
|
colNum = _layout$colNum === void 0 ? 2 : _layout$colNum,
|
70
58
|
_layout$labelGutter = layout.labelGutter,
|
@@ -194,20 +182,14 @@ var ProTableInfo = function ProTableInfo(props) {
|
|
194
182
|
}
|
195
183
|
};
|
196
184
|
|
197
|
-
return /*#__PURE__*/_react.default.createElement(
|
198
|
-
className: "teamix-pro-info ".concat(className)
|
199
|
-
}, others), /*#__PURE__*/_react.default.createElement(_card.default, _objectSpread({
|
200
|
-
compacted: true,
|
201
|
-
hoveredShadow: false,
|
202
|
-
bordered: false
|
203
|
-
}, header), /*#__PURE__*/_react.default.createElement(_components.Table.StickyLock, {
|
185
|
+
return /*#__PURE__*/_react.default.createElement(_components.Table.StickyLock, {
|
204
186
|
className: "teamix-pro-info-table",
|
205
187
|
cellProps: setCellProps,
|
206
188
|
columns: newColumns(),
|
207
189
|
hasHeader: false,
|
208
190
|
hasBorder: true,
|
209
191
|
dataSource: newDataSource
|
210
|
-
})
|
192
|
+
});
|
211
193
|
};
|
212
194
|
|
213
195
|
var _default = ProTableInfo;
|
package/lib/info/index.js
CHANGED
@@ -10,11 +10,11 @@ exports.default = void 0;
|
|
10
10
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
12
12
|
|
13
|
-
var
|
13
|
+
var _TableInfo = _interopRequireDefault(require("./components/TableInfo"));
|
14
14
|
|
15
|
-
var
|
15
|
+
var _HeaderInfo = _interopRequireDefault(require("./components/HeaderInfo"));
|
16
16
|
|
17
|
-
var
|
17
|
+
var _BaseInfo = _interopRequireDefault(require("./components/BaseInfo"));
|
18
18
|
|
19
19
|
var _InfoGroup = _interopRequireDefault(require("./components/InfoGroup"));
|
20
20
|
|
@@ -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"];
|
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,15 +83,25 @@ 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,
|
81
91
|
others = _objectWithoutProperties(props, _excluded);
|
82
92
|
|
83
93
|
var _useContext = (0, _react.useContext)(_utils.ProInfoGroupContext),
|
84
94
|
contextUrl = _useContext.url,
|
85
95
|
contextMethod = _useContext.method,
|
86
96
|
contextParams = _useContext.params,
|
87
|
-
contextFormatResult = _useContext.formatResult
|
97
|
+
contextFormatResult = _useContext.formatResult,
|
98
|
+
contextVisible = _useContext.visible,
|
99
|
+
contextSize = _useContext.size; // 获取容器宽度
|
88
100
|
|
89
101
|
|
102
|
+
var ref = (0, _react.useRef)();
|
103
|
+
var size = contextVisible ? contextSize : (0, _hooks.useSize)(ref); // 请求数据
|
104
|
+
|
90
105
|
var _useState = (0, _react.useState)(false),
|
91
106
|
_useState2 = _slicedToArray(_useState, 2),
|
92
107
|
loading = _useState2[0],
|
@@ -149,31 +164,40 @@ var ProInfo = function ProInfo(props) {
|
|
149
164
|
getData.run({});
|
150
165
|
}
|
151
166
|
});
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
return /*#__PURE__*/_react.default.createElement(_baseInfo.default, _objectSpread(_objectSpread({}, others), {}, {
|
167
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
168
|
+
ref: ref,
|
169
|
+
className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : ''),
|
170
|
+
style: style
|
171
|
+
}, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread(_objectSpread({
|
172
|
+
compacted: true,
|
173
|
+
hoveredShadow: false,
|
174
|
+
bordered: false,
|
175
|
+
backgroundColor: "transparent"
|
176
|
+
}, header), others), type === 'table' && /*#__PURE__*/_react.default.createElement(_TableInfo.default, {
|
177
|
+
dataSource: dataSource,
|
178
|
+
columns: columns,
|
179
|
+
loading: loading || getData.loading,
|
180
|
+
result: getDataSource(getData.data),
|
181
|
+
actionRef: actionRef,
|
182
|
+
layout: layout
|
183
|
+
}), type === 'header' && /*#__PURE__*/_react.default.createElement(_HeaderInfo.default, {
|
184
|
+
dataSource: dataSource,
|
185
|
+
columns: columns,
|
172
186
|
header: header,
|
173
187
|
loading: loading || getData.loading,
|
174
188
|
result: getDataSource(getData.data),
|
175
|
-
actionRef: actionRef
|
176
|
-
|
189
|
+
actionRef: actionRef,
|
190
|
+
layout: layout,
|
191
|
+
size: size
|
192
|
+
}), type === 'base' && /*#__PURE__*/_react.default.createElement(_BaseInfo.default, {
|
193
|
+
dataSource: dataSource,
|
194
|
+
columns: columns,
|
195
|
+
loading: loading || getData.loading,
|
196
|
+
result: getDataSource(getData.data),
|
197
|
+
actionRef: actionRef,
|
198
|
+
layout: layout,
|
199
|
+
size: size
|
200
|
+
})));
|
177
201
|
};
|
178
202
|
|
179
203
|
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,7 @@ export declare type ProInfoBaseProps = {
|
|
35
41
|
};
|
36
42
|
/** 布局值 */
|
37
43
|
layout?: BaseInfoLayoutProps;
|
38
|
-
};
|
44
|
+
} & ProInfoHeaderProps;
|
39
45
|
/** ProInfoItemProps info 单元格 定义 */
|
40
46
|
export interface ProInfoItemProps {
|
41
47
|
/** 标题 */
|
@@ -49,9 +55,9 @@ export interface ProInfoItemProps {
|
|
49
55
|
/** 对应 ProField 里面的 type */
|
50
56
|
valueType?: IProFieldType;
|
51
57
|
/** 渲染单元格内容字段 */
|
52
|
-
render?:
|
58
|
+
render?: ProInfoCellRender;
|
53
59
|
/** 枚举值 */
|
54
|
-
dataSource?: IProFieldOptionItem[];
|
60
|
+
dataSource?: IProFieldOptionItem[] | ProInfoCellFunProp;
|
55
61
|
/** 表头的筛选菜单项,当值为 true 时,自动使用 dataSource 生成 */
|
56
62
|
filters?: boolean;
|
57
63
|
/** 操作组配置 */
|
@@ -138,7 +144,9 @@ export declare type InfoValueItemProps = {
|
|
138
144
|
infoItem: ProInfoItemProps;
|
139
145
|
record: any;
|
140
146
|
actionRef?: React.MutableRefObject<ProInfoActionType | undefined>;
|
141
|
-
|
147
|
+
render?: ProInfoCellRender;
|
148
|
+
dataSource?: IProFieldOptionItem[] | ProInfoCellFunProp;
|
149
|
+
} & Omit<IProFieldProps, 'render' | 'dataSource'>;
|
142
150
|
export declare type ProInfoHeaderProps = CardProps;
|
143
151
|
/** ProInfoGroupContextProps */
|
144
152
|
export declare type ProInfoGroupContextProps = {
|
@@ -173,3 +181,4 @@ export declare type ProInfoTransparentBase = {
|
|
173
181
|
/** style */
|
174
182
|
style?: React.CSSProperties;
|
175
183
|
};
|
184
|
+
export {};
|
package/lib/page-header/index.js
CHANGED
@@ -111,7 +111,7 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
|
|
111
111
|
|
112
112
|
var isColorPresetColor = isPresetColor(color);
|
113
113
|
var isBgColorPresetColor = isPresetColor(backgroundColor);
|
114
|
-
var className = (0, _classnames2.default)((_classnames = {}, _defineProperty(_classnames, "".concat(cls("color-".concat(color))), isColorPresetColor), _defineProperty(_classnames, "".concat(cls("color-
|
114
|
+
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
115
|
var styleColor = isColorPresetColor ? undefined : color;
|
116
116
|
var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
|
117
117
|
var style = {
|