@teamix/pro 1.1.4 → 1.1.8

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 (142) hide show
  1. package/README.md +97 -0
  2. package/dist/212.js +2 -2
  3. package/dist/pro.css +1 -1
  4. package/dist/pro.js +3147 -1872
  5. package/dist/pro.min.css +1 -1
  6. package/dist/pro.min.js +1 -1
  7. package/dist/pro.min.js.LICENSE.txt +1 -1
  8. package/es/actions/dialog-form.d.ts +3 -3
  9. package/es/actions/dialog-table.d.ts +6 -1
  10. package/es/actions/dialog-table.js +10 -1
  11. package/es/actions/drawer-table.d.ts +4 -0
  12. package/es/actions/drawer-table.js +7 -1
  13. package/es/actions/index.d.ts +6 -11
  14. package/es/actions/index.js +41 -21
  15. package/es/actions/index.scss +1 -1
  16. package/es/card/index.d.ts +17 -0
  17. package/es/form/Components/ProField/index.d.ts +8 -0
  18. package/es/form/ProForm/index.d.ts +2 -2
  19. package/es/form/ProForm/index.js +9 -2
  20. package/es/form/ProForm/index.scss +40 -7
  21. package/es/form/SchemaForm/adapterType.js +3 -3
  22. package/es/form/SchemaForm/index.d.ts +2 -2
  23. package/es/form/SchemaForm/index.js +9 -5
  24. package/es/form/SchemaForm/initializeArrayCards.js +10 -55
  25. package/es/form/SchemaForm/initializeArrayCollapse.js +10 -64
  26. package/es/form/SchemaForm/initializeArrayIcon.js +19 -7
  27. package/es/form/SchemaForm/initializeArrayItems.js +16 -75
  28. package/es/form/SchemaForm/initializeArrayTable.js +23 -33
  29. package/es/form/SchemaForm/initializeFormButton.js +35 -38
  30. package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  31. package/es/form/SchemaForm/initializeFormStep.d.ts +4 -2
  32. package/es/form/SchemaForm/initializeFormStep.js +21 -7
  33. package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
  34. package/es/form/SchemaForm/initializeProField.js +3 -3
  35. package/es/form/SchemaForm/reactions.d.ts +1 -1
  36. package/es/form/SchemaForm/reactions.js +2 -2
  37. package/es/form/index.d.ts +17 -9
  38. package/es/form/index.js +21 -9
  39. package/es/form/typing.d.ts +13 -22
  40. package/es/form/warning.js +2 -6
  41. package/es/index.d.ts +4 -3
  42. package/es/index.js +4 -3
  43. package/es/info/components/FormItem/index.js +4 -4
  44. package/es/info/components/FormItem/index.scss +11 -0
  45. package/es/info/components/InfoGroup/index.js +37 -6
  46. package/es/info/components/InfoGroup/index.scss +6 -0
  47. package/es/info/components/InfoValueItem/index.js +14 -2
  48. package/es/info/components/baseInfo/index.js +10 -9
  49. package/es/info/components/headerInfo/index.js +10 -9
  50. package/es/info/components/tableInfo/index.js +7 -4
  51. package/es/info/components/tableInfo/index.scss +1 -1
  52. package/es/info/index.d.ts +1 -0
  53. package/es/info/index.js +9 -7
  54. package/es/info/index.scss +4 -0
  55. package/es/info/typing.d.ts +17 -3
  56. package/es/info/utils/index.d.ts +11 -2
  57. package/es/info/utils/index.js +21 -0
  58. package/es/nocode/configurators/PageHeader.js +49 -43
  59. package/es/nocode/configurators/ProTable.js +12 -9
  60. package/es/nocode/configurators/common.d.ts +117 -105
  61. package/es/nocode/configurators/common.js +38 -34
  62. package/es/nocode/index.scss +1 -4
  63. package/es/page-header/index.d.ts +3 -0
  64. package/es/page-header/index.js +40 -13
  65. package/es/page-header/index.scss +6 -4
  66. package/es/table/components/Filter/index.js +8 -16
  67. package/es/table/components/Layout/index.js +2 -1
  68. package/es/table/components/Layout/index.scss +1 -1
  69. package/es/table/components/ToolBar/FilterColumnIcon.js +77 -17
  70. package/es/table/components/ToolBar/index.scss +10 -0
  71. package/es/table/index.d.ts +0 -1
  72. package/es/table/index.js +75 -56
  73. package/es/table/index.scss +0 -1
  74. package/es/table/typing.d.ts +3 -1
  75. package/lib/actions/dialog-form.d.ts +3 -3
  76. package/lib/actions/dialog-table.d.ts +6 -1
  77. package/lib/actions/dialog-table.js +20 -1
  78. package/lib/actions/drawer-table.d.ts +4 -0
  79. package/lib/actions/drawer-table.js +14 -1
  80. package/lib/actions/index.d.ts +6 -11
  81. package/lib/actions/index.js +44 -20
  82. package/lib/actions/index.scss +1 -1
  83. package/lib/card/index.d.ts +17 -0
  84. package/lib/form/Components/ProField/index.d.ts +8 -0
  85. package/lib/form/ProForm/index.d.ts +2 -2
  86. package/lib/form/ProForm/index.js +10 -2
  87. package/lib/form/ProForm/index.scss +40 -7
  88. package/lib/form/SchemaForm/adapterType.js +3 -3
  89. package/lib/form/SchemaForm/index.d.ts +2 -2
  90. package/lib/form/SchemaForm/index.js +10 -5
  91. package/lib/form/SchemaForm/initializeArrayCards.js +10 -54
  92. package/lib/form/SchemaForm/initializeArrayCollapse.js +10 -63
  93. package/lib/form/SchemaForm/initializeArrayIcon.js +19 -7
  94. package/lib/form/SchemaForm/initializeArrayItems.js +16 -74
  95. package/lib/form/SchemaForm/initializeArrayTable.js +23 -33
  96. package/lib/form/SchemaForm/initializeFormButton.js +35 -38
  97. package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  98. package/lib/form/SchemaForm/initializeFormStep.d.ts +4 -2
  99. package/lib/form/SchemaForm/initializeFormStep.js +21 -7
  100. package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
  101. package/lib/form/SchemaForm/initializeProField.js +3 -3
  102. package/lib/form/SchemaForm/reactions.d.ts +1 -1
  103. package/lib/form/SchemaForm/reactions.js +2 -2
  104. package/lib/form/index.d.ts +17 -9
  105. package/lib/form/index.js +81 -56
  106. package/lib/form/typing.d.ts +13 -22
  107. package/lib/form/warning.js +2 -6
  108. package/lib/index.d.ts +4 -3
  109. package/lib/index.js +16 -4
  110. package/lib/info/components/FormItem/index.js +4 -4
  111. package/lib/info/components/FormItem/index.scss +11 -0
  112. package/lib/info/components/InfoGroup/index.js +46 -6
  113. package/lib/info/components/InfoGroup/index.scss +6 -0
  114. package/lib/info/components/InfoValueItem/index.js +15 -3
  115. package/lib/info/components/baseInfo/index.js +10 -9
  116. package/lib/info/components/headerInfo/index.js +11 -10
  117. package/lib/info/components/tableInfo/index.js +7 -3
  118. package/lib/info/components/tableInfo/index.scss +1 -1
  119. package/lib/info/index.d.ts +1 -0
  120. package/lib/info/index.js +8 -6
  121. package/lib/info/index.scss +4 -0
  122. package/lib/info/typing.d.ts +17 -3
  123. package/lib/info/utils/index.d.ts +11 -2
  124. package/lib/info/utils/index.js +31 -0
  125. package/lib/nocode/configurators/PageHeader.js +49 -43
  126. package/lib/nocode/configurators/ProTable.js +12 -9
  127. package/lib/nocode/configurators/common.d.ts +117 -105
  128. package/lib/nocode/configurators/common.js +38 -34
  129. package/lib/nocode/index.scss +1 -4
  130. package/lib/page-header/index.d.ts +3 -0
  131. package/lib/page-header/index.js +42 -13
  132. package/lib/page-header/index.scss +6 -4
  133. package/lib/table/components/Filter/index.js +7 -15
  134. package/lib/table/components/Layout/index.js +2 -1
  135. package/lib/table/components/Layout/index.scss +1 -1
  136. package/lib/table/components/ToolBar/FilterColumnIcon.js +75 -16
  137. package/lib/table/components/ToolBar/index.scss +10 -0
  138. package/lib/table/index.d.ts +0 -1
  139. package/lib/table/index.js +76 -65
  140. package/lib/table/index.scss +0 -1
  141. package/lib/table/typing.d.ts +3 -1
  142. package/package.json +5 -5
