@teamix/pro 1.2.18 → 1.2.22

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 (113) hide show
  1. package/dist/212.js +49 -49
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +3581 -990
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/es/actions/base.d.ts +2 -1
  7. package/es/actions/base.js +1 -1
  8. package/es/actions/danger-pop-confirm.d.ts +5 -0
  9. package/es/actions/danger-pop-confirm.js +10 -0
  10. package/es/actions/dialog.d.ts +1 -1
  11. package/es/actions/dialog.js +42 -55
  12. package/es/actions/index.d.ts +13 -0
  13. package/es/actions/index.js +21 -16
  14. package/es/actions/pop-confirm.d.ts +9 -0
  15. package/es/actions/pop-confirm.js +9 -0
  16. package/es/form/Components/LightFilter/componentMap.d.ts +2 -1
  17. package/es/form/Components/LightFilter/componentMap.js +4 -2
  18. package/es/form/Components/LightFilter/index.d.ts +1 -0
  19. package/es/form/Components/LightFilter/index.js +34 -16
  20. package/es/form/Components/LightFilter/index.scss +14 -4
  21. package/es/form/Filter/AdvancedFilter.d.ts +7 -0
  22. package/es/form/Filter/AdvancedFilter.js +114 -0
  23. package/es/form/Filter/LightFilter.d.ts +7 -0
  24. package/es/form/Filter/LightFilter.js +79 -0
  25. package/es/form/Filter/SimpleFilter.d.ts +7 -0
  26. package/es/form/Filter/SimpleFilter.js +74 -0
  27. package/es/form/Filter/index2.js +288 -235
  28. package/es/form/Filter/index2.scss +3 -0
  29. package/es/form/ProForm/index.js +11 -7
  30. package/es/form/ProForm/index.scss +40 -6
  31. package/es/form/ProForm/useFormDisplayValues.js +4 -2
  32. package/es/form/SchemaForm/index.js +16 -10
  33. package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
  34. package/es/form/SchemaForm/initializeDataSource.js +4 -9
  35. package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
  36. package/es/form/SchemaForm/initializeRequest.js +4 -10
  37. package/es/form/SchemaForm/initializeRules.d.ts +7 -1
  38. package/es/form/SchemaForm/initializeRules.js +9 -13
  39. package/es/form/SchemaForm/reactions.d.ts +5 -5
  40. package/es/form/SchemaForm/reactions.js +27 -29
  41. package/es/form/global.scss +1 -0
  42. package/es/form/typing.d.ts +11 -2
  43. package/es/form/utils.d.ts +8 -7
  44. package/es/form/utils.js +5 -4
  45. package/es/index.d.ts +1 -1
  46. package/es/index.js +1 -1
  47. package/es/table/components/Filter/index.js +1 -0
  48. package/es/table/components/Layout/index.js +21 -12
  49. package/es/table/components/Pagination/index.d.ts +4 -0
  50. package/es/table/components/Pagination/index.js +154 -0
  51. package/es/table/components/Pagination/index.scss +22 -0
  52. package/es/table/components/ToolBar/FilterColumnIcon.js +42 -8
  53. package/es/table/components/ToolBar/index.scss +17 -6
  54. package/es/table/index.js +118 -34
  55. package/es/table/index.scss +7 -1
  56. package/es/table/typing.d.ts +6 -2
  57. package/es/table/utils/columnRender.js +2 -1
  58. package/es/table/utils/index.d.ts +7 -0
  59. package/es/table/utils/index.js +38 -4
  60. package/lib/actions/base.d.ts +2 -1
  61. package/lib/actions/base.js +1 -1
  62. package/lib/actions/danger-pop-confirm.d.ts +5 -0
  63. package/lib/actions/danger-pop-confirm.js +22 -0
  64. package/lib/actions/dialog.d.ts +1 -1
  65. package/lib/actions/dialog.js +42 -54
  66. package/lib/actions/index.d.ts +13 -0
  67. package/lib/actions/index.js +23 -16
  68. package/lib/actions/pop-confirm.d.ts +9 -0
  69. package/lib/actions/pop-confirm.js +23 -0
  70. package/lib/form/Components/LightFilter/componentMap.d.ts +2 -1
  71. package/lib/form/Components/LightFilter/componentMap.js +6 -4
  72. package/lib/form/Components/LightFilter/index.d.ts +1 -0
  73. package/lib/form/Components/LightFilter/index.js +31 -14
  74. package/lib/form/Components/LightFilter/index.scss +14 -4
  75. package/lib/form/Filter/AdvancedFilter.d.ts +7 -0
  76. package/lib/form/Filter/AdvancedFilter.js +134 -0
  77. package/lib/form/Filter/LightFilter.d.ts +7 -0
  78. package/lib/form/Filter/LightFilter.js +99 -0
  79. package/lib/form/Filter/SimpleFilter.d.ts +7 -0
  80. package/lib/form/Filter/SimpleFilter.js +93 -0
  81. package/lib/form/Filter/index2.js +291 -234
  82. package/lib/form/Filter/index2.scss +3 -0
  83. package/lib/form/ProForm/index.js +10 -6
  84. package/lib/form/ProForm/index.scss +40 -6
  85. package/lib/form/ProForm/useFormDisplayValues.js +3 -1
  86. package/lib/form/SchemaForm/index.js +16 -9
  87. package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
  88. package/lib/form/SchemaForm/initializeDataSource.js +4 -11
  89. package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
  90. package/lib/form/SchemaForm/initializeRequest.js +4 -11
  91. package/lib/form/SchemaForm/initializeRules.d.ts +7 -1
  92. package/lib/form/SchemaForm/initializeRules.js +9 -16
  93. package/lib/form/SchemaForm/reactions.d.ts +5 -5
  94. package/lib/form/SchemaForm/reactions.js +29 -31
  95. package/lib/form/global.scss +1 -0
  96. package/lib/form/typing.d.ts +11 -2
  97. package/lib/form/utils.d.ts +8 -7
  98. package/lib/form/utils.js +6 -5
  99. package/lib/index.d.ts +1 -1
  100. package/lib/index.js +1 -1
  101. package/lib/table/components/Layout/index.js +20 -11
  102. package/lib/table/components/Pagination/index.d.ts +4 -0
  103. package/lib/table/components/Pagination/index.js +174 -0
  104. package/lib/table/components/Pagination/index.scss +22 -0
  105. package/lib/table/components/ToolBar/FilterColumnIcon.js +41 -7
  106. package/lib/table/components/ToolBar/index.scss +17 -6
  107. package/lib/table/index.js +115 -32
  108. package/lib/table/index.scss +7 -1
  109. package/lib/table/typing.d.ts +6 -2
  110. package/lib/table/utils/columnRender.js +2 -1
  111. package/lib/table/utils/index.d.ts +7 -0
  112. package/lib/table/utils/index.js +46 -4
  113. package/package.json +3 -3
