@teamix/pro 1.1.37 → 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.
Files changed (49) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +687 -96
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog.d.ts +9 -0
  6. package/es/actions/dialog.js +96 -26
  7. package/es/actions/index.scss +31 -0
  8. package/es/actions/request.d.ts +1 -1
  9. package/es/actions/request.js +2 -2
  10. package/es/form/Components/ProField/index.d.ts +1 -84
  11. package/es/form/typing.d.ts +5 -5
  12. package/es/index.d.ts +1 -1
  13. package/es/index.js +1 -1
  14. package/es/info/components/{headerInfo → HeaderInfo}/index.d.ts +0 -0
  15. package/es/info/components/{headerInfo → HeaderInfo}/index.js +0 -0
  16. package/es/info/components/{headerInfo → HeaderInfo}/index.scss +0 -0
  17. package/es/info/components/InfoValueItem/index.js +3 -0
  18. package/es/info/components/{tableInfo → TableInfo}/index.d.ts +0 -0
  19. package/es/info/components/{tableInfo → TableInfo}/index.js +0 -0
  20. package/es/info/components/{tableInfo → TableInfo}/index.scss +0 -0
  21. package/es/info/components/baseInfo/index.js +29 -10
  22. package/es/info/index.js +28 -7
  23. package/es/info/typing.d.ts +3 -1
  24. package/es/table/components/Filter/index.js +7 -2
  25. package/es/table/components/Filter/index.scss +1 -1
  26. package/es/table/typing.d.ts +2 -0
  27. package/lib/actions/dialog.d.ts +9 -0
  28. package/lib/actions/dialog.js +99 -25
  29. package/lib/actions/index.scss +31 -0
  30. package/lib/actions/request.d.ts +1 -1
  31. package/lib/actions/request.js +2 -2
  32. package/lib/form/Components/ProField/index.d.ts +1 -84
  33. package/lib/form/typing.d.ts +5 -5
  34. package/lib/index.d.ts +1 -1
  35. package/lib/index.js +1 -1
  36. package/lib/info/components/{headerInfo → HeaderInfo}/index.d.ts +0 -0
  37. package/lib/info/components/{headerInfo → HeaderInfo}/index.js +0 -0
  38. package/lib/info/components/{headerInfo → HeaderInfo}/index.scss +0 -0
  39. package/lib/info/components/InfoValueItem/index.js +3 -0
  40. package/lib/info/components/{tableInfo → TableInfo}/index.d.ts +0 -0
  41. package/lib/info/components/{tableInfo → TableInfo}/index.js +0 -0
  42. package/lib/info/components/{tableInfo → TableInfo}/index.scss +0 -0
  43. package/lib/info/components/baseInfo/index.js +29 -10
  44. package/lib/info/index.js +27 -6
  45. package/lib/info/typing.d.ts +3 -1
  46. package/lib/table/components/Filter/index.js +7 -2
  47. package/lib/table/components/Filter/index.scss +1 -1
  48. package/lib/table/typing.d.ts +2 -0
  49. package/package.json +1 -1
@@ -155,6 +155,9 @@ var InfoValueItem = function InfoValueItem(props) {
155
155
  type: "text",
156
156
  style: {
157
157
  marginLeft: '8px'
158
+ },
159
+ context: {
160
+ record: record
158
161
  }
159
162
  });
160
163
  }
@@ -37,29 +37,48 @@ var ProBaseInfo = function ProBaseInfo(props) {
37
37
  layout = props.layout,
38
38
  size = props.size;
39
39
 
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)]; // 获取列的布局参数
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)]; // 获取列内的布局参数
41
41
 
42
42
 
43
- var getFormItemLayout = function getFormItemLayout() {
43
+ var getFormItemLayout = function getFormItemLayout(colspan) {
44
+ var formItemLayout = JSON.parse(JSON.stringify(defaultLayout.formItemLayout)); // 自定义布局
45
+
44
46
  if (layout) {
45
47
  var _layout$labelCol, _layout$wrapperCol;
46
48
 
47
- return {
48
- labelCol: (_layout$labelCol = layout === null || layout === void 0 ? void 0 : layout.labelCol) !== null && _layout$labelCol !== void 0 ? _layout$labelCol : defaultLayout.formItemLayout.labelCol,
49
- wrapperCol: (_layout$wrapperCol = layout === null || layout === void 0 ? void 0 : layout.wrapperCol) !== null && _layout$wrapperCol !== void 0 ? _layout$wrapperCol : defaultLayout.formItemLayout.wrapperCol
50
- };
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);
51
61
  }
52
62
 
53
- return defaultLayout.formItemLayout;
63
+ var newFormItemLayout = {
64
+ labelCol: {
65
+ span: newLabelSpan
66
+ },
67
+ wrapperCol: {
68
+ span: newWrapperSpan
69
+ }
70
+ };
71
+ return Object.assign(formItemLayout, newFormItemLayout);
54
72
  };
55
73
 