@@ -35,10 +35,14 @@ var _error = require("./error");
35
35
 
36
36
  var _dialogForm = require("./dialog-form");
37
37
 
38
+ var _dialogTable = require("./dialog-table");
39
+
38
40
  var _drawer = require("./drawer");
39
41
 
40
42
  var _drawerForm = require("./drawer-form");
41
43
 
44
+ var _drawerTable = require("./drawer-table");
45
+
42
46
  require("./index.scss");
43
47
 
44
48
  var _excluded = ["type"],
@@ -123,6 +127,10 @@ var useAction = function useAction(config, context) {
123
127
  return (0, _dialogForm.useDialogFormAction)(others, context);
124
128
  }
125
129
 
130
+ if (type === 'dialog-table') {
131
+ return (0, _dialogTable.useDialogTableAction)(others, context);
132
+ }
133
+
126
134
  if (type === 'drawer') {
127
135
  return (0, _drawer.useDrawerAction)(others, context);
128
136
  }
@@ -131,6 +139,10 @@ var useAction = function useAction(config, context) {
131
139
  return (0, _drawerForm.useDrawerFormAction)(others, context);
132
140
  }
133
141
 
142
+ if (type === 'drawer-table') {
143
+ return (0, _drawerTable.useDrawerTableAction)(others, context);
144
+ }
145
+
134
146
  var registedAction = RegistedActions.get(type);