@@ -12,7 +12,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
12
12
 
13
13
  import React, { memo, useEffect, useMemo } from 'react';
14
14
  import cls from 'classnames';
15
- import { createForm, onFormValuesChange, registerValidateLocale, setValidateLanguage } from '@formily/core';
15
+ import { createForm, onFieldValueChange, registerValidateLocale, setValidateLanguage } from '@formily/core';
16
16
  import { toJS } from '@formily/reactive';
17
17
  import { Form } from '@teamix/formily';
18
18
  import { usePrefixCls, getLanguage } from '@teamix/utils';
@@ -78,12 +78,12 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
78
78
  }, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]); // 添加onChange
79
79
 
80
80
  useEffect(function () {
81
- form.removeEffects('onChange');
82
- form.addEffects('onChange', function () {
83
- onFormValuesChange(function (form) {
84
- if (onChange) {
85
- onChange(toJS(form.values));
86
- }
81
+ form.removeEffects('onFieldValueChange');
82
+ form.addEffects('onFieldValueChange', function () {
83
+ onFieldValueChange('*', function (field, form) {
84
+ var _field$props;
85
+
86
+ onChange && onChange(toJS(form.values), toJS(field.value), (_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.name);
87
87
  });
88
88
  });
89
89
  }, [form, onChange]); // 配置表单默认值
@@ -94,6 +94,10 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
94
94
  } else if (initialRequest) {
95
95
  useInitialRequest(initialRequest).then(function (values) {
96
96
  form.setInitialValues(values);
97
+ }).finally(function () {
98
+ initialRequest.onComplete && initialRequest.onComplete(undefined, undefined, {
99
+ form: form
100
+ });
97
101
  });
98
102
  }
99
103
  }, []); // 配置国际化
@@ -180,16 +180,19 @@
180
180
  border: 0;
181
181
  }
182
182
  }
183
+ .#{$css-prefix}input-control:last-child {
184
+ padding-right: 0;
185
+ }
183
186
  }
184
187
 
185
188
  // 数组类组件添加按钮
186
- .#{$css-prefix}formily-array-base-addition {
189
+ .#{$form-array}-base-addition {
187
190
  .#{$css-prefix}formily-icon {