56
74
  var renderContent = function renderContent() {
57
75
  return columns.map(function (item, index) {
58
- var _layout$span, _item$title, _item$valueType, _ref;
76
+ var _layout$span, _layout$span2, _item$title, _item$valueType, _ref, _item$colSpan;
59
77
 
60
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;
61
80
  return /*#__PURE__*/_react.default.createElement(Col, {
62
- span: (_layout$span = layout === null || layout === void 0 ? void 0 : layout.span) !== null && _layout$span !== void 0 ? _layout$span : span,
81
+ span: layoutSpan,
63
82
  key: index
64
83
  }, /*#__PURE__*/_react.default.createElement(_ProInfoItem.default, {
65
84
  label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
@@ -73,7 +92,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
73
92
  record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
74
93
  actionRef: actionRef
75
94
  }),
76
- baseInfoLayout: getFormItemLayout(),
95
+ baseInfoLayout: getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0),
77
96
  tooltip: item.tooltip,
78
97
  tooltipIcon: item.tooltipIcon
79
98
  }));
package/lib/info/index.js CHANGED
@@ -41,7 +41,7 @@ Object.keys(_typing).forEach(function (key) {
41
41
  }
42
42
  });
43
43
  });
44
- var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError", "className", "style", "columns", "layout", "dataSource"];
44
+ var _excluded = ["type", "url", "method", "formatResult", "params", "actionRef", "header", "onError", "className", "style", "columns", "layout", "dataSource", "loading", "extra"];
45
45
 
46
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
47
 
@@ -88,6 +88,8 @@ var ProInfo = function ProInfo(props) {
88
88
  columns = props.columns,
89
89
  layout = props.layout,
90
90
  dataSource = props.dataSource,
91
+ userLoading = props.loading,
92
+ extra = props.extra,
91
93
  others = _objectWithoutProperties(props, _excluded);
92
94
 
93
95
  var _useContext = (0, _react.useContext)(_utils.ProInfoGroupContext),
@@ -164,19 +166,38 @@ var ProInfo = function ProInfo(props) {
164
166
  getData.run({});
165
167
  }
166
168
  });
169
+
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
+
167
186
  return /*#__PURE__*/_react.default.createElement("div", {
168
187
  ref: ref,
169
188
  className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : ''),
170
189
  style: style
171
- }, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread(_objectSpread({
190
+ }, /*#__PURE__*/_react.default.createElement(_.ProCard, _objectSpread(_objectSpread(_objectSpread({
172
191
  compacted: true,
173
192
  hoveredShadow: false,
174
193
  bordered: false,
175
194
  backgroundColor: "transparent"
176
- }, header), others), type === 'table' && /*#__PURE__*/_react.default.createElement(_tableInfo.default, {
195
+ }, header), others), {}, {
196
+ extra: getExtra()
197
+ }), type === 'table' && /*#__PURE__*/_react.default.createElement(_tableInfo.default, {
177
198
  dataSource: dataSource,
178
199
  columns: columns,
179
- loading: loading || getData.loading,
200
+ loading: userLoading || loading || getData.loading,
180
201
  result: getDataSource(getData.data),
181
202
  actionRef: actionRef,
182
203
  layout: layout
@@ -184,7 +205,7 @@ var ProInfo = function ProInfo(props) {
184
205
  dataSource: dataSource,
185
206
  columns: columns,
186
207
  header: header,
187
- loading: loading || getData.loading,
208
+ loading: userLoading || loading || getData.loading,
188
209
  result: getDataSource(getData.data),
189
210
  actionRef: actionRef,
190
211
  layout: layout,
@@ -192,7 +213,7 @@ var ProInfo = function ProInfo(props) {
192
213
  }), type === 'base' && /*#__PURE__*/_react.default.createElement(_baseInfo.default, {
193
214
  dataSource: dataSource,
194
215
  columns: columns,
195
- loading: loading || getData.loading,
216
+ loading: userLoading || loading || getData.loading,
196
217
  result: getDataSource(getData.data),
197
218
  actionRef: actionRef,
198
219
  layout: layout,
@@ -41,6 +41,8 @@ export declare type ProInfoBaseProps = {
41
41
  };
42
42
  /** 布局值 */
43
43
  layout?: BaseInfoLayoutProps;
44
+ /** 加载动画 */
45
+ loading?: boolean;
44
46
  } & ProInfoHeaderProps;
45
47
  /** ProInfoItemProps info 单元格 定义 */
46
48
  export interface ProInfoItemProps {
@@ -147,7 +149,7 @@ export declare type InfoValueItemProps = {
147
149
  render?: ProInfoCellRender;
148
150
  dataSource?: IProFieldOptionItem[] | ProInfoCellFunProp;
149
151
  } & Omit<IProFieldProps, 'render' | 'dataSource'>;
150
- export declare type ProInfoHeaderProps = CardProps;
152
+ export declare type ProInfoHeaderProps = Omit<CardProps, 'loading'>;
151
153
  /** ProInfoGroupContextProps */
152
154
  export declare type ProInfoGroupContextProps = {
153
155
  /** 因为其他数据都为异步。visible 只用作标识 */
@@ -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
@@ -1,5 +1,5 @@
1
1
  .teamix-pro-table-toolbar-filter {
2
- width: 130px;
2
+ min-width: 130px;
3
3
  max-height: 350px;
4
4
  overflow-y: auto;
5
5
  box-shadow: var(--popup-local-shadow, 0px 6px 24px 0px rgba(0, 0, 0, 0.1));
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamix/pro",
3
- "version": "1.1.37",
3
+ "version": "1.1.38",
4
4
  "description": "TeamixPro大包",
5
5
  "repository": "http://gitlab.alibaba-inc.com/teamix/pro",
6
6
  "author": "Velociraptor(迅猛龙)",