@teamix/pro 1.2.33 → 1.3.1

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 (93) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +17242 -17233
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/dialog-form.d.ts +9 -4
  6. package/es/actions/dialog-form.js +16 -9
  7. package/es/form/Filter/AdvancedFilter.js +4 -4
  8. package/es/form/Filter/LightFilter.js +22 -15
  9. package/es/form/Filter/index.js +200 -106
  10. package/es/form/Filter/useSpecialProps.d.ts +1 -1
  11. package/es/form/Filter/useSpecialProps.js +9 -9
  12. package/es/form/ProForm/index.js +4 -4
  13. package/es/form/ProForm/index.scss +8 -8
  14. package/es/form/SchemaForm/index.js +4 -4
  15. package/es/form/SchemaForm/initializeDataSource.d.ts +1 -1
  16. package/es/form/SchemaForm/initializeDataSource.js +2 -2
  17. package/es/form/SchemaForm/initializeRequest.d.ts +1 -1
  18. package/es/form/SchemaForm/initializeRequest.js +40 -5
  19. package/es/form/SchemaForm/reactions.d.ts +2 -2
  20. package/es/form/SchemaForm/reactions.js +39 -21
  21. package/es/form/typing.d.ts +10 -2
  22. package/es/index.d.ts +4 -4
  23. package/es/index.js +4 -4
  24. package/es/nocode/configurators/PageHeader.js +2 -2
  25. package/es/page-header/index.js +7 -3
  26. package/es/table/components/Layout/index.js +2 -2
  27. package/es/table/components/Pagination/index.js +11 -1
  28. package/es/table/components/ToolBar/Fullscreen.js +32 -4
  29. package/es/table/index.js +70 -40
  30. package/es/table/index.scss +6 -0
  31. package/es/table/typing.d.ts +10 -6
  32. package/es/table/utils/columnRender.js +1 -1
  33. package/es/timeline/ProTimeLineItem/index.d.ts +5 -0
  34. package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +59 -72
  35. package/es/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
  36. package/es/timeline/index.d.ts +10 -0
  37. package/es/{step → timeline}/index.js +33 -57
  38. package/es/timeline/index.scss +7 -0
  39. package/es/timeline/typing.d.ts +101 -0
  40. package/es/{step → timeline}/typing.js +0 -0
  41. package/lib/actions/dialog-form.d.ts +9 -4
  42. package/lib/actions/dialog-form.js +16 -9
  43. package/lib/form/Filter/AdvancedFilter.js +4 -4
  44. package/lib/form/Filter/LightFilter.js +21 -15
  45. package/lib/form/Filter/index.js +199 -105
  46. package/lib/form/Filter/useSpecialProps.d.ts +1 -1
  47. package/lib/form/Filter/useSpecialProps.js +8 -8
  48. package/lib/form/ProForm/index.js +4 -4
  49. package/lib/form/ProForm/index.scss +8 -8
  50. package/lib/form/SchemaForm/index.js +4 -4
  51. package/lib/form/SchemaForm/initializeDataSource.d.ts +1 -1
  52. package/lib/form/SchemaForm/initializeDataSource.js +2 -2
  53. package/lib/form/SchemaForm/initializeRequest.d.ts +1 -1
  54. package/lib/form/SchemaForm/initializeRequest.js +40 -5
  55. package/lib/form/SchemaForm/reactions.d.ts +2 -2
  56. package/lib/form/SchemaForm/reactions.js +38 -20
  57. package/lib/form/typing.d.ts +10 -2
  58. package/lib/index.d.ts +4 -4
  59. package/lib/index.js +10 -10
  60. package/lib/nocode/configurators/PageHeader.js +2 -2
  61. package/lib/page-header/index.js +6 -2
  62. package/lib/table/components/Layout/index.js +2 -2
  63. package/lib/table/components/Pagination/index.js +10 -0
  64. package/lib/table/components/ToolBar/Fullscreen.js +30 -3
  65. package/lib/table/index.js +70 -40
  66. package/lib/table/index.scss +6 -0
  67. package/lib/table/typing.d.ts +10 -6
  68. package/lib/table/utils/columnRender.js +1 -1
  69. package/lib/timeline/ProTimeLineItem/index.d.ts +5 -0
  70. package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.js +58 -72
  71. package/lib/{step/ProStepItem/components/VerStepItem → timeline/ProTimeLineItem}/index.scss +34 -86
  72. package/lib/timeline/index.d.ts +10 -0
  73. package/lib/{step → timeline}/index.js +38 -58
  74. package/lib/timeline/index.scss +7 -0
  75. package/lib/timeline/typing.d.ts +101 -0
  76. package/lib/{step → timeline}/typing.js +0 -0
  77. package/package.json +1 -1
  78. package/es/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
  79. package/es/step/ProStepItem/components/HozStepItem/index.js +0 -235
  80. package/es/step/ProStepItem/components/HozStepItem/index.scss +0 -279
  81. package/es/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
  82. package/es/step/ProStepItem/index.d.ts +0 -4
  83. package/es/step/ProStepItem/index.js +0 -57
  84. package/es/step/index.d.ts +0 -9
  85. package/es/step/typing.d.ts +0 -96
  86. package/lib/step/ProStepItem/components/HozStepItem/index.d.ts +0 -5
  87. package/lib/step/ProStepItem/components/HozStepItem/index.js +0 -258
  88. package/lib/step/ProStepItem/components/HozStepItem/index.scss +0 -279
  89. package/lib/step/ProStepItem/components/VerStepItem/index.d.ts +0 -5
  90. package/lib/step/ProStepItem/index.d.ts +0 -4
  91. package/lib/step/ProStepItem/index.js +0 -69
  92. package/lib/step/index.d.ts +0 -9
  93. package/lib/step/typing.d.ts +0 -96
