@teamix/pro 1.1.30 → 1.1.34

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 (59) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +1113 -474
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/index.js +13 -8
  6. package/es/actions/link.d.ts +2 -2
  7. package/es/form/Components/FormGroup/index.scss +1 -1
  8. package/es/form/Components/ProField/index.d.ts +4 -0
  9. package/es/form/Components/Query/index.scss +1 -6
  10. package/es/form/Components/Text/index.scss +4 -2
  11. package/es/form/ProForm/index.js +2 -2
  12. package/es/form/ProForm/index.scss +4 -11
  13. package/es/form/ProForm/useFormDisplayValues.d.ts +6 -0
  14. package/es/form/ProForm/useFormDisplayValues.js +65 -0
  15. package/es/form/SchemaForm/adapterType.js +2 -1
  16. package/es/form/SchemaForm/index.js +5 -15
  17. package/es/form/SchemaForm/initializeProField.js +1 -0
  18. package/es/form/SchemaForm/initializeReactions.d.ts +2 -0
  19. package/es/form/SchemaForm/initializeReactions.js +89 -0
  20. package/es/form/global.scss +12 -0
  21. package/es/form/index.d.ts +3 -3
  22. package/es/form/index.js +3 -3
  23. package/es/form/typing.d.ts +2 -2
  24. package/es/form/utils.d.ts +31 -8
  25. package/es/form/utils.js +27 -44
  26. package/es/index.d.ts +1 -1
  27. package/es/index.js +1 -1
  28. package/es/table/components/Filter/index.js +6 -2
  29. package/es/table/index.js +4 -1
  30. package/es/table/typing.d.ts +8 -4
  31. package/es/table/utils/columnRender.js +38 -11
  32. package/lib/actions/index.js +12 -7
  33. package/lib/actions/link.d.ts +2 -2
  34. package/lib/form/Components/FormGroup/index.scss +1 -1
  35. package/lib/form/Components/ProField/index.d.ts +4 -0
  36. package/lib/form/Components/Query/index.scss +1 -6
  37. package/lib/form/Components/Text/index.scss +4 -2
  38. package/lib/form/ProForm/index.js +1 -1
  39. package/lib/form/ProForm/index.scss +4 -11
  40. package/lib/form/ProForm/useFormDisplayValues.d.ts +6 -0
  41. package/lib/form/ProForm/useFormDisplayValues.js +74 -0
  42. package/lib/form/SchemaForm/adapterType.js +2 -1
  43. package/lib/form/SchemaForm/index.js +5 -14
  44. package/lib/form/SchemaForm/initializeProField.js +1 -0
  45. package/lib/form/SchemaForm/initializeReactions.d.ts +2 -0
  46. package/lib/form/SchemaForm/initializeReactions.js +101 -0
  47. package/lib/form/global.scss +12 -0
  48. package/lib/form/index.d.ts +3 -3
  49. package/lib/form/index.js +15 -8
  50. package/lib/form/typing.d.ts +2 -2
  51. package/lib/form/utils.d.ts +31 -8
  52. package/lib/form/utils.js +28 -54
  53. package/lib/index.d.ts +1 -1
  54. package/lib/index.js +1 -1
  55. package/lib/table/components/Filter/index.js +6 -2
  56. package/lib/table/index.js +4 -1
  57. package/lib/table/typing.d.ts +8 -4
  58. package/lib/table/utils/columnRender.js +38 -11
  59. package/package.json +1 -1
package/es/index.js CHANGED
@@ -25,6 +25,6 @@ export * from './page-container';
25
25
  export * from './page-header';
26
26
  export * from './skeleton';
27
27
  export * from './table';
