@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,66 +1,65 @@
|
|
1
|
-
var _excluded = ["header", "columns", "dataSource", "loading", "result", "actionRef", "className", "layout"];
|
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
1
|
import { Grid } from '@alicloudfe/components';
|
14
|
-
import
|
15
|
-
import React, { useContext, useRef } from 'react';
|
2
|
+
import React from 'react';
|
16
3
|
import ProInfoItem from '../ProInfoItem';
|
17
4
|
import './index.scss';
|
18
|
-
import { useSize } from '@teamix/hooks';
|
19
5
|
import { getLayout } from '../../utils/utils';
|
20
6
|
import defaultLayoutMap from '../../utils/layout';
|
21
7
|
import InfoValueItem from '../InfoValueItem';
|
22
|
-
import { getDataIndexValue
|
8
|
+
import { getDataIndexValue } from '../../utils';
|
23
9
|
var Row = Grid.Row,
|
24
10
|
Col = Grid.Col;
|
25
11
|
|
26
12
|
var ProBaseInfo = function ProBaseInfo(props) {
|
27
13
|
var _size$width;
|
28
14
|
|
29
|
-
var
|
30
|
-
columns = props.columns,
|
15
|
+
var columns = props.columns,
|
31
16
|
dataSource = props.dataSource,
|
32
17
|
loading = props.loading,
|
33
18
|
result = props.result,
|
34
19
|
actionRef = props.actionRef,
|
35
|
-
className = props.className,
|
36
20
|
layout = props.layout,
|
37
|
-
|
21
|
+
size = props.size;
|
22
|
+
var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)]; // 获取列内的布局参数
|
38
23
|
|
39
|
-
var
|
40
|
-
|
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)]; // 获取列的布局参数
|
24
|
+
var getFormItemLayout = function getFormItemLayout(colspan) {
|
25
|
+
var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout)); // 自定义布局
|
43
26
|
|
44
|
-
var getFormItemLayout = function getFormItemLayout() {
|
45
27
|
if (layout) {
|
46
28
|
var _layout$labelCol, _layout$wrapperCol;
|
47
29
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
30
|
+
var labelCol = (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol;
|
31
|
+
var wrapperCol = (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol;
|
32
|
+
formItemLayout.labelCol = labelCol;
|
33
|
+
formItemLayout.wrapperCol = wrapperCol;
|
34
|
+
}
|
35
|
+
|
36
|
+
var newLabelSpan = formItemLayout.labelCol.span;
|
37
|
+
var newWrapperSpan = formItemLayout.wrapperCol.span; // 计算合并列情况。label与wrapper需要重新计算
|
38
|
+
|
39
|
+
if (colspan) {
|
40
|
+
newLabelSpan = newLabelSpan / colspan;
|
41
|
+
newWrapperSpan = newWrapperSpan + (formItemLayout.labelCol.span - newLabelSpan);
|
52
42
|
}
|
53
43
|
|
54
|
-
|
44
|
+
var newFormItemLayout = {
|
45
|
+
labelCol: {
|
46
|
+
span: newLabelSpan
|
47
|
+
},
|
48
|
+
wrapperCol: {
|
49
|
+
span: newWrapperSpan
|
50
|
+
}
|
51
|
+
};
|
52
|
+
return Object.assign(formItemLayout, newFormItemLayout);
|
55
53
|
};
|
56
54
|
|
57
55
|
var renderContent = function renderContent() {
|
58
56
|
return columns.map(function (item, index) {
|
59
|
-
var _layout$span, _item$title, _item$valueType, _ref;
|
57
|
+
var _layout$span, _layout$span2, _item$title, _item$valueType, _ref, _item$colSpan;
|
60
58
|
|
61
59
|
var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
|
60
|
+
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;
|
62
61
|
return /*#__PURE__*/React.createElement(Col, {
|
63
|
-
span:
|
62
|
+
span: layoutSpan,
|
64
63
|
key: index
|
65
64
|
}, /*#__PURE__*/React.createElement(ProInfoItem, {
|
66
65
|
label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
|
@@ -74,24 +73,17 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
74
73
|
record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
|
75
74
|
actionRef: actionRef
|
76
75
|
}),
|
77
|
-
baseInfoLayout: getFormItemLayout(),
|
76
|
+
baseInfoLayout: getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0),
|
78
77
|
tooltip: item.tooltip,
|
79
78
|
tooltipIcon: item.tooltipIcon
|
80
79
|
}));
|
81
80
|
});
|
82
81
|
};
|
83
82
|
|
84
|
-
return /*#__PURE__*/React.createElement(
|
85
|
-
ref: ref,
|
86
|
-
className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : '')
|
87
|
-
}, others), (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(ProCard, _objectSpread({
|
88
|
-
compacted: true,
|
89
|
-
hoveredShadow: false,
|
90
|
-
bordered: false
|
91
|
-
}, header), /*#__PURE__*/React.createElement(Row, {
|
83
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(Row, {
|
92
84
|
wrap: true,
|
93
85
|
className: "teamix-pro-info-content-row"
|
94
|
-
}, renderContent()))
|
86
|
+
}, renderContent()));
|
95
87
|
};
|
96
88
|
|
97
89
|
export default ProBaseInfo;
|
package/es/info/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError"];
|
1
|
+
var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError", "className", "style", "columns", "layout", "dataSource", "loading", "extra"];
|
2
2
|
|
3
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
4
|
|
@@ -22,7 +22,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
22
22
|
|
23
23
|
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; }
|
24
24
|
|
25
|
-
import React, { useContext, useEffect, useRef, useState } from 'react';
|
25
|
+
import React, { isValidElement, useContext, useEffect, useRef, useState } from 'react';
|
26
26
|
import ProTableInfo from './components/tableInfo';
|
27
27
|
import ProHeaderInfo from './components/headerInfo';
|
28
28
|
import ProBaseInfo from './components/baseInfo';
|
@@ -30,10 +30,13 @@ import ProInfoGroup from './components/InfoGroup';
|
|
30
30
|
import './index.scss';
|
31
31
|
import { ProInfoGroupContext, useActionType } from './utils';
|
32
32
|
import { getDeepValue, request as utilResquest, useRequest } from '@teamix/utils';
|
33
|
+
import { useSize } from '@teamix/hooks';
|
34
|
+
import { ProCard } from '..';
|
33
35
|
export * from './typing';
|
34
36
|
|
35
37
|
var ProInfo = function ProInfo(props) {
|
36
|
-
var type = props.type,
|
38
|
+
var _props$type = props.type,
|
39
|
+
type = _props$type === void 0 ? 'base' : _props$type,
|
37
40
|
url = props.url,
|
38
41
|
_props$method = props.method,
|
39
42
|
method = _props$method === void 0 ? 'post' : _props$method,
|
@@ -43,15 +46,27 @@ var ProInfo = function ProInfo(props) {
|
|
43
46
|
_props$header = props.header,
|
44
47
|
header = _props$header === void 0 ? {} : _props$header,
|
45
48
|
_onError = props.onError,
|
49
|
+
className = props.className,
|
50
|
+
style = props.style,
|
51
|
+
columns = props.columns,
|
52
|
+
layout = props.layout,
|
53
|
+
dataSource = props.dataSource,
|
54
|
+
userLoading = props.loading,
|
55
|
+
extra = props.extra,
|
46
56
|
others = _objectWithoutProperties(props, _excluded);
|
47
57
|
|
48
58
|
var _useContext = useContext(ProInfoGroupContext),
|
49
59
|
contextUrl = _useContext.url,
|
50
60
|
contextMethod = _useContext.method,
|
51
61
|
contextParams = _useContext.params,
|
52
|
-
contextFormatResult = _useContext.formatResult
|
62
|
+
contextFormatResult = _useContext.formatResult,
|
63
|
+
contextVisible = _useContext.visible,
|
64
|
+
contextSize = _useContext.size; // 获取容器宽度
|
53
65
|
|
54
66
|
|
67
|
+
var ref = useRef();
|
68
|
+
var size = contextVisible ? contextSize : useSize(ref); // 请求数据
|
69
|
+
|
55
70
|
var _useState = useState(false),
|
56
71
|
_useState2 = _slicedToArray(_useState, 2),
|
57
72
|
loading = _useState2[0],
|
@@ -115,30 +130,58 @@ var ProInfo = function ProInfo(props) {
|
|
115
130
|
}
|
116
131
|
});
|
117
132
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
133
|
+
var getExtra = function getExtra() {
|
134
|
+
if (!extra) {
|
135
|
+
return undefined;
|
136
|
+
}
|
137
|
+
|
138
|
+
if ( /*#__PURE__*/isValidElement(extra)) {
|
139
|
+
return extra;
|
140
|
+
}
|
141
|
+
|
142
|
+
return _objectSpread(_objectSpread({}, extra), {}, {
|
143
|
+
context: {
|
144
|
+
record: dataSource !== null && dataSource !== void 0 ? dataSource : getDataSource(getData.data)
|
145
|
+
}
|
146
|
+
});
|
147
|
+
};
|
148
|
+
|
149
|
+
return /*#__PURE__*/React.createElement("div", {
|
150
|
+
ref: ref,
|
151
|
+
className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : ''),
|
152
|
+
style: style
|
153
|
+
}, /*#__PURE__*/React.createElement(ProCard, _objectSpread(_objectSpread(_objectSpread({
|
154
|
+
compacted: true,
|
155
|
+
hoveredShadow: false,
|
156
|
+
bordered: false,
|
157
|
+
backgroundColor: "transparent"
|
158
|
+
}, header), others), {}, {
|
159
|
+
extra: getExtra()
|
160
|
+
}), type === 'table' && /*#__PURE__*/React.createElement(ProTableInfo, {
|
161
|
+
dataSource: dataSource,
|
162
|
+
columns: columns,
|
163
|
+
loading: userLoading || loading || getData.loading,
|
164
|
+
result: getDataSource(getData.data),
|
165
|
+
actionRef: actionRef,
|
166
|
+
layout: layout
|
167
|
+
}), type === 'header' && /*#__PURE__*/React.createElement(ProHeaderInfo, {
|
168
|
+
dataSource: dataSource,
|
169
|
+
columns: columns,
|
137
170
|
header: header,
|
138
|
-
loading: loading || getData.loading,
|
171
|
+
loading: userLoading || loading || getData.loading,
|
172
|
+
result: getDataSource(getData.data),
|
173
|
+
actionRef: actionRef,
|
174
|
+
layout: layout,
|
175
|
+
size: size
|
176
|
+
}), type === 'base' && /*#__PURE__*/React.createElement(ProBaseInfo, {
|
177
|
+
dataSource: dataSource,
|
178
|
+
columns: columns,
|
179
|
+
loading: userLoading || loading || getData.loading,
|
139
180
|
result: getDataSource(getData.data),
|
140
|
-
actionRef: actionRef
|
141
|
-
|
181
|
+
actionRef: actionRef,
|
182
|
+
layout: layout,
|
183
|
+
size: size
|
184
|
+
})));
|
142
185
|
};
|
143
186
|
|
144
187
|
ProInfo.Group = ProInfoGroup;
|
package/es/info/index.scss
CHANGED
package/es/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/es/page-header/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
var _excluded = ["
|
1
|
+
var _excluded = ["text", "children", "closable"],
|
2
|
+
_excluded2 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
|
2
3
|
|
3
4
|
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; }
|
4
5
|
|
@@ -66,15 +67,29 @@ var renderTags = function renderTags(tags) {
|
|
66
67
|
return /*#__PURE__*/React.createElement(Tag.Group, {
|
67
68
|
className: cls('tags')
|
68
69
|
}, tags.map(function (tag, i) {
|
69
|
-
|
70
|
+
// @ts-ignore
|
71
|
+
var text = tag.text,
|
72
|
+
children = tag.children,
|
73
|
+
closable = tag.closable,
|
74
|
+
others = _objectWithoutProperties(tag, _excluded);
|
75
|
+
|
76
|
+
if (closable) {
|
77
|
+
return /*#__PURE__*/React.createElement(Tag.Closeable, _objectSpread({
|
78
|
+
key: i,
|
79
|
+
size: "large",
|
80
|
+
style: {
|
81
|
+
marginBottom: 0
|
82
|
+
}
|
83
|
+
}, others), text || children);
|
84
|
+
}
|
85
|
+
|
86
|
+
return /*#__PURE__*/React.createElement(Tag, _objectSpread({
|
70
87
|
key: i,
|
71
88
|
size: "large",
|
72
|
-
type: tag.type,
|
73
|
-
color: tag.color,
|
74
89
|
style: {
|
75
90
|
marginBottom: 0
|
76
91
|
}
|
77
|
-
},
|
92
|
+
}, others), text || children);
|
78
93
|
}));
|
79
94
|
};
|
80
95
|
|
@@ -92,7 +107,7 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
|
|
92
107
|
|
93
108
|
var isColorPresetColor = isPresetColor(color);
|
94
109
|
var isBgColorPresetColor = isPresetColor(backgroundColor);
|
95
|
-
var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(cls("color-".concat(color))), isColorPresetColor), _defineProperty(_classnames, "".concat(cls("color-
|
110
|
+
var className = classnames((_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));
|
96
111
|
var styleColor = isColorPresetColor ? undefined : color;
|
97
112
|
var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
|
98
113
|
var style = {
|
@@ -159,7 +174,7 @@ var PageHeader = function PageHeader(props) {
|
|
159
174
|
children = props.children,
|
160
175
|
className = props.className,
|
161
176
|
style = props.style,
|
162
|
-
others = _objectWithoutProperties(props,
|
177
|
+
others = _objectWithoutProperties(props, _excluded2);
|
163
178
|
|
164
179
|
var history = useHistory();
|
165
180
|
var backgroundImage = image ? "url('".concat(image, "')") : undefined;
|
@@ -35,7 +35,9 @@ var RadioItem = Menu.RadioItem;
|
|
35
35
|
|
36
36
|
var Filter = function Filter(props) {
|
37
37
|
var column = props.column,
|
38
|
-
actionRef = props.actionRef;
|
38
|
+
actionRef = props.actionRef;
|
39
|
+
var _column$filtersWidth = column.filtersWidth,
|
40
|
+
filtersWidth = _column$filtersWidth === void 0 ? 130 : _column$filtersWidth; // 选中过滤项
|
39
41
|
|
40
42
|
var _useState = useState([]),
|
41
43
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -154,7 +156,10 @@ var Filter = function Filter(props) {
|
|
154
156
|
return setVisible(false);
|
155
157
|
}
|
156
158
|
}, /*#__PURE__*/React.createElement("div", {
|
157
|
-
className: cls()
|
159
|
+
className: cls(),
|
160
|
+
style: {
|
161
|
+
width: filtersWidth
|
162
|
+
}
|
158
163
|
}, /*#__PURE__*/React.createElement(Menu, null, renderSelect(), /*#__PURE__*/React.createElement("div", {
|
159
164
|
className: cls({
|
160
165
|
'btn-box': true
|
package/es/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`形式的快速取值 和 数组取值 */
|
@@ -3,11 +3,18 @@ import { IFormProps, IFormSchema } from '../form';
|
|
3
3
|
import { RequestAction } from './request';
|
4
4
|
import { DialogAction } from './dialog';
|
5
5
|
export interface DialogFormAction extends DialogAction {
|
6
|
+
/** 表单初始值 */
|
6
7
|
initialValues?: any;
|
8
|
+
/** 表单初始化数据请求 */
|
7
9
|
initialRequest?: RequestAction;
|
10
|
+
/** 表单提交发送数据请求时,是否携带全部表单数据。默认携带 */
|
8
11
|
useFieldValuesForRequest?: boolean;
|
12
|
+
/**
|
13
|
+
* @deprecated 建议使用 schema 配置 IFormProps 代替
|
14
|
+
*/
|
9
15
|
formProps?: Omit<IFormProps, 'schema'>;
|
10
|
-
|
16
|
+
/** 同时支持两种配置方式,如果想完整定制表单,可使用完整的表单配置项 IFormProps,否则可以只配置 IFormSchema */
|
17
|
+
schema: IFormSchema | IFormProps;
|
11
18
|
}
|
12
19
|
export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
|
13
20
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
@@ -22,7 +22,8 @@ var _request = require("./request");
|
|
22
22
|
|
23
23
|
var _dialog = _interopRequireDefault(require("./dialog"));
|
24
24
|
|
25
|
-
var _excluded = ["schema",
|
25
|
+
var _excluded = ["schema"],
|
26
|
+
_excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "onCancel"];
|
26
27
|
|
27
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
28
29
|
|
@@ -30,16 +31,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
30
31
|
|
31
32
|
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; }
|
32
33
|
|
33
|
-
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; }
|
34
|
-
|
35
|
-
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; }
|
36
|
-
|
37
|
-
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; }
|
38
|
-
|
39
|
-
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; }
|
40
|
-
|
41
|
-
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; }
|
42
|
-
|
43
34
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
44
35
|
|
45
36
|
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."); }
|
@@ -52,6 +43,16 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
52
43
|
|
53
44
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
54
45
|
|
46
|
+
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; }
|
47
|
+
|
48
|
+
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; }
|
49
|
+
|
50
|
+
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; }
|
51
|
+
|
52
|
+
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; }
|
53
|
+
|
54
|
+
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; }
|
55
|
+
|
55
56
|
function getDefaultFormPropsByDialogSize(size) {
|
56
57
|
if (size === 'small') {
|
57
58
|
return {
|
@@ -84,15 +85,31 @@ function getDefaultFormPropsByDialogSize(size) {
|
|
84
85
|
};
|
85
86
|
}
|
86
87
|
|
88
|
+
function getSchemaAndFormProps(schema, formProps) {
|
89
|
+
if (schema instanceof Array) {
|
90
|
+
return _objectSpread({
|
91
|
+
schema: schema
|
92
|
+
}, formProps);
|
93
|
+
}
|
94
|
+
|
95
|
+
var formSchema = schema;
|
96
|
+
return formSchema;
|
97
|
+
}
|
98
|
+
|
87
99
|
var DialogForm = function DialogForm(props) {
|
88
100
|
var initialValues = props.initialValues,
|
89
101
|
initialRequest = props.initialRequest,
|
90
|
-
schema = props.schema,
|
91
102
|
_props$size = props.size,
|
92
103
|
size = _props$size === void 0 ? 'small' : _props$size,
|
104
|
+
schema = props.schema,
|
93
105
|
formProps = props.formProps,
|
94
106
|
context = props.context,
|
95
107
|
formRef = props.formRef;
|
108
|
+
|
109
|
+
var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
|
110
|
+
formSchema = _getSchemaAndFormProp.schema,
|
111
|
+
others = _objectWithoutProperties(_getSchemaAndFormProp, _excluded);
|
112
|
+
|
96
113
|
var form = (0, _form.createForm)({
|
97
114
|
initialValues: (0, _utils.getTargetValue)(initialValues, context)
|
98
115
|
});
|
@@ -123,8 +140,8 @@ var DialogForm = function DialogForm(props) {
|
|
123
140
|
}
|
124
141
|
}, /*#__PURE__*/_react.default.createElement(_form.default, _objectSpread(_objectSpread({
|
125
142
|
form: form,
|
126
|
-
schema: (0, _utils.getTargetValue)(
|
127
|
-
}, getDefaultFormPropsByDialogSize(size)), (0, _utils.getTargetValue)(
|
143
|
+
schema: (0, _utils.getTargetValue)(formSchema, context)
|
144
|
+
}, getDefaultFormPropsByDialogSize(size)), (0, _utils.getTargetValue)(others, context))));
|
128
145
|
};
|
129
146
|
|
130
147
|
function useDialogFormAction(action, context) {
|
@@ -139,7 +156,7 @@ function useDialogFormAction(action, context) {
|
|
139
156
|
size = _action$size === void 0 ? 'small' : _action$size,
|
140
157
|
_onFinish = action.onFinish,
|
141
158
|
_onCancel = action.onCancel,
|
142
|
-
others = _objectWithoutProperties(action,
|
159
|
+
others = _objectWithoutProperties(action, _excluded2);
|
143
160
|
|
144
161
|
var formRef = (0, _react.useRef)();
|
145
162
|
return (0, _dialog.default)(Object.assign({
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { DialogAction } from './dialog';
|
2
|
+
import { ProInfoProps } from '..';
|
3
|
+
export interface DialogInfoAction extends DialogAction {
|
4
|
+
schema: ProInfoProps;
|
5
|
+
}
|
6
|
+
export declare function useDialogInfoAction(action: DialogInfoAction, context?: any): {
|
7
|
+
[x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
|
8
|
+
};
|
9
|
+
export default useDialogInfoAction;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
exports.useDialogInfoAction = useDialogInfoAction;
|
8
|
+
|
9
|
+
var _dialog = _interopRequireDefault(require("./dialog"));
|
10
|
+
|
11
|
+
var _ = require("..");
|
12
|
+
|
13
|
+
var _excluded = ["schema"];
|
14
|
+
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
19
|
+
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; }
|
20
|
+
|
21
|
+
function useDialogInfoAction(action, context) {
|
22
|
+
var schema = action.schema,
|
23
|
+
others = _objectWithoutProperties(action, _excluded);
|
24
|
+
|
25
|
+
return (0, _dialog.default)(Object.assign({
|
26
|
+
component: _.ProInfo,
|
27
|
+
closeable: true,
|
28
|
+
size: 'mini',
|
29
|
+
schema: Object.assign({
|
30
|
+
backgroundColor: 'grey',
|
31
|
+
compacted: false
|
32
|
+
}, schema)
|
33
|
+
}, others), context);
|
34
|
+
}
|
35
|
+
|
36
|
+
var _default = useDialogInfoAction;
|
37
|
+
exports.default = _default;
|