188
191
  margin-right: 4px;
189
192
  }
190
193
  }
191
194
  // 数组类ArrayItem Icon 居中
192
- .#{$css-prefix}formily-array-items-item-inner {
195
+ .#{$form-array}-items-item-inner {
193
196
  > .#{$css-prefix}box {
194
197
  > .#{$css-prefix}space-item {
195
198
  > .#{$css-prefix}formily-icon {
@@ -206,7 +209,7 @@
206
209
 
207
210
  // 折叠面板
208
211
  .#{$css-prefix}formily-collapse,
209
- .#{$css-prefix}formily-array-collapse-item {
212
+ .#{$form-array}-collapse-item {
210
213
  .#{$css-prefix}collapse-panel-hidden {
211
214
  .#{$css-prefix}collapse-panel-content {
212
215
  padding-top: 4px;
@@ -258,7 +261,7 @@
258
261
  }
259
262
 
260
263
  // ArrayItems
261
- .#{$css-prefix}formily-array-items {
264
+ .#{$form-array}-items {
262
265
  .#{$css-prefix}formily-grid-layout {
263
266
  > div:last-child {
264
267
  display: flex;
@@ -266,8 +269,39 @@
266
269
  align-items: center;
267
270
  }
268
271
  }
269
- .#{$css-prefix}formily-array-base-remove {
270
- cursor: pointer;
272
+ }
273
+ .#{$form-array}-base-remove,
274
+ .#{$form-array}-base-addition,
275
+ .#{$form-array}-base-move-down,
276
+ .#{$form-array}-base-move-up,
277
+ .#{$form-array}-base-sort-handle,
278
+ .form-array-base-icon {
279
+ color: var(--color-fill1-6, #848484);
280
+ &:hover {
281
+ color: var(--color-brand1-6, #0064c8);
282
+ }
283
+ }
284
+ .form-array-base-icon {
285
+ cursor: pointer;
286
+ }
287
+
288
+ // ArrayCard
289
+ .#{$form-array}-cards-item {
290
+ .#{$css-prefix}card-head {
291
+ padding: 16px 20px;
292
+ background-color: var(--color-fill1-2, #f7f7f7);
293
+ .#{$css-prefix}card-head-main {
294
+ margin-top: 0;
295
+ border-bottom: 0;
296
+ height: 22px;
297
+ line-height: 22px;
298
+ .#{$css-prefix}card-title {
299
+ padding-left: 0;
300
+ &::before {
301
+ display: none;
302
+ }
303
+ }
304
+ }
271
305
  }
272
306
  }
273
307
 
@@ -12,7 +12,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
13
  import { useForm } from '@formily/react';
14
14
  import { toJS } from '@formily/reactive';
