@teamix/pro 1.3.1 → 1.3.4

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 (79) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +51673 -47273
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog-form.js +8 -5
  6. package/es/actions/dialog.js +2 -4
  7. package/es/form/Components/LightFilter/index.d.ts +1 -0
  8. package/es/form/Components/LightFilter/index.js +9 -6
  9. package/es/form/Components/ProField/mapDateFormat.d.ts +3 -0
  10. package/es/form/Components/ProField/mapDateFormat.js +113 -0
  11. package/es/form/Filter/LightFilter.js +13 -3
  12. package/es/form/Filter/SimpleFilter.js +1 -1
  13. package/es/form/Filter/index.js +44 -10
  14. package/es/form/ProForm/customComponent.js +2 -1
  15. package/es/form/ProForm/useFormDisplayValues.js +2 -2
  16. package/es/form/SchemaForm/adapterDecorator.js +1 -1
  17. package/es/form/SchemaForm/adapterType.js +2 -5
  18. package/es/form/SchemaForm/index.js +29 -14
  19. package/es/form/SchemaForm/initializeDataSource.d.ts +2 -1
  20. package/es/form/SchemaForm/initializeDataSource.js +9 -3
  21. package/es/form/SchemaForm/initializeSelectTable.d.ts +3 -0
  22. package/es/form/SchemaForm/initializeSelectTable.js +38 -0
  23. package/es/form/SchemaForm/reactions.d.ts +2 -2
  24. package/es/form/SchemaForm/reactions.js +42 -38
  25. package/es/form/fieldTypeMap.d.ts +3 -0
  26. package/es/form/fieldTypeMap.js +3 -0
  27. package/es/form/index.d.ts +2 -1
  28. package/es/form/typing.d.ts +6 -1
  29. package/es/form/utils.js +13 -4
  30. package/es/index.d.ts +1 -1
  31. package/es/index.js +1 -1
  32. package/es/info/components/baseInfo/index.scss +3 -0
  33. package/es/page-header/index.d.ts +3 -1
  34. package/es/page-header/index.js +12 -3
  35. package/es/table/components/ToolBar/DensityIcon.js +5 -3
  36. package/es/table/components/ToolBar/FilterColumnIcon.js +12 -3
  37. package/es/table/components/ToolBar/index.scss +3 -3
  38. package/es/table/index.js +8 -4
  39. package/es/table/index.scss +11 -1
  40. package/es/table/typing.d.ts +4 -0
  41. package/es/table/utils/columnRender.js +6 -0
  42. package/lib/actions/dialog-form.js +8 -5
  43. package/lib/actions/dialog.js +1 -3
  44. package/lib/form/Components/LightFilter/index.d.ts +1 -0
  45. package/lib/form/Components/LightFilter/index.js +9 -6
  46. package/lib/form/Components/ProField/mapDateFormat.d.ts +3 -0
  47. package/lib/form/Components/ProField/mapDateFormat.js +125 -0
  48. package/lib/form/Filter/LightFilter.js +13 -3
  49. package/lib/form/Filter/SimpleFilter.js +1 -1
  50. package/lib/form/Filter/index.js +44 -10
  51. package/lib/form/ProForm/customComponent.js +3 -1
  52. package/lib/form/ProForm/useFormDisplayValues.js +1 -1
  53. package/lib/form/SchemaForm/adapterDecorator.js +1 -1
  54. package/lib/form/SchemaForm/adapterType.js +2 -5
  55. package/lib/form/SchemaForm/index.js +30 -13
  56. package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -1
  57. package/lib/form/SchemaForm/initializeDataSource.js +9 -3
  58. package/lib/form/SchemaForm/initializeSelectTable.d.ts +3 -0
  59. package/lib/form/SchemaForm/initializeSelectTable.js +45 -0
  60. package/lib/form/SchemaForm/reactions.d.ts +2 -2
  61. package/lib/form/SchemaForm/reactions.js +42 -38
  62. package/lib/form/fieldTypeMap.d.ts +3 -0
  63. package/lib/form/fieldTypeMap.js +5 -1
  64. package/lib/form/index.d.ts +2 -1
  65. package/lib/form/typing.d.ts +6 -1
  66. package/lib/form/utils.js +13 -4
  67. package/lib/index.d.ts +1 -1
  68. package/lib/index.js +1 -1
  69. package/lib/info/components/baseInfo/index.scss +3 -0
  70. package/lib/page-header/index.d.ts +3 -1
  71. package/lib/page-header/index.js +11 -2
  72. package/lib/table/components/ToolBar/DensityIcon.js +5 -3
  73. package/lib/table/components/ToolBar/FilterColumnIcon.js +11 -2
  74. package/lib/table/components/ToolBar/index.scss +3 -3
  75. package/lib/table/index.js +8 -4
  76. package/lib/table/index.scss +11 -1
  77. package/lib/table/typing.d.ts +4 -0
  78. package/lib/table/utils/columnRender.js +6 -0
  79. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["schema"],
