@teamix/pro 1.3.6 → 1.3.7

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 (52) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +2906 -9938
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/dist/pro.min.js.LICENSE.txt +0 -9
  6. package/es/actions/dialog-form.d.ts +2 -0
  7. package/es/actions/dialog-form.js +5 -2
  8. package/es/actions/index.d.ts +5 -1
  9. package/es/actions/index.js +30 -9
  10. package/es/form/Filter/useSpecialProps.js +2 -2
  11. package/es/form/ProForm/index.js +5 -3
  12. package/es/form/ProForm/index.scss +16 -8
  13. package/es/form/SchemaForm/reactions.js +2 -2
  14. package/es/form/typing.d.ts +1 -0
  15. package/es/index.d.ts +1 -1
  16. package/es/index.js +1 -1
  17. package/es/info/components/ProInfoItem/index.js +2 -6
  18. package/es/info/components/ProInfoItem/index.scss +0 -4
  19. package/es/info/components/baseInfo/index.js +1 -2
  20. package/es/info/typing.d.ts +0 -2
  21. package/es/info/utils/index.d.ts +0 -8
  22. package/es/info/utils/index.js +1 -28
  23. package/es/sidebar/components/tree/index.js +1 -1
  24. package/es/sidebar/components/tree-node/components/IconSwitch/index.js +1 -1
  25. package/es/table/components/Pagination/index.js +4 -4
  26. package/es/table/components/ToolBar/FilterColumnIcon.js +5 -1
  27. package/es/table/index.js +9 -4
  28. package/es/table/typing.d.ts +3 -1
  29. package/lib/actions/dialog-form.d.ts +2 -0
  30. package/lib/actions/dialog-form.js +5 -2
  31. package/lib/actions/index.d.ts +5 -1
  32. package/lib/actions/index.js +29 -7
  33. package/lib/form/Filter/useSpecialProps.js +1 -1
  34. package/lib/form/ProForm/index.js +5 -3
  35. package/lib/form/ProForm/index.scss +16 -8
  36. package/lib/form/SchemaForm/reactions.js +1 -1
  37. package/lib/form/typing.d.ts +1 -0
  38. package/lib/index.d.ts +1 -1
  39. package/lib/index.js +1 -1
  40. package/lib/info/components/ProInfoItem/index.js +2 -6
  41. package/lib/info/components/ProInfoItem/index.scss +0 -4
  42. package/lib/info/components/baseInfo/index.js +0 -1
  43. package/lib/info/typing.d.ts +0 -2
  44. package/lib/info/utils/index.d.ts +0 -8
  45. package/lib/info/utils/index.js +1 -32
  46. package/lib/sidebar/components/tree/index.js +2 -2
  47. package/lib/sidebar/components/tree-node/components/IconSwitch/index.js +1 -1
  48. package/lib/table/components/Pagination/index.js +3 -3
  49. package/lib/table/components/ToolBar/FilterColumnIcon.js +5 -1
  50. package/lib/table/index.js +8 -3
  51. package/lib/table/typing.d.ts +3 -1
  52. package/package.json +18 -4
@@ -26,15 +26,6 @@ object-assign
26
26
 
27
27
  /*! js-cookie v3.0.1 | MIT */
28
28
 
29
- /**
30
- * @license
31
- * Lodash <https://lodash.com/>
32
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
33
- * Released under MIT license <https://lodash.com/license>
34
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
35
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
36
- */
37
-
38
29
  /** @license React v16.13.1
39
30
  * react-is.production.min.js
40
31
  *
@@ -20,6 +20,8 @@ export interface DialogFormAction extends DialogAction {
20
20
  schema: ProFormSchema | Omit<ProFormProps, 'form'>;
21
21
  /** 外部传来的 formRef,用于获取内置 form 实例 */
22
22
  formRef?: React.MutableRefObject<ProFormType | undefined>;
23
+ /** 是否开启懒惰校验,只校验第一个非法规则,默认开启 */
24
+ validateFirst?: boolean;
23
25
  }
24
26
  export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
