@teamix/pro 1.4.14 → 1.4.17

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 (67) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +440 -114
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/card/index.js +49 -6
  6. package/es/card/index.scss +8 -0
  7. package/es/form/ProForm/index.js +14 -32
  8. package/es/form/ProForm/index.scss +9 -2
  9. package/es/form/ProForm/useAutoLayout.d.ts +9 -0
  10. package/es/form/ProForm/useAutoLayout.js +114 -0
  11. package/es/form/SchemaForm/initializeArrayTable.js +42 -7
  12. package/es/form/typing.d.ts +4 -0
  13. package/es/index.d.ts +1 -1
  14. package/es/index.js +1 -1
  15. package/es/info/components/baseInfo/index.js +9 -3
  16. package/es/info/components/headerInfo/index.js +11 -3
  17. package/es/info/components/tableInfo/index.js +6 -3
  18. package/es/info/typing.d.ts +2 -0
  19. package/es/info/utils/index.d.ts +8 -0
  20. package/es/info/utils/index.js +28 -1
  21. package/es/nocode/index.scss +2 -2
  22. package/es/nocode/pages/playground.js +1 -1
  23. package/es/nocode/pages/renderer.js +1 -1
  24. package/es/nocode/playground.js +1 -1
  25. package/es/sidebar/components/tree-node/index.js +15 -6
  26. package/es/sidebar/components/tree-node/index.scss +9 -5
  27. package/es/sidebar/index.js +2 -2
  28. package/es/sidebar/index.scss +13 -1
  29. package/es/sidebar/typing.d.ts +4 -2
  30. package/es/sidebar/utils/index.d.ts +278 -0
  31. package/es/sidebar/utils/index.js +55 -14
  32. package/es/table/components/Layout/index.js +12 -6
  33. package/es/table/components/QuickAction/index.js +1 -1
  34. package/es/table/index.js +36 -11
  35. package/es/table/index.scss +8 -0
  36. package/lib/card/index.js +58 -6
  37. package/lib/card/index.scss +8 -0
  38. package/lib/form/ProForm/index.js +13 -31
  39. package/lib/form/ProForm/index.scss +9 -2
  40. package/lib/form/ProForm/useAutoLayout.d.ts +9 -0
  41. package/lib/form/ProForm/useAutoLayout.js +124 -0
  42. package/lib/form/SchemaForm/initializeArrayTable.js +42 -7
  43. package/lib/form/typing.d.ts +4 -0
  44. package/lib/index.d.ts +1 -1
  45. package/lib/index.js +1 -1
  46. package/lib/info/components/baseInfo/index.js +8 -2
  47. package/lib/info/components/headerInfo/index.js +10 -2
  48. package/lib/info/components/tableInfo/index.js +5 -2
  49. package/lib/info/typing.d.ts +2 -0
  50. package/lib/info/utils/index.d.ts +8 -0
  51. package/lib/info/utils/index.js +29 -0
  52. package/lib/nocode/index.scss +2 -2
  53. package/lib/nocode/pages/playground.js +1 -1
  54. package/lib/nocode/pages/renderer.js +1 -1
  55. package/lib/nocode/playground.js +1 -1
  56. package/lib/sidebar/components/tree-node/index.js +16 -6
  57. package/lib/sidebar/components/tree-node/index.scss +9 -5
  58. package/lib/sidebar/index.js +2 -2
  59. package/lib/sidebar/index.scss +13 -1
  60. package/lib/sidebar/typing.d.ts +4 -2
  61. package/lib/sidebar/utils/index.d.ts +278 -0
  62. package/lib/sidebar/utils/index.js +56 -14
  63. package/lib/table/components/Layout/index.js +12 -6
  64. package/lib/table/components/QuickAction/index.js +1 -1
  65. package/lib/table/index.js +35 -10
  66. package/lib/table/index.scss +8 -0
  67. package/package.json +1 -1
package/es/card/index.js CHANGED
@@ -38,7 +38,8 @@ import ProCardDivider from './divider';
38
38
  import ProCardSelectable from './selectable';
39
39
  import ProCardTab from './tab';
40
40
  import './index.scss';
41
- import ProField from '@teamix/pro-field';
41
+ import ProField, { Ellipsis } from '@teamix/pro-field';
42
+ import ReactDOM from 'react-dom';
42
43
  export * from './card-container';