2
- _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest", "formRef"];
2
+ _excluded2 = ["schema", "useFieldValuesForRequest", "initialValues", "initialRequest", "formProps", "size", "onFinish", "beforeRequest", "formRef", "extendParams"];
3
3
 
4
4
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
5
5
 
@@ -147,6 +147,7 @@ export function useDialogFormAction(action, context) {
147
147
  _onFinish = action.onFinish,
148
148
  propsBeforeRequest = action.beforeRequest,
149
149
  propsFormRef = action.formRef,
150
+ propsExtendParams = action.extendParams,
150
151
  others = _objectWithoutProperties(action, _excluded2);
151
152
 
152
153
  var innerFormRef = /*#__PURE__*/createRef();
@@ -167,10 +168,12 @@ export function useDialogFormAction(action, context) {
167
168
  formRef: propsFormRef
168
169
  }, dialogFormProps));
169
170
  },
170
- extendParams: useFieldValuesForRequest ? '{{fields}}' : undefined,
171
+ extendParams: useFieldValuesForRequest ? ['{{fields}}', propsExtendParams] : propsExtendParams,
171
172
  beforeRequest: function beforeRequest(context) {
172
173
  return new Promise(function (resolve, reject) {
173
174
  innerFormRef.current.validate().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
175
+ var _innerFormRef$current;
176
+
174
177
  var beforeRequestContext, requestContext;
175
178
  return regeneratorRuntime.wrap(function _callee$(_context) {
176
179
  while (1) {
@@ -206,7 +209,7 @@ export function useDialogFormAction(action, context) {
206
209
 
207
210
  case 13:
208
211
  requestContext = Object.assign({
209
- fields: innerFormRef.current.values
212
+ fields: (_innerFormRef$current = innerFormRef.current) === null || _innerFormRef$current === void 0 ? void 0 : _innerFormRef$current.values
210
213
  }, _typeof(beforeRequestContext) === 'object' ? beforeRequestContext : {});
211
214
  resolve(requestContext);
212
215
 
@@ -222,9 +225,9 @@ export function useDialogFormAction(action, context) {
222
225
  });
223
226
  },
224
227
  onFinish: function onFinish() {
225
- var _innerFormRef$current;
228
+ var _innerFormRef$current2;
226
229
 
227
- _onFinish && _onFinish((_innerFormRef$current = innerFormRef.current) === null || _innerFormRef$current === void 0 ? void 0 : _innerFormRef$current.values);
230
+ _onFinish && _onFinish((_innerFormRef$current2 = innerFormRef.current) === null || _innerFormRef$current2 === void 0 ? void 0 : _innerFormRef$current2.values);
228
231
  }
229
232
  }, others), context);
230
233
  }
@@ -32,7 +32,7 @@ import classnames from 'classnames';
32
32
  import { useHistory } from 'react-router-dom';
33
33
  import { Dialog, Drawer } from '@alicloudfe/components';
34
34
  import PopConfirm from '@teamix/pop-confirm';
35
- import { getTargetValue, uuid, getMessage } from '@teamix/utils';
35
+ import { getTargetValue, getMessage } from '@teamix/utils';
36
36
  import ProForm, { createForm } from '../form';
37
37
  import { renderProMessage } from '../utils/message';
38
38
  import { eventHandler } from './base';
@@ -210,9 +210,7 @@ export function useDialogAction(action, actionContext) {
210
210
  var dialogContext = Object.assign({}, context, {
211
211
  hide: hide
212
212
  });
213
- var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({
214
- key: uuid()
215
- }, addContext(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
213
+ var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({}, addContext(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
216
214
 
217
215
  var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "title", addContextForReactNode(title, dialogContext)), _defineProperty(_objectSpread2, "content", /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
218
216
  className: "teamix-pro-dialog-before-content"
@@ -8,6 +8,7 @@ import './index.scss';
8
8
  interface ILightFiter {
9
9
  size?: 'small' | 'medium' | 'large';
10
10
  defaultFilterValue?: string;
11
+ filterValues?: string[];
11
12
  onFilterChange?: (schema?: any) => any;
12
13
  filterProps?: SelectProps;
13
14
  buttonProps?: ButtonProps;
@@ -56,14 +56,16 @@ var useMain = function useMain(active) {
56
56
  }; // 筛选项数据
57
57
 
58
58
 
59
- var useFilterItems = function useFilterItems() {
59
+ var useFilterItems = function useFilterItems(filterValues) {
60
60
  var schema = useFieldSchema();
61
61
  var filterItems = [];
62
62
  schema.mapProperties(function (schema, name) {
63
- filterItems.push({
64
- label: schema.title,
65
- value: schema.name
66
- });
63
+ if (!filterValues || filterValues && filterValues.includes(schema.name)) {
64
+ filterItems.push({
65
+ label: schema.title,
66
+ value: schema.name
67
+ });
68
+ }
67
69
  });
68
70
  return filterItems;
69
71
  }; // 是否输入框类型的组件
@@ -77,12 +79,13 @@ var isInputCategory = function isInputCategory(currentSchema) {
77
79
  var LightFilter = observer(function (props) {
78
80
  var _filterItems$, _main$;
79
81
 
80
- var filterItems = useFilterItems();
81
82
  var size = props.size,
82
83
  defaultFilterValue = props.defaultFilterValue,
84
+ filterValues = props.filterValues,
83
85
  onFilterChange = props.onFilterChange,
84
86
  filterProps = props.filterProps,
85
87
  buttonProps = props.buttonProps;
88
+ var filterItems = useFilterItems(filterValues);
86
89
 
87
90
  var _useState = useState(defaultFilterValue || ((_filterItems$ = filterItems[0]) === null || _filterItems$ === void 0 ? void 0 : _filterItems$.value)),
88
91
  _useState2 = _slicedToArray(_useState, 2),
@@ -0,0 +1,3 @@
1
+ import { GeneralField } from '@formily/core';
2
+ declare const mapDateFormat: (props: any, field: GeneralField) => {};
3
+ export default mapDateFormat;
@@ -0,0 +1,113 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
+
15
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
+
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
+
19
+ import { isEmpty } from '@formily/shared';
20
+ import { isArr, isFn } from '@teamix/utils';
21
+ import Moment from 'moment';
22
+
23
+ var moment = function moment(date, format) {
24
+ return Moment((date === null || date === void 0 ? void 0 : date.toDate) ? date.toDate() : date, format);
25
+ };
26
+
27
+ var momentable = function momentable(value, format) {
28
+ return Array.isArray(value) ? value.map(function (val) {
29
+ return moment(val, format);
30
+ }) : value ? moment(value, format) : value;
31
+ };
32
+
33
+ var formatMomentValue = function formatMomentValue(value, format, placeholder) {
34
+ var formatDate = function formatDate(date, format) {
35
+ var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
36
+ if (!date) return placeholder;
37
+
38
+ if (isArr(format)) {
39
+ var _format = format[i];
40
+
41
+ if (isFn(_format)) {
42
+ return _format(date);
43
+ }
44
+
45
+ if (isEmpty(_format)) {
46
+ return date;
47
+ }
48
+
49
+ return moment(date).format(_format);
50
+ } else {
51
+ if (isFn(format)) {
52
+ return format(date);
53
+ }
54
+
55
+ if (isEmpty(format)) {
56
+ return date;
57
+ }
58
+
59
+ return moment(date).format(format);
60
+ }
61
+ };
62
+
63
+ if (isArr(value)) {
64
+ return value.map(function (val, index) {
65
+ return formatDate(val, format, index);
66
+ });
67
+ } else {
68
+ return value ? formatDate(value, format) : value || placeholder;
69
+ }
70
+ };
71
+
72
+ var mapDateFormatDatePicker2 = function mapDateFormatDatePicker2(type) {
73
+ var getDefaultFormat = function getDefaultFormat(props) {
74
+ var _type = props['type'] || type;
75
+
76
+ if (_type === 'month') {
77
+ return 'YYYY-MM';
78
+ } else if (_type === 'quarter') {
79
+ return 'YYYY-\\QQ';
80
+ } else if (_type === 'year') {
81
+ return 'YYYY';
82
+ } else if (_type === 'week') {
83
+ return 'YYYY-wo';
84
+ }
85
+
86
+ return props['showTime'] ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
87
+ };
88
+
89
+ return function (props) {
90
+ var format = props['format'] || getDefaultFormat(props);
91
+ var _onChange = props.onChange;
92
+ return _objectSpread(_objectSpread({}, props), {}, {
93
+ format: format === 'YYYY-MM-DD HH:mm:ss' ? 'YYYY-MM-DD' : format,
94
+ value: momentable(props.value, format === 'YYYY-wo' ? 'YYYY-w' : format),
95
+ onChange: function onChange(value) {
96
+ if (_onChange) {
97
+ _onChange(formatMomentValue(value, format));
98
+ }
99
+ }
100
+ });
101
+ };
102
+ };
103
+
104
+ var mapDateFormat = function mapDateFormat(props, field) {
105
+ var _ref = field.component || [],
106
+ _ref2 = _slicedToArray(_ref, 1),
107
+ component = _ref2[0];
108
+
109
+ console.log(component);
110
+ return {};
111
+ };
112
+
113
+ export default mapDateFormat;
@@ -1,4 +1,4 @@
1
- var _excluded = ["form", "schema", "onSubmit", "onChange", "defaultFilterValue", "activeFilterValueRef"];
1
+ var _excluded = ["form", "schema", "onSubmit", "onChange", "defaultFilterValue", "filterValues", "activeFilterValueRef"];
2
2
 
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
 
@@ -26,6 +26,7 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
26
26
  onSubmit = props.onSubmit,
27
27
  onChange = props.onChange,
28
28
  defaultFilterValue = props.defaultFilterValue,
29
+ filterValues = props.filterValues,
29
30
  activeFilterValueRef = props.activeFilterValueRef,
30
31
  otherProps = _objectWithoutProperties(props, _excluded);
31
32
 
@@ -48,15 +49,24 @@ var LightFilter = /*#__PURE__*/memo(function (props) {
48
49
  }, [form]); // 实际输出onFilter
49
50
 
50
51
  var onFilter = useCallback(function () {
52
+ var _Object$keys;
53
+
51
54
  var key = filterValue.current;
52
- var value = form.values[key];
53
- onChange === null || onChange === void 0 ? void 0 : onChange(_defineProperty({}, key, value));
55
+ var value = form.values[key]; // 删除旧值
56
+
57
+ (_Object$keys = Object.keys(form.values)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (item) {
58
+ if (item !== key) {
59
+ form.setValuesIn(item, undefined);
60
+ }
61
+ });
62
+ onChange === null || onChange === void 0 ? void 0 : onChange(_defineProperty({}, key, value), value, key);
54
63
  }, [onChange]);
55
64
  var LightSchema = useMemo(function () {
56
65
  return [{
57
66
  component: 'LightFilter',
58
67
  props: {
59
68
  defaultFilterValue: defaultFilterValue,
69
+ filterValues: filterValues,
60
70
  onFilterChange: onFilterChange,
61
71
  buttonProps: {
62
72
  onClick: onFilter
@@ -84,7 +84,7 @@ var SimpleFilter = /*#__PURE__*/memo(function (props) {
84
84
  } else {
85
85
  onChange === null || onChange === void 0 ? void 0 : onChange(values, name, value);
86
86
  }
87
- }, [searchName, searchValue.current]);
87
+ }, [onChange, searchName, searchValue.current]);
88
88
  useEffect(function () {
89
89
  var _props$form$initialVa, _props$form$initialVa2;
90
90
 
@@ -1,4 +1,4 @@
1
- var _excluded = ["addonAfter", "addonBefore", "mode", "purePanel", "expand", "formRef", "defaultFilterValue", "filterDebounce", "onFilter", "onInit", "onReset", "onExpand"];
1
+ var _excluded = ["addonAfter", "addonBefore", "mode", "purePanel", "expand", "formRef", "defaultFilterValue", "filterValues", "filterDebounce", "onFilter", "onInit", "onReset", "onExpand", "onChange"];
2
2
 
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
 
@@ -62,11 +62,13 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
62
62
  expand = props.expand,
63
63
  formRef = props.formRef,
64
64
  defaultFilterValue = props.defaultFilterValue,
65
+ filterValues = props.filterValues,
65
66
  filterDebounce = props.filterDebounce,
66
67
  onFilter = props.onFilter,
67
68
  onInit = props.onInit,
68
69
  onReset = props.onReset,
69
70
  onExpand = props.onExpand,
71
+ onChange = props.onChange,
70
72
  otherProps = _objectWithoutProperties(props, _excluded);
71
73
 
72
74
  var _useSpecialProps = useSpecialProps(props),
@@ -152,6 +154,7 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
152
154
  if (!formRef.current.updateTags) {
153
155
  formRef.current.updateTags = function () {
154
156
  configFilterItem(form);
157
+ configTag();
155
158
  };
156
159
  }
157
160
  }
@@ -327,7 +330,13 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
327
330
  return function (_x) {
328
331
  return _ref4.apply(this, arguments);
329
332
  };
330
- }(), [onFilter, hasRequired, onInit]); // 轻量搜索Filter
333
+ }(), [onFilter, hasRequired, onInit]); // 简单搜索Change
334
+
335
+ var onSimpleChange = useCallback(function (values, fieldValue, fieldName) {
336
+ if (currentForm.current === 'simple') {
337
+ onChange === null || onChange === void 0 ? void 0 : onChange(values, fieldValue, fieldName);
338
+ }
339
+ }, [onChange]); // 轻量搜索Filter
331
340
 
332
341
  var onLightFilter = useCallback(function (values) {
333
342
  if (currentForm.current === 'light') {
@@ -345,7 +354,13 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
345
354
  configTag();
346
355
  }
347
356
  }
348
- }, [onFilter]); // 高级搜索Filter by Submit
357
+ }, [onFilter]); // 轻量搜索Change
358
+
359
+ var onLightChange = useCallback(function (values, fieldValue, fieldName) {
360
+ if (currentForm.current === 'light') {
361
+ onChange === null || onChange === void 0 ? void 0 : onChange(values, fieldValue, fieldName);
362
+ }
363
+ }, [onChange]); // 高级搜索Filter
349
364
 
350
365
  var onAdvancedFilter = useCallback(function (values) {
351
366
  setCurrentForm('advanced');
@@ -365,9 +380,9 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
365
380
  lightForm.reset('*', {
366
381
  forceClear: true
367
382
  });
368
- }, [onReset]); // 高级搜索Filter by Change
383
+ }, [onReset]); // 高级搜索Init
369
384
 
370
- var onAdvancedChange = useCallback( /*#__PURE__*/function () {
385
+ var onAdvancedInit = useCallback( /*#__PURE__*/function () {
371
386
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(values) {
372
387
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
373
388
  while (1) {
@@ -412,7 +427,13 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
412
427
  return function (_x2) {
413
428
  return _ref5.apply(this, arguments);
414
429
  };
415
- }(), [hasRequired, onInit]); // 关闭标签清空表单字段值
430
+ }(), [hasRequired, onInit]); // 高级搜索Change
431
+
432
+ var onAdvancedChange = useCallback(function (values, fieldValue, fieldName) {
433
+ if (currentForm.current === 'advanced') {
434
+ onChange === null || onChange === void 0 ? void 0 : onChange(values, fieldValue, fieldName);
435
+ }
436
+ }, [onChange]); // 关闭标签清空表单字段值
416
437
 
417
438
  var onTagClose = useCallback(function (key, index) {
418
439
  var newValue = undefined;
@@ -432,7 +453,10 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
432
453
  form.setState({
433
454
  loading: false
434
455
  });
435
- }, []); // 组件挂载
456
+ }, []);
457
+ var debounceFun = debounce(function (fun, props) {
458
+ return fun(props);
459
+ }, filterDebounce); // 组件挂载
436
460
 
437
461
  useEffect(function () {
438
462
  setCurrentForm(currentForm.current);
@@ -448,20 +472,30 @@ var QueryFilter = /*#__PURE__*/memo(function (props) {
448
472
  className: cls("".concat(prefixCls, "-inline"), purePanel || hasRequired ? "".concat(prefixCls, "-inline-hidden") : '')
449
473
  }, /*#__PURE__*/React.createElement(LightFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
450
474
  defaultFilterValue: defaultFilterValue,
475
+ filterValues: filterValues,
451
476
  activeFilterValueRef: activeFilterValueRef,
452
477
  form: lightForm,
453
- onChange: debounce(onLightFilter, filterDebounce)
478
+ onChange: function onChange(values, fieldValue, fieldName) {
479
+ debounceFun(onLightFilter, values);
480
+ onLightChange(values, fieldValue, fieldName);
481
+ }
454
482
  }))) : /*#__PURE__*/React.createElement("div", {
455
483
  className: "".concat(prefixCls, "-inline")
456
484
  }, /*#__PURE__*/React.createElement(SimpleFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
457
485
  form: simpleForm,
458
- onChange: debounce(onSimpleFilter, filterDebounce),
486
+ onChange: function onChange(values, fieldValue, fieldName) {
487
+ debounceFun(onSimpleFilter, values);
488
+ onSimpleChange(values, fieldValue, fieldName);
489
+ },
459
490
  onSubmit: onSimpleFilter,
460
491
  onInitialComplete: onInitialComplete
461
492
  }))),
462
493
  panelContent: mode === 'panel' ? /*#__PURE__*/React.createElement(AdvancedFilter, _objectSpread(_objectSpread({}, otherProps), {}, {
463
494
  form: advancedForm,
464
- onChange: debounce(onAdvancedChange, filterDebounce),
495
+ onChange: function onChange(values, fieldValue, fieldName) {
496
+ debounceFun(onAdvancedInit, values);
497
+ onAdvancedChange(values, fieldValue, fieldName);
498
+ },
465
499
  onSubmit: onAdvancedFilter,
466
500
  onReset: onAdvancedReset,
467
501
  onInitialComplete: onInitialComplete
@@ -6,6 +6,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import { connect, mapProps } from '@formily/react';
8
8
  import { toJS } from '@formily/reactive';
9
+ import { mapSize, mapStatus, mapDataSource } from '../utils';
9
10
 
10
11
  var customComponent = function customComponent(component) {
11
12
  return connect(component, mapProps(function (props, field) {
@@ -14,7 +15,7 @@ var customComponent = function customComponent(component) {
14
15
  form: field.form,
15
16
  values: toJS(field.form.values)
16
17
  });
17
- }));
18
+ }, mapSize, mapStatus, mapDataSource));
18
19
  };
19
20
 
20
21
  export { customComponent };
@@ -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, isSignificative, getValueByValue } from '@teamix/utils';
15
+ import { isArr, isPlainObj, isUsable, getValueByValue } from '@teamix/utils';
16
16
  import fieldTypeMap from '../fieldTypeMap';
17
17
  /**
18
18
  * 获取表单值的可显示值
@@ -44,7 +44,7 @@ var getDisplayValues = function getDisplayValues(form, values) {
44
44
 
45
45
  var isFieldValue = Object.keys(fieldTypeMap).includes(field === null || field === void 0 ? void 0 : field.component[0]); // 判断值的类型,递归获取每个值在该结构中的完整路径
46
46
 
47
- if (!isSignificative(values)) {
47
+ if (!isUsable(values)) {
48
48
  displayValues = {};
49
49
  } else if (isPlainObj(values) && !isFieldValue) {
50
50
  // 如果值是布局对象的值
@@ -20,7 +20,7 @@ export default (function (decorator, component) {
20
20
  return decorator;
21
21
  }
22
22
 
23
- if ([].concat(_toConsumableArray(Object.keys(fieldTypeMap)), ['Upload', 'ArrayCards', 'ArrayCollapse', 'ArrayTable', 'ArrayItems']).includes(component)) {
23
+ if ([].concat(_toConsumableArray(Object.keys(fieldTypeMap)), ['Upload', 'SelectTable', 'ArrayCards', 'ArrayCollapse', 'ArrayTable', 'ArrayItems']).includes(component)) {
24
24
  return 'FormItem';
25
25
  }
26
26
 
@@ -47,11 +47,8 @@ var typeMap = (_typeMap = {
47
47
  Range: 'string',
48
48
  Search: 'array',
49
49
  SelectGroup: 'array',
50
- ArrayCollapse: 'array',
51
- ArrayCards: 'array',
52
- ArrayTable: 'array',
53
- ArrayItems: 'array'
54
- }, _defineProperty(_typeMap, 'Editable.Popover', 'object'), _defineProperty(_typeMap, 'Editable.Dialog', 'object'), _defineProperty(_typeMap, 'Editable.Drawer', 'object'), _typeMap);
50
+ SelectTable: 'array'
51
+ }, _defineProperty(_typeMap, 'SelectTable.Column', 'string'), _defineProperty(_typeMap, "ArrayCollapse", 'array'), _defineProperty(_typeMap, "ArrayCards", 'array'), _defineProperty(_typeMap, "ArrayTable", 'array'), _defineProperty(_typeMap, "ArrayItems", 'array'), _defineProperty(_typeMap, 'Editable.Popover', 'object'), _defineProperty(_typeMap, 'Editable.Dialog', 'object'), _defineProperty(_typeMap, 'Editable.Drawer', 'object'), _typeMap);
55
52
  export default (function (type, component) {
56
53
  return type || typeMap[component] || 'void';
57
54
  });
@@ -33,7 +33,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
33
33
  import React, { memo, useCallback, useMemo } from 'react';
34
34
  import { createSchemaField } from '@formily/react';
35
35
  import { Affix } from '@alicloudfe/components';
36
- import { Upload, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
36
+ import { Upload, SelectTable, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
37
37
  import ProFieldComponents from '../Components/ProField';
38
38
  import { EditableDialog, EditableDrawer, EditablePopover } from '../Components/Editable';
39
39
  import FormGroup from '../Components/FormGroup';
@@ -55,18 +55,26 @@ import initializeFormGroup from './initializeFormGroup';
55
55
  import initializeFormStep from './initializeFormStep';
56
56
  import initializeFormTab from './initializeFormTab';
57
57
  import initializeFormCollapse from './initializeFormCollapse';
58
+ import initializeSelectTable from './initializeSelectTable';
58
59
  import { $request, $common, $dataSource, $validator } from './reactions';
59
60
  import fieldTypeMap from '../fieldTypeMap';
60
61
  import { getFieldName, mapSchemaName } from '../utils';
62
+ import { getGlobalConfig } from '@teamix/utils';
61
63
  import warning from '../warning';
62
64
  export default /*#__PURE__*/memo(function (_ref) {
63
65
  var schema = _ref.schema,
64
66
  scope = _ref.scope,
65
67
  components = _ref.components;
66
- // 创建 SchemaField
68
+
69
+ // 获取全局配置
70
+ var _ref2 = getGlobalConfig('ProForm') || {},
71
+ globalComponents = _ref2.components,
72
+ globalScope = _ref2.scope; // 创建 SchemaField
73
+
74
+
67
75
  var SchemaField = useMemo(function () {
68
76
  return createSchemaField({
69
- components: _objectSpread(_objectSpread({}, ProFieldComponents), {}, {
77
+ components: _objectSpread(_objectSpread(_objectSpread({}, globalComponents), ProFieldComponents), {}, {
70
78
  FormLayout: FormLayout,
71
79
  FormItem: FormItem,
72
80
  ArrayCollapse: ArrayCollapse,
@@ -89,6 +97,7 @@ export default /*#__PURE__*/memo(function (_ref) {
89
97
  EditablePopover: EditablePopover,
90
98
  FormGroup: FormGroup,
91
99
  Upload: Upload,
100
+ SelectTable: SelectTable,
92
101
  Affix: Affix,
93
102
  LightFilter: LightFilter,
94
103
  Text: Text
@@ -97,7 +106,7 @@ export default /*#__PURE__*/memo(function (_ref) {
97
106
  }, []); // 合并 schema 中 request 的 scope
98
107
 
99
108
  var mergedScope = useMemo(function () {
100
- return _objectSpread(_objectSpread({}, scope), {}, {
109
+ return _objectSpread(_objectSpread(_objectSpread({}, globalScope), scope), {}, {
101
110
  $request: $request,
102
111
  $common: $common,
103
112
  $dataSource: $dataSource,
@@ -166,6 +175,11 @@ export default /*#__PURE__*/memo(function (_ref) {
166
175
 
167
176
  if (['FormCollapse'].includes(originalComponent)) {
168
177
  newItem = initializeFormCollapse(newItem);
178
+ } // 初始化选择表格 - SelectTable
179
+
180
+
181
+ if (['SelectTable'].includes(originalComponent)) {
182
+ newItem = initializeSelectTable(newItem);
169
183
  }
170
184
  }
171
185
 
@@ -200,13 +214,14 @@ export default /*#__PURE__*/memo(function (_ref) {
200
214
 
201
215
  var _initializeRequest = initializeRequest(request, "".concat(suffix, "r")),
202
216
  requestReactions = _initializeRequest.reactions,
203
- requestScope = _initializeRequest.scope; // 初始化dataSource,如果readPretty为字符串表达式将失去loading等状态,仍可配置dataSource
217
+ requestScope = _initializeRequest.scope; // 初始化dataSource
204
218
 
205
219
 
206
- var _initializeDataSource = initializeDataSource(dataSource, "".concat(suffix, "d"), newItem.readPretty),
220
+ var _initializeDataSource = initializeDataSource(dataSource, "".concat(suffix, "d")),
207
221
  defaultDataSource = _initializeDataSource.dataSource,
208
222
  dataSourceReactions = _initializeDataSource.reactions,
209
- dataSourceScope = _initializeDataSource.scope; // 初始化rules validator
223
+ dataSourceScope = _initializeDataSource.scope,
224
+ dataSourceData = _initializeDataSource.data; // 初始化rules validator
210
225
 
211
226
 
212
227
  var _initializeRules = initializeRules(rules, "".concat(suffix, "v")),
@@ -216,10 +231,10 @@ export default /*#__PURE__*/memo(function (_ref) {
216
231
 
217
232
  var defaultReactions = initializeReactions(reactions, [].concat(_toConsumableArray(requestReactions), _toConsumableArray(dataSourceReactions))); // 合并scope
218
233
 
219
- Object.entries(_objectSpread(_objectSpread(_objectSpread({}, requestScope), dataSourceScope), rulesScope)).map(function (_ref2) {
220
- var _ref3 = _slicedToArray(_ref2, 2),
221
- k = _ref3[0],
222
- v = _ref3[1];
234
+ Object.entries(_objectSpread(_objectSpread(_objectSpread({}, requestScope), dataSourceScope), rulesScope)).map(function (_ref3) {
235
+ var _ref4 = _slicedToArray(_ref3, 2),
236
+ k = _ref4[0],
237
+ v = _ref4[1];
223
238
 
224
239
  mergedScope[k] = v;
225
240
  });
@@ -231,9 +246,9 @@ export default /*#__PURE__*/memo(function (_ref) {
231
246
  rules: defaultRules,
232
247
  reactions: defaultReactions,
233
248
  dataSource: defaultDataSource,
234
- data: data || {
235
- placeholder: true
236
- }
249
+ data: _objectSpread(_objectSpread(_objectSpread({}, data), dataSourceData), {}, {
250
+ __placeholder: true
251
+ })
237
252
  })); // 递归子组件
238
253
 
239
254
  var recursiveProperties = (children === null || children === void 0 ? void 0 : children.length) ? {
@@ -1,11 +1,12 @@
1
1
  import type { ProFormRequestConfig } from '../typing';
2
2
  interface IInitializeDataSource {
3
- (requestConfig?: ProFormRequestConfig | any, suffix?: string, readPretty?: string | boolean): {
3
+ (requestConfig?: ProFormRequestConfig | any, suffix?: string): {
4
4
  dataSource?: any[];
5
5
  reactions: any[];
6
6
  scope: {
7
7
  [x: string]: any;
8
8
  };
9
+ data?: any;
9
10
  };
10
11
  }
11
12
  declare const initializeDataSource: IInitializeDataSource;
@@ -2,13 +2,19 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
2
2
 
3
3
  import { isPlainObj } from '@teamix/utils';
4
4
 
5
- var initializeDataSource = function initializeDataSource(dataSource, suffix, readPretty) {
5
+ var initializeDataSource = function initializeDataSource(dataSource, suffix) {
6
6
  if (isPlainObj(dataSource)) {
7
+ var _requestConfig$extraC;
8
+
7
9
  var requestConfig = dataSource;
8
10
  var requestConfigName = "$requestConfig_".concat(suffix);
9
11
  return {
10
- reactions: ["{{$dataSource($request,".concat(requestConfigName, ",context,").concat(readPretty, ")}}")],
11
- scope: _defineProperty({}, requestConfigName, requestConfig)
12
+ reactions: ["{{$dataSource($request,".concat(requestConfigName, ",context)}}")],
13
+ scope: _defineProperty({}, requestConfigName, requestConfig),
14
+ // dataSource请求时,默认配置字段为只读
15
+ data: {
16
+ readOnlyOnLoading: (requestConfig === null || requestConfig === void 0 ? void 0 : (_requestConfig$extraC = requestConfig.extraConfig) === null || _requestConfig$extraC === void 0 ? void 0 : _requestConfig$extraC.readOnly) !== false
17
+ }
12
18
  };
13
19
  }
14
20
 
@@ -0,0 +1,3 @@
1
+ import type { ProFormInitializeItem } from '../typing';
2
+ declare const initialize: ProFormInitializeItem;
3
+ export default initialize;