28
- var version = '1.1.29';
28
+ var version = '1.1.33';
29
29
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
30
30
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils };
@@ -86,9 +86,11 @@ var Filter = function Filter(props) {
86
86
 
87
87
  var renderSingle = function renderSingle() {
88
88
  return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref3) {
89
+ var _value$toString;
90
+
89
91
  var label = _ref3.label,
90
92
  value = _ref3.value;
91
- var valueStr = value.toString();
93
+ var valueStr = (_value$toString = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString !== void 0 ? _value$toString : '';
92
94
  return /*#__PURE__*/React.createElement(RadioItem, {
93
95
  id: valueStr,
94
96
  checked: selected.includes(valueStr),
@@ -103,9 +105,11 @@ var Filter = function Filter(props) {
103
105
 
104
106
  var renderMultiple = function renderMultiple() {
105
107
  return filters === null || filters === void 0 ? void 0 : filters.map(function (_ref4) {
108
+ var _value$toString2;
109
+
106
110
  var label = _ref4.label,
107
111
  value = _ref4.value;
108
- var valueStr = value.toString();
112
+ var valueStr = (_value$toString2 = value === null || value === void 0 ? void 0 : value.toString()) !== null && _value$toString2 !== void 0 ? _value$toString2 : '';
109
113
  return /*#__PURE__*/React.createElement(CheckboxItem, {
110
114
  key: valueStr,
111
115
  checked: selected.includes(valueStr),
package/es/table/index.js CHANGED
@@ -624,9 +624,12 @@ var ProTable = function ProTable(props) {
624
624
  }
625
625
 
626
626
  function onChangePaginationSize(currentPageSize) {
627
+ var _request5;
628
+
627
629
  setPageSize(currentPageSize);
630
+ setCurrentPage(1);
628
631
 
629
- _request(_defineProperty({}, targetPageSizeKey, currentPageSize));
632
+ _request((_request5 = {}, _defineProperty(_request5, targetPageSizeKey, currentPageSize), _defineProperty(_request5, targetPageKey, 1), _request5));
630
633
  }
631
634
 
632
635
  function renderRowSelection() {
@@ -11,8 +11,10 @@ import { Method } from 'axios';
11
11
  import React from 'react';
12
12
  import type { Form as FormType } from '@formily/core';
13
13
  declare type IFieldRenderProps = keyof IProFieldFormatterProps;
14
+ /** 列record函数 */
15
+ declare type ProTableCellFunProp = (value: any, index: number, record: any) => any;
14
16
  declare type ITableCellRender = {
15
- [key in IFieldRenderProps]?: IProFieldFormatterProps[key] | ((...props: any) => void);
17
+ [key in IFieldRenderProps]?: IProFieldFormatterProps[key] | ProTableCellFunProp;
16
18
  } | ((...other: any) => React.ReactNode);
17
19
  declare type TDataService = {
18
20
  /** 翻页器总数 */
@@ -31,14 +33,14 @@ export declare type ProColumnProps = {
31
33
  tooltipIcon?: React.ReactNode;
32
34
  /** 对应 ProField 里面的 type */
33
35
  valueType?: IProFieldType;
34
- /** 是否默认隐藏列 */
36
+ /** 【列配置】是否默认隐藏列 */
35
37
  columnFilters?: boolean;
36
- /** 是否禁用隐藏列 */
38
+ /** 【列配置】是否禁用隐藏列 */
37
39
  columnFiltersDisabled?: boolean;
38
40
  /** 渲染单元格内容字段 */
39
41
  render?: ITableCellRender;
40
42
  /** 枚举值 */
41
- dataSource?: IProFieldOptionItem[];
43
+ dataSource?: IProFieldOptionItem[] | ProTableCellFunProp;
42
44
  /** 表头的过滤菜单项,当值为 true 时,自动使用 dataSource 生成 */
43
45
  filters?: boolean | ProTableColumnsFilterItemProps[];
44
46
  /** 表头的过滤菜单项过滤方式 single 单选 multiple 多选 */
@@ -49,6 +51,8 @@ export declare type ProColumnProps = {
49
51
  actionSchema?: ActionGroupProps;
50
52
  /** 指定列对应的字段,支持`a.b`形式的快速取值 和 数组取值 */
51
53
  dataIndex?: string | string[];
54
+ /** 指定 valueType 为日期时间格式时,可以格式化日期时间 */
55
+ format?: string;
52
56
  } & Omit<ColumnProps, 'filters' | 'dataIndex' | 'filtersMode'>;
53
57
  export declare type ProTableProps = {
54
58
  /** ProColums 定义,取代 Table 的 columns */
@@ -57,7 +57,8 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
57
57
  valueType = _item$valueType === void 0 ? 'text' : _item$valueType,
58
58
  render = item.render,
59
59
  actionSchema = item.actionSchema,
60
- dataIndex = item.dataIndex; // 如果没传 dataIndex,返回 null
60
+ dataIndex = item.dataIndex,
61
+ format = item.format; // 如果没传 dataIndex,返回 null
61
62
 
62
63
  if (!dataIndex) {
63
64
  value = null;
@@ -72,7 +73,8 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
72
73
  });
73
74
  }
74
75
 
75
- var newRender = null; // 如果 render 直接传函数
76
+ var newRender = null;
77
+ var newDataSource = null; // 如果 render 直接传函数
76
78
 
77
79
  if (typeof render === 'function') {
78
80
  newRender = function newRender() {
@@ -96,6 +98,29 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
96
98
  }, actionSchema), {}, {
97
99
  context: _objectSpread(_objectSpread({}, defaultContext), actionSchema.context)
98
100
  }));
101
+ } // dataSource可传函数
102
+
103
+
104
+ if (typeof item.dataSource === 'function') {
105
+ var _item$dataSource;
106
+
107
+ newDataSource = (_item$dataSource = item.dataSource) === null || _item$dataSource === void 0 ? void 0 : _item$dataSource.call(item, value, index, record);
108
+ } else {
109
+ var _item$dataSource2;
110
+
111
+ newDataSource = ((_item$dataSource2 = item.dataSource) !== null && _item$dataSource2 !== void 0 ? _item$dataSource2 : []).map(function (item) {
112
+ return Object.fromEntries(Object.entries(item).map(function (_ref) {
113
+ var _ref2 = _slicedToArray(_ref, 2),
114
+ k = _ref2[0],
115
+ v = _ref2[1];
116
+
117
+ return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
118
+ record: record,
119
+ value: value,
120
+ index: index
121
+ }))];
122
+ }));
123
+ });
99
124
  } // 渲染 ProField
100
125
 
101
126
 
@@ -103,7 +128,8 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
103
128
  type: valueType || 'text',
104
129
  value: value,
105
130
  render: newRender,
106
- dataSource: item.dataSource
131
+ dataSource: newDataSource,
132
+ format: format
107
133
  });
108
134
  };
109
135
  /**
@@ -121,10 +147,10 @@ var processRenderFunction = function processRenderFunction() {
121
147
  var index = arguments.length > 2 ? arguments[2] : undefined;
122
148
  var record = arguments.length > 3 ? arguments[3] : undefined;
123
149
  var external = ['linkOnClick', 'link', 'value'];
124
- return Object.fromEntries(Object.entries(render).map(function (_ref) {
125
- var _ref2 = _slicedToArray(_ref, 2),
126
- k = _ref2[0],
127
- v = _ref2[1];
150
+ return Object.fromEntries(Object.entries(render).map(function (_ref3) {
151
+ var _ref4 = _slicedToArray(_ref3, 2),
152
+ k = _ref4[0],
153
+ v = _ref4[1];
128
154
 
129
155
  if (typeof v === 'function') {
130
156
  var _v;
@@ -159,10 +185,11 @@ var processBuriedPoint = function processBuriedPoint() {
159
185
  var value = arguments.length > 2 ? arguments[2] : undefined;
160
186
  var index = arguments.length > 3 ? arguments[3] : undefined;
161
187
  return Object.fromEntries([// 默认 ellipsis、descriptionEllipsis 为 true
162
- ['ellipsis', true], ['descriptionEllipsis', true]].concat(_toConsumableArray(Object.entries(render).map(function (_ref3) {
163
- var _ref4 = _slicedToArray(_ref3, 2),
164
- k = _ref4[0],
165
- v = _ref4[1];
188
+ // emptyText 默认为 '-'
189
+ ['ellipsis', true], ['descriptionEllipsis', true], ['emptyText', '-']].concat(_toConsumableArray(Object.entries(render).map(function (_ref5) {
190
+ var _ref6 = _slicedToArray(_ref5, 2),
191
+ k = _ref6[0],
192
+ v = _ref6[1];
166
193
 
167
194
  return [k, getTargetValue(v, _objectSpread(_objectSpread({}, record), {}, {
168
195
  record: record,
@@ -156,16 +156,18 @@ var useAction = function useAction(config, context) {
156
156
 
157
157
  exports.useAction = useAction;
158
158
 
159
- var buttonContent = function buttonContent(content, iconType, iconSize) {
159
+ var buttonContent = function buttonContent(content, iconType, iconSize, context) {
160
+ var renderedContent = typeof content === 'function' ? content(context) : content;
161
+
160
162
  if (!iconType) {
161
- return content;
163
+ return renderedContent;
162
164
  }
163
165
 
164
166
  return [/*#__PURE__*/_react.default.createElement(_icon.default, {
165
167
  type: iconType,
166
168
  size: iconSize,
167
169
  key: "teamix-button-icon"
168
- }), content];
170
+ }), renderedContent];
169
171
  };