135
147
 
136
148
  if (!registedAction) {
@@ -196,9 +208,25 @@ function renderMenuButtonItem(item, key, context) {
196
208
  return item.onClick(e, context);
197
209
  }
198
210
  }) : _objectSpread({}, menuItemProps);
199
- return /*#__PURE__*/_react.default.createElement(_components.MenuButton.Item, _objectSpread(_objectSpread({}, buttonProps), {}, {
211
+ return /*#__PURE__*/_react.default.createElement(_components.MenuButton.Item, _objectSpread({
200
212
  key: key
201
- }), buttonContent(item.children, item.icon));
213
+ }, buttonProps), buttonContent(item.children, item.icon));
214
+ }
215
+
216
+ function renderCommonActionButtonMenuItem(action, key, context) {
217
+ // @ts-ignore
218
+ if (action.actions && action.actions.length) {
219
+ return /*#__PURE__*/_react.default.createElement(_components.Menu.SubMenu, {
220
+ key: key,
221
+ label: // @ts-ignore
222
+ action.label || action.children
223
+ }, //@ts-ignore
224
+ action.actions.map(function (a, j) {
225
+ return renderCommonActionButtonMenuItem(a, j, context);
226
+ }));
227
+ }
228
+
229
+ return renderMenuButtonItem(action, key, context);
202
230
  }
203
231
 
204
232
  var ActionMenuButton = function ActionMenuButton(props) {
@@ -214,25 +242,17 @@ var ActionMenuButton = function ActionMenuButton(props) {
214
242
 
215
243
  return /*#__PURE__*/_react.default.createElement(_components.MenuButton, _objectSpread({
216
244
  popupTriggerType: "hover",
245
+ menuProps: {
246
+ mode: 'popup',
247
+ triggerType: 'hover'
248
+ },
217
249
  type: type,
218
250
  label: buttonContent(label || children, icon, iconSize)
219
- }, others), actions.map(function (child, i) {
220
- // @ts-ignore
221
- if (child.actions && child.actions.length) {
222
- return [/*#__PURE__*/_react.default.createElement(_components.MenuButton.Divider, null),
223
- /*#__PURE__*/
224
- // @ts-ignore
225
- _react.default.createElement(_components.MenuButton.Group, {
226
- label: child.label || child.children
227
- }, //@ts-ignore
228
- child.actions.map(function (action, j) {
229
- return renderMenuButtonItem(action, "".concat(i, "-").concat(j), context);
230
- })), /*#__PURE__*/_react.default.createElement(_components.MenuButton.Divider, null), /*#__PURE__*/_react.default.createElement(_components.MenuButton.Divider, null)];
231
- }
232
-
233
- return renderMenuButtonItem(child, "".concat(i), context);
251
+ }, others), actions.map(function (action, i) {
252
+ return renderCommonActionButtonMenuItem(action, i, context);
234
253
  }));
235
- };
254
+ }; // 如果 actions 数量超过了 max,则把第 max 个和剩余超出部分折叠起来成为一个 menu
255
+
236
256
 