25
27
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
@@ -90,14 +90,17 @@ var DialogForm = function DialogForm(props) {
90
90
  formProps = props.formProps,
91
91
  context = props.context,
92
92
  formRef = props.formRef,
93
- innerFormRef = props.innerFormRef;
93
+ innerFormRef = props.innerFormRef,
94
+ _props$validateFirst = props.validateFirst,
95
+ validateFirst = _props$validateFirst === void 0 ? true : _props$validateFirst;
94
96
 
95
97
  var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
96
98
  formSchema = _getSchemaAndFormProp.schema,
97
99
  others = _objectWithoutProperties(_getSchemaAndFormProp, _excluded);
98
100
 
99
101
  var form = createForm({
100
- initialValues: getTargetValue(initialValues, context)
102
+ initialValues: getTargetValue(initialValues, context),
103
+ validateFirst: validateFirst
101
104
  });
102
105
 
103
106
  var _useState = useState(false),
@@ -1,6 +1,7 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { ButtonProps } from '@alicloudfe/components/types/button';
3
3
  import { MenuButtonProps } from '@alicloudfe/components/types/menu-button';
4
+ import { TooltipProps } from '@alicloudfe/components/types/balloon';
4
5
  import { LinkAction } from './link';
5
6
  import { RequestAction } from './request';
6
7
  import { DialogAction } from './dialog';
@@ -29,7 +30,10 @@ export declare function useAction(config?: ProActionConfig, context?: any): any;
29
30
  export interface ProActionButtonProps extends ProActionCommonProps, ButtonProps {
30
31
  config?: ProActionConfig;
31
32
  disabled?: any;
33
+ tooltip?: ReactNode;
34
+ disabledTooltip?: ReactNode;
32
35
  icon?: string;
36
+ tooltipProps?: TooltipProps;
33
37
  onClick?: (event: React.MouseEvent<Element, MouseEvent>, context?: any) => void;
34
38
  }
35
39
  export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["type"],
2
- _excluded2 = ["config", "icon", "iconSize", "type", "context", "children", "visible", "onClick"],
2
+ _excluded2 = ["config", "icon", "iconSize", "type", "context", "children", "visible", "disabled", "onClick", "tooltip", "disabledTooltip", "tooltipProps"],
3
3
  _excluded3 = ["loading"],
4
4
  _excluded4 = ["icon", "iconSize", "label", "actions", "children", "context", "type", "className", "noArrow"],
5
5
  _excluded5 = ["context", "text"],
@@ -31,9 +31,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
31
31
 
32
32
  import React from 'react';
33
33
  import cls from 'classnames';
34
- import { Button, MenuButton, Menu, Divider } from '@alicloudfe/components';
34
+ import { Button, MenuButton, Menu, Divider, Balloon } from '@alicloudfe/components';
35
35
  import Icon from '@teamix/icon';
36
- import { getTargetValue, getMessage } from '@teamix/utils';
36
+ import { getTargetValue, getMessage, usePrefixCls } from '@teamix/utils';
37
37
  import { useLinkAction } from './link';
38
38
  import { useRequestAction } from './request';
39
39
  import { useDialogAction } from './dialog';
@@ -165,18 +165,39 @@ export var ProActionButton = function ProActionButton(props) {
165
165
  context = props.context,
166
166
  children = props.children,
167
167
  visible = props.visible,
168
+ disabled = props.disabled,
168
169
  _onClick = props.onClick,
170
+ tooltip = props.tooltip,
171
+ disabledTooltip = props.disabledTooltip,
172
+ tooltipProps = props.tooltipProps,
169
173
  others = _objectWithoutProperties(props, _excluded2);
170
174
 
171
175
  var actionProps = useAction(config, context);
172
- var buttonProps = _onClick ? _objectSpread(_objectSpread(_objectSpread({}, actionProps), others), {}, {
176
+ var buttonProps = _onClick ? _objectSpread(_objectSpread(_objectSpread({
177
+ disabled: disabled
178
+ }, actionProps), others), {}, {
173
179
  onClick: function onClick(e) {
174
180
  return _onClick(e, context);
175
181
  }
176
- }) : _objectSpread(_objectSpread({}, actionProps), others);
177
- return /*#__PURE__*/React.createElement(Button, _objectSpread({
182
+ }) : _objectSpread(_objectSpread({
183
+ disabled: disabled
184
+ }, actionProps), others);
185
+ var content = /*#__PURE__*/React.createElement(Button, _objectSpread({
178
186
  type: type
179
187
  }, buttonProps), buttonContent(children, icon, iconSize, context));
188
+
189
+ var baseToolTipProps = _objectSpread({
190
+ triggerType: 'hover',
191
+ align: 't',
192
+ trigger: content
193
+ }, tooltipProps);
194
+
195
+ if (tooltip || disabledTooltip) {
196
+ var showToolTip = disabled ? disabledTooltip : tooltip;
197
+ content = /*#__PURE__*/React.createElement(Balloon.Tooltip, _objectSpread({}, baseToolTipProps), showToolTip);
198
+ }
199
+
200
+ return content;
180
201
  };
181
202
 
182
203
  var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
@@ -202,9 +223,7 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
202
223
  }
203
224
  }) : _objectSpread({}, menuItemProps);
204
225
  return /*#__PURE__*/React.createElement("div", _objectSpread({
205
- className: cls('teamix-pro-action-menu-item', 'next-menu-item', {
206
- 'next-disabled': disabled
207
- })
226
+ className: cls('teamix-pro-action-menu-item', "".concat(usePrefixCls(), "menu-item"), _defineProperty({}, "".concat(usePrefixCls(), "disabled"), disabled))
208
227
  }, buttonProps), buttonContent(children, icon, undefined, context));
209
228
  };