43
44
  var cls = usePrefixCls('teamix-pro-card');
44
45
 
@@ -115,9 +116,19 @@ export var ProCard = function ProCard(props) {
115
116
  innerCollapseState = _React$useState2[0],
116
117
  setInnerCollapseState = _React$useState2[1];
117
118
 
119
+ var cardRef = React.useRef(); // 表头 tooltip tags description 宽度
120
+
121
+ var _React$useState3 = React.useState(0),
122
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
123
+ headerWithoutTitleWidth = _React$useState4[0],
124
+ setHeaderWithoutTitleWidth = _React$useState4[1];
125
+
118
126
  var _formatSpacing = formatSpacing(spacing),
119
127
  horizonal = _formatSpacing.horizonal,
120
- vertical = _formatSpacing.vertical;
128
+ vertical = _formatSpacing.vertical; // useEffect(() => {
129
+ // calculateHeaderWidth();
130
+ // }, []);
131
+
121
132
 
122
133
  var hasDivider = (divider || !!split) && (title || extra);
123
134
  var hasCollapse = collapsible === true || defaultCollapsed !== undefined || collapsed !== undefined;
@@ -193,7 +204,28 @@ export var ProCard = function ProCard(props) {
193
204
  marginBottom: -vertical
194
205
  } : {};
195
206
 
196
- var cardContentStyle = _objectSpread(_objectSpread({}, cardContentMargin), contentStyle);
207
+ var cardContentStyle = _objectSpread(_objectSpread({}, cardContentMargin), contentStyle); // 计算宽度
208
+
209
+
210
+ var calculateHeaderWidth = function calculateHeaderWidth() {
211
+ if (cardRef === null || cardRef === void 0 ? void 0 : cardRef.current) {
212
+ var _tooltipDom$clientWid, _tagsDom$clientWidth, _descriptionDom$clien;
213
+
214
+ var cardDom = ReactDOM.findDOMNode(cardRef.current);
215
+ var headerDom = cardDom === null || cardDom === void 0 ? void 0 : cardDom.querySelector('.teamix-pro-card-title');
216
+ var tooltipDom = headerDom === null || headerDom === void 0 ? void 0 : headerDom.querySelector('.teamix-pro-card-title-tooltip');
217
+ var tagsDom = headerDom === null || headerDom === void 0 ? void 0 : headerDom.querySelector('.teamix-pro-tags');
218
+ var descriptionDom = headerDom === null || headerDom === void 0 ? void 0 : headerDom.querySelector('.teamix-pro-card-title-description');
219
+ var widthList = [(_tooltipDom$clientWid = tooltipDom === null || tooltipDom === void 0 ? void 0 : tooltipDom.clientWidth) !== null && _tooltipDom$clientWid !== void 0 ? _tooltipDom$clientWid : 0, (_tagsDom$clientWidth = tagsDom === null || tagsDom === void 0 ? void 0 : tagsDom.clientWidth) !== null && _tagsDom$clientWidth !== void 0 ? _tagsDom$clientWidth : 0, (_descriptionDom$clien = descriptionDom === null || descriptionDom === void 0 ? void 0 : descriptionDom.clientWidth) !== null && _descriptionDom$clien !== void 0 ? _descriptionDom$clien : 0].filter(function (item) {
220
+ return item;
221
+ });
222
+ var width = widthList.reduce(function (acc, cur) {
223
+ return acc + cur;
224
+ }, 0) + widthList.length * 8; // 无法取出精准宽度,减去1作为阈值
225
+
226
+ setHeaderWithoutTitleWidth(width - 1);
227
+ }
228
+ };
197
229
 
198
230
  var renderTitle = function renderTitle() {
199
231
  var icon = tooltipIcon || 'info-circle-line';
@@ -213,9 +245,20 @@ export var ProCard = function ProCard(props) {
213
245
  type: "down-fill"
214
246
  }), /*#__PURE__*/React.createElement("div", {
215
247
  className: cls('title-name')
216
- }, title)), !hasCollapse && /*#__PURE__*/React.createElement("div", {
217
- className: cls('title-name')
218
- }, title), tooltip && /*#__PURE__*/React.createElement("div", {
248
+ }, /*#__PURE__*/React.createElement(ProField, {
249
+ value: title,
250
+ type: "text",
251
+ render: {
252
+ ellipsis: true
253
+ }
254
+ }))), !hasCollapse && /*#__PURE__*/React.createElement("div", {
255
+ className: cls('title-name'),
256
+ style: {
257
+ maxWidth: "calc(100% - ".concat(headerWithoutTitleWidth, "px)")
258
+ }
259
+ }, /*#__PURE__*/React.createElement(Ellipsis, {
260
+ tooltip: title
261
+ }, title)), tooltip && /*#__PURE__*/React.createElement("div", {
219
262
  className: cls('title-tooltip')
220
263
  }, /*#__PURE__*/React.createElement(Balloon.Tooltip, {
221
264
  align: "t",
@@ -40,6 +40,13 @@
40
40
  }
41
41
  }
42
42
 
43
+ .next-card-header-titles {
44
+ padding-right: 8px;
45
+ }
46
+ .next-card-header-extra {
47
+ margin-top: 2px;
48
+ }
49
+
43
50
  &-title {
44
51
  display: flex;
45
52
  align-items: center;
@@ -80,6 +87,7 @@
80
87
 
81
88
  &-description {
82
89
  font-size: 12px;
90
+ min-width: 40px;
83
91
  }
84
92
  }
85
93
 
@@ -1,4 +1,4 @@
1
- var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onChangeType", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst", "schema", "children"];
1
+ var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "onChange", "onChangeType", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst", "schema", "children"];
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
 