@@ -1,12 +1,47 @@
1
+ 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; }
2
+
3
+ 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; }
4
+
1
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
6
 
7
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
+
9
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+
11
+ 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); }
12
+
13
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
+
15
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
16
+
17
+ 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; }
18
+
19
+ import { isArr } from '@teamix/utils';
20
+
3
21
  var initializeRequest = function initializeRequest(requestConfig, suffix) {
4
22
  if (requestConfig) {
5
- var requestConfigName = "$requestConfig_".concat(suffix);
6
- return {
7
- reactions: ["{{$common($request,".concat(requestConfigName, ",context)}}")],
8
- scope: _defineProperty({}, requestConfigName, requestConfig)
9
- };
23
+ if (isArr(requestConfig)) {
24
+ var reactionsMap = [];
25
+ var scopeMap = {};
26
+ requestConfig.forEach(function (item, index) {
27
+ var _initializeRequest = initializeRequest(item, "".concat(suffix).concat(index)),
28
+ reactions = _initializeRequest.reactions,
29
+ scope = _initializeRequest.scope;
30
+
31
+ reactionsMap = [].concat(_toConsumableArray(reactionsMap), _toConsumableArray(reactions));
32
+ scopeMap = _objectSpread(_objectSpread({}, scopeMap), scope);
33
+ });
34
+ return {
35
+ reactions: reactionsMap,
36
+ scope: scopeMap
37
+ };
38
+ } else {
39
+ var requestConfigName = "$requestConfig_".concat(suffix);
40
+ return {
41
+ reactions: ["{{$common($request,".concat(requestConfigName, ",context)}}")],
42
+ scope: _defineProperty({}, requestConfigName, requestConfig)
43
+ };
44
+ }
10
45
  }
11
46
 
12
47
  return {
@@ -1,6 +1,6 @@
1
1
  import type { ProFormRequestConfig } from '../typing';
2
- declare const $request: (field: any, requestConfig: ProFormRequestConfig, context: any) => Promise<unknown>;
2
+ declare const $request: (field: any, requestConfig: ProFormRequestConfig, context: any, type: 'request' | 'validator' | 'dataSource') => Promise<unknown>;
3
3
  declare const $common: (services: any, requestConfig: ProFormRequestConfig, context: any) => (field: any) => any;
4
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;
5
+ declare const $dataSource: (services: any, requestConfig: ProFormRequestConfig, context: any, readPretty: any) => (field: any) => any;
6
6
  export { $request, $common, $dataSource, $validator };
@@ -4,16 +4,21 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- import { isFn, isPlainObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
7
+ import { isFn, isPureObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
8
8
 
9
- var $request = function $request(field, requestConfig, context) {
9
+ var $request = function $request(field, requestConfig, context, type) {
10
10
  var _field$data;
11
11
 
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
12
  var beforeRequest = requestConfig.beforeRequest,
14
13
  onSuccess = requestConfig.onSuccess;
15
- var refreshResult = isPlainObj(refresh) ? refresh : {};
16
14
  var beforeRequestResult = isFn(beforeRequest) ? beforeRequest(field, context) : {};
15
+ /**
16
+ * // 主动触发的请求刷新
17
+ */
18
+ // 触发所有配置的请求
19
+
20
+ var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
21
+ var refreshResult = isPureObj(refresh) ? refresh : {};
17
22
  return doCommonRequest(_objectSpread(_objectSpread({}, requestConfig), {}, {
18
23
  params: _objectSpread(_objectSpread(_objectSpread({}, requestConfig.params), beforeRequestResult), refreshResult),
19
24
  beforeRequest: function beforeRequest() {
@@ -28,7 +33,7 @@ var $request = function $request(field, requestConfig, context) {
28
33
 
29
34
  var $common = function $common(services, requestConfig, context) {
30
35
  return function (field) {
31
- return services(field, requestConfig, context).then(function (res) {
36
+ return services(field, requestConfig, context, 'request').then(function (res) {
32
37
  return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
33
38
  });
34
39
  };
@@ -38,35 +43,48 @@ var $common = function $common(services, requestConfig, context) {
38
43
  var $validator = function $validator(services, requestConfig, context) {
39
44
  return function (value, rules, _ref) {
40
45
  var field = _ref.field;
41
- return services(field, requestConfig, context).then(function (res) {
46
+ return services(field, requestConfig, context, 'validator').then(function (res) {
42
47
  return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
43
48
  });
44
49
  };
45
50
  }; // 配置DataSource
46
51
 
47
52
 
48
- var $dataSource = function $dataSource(services, requestConfig, context) {
53
+ var $dataSource = function $dataSource(services, requestConfig, context, readPretty) {
49
54
  return function (field) {
50
- field.setState({
51
- loading: true,
52
- readOnly: true
53
- });
54
- return services(field, requestConfig, context).then(function (res) {
55
+ if (!readPretty) {
56
+ field.setState({
57
+ loading: true,
58
+ readOnly: true
59
+ });
60
+ }
61
+
62
+ return services(field, requestConfig, context, 'dataSource').then(function (res) {
55
63
  var isValueInDataSource = getValueByValue(res, field.value);
56
64
  var clearValue = isValueInDataSource ? {} : {
57
65
  value: undefined
58
66
  };
59
- field.setState(_objectSpread({
60
- dataSource: res,
61
- loading: false,
62
- readOnly: false
63
- }, clearValue));
67
+
68
+ if (!readPretty) {
69
+ field.setState(_objectSpread({
70
+ dataSource: res,
71
+ loading: false,
72
+ readOnly: false
73
+ }, clearValue));
74
+ } else {
75
+ field.setState({
76
+ dataSource: res
77
+ });
78
+ }
79
+
64
80
  return requestConfig.onComplete && requestConfig.onComplete(res, field, context);
65
81
  }).catch(function () {
66
- field.setState({
67
- loading: false,
68
- readOnly: false
69
- });
82
+ if (!readPretty) {
83
+ field.setState({
84
+ loading: false,
85
+ readOnly: false
86
+ });
87
+ }
70
88
  });
71
89
  };
72
90
  };
@@ -10,6 +10,10 @@ declare type FieldDisplayTypes = 'none' | 'hidden' | 'visible';
10
10
  export interface ProFormInitializeItem {
11
11
  (item: ProFormSchemaItem, props?: any): ProFormSchemaItem;
12
12
  }
13
+ /**
14
+ * ProForm 实例类型
15
+ */
16
+ export declare type ProFormType = FormType;
13
17
  declare type IBaseComponent = 'Input' | 'Password' | 'TextArea' | 'NumberPicker' | 'Percent' | 'Money' | 'Select' | 'MultipleSelect' | 'TreeSelect' | 'Cascader' | 'MultipleCascader' | 'ArbitraryCascader' | 'Radio' | 'Checkbox' | 'Switch' | 'DatePicker' | 'TimePicker' | 'DateTimePicker' | 'WeekPicker' | 'MonthPicker' | 'YearPicker' | 'QuarterPicker' | 'DateRangePicker' | 'TimeRangePicker' | 'DateTimeRangePicker' | 'WeekRangePicker' | 'MonthRangePicker' | 'YearRangePicker' | 'QuarterRangePicker' | 'Transfer' | 'Upload' | 'ColorPicker' | 'ColorRadio' | 'IconPicker' | 'JsonInput' | 'TagPicker' | 'MultipleTagPicker' | 'Range' | 'Search' | 'SelectGroup';
14
18
  declare type IButtonComponent = 'Submit' | 'Reset';
15
19
  declare type IComboComponent = 'ArrayCards' | 'ArrayCards.Addition' | 'ArrayCards.Remove' | 'ArrayCards.MoveUp' | 'ArrayCards.MoveDown' | 'ArrayCards.Index' | 'ArrayCollapse' | 'ArrayCollapse.CollapsePanel' | 'ArrayCollapse.Addition' | 'ArrayCollapse.Remove' | 'ArrayCollapse.MoveUp' | 'ArrayCollapse.MoveDown' | 'ArrayCollapse.Index' | 'ArrayTable' | 'ArrayTable.Column' | 'ArrayTable.SortHandle' | 'ArrayTable.Addition' | 'ArrayTable.Remove' | 'ArrayTable.MoveDown' | 'ArrayTable.MoveUp' | 'ArrayTable.Index' | 'ArrayItems' | 'ArrayItems.Item' | 'ArrayItems.SortHandle' | 'ArrayItems.Addition' | 'ArrayItems.Remove' | 'ArrayItems.MoveDown' | 'ArrayItems.MoveUp' | 'ArrayItems.Index' | 'Editable' | 'Editable.Popover' | 'Editable.Dialog' | 'Editable.Drawer';
@@ -44,7 +48,7 @@ export interface ProFormSchemaItem {
44
48
  readPretty?: boolean | string;
45
49
  pattern?: FieldPatternTypes;
46
50
  default?: any;
47
- request?: ProFormRequestConfig;
51
+ request?: ProFormRequestConfig | ProFormRequestConfig[];
48
52
  data?: AnyObject;
49
53
  }
50
54
  export declare type ProFormSchema = ProFormSchemaItem[];
@@ -63,12 +67,14 @@ export interface ProFormProps extends IFormLayoutProps {
63
67
  onChange?: (values: any, fieldValue?: any, fieldName?: any) => any;
64
68
  onSubmit?: ((values: any) => any) | CommonRequestConfig;
65
69
  onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
70
+ onInitialComplete?: (form: FormType) => void;
66
71
  }
67
72
  export interface FilterProps extends ProFormProps {
68
73
  form: FormType;
69
74
  defaultFilterValue?: string;
75
+ activeFilterValueRef?: React.MutableRefObject<any>;
76
+ forceClear?: boolean;
70
77
  onReset?: (payload?: any) => void;
71
- onResetClick?: () => void;
72
78
  }
73
79
  export interface QueryFilterLayoutProps {
74
80
  prefixCls?: string;
@@ -92,6 +98,8 @@ export interface QueryFilterProps extends ProFormProps {
92
98
  purePanel?: boolean;
93
99
  /** 面板是否默认展开,仅在 mode='panel' 时生效 */
94
100
  expand?: boolean;
101
+ /** 是否强制清除 */
102
+ forceClear?: boolean;
95
103
  /** 顶部筛选区前缀 */
96
104
  addonBefore?: ReactNode;
97
105
  /** 顶部筛选区后缀 */
package/es/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import ProPageHeader from './page-header';
9
9
  import ProTable from './table';
10
10
  import ProSkeleton from './skeleton';
11
11
  import utils from './utils';
12
- import { ProStep } from './step';
12
+ import { ProTimeline } from './timeline';
13
13
  import * as nocode from './nocode';
14
14
  import * as templates from './templates';
15
15
  export * from './actions';
@@ -23,6 +23,6 @@ export * from './page-header';
23
23
  export * from './skeleton';
24
24
  export * from './table';
25
25
  export * from './utils';
26
- export * from './step';
27
- declare const version = "1.2.33";
28
- export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProStep, hooks, nocode, templates, utils, };
26
+ export * from './timeline';
27
+ declare const version = "1.3.1";
28
+ export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProTimeline, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -11,7 +11,7 @@ import ProTable from './table';
11
11
  import ProSkeleton from './skeleton';
12
12
  import utils from './utils'; // import ProSidebar from './sidebar'
13
13
 
14
- import { ProStep } from './step';
14
+ import { ProTimeline } from './timeline';
15
15
  import * as nocode from './nocode';
16
16
  import * as templates from './templates';
17
17
  import TeamixIcon from '@teamix/icon'; // 设置图标源
@@ -29,8 +29,8 @@ export * from './skeleton';
29
29
  export * from './table';
30
30
  export * from './utils'; // export * from './sidebar';
31
31
 
32
- export * from './step';
33
- var version = '1.2.33';
32
+ export * from './timeline';
33
+ var version = '1.3.1';
34
34
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
35
35
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
36
- ProStep, hooks, nocode, templates, utils };
36
+ ProTimeline, hooks, nocode, templates, utils };
@@ -80,11 +80,11 @@ var schema = [{
80
80
  }, {
81
81
  name: 'iconColor',
82
82
  title: '图标颜色',
83
- component: 'ColorSwatches'
83
+ component: 'ColorPicker'
84
84
  }, {
85
85
  name: 'iconBackgroundColor',
86
86
  title: '图标背景颜色',
87
- component: 'ColorSwatches'
87
+ component: 'ColorPicker'
88
88
  }, {
89
89
  name: 'iconBackgroundType',
90
90
  title: '图标背景形状',
@@ -17,7 +17,7 @@ import { useHistory } from 'react-router-dom';
17
17
  import classnames from 'classnames';
18
18
  import TeamixIcon from '@teamix/icon';
19
19
  import { Breadcrumb } from '@alicloudfe/components';
20
- import { baseClass, goToLink, renderTags, isPresetColor, getColorClassName, getBackgroundColorClassName } from '@teamix/utils';
20
+ import { baseClass, goToLink, renderTags, isPresetColor, getColor, getColorClassName, getBackgroundColorClassName } from '@teamix/utils';
21
21
  import { ProActionGroup } from '../actions';
22
22
  import { ProSkeletonRaw } from '../skeleton';
23
23
  import ProInfo from '../info';
@@ -69,8 +69,12 @@ var getColorAndStyle = function getColorAndStyle(color, backgroundColor, backgro
69
69
  var isColorPresetColor = isPresetColor(color);
70
70
  var isBgColorPresetColor = isPresetColor(backgroundColor);
71
71
  var className = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(getColorClassName(color)), isColorPresetColor), _defineProperty(_classnames, "".concat(getBackgroundColorClassName(backgroundColor)), isBgColorPresetColor), _defineProperty(_classnames, "".concat(cls("bg-type-".concat(backgroundType))), !!backgroundType), _classnames));
72
- var styleColor = isColorPresetColor ? undefined : color;
73
- var styleBgColor = isBgColorPresetColor ? undefined : backgroundColor;
72
+ var styleColor = isColorPresetColor ? getColor(color) : color;
73
+ var styleBgColor = isBgColorPresetColor ? getColor(backgroundColor) : backgroundColor; // debugger;
74
+ // console.log('color', color);
75
+ // console.log('backgroundColor', backgroundColor);
76
+ // console.log('styleBgColor', styleBgColor);
77
+
74
78
  var style = {
75
79
  color: styleColor,
76
80
  backgroundColor: styleBgColor
@@ -152,13 +152,13 @@ var Layout = function Layout(props) {
152
152
  className: cls('wrapper')
153
153
  }, /*#__PURE__*/React.createElement("div", {
154
154
  className: cls('left')
155
- }, header && /*#__PURE__*/React.createElement(Header, _objectSpread({}, header)), (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema3 = dataFilter.schema) === null || _dataFilter$schema3 === void 0 ? void 0 : _dataFilter$schema3.length) && renderQueryFilter()), /*#__PURE__*/React.createElement("div", {
155
+ }, header && /*#__PURE__*/React.createElement(Header, _objectSpread({}, header))), /*#__PURE__*/React.createElement("div", {
156
156
  className: cls('right')
157
157
  }, extra && /*#__PURE__*/React.createElement(QuickAction, {
158
158
  actionRef: actionRef,
159
159
  quickAction: extra,
160
160
  rowSelection: rowSelection
161
- }), !(dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema4 = dataFilter.schema) === null || _dataFilter$schema4 === void 0 ? void 0 : _dataFilter$schema4.length) && renderQueryFilter())));
161
+ }), !(dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema3 = dataFilter.schema) === null || _dataFilter$schema3 === void 0 ? void 0 : _dataFilter$schema3.length) && renderQueryFilter())), (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema4 = dataFilter.schema) === null || _dataFilter$schema4 === void 0 ? void 0 : _dataFilter$schema4.length) && renderQueryFilter());
162
162
  } else if (!header && mainAction) {
163
163
  return /*#__PURE__*/React.createElement(React.Fragment, null, renderQueryFilter());
164
164
  } else if (!header && !mainAction) {
@@ -23,7 +23,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
23
23
  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; }
24
24
 
25
25
  // 自适应宽度的翻页器
26
- import React, { useState } from 'react';
26
+ import React, { useState, useEffect } from 'react';
27
27
  import { Pagination, Balloon, Select, Button, Input, Icon } from '@alicloudfe/components';
28
28
  import { getMessage, baseClass } from '@teamix/utils';
29
29
  import { useResponsiveProps } from '@teamix/hooks';
@@ -46,6 +46,13 @@ export default (function (props) {
46
46
  responsiveProps = _useResponsiveProps.responsiveProps,
47
47
  paginationWrapperRef = _useResponsiveProps.ref;
48
48
 
49
+ useEffect(function () {
50
+ // size='mini' 模式下 current 受控
51
+ if (responsiveProps === 'mini') {
52
+ setCurrentPage(current);
53
+ }
54
+ }, [current]);
55
+
49
56
  var _useState = useState(false),
50
57
  _useState2 = _slicedToArray(_useState, 2),
51
58
  visible = _useState2[0],
@@ -82,6 +89,9 @@ export default (function (props) {
82
89
  text: true,
83
90
  onMouseEnter: function onMouseEnter() {
84
91
  return setVisible(true);
92
+ },
93
+ style: {
94
+ lineHeight: '18px'
85
95
  }
86
96
  }, getMessage('total', {
87
97
  total: total
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { Message, Overlay } from '@alicloudfe/components';
3
3
  import './index.scss';
4
- import { getMessage } from '@teamix/utils';
4
+ import { getMessage, getValidValues } from '@teamix/utils';
5
5
 
6
6
  var FullScreen = function FullScreen(props) {
7
7
  var children = props.children,
@@ -9,7 +9,8 @@ var FullScreen = function FullScreen(props) {
9
9
  actionRef = props.actionRef;
10
10
  var _actionRef$current = actionRef.current,
11
11
  normalDataFilterForm = _actionRef$current.normalDataFilterForm,
12
- fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm;
12
+ fullscreenDataFilterForm = _actionRef$current.fullscreenDataFilterForm,
13
+ filterEnableRef = _actionRef$current.filterEnableRef;
13
14
 
14
15
  var closeByESC = function closeByESC(e) {
15
16
  if (visible && e.code === 'Escape') {
@@ -28,12 +29,39 @@ var FullScreen = function FullScreen(props) {
28
29
  }, [visible, actionRef]);
29
30
 
30
31
  var afterClose = function afterClose() {
31
- normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm.values);
32
+ // 判断全屏前后筛选表单值是否有改变
33
+ var n = JSON.stringify(getValidValues(normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.values));
34
+ var f = JSON.stringify(getValidValues(fullscreenDataFilterForm === null || fullscreenDataFilterForm === void 0 ? void 0 : fullscreenDataFilterForm.values));
35
+
36
+ if (n === f) {
37
+ // 关闭全屏后,表单值未变化,开启普通表单onFilter
38
+ filterEnableRef.current.normal = true;
39
+ } else {
40
+ // 关闭全屏后,表单值有变化,修改表单值
41
+ normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.setValues(fullscreenDataFilterForm === null || fullscreenDataFilterForm === void 0 ? void 0 : fullscreenDataFilterForm.values);
42
+ } // 关闭全屏后,关闭全屏表单onFilter
43
+
44
+
45
+ filterEnableRef.current.fullscreen = false;
32
46
  }; // 全屏开启之后
33
47
 
34
48
 
35
49
  var afterOpen = function afterOpen() {
36
- fullscreenDataFilterForm.setValues(normalDataFilterForm.values);
50
+ // 判断全屏前后筛选表单值是否有改变
51
+ var n = JSON.stringify(getValidValues(normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.values));
52
+ var f = JSON.stringify(getValidValues(fullscreenDataFilterForm === null || fullscreenDataFilterForm === void 0 ? void 0 : fullscreenDataFilterForm.values));
53
+
54
+ if (n === f) {
55
+ // 全屏后,表单值未变化,开启全屏表单onFilter
56
+ filterEnableRef.current.fullscreen = true;
57
+ } else {
58
+ // 全屏后,表单值变化,修改表单值
59
+ fullscreenDataFilterForm === null || fullscreenDataFilterForm === void 0 ? void 0 : fullscreenDataFilterForm.setValues(normalDataFilterForm === null || normalDataFilterForm === void 0 ? void 0 : normalDataFilterForm.values);
60
+ } // 全屏后,关闭普通表单onFilter
61
+
62
+
63
+ filterEnableRef.current.normal = false; // 消息提示
64
+
37
65
  Message.show({
38
66
  type: 'notice',
39
67
  content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, getMessage('press')), /*#__PURE__*/React.createElement("span", {
package/es/table/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams"];
1
+ var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords"];
2
2
 
3
3
  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); }
4
4
 
@@ -121,7 +121,7 @@ var globalFormatSort = function globalFormatSort(sort) {
121
121
  };
122
122
 
123
123
  var ProTable = function ProTable(props) {
124
- var _rowSelection$selecte, _dataFilterForm4;
124
+ var _rowSelection$selecte;
125
125
 
126
126
  var header = props.header,
127
127
  className = props.className,
@@ -176,6 +176,8 @@ var ProTable = function ProTable(props) {
176
176
  _props$filterColumnTy = props.filterColumnType,
177
177
  filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
178
178
  defaultFilterParams = props.defaultFilterParams,
179
+ _props$reserveSelecte = props.reserveSelectedRecords,
180
+ reserveSelectedRecords = _props$reserveSelecte === void 0 ? false : _props$reserveSelecte,
179
181
  otherProps = _objectWithoutProperties(props, _excluded);
180
182
 
181
183
  var targetPageKey = pageKey || globalPageKey;
@@ -287,16 +289,21 @@ var ProTable = function ProTable(props) {
287
289
  var _useState27 = useState(false),
288
290
  _useState28 = _slicedToArray(_useState27, 2),
289
291
  fullscreenState = _useState28[0],
290
- setFullscreenState = _useState28[1]; // 非全屏状态下的
292
+ setFullscreenState = _useState28[1]; // 切换全屏搜索开关
291
293
 
292
294
 
295
+ var filterEnableRef = useRef({
296
+ fullscreen: false,
297
+ normal: true
298
+ }); // 非全屏状态下的
299
+
293
300
  var normalDataFilterFormRef = useRef();
294
301
  var fullscreenDataFilterFormRef = useRef();
295
302
  var normalDataFilterForm = normalDataFilterFormRef.current;
296
303
  var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current; // 传给 QueryFilter 的 formRef
297
304
 
298
- var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
299
- var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
305
+ var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef; // let dataFilterForm = dataFilterFormRef.current;
306
+ // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
300
307
 
301
308
  var _useState29 = useState(false),
302
309
  _useState30 = _slicedToArray(_useState29, 2),
@@ -334,7 +341,7 @@ var ProTable = function ProTable(props) {
334
341
  result = propsRowSelection.getProps(record, index);
335
342
  }
336
343
 
337
- if (showSkeleton) {
344
+ if (showSkeleton && result) {
338
345
  result.disabled = true;
339
346
  }
340
347
 
@@ -505,12 +512,12 @@ var ProTable = function ProTable(props) {
505
512
  _request(params);
506
513
  },
507
514
  reset: function reset() {
508
- var _actionRef$current4, _actionRef$current4$s, _dataFilterForm;
515
+ var _actionRef$current4, _actionRef$current4$s, _dataFilterFormRef$cu;
509
516
 
510
517
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
511
518
 
512
519
  (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, {});
513
- (_dataFilterForm = dataFilterForm) === null || _dataFilterForm === void 0 ? void 0 : _dataFilterForm.reset();
520
+ (_dataFilterFormRef$cu = dataFilterFormRef.current) === null || _dataFilterFormRef$cu === void 0 ? void 0 : _dataFilterFormRef$cu.reset();
514
521
  setCurrentPage(1);
515
522
 
516
523
  _request(_defineProperty({}, targetPageKey, 1));
@@ -532,9 +539,11 @@ var ProTable = function ProTable(props) {
532
539
  pageSize: pageSize
533
540
  },
534
541
  data: data,
535
- dataFilterForm: dataFilterForm,
542
+ dataFilterForm: dataFilterFormRef.current,
543
+ dataFilterFormRef: dataFilterFormRef,
536
544
  normalDataFilterForm: normalDataFilterForm,
537
545
  fullscreenDataFilterForm: fullscreenDataFilterForm,
546
+ filterEnableRef: filterEnableRef,
538
547
  resetTableMaxBodyHeight: function resetTableMaxBodyHeight() {
539
548
  getHeaderHeight().then(function (height) {
540
549
  setHeaderHeight(height);
@@ -623,8 +632,8 @@ var ProTable = function ProTable(props) {
623
632
  }
624
633
  }); // 请求函数
625
634
 
626
- function _request(params, noLoading) {
627
- var _dataFilterForm2, _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
635
+ function _request(params, noLoading, filterParams) {
636
+ var _dataFilterFormRef$cu2, _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
628
637
 
629
638
  // 如果没有传 url 且没有 customRequest,直接返回
630
639
  if (!url && !customRequest) {
@@ -637,7 +646,7 @@ var ProTable = function ProTable(props) {
637
646
 
638
647
  var sortParams = targetFormatSort(sort); // 筛选区请求参数
639
648
 
640
- var dataFilterParams = toJS((_dataFilterForm2 = dataFilterForm) === null || _dataFilterForm2 === void 0 ? void 0 : _dataFilterForm2.values); // 列过滤请求参数
649
+ var dataFilterParams = filterParams !== null && filterParams !== void 0 ? filterParams : (_dataFilterFormRef$cu2 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu2 === void 0 ? void 0 : _dataFilterFormRef$cu2.values; // 列过滤请求参数
641
650
 
642
651
  var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
643
652
 
@@ -688,31 +697,24 @@ var ProTable = function ProTable(props) {
688
697
  }
689
698
 
690
699
  useEffect(function () {
691
- dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
700
+ var _propsDataFilter$sche, _propsDataFilter$sche2;
692
701
 
702
+ // 监听 浏览器变化 更吸底状态
693
703
  if (footerSuction) {
694
704
  getFooterSuctionState();
695
705
 
696
706
  window.onresize = function () {
697
707
  getFooterSuctionState();
698
708
  };
699
- }
709
+ } // 如果不传 dataFilter,则在这里初始化请求
700
710
 
701
- if (propsDataFilter) {
702
- var _dataFilterForm3;
703
711
 
704
- if (requestWhenMount && ((_dataFilterForm3 = dataFilterForm) === null || _dataFilterForm3 === void 0 ? void 0 : _dataFilterForm3.id)) {
705
- // 在请求发送之前 处理漏斗默认数据
706
- processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
712
+ var hasDataFilter = (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche = propsDataFilter.schema) === null || _propsDataFilter$sche === void 0 ? void 0 : _propsDataFilter$sche.length) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : (_propsDataFilter$sche2 = propsDataFilter.schema) === null || _propsDataFilter$sche2 === void 0 ? void 0 : _propsDataFilter$sche2.length) > 0;
707
713
 
708
- _request();
709
- }
710
- } else {
711
- if (requestWhenMount) {
712
- processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
714
+ if (requestWhenMount && !hasDataFilter) {
715
+ processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
713
716
 
714
- _request();
715
- }
717
+ _request();
716
718
  }
717
719
 
718
720
  return function () {
@@ -726,7 +728,7 @@ var ProTable = function ProTable(props) {
726
728
 
727
729
  actionRef.current = undefined;
728
730
  };
729
- }, [(_dataFilterForm4 = dataFilterForm) === null || _dataFilterForm4 === void 0 ? void 0 : _dataFilterForm4.id]);
731
+ }, []);
730
732
 
731
733
  function onSort(dataIndex, order) {
732
734
  var nextSort = _defineProperty({}, dataIndex, order);
@@ -738,26 +740,45 @@ var ProTable = function ProTable(props) {
738
740
 
739
741
 
740
742
  var dataFilter = _objectSpread(_objectSpread({
741
- mode: 'inline'
743
+ mode: 'inline',
744
+ forceClear: true
742
745
  }, propsDataFilter), {}, {
746
+ onInit: function onInit(values) {
747
+ // 表单初始化请求处理
748
+ (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit(values));
749
+ !fullscreenState && _request({}, false, values);
750
+ return true;
751
+ },
743
752
  onFilter: function onFilter(values) {
744
753
  var _actionRef$current6, _actionRef$current6$c;
745
754
 
755
+ // 全屏状态,判断全屏表单onFilter是否禁用
756
+ if (fullscreenState && !filterEnableRef.current.fullscreen) {
757
+ filterEnableRef.current.fullscreen = true;
758
+ return;
759
+ } // 非全屏状态,判断普通表单onFiler是否禁用
760
+
761
+
762
+ if (!fullscreenState && !filterEnableRef.current.normal) {
763
+ filterEnableRef.current.normal = true;
764
+ return;
765
+ }
766
+
746
767
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
747
768
 
748
769
  (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
749
770
  setCurrentPage(1);
750
771
 
751
- _request(_defineProperty({}, targetPageKey, 1));
772
+ _request(_defineProperty({}, targetPageKey, 1), false, values);
752
773
  },
753
- onReset: function onReset() {
754
- var _dataFilterForm5;
774
+ onReset: function onReset(values) {
775
+ var _dataFilterFormRef$cu3;
755
776
 
756
777
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
757
- (_dataFilterForm5 = dataFilterForm) === null || _dataFilterForm5 === void 0 ? void 0 : _dataFilterForm5.reset();
778
+ (_dataFilterFormRef$cu3 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu3 === void 0 ? void 0 : _dataFilterFormRef$cu3.reset();
758
779
  setCurrentPage(1);
759
780
 
760
- _request(_defineProperty({}, targetPageKey, 1));
781
+ _request(_defineProperty({}, targetPageKey, 1), false, values);
761
782
  }
762
783
  });
763
784
 
@@ -841,21 +862,30 @@ var ProTable = function ProTable(props) {
841
862
 
842
863
  var renderFooter = function renderFooter() {
843
864
  function onChangePagination(currentPage) {
844
- var _actionRef$current7, _actionRef$current7$c;
845
-
846
865
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
847
- // 翻页暂时先清空选择
848
- (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
866
+
867
+ // 翻页默认清空选择
868
+ if (!reserveSelectedRecords) {
869
+ var _actionRef$current7, _actionRef$current7$c;
870
+
871
+ (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
872
+ }
873
+
849
874
  setCurrentPage(currentPage);
850
875
 
851
876
  _request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
852
877
  }
853
878
 
854
879
  function onChangePaginationSize(currentPageSize) {
855
- var _actionRef$current8, _actionRef$current8$c, _request5;
880
+ var _request5;
881
+
882
+ // 翻页默认清空选择
883
+ if (!reserveSelectedRecords) {
884
+ var _actionRef$current8, _actionRef$current8$c;
885
+
886
+ (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
887
+ }
856
888
 
857
- // 翻页暂时先清空选择
858
- (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
859
889
  setPageSize(currentPageSize);
860
890
  setCurrentPage(1);
861
891