237
257
  exports.ActionMenuButton = ActionMenuButton;
238
258
 
@@ -246,7 +266,8 @@ function formatGroupActions(actions, max, moreConfig) {
246
266
  return [].concat(_toConsumableArray(actions.slice(0, MAX - 1)), [_objectSpread(_objectSpread({}, moreConfig), {}, {
247
267
  actions: actions.slice(MAX - 1)
248
268
  })]);
249
- }
269
+ } // 渲染一个 button 或者 menu button
270
+
250
271
 
251
272
  function renderCommonActionButton(button, context, isTypeText) {
252
273
  var buttonContext = button.context,
@@ -352,5 +373,8 @@ function ActionGroup(props) {
352
373
  }));
353
374
  }
354
375
 
355
- var _default = ActionButton;
376
+ var _default = function _default(props) {
377
+ return renderCommonActionButton(props);
378
+ };
379
+
356
380
  exports.default = _default;
@@ -13,7 +13,7 @@
13
13
  &.text:not(.divider) {
14
14
  & > button {
15
15
  &:not(:last-child) {
16
- margin-right: var(--s-2);
16
+ margin-right: var(--s-4);
17
17
  }
18
18
  }
19
19
  }
@@ -8,22 +8,39 @@ export declare type CardContainerProps = {
8
8
  } & React.HTMLAttributes<HTMLElement>;
9
9
  export declare const CardContainer: React.FC<CardContainerProps>;
10
10
  export interface CardProps {
11
+ /** 内容部分 */
11
12
  children?: React.ReactNode;
13
+ /**卡片标题 */
12
14
  title?: React.ReactNode;
15
+ /**卡片副标题 */
13
16
  subTitle?: React.ReactNode;
17
+ /**额外信息区域,位于卡片右上角,可以配置一些常用轻量操作 */
14
18
  extra?: React.ReactNode | IActionButton[];
19
+ /**卡片背景图 */
15
20
  image?: string;
21
+ /**卡片标题下方是否有分割线 */
16
22
  divider?: boolean;
23
+ /**卡片是否有边框 */
17
24
  bordered?: boolean;
25
+ /**卡片在hovers时是否有阴影 */
18
26
  hoveredShadow?: boolean;
27
+ /**卡片是否为紧凑模式,紧凑模式下卡片无内边距 */
19
28
  compacted?: boolean;
29
+ /**卡片内容是否居中展示 */
20
30
  centered?: boolean;
31
+ /**加载中状态 */
21
32
  loading?: boolean;
33
+ /**背景色 */
22
34
  backgroundColor?: 'blue' | 'green' | 'red' | 'orange' | 'yellow' | 'grey' | 'transparent';
35
+ /**卡片嵌套使用的模式下,卡片占父卡片内容区域的栅格数量 */
23
36
  col?: number | string;
37
+ /**卡片 class */
24
38
  className?: string;
39
+ /**卡片样式 */
25
40
  style?: React.CSSProperties;
41
+ /**卡片内容 class */
26
42
  contentClassName?: string;
43
+ /**卡片内容样式 */
27
44
  contentStyle?: React.CSSProperties;
28
45
  }
29
46
  declare const Card: React.FC<CardProps>;