@@ -10,8 +10,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
10
 
11
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
12
 
13
- import React, { memo, useEffect, useMemo } from 'react';
14
- import { usePrefixCls, cls, getLanguage, getGlobalConfig, isBool } from '@teamix/utils';
13
+ import React, { memo, useEffect, useMemo, useRef } from 'react';
14
+ import { usePrefixCls, cls, getLanguage, getGlobalConfig } from '@teamix/utils';
15
15
  import { createForm, onFieldValueChange, onFormValuesChange, registerValidateLocale, setValidateLanguage } from '@formily/core';
16
16
  import { toJS } from '@formily/reactive';
17
17
  import { Form, Upload, SelectTable, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
@@ -22,8 +22,8 @@ import FormGroup from '../Components/FormGroup';
22
22
  import LightFilter from '../Components/LightFilter';
23
23
  import Text from '../Components/Text/index';
24
24
  import SchemaForm from '../SchemaForm';
25
- import { mergeArrayValue } from '../utils';
26
25
  import useAutoSubmit from './useAutoSubmit';
26
+ import useAutoLayout from './useAutoLayout';
27
27
  import useInitialRequest from './useInitialRequest';
28
28
  import validateLocale from '../locales/validate';
29
29
  import './index.scss';
@@ -63,12 +63,6 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
63
63
  scope = _ref.scope,
64
64
  context = _ref.context,
65
65
  components = _ref.components,
66
- layout = _ref.layout,
67
- labelAlign = _ref.labelAlign,
68
- wrapperAlign = _ref.wrapperAlign,
69
- labelCol = _ref.labelCol,
70
- wrapperCol = _ref.wrapperCol,
71
- breakpoints = _ref.breakpoints,
72
66
  onChange = _ref.onChange,
73
67
  onChangeType = _ref.onChangeType,
74
68
  onSubmit = _ref.onSubmit,
@@ -80,7 +74,8 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
80
74
  children = _ref.children,
81
75
  otherProps = _objectWithoutProperties(_ref, _excluded);
82
76
 
83
- // 获取全局配置
77
+ var formRef = useRef(); // 获取全局配置
78
+
84
79
  var _ref2 = getGlobalConfig('ProForm') || {},
85
80
  globalComponents = _ref2.components,
86
81
  globalScope = _ref2.scope;
@@ -98,25 +93,10 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
98
93
 
99
94
  var mergedComponents = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, globalComponents), components), formilyComponents), ProFieldComponents);
100
95
 