170
172
 
171
173
  var ActionButton = function ActionButton(props) {
@@ -189,7 +191,7 @@ var ActionButton = function ActionButton(props) {
189
191
  }) : _objectSpread(_objectSpread({}, actionProps), others);
190
192
  return /*#__PURE__*/_react.default.createElement(_components.Button, _objectSpread({
191
193
  type: type
192
- }, buttonProps), buttonContent(children, icon, iconSize));
194
+ }, buttonProps), buttonContent(children, icon, iconSize, context));
193
195
  };
194
196
 
195
197
  exports.ActionButton = ActionButton;
@@ -210,7 +212,7 @@ function renderMenuButtonItem(item, key, context) {
210
212
  }) : _objectSpread({}, menuItemProps);
211
213
  return /*#__PURE__*/_react.default.createElement(_components.MenuButton.Item, _objectSpread({
212
214
  key: key
213
- }, buttonProps), buttonContent(item.children, item.icon));
215
+ }, buttonProps), buttonContent(item.children, item.icon, undefined, context));
214
216
  }
215
217
 
216
218
  function renderCommonActionButtonMenuItem(action, key, context) {
@@ -246,8 +248,11 @@ var ActionMenuButton = function ActionMenuButton(props) {
246
248
  mode: 'popup',
247
249
  triggerType: 'hover'
248
250
  },
251
+ popupProps: {
252
+ shouldUpdatePosition: true
253
+ },
249
254
  type: type,
250
- label: buttonContent(label || children, icon, iconSize)
255
+ label: buttonContent(label || children, icon, iconSize, context)
251
256
  }, others), actions.map(function (action, i) {
252
257
  return renderCommonActionButtonMenuItem(action, i, context);
253
258
  }));