@@ -139,6 +139,14 @@ declare const _default: React.ForwardRefExoticComponent<(Partial<import("@teamix
139
139
  type: "search";
140
140
  } & {
141
141
  children?: React.ReactNode;
142
+ }> | Partial<import("@teamix/pro-field/lib/components/FieldTagFilter").IProFieldTagFilter & {
143
+ type: "tagFilter";
144
+ } & {
145
+ children?: React.ReactNode;
146
+ }> | Partial<import("@teamix/pro-field/lib/components/FieldMenuSelect").IProFieldMenuSelect & {
147
+ type: "menuSelect";
148
+ } & {
149
+ children?: React.ReactNode;
142
150
  }> | Pick<Partial<{
143
151
  [key: string]: any;
144
152
  type: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { IProFormProps } from '../typing';
2
+ import type { IFormProps } from '../typing';
3
3
  import './index.scss';
4
- declare const ProForm: React.FC<IProFormProps>;
4
+ declare const ProForm: React.FC<IFormProps>;
5
5
  export default ProForm;
@@ -9,6 +9,8 @@ exports.default = void 0;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
12
14
  var _core = require("@formily/core");
13
15
 
14
16
  var _reactive = require("@formily/reactive");
@@ -25,7 +27,7 @@ var _utils2 = require("../utils");
25
27
 
26
28
  require("./index.scss");
27
29
 
28
- var _excluded = ["form", "initialValues", "schema", "scope", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed"];
30
+ var _excluded = ["form", "initialValues", "schema", "scope", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "className"];
29
31
 
30
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
33
 
@@ -59,11 +61,13 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
59
61
  onChange = _ref.onChange,
60
62
  onSubmit = _ref.onSubmit,
61
63
  onSubmitFailed = _ref.onSubmitFailed,
64
+ className = _ref.className,
62
65
  otherProps = _objectWithoutProperties(_ref, _excluded);
63
66
 
64
67
  var form = (0, _react.useMemo)(function () {
65
68
  return outerForm || (0, _core.createForm)();
66
69
  }, []);
70
+ var prefix = 'teamix-pro-form';
67
71
  var getTeamixLayout = (0, _react.useMemo)(function () {
68
72
  return breakpoints ? {
69
73
  breakpoints: breakpoints,
@@ -107,7 +111,11 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
107
111
  return outerForm === false ?
108
112
  /*#__PURE__*/
109
113
  // 特殊表单,无需渲染form实例,例如FormDialog等
110
- _react.default.createElement(_formily.FormLayout, _objectSpread(_objectSpread({}, otherProps), getTeamixLayout), formChildren) : /*#__PURE__*/_react.default.createElement(_formily.Form, _objectSpread(_objectSpread(_objectSpread({}, otherProps), getTeamixLayout), {}, {
114
+ _react.default.createElement(_formily.FormLayout, _objectSpread(_objectSpread({
115
+ className: (0, _classnames.default)(prefix, className)
116
+ }, otherProps), getTeamixLayout), formChildren) : /*#__PURE__*/_react.default.createElement(_formily.Form, _objectSpread(_objectSpread(_objectSpread({
117
+ className: (0, _classnames.default)(prefix, className)
118
+ }, otherProps), getTeamixLayout), {}, {
111
119
  form: form,
112
120
  onAutoSubmit: onSubmit,
113
121
  onAutoSubmitFailed: onSubmitFailed
@@ -1,6 +1,13 @@
1
1
  @import '~@alifd/next/lib/core/index-noreset.scss';
2
2
 
3
3
  $form-item-cls: #{$css-prefix}formily-item;
4
+ $teamix-pro-form: teamix-pro-form;
5
+
6
+ .#{$teamix-pro-form} {
7
+ .next-affix {
8
+ top: auto !important; // todo 待pro-page-containe修复后移除
9
+ }
10
+ }
4
11
 
5
12
  // FormItem 样式重写
6
13
  .#{$form-item-cls} {
@@ -37,9 +44,14 @@ $form-item-cls: #{$css-prefix}formily-item;
37
44
  > .teamix-pro-field-checkbox,
38
45
  .teamix-pro-field-radio,
39
46
  .teamix-pro-field-switch,
40
- .teamix-pro-field-colorradio {
47
+ .teamix-pro-field-colorradio,
48
+ .teamix-pro-field-range,
49
+ .#{$css-prefix}btn-text {
41
50
  line-height: var(--form-element-medium-height, 32px);
42
51
  }
52
+ > .#{$css-prefix}btn-text {
53
+ width: auto;
54
+ }
43
55
  }
44
56
  }
45
57
  }
@@ -87,15 +99,20 @@ $form-item-cls: #{$css-prefix}formily-item;
87
99
  .#{$form-item-cls}-extra {
88
100
  color: var(--color-text1-8, #848484);
89
101
  }
102
+ .#{$form-item-cls}-error-help {
103
+ color: var(--color-error-5, #e84738);
104
+ }
90
105
 
91
106
  // 前缀 后缀
92
107
  .#{$form-item-cls}-control {
93
108
  .#{$form-item-cls}-control-content {
94
109
  .#{$form-item-cls}-addon-before {
95
110
  margin-right: 16px;
111
+ color: var(--color-text1-8, #848484);
96
112
  }
97
113
  .#{$form-item-cls}-addon-after {
98
114
  margin-left: 16px;
115
+ color: var(--color-text1-8, #848484);
99
116
  }
100
117
  }
101
118
  }
@@ -218,14 +235,16 @@ $inset-font-weight-medium: calc(
218
235
  }
219
236
  }
220
237
 
221
- .#{$css-prefix}formily-button-group-sticky {
222
- margin-top: var(--form-element-medium-height, 32px);
223
- padding: 12px 16px 12px 24px;
224
- border: 0;
225
- background: var(--color-fill1-1, #fff);
238
+ .#{$teamix-pro-form}-button-affix.#{$css-prefix}affix {
239
+ left: 0;
240
+ right: 0;
241
+ width: 100% !important;
242
+ height: 56px !important;
243
+ padding-left: 24px;
244
+ background: var(--color-fill1-1, #fff) !important;
226
245
  box-shadow: 0 -1px 5px 0 rgba(38, 38, 38, 0.14);
227
246
  .#{$css-prefix}formily-button-group {
228
- margin-top: 0;
247
+ margin-bottom: 12px;
229
248
  }
230
249
  }
231
250
 
@@ -246,3 +265,17 @@ $inset-font-weight-medium: calc(
246
265
  }
247
266
  }
248
267
  }
268
+
269
+ // ArrayItems
270
+ .#{$css-prefix}formily-array-items {
271
+ .#{$css-prefix}formily-grid-layout {
272
+ > div:last-child {
273
+ display: flex;
274
+ justify-content: flex-end;
275
+ align-items: center;
276
+ }
277
+ }
278
+ .#{$css-prefix}formily-array-base-remove {
279
+ cursor: pointer;
280
+ }
281
+ }
@@ -36,7 +36,7 @@ var typeMap = (_typeMap = {
36
36
  YearPicker: 'string',
37
37
  QuarterPicker: 'string',
38
38
  DateRangePicker: 'array',
39
- // TimeRangePicker: 'array',
39
+ TimeRangePicker: 'array',
40
40
  DateTimeRangePicker: 'array',
41
41
  WeekRangePicker: 'array',
42
42
  MonthRangePicker: 'array',
@@ -46,10 +46,10 @@ var typeMap = (_typeMap = {
46
46
  Upload: 'object',
47
47
  ColorPicker: 'string',
48
48
  ColorRadio: 'string',
49
- ColorSwatches: 'string',
50
- ColorTwitter: 'string',
51
49
  IconPicker: 'string',
52
50
  JsonInput: 'object',
51
+ TagPicker: 'array',
52
+ Range: 'string',
53
53
  Search: 'array',
54
54
  ArrayCollapse: 'array',
55
55
  ArrayCards: 'array',
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import type { IProFormProps } from '../typing';
3
- declare const _default: React.MemoExoticComponent<({ schema, scope, components }: IProFormProps) => JSX.Element>;
2
+ import type { IFormProps } from '../typing';
3
+ declare const _default: React.MemoExoticComponent<({ schema, scope, components }: IFormProps) => JSX.Element>;
4
4
  export default _default;
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _react2 = require("@formily/react");
13
13
 
14
+ var _components = require("@alicloudfe/components");
15
+
14
16
  var _formily = require("@teamix/formily");
15
17
 
16
18
  var _ProField = _interopRequireDefault(require("../Components/ProField"));
@@ -96,7 +98,6 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
96
98
  var SchemaField = (0, _react.useMemo)(function () {
97
99
  return (0, _react2.createSchemaField)({
98
100
  components: {
99
- Upload: _formily.Upload,
100
101
  ProField: _ProField.default,
101
102
  FormLayout: _formily.FormLayout,
102
103
  FormItem: _formily.FormItem,
@@ -120,7 +121,9 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
120
121
  EditablePopover: _Editable.EditablePopover,
121
122
  FormGroup: _FormGroup.default,
122
123
  Search: _Search.default,
123
- QueryFilter: _QueryFilter.default
124
+ QueryFilter: _QueryFilter.default,
125
+ Upload: _formily.Upload,
126
+ Affix: _components.Affix
124
127
  }
125
128
  });
126
129
  }, []); // 合并schema中request的scope
@@ -277,9 +280,10 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
277
280
 
278
281
  var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
279
282
  properties: formatSchema(children)
280
- } : {}; // 递归items(类似子组件)
283
+ } : {}; // 递归items(类似子组件,会先由各initialize方法格式化为固定形式,type不同不统一处理)
284
+ // 例如:[{ name: 'items', type: 'object', children: items }]
281
285
 
282
- var recursiveItems = items ? formatSchema(items) : {}; // 配置组件属性
286
+ var recursiveItems = items ? formatSchema([items]) : {}; // 配置组件属性
283
287
 
284
288
  schemaProperties[name] = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, otherProps), formatParam), recursiveProperties), recursiveItems);