210
229
 
@@ -363,6 +382,8 @@ function getActionConfig(action, index, context) {
363
382
  key: getKey(index, _key),
364
383
  actions: actions.map(function (a, j) {
365
384
  return getActionConfig(a, j, context);
385
+ }).filter(function (action) {
386
+ return action.visible !== false;
366
387
  })
367
388
  }, getTargetValue(_others, context));
368
389
  }
@@ -1,4 +1,4 @@
1
- import { isUsable, isStr, isPureObj } from '@teamix/utils'; // 获取Schema是否包含默认值、异步默认值、必选校验等
1
+ import { isUsable, isStr, isPlainObj } from '@teamix/utils'; // 获取Schema是否包含默认值、异步默认值、必选校验等
2
2
 
3
3
  var useSpecialProps = function useSpecialProps(props) {
4
4
  var initialValues = props.initialValues,
@@ -16,7 +16,7 @@ var useSpecialProps = function useSpecialProps(props) {
16
16
  dataSource = item.dataSource,
17
17
  children = item.children; // 字符串变量配置default值会触发onChange
18
18
 
19
- hasChangeDefault = hasChangeDefault || !!(isPureObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
19
+ hasChangeDefault = hasChangeDefault || !!(isPlainObj(dataSource) && isStr(value) && value.indexOf('.dataSource'));
20
20
  hasDefault = hasDefault || isUsable(value);
21
21
  hasRequired = hasRequired || required || !!rules;
22
22
 
@@ -1,4 +1,4 @@
1
- var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "context", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "onInitialComplete", "className"];
1
+ var _excluded = ["form", "initialValues", "initialRequest", "schema", "scope", "context", "components", "children", "layout", "labelAlign", "wrapperAlign", "labelCol", "wrapperCol", "breakpoints", "onChange", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst"];
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
 
@@ -43,11 +43,12 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
43
43
  onSubmitFailed = _ref.onSubmitFailed,
44
44
  onInitialComplete = _ref.onInitialComplete,
45
45
  className = _ref.className,
46
+ validateFirst = _ref.validateFirst,
46
47
  otherProps = _objectWithoutProperties(_ref, _excluded);
47
48
 
48
49
  var form = useMemo(function () {
49
50
  return outerForm || createForm({
50
- validateFirst: true
51
+ validateFirst: validateFirst
51
52
  });
52
53
  }, []);
53
54
  var prefixCls = usePrefixCls('', {
@@ -119,6 +120,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
119
120
  });
120
121
  ProForm.defaultProps = {
121
122
  colon: false,
122
- labelAlign: 'left'
123
+ labelAlign: 'left',
124
+ validateFirst: true
123
125
  };
124
126
  export default ProForm;
@@ -197,14 +197,15 @@
197
197
  margin-right: 4px;
198
198
  }
199
199
  }
200
- // 数组类ArrayItem Icon 居中(移除,通过align:center配置)
201
- // .#{$form-array}-items-item-inner {
202
- // .#{$css-prefix}space-item {
203
- // > .#{$css-prefix}formily-icon {
204
- // margin-top: 9px;
205
- // }
206
- // }
207
- // }
200
+ // 数组类ArrayItem Icon text 居中
201
+ .#{$form-array}-items-item-inner {
202
+ .#{$css-prefix}space-item {
203
+ > .#{$css-prefix}formily-icon.#{$css-prefix}btn-text {
204
+ line-height: inherit !important;
205
+ margin-right: 0;
206
+ }
207
+ }
208
+ }
208
209
 