101
- var onAutoSubmit = useAutoSubmit(onSubmit, context); // todo 需要formily支持断点下的属性更新
102
-
103
- var getTeamixLayout = useMemo(function () {
104
- return breakpoints === true ? {
105
- breakpoints: [480],
106
- layout: mergeArrayValue(['vertical'], layout),
107
- labelAlign: mergeArrayValue(['left'], labelAlign),
108
- wrapperAlign: mergeArrayValue(['left'], wrapperAlign),
109
- labelCol: mergeArrayValue([24], labelCol),
110
- wrapperCol: mergeArrayValue([24], wrapperCol)
111
- } : {
112
- breakpoints: isBool(breakpoints) ? undefined : breakpoints,
113
- layout: layout,
114
- labelAlign: labelAlign,
115
- wrapperAlign: wrapperAlign,
116
- labelCol: labelCol,
117
- wrapperCol: wrapperCol
118
- };
119
- }, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
96
+ var onAutoSubmit = useAutoSubmit(onSubmit, context);
97
+ var autoTeamixLayout = useAutoLayout(_objectSpread(_objectSpread({}, otherProps), {}, {
98
+ schema: schema
99
+ }), formRef);
120
100
  useMemo(function () {
121
101
  // 配置表单默认值
122
102
  if (initialValues) {
@@ -157,7 +137,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
157
137
  }, []);
158
138
  return /*#__PURE__*/React.createElement(Form, _objectSpread(_objectSpread(_objectSpread({
159
139
  className: cls(prefixCls(), className)
160
- }, otherProps), getTeamixLayout), {}, {
140
+ }, otherProps), autoTeamixLayout), {}, {
161
141
  form: form,
162
142
  onAutoSubmit: onAutoSubmit,
163
143
  onAutoSubmitFailed: onSubmitFailed
@@ -165,7 +145,9 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
165
145
  schema: schema,
166
146
  scope: mergedScope,
167
147
  components: mergedComponents
168
- }) : null, children);
148
+ }) : null, /*#__PURE__*/React.createElement("div", {
149
+ ref: formRef
150
+ }), children);
169
151
  });
170
152
  ProForm.defaultProps = {
171
153
  colon: false,
@@ -338,8 +338,15 @@
338
338
  }
339
339
 
340
340
  // ArrayTable
341
- .#{$form-array}-table-status-select {
342
- display: none;
341
+ .#{$form-array}-table {
342
+ &-status-select {
343
+ display: none;
344
+ }
345
+ .#{$css-prefix}formily-item:not(.#{$form-item-cls}-feedback-layout-popover) {
346
+ .#{$form-item-cls}-help {
347
+ z-index: 2 !important;
348
+ }
349
+ }
343
350
  }
344
351
 
345
352
  // SelectTable