285
289
  });
@@ -290,7 +294,8 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
290
294
  type: 'object',
291
295
  properties: formatSchema(schema)
292
296
  };
293
- }, [formatSchema, schema]);
297
+ }, [formatSchema, schema]); // console.log(schemaPro);
298
+
294
299
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(SchemaField, {
295
300
  schema: schemaPro,
296
301
  components: components,
@@ -4,12 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _excluded = ["props", "children", "items"],
8
- _excluded2 = ["itemType"];
9
-
10
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
-
12
- 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; }
13
7
 
14
8
  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; }
15
9
 
@@ -17,58 +11,20 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
17
11
 
18
12
  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; }
19
13
 
20
- var initializeChildren = function initializeChildren(item) {
21
- return item;
22
- };
23
-
24
- var initializeAddition = function initializeAddition(item) {
25
- return _objectSpread(_objectSpread({}, item), {}, {
26
- component: 'ArrayCards.Addition'
27
- });
28
- };
29
-
30
- var initializeString = function initializeString(items) {
31
- return [{
32
- name: 'items',
33
- children: items.map(function (item) {
34
- return initializeChildren(item);
35
- })
36
- }];
37
- };
14
+ var initializeItems = function initializeItems(items) {
15
+ if (items) {
16
+ return _objectSpread(_objectSpread({}, items), {}, {
17
+ name: 'items'
18
+ });
19
+ }
38
20
 
39
- var initializeObject = function initializeObject(items) {
40
- return [{
41
- name: 'items',
42
- type: 'object',
43
- children: items.map(function (item) {
44
- return initializeChildren(item);
45
- })
46
- }];
21
+ return items;
47
22
  };
48
23
 
49
24
  var initialize = function initialize(item) {
50
- var _item$props = item.props,
51
- props = _item$props === void 0 ? {} : _item$props,
52
- _item$children = item.children,
53
- children = _item$children === void 0 ? [] : _item$children,
54
- _item$items = item.items,
55
- items = _item$items === void 0 ? [] : _item$items,
56
- other = _objectWithoutProperties(item, _excluded);
57
-
58
- var _props$itemType = props.itemType,
59
- itemType = _props$itemType === void 0 ? 'string' : _props$itemType,
60
- otherProps = _objectWithoutProperties(props, _excluded2);
61
-
62
- var renderItemsMap = {
63
- string: initializeString(items),
64
- object: initializeObject(items)
65
- };
66
- return _objectSpread(_objectSpread({}, other), {}, {
67
- props: otherProps,
68
- children: children.map(function (item) {
69
- return initializeAddition(item);
70
- }),
71
- items: renderItemsMap[itemType]
25
+ var items = item.items;
26
+ return _objectSpread(_objectSpread({}, item), {}, {
27
+ items: items ? initializeItems(items) : {}
72
28
  });
73
29
  };
74
30
 
@@ -4,12 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _excluded = ["props", "children", "items"],
8
- _excluded2 = ["itemType", "title"];
9
-
10
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
11
-
12
- 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; }
13
7
 
14
8
  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; }
15
9
 
@@ -17,67 +11,20 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
17
11
 
18
12
  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; }
