@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.
Files changed (55) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +464 -352
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog-form.d.ts +8 -1
  6. package/es/actions/dialog-form.js +32 -15
  7. package/es/actions/dialog-info.d.ts +9 -0
  8. package/es/actions/dialog-info.js +23 -0
  9. package/es/actions/dialog.d.ts +2 -0
  10. package/es/actions/dialog.js +11 -4
  11. package/es/actions/drawer-info.d.ts +6 -0
  12. package/es/actions/drawer-info.js +7 -0
  13. package/es/actions/index.d.ts +11 -5
  14. package/es/actions/index.js +28 -12
  15. package/es/actions/index.scss +8 -0
  16. package/es/actions/link.js +2 -12
  17. package/es/form/SchemaForm/reactions.js +4 -2
  18. package/es/index.d.ts +1 -1
  19. package/es/index.js +1 -1
  20. package/es/info/components/InfoValueItem/index.js +108 -26
  21. package/es/info/components/baseInfo/index.d.ts +3 -1
  22. package/es/info/components/baseInfo/index.js +6 -33
  23. package/es/info/components/headerInfo/index.d.ts +3 -1
  24. package/es/info/components/headerInfo/index.js +8 -39
  25. package/es/info/components/tableInfo/index.js +4 -21
  26. package/es/info/index.js +50 -28
  27. package/es/info/index.scss +0 -4
  28. package/es/info/typing.d.ts +14 -5
  29. package/es/page-header/index.js +1 -1
  30. package/lib/actions/dialog-form.d.ts +8 -1
  31. package/lib/actions/dialog-form.js +32 -15
  32. package/lib/actions/dialog-info.d.ts +9 -0
  33. package/lib/actions/dialog-info.js +37 -0
  34. package/lib/actions/dialog.d.ts +2 -0
  35. package/lib/actions/dialog.js +11 -4
  36. package/lib/actions/drawer-info.d.ts +6 -0
  37. package/lib/actions/drawer-info.js +18 -0
  38. package/lib/actions/index.d.ts +11 -5
  39. package/lib/actions/index.js +30 -12
  40. package/lib/actions/index.scss +8 -0
  41. package/lib/actions/link.js +2 -12
  42. package/lib/form/SchemaForm/reactions.js +4 -2
  43. package/lib/index.d.ts +1 -1
  44. package/lib/index.js +1 -1
  45. package/lib/info/components/InfoValueItem/index.js +107 -25
  46. package/lib/info/components/baseInfo/index.d.ts +3 -1
  47. package/lib/info/components/baseInfo/index.js +5 -40
  48. package/lib/info/components/headerInfo/index.d.ts +3 -1
  49. package/lib/info/components/headerInfo/index.js +7 -46
  50. package/lib/info/components/tableInfo/index.js +4 -22
  51. package/lib/info/index.js +52 -28
  52. package/lib/info/index.scss +0 -4
  53. package/lib/info/typing.d.ts +14 -5
  54. package/lib/page-header/index.js +1 -1
  55. 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 header = props.header,
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("div", _objectSpread({
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 _tableInfo = _interopRequireDefault(require("./components/tableInfo"));
13
+ var _TableInfo = _interopRequireDefault(require("./components/TableInfo"));
14
14
 
15
- var _headerInfo = _interopRequireDefault(require("./components/headerInfo"));
15
+ var _HeaderInfo = _interopRequireDefault(require("./components/HeaderInfo"));
16
16
 
17
- var _baseInfo = _interopRequireDefault(require("./components/baseInfo"));
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
- if (type === 'table') {
154
- return /*#__PURE__*/_react.default.createElement(_tableInfo.default, _objectSpread(_objectSpread({}, others), {}, {
155
- header: header,
156
- loading: loading || getData.loading,
157
- result: getDataSource(getData.data),
158
- actionRef: actionRef
159
- }));
160
- }
161
-
162
- if (type === 'header') {
163
- return /*#__PURE__*/_react.default.createElement(_headerInfo.default, _objectSpread(_objectSpread({}, others), {}, {
164
- header: header,
165
- loading: loading || getData.loading,
166
- result: getDataSource(getData.data),
167
- actionRef: actionRef
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;
@@ -1,10 +1,6 @@
1
1
  .teamix-pro-info {
2
2
  color: var(--color-brand1-6);
3
3
 
4
- .next-card {
5
- background: none;
6
- }
7
-
8
4
  .teamix-pro-info-content-row {
9
5
  width: 100%;
10
6
  }
@@ -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?: IProFieldFormatterProps | ((...other: any) => React.ReactNode);
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
- } & IProFieldProps;
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 {};
@@ -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-bg-".concat(color))), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamix/pro",
3
- "version": "1.1.34",
3
+ "version": "1.1.35",
4
4
  "description": "TeamixPro大包",
5
5
  "repository": "http://gitlab.alibaba-inc.com/teamix/pro",
6
6
  "author": "Velociraptor(迅猛龙)",