@teamix/pro 1.4.10 → 1.4.13

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 +319 -112
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/index.scss +1 -1
  6. package/es/form/ProForm/index.scss +5 -0
  7. package/es/form/SchemaForm/index.js +12 -4
  8. package/es/form/SchemaForm/initializeDataSource.d.ts +3 -0
  9. package/es/form/SchemaForm/initializeDataSource.js +7 -0
  10. package/es/form/SchemaForm/initializeFormButton.js +4 -5
  11. package/es/index.d.ts +1 -1
  12. package/es/index.js +1 -1
  13. package/es/info/components/ProInfoItem/index.js +33 -4
  14. package/es/info/components/ProInfoItem/index.scss +18 -11
  15. package/es/info/components/baseInfo/index.js +4 -1
  16. package/es/info/components/baseInfo/index.scss +4 -1
  17. package/es/info/components/headerInfo/index.js +4 -1
  18. package/es/info/components/headerInfo/index.scss +3 -0
  19. package/es/info/components/tableInfo/index.js +2 -1
  20. package/es/info/index.js +6 -3
  21. package/es/info/typing.d.ts +3 -1
  22. package/es/table/components/Layout/index.js +5 -3
  23. package/es/table/index.js +95 -50
  24. package/es/table/index.scss +5 -0
  25. package/es/table/typing.d.ts +3 -1
  26. package/es/table/utils/columnRender.js +2 -1
  27. package/lib/actions/index.scss +1 -1
  28. package/lib/form/ProForm/index.scss +5 -0
  29. package/lib/form/SchemaForm/index.js +11 -3
  30. package/lib/form/SchemaForm/initializeDataSource.d.ts +3 -0
  31. package/lib/form/SchemaForm/initializeDataSource.js +10 -2
  32. package/lib/form/SchemaForm/initializeFormButton.js +3 -4
  33. package/lib/index.d.ts +1 -1
  34. package/lib/index.js +1 -1
  35. package/lib/info/components/ProInfoItem/index.js +33 -4
  36. package/lib/info/components/ProInfoItem/index.scss +18 -11
  37. package/lib/info/components/baseInfo/index.js +4 -1
  38. package/lib/info/components/baseInfo/index.scss +4 -1
  39. package/lib/info/components/headerInfo/index.js +4 -1
  40. package/lib/info/components/headerInfo/index.scss +3 -0
  41. package/lib/info/components/tableInfo/index.js +3 -1
  42. package/lib/info/index.js +5 -2
  43. package/lib/info/typing.d.ts +3 -1
  44. package/lib/table/components/Layout/index.js +5 -3
  45. package/lib/table/index.js +95 -49
  46. package/lib/table/index.scss +5 -0
  47. package/lib/table/typing.d.ts +3 -1
  48. package/lib/table/utils/columnRender.js +2 -1
  49. package/package.json +1 -1
@@ -114,7 +114,7 @@
114
114
  margin-top: 10px;
115
115
  padding-bottom: 10px;
116
116
  .next-col.next-col-24:last-child {
117
- .teamix-pro-field-info-form-item:last-child {
117
+ .teamix-pro-info-item:last-child {
118
118
  padding-bottom: 0px;
119
119
  }
120
120
  }
@@ -236,6 +236,11 @@
236
236
  }
237
237
 
238
238
  // 按钮样式
239
+ .teamix-button-group-item.#{$form-item-cls}-layout-vertical {
240
+ > .#{$css-prefix}formily-item-label {
241
+ display: none;
242
+ }
243
+ }
239
244
  .#{$css-prefix}formily-button-group {
240
245
  margin-top: var(--form-element-medium-height, 32px);
241
246
  }
@@ -1,4 +1,4 @@
1
- var _excluded = ["component", "type", "name", "decorator", "decoratorProps", "dataSource", "reactions", "rules", "children", "items", "tooltip", "request", "data"];
1
+ var _excluded = ["type", "name", "component", "props", "decorator", "decoratorProps", "dataSource", "reactions", "rules", "children", "items", "tooltip", "request", "data"];
2
2
 
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
 
@@ -32,7 +32,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
32
32
 
33
33
  import React, { memo, useCallback, useRef, useMemo } from 'react';
34
34
  import { createSchemaField } from '@formily/react';
35
- import { isUsable } from '@teamix/utils';
35
+ import { cls, isUsable } from '@teamix/utils';
36
36
  import adapterType from './adapterType';