@@ -0,0 +1,9 @@
1
+ declare const useAutoLayout: ({ breakpoints: outBreakpoints, layout, labelAlign, wrapperAlign, labelCol: outLabelCol, wrapperCol: outWrapperCol, autoLayout, schema, }: any, formRef: any) => {
2
+ breakpoints: any;
3
+ layout: any;
4
+ labelAlign: any;
5
+ wrapperAlign: any;
6
+ labelCol: any;
7
+ wrapperCol: any;
8
+ };
9
+ export default useAutoLayout;
@@ -0,0 +1,114 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ 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."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ import { useEffect, useMemo, useState } from 'react';
14
+ import { isPlainObj, isBool, autoWidthBySpace, getWidthByCharacterMap, isStr } from '@teamix/utils';
15
+ import { mergeArrayValue } from '../utils';
16
+
17
+ var useAutoLayout = function useAutoLayout(_ref, formRef) {
18
+ var outBreakpoints = _ref.breakpoints,
19
+ layout = _ref.layout,
20
+ labelAlign = _ref.labelAlign,
21
+ wrapperAlign = _ref.wrapperAlign,
22
+ outLabelCol = _ref.labelCol,
23
+ outWrapperCol = _ref.wrapperCol,
24
+ autoLayout = _ref.autoLayout,
25
+ schema = _ref.schema;
26
+
27
+ var _ref2 = isPlainObj(autoLayout) ? autoLayout : {
28
+ autoLabel: autoLayout
29
+ },
30
+ autoLabel = _ref2.autoLabel;
31
+
32
+ var breakpoints = useMemo(function () {
33
+ return autoLabel ? false : outBreakpoints;
34
+ }, []); // 当前断点不支持Col更新
35
+
36
+ var _useState = useState({
37
+ labelCol: outLabelCol,
38
+ wrapperCol: outWrapperCol
39
+ }),
40
+ _useState2 = _slicedToArray(_useState, 2),
41
+ autoCol = _useState2[0],
42
+ setAutoCol = _useState2[1];
43
+
44
+ var labelCol = autoCol.labelCol,
45
+ wrapperCol = autoCol.wrapperCol;
46
+ useEffect(function () {
47
+ /**
48
+ * autolayout
49
+ */
50
+ if (autoLabel) {
51
+ var formWidth = formRef.current.getBoundingClientRect().width; // 表单宽度
52
+
53
+ var labelArray = schema.map(function (item) {
54
+ var text = item.title;
55
+
56
+ if (isStr(text)) {
57
+ var _item$decoratorProps;
58
+
59
+ if (item.required) {
60
+ text += '一'; // 必填 + 12
61
+ }
62
+
63
+ if ((_item$decoratorProps = item.decoratorProps) === null || _item$decoratorProps === void 0 ? void 0 : _item$decoratorProps.tooltip) {
64
+ text += '一'; // 提示 + 18
65
+ }
66
+
67
+ return text;
68
+ }
69
+
70
+ return '';
71
+ }); // 标题内容集合
72
+
73
+ var labelWidthArray = getWidthByCharacterMap(labelArray); // 标题宽度集合
74
+
75
+ var _autoWidthBySpace = autoWidthBySpace(labelWidthArray),
76
+ expectedWidth = _autoWidthBySpace.expectedWidth,
77
+ consoleArray = _autoWidthBySpace.consoleArray; // 智能计算预期宽度
78
+
79
+
80
+ var expectedCol = Math.ceil(expectedWidth / formWidth * 24); // 预期宽度转换为 Col 值
81
+
82
+ setAutoCol({
83
+ labelCol: expectedCol,
84
+ wrapperCol: wrapperCol
85
+ });
86
+ } else {
87
+ setAutoCol({
88
+ labelCol: outLabelCol,
89
+ wrapperCol: outWrapperCol
90
+ });
91
+ }
92
+ }, [outLabelCol, outWrapperCol]); // Layout配置By断点(配置断点后,目前不支持 Col 更新)
93
+
94
+ var autoTeamixLayout = useMemo(function () {
95
+ return breakpoints === true ? {
96
+ breakpoints: [480],
97
+ layout: mergeArrayValue(['vertical'], layout),
98
+ labelAlign: mergeArrayValue(['left'], labelAlign),
99
+ wrapperAlign: mergeArrayValue(['left'], wrapperAlign),
100
+ labelCol: mergeArrayValue([24], labelCol),
101
+ wrapperCol: mergeArrayValue([24], wrapperCol)
102
+ } : {
103
+ breakpoints: isBool(breakpoints) ? undefined : breakpoints,
104
+ layout: layout,
105
+ labelAlign: labelAlign,
106
+ wrapperAlign: wrapperAlign,
107
+ labelCol: labelCol,
108
+ wrapperCol: wrapperCol
109
+ };
110
+ }, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
111
+ return autoTeamixLayout;
112
+ };
113
+
114
+ export default useAutoLayout;
@@ -1,4 +1,5 @@
1
- var _excluded = ["title", "decoratorProps"];
1
+ var _excluded = ["title", "decoratorProps"],
2
+ _excluded2 = ["title", "dataIndex", "cell", "htmlTitle", "sortable", "width", "align", "alignHeader", "filters", "filterMode", "filterMenuProps", "lock", "resizable", "colSpan"];
2
3
 
3
4
  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
5
 
@@ -12,15 +13,49 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
12
13
 
13
14
  var initializeColumn = function initializeColumn(item) {
14
15
  var title = item.title,
15
- decoratorProps = item.decoratorProps,
16
- children = _objectWithoutProperties(item, _excluded);
16
+ _item$decoratorProps = item.decoratorProps,
17
+ decoratorProps = _item$decoratorProps === void 0 ? {} : _item$decoratorProps,
18
+ children = _objectWithoutProperties(item, _excluded); // 将Table.Column属性和组件FormItem属性通过decoratorProps统一传入,再分别赋值
17
19
 
20
+
21
+ var columnTitle = decoratorProps.title,
22
+ dataIndex = decoratorProps.dataIndex,
23
+ cell = decoratorProps.cell,
24
+ htmlTitle = decoratorProps.htmlTitle,
25
+ sortable = decoratorProps.sortable,
26
+ width = decoratorProps.width,
27
+ align = decoratorProps.align,
28
+ alignHeader = decoratorProps.alignHeader,
29
+ filters = decoratorProps.filters,
30
+ filterMode = decoratorProps.filterMode,
31
+ filterMenuProps = decoratorProps.filterMenuProps,
32
+ lock = decoratorProps.lock,
33
+ resizable = decoratorProps.resizable,
34
+ colSpan = decoratorProps.colSpan,
35
+ formItemDecoratorProps = _objectWithoutProperties(decoratorProps, _excluded2);
36
+
37
+ var columnProperties = {
38
+ title: title !== null && title !== void 0 ? title : columnTitle,
39
+ dataIndex: dataIndex,
40
+ cell: cell,
41
+ htmlTitle: htmlTitle,
42
+ sortable: sortable,
43
+ width: width,
44
+ align: align,
45
+ alignHeader: alignHeader,
46
+ filters: filters,
47
+ filterMode: filterMode,
48
+ filterMenuProps: filterMenuProps,
49
+ lock: lock,
50
+ resizable: resizable,
51
+ colSpan: colSpan
52
+ };
18
53
  return {
19
54
  component: 'ArrayTable.Column',
20
- props: _objectSpread(_objectSpread({}, decoratorProps), {}, {
21
- title: title
22
- }),
23
- children: [_objectSpread({}, children)]
55
+ props: columnProperties,
56
+ children: [_objectSpread(_objectSpread({}, children), {}, {
57
+ decoratorProps: formItemDecoratorProps
58
+ })]
24
59
  };
25
60
  };
26
61
 
@@ -59,6 +59,9 @@ export interface ProFormSchemaItem {
59
59
  data?: AnyObject;
60
60
  }
61
61
  export declare type ProFormSchema = ProFormSchemaItem[];
62
+ interface AutoLayout {
63
+ autoLabel?: boolean;
64
+ }
62
65
  export interface ProFormProps extends Omit<IFormLayoutProps, 'breakpoints'> {
63
66
  form?: FormType | false;
64
67
  schema?: ProFormSchema;
@@ -78,6 +81,7 @@ export interface ProFormProps extends Omit<IFormLayoutProps, 'breakpoints'> {
78
81
  onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
79
82
  onInitialComplete?: (form: FormType) => void;
80
83
  breakpoints?: number[] | boolean;
84
+ autoLayout?: AutoLayout | boolean;
81
85
  }
82
86
  export interface FilterProps extends ProFormProps {
83
87
  form: FormType;
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.14";
31
+ declare const version = "1.4.17";
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.14';
39
+ var version = '1.4.17';
40
40
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
41
41
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils };
@@ -5,7 +5,7 @@ import './index.scss';
5
5
  import { getLayout } from '../../utils/utils';
6
6
  import defaultLayoutMap from '../../utils/layout';
7
7
  import InfoValueItem from '../InfoValueItem';
8
- import { getDataIndexValue } from '../../utils';
8
+ import { getDataIndexValue, isHidden } from '../../utils';
9
9
  var Row = Grid.Row,
10
10
  Col = Grid.Col;
11
11
 
@@ -55,7 +55,13 @@ var ProBaseInfo = function ProBaseInfo(props) {
55
55
 
56
56
  var renderContent = function renderContent() {
57
57
  return columns.map(function (item, index) {
58
- var _layout$span, _layout$span2, _item$title, _item$valueType, _ref, _item$colSpan;
58
+ var _ref, _ref2, _layout$span, _layout$span2, _item$title, _item$valueType, _ref3, _item$colSpan;
59
+
60
+ var hidden = isHidden(item === null || item === void 0 ? void 0 : item.hidden, getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}), (_ref2 = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref2 !== void 0 ? _ref2 : {}, context);
61
+
62
+ if (hidden) {
63
+ return;
64
+ }
59
65
 
60
66
  var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
61
67
  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;
@@ -67,7 +73,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
67
73
  loading: loading,
68
74
  value: /*#__PURE__*/React.createElement(InfoValueItem, {
69
75
  type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
70
- value: getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}),
76
+ value: getDataIndexValue(item.dataIndex, (_ref3 = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref3 !== void 0 ? _ref3 : {}),
71
77
  render: item.render,
72
78
  dataSource: item.dataSource,
73
79
  infoItem: item,
@@ -5,7 +5,7 @@ import './index.scss';
5
5
  import defaultLayoutMap from '../../utils/layout';
6
6
  import { getLayout } from '../../utils/utils';
7
7
  import InfoValueItem from '../InfoValueItem';
8
- import { getDataIndexValue } from '../../utils';
8
+ import { getDataIndexValue, isHidden } from '../../utils';
9
9
  var Row = Grid.Row,
10
10
  Col = Grid.Col;
11
11
 
@@ -18,12 +18,19 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
18
18
  loading = props.loading,
19
19
  result = props.result,
20
20
  actionRef = props.actionRef,
21
- size = props.size;
21
+ size = props.size,
22
+ context = props.context;
22
23
  var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
23
24
 
24
25
  var renderContent = function renderContent() {
25
26
  return columns.map(function (item, index) {
26
- var _item$title, _item$valueType;
27
+ var _ref, _ref2, _item$title, _item$valueType;
28
+
29
+ var hidden = isHidden(item === null || item === void 0 ? void 0 : item.hidden, getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}), (_ref2 = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref2 !== void 0 ? _ref2 : {}, context);
30
+
31
+ if (hidden) {
32
+ return;
33
+ }
27
34
 
28
35
  var span = 24;
29
36
 
@@ -51,6 +58,7 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
51
58
  infoItem: item,
52
59
  record: dataSource !== null && dataSource !== void 0 ? dataSource : result,
53
60
  actionRef: actionRef,
61
+ context: context,
54
62
  props: item.props
55
63
  }),
56
64
  headerInfoLayout: layout !== null && layout !== void 0 ? layout : defaultLayout,
@@ -23,7 +23,7 @@ import './index.scss';
23
23
  import { LabelIconTip } from '../../../field';
24
24
  import InfoValueItem from '../InfoValueItem';
25
25
  import { ProSkeletonRaw } from '../../..';
26
- import { getDataIndexValue } from '../../utils';
26
+ import { getDataIndexValue, isHidden } from '../../utils';
27
27
  import cloneDeep from 'lodash.clonedeep';
28
28
 
29
29
  var ProTableInfo = function ProTableInfo(props) {
@@ -33,7 +33,8 @@ var ProTableInfo = function ProTableInfo(props) {
33
33
  layout = _props$layout === void 0 ? {} : _props$layout,
34
34
  loading = props.loading,
35
35
  result = props.result,
36
- actionRef = props.actionRef;
36
+ actionRef = props.actionRef,
37
+ context = props.context;
37
38
  var _layout$colNum = layout.colNum,
38
39
  colNum = _layout$colNum === void 0 ? 2 : _layout$colNum,
39
40
  _layout$labelGutter = layout.labelGutter,
@@ -73,7 +74,9 @@ var ProTableInfo = function ProTableInfo(props) {
73
74
 
74
75
  var newDataSource = useMemo(function () {
75
76
  var nResult = [];
76
- var columnsCopy = cloneDeep(columns); // 取当前行的数据。直到取完
77
+ var columnsCopy = cloneDeep(columns).filter(function (item) {
78
+ return !isHidden(item.hidden, getDataIndexValue(item.dataIndex, dataSource !== null && dataSource !== void 0 ? dataSource : result), dataSource !== null && dataSource !== void 0 ? dataSource : result, context);
79
+ }); // 取当前行的数据。直到取完
77
80
 
78
81
  while (columnsCopy.length > 0) {
79
82
  var filterColumns = [];
@@ -98,6 +98,8 @@ export interface ProInfoColumnsProps {
98
98
  props?: any;
99
99
  /** 对齐方式 **/
100
100
  alignItems?: 'center' | 'flex-start' | 'flex-end' | string;
101
+ /** 是否隐藏 **/
102
+ hidden?: boolean | ProInfoCellFunProp | string;
101
103
  }
102
104
  export declare type ProInfoActionType = {
103
105
  /** 刷新Info */
@@ -10,3 +10,11 @@ export declare const ProInfoGroupContext: React.Context<ProInfoGroupContextProps
10
10
  * @returns
11
11
  */
12
12
  export declare function getDataIndexValue(dataIndex: ProInfoColumnsProps['dataIndex'], dataSource: object): any;
13
+ /**
14
+ * 判断是否隐藏
15
+ * @param hidden
16
+ * @param value
17
+ * @param record
18
+ * @param context
19
+ */
20
+ export declare function isHidden(hidden: ProInfoColumnsProps['hidden'], value: any, record: any, context: any): any;
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  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; }
6
6
 
7
- import { getDeepValue } from '@teamix/utils';
7
+ import { getDeepValue, getTargetValue } from '@teamix/utils';
8
8
  import React from 'react';
9
9
  export function useActionType(ref, action) {
10
10
  // 合并自定义事件
@@ -30,4 +30,31 @@ export function getDataIndexValue(dataIndex, dataSource) {
30
30
  }
31
31
 
32
32
  return getDeepValue(dataIndex !== null && dataIndex !== void 0 ? dataIndex : '', dataSource);
33
+ }
34
+ /**
35
+ * 判断是否隐藏
36
+ * @param hidden
37
+ * @param value
38
+ * @param record
39
+ * @param context
40
+ */
41
+
42
+ export function isHidden(hidden, value, record, context) {
43
+ if (typeof hidden === 'string') {
44
+ return getTargetValue(hidden, _objectSpread(_objectSpread({}, record), {}, {
45
+ record: record,
46
+ value: value,
47
+ context: context
48
+ }));
49
+ }
50
+
51
+ if (typeof hidden === 'boolean') {
52
+ return hidden;
53
+ }
54
+
55
+ if (typeof hidden === 'function') {
56
+ return hidden === null || hidden === void 0 ? void 0 : hidden(value, record);
57
+ }
58
+
59
+ return false;
33
60
  }
@@ -1,4 +1,4 @@
1
- .teamix-nocode {
1
+ .teamix-pro-nocode {
2
2
  &-empty {
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -75,7 +75,7 @@
75
75
  right: 20px;
76
76
  bottom: 20px;
77
77
 
78
- &>i {
78
+ & > i {
79
79
  cursor: pointer;
80
80
  color: var(--color-text1-8, #848484);
81
81
  background-color: rgba(0, 0, 0, 0.06);
@@ -26,7 +26,7 @@ import { useAction } from '../../actions';
26
26
  import { initConfigurator } from '../configurators';
27
27
  import { ComponentConfiguratorMap } from '../configurators/map';
28
28
  import { PlayGroundLayout } from '../playground';
29
- var cls = usePrefixCls('teamix-nocode');
29
+ var cls = usePrefixCls('teamix-pro-nocode');
30
30
  export var PagePlayground = function PagePlayground(props) {
31
31
  var _useState = useState(undefined),
32
32
  _useState2 = _slicedToArray(_useState, 2),
@@ -40,7 +40,7 @@ import PageHeader from '../../page-header';
40
40
  import { ProSkeletonRaw } from '../../skeleton';
41
41
  import { usePrefixCls } from '@teamix/utils';
42
42
  import { PageMap } from '.';
43
- var cls = usePrefixCls('teamix-nocode');
43
+ var cls = usePrefixCls('teamix-pro-nocode');
44
44
 
45
45
  var Loading = function Loading(props) {
46
46
  return /*#__PURE__*/React.createElement(PageContainer, _objectSpread({
@@ -20,7 +20,7 @@ import React, { useMemo } from 'react';
20
20
  import { usePrefixCls } from '@teamix/utils';
21
21
  import { useDebounceFn } from '@teamix/hooks';
22
22
  import { initConfigurator } from './configurators';
23
- var cls = usePrefixCls('teamix-nocode-playground');
23
+ var cls = usePrefixCls('teamix-pro-nocode-playground');
24
24
  export var PlayGroundLayout = function PlayGroundLayout(props) {
25
25
  return /*#__PURE__*/React.createElement("div", {
26
26
  className: cls()