15
- import { isArr, isPlainObj, getValueByValue } from '@teamix/utils';
15
+ import { isArr, isPlainObj, isSignificative, getValueByValue } from '@teamix/utils';
16
16
  /**
17
17
  * 获取表单值的可显示值
18
18
  * @returns 如果某字段有dataSource,则返回value对应label
@@ -56,7 +56,9 @@ var getDisplayValues = function getDisplayValues(form, values) {
56
56
  }; // 判断值的类型,递归获取每个值在该结构中的完整路径
57
57
 
58
58
 
59
- if (isPlainObj(values) && isLayoutValue(values)) {
59
+ if (!isSignificative(values)) {
60
+ displayValues = {};
61
+ } else if (isPlainObj(values) && isLayoutValue(values)) {
60
62
  // 如果值是对象且是布局对象的值
61
63
  displayValues = {};
62
64
  Object.entries(values).forEach(function (_ref) {
@@ -55,8 +55,9 @@ import initializeFormGroup from './initializeFormGroup';
55
55
  import initializeFormStep from './initializeFormStep';
56
56
  import initializeFormTab from './initializeFormTab';
57
57
  import initializeFormCollapse from './initializeFormCollapse';
58
+ import { $request, $common, $dataSource, $validator } from './reactions';
58
59
  import fieldTypeMap from '../fieldTypeMap';
59
- import { getRandomName, mapSchemaName } from '../utils';
60
+ import { getFieldName, mapSchemaName } from '../utils';
60
61
  import warning from '../warning';
61
62
  export default /*#__PURE__*/memo(function (_ref) {
62
63
  var schema = _ref.schema,
@@ -96,12 +97,17 @@ export default /*#__PURE__*/memo(function (_ref) {
96
97
  }, []); // 合并 schema 中 request 的 scope
97
98
 
98
99
  var mergedScope = useMemo(function () {
99
- return _objectSpread({}, scope);
100
+ return _objectSpread(_objectSpread({}, scope), {}, {
101
+ $request: $request,
102
+ $common: $common,
103
+ $dataSource: $dataSource,
104
+ $validator: $validator
105
+ });
100
106
  }, [scope]); // 格式化 schema
101
107
 
102
108
  var formatSchema = useCallback(function (schema) {
103
109
  var schemaProperties = {};
104
- schema === null || schema === void 0 ? void 0 : schema.forEach(function (item) {
110
+ schema === null || schema === void 0 ? void 0 : schema.forEach(function (item, index) {
105
111
  var newItem = warning(item);
106
112
  var _newItem = newItem,
107
113
  originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
@@ -165,7 +171,7 @@ export default /*#__PURE__*/memo(function (_ref) {
165
171
  component = _newItem2.component,
166
172
  type = _newItem2.type,
167
173
  _newItem2$name = _newItem2.name,
168
- name = _newItem2$name === void 0 ? getRandomName(component === null || component === void 0 ? void 0 : component.replace(/\./g, '')) : _newItem2$name,
174
+ name = _newItem2$name === void 0 ? getFieldName(component === null || component === void 0 ? void 0 : component.replace(/\./g, ''), index) : _newItem2$name,
169
175
  decorator = _newItem2.decorator,
170
176
  decoratorProps = _newItem2.decoratorProps,
171
177
  dataSource = _newItem2.dataSource,
@@ -190,18 +196,18 @@ export default /*#__PURE__*/memo(function (_ref) {
190
196
  var defaultDecoratorProps = _objectSpread(_objectSpread({}, tooltipProps), decoratorProps); // 初始化request
191
197
 
192
198
 
193
- var _initializeRequest = initializeRequest(request),
199
+ var _initializeRequest = initializeRequest(request, index),
194
200
  requestReactions = _initializeRequest.reactions,
195
201
  requestScope = _initializeRequest.scope; // 初始化dataSource
196
202
 
197
203
 
198
- var _initializeDataSource = initializeDataSource(dataSource),
204
+ var _initializeDataSource = initializeDataSource(dataSource, index),
199
205
  defaultDataSource = _initializeDataSource.dataSource,
200
206
  dataSourceReactions = _initializeDataSource.reactions,
201
207
  dataSourceScope = _initializeDataSource.scope; // 初始化rules
202
208
 
203
209
 
204
- var _initializeRules = initializeRules(rules),
210
+ var _initializeRules = initializeRules(rules, index),
205
211
  defaultRules = _initializeRules.rules,
206
212
  rulesScope = _initializeRules.scope; // 合并reactions,初始化reactions
207
213
 
@@ -239,15 +245,15 @@ export default /*#__PURE__*/memo(function (_ref) {
239
245
  });
240
246
  return schemaProperties;
241
247
  }, [mergedScope]);
242
- var proFormSchema = useMemo(function () {
248
+ var formilySchema = useMemo(function () {
243
249
  return {
244
250
  type: 'object',
245
251
  properties: formatSchema(schema)
246
252
  };
247
- }, [schema]); // console.log(proFormSchema);
253
+ }, [schema]); // console.log(formilySchema);
248
254
 
249
255
  return /*#__PURE__*/React.createElement(SchemaField, {
250
- schema: proFormSchema,
256
+ schema: formilySchema,
251
257
  components: components,
252
258
  scope: mergedScope
253
259
  });
@@ -1,6 +1,6 @@
1
- import type { ProFormRequestConfig } from '../';
1
+ import type { ProFormRequestConfig } from '../typing';
2
2
  interface IInitializeDataSource {
3
- (requestConfig?: ProFormRequestConfig | any): {
3
+ (requestConfig?: ProFormRequestConfig | any, index?: number): {
4
4
  dataSource?: any[];
5
5
  reactions: any[];
6
6
  scope: {
@@ -1,19 +1,14 @@
1
1
  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; }
2
2
 
3
3
  import { isPlainObj } from '@teamix/utils';
4
- import { $request, $dataSource } from './reactions';
5
- import { getRandomName } from '../utils';
6
4
 
7
- var initializeDataSource = function initializeDataSource(dataSource) {
5
+ var initializeDataSource = function initializeDataSource(dataSource, index) {
8
6
  if (isPlainObj(dataSource)) {
9
- var _scope;
10
-
11
7
  var requestConfig = dataSource;
12
- var requestScopeName = getRandomName('$request');
13
- var dataSourceScopeName = getRandomName('$dataSource');
8
+ var requestConfigName = "$requestConfig_".concat(index);
14
9
  return {
15
- reactions: ["{{".concat(dataSourceScopeName, "(").concat(requestScopeName, ",").concat(requestConfig.onComplete, ",context)}}")],
16
- scope: (_scope = {}, _defineProperty(_scope, requestScopeName, $request(requestConfig)), _defineProperty(_scope, dataSourceScopeName, $dataSource), _scope)
10
+ reactions: ["{{$dataSource($request,".concat(requestConfigName, ",context)}}")],
11
+ scope: _defineProperty({}, requestConfigName, requestConfig)
17
12
  };
18
13
  }
19
14
 
@@ -1,6 +1,6 @@
1
- import type { ProFormRequestConfig } from '../';
1
+ import type { ProFormRequestConfig } from '../typing';
2
2
  interface IInitializeRequest {
3
- (requestConfig?: ProFormRequestConfig): {
3
+ (requestConfig?: ProFormRequestConfig, index?: number): {
4
4
  reactions: any[];
5
5
  scope: {
6
6
  [x: string]: any;
@@ -1,17 +1,11 @@
1
1
  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; }
2
2
 
3
- import { $request, $context } from '../SchemaForm/reactions';
4
- import { getRandomName } from '../utils';
5
-
6
- var initializeRequest = function initializeRequest(requestConfig) {
3
+ var initializeRequest = function initializeRequest(requestConfig, index) {
7
4
  if (requestConfig) {
8
- var _scope;
9
-
10
- var requestScopeName = getRandomName('$request');
11
- var contextScopeName = getRandomName('$context');
5
+ var requestConfigName = "$requestConfig_".concat(index);
12
6
  return {
13
- reactions: ["{{".concat(contextScopeName, "(").concat(requestScopeName, ",").concat(requestConfig.onComplete, ",context)}}")],
14
- scope: (_scope = {}, _defineProperty(_scope, requestScopeName, $request(requestConfig)), _defineProperty(_scope, contextScopeName, $context), _scope)
7
+ reactions: ["{{$common($request,".concat(requestConfigName, ",context)}}")],
8
+ scope: _defineProperty({}, requestConfigName, requestConfig)
15
9
  };
16
10
  }
17
11
 
@@ -1,5 +1,11 @@
1
1
  interface IInitializeRules {
2
- (rules?: any): any;
2
+ (rules?: any, index?: number): {
3
+ rules?: any;
4
+ reactions: any[];
5
+ scope: {
6
+ [x: string]: any;
7
+ };
8
+ };
3
9
  }
4
10
  declare const initializeRules: IInitializeRules;
5
11
  export default initializeRules;
@@ -17,23 +17,19 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
17
17
  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; }
18
18
 
19
19
  import { isArr, isPlainObj } from '@teamix/utils';
20
- import { $request } from '../SchemaForm/reactions';
21
- import { getRandomName } from '../utils';
22
- import { $validator } from './reactions';
23
20
 
24
- var initializeRules = function initializeRules(rules) {
21
+ var initializeRules = function initializeRules(rules, index) {
25
22
  var initializeValidator = function initializeValidator(rule) {
26
- if (isPlainObj(rule === null || rule === void 0 ? void 0 : rule.validator)) {
27
- var _scope;
23
+ var subIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
28
24
 
29
- var validator = rule.validator;
30
- var requestScopeName = getRandomName('$request');
31
- var validatorScopeName = getRandomName('$validator');
25
+ if (isPlainObj(rule === null || rule === void 0 ? void 0 : rule.validator)) {
26
+ var requestConfig = rule.validator;
27
+ var requestConfigName = "$requestConfig_".concat(index, "_").concat(subIndex);
32
28
  return {
33
29
  rules: _objectSpread(_objectSpread({}, rule), {}, {
34
- validator: "{{".concat(validatorScopeName, "(").concat(requestScopeName, ",").concat(validator.onComplete, ",context)}}")
30
+ validator: "{{$validator($request,".concat(requestConfigName, ",context)}}")
35
31
  }),
36
- scope: (_scope = {}, _defineProperty(_scope, requestScopeName, $request(validator)), _defineProperty(_scope, validatorScopeName, $validator), _scope)
32
+ scope: _defineProperty({}, requestConfigName, requestConfig)
37
33
  };
38
34
  }
39
35
 
@@ -44,8 +40,8 @@ var initializeRules = function initializeRules(rules) {
44
40
  };
45
41
 
46
42
  if (isArr(rules)) {
47
- return rules.reduce(function (prev, current) {
48
- var result = initializeValidator(current);
43
+ return rules.reduce(function (prev, current, subIndex) {
44
+ var result = initializeValidator(current, subIndex);
49
45
  prev.rules = [].concat(_toConsumableArray(prev.rules), [result.rules]);
50
46
  prev.scope = _objectSpread(_objectSpread({}, prev.scope), result.scope);
51
47
  return prev;
@@ -1,6 +1,6 @@
1
1
  import type { ProFormRequestConfig } from '../typing';
2
- declare const $request: (requestConfig: ProFormRequestConfig) => (field: any, context: any) => Promise<unknown>;
3
- declare const $context: (services: any, onComplete: any, context: any) => (field: any) => any;
4
- declare const $validator: (services: any, onComplete: any, context: any) => (value: any, rules: any, { field }: any) => any;
5
- declare const $dataSource: (services: any, onComplete: any, context: any) => (field: any) => any;
6
- export { $request, $context, $dataSource, $validator };
2
+ declare const $request: (field: any, requestConfig: ProFormRequestConfig, context: any) => Promise<unknown>;
3
+ declare const $common: (services: any, requestConfig: ProFormRequestConfig, context: any) => (field: any) => any;
4
+ declare const $validator: (services: any, requestConfig: ProFormRequestConfig, context: any) => (value: any, rules: any, { field }: any) => any;
5
+ declare const $dataSource: (services: any, requestConfig: ProFormRequestConfig, context: any) => (field: any) => any;
6
+ export { $request, $common, $dataSource, $validator };
@@ -6,54 +6,52 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import { isFn, isPlainObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
8
8
 
9
- var $request = function $request(requestConfig) {
10
- return function (field, context) {
11
- var _field$data;
9
+ var $request = function $request(field, requestConfig, context) {
10
+ var _field$data;
12
11
 
13
- var refresh = field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
14
- var beforeRequest = requestConfig.beforeRequest,
15
- onSuccess = requestConfig.onSuccess;
16
- var refreshResult = isPlainObj(refresh) ? refresh : {};
17
- var beforeRequestResult = isFn(beforeRequest) ? beforeRequest(field, context) : {};
18
- return doCommonRequest(_objectSpread(_objectSpread({}, requestConfig), {}, {
19
- params: _objectSpread(_objectSpread(_objectSpread({}, requestConfig.params), beforeRequestResult), refreshResult),
20
- beforeRequest: function beforeRequest() {
21
- return beforeRequestResult;
22
- },
23
- onSuccess: isFn(onSuccess) ? function (res) {
24
- return onSuccess(res, field, context);
25
- } : onSuccess
26
- }), context);
27
- };
28
- }; // 配置上下文
12
+ var refresh = field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
13
+ var beforeRequest = requestConfig.beforeRequest,
14
+ onSuccess = requestConfig.onSuccess;
15
+ var refreshResult = isPlainObj(refresh) ? refresh : {};
16
+ var beforeRequestResult = isFn(beforeRequest) ? beforeRequest(field, context) : {};
17
+ return doCommonRequest(_objectSpread(_objectSpread({}, requestConfig), {}, {
18
+ params: _objectSpread(_objectSpread(_objectSpread({}, requestConfig.params), beforeRequestResult), refreshResult),
19
+ beforeRequest: function beforeRequest() {
20
+ return beforeRequestResult;
21
+ },
22
+ onSuccess: isFn(onSuccess) ? function (res) {
23
+ return onSuccess(res, field, context);
24
+ } : onSuccess
25
+ }), context);
26
+ }; // 通用请求配置上下文
29
27
 
30
28
 
31
- var $context = function $context(services, onComplete, context) {
29
+ var $common = function $common(services, requestConfig, context) {
32
30
  return function (field) {
33
- return services(field, context).then(function (res) {
34
- return onComplete && onComplete(res, field, context);
31
+ return services(field, requestConfig, context).then(function (res) {
32
+ return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
35
33
  });
36
34
  };
37
35
  }; // 配置校验
38
36
 
39
37
 
40
- var $validator = function $validator(services, onComplete, context) {
38
+ var $validator = function $validator(services, requestConfig, context) {
41
39
  return function (value, rules, _ref) {
42
40
  var field = _ref.field;
43
- return services(field, context).then(function (res) {
44
- return onComplete && onComplete(res, field, context);
41
+ return services(field, requestConfig, context).then(function (res) {
42
+ return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
45
43
  });
46
44
  };
47
45
  }; // 配置DataSource
48
46
 
49
47
 
50
- var $dataSource = function $dataSource(services, onComplete, context) {
48
+ var $dataSource = function $dataSource(services, requestConfig, context) {
51
49
  return function (field) {
52
50
  field.setState({
53
51
  loading: true,
54
52
  readOnly: true
55
53
  });
56
- return services(field, context).then(function (res) {
54
+ return services(field, requestConfig, context).then(function (res) {
57
55
  var isValueInDataSource = getValueByValue(res, field.value);
58
56
  var clearValue = isValueInDataSource ? {} : {
59
57
  value: undefined
@@ -63,7 +61,7 @@ var $dataSource = function $dataSource(services, onComplete, context) {
63
61
  loading: false,
64
62
  readOnly: false
65
63
  }, clearValue));
66
- return onComplete && onComplete(res, field, context);
64
+ return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
67
65
  }).catch(function () {
68
66
  field.setState({
69
67
  loading: false,
@@ -73,4 +71,4 @@ var $dataSource = function $dataSource(services, onComplete, context) {
73
71
  };
74
72
  };
75
73
 
76
- export { $request, $context, $dataSource, $validator };
74
+ export { $request, $common, $dataSource, $validator };
@@ -1,6 +1,7 @@
1
1
  @import '~@alicloudfe/components/lib/common-var.scss';
2
2
 
3
3
  $form-item-cls: #{$css-prefix}formily-item;
4
+ $form-array: #{$css-prefix}formily-array;
4
5
  $teamix-pro-form: teamix-pro-form;
5
6
  $teamix-pro-field: teamix-pro-field;
6
7
 
@@ -58,12 +58,18 @@ export interface ProFormProps extends IFormLayoutProps {
58
58
  };
59
59
  children?: React.ReactNode;
60
60
  initialValues?: AnyObject;
61
- initialRequest?: CommonRequestConfig;
61
+ initialRequest?: ProFormRequestConfig;
62
62
  previewTextPlaceholder?: ReactNode;
63
- onChange?: (values: any, displayValues?: any) => any;
63
+ onChange?: (values: any, fieldValue?: any, fieldName?: any) => any;
64
64
  onSubmit?: ((values: any) => any) | CommonRequestConfig;
65
65
  onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
66
66
  }
67
+ export interface FilterProps extends ProFormProps {
68
+ form: FormType;
69
+ defaultFilterValue?: string;
70
+ onReset?: (payload?: any) => void;
71
+ onResetClick?: () => void;
72
+ }
67
73
  export interface QueryFilterProps extends ProFormProps {
68
74
  /**
69
75
  * @deprecated triggerType已弃用
@@ -73,6 +79,9 @@ export interface QueryFilterProps extends ProFormProps {
73
79
  expand?: boolean;
74
80
  addonBefore?: ReactNode;
75
81
  addonAfter?: ReactNode;
82
+ defaultFilterValue?: string;
83
+ formRef?: React.MutableRefObject<any>;
84
+ onInit?: (values: any) => boolean;
76
85
  onFilter?: (values: any) => void;
77
86
  onReset?: (payload?: any) => void;
78
87
  }
@@ -15,14 +15,15 @@ declare const mapStatus: (props: any, field: any) => any;
15
15
  declare const mapDataSource: (props: any, field: any) => any;
16
16
  declare const mapMode: (props: any, field: any) => any;
17
17
  /**
18
- * 为未配置name的字段添加随机字段名称
19
- * @param prefix 随机字段名称前缀,默认为name
20
- * @returns 随机字段名称
18
+ * 创建字段名称
19
+ * @param prefix 字段名称前缀,接收字段component名称,默认为FieldName
20
+ * @param index 字段索引
21
+ * @returns 字段唯一名称
21
22
  */
22
- interface IGetRandomName {
23
- (prefix?: string): string;
23
+ interface IGetFieldName {
24
+ (prefix: string, index?: number): string;
24
25
  }
25
- declare const getRandomName: IGetRandomName;
26
+ declare const getFieldName: IGetFieldName;
26
27
  /**
27
28
  * 将ProForm的key映射为formily的key,然后筛除掉无效的key/value
28
29
  * @param obj
@@ -36,4 +37,4 @@ declare const mapSchemaName: (obj: any) => any;
36
37
  * @returns 合并数组或合并其他值
37
38
  */
38
39
  declare const mergeArrayValue: (arr: any[], v?: any) => any[];
39
- export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getRandomName, mapSchemaName, };
40
+ export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getFieldName, mapSchemaName, };
package/es/form/utils.js CHANGED
@@ -113,9 +113,10 @@ var mapMode = function mapMode(props, field) {
113
113
  });
114
114
  };
115
115
 
116
- var getRandomName = function getRandomName() {
117
- var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'name';
118
- return "".concat(prefix, "_").concat(Math.floor(Math.random() * Math.pow(10, 18)));
116
+ var getFieldName = function getFieldName() {
117
+ var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'FieldName';
118
+ var index = arguments.length > 1 ? arguments[1] : undefined;
119
+ return "".concat(prefix, "-").concat(index);
119
120
  };
120
121
  /**
121
122
  * 将ProForm的key映射为formily的key,然后筛除掉无效的key/value
@@ -168,4 +169,4 @@ var mergeArrayValue = function mergeArrayValue(arr, v) {
168
169
  return [].concat(_toConsumableArray(arr), [v]);
169
170
  };
170
171
 
171
- export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getRandomName, mapSchemaName };
172
+ export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getFieldName, mapSchemaName };
package/es/index.d.ts CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
21
21
  export * from './page-header';
22
22
  export * from './skeleton';
23
23
  export * from './table';
24
- declare const version = "1.2.17";
24
+ declare const version = "1.2.21";
25
25
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -27,7 +27,7 @@ export * from './page-header';
27
27
  export * from './skeleton';
28
28
  export * from './table'; // export * from './sidebar';
29
29
 
30
- var version = '1.2.17';
30
+ var version = '1.2.21';
31
31
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
32
32
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
33
33
  hooks, nocode, templates, utils };
@@ -24,6 +24,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
24
24
 
25
25
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
26
 
27
+ // 表格项列筛选
27
28
  import React, { useEffect, useMemo, useState } from 'react';
28
29
  import TeamixIcon from '@teamix/icon';
29
30
  import { Button, Dropdown, Menu } from '@alicloudfe/components';
@@ -24,7 +24,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
24
24
 
25
25
  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; }
26
26
 
27
- import React, { useEffect, useState } from 'react';
27
+ import React, { useEffect, useState, isValidElement } from 'react';
28
28
  import { Header, baseClass } from '@teamix/utils';
29
29
  import { Button, Badge } from '@alicloudfe/components';
30
30
  import TeamixIcon from '@teamix/icon';
@@ -48,7 +48,7 @@ var Layout = function Layout(props) {
48
48
  rowSelection = props.rowSelection,
49
49
  otherProps = _objectWithoutProperties(props, _excluded);
50
50
 
51
- var mode = (dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.mode) || 'inline';
51
+ var mode = dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.mode;
52
52
 
53
53
  var _useState = useState((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.expand) || false),
54
54
  _useState2 = _slicedToArray(_useState, 2),
@@ -107,17 +107,26 @@ var Layout = function Layout(props) {
107
107
 
108
108
 
109
109
  var renderPanelFilter = function renderPanelFilter() {
110
- var _dataFilter$schema2;
110
+ if (dataFilter) {
111
+ var _dataFilter$schema2;
111
112
 
112
- if (dataFilter && (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length) >= 0) {
113
- return /*#__PURE__*/React.createElement("div", {
114
- className: cls('panel-filter'),
115
- style: {
116
- display: expand ? 'block' : 'none'
117
- }
118
- }, /*#__PURE__*/React.createElement(AdvancedFilter, _objectSpread({
119
- form: dataFilterForm
120
- }, dataFilter)));
113
+ if ( /*#__PURE__*/isValidElement(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.content)) {
114
+ return /*#__PURE__*/React.createElement("div", {
115
+ className: cls('panel-filter'),
116
+ style: {
117
+ display: expand ? 'block' : 'none'
118
+ }
119
+ }, dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.content);
120
+ } else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length) >= 0) {
121
+ return /*#__PURE__*/React.createElement("div", {
122
+ className: cls('panel-filter'),
123
+ style: {
124
+ display: expand ? 'block' : 'none'
125
+ }
126
+ }, /*#__PURE__*/React.createElement(AdvancedFilter, _objectSpread({
127
+ form: dataFilterForm
128
+ }, dataFilter)));
129
+ }
121
130
  }
122
131
  }; // 渲染过滤器按钮
123
132
 
@@ -0,0 +1,4 @@
1
+ import { PaginationProps } from '@alicloudfe/components/types/pagination';
2
+ import './index.scss';
3
+ declare const _default: (props: PaginationProps) => JSX.Element;
4
+ export default _default;