37
37
  import adapterComponent from './adapterComponent';
38
38
  import adapterDecorator from './adapterDecorator';
@@ -134,9 +134,10 @@ export default /*#__PURE__*/memo(function (_ref) {
134
134
  }
135
135
 
136
136
  var _newItem2 = newItem,
137
- component = _newItem2.component,
138
137
  type = _newItem2.type,
139
138
  name = _newItem2.name,
139
+ component = _newItem2.component,
140
+ props = _newItem2.props,
140
141
  decorator = _newItem2.decorator,
141
142
  decoratorProps = _newItem2.decoratorProps,
142
143
  dataSource = _newItem2.dataSource,
@@ -172,7 +173,8 @@ export default /*#__PURE__*/memo(function (_ref) {
172
173
  defaultDataSource = _initializeDataSource.dataSource,
173
174
  dataSourceReactions = _initializeDataSource.reactions,
174
175
  dataSourceScope = _initializeDataSource.scope,
175
- dataSourceData = _initializeDataSource.data; // 初始化rules validator
176
+ dataSourceData = _initializeDataSource.data,
177
+ dataSourceProps = _initializeDataSource.props; // 初始化rules validator
176
178
 
177
179
 
178
180
  var _initializeRules = initializeRules(rules, "".concat(suffix, "v")),
@@ -188,10 +190,16 @@ export default /*#__PURE__*/memo(function (_ref) {
188
190
  v = _ref3[1];
189
191
 
190
192
  schemaScopeRef.current[k] = v;
193
+ }); // 合并字段属性
194
+
195
+ var defaultProps = _objectSpread(_objectSpread(_objectSpread({}, props), dataSourceProps), {}, {
196
+ className: cls(props === null || props === void 0 ? void 0 : props.className, dataSourceProps === null || dataSourceProps === void 0 ? void 0 : dataSourceProps.className)
191
197
  });
198
+
192
199
  var formatParam = mapSchemaName(_objectSpread(_objectSpread({}, otherProps), {}, {
193
200
  type: defaultType,
194
201
  component: component,
202
+ props: defaultProps,
195
203
  decorator: defaultDecorator,
196
204
  decoratorProps: defaultDecoratorProps,
197
205
  rules: defaultRules,
@@ -6,6 +6,9 @@ interface IInitializeDataSource {
6
6
  [x: string]: any;
7
7
  };
8
8
  data?: any;
9
+ props?: {
10
+ [x: string]: any;
11
+ };
9
12
  };
10
13
  }
11
14
  declare const initializeDataSource: IInitializeDataSource;
@@ -1,3 +1,4 @@
1
+ import { getTestRequestParams, getTestRequestData } from '@teamix/utils';
1
2
  import { initializeRequestExpression } from '../utils';
2
3
 
3
4
  var initializeDataSource = function initializeDataSource(dataSource, suffix) {
@@ -12,6 +13,12 @@ var initializeDataSource = function initializeDataSource(dataSource, suffix) {
12
13
  scope: scope,
13
14
  data: {
14
15
  readOnlyOnLoading: (dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$extraConf = dataSource.extraConfig) === null || _dataSource$extraConf === void 0 ? void 0 : _dataSource$extraConf.readOnly) !== false
16
+ },
17
+ props: {
18
+ className: 'teamix-test-request',
19
+ 'data-teamix-test-request': "url=".concat(dataSource === null || dataSource === void 0 ? void 0 : dataSource.url, "&formatResult=").concat(!!(dataSource === null || dataSource === void 0 ? void 0 : dataSource.formatResult)),
20
+ 'data-teamix-test-params': getTestRequestParams(dataSource === null || dataSource === void 0 ? void 0 : dataSource.params),
21
+ 'data-teamix-test-data': getTestRequestData('dataSource')
15
22
  }
16
23
  } : {
17
24
  reactions: [],
@@ -10,7 +10,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
10
10
 
11
11
  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; }
12
12
 
13
- import { getMessage } from '@teamix/utils';
13
+ import { getMessage, cls } from '@teamix/utils';
14
14
 
15
15
  var initializeButton = function initializeButton(item) {
16
16
  var component = item.component,
@@ -45,15 +45,14 @@ var initialize = function initialize(item) {
45
45
  return initializeButton(item);
46
46
  }
47
47
 
48
- var commonMode = _objectSpread(_objectSpread({
49
- title: ' '
50
- }, item), {}, {
48
+ var commonMode = _objectSpread(_objectSpread({}, item), {}, {
51
49
  component: component,
52
50
  props: otherProps,
53
51
  decorator: 'FormButtonGroup.FormItem',
54
52
  decoratorProps: _objectSpread({
55
53
  inset: false,
56
- fullness: true
54
+ fullness: true,
55
+ className: cls('teamix-button-group-item', decoratorProps === null || decoratorProps === void 0 ? void 0 : decoratorProps.className)
57
56
  }, decoratorProps)
58
57
  }); // 吸底模式
59
58
 
package/es/index.d.ts CHANGED
@@ -28,5 +28,5 @@ export * from './table';
28
28
  export * from './sidebar';
29
29
  export * from './utils';
30
30
  export * from './timeline';
31
- declare const version = "1.4.10";
31
+ declare const version = "1.4.13";
32
32
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -36,6 +36,6 @@ export * from './table';
36
36
  export * from './sidebar';
37
37
  export * from './utils';
38
38
  export * from './timeline';
39
- var version = '1.4.10';
39
+ var version = '1.4.13';
40
40
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
41
41
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils };
@@ -4,7 +4,7 @@ import { usePrefixCls } from '@teamix/utils';
4
4
  import React from 'react';
5
5
  import { Ellipsis, LabelIconTip } from '../../../field';
6
6
  import './index.scss';
7
- var cls = usePrefixCls('teamix-pro-field-info-form-item');
7
+ var cls = usePrefixCls('teamix-pro-info-item');
8
8
  var Row = Grid.Row,
9
9
  Col = Grid.Col;
10
10
 
@@ -15,7 +15,26 @@ var ProInfoItem = function ProInfoItem(prop) {
15
15
  headerInfoLayout = prop.headerInfoLayout,
16
16
  loading = prop.loading,
17
17
  tooltip = prop.tooltip,
18
- tooltipIcon = prop.tooltipIcon;
18
+ tooltipIcon = prop.tooltipIcon,
19
+ valueType = prop.valueType,
20
+ render = prop.render,
21
+ alignItems = prop.alignItems; // 判断是否需要居中
22
+
23
+ var isAlignItemsCenter = function isAlignItemsCenter() {
24
+ if (typeof render !== 'function') {
25
+ var type = render === null || render === void 0 ? void 0 : render.type;
26
+
27
+ if (valueType === 'selectGroup') {
28
+ return true;
29
+ }
30
+
31
+ if (type === 'tag' || type === 'statusIconTag' || type === 'eventLevelTag' || type === 'warningLevelTag') {
32
+ return true;
33
+ }
34
+ }
35
+
36
+ return false;
37
+ };
19
38
 
20
39
  if (baseInfoLayout) {
21
40
  var labelCol = baseInfoLayout.labelCol,
@@ -24,7 +43,13 @@ var ProInfoItem = function ProInfoItem(prop) {
24
43
  className: cls('')
25
44
  }, /*#__PURE__*/React.createElement(Row, {
26
45
  gutter: 10,
27
- className: cls('base-row')
46
+ className: cls({
47
+ 'base-row': true,
48
+ 'base-row-center': isAlignItemsCenter()
49
+ }),
50
+ style: alignItems ? {
51
+ alignItems: alignItems
52
+ } : {}
28
53
  }, /*#__PURE__*/React.createElement(Col, {
29
54
  span: labelCol === null || labelCol === void 0 ? void 0 : labelCol.span,
30
55
  className: cls('label')
@@ -48,7 +73,11 @@ var ProInfoItem = function ProInfoItem(prop) {
48
73
  return /*#__PURE__*/React.createElement("div", {
49
74
  className: cls()
50
75
  }, /*#__PURE__*/React.createElement(Row, {
51
- className: cls('header-row')
76
+ className: cls({
77
+ 'header-row': true,
78
+ 'header-row-center': isAlignItemsCenter()
79
+ }),
80
+ style: {}
52
81
  }, /*#__PURE__*/React.createElement("div", {
53
82
  className: cls('header-label')
54
83
  }, /*#__PURE__*/React.createElement(LabelIconTip, {
@@ -14,43 +14,50 @@ $header-text-size: var(--font-size-body-1, 12px);
14
14
 
15
15
  $item-padding-bottom: 8px;
16
16
 
17
- .teamix-pro-field-info-form-item {
17
+ .teamix-pro-info-item {
18
18
  width: 100%;
19
19
  padding-bottom: $item-padding-bottom;
20
20
  &-header-row {
21
21
  display: flex;
22
- align-items: center;
22
+ align-items: flex-start;
23
+
24
+ &-center {
25
+ align-items: center;
26
+ }
23
27
  }
24
28
  &-base-row {
25
29
  display: flex;
26
- align-items: center;
30
+ align-items: flex-start;
31
+ &-center {
32
+ align-items: center;
33
+ }
27
34
  }
28
35
  }
29
36
 
30
- .teamix-pro-field-info-form-item-label {
37
+ .teamix-pro-info-item-label {
31
38
  color: $label-color;
32
39
  font-size: $label-size;
33
40
  // font-weight: $label-weight;
34
41
  display: unset;
35
42
  }
36
43
 
37
- .teamix-pro-field-info-form-item-value {
44
+ .teamix-pro-info-item-value {
38
45
  color: $text-color;
39
46
  font-size: $text-size;
40
- display: unset;
47
+ //display: unset;
41
48
  width: 100%;
42
49
  padding-right: 20px;
43
50
  }
44
51
 
45
- .teamix-pro-field-info-form-item-header-label {
52
+ .teamix-pro-info-item-header-label {
46
53
  color: $header-label-color;
47
54
  font-size: $header-label-size;
48
55
  // font-weight: $header-label-weight;
49
56
  display: inline-block;
50
- white-space:nowrap;
57
+ white-space: nowrap;
51
58
  }
52
59
 
53
- .teamix-pro-field-info-form-item-header-value {
60
+ .teamix-pro-info-item-header-value {
54
61
  color: $header-text-color;
55
62
  font-size: $header-text-size;
56
63
  display: inline-block;
@@ -58,9 +65,9 @@ $item-padding-bottom: 8px;
58
65
  padding-right: 20px;
59
66
  }
60
67
 
61
- .teamix-pro-field-info-form-item-base-skeleton-box {
68
+ .teamix-pro-info-item-base-skeleton-box {
62
69
  width: 100%;
63
- height: 100%;
70
+ height: 18px;
64
71
  display: flex;
65
72
  align-items: center;
66
73
  span {
@@ -78,7 +78,10 @@ var ProBaseInfo = function ProBaseInfo(props) {
78
78
  }),
79
79
  baseInfoLayout: getFormItemLayout((_item$colSpan = item === null || item === void 0 ? void 0 : item.colSpan) !== null && _item$colSpan !== void 0 ? _item$colSpan : 0),
80
80
  tooltip: item.tooltip,
81
- tooltipIcon: item.tooltipIcon
81
+ tooltipIcon: item.tooltipIcon,
82
+ render: item.render,
83
+ valueType: item.valueType,
84
+ alignItems: item.alignItems
82
85
  }));
83
86
  });
84
87
  };
@@ -1,3 +1,6 @@
1
1
  .teamix-pro-info {
2
2
  width: 100%;
3
- }
3
+ }
4
+ .teamix-pro-info-content-row {
5
+ align-items: flex-start;
6
+ }
@@ -55,7 +55,10 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
55
55
  }),
56
56
  headerInfoLayout: layout !== null && layout !== void 0 ? layout : defaultLayout,
57
57
  tooltip: item.tooltip,
58
- tooltipIcon: item.tooltipIcon
58
+ tooltipIcon: item.tooltipIcon,
59
+ render: item.render,
60
+ valueType: item.valueType,
61
+ alignItems: item.alignItems
59
62
  }));
60
63
  });
61
64
  };
@@ -0,0 +1,3 @@
1
+ .teamix-pro-info-content-row {
2
+ align-items: flex-start;
3
+ }
@@ -24,6 +24,7 @@ import { LabelIconTip } from '../../../field';
24
24
  import InfoValueItem from '../InfoValueItem';
25
25
  import { ProSkeletonRaw } from '../../..';
26
26
  import { getDataIndexValue } from '../../utils';
27
+ import cloneDeep from 'lodash.clonedeep';
27
28
 
28
29
  var ProTableInfo = function ProTableInfo(props) {
29
30
  var columns = props.columns,
@@ -72,7 +73,7 @@ var ProTableInfo = function ProTableInfo(props) {
72
73
 
73
74
  var newDataSource = useMemo(function () {
74
75
  var nResult = [];
75
- var columnsCopy = JSON.parse(JSON.stringify(columns)); // 取当前行的数据。直到取完
76
+ var columnsCopy = cloneDeep(columns); // 取当前行的数据。直到取完
76
77
 
77
78
  while (columnsCopy.length > 0) {
78
79
  var filterColumns = [];
package/es/info/index.js CHANGED
@@ -30,7 +30,7 @@ import ProBaseInfo from './components/baseInfo';
30
30
  import ProInfoGroup from './components/InfoGroup';
31
31
  import './index.scss';
32
32
  import { ProInfoGroupContext, useActionType } from './utils';
33
- import { doCommonRequest } from '@teamix/utils';
33
+ import { doCommonRequest, cls, getTestRequestData, getTestRequestParams } from '@teamix/utils';
34
34
  import { useSize } from '@teamix/hooks';
35
35
  import { ProCard } from '..';
36
36
  export * from './typing';
@@ -162,8 +162,11 @@ var ProInfo = function ProInfo(props) {
162
162
 
163
163
  return /*#__PURE__*/React.createElement("div", {
164
164
  ref: ref,
165
- className: "teamix-pro-info ".concat(className !== null && className !== void 0 ? className : ''),
166
- style: style
165
+ style: style,
166
+ className: cls('teamix-pro-info', className, 'teamix-test-request'),
167
+ "data-teamix-test-request": "url=".concat(url, "&formatResult=").concat(!!formatResult),
168
+ "data-teamix-test-params": getTestRequestParams(params),
169
+ "data-teamix-test-data": getTestRequestData(columns)
167
170
  }, /*#__PURE__*/React.createElement(ProCard, _objectSpread(_objectSpread(_objectSpread({
168
171
  compacted: true,
169
172
  hoveredShadow: false,
@@ -96,6 +96,8 @@ export interface ProInfoColumnsProps {
96
96
  extra?: React.ReactNode;
97
97
  /** 其他 ProField 配置 */
98
98
  props?: any;
99
+ /** 对齐方式 **/
100
+ alignItems?: 'center' | 'flex-start' | 'flex-end' | string;
99
101
  }
100
102
  export declare type ProInfoActionType = {
101
103
  /** 刷新Info */
@@ -113,7 +115,7 @@ export declare type IProProInfoItem = {
113
115
  headerInfoLayout?: ProHeaderInfoLayoutProps;
114
116
  /** loading 状态 */
115
117
  loading?: boolean;
116
- } & Pick<ProInfoColumnsProps, 'tooltip' | 'tooltipIcon'>;
118
+ } & Pick<ProInfoColumnsProps, 'tooltip' | 'tooltipIcon' | 'render' | 'valueType' | 'alignItems'>;
117
119
  /** header info 定义 */
118
120
  export declare type IProHeaderInfo = {
119
121
  /** 布局值 */
@@ -1,4 +1,4 @@
1
- var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection"];
1
+ var _excluded = ["header", "mainAction", "extra", "actionRef", "dataFilter", "dataFilterFormRef", "afterDataFilter", "rowSelection", "toolBar"];
2
2
 
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
 
@@ -31,6 +31,7 @@ var Layout = function Layout(props) {
31
31
  dataFilterFormRef = props.dataFilterFormRef,
32
32
  afterDataFilter = props.afterDataFilter,
33
33
  rowSelection = props.rowSelection,
34
+ toolBar = props.toolBar,
34
35
  otherProps = _objectWithoutProperties(props, _excluded); // 渲染主操作区
35
36
 
36
37
 
@@ -69,7 +70,8 @@ var Layout = function Layout(props) {
69
70
  quickAction: extra,
70
71
  rowSelection: rowSelection
71
72
  }), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
72
- actionRef: actionRef
73
+ actionRef: actionRef,
74
+ toolBar: toolBar
73
75
  }, otherProps)));
74
76
  }; // 渲染新版 QueryFilter
75
77
 
@@ -170,7 +172,7 @@ var Layout = function Layout(props) {
170
172
  }
171
173
  };
172
174
 
173
- if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) || mainAction || header || extra) {
175
+ if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) || mainAction || header || extra || toolBar !== false) {
174
176
  return /*#__PURE__*/React.createElement("div", {
175
177
  className: cls()
176
178
  }, renderLayout());