209
210
  // Editable预览态行高
210
211
  .#{$css-prefix}formily-editable-content {
@@ -212,6 +213,13 @@
212
213
  }
213
214
 
214
215
  // 折叠面板
216
+ .#{$css-prefix}formily-collapse {
217
+ .#{$css-prefix}collapse-panel-title {
218
+ .#{$css-prefix}badge-count {
219
+ transform: translateX(4px);
220
+ }
221
+ }
222
+ }
215
223
  .#{$css-prefix}formily-collapse,
216
224
  .#{$form-array}-collapse-item {
217
225
  .#{$css-prefix}collapse-panel-hidden {
@@ -10,7 +10,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
10
 
11
11
  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; }
12
12
 
13
- import { isFn, isPureObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
13
+ import { isFn, isPlainObj, doCommonRequest, getValueByValue } from '@teamix/utils'; // 配置请求
14
14
 
15
15
  var $request = function $request(field, _ref, context, type) {
16
16
  var _field$data;
@@ -29,7 +29,7 @@ var $request = function $request(field, _ref, context, type) {
29
29
  // 触发所有配置的请求
30
30
 
31
31
  var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
32
- var refreshResult = isPureObj(refresh) ? refresh : {};
32
+ var refreshResult = isPlainObj(refresh) ? refresh : {};
33
33
  return doCommonRequest(_objectSpread(_objectSpread({}, requestConfig), {}, {
34
34
  params: _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult),
35
35
  beforeRequest: function beforeRequest() {
@@ -66,6 +66,7 @@ export interface ProFormProps extends IFormLayoutProps {
66
66
  initialValues?: AnyObject;
67
67
  initialRequest?: ProFormRequestConfig;
68
68
  previewTextPlaceholder?: ReactNode;
69
+ validateFirst?: boolean;
69
70
  onChange?: (values: any, fieldValue?: any, fieldName?: any) => any;
70
71
  onSubmit?: ((values: any) => any) | CommonRequestConfig;
71
72
  onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
package/es/index.d.ts CHANGED
@@ -26,5 +26,5 @@ export * from './table';
26
26
  export * from './sidebar';
27
27
  export * from './utils';
28
28
  export * from './timeline';
29
- declare const version = "1.3.6";
29
+ declare const version = "1.3.7";
30
30
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -31,6 +31,6 @@ export * from './sidebar';
31
31
  export * from './utils'; // export * from './sidebar';
32
32
 
33
33
  export * from './timeline';
34
- var version = '1.3.6';
34
+ var version = '1.3.7';
35
35
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
36
36
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils };
@@ -14,17 +14,13 @@ var ProInfoItem = function ProInfoItem(prop) {
14
14
  headerInfoLayout = prop.headerInfoLayout,
15
15
  loading = prop.loading,
16
16
  tooltip = prop.tooltip,
17
- tooltipIcon = prop.tooltipIcon,
18
- _isLastRow = prop._isLastRow;
17
+ tooltipIcon = prop.tooltipIcon;
19
18
 
20
19
  if (baseInfoLayout) {
21
20
  var labelCol = baseInfoLayout.labelCol,
22
21
  wrapperCol = baseInfoLayout.wrapperCol;
23
22
  return /*#__PURE__*/React.createElement("div", {
24
- className: cls({
25
- '': true,
26
- isLastRow: _isLastRow
27
- })
23
+ className: cls('')
28
24
  }, /*#__PURE__*/React.createElement(Row, {
29
25
  gutter: 10,
30
26
  className: cls('base-row')
@@ -17,10 +17,6 @@ $item-padding-bottom: 8px;
17
17
  .teamix-pro-field-info-form-item {
18
18
  width: 100%;
19
19
  padding-bottom: $item-padding-bottom;
20
- &-isLastRow{
21
- padding-bottom: unset;
22
- }
23
-
24
20
  &-header-row {
25
21
  display: flex;
26
22
  align-items: center;
@@ -5,7 +5,7 @@ import './index.scss';
5
5
  import { getLayout } from '../../utils/utils';
6
6
  import defaultLayoutMap from '../../utils/layout';
7
7
  import InfoValueItem from '../InfoValueItem';
8
- import { getDataIndexValue, isLastRow } from '../../utils';
8
+ import { getDataIndexValue } from '../../utils';
9
9
  var Row = Grid.Row,
10
10
  Col = Grid.Col;
11
11
 
@@ -65,7 +65,6 @@ var ProBaseInfo = function ProBaseInfo(props) {
65
65
  }, /*#__PURE__*/React.createElement(ProInfoItem, {
66
66
  label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
67
67
  loading: loading,
68
- _isLastRow: !!isLastRow(columns.length, layoutSpan, index),
69
68
  value: /*#__PURE__*/React.createElement(InfoValueItem, {
70
69
  type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
71
70
  value: getDataIndexValue(item.dataIndex, (_ref = dataSource !== null && dataSource !== void 0 ? dataSource : result) !== null && _ref !== void 0 ? _ref : {}),
@@ -113,8 +113,6 @@ export declare type IProProInfoItem = {
113
113
  headerInfoLayout?: ProHeaderInfoLayoutProps;
114
114
  /** loading 状态 */
115
115
  loading?: boolean;
116
- /** isLastRow 是否是最后一行的元素 */
117
- _isLastRow?: boolean;
118
116
  } & Pick<ProInfoColumnsProps, 'tooltip' | 'tooltipIcon'>;
119
117
  /** header info 定义 */
120
118
  export declare type IProHeaderInfo = {
@@ -10,11 +10,3 @@ export declare const ProInfoGroupContext: React.Context<ProInfoGroupContextProps
10
10
  * @returns
11
11
  */
12
12
  export declare function getDataIndexValue(dataIndex: ProInfoColumnsProps['dataIndex'], dataSource: object): any;
13
- /**
14
- * 是否是最后一样的元素
15
- * @param columnsLength
16
- * @param layoutSpan
17
- * @params itemIndex
18
- * @returns
19
- */
20
- export declare const isLastRow: (columnsLength: number, layoutSpan: number, itemIndex: number) => boolean | undefined;
@@ -30,31 +30,4 @@ export function getDataIndexValue(dataIndex, dataSource) {
30
30
  }
31
31
 
32
32
  return getDeepValue(dataIndex !== null && dataIndex !== void 0 ? dataIndex : '', dataSource);
33
- }
34
- /**
35
- * 是否是最后一样的元素
36
- * @param columnsLength
37
- * @param layoutSpan
38
- * @params itemIndex
39
- * @returns
40
- */
41
-
42
- export var isLastRow = function isLastRow(columnsLength, layoutSpan, itemIndex) {
43
- if (!columnsLength || !layoutSpan) return;
44
- var lastRowColumnsIndexList = [];
45
- var rowCount = 24 / layoutSpan;
46
-
47
- if (columnsLength % rowCount === 0) {
48
- while (rowCount--) {
49
- lastRowColumnsIndexList.push(columnsLength--);
50
- }
51
- } else {
52
- var lastRowCount = columnsLength % rowCount;
53
-
54
- while (lastRowCount--) {
55
- lastRowColumnsIndexList.push(columnsLength--);
56
- }
57
- }
58
-
59
- return lastRowColumnsIndexList.includes(itemIndex + 1);
60
- };
33
+ }
@@ -36,7 +36,7 @@ import { Tree } from '@alicloudfe/components';
36
36
  import { baseClass } from '@teamix/utils';
37
37
  import React, { useEffect, useMemo, useState } from 'react';
38
38
  import { renderTreeNode, renderTreeNodeDependenceValue } from '../tree-node';
39
- import { debounce } from 'lodash';
39
+ import debounce from 'lodash.debounce';
40
40
  import './index.scss';
41
41
  import '../tree-node/index.scss';
42
42
  import { findNodeWithPath, getAllNodeKey, getTreeLevelKey, loop } from '../../utils';
@@ -33,7 +33,7 @@ var ProIconSwitch = function ProIconSwitch(props) {
33
33
  setVisible = _useState2[1];
34
34
 
35
35
  useEffect(function () {
36
- setVisible(visibleProp !== null && visibleProp !== void 0 ? visibleProp : false);
36
+ setVisible(visibleProp !== null && visibleProp !== void 0 ? visibleProp : true);
37
37
  }, [visibleProp]); // 点击操作
38
38
 
39
39
  var clickHandle = function clickHandle(e, state) {
@@ -25,7 +25,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
25
25
  // 自适应宽度的翻页器
26
26
  import React, { useState, useEffect } from 'react';
27
27
  import { Pagination, Balloon, Select, Button, Input, Icon } from '@alicloudfe/components';
28
- import { getMessage, baseClass } from '@teamix/utils';
28
+ import { getMessage, baseClass, usePrefixCls } from '@teamix/utils';
29
29
  import { useResponsiveProps } from '@teamix/hooks';
30
30
  import './index.scss';
31
31
  var cls = baseClass('teamix-pro-pagination');
@@ -160,7 +160,7 @@ export default (function (props) {
160
160
  return /*#__PURE__*/React.createElement("div", {
161
161
  className: cls('custom-jumper')
162
162
  }, /*#__PURE__*/React.createElement(Button, {
163
- className: "next-prev next-pagination-item",
163
+ className: "".concat(usePrefixCls(), "prev ").concat(usePrefixCls(), "pagination-item"),
164
164
  onClick: handlePrevClick,
165
165
  disabled: Number(currentPage) <= 1
166
166
  }, /*#__PURE__*/React.createElement(Icon, {
@@ -182,7 +182,7 @@ export default (function (props) {
182
182
  marginRight: 4
183
183
  }
184
184
  }, "/"), getTotalPage(total, pageSize)), /*#__PURE__*/React.createElement(Button, {
185
- className: "next-next next-pagination-item",
185
+ className: "".concat(usePrefixCls(), "next ").concat(usePrefixCls(), "pagination-item"),
186
186
  onClick: handleNextClick,
187
187
  //@ts-ignore
188
188
  disabled: total && Number(currentPage) >= getTotalPage(total, pageSize)
@@ -200,7 +200,7 @@ export default (function (props) {
200
200
  }, otherProps));
201
201
  } else {
202
202
  return /*#__PURE__*/React.createElement("div", {
203
- className: "".concat(cls('custom-mini-pagination'), " next-pagination")
203
+ className: "".concat(cls('custom-mini-pagination'), " ").concat(usePrefixCls(), "pagination")
204
204
  }, customTotalRender(total), customJumpRender());
205
205
  }
206
206
  }
@@ -47,8 +47,12 @@ var processColumns = function processColumns(columns) {
47
47
  columns = columns.filter(function (item) {
48
48
  return item.valueType !== 'selectGroup';
49
49
  });
50
- }
50
+ } // hidden 为 true 时不展示
51
+
51
52
 
53
+ columns = columns.filter(function (item) {
54
+ return (item === null || item === void 0 ? void 0 : item.hidden) !== true;
55
+ });
52
56
  return columns.map(function (item) {
53
57
  if (item.columnFilters === false) {
54
58
  return item;
package/es/table/index.js CHANGED
@@ -36,7 +36,7 @@ import React, { useState, useEffect, useRef } from 'react';
36
36
  import { Table, Checkbox } from '@alicloudfe/components';
37
37
  import Pagination from './components/Pagination';
38
38
  import genProColumnToColumn from './utils/genProColumnToColumn';
39
- import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps, getCookie } from '@teamix/utils';
39
+ import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps, getCookie, usePrefixCls } from '@teamix/utils';
40
40
  import { ProSkeletonRaw as Skeleton } from '../skeleton';
41
41
  import './index.scss';
42
42
  import Layout from './components/Layout';
@@ -65,7 +65,7 @@ var processColumns = function processColumns(columns, initialColumns) {
65
65
  var _filterColumns;
66
66
 
67
67
  var filterColumns = columns.filter(function (item) {
68
- return item.columnFilters !== false;
68
+ return item.columnFilters !== false && (item === null || item === void 0 ? void 0 : item.hidden) !== true;
69
69
  });
70
70
 
71
71
  if (isRoot) {
@@ -269,7 +269,7 @@ var ProTable = function ProTable(props) {
269
269
 
270
270
  var tableDom = tableRef.current;
271
271
  var headerDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements = tableDom.getElementsByClassName('teamix-pro-table-layout')) === null || _tableDom$getElements === void 0 ? void 0 : _tableDom$getElements[0];
272
- var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName('next-table-header-inner')) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
272
+ var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName("".concat(usePrefixCls(), "table-header-inner"))) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
273
273
  return new Promise(function (resolve) {
274
274
  setTimeout(function () {
275
275
  var _headerDom$offsetHeig, _tableHeaderDom$offse;
@@ -692,6 +692,11 @@ var ProTable = function ProTable(props) {
692
692
  setTotal(total || (data === null || data === void 0 ? void 0 : data.length));
693
693
  setShowSkeleton(false);
694
694
  setCustomTableLoading(false);
695
+ } // 重新计算是否需要吸底
696
+
697
+
698
+ if (footerSuction) {
699
+ getFooterSuctionState();
695
700
  }
696
701
  });
697
702
  } else {
@@ -750,7 +755,7 @@ var ProTable = function ProTable(props) {
750
755
  onInit: function onInit(values) {
751
756
  // 表单初始化请求处理
752
757
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onInit(values));
753
- !fullscreenState && _request({}, false, values);
758
+ !fullscreenState && requestWhenMount && _request({}, false, values);
754
759
  return true;
755
760
  },
756
761
  onFilter: function onFilter(values) {
@@ -33,7 +33,9 @@ export declare type ProTableColumnProps = {
33
33
  tooltipIcon?: React.ReactNode;
34
34
  /** 对应 ProField 里面的 type */
35
35
  valueType?: ProFieldType;
36
- /** 【列配置】是否默认隐藏列 */
36
+ /** 是否隐藏表格列,列配置也不显示 */
37
+ hidden?: boolean;
38
+ /** 【列配置】是否默认隐藏表格列,但列配置显示 */
37
39
  columnFilters?: boolean;
38
40
  /** 【列配置】是否禁用隐藏列 */
39
41
  columnFiltersDisabled?: boolean;
@@ -20,6 +20,8 @@ export interface DialogFormAction extends DialogAction {
20
20
  schema: ProFormSchema | Omit<ProFormProps, 'form'>;
21
21
  /** 外部传来的 formRef,用于获取内置 form 实例 */
22
22
  formRef?: React.MutableRefObject<ProFormType | undefined>;
23
+ /** 是否开启懒惰校验,只校验第一个非法规则,默认开启 */
24
+ validateFirst?: boolean;
23
25
  }
24
26
  export declare function useDialogFormAction(action: DialogFormAction, context?: any): {
25
27
  [x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
@@ -111,14 +111,17 @@ var DialogForm = function DialogForm(props) {
111
111
  formProps = props.formProps,
112
112
  context = props.context,
113
113
  formRef = props.formRef,
114
- innerFormRef = props.innerFormRef;
114
+ innerFormRef = props.innerFormRef,
115
+ _props$validateFirst = props.validateFirst,
116
+ validateFirst = _props$validateFirst === void 0 ? true : _props$validateFirst;
115
117
 
116
118
  var _getSchemaAndFormProp = getSchemaAndFormProps(schema, formProps),
117
119
  formSchema = _getSchemaAndFormProp.schema,
118
120
  others = _objectWithoutProperties(_getSchemaAndFormProp, _excluded);
119
121
 
120
122
  var form = (0, _form.createForm)({
121
- initialValues: (0, _utils.getTargetValue)(initialValues, context)
123
+ initialValues: (0, _utils.getTargetValue)(initialValues, context),
124
+ validateFirst: validateFirst
122
125
  });
123
126
 
124
127
  var _useState = (0, _react.useState)(false),
@@ -1,6 +1,7 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { ButtonProps } from '@alicloudfe/components/types/button';
3
3
  import { MenuButtonProps } from '@alicloudfe/components/types/menu-button';
4
+ import { TooltipProps } from '@alicloudfe/components/types/balloon';
4
5
  import { LinkAction } from './link';
5
6
  import { RequestAction } from './request';
6
7
  import { DialogAction } from './dialog';
@@ -29,7 +30,10 @@ export declare function useAction(config?: ProActionConfig, context?: any): any;
29
30
  export interface ProActionButtonProps extends ProActionCommonProps, ButtonProps {
30
31
  config?: ProActionConfig;
31
32
  disabled?: any;
33
+ tooltip?: ReactNode;
34
+ disabledTooltip?: ReactNode;
32
35
  icon?: string;
36
+ tooltipProps?: TooltipProps;
33
37
  onClick?: (event: React.MouseEvent<Element, MouseEvent>, context?: any) => void;
34
38
  }
35
39
  export declare const ProActionButton: (props: ProActionButtonProps) => JSX.Element;
@@ -54,7 +54,7 @@ var _dangerPopConfirm = require("./danger-pop-confirm");
54
54
  require("./index.scss");
55
55
 
56
56
  var _excluded = ["type"],
57
- _excluded2 = ["config", "icon", "iconSize", "type", "context", "children", "visible", "onClick"],
57
+ _excluded2 = ["config", "icon", "iconSize", "type", "context", "children", "visible", "disabled", "onClick", "tooltip", "disabledTooltip", "tooltipProps"],
58
58
  _excluded3 = ["loading"],
59
59
  _excluded4 = ["icon", "iconSize", "label", "actions", "children", "context", "type", "className", "noArrow"],
60
60
  _excluded5 = ["context", "text"],
@@ -202,18 +202,40 @@ var ProActionButton = function ProActionButton(props) {
202
202
  context = props.context,
203
203
  children = props.children,
204
204
  visible = props.visible,
205
+ disabled = props.disabled,
205
206
  _onClick = props.onClick,
207
+ tooltip = props.tooltip,
208
+ disabledTooltip = props.disabledTooltip,
209
+ tooltipProps = props.tooltipProps,
206
210
  others = _objectWithoutProperties(props, _excluded2);
207
211
 
208
212
  var actionProps = useAction(config, context);
209
- var buttonProps = _onClick ? _objectSpread(_objectSpread(_objectSpread({}, actionProps), others), {}, {
213
+ var buttonProps = _onClick ? _objectSpread(_objectSpread(_objectSpread({
214
+ disabled: disabled
215
+ }, actionProps), others), {}, {
210
216
  onClick: function onClick(e) {
211
217
  return _onClick(e, context);
212
218
  }
213
- }) : _objectSpread(_objectSpread({}, actionProps), others);
214
- return /*#__PURE__*/_react.default.createElement(_components.Button, _objectSpread({
219
+ }) : _objectSpread(_objectSpread({
220
+ disabled: disabled
221
+ }, actionProps), others);
222
+
223
+ var content = /*#__PURE__*/_react.default.createElement(_components.Button, _objectSpread({
215
224
  type: type
216
225
  }, buttonProps), buttonContent(children, icon, iconSize, context));
226
+
227
+ var baseToolTipProps = _objectSpread({
228
+ triggerType: 'hover',
229
+ align: 't',
230
+ trigger: content
231
+ }, tooltipProps);
232
+
233
+ if (tooltip || disabledTooltip) {
234
+ var showToolTip = disabled ? disabledTooltip : tooltip;
235
+ content = /*#__PURE__*/_react.default.createElement(_components.Balloon.Tooltip, _objectSpread({}, baseToolTipProps), showToolTip);
236
+ }
237
+
238
+ return content;
217
239
  };
218
240
 
219
241
  exports.ProActionButton = ProActionButton;
@@ -241,9 +263,7 @@ var ProActionMenuButtonItem = function ProActionMenuButtonItem(props) {
241
263
  }
242
264
  }) : _objectSpread({}, menuItemProps);
243
265
  return /*#__PURE__*/_react.default.createElement("div", _objectSpread({
244
- className: (0, _classnames.default)('teamix-pro-action-menu-item', 'next-menu-item', {
245
- 'next-disabled': disabled
246
- })
266
+ className: (0, _classnames.default)('teamix-pro-action-menu-item', "".concat((0, _utils.usePrefixCls)(), "menu-item"), _defineProperty({}, "".concat((0, _utils.usePrefixCls)(), "disabled"), disabled))
247
267
  }, buttonProps), buttonContent(children, icon, undefined, context));
248
268
  };
249
269
 
@@ -405,6 +425,8 @@ function getActionConfig(action, index, context) {
405
425
  key: getKey(index, _key),
406
426
  actions: actions.map(function (a, j) {
407
427
  return getActionConfig(a, j, context);
428
+ }).filter(function (action) {
429
+ return action.visible !== false;
408
430
  })
409
431
  }, (0, _utils.getTargetValue)(_others, context));
410
432
  }