@@ -295,7 +300,7 @@ function renderCommonActionButton(button, context, isTypeText) {
295
300
  function getDefaultMoreButton(type, moreText) {
296
301
  if (type === 'button') {
297
302
  return {
298
- label: moreText || '更多'
303
+ label: moreText || (0, _utils.getMessage)('more')
299
304
  };
300
305
  }
301
306
 
@@ -1,6 +1,6 @@
1
- import { LinkPath } from '@teamix/utils';
1
+ import { LocationHistory } from '@teamix/utils';
2
2
  import { BaseAction } from './base';
3
- export interface LinkAction extends BaseAction, LinkPath {
3
+ export interface LinkAction extends BaseAction, LocationHistory {
4
4
  }
5
5
  export declare function useLinkAction(action: LinkAction, context?: any): {
6
6
  [x: string]: (e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void;
@@ -1,4 +1,4 @@
1
- @import '~@alifd/next/lib/core/index-noreset.scss';
1
+ @import '../../global.scss';
2
2
 
3
3
  $formily-group: #{$css-prefix}formily-group;
4
4
 
@@ -143,6 +143,10 @@ declare const _default: React.ForwardRefExoticComponent<(Partial<import("@teamix
143
143
  type: "tagFilter";
144
144
  } & {
145
145
  children?: React.ReactNode;
146
+ }> | Partial<import("@teamix/pro-field/lib/components/FieldTagFilter").IProFieldMultipleTagFilter & {
147
+ type: "multipleTagPicker";
148
+ } & {
149
+ children?: React.ReactNode;
146
150
  }> | Partial<import("@teamix/pro-field/lib/components/FieldMenuSelect").IProFieldMenuSelect & {
147
151
  type: "menuSelect";
148
152
  } & {
@@ -1,9 +1,4 @@
1
- @import '~@alifd/next/lib/core/index-noreset.scss';
2
-
3
- $form-item-cls: #{$css-prefix}formily-item;
4
- $noborder-font-weight-medium: calc(
5
- var(--form-element-medium-height, 32px) - var(--input-border-width, 1px) * 2
6
- );
1
+ @import '../../global.scss';
7
2
 
8
3
  // Query样式
9
4
  .#{$css-prefix}filter {
@@ -1,6 +1,8 @@
1
- $teamix-pro-form: teamix-pro-form;
1
+ @import '../../global.scss';
2
2
 
3
- .#{$teamix-pro-form}-text {
3
+ $teamix-pro-form-text: #{$teamix-pro-form}-text;
4
+
5
+ .#{$teamix-pro-form-text} {
4
6
  line-height: var(--form-element-medium-height, 32px);
5
7
  color: var(--color-fill1-6, #848484);
6
8
  }
@@ -98,7 +98,7 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
98
98
  form.addEffects('onChange', function () {
99
99
  (0, _core.onFormValuesChange)(function (form) {
100
100
  if (onChange) {
101
- onChange((0, _reactive.toJS)(form.values), (0, _utils2.getDisplayValues)(form, form.values));
101
+ onChange((0, _reactive.toJS)(form.values));
102
102
  }
103
103
  });
104
104
  });
@@ -1,14 +1,11 @@
1
- @import '~@alifd/next/lib/core/index-noreset.scss';
2
-
3
- $form-item-cls: #{$css-prefix}formily-item;
4
- $teamix-pro-form: teamix-pro-form;
1
+ @import '../global.scss';
5
2
 
6
3
  // FormItem 样式重写
7
4
  .#{$form-item-cls} {
8
5
  // 标签加粗 主题颜色
9
6
  .#{$form-item-cls}-label label {
10
7
  color: var(--form-label-color, #333333);
11
- font-weight: $font-weight-medium;
8
+ font-weight: var(--font-weight-medium, 500);
12
9
  }
13
10
 
14
11
  // 溢出label样式
@@ -126,10 +123,6 @@ $teamix-pro-form: teamix-pro-form;
126
123
  }
127
124
  }
128
125
 
129
- // 内嵌模式
130
- $inset-font-weight-medium: calc(
131
- var(--form-element-medium-height, 32px) - var(--input-border-width, 1px) * 2
132
- );
133
126
  // 内嵌模式 - 行高
134
127
  .#{$form-item-cls}-inset {
135
128
  line-height: $inset-font-weight-medium;
@@ -155,7 +148,7 @@ $inset-font-weight-medium: calc(
155
148
  .#{$form-item-cls}-label-content {
156
149
  label {
157
150
  color: var(--color-text1-8, #848484);
158
- font-weight: $font-weight-2;
151
+ font-weight: normal;
159
152
  }
160
153
  }
161
154
  .#{$form-item-cls}-colon {
@@ -193,7 +186,7 @@ $inset-font-weight-medium: calc(
193
186
 
194
187
  // Editable预览态行高
195
188
  .#{$css-prefix}formily-editable-content {
196
- line-height: $s-8;
189
+ line-height: var(--form-element-medium-height, 32px);
197
190
  }
198
191
 
199
192
  // 折叠面板
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 获取表单值的可显示值
3
+ * @returns 如果某字段有dataSource,则返回value对应label
4
+ */
5
+ declare const useFormDisplayValues: () => any;
6
+ export default useFormDisplayValues;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("@formily/react");
9
+
10
+ var _utils = require("@teamix/utils");
11
+
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+
14
+ 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."); }
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ 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; }
21
+
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+
24
+ /**
25
+ * 获取表单值的可显示值
26
+ * @returns 如果某字段有dataSource,则返回value对应label
27
+ */
28
+ var useFormDisplayValues = function useFormDisplayValues() {
29
+ var form = (0, _react.useForm)();
30
+ var values = form.values; // 判断值的类型,递归获取每个值在该结构中的完整路径
31
+
32
+ var getDisplayValues = function getDisplayValues(values) {
33
+ var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
34
+ var displayValues;
35
+
36
+ if ((0, _utils.isPlainObj)(values)) {
37
+ displayValues = {};
38
+ Object.entries(values).forEach(function (_ref) {
39
+ var _ref2 = _slicedToArray(_ref, 2),
40
+ key = _ref2[0],
41
+ value = _ref2[1];
42
+
43
+ var path = prefix ? "".concat(prefix, ".").concat(key) : "".concat(key);
44
+ displayValues[key] = getDisplayValues(value, path);
45
+ });
46
+ } else if ((0, _utils.isArr)(values)) {
47
+ displayValues = [];
48
+ values.map(function (value, index) {
49
+ var path = prefix ? "".concat(prefix, ".").concat(index) : "".concat(index);
50
+ displayValues[index] = getDisplayValues(value, path);
51
+ });
52
+ } else {
53
+ // 通过值的完整路径获取字段address(从form实例的indexes中),然后获取该字段的value在该字段dataSource中对应的label
54
+ var address = form.indexes[prefix];
55
+ var field = form.query(address).take();
56
+ displayValues = (0, _utils.getValueByValue)(field === null || field === void 0 ? void 0 : field.dataSource, values) || values;
57
+ }
58
+
59
+ return displayValues;
60
+ }; // 测试样例
61
+ // const example = {
62
+ // a: [
63
+ // [{ b: 'a.0.0.b', c: 'a.0.0.c' }, { d: 'a.0.1.d' }],
64
+ // { e: [{ f: { g: [{ h: 'a.1.e.0.f.g.0.h' }] } }, 'a.1.e.1'] },
65
+ // ],
66
+ // };
67
+ // console.log(getDisplayValues(example));
68
+
69
+
70
+ return getDisplayValues(values);
71
+ };
72
+
73
+ var _default = useFormDisplayValues;
74
+ exports.default = _default;
@@ -48,7 +48,8 @@ var typeMap = (_typeMap = {
48
48
  ColorRadio: 'string',
49
49
  IconPicker: 'string',
50
50
  JsonInput: 'object',
51
- TagPicker: 'array',
51
+ TagPicker: 'string',
52
+ MultipleTagPicker: 'array',
52
53
  Range: 'string',
53
54
  Search: 'array',
54
55
  ArrayCollapse: 'array',
@@ -35,6 +35,8 @@ var _adapterDecorator = _interopRequireDefault(require("./adapterDecorator"));
35
35
 
36
36
  var _initializeRequest2 = _interopRequireDefault(require("./initializeRequest"));
37
37
 
38
+ var _initializeReactions = _interopRequireDefault(require("./initializeReactions"));
39
+
38
40
  var _initializeDataSource2 = _interopRequireDefault(require("./initializeDataSource"));
39
41
 
40
42
  var _initializeRules2 = _interopRequireDefault(require("./initializeRules"));
@@ -255,21 +257,10 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
255
257
 
256
258
  var _initializeRules = (0, _initializeRules2.default)(rules),
257
259
  defaultRules = _initializeRules.rules,
258
- rulesScope = _initializeRules.scope; // 合并reactions
259
-
260
-
261
- var mergedReactions = function () {
262
- var innerReactions = [].concat(_toConsumableArray(requestReactions), _toConsumableArray(dataSourceReactions));
263
-
264
- if (reactions && innerReactions.length) {
265
- return (0, _utils.mergeArrayValue)(innerReactions, reactions);
266
- } else if (innerReactions.length) {
267
- return innerReactions;
268
- }
260
+ rulesScope = _initializeRules.scope; // 合并reactions,初始化reactions
269
261
 
270
- return reactions;
271
- }(); // 合并scope
272
262
 
263
+ var defaultReactions = (0, _initializeReactions.default)(reactions, [].concat(_toConsumableArray(requestReactions), _toConsumableArray(dataSourceReactions))); // 合并scope
273
264
 
274
265
  Object.entries(_objectSpread(_objectSpread(_objectSpread({}, requestScope), dataSourceScope), rulesScope)).map(function (_ref2) {
275
266
  var _ref3 = _slicedToArray(_ref2, 2),
@@ -284,7 +275,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
284
275
  decorator: defaultDecorator,
285
276
  decoratorProps: defaultDecoratorProps,
286
277
  rules: defaultRules,
287
- reactions: mergedReactions,
278
+ reactions: defaultReactions,
288
279
  dataSource: defaultDataSource
289
280
  })); // 递归子组件
290
281
 
@@ -52,6 +52,7 @@ var proFieldTypeMap = {
52
52
  IconPicker: 'icon',
53
53
  JsonInput: 'json',
54
54
  TagPicker: 'tagPicker',
55
+ MultipleTagPicker: 'multipleTagPicker',
55
56
  Range: 'range',
56
57
  Search: 'search' // Upload: 'upload',
57
58
 
@@ -0,0 +1,2 @@
1
+ declare const initializeReactions: (reactions: any, innerReactions: any) => any;
2
+ export default initializeReactions;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _utils = require("@teamix/utils");
9
+
10
+ var _utils2 = require("../utils");
11
+
12
+ var _schemaNameMap = _interopRequireDefault(require("../schemaNameMap"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ 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; }
17
+
18
+ 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; }
19
+
20
+ 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; }
21
+
22
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
23
+
24
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
+
26
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
27
+
28
+ function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
29
+
30
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
31
+
32
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
+
34
+ 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."); }
35
+
36
+ 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); }
37
+
38
+ 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; }
39
+
40
+ 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; }
41
+
42
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
+
44
+ var mapSchemaName = function mapSchemaName(schema) {
45
+ if ((0, _utils.isPlainObj)(schema)) {
46
+ var newSchema = {};
47
+ Object.entries(schema).forEach(function (_ref) {
48
+ var _ref2 = _slicedToArray(_ref, 2),
49
+ key = _ref2[0],
50
+ value = _ref2[1];
51
+
52
+ var _key$split = key.split('.'),
53
+ _key$split2 = _toArray(_key$split),
54
+ firstKey = _key$split2[0],
55
+ otherKey = _key$split2.slice(1);
56
+
57
+ var newFirstKey = (0, _utils.getValueByValue)(_schemaNameMap.default, firstKey, {
58
+ inputKey: 'proForm',
59
+ outputKey: 'formily'
60
+ }) || firstKey;
61
+ var newKey = [newFirstKey].concat(_toConsumableArray(otherKey)).join('.');
62
+ newSchema[newKey] = value;
63
+ });
64
+ return newSchema;
65
+ }
66
+
67
+ return schema;
68
+ };
69
+
70
+ var initializeReactions = function initializeReactions(reactions, innerReactions) {
71
+ var temp = innerReactions; // 合并reactions
72
+
73
+ if (reactions) {
74
+ temp = (0, _utils2.mergeArrayValue)(innerReactions, reactions);
75
+ } // schema名称映射,由ProFormSchema映射为formilySchema
76
+
77
+
78
+ temp = temp.map(function (item) {
79
+ var _item$fulfill, _item$otherwise;
80
+
81
+ var fulfillSchema = mapSchemaName(item === null || item === void 0 ? void 0 : (_item$fulfill = item.fulfill) === null || _item$fulfill === void 0 ? void 0 : _item$fulfill.schema);
82
+ var otherwiseSchema = mapSchemaName(item === null || item === void 0 ? void 0 : (_item$otherwise = item.otherwise) === null || _item$otherwise === void 0 ? void 0 : _item$otherwise.schema);
83
+
84
+ if (fulfillSchema || otherwiseSchema) {
85
+ return _objectSpread(_objectSpread({}, item), {}, {
86
+ fulfill: _objectSpread(_objectSpread({}, item === null || item === void 0 ? void 0 : item.fulfill), {}, {
87
+ schema: fulfillSchema
88
+ }),
89
+ otherwise: _objectSpread(_objectSpread({}, item === null || item === void 0 ? void 0 : item.otherwise), {}, {
90
+ schema: otherwiseSchema
91
+ })
92
+ });
93
+ }
94
+
95
+ return item;
96
+ });
97
+ return temp;
98
+ };
99
+
100
+ var _default = initializeReactions;
101
+ exports.default = _default;
@@ -0,0 +1,12 @@
1
+ @import '~@alicloudfe/components/lib/common-var.scss';
2
+
3
+ $form-item-cls: #{$css-prefix}formily-item;
4
+ $teamix-pro-form: teamix-pro-form;
5
+
6
+ $inset-font-weight-medium: calc(
7
+ var(--form-element-medium-height, 32px) - var(--input-border-width, 1px) * 2
8
+ );
9
+
10
+ $noborder-font-weight-medium: calc(
11
+ var(--form-element-medium-height, 32px) - var(--input-border-width, 1px) * 2
12
+ );
@@ -13,10 +13,10 @@ export * as formilyTeamix from '@teamix/formily';
13
13
  * 导出常用formily内容,需谨慎限制
14
14
  */
15
15
  import { createForm, registerValidateRules as registerRules, registerValidateFormats as registerFormats, registerValidateLocale, setValidateLanguage } from '@formily/core';
16
- import { FormConsumer } from '@formily/react';
16
+ import { FormConsumer, useForm } from '@formily/react';
17
17
  import { FormDialog, FormDrawer, FormStep, FormTab, FormCollapse } from '@teamix/formily';
18
- import { getDisplayValues } from './utils';
19
- export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, FormCollapse, registerRules, registerFormats, registerValidateLocale, setValidateLanguage, getDisplayValues, };
18
+ import useFormDisplayValues from './ProForm/useFormDisplayValues';
19
+ export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, FormCollapse, registerRules, registerFormats, registerValidateLocale, setValidateLanguage, useForm, useFormDisplayValues, };
20
20
  /**
21
21
  * 导出 Filter 组件
22
22
  */