19
13
 
20
- var initializeChildren = function initializeChildren(item) {
21
- return item;
22
- };
23
-
24
- var initializeAddition = function initializeAddition(item) {
25
- return _objectSpread(_objectSpread({}, item), {}, {
26
- component: 'ArrayCollapse.Addition'
27
- });
28
- };
29
-
30
- var initializeString = function initializeString(items, props) {
31
- return [{
32
- name: 'items',
33
- component: 'ArrayCollapse.CollapsePanel',
34
- props: props,
35
- children: items.map(function (item) {
36
- return initializeChildren(item);
37
- })
38
- }];
39
- };
14
+ var initializeItems = function initializeItems(items) {
15
+ if (items) {
16
+ return _objectSpread(_objectSpread({}, items), {}, {
17
+ name: 'items'
18
+ });
19
+ }
40
20
 
41
- var initializeObject = function initializeObject(items, props) {
42
- return [{
43
- type: 'object',
44
- name: 'items',
45
- component: 'ArrayCollapse.CollapsePanel',
46
- props: props,
47
- children: items.map(function (item) {
48
- return initializeChildren(item);
49
- })
50
- }];
21
+ return items;
51
22
  };
52
23
 
53
24
  var initialize = function initialize(item) {
54
- var _item$props = item.props,
55
- props = _item$props === void 0 ? {} : _item$props,
56
- _item$children = item.children,
57
- children = _item$children === void 0 ? [] : _item$children,
58
- _item$items = item.items,
59
- items = _item$items === void 0 ? [] : _item$items,
60
- other = _objectWithoutProperties(item, _excluded);
61
-
62
- var _props$itemType = props.itemType,
63
- itemType = _props$itemType === void 0 ? 'string' : _props$itemType,
64
- title = props.title,
65
- otherProps = _objectWithoutProperties(props, _excluded2);
66
-
67
- var renderItemsMap = {
68
- string: initializeString(items, {
69
- title: title
70
- }),
71
- object: initializeObject(items, {
72
- title: title
73
- })
74
- };
75
- return _objectSpread(_objectSpread({}, other), {}, {
76
- props: otherProps,
77
- children: children.map(function (item) {
78
- return initializeAddition(item);
79
- }),
80
- items: renderItemsMap[itemType]
25
+ var items = item.items;
26
+ return _objectSpread(_objectSpread({}, item), {}, {
27
+ items: items ? initializeItems(items) : {}
81
28
  });
82
29
  };
83
30
 
@@ -9,7 +9,9 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _icon = _interopRequireDefault(require("@teamix/icon"));
11
11
 
12
- var _excluded = ["component", "props"];
12
+ var _excluded = ["component", "props"],
13
+ _excluded2 = ["icon"],
14
+ _excluded3 = ["text", "type"];
13
15
 
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
@@ -25,12 +27,18 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
25
27
 
26
28
  var initialize = function initialize(item) {
27
29
  var component = item.component,
28
- props = item.props,
30
+ _item$props = item.props,
31
+ props = _item$props === void 0 ? {} : _item$props,
29
32
  other = _objectWithoutProperties(item, _excluded);
30
33
 
34
+ var icon = props.icon,
35
+ otherProps = _objectWithoutProperties(props, _excluded2);
36
+
31
37
  var iconType = '';
32
38
 
33
- if (component) {
39
+ if (icon) {
40
+ iconType = icon;
41
+ } else if (component) {
34
42
  if (/Addition/.test(component)) {
35
43
  iconType = 'add-line';
36
44
  } else if (/Remove/.test(component)) {
@@ -47,13 +55,17 @@ var initialize = function initialize(item) {
47
55
  return _objectSpread(_objectSpread({}, other), {}, {
48
56
  component: component,
49
57
  props: _objectSpread({
50
- icon: function icon(props) {
51
- return /*#__PURE__*/_react.default.createElement(_icon.default, _objectSpread({
58
+ icon: function icon(_ref) {
59
+ var text = _ref.text,
60
+ type = _ref.type,
61
+ props = _objectWithoutProperties(_ref, _excluded3);
62
+
63
+ return /*#__PURE__*/_react.default.createElement(_icon.default, _objectSpread(_objectSpread({}, props), {}, {
52
64
  type: iconType,
53
65
  size: "small"
54
- }, props));
66
+ }));
55
67
  }
56
- }, props)
68
+ }, otherProps)
57
69
  });
58
70
  };
59
71