@ant-design/pro-components 3.1.8-0 → 3.1.10-0

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 (56) hide show
  1. package/dist/pro-components.min.js +1 -1
  2. package/es/descriptions/index.d.ts +7 -1
  3. package/es/field/components/Cascader/index.d.ts +2 -2
  4. package/es/field/components/Checkbox/index.d.ts +2 -2
  5. package/es/field/components/DatePicker/index.d.ts +2 -2
  6. package/es/field/components/FromNow/index.d.ts +1 -1
  7. package/es/field/components/Percent/util.d.ts +1 -1
  8. package/es/field/components/Radio/index.d.ts +1 -1
  9. package/es/field/components/RangePicker/index.d.ts +2 -2
  10. package/es/field/components/Segmented/index.d.ts +1 -1
  11. package/es/field/components/Select/LightSelect/index.d.ts +2 -2
  12. package/es/field/components/Select/index.d.ts +1 -1
  13. package/es/field/components/Switch/index.d.ts +1 -1
  14. package/es/field/components/TimePicker/index.d.ts +2 -2
  15. package/es/field/components/TreeSelect/index.d.ts +1 -1
  16. package/es/form/BaseForm/BaseForm.js +2 -5
  17. package/es/form/components/FormItem/Group/index.js +2 -5
  18. package/es/form/components/FormItem/index.js +1 -1
  19. package/es/form/components/UploadButton/index.d.ts +3 -2
  20. package/es/form/components/UploadDragger/index.d.ts +1 -1
  21. package/es/layout/ProLayout.js +1 -1
  22. package/es/table/utils/columnRender.d.ts +1 -1
  23. package/es/utils/autoFocusToFirstChild/index.d.ts +6 -0
  24. package/es/utils/autoFocusToFirstChild/index.js +18 -0
  25. package/es/utils/components/ErrorBoundary/index.d.ts +1 -1
  26. package/es/utils/genCopyable/index.d.ts +1 -1
  27. package/es/utils/index.d.ts +2 -1
  28. package/es/utils/index.js +2 -1
  29. package/lib/descriptions/index.d.ts +7 -1
  30. package/lib/field/components/Cascader/index.d.ts +2 -2
  31. package/lib/field/components/Checkbox/index.d.ts +2 -2
  32. package/lib/field/components/DatePicker/index.d.ts +2 -2
  33. package/lib/field/components/FromNow/index.d.ts +1 -1
  34. package/lib/field/components/Percent/util.d.ts +1 -1
  35. package/lib/field/components/Radio/index.d.ts +1 -1
  36. package/lib/field/components/RangePicker/index.d.ts +2 -2
  37. package/lib/field/components/Segmented/index.d.ts +1 -1
  38. package/lib/field/components/Select/LightSelect/index.d.ts +2 -2
  39. package/lib/field/components/Select/index.d.ts +1 -1
  40. package/lib/field/components/Switch/index.d.ts +1 -1
  41. package/lib/field/components/TimePicker/index.d.ts +2 -2
  42. package/lib/field/components/TreeSelect/index.d.ts +1 -1
  43. package/lib/form/BaseForm/BaseForm.js +1 -4
  44. package/lib/form/components/FormItem/Group/index.js +1 -4
  45. package/lib/form/components/FormItem/index.js +1 -1
  46. package/lib/form/components/UploadButton/index.d.ts +3 -2
  47. package/lib/form/components/UploadDragger/index.d.ts +1 -1
  48. package/lib/layout/ProLayout.js +1 -1
  49. package/lib/table/utils/columnRender.d.ts +1 -1
  50. package/lib/utils/autoFocusToFirstChild/index.d.ts +6 -0
  51. package/lib/utils/autoFocusToFirstChild/index.js +24 -0
  52. package/lib/utils/components/ErrorBoundary/index.d.ts +1 -1
  53. package/lib/utils/genCopyable/index.d.ts +1 -1
  54. package/lib/utils/index.d.ts +2 -1
  55. package/lib/utils/index.js +8 -0
  56. package/package.json +14 -15
@@ -1,4 +1,6 @@
1
1
  import type { DescriptionsProps, FormProps } from 'antd';
2
+ import type { Breakpoint } from 'antd/es/_util/responsiveObserver';
3
+ import { CellSemanticClassNames, CellSemanticStyles } from 'antd/es/descriptions/DescriptionsContext';
2
4
  import React from 'react';
3
5
  import type { ProFieldFCMode } from '../provider';
4
6
  import type { ProCoreActionType, ProEllipsis, ProFieldValueType, ProSchema, ProSchemaComponentTypes, RowEditableConfig, UseEditableMapUtilType } from '../utils';
@@ -9,8 +11,12 @@ export interface DescriptionsItemProps {
9
11
  className?: string;
10
12
  style?: React.CSSProperties;
11
13
  label?: React.ReactNode;
14
+ classNames?: CellSemanticClassNames;
15
+ styles?: CellSemanticStyles;
12
16
  children: React.ReactNode;
13
- span?: number;
17
+ span?: number | 'filled' | {
18
+ [key in Breakpoint]?: number;
19
+ };
14
20
  }
15
21
  /**
16
22
  * 定义列表属性的类型定义,用于定义列表的一列
@@ -11,7 +11,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
11
11
  options?: (string | number | import("antd").CheckboxOptionType<any>)[] | undefined;
12
12
  radioType?: "button" | "radio" | undefined;
13
13
  placeholder?: string | undefined;
14
- variant?: "filled" | "outlined" | "borderless" | undefined;
14
+ variant?: "outlined" | "filled" | "borderless" | undefined;
15
15
  } & {
16
16
  text: string;
17
17
  valueEnum?: import("src/utils/typing").ProFieldValueEnumType | undefined;
@@ -19,7 +19,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
19
19
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
20
20
  params?: any;
21
21
  fieldProps?: any;
22
- variant?: "filled" | "outlined" | "borderless" | undefined;
22
+ variant?: "outlined" | "filled" | "borderless" | undefined;
23
23
  id?: string | undefined;
24
24
  defaultKeyWords?: string | undefined;
25
25
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -6,7 +6,7 @@ export type GroupProps = {
6
6
  options?: CheckboxGroupProps['options'];
7
7
  } & FieldSelectProps;
8
8
  declare const _default: React.ForwardRefExoticComponent<import("src/provider").BaseProFieldFC & import("src/provider").ProRenderFieldPropsType & {
9
- layout?: "vertical" | "horizontal" | undefined;
9
+ layout?: "horizontal" | "vertical" | undefined;
10
10
  options?: (string | number | import("antd/lib/checkbox").CheckboxOptionType<any>)[] | undefined;
11
11
  } & {
12
12
  text: string;
@@ -15,7 +15,7 @@ declare const _default: React.ForwardRefExoticComponent<import("src/provider").B
15
15
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
16
16
  params?: any;
17
17
  fieldProps?: any;
18
- variant?: "filled" | "outlined" | "borderless" | undefined;
18
+ variant?: "outlined" | "filled" | "borderless" | undefined;
19
19
  id?: string | undefined;
20
20
  defaultKeyWords?: string | undefined;
21
21
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -4,7 +4,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
4
4
  text: string | number;
5
5
  format?: string | undefined;
6
6
  showTime?: boolean | undefined;
7
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
8
- picker?: "time" | "date" | "year" | "month" | "week" | "quarter" | undefined;
7
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
8
+ picker?: "time" | "date" | "month" | "week" | "year" | "quarter" | undefined;
9
9
  } & ProFieldLightProps & React.RefAttributes<any>>;
10
10
  export default _default;
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
3
3
  text: string;
4
4
  format?: string | undefined;
5
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
5
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
6
6
  } & React.RefAttributes<any>>;
7
7
  export default _default;
@@ -1,7 +1,7 @@
1
1
  /** 获取展示符号 */
2
2
  export declare function getSymbolByRealValue(realValue: number): "-" | "+" | null;
3
3
  /** 获取颜色 */
4
- export declare function getColorByRealValue(realValue: number /** ,color: string */): "#595959" | "#ff4d4f" | "#52c41a";
4
+ export declare function getColorByRealValue(realValue: number /** ,color: string */): "#52c41a" | "#595959" | "#ff4d4f";
5
5
  /** 获取到最后展示的数字 */
6
6
  export declare function getRealTextWithPrecision(realValue: number, precision?: number): string | number;
7
7
  /**
@@ -15,7 +15,7 @@ declare const _default: React.ForwardRefExoticComponent<import("src/provider").B
15
15
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
16
16
  params?: any;
17
17
  fieldProps?: any;
18
- variant?: "filled" | "outlined" | "borderless" | undefined;
18
+ variant?: "outlined" | "filled" | "borderless" | undefined;
19
19
  id?: string | undefined;
20
20
  defaultKeyWords?: string | undefined;
21
21
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -3,8 +3,8 @@ import type { ProFieldLightProps } from '../../PureProField';
3
3
  declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
4
4
  text: string[];
5
5
  format?: string | undefined;
6
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
6
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
7
7
  showTime?: boolean | undefined;
8
- picker?: "time" | "date" | "year" | "month" | "week" | "quarter" | undefined;
8
+ picker?: "time" | "date" | "month" | "week" | "year" | "quarter" | undefined;
9
9
  } & ProFieldLightProps & React.RefAttributes<any>>;
10
10
  export default _default;
@@ -9,7 +9,7 @@ declare const _default: React.ForwardRefExoticComponent<import("src/provider").B
9
9
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
10
10
  params?: any;
11
11
  fieldProps?: any;
12
- variant?: "filled" | "outlined" | "borderless" | undefined;
12
+ variant?: "outlined" | "filled" | "borderless" | undefined;
13
13
  id?: string | undefined;
14
14
  defaultKeyWords?: string | undefined;
15
15
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -31,7 +31,7 @@ declare const _default: React.ForwardRefExoticComponent<SelectProps<any, import(
31
31
  */
32
32
  fetchDataOnSearch?: boolean | undefined;
33
33
  /** 变体类型 */
34
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
35
- labelVariant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
34
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
35
+ labelVariant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
36
36
  } & ProFieldLightProps & SelectProps<any, import("antd/es/select").DefaultOptionType> & React.RefAttributes<any>>;
37
37
  export default _default;
@@ -43,7 +43,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
43
43
  params?: any;
44
44
  /** 组件的全局设置 */
45
45
  fieldProps?: any;
46
- variant?: "filled" | "outlined" | "borderless" | undefined;
46
+ variant?: "outlined" | "filled" | "borderless" | undefined;
47
47
  id?: string | undefined;
48
48
  /** 默认搜素条件 */
49
49
  defaultKeyWords?: string | undefined;
@@ -3,6 +3,6 @@ import React from 'react';
3
3
  declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
4
4
  text: boolean;
5
5
  fieldProps?: SwitchProps | undefined;
6
- variant?: "filled" | "outlined" | "borderless" | undefined;
6
+ variant?: "outlined" | "filled" | "borderless" | undefined;
7
7
  } & React.RefAttributes<any>>;
8
8
  export default _default;
@@ -3,12 +3,12 @@ import type { ProFieldLightProps } from '../../PureProField';
3
3
  declare const FieldTimeRangePicker: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
4
4
  text: string[] | number[];
5
5
  format?: string | undefined;
6
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
6
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
7
7
  } & ProFieldLightProps & React.RefAttributes<any>>;
8
8
  export { FieldTimeRangePicker };
9
9
  declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
10
10
  text: string | number;
11
11
  format?: string | undefined;
12
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
12
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
13
13
  } & ProFieldLightProps & React.RefAttributes<any>>;
14
14
  export default _default;
@@ -15,7 +15,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
15
15
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
16
16
  params?: any;
17
17
  fieldProps?: any;
18
- variant?: "filled" | "outlined" | "borderless" | undefined;
18
+ variant?: "outlined" | "filled" | "borderless" | undefined;
19
19
  id?: string | undefined;
20
20
  defaultKeyWords?: string | undefined;
21
21
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -4,7 +4,7 @@ import { ConfigProvider, Form, Spin } from 'antd';
4
4
  import { clsx } from 'clsx';
5
5
  import React, { useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
6
6
  import { ProConfigProvider } from "../../provider";
7
- import { conversionMomentValue, isDeepEqualReact, nanoid, ProFormContext, runFunction, transformKeySubmitValue, useFetchData, usePrevious, useRefFunction, useStyle } from "../../utils";
7
+ import { autoFocusToFirstChild, conversionMomentValue, isDeepEqualReact, nanoid, ProFormContext, runFunction, transformKeySubmitValue, useFetchData, usePrevious, useRefFunction, useStyle } from "../../utils";
8
8
  import { FormListContext } from "../components/List";
9
9
  import FieldContext from "../FieldContext";
10
10
  import { GridContext, useGridHelpers } from "../helpers";
@@ -182,10 +182,7 @@ function BaseFormComponents(props) {
182
182
  const items = useMemo(() => {
183
183
  return React.Children.toArray(children).map((item, index) => {
184
184
  if (index === 0 && /*#__PURE__*/React.isValidElement(item) && autoFocusFirstInput) {
185
- return /*#__PURE__*/React.cloneElement(item, {
186
- ...item.props,
187
- autoFocus: autoFocusFirstInput
188
- });
185
+ return autoFocusToFirstChild(item, autoFocusFirstInput);
189
186
  }
190
187
  return item;
191
188
  });
@@ -3,7 +3,7 @@ import { useControlledState } from '@rc-component/util';
3
3
  import { ConfigProvider, Space } from 'antd';
4
4
  import { clsx } from 'clsx';
5
5
  import React, { useCallback, useContext, useMemo } from 'react';
6
- import { LabelIconTip, useRefFunction } from "../../../../utils";
6
+ import { autoFocusToFirstChild, LabelIconTip, useRefFunction } from "../../../../utils";
7
7
  import FieldContext from "../../../FieldContext";
8
8
  import { useGridHelpers } from "../../../helpers/grid";
9
9
  import { useStyle } from "./style";
@@ -102,10 +102,7 @@ const Group = /*#__PURE__*/React.forwardRef((props, ref) => {
102
102
  return null;
103
103
  }
104
104
  if (index === 0 && /*#__PURE__*/React.isValidElement(element) && autoFocus) {
105
- return /*#__PURE__*/React.cloneElement(element, {
106
- ...element.props,
107
- autoFocus
108
- });
105
+ return autoFocusToFirstChild(element, autoFocus);
109
106
  }
110
107
  return element;
111
108
  });
@@ -96,7 +96,7 @@ const WithValueFomFiledProps = formFieldProps => {
96
96
  ...(variantFromRest !== undefined && {
97
97
  variant: variantFromRest
98
98
  }),
99
- onBlur: isProFormComponent && !isValidElementForFiledChildren && onBlur
99
+ onBlur: isProFormComponent && !isValidElementForFiledChildren && typeof onBlur === 'function' ? onBlur : undefined
100
100
  }));
101
101
  };
102
102
  /**
@@ -1,8 +1,9 @@
1
1
  import type { ButtonProps, ImageProps, UploadProps } from 'antd';
2
+ import type { UploadRef } from 'antd/es/upload';
2
3
  import React from 'react';
3
4
  import type { ProFormFieldItemProps } from '../../typing';
4
- type PickUploadProps = Pick<UploadProps<any>, 'listType' | 'action' | 'accept' | 'fileList' | 'onChange'>;
5
- export type ProFormUploadButtonProps = ProFormFieldItemProps<UploadProps<any>, HTMLElement> & {
5
+ type PickUploadProps = Pick<UploadProps, 'listType' | 'action' | 'accept' | 'fileList' | 'onChange'>;
6
+ export type ProFormUploadButtonProps = ProFormFieldItemProps<UploadProps, UploadRef> & {
6
7
  /**
7
8
  * @name 上传文件的图标
8
9
  * @default UploadOutlined
@@ -1,4 +1,4 @@
1
- import type { DraggerProps, UploadProps } from 'antd/lib/upload';
1
+ import type { DraggerProps, UploadProps } from 'antd';
2
2
  import React from 'react';
3
3
  import type { ProFormFieldItemProps } from '../../typing';
4
4
  export type ProFormUploadDraggerProps = ProFormFieldItemProps<DraggerProps> & {
@@ -406,7 +406,7 @@ const BaseProLayout = props => {
406
406
  position: 'absolute',
407
407
  ...item
408
408
  }
409
- }, `bg-layout-${index}`);
409
+ }, item.src ? `${item.src}-${index}` : `bg-layout-${index}`);
410
410
  });
411
411
  }
412
412
  return null;
@@ -22,7 +22,7 @@ type ColumnRenderInterface<T> = {
22
22
  *
23
23
  * @param item
24
24
  */
25
- export declare const renderColumnsTitle: (item: ProColumns<any>) => string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null | undefined;
25
+ export declare const renderColumnsTitle: (item: ProColumns<any>) => string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
26
26
  /**
27
27
  * 默认的 filter 方法
28
28
  *
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * 将 autoFocus 应用到第一个子节点;若首个子节点是 Fragment,则递归应用到其第一个子节点,
4
+ * 避免向 React.Fragment 传入非法 props。
5
+ */
6
+ export declare function autoFocusToFirstChild(node: React.ReactNode, autoFocus: boolean): React.ReactNode;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * 将 autoFocus 应用到第一个子节点;若首个子节点是 Fragment,则递归应用到其第一个子节点,
5
+ * 避免向 React.Fragment 传入非法 props。
6
+ */
7
+ export function autoFocusToFirstChild(node, autoFocus) {
8
+ if (!autoFocus || ! /*#__PURE__*/React.isValidElement(node)) return node;
9
+ if (node.type === React.Fragment) {
10
+ const children = React.Children.toArray(node.props.children);
11
+ const newChildren = children.map((child, index) => index === 0 ? autoFocusToFirstChild(child, autoFocus) : child);
12
+ return /*#__PURE__*/React.cloneElement(node, {}, ...newChildren);
13
+ }
14
+ return /*#__PURE__*/React.cloneElement(node, {
15
+ ...node.props,
16
+ autoFocus
17
+ });
18
+ }
@@ -15,6 +15,6 @@ declare class ErrorBoundary extends React.Component<{
15
15
  errorInfo: string;
16
16
  };
17
17
  componentDidCatch(error: any, errorInfo: ErrorInfo): void;
18
- render(): string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null | undefined;
18
+ render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
19
19
  }
20
20
  export { ErrorBoundary };
@@ -12,4 +12,4 @@ export type ProEllipsis = ProEllipsisTooltip | boolean;
12
12
  * @param item
13
13
  * @param text
14
14
  */
15
- export declare const genCopyable: (dom: React.ReactNode, item: any, text: string) => string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null | undefined;
15
+ export declare const genCopyable: (dom: React.ReactNode, item: any, text: string) => string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
@@ -1,4 +1,5 @@
1
1
  import { lighten, operationUnit, resetComponent, setAlpha, useStyle } from '../provider';
2
+ import { autoFocusToFirstChild } from './autoFocusToFirstChild';
2
3
  import { DropdownFooter } from './components/DropdownFooter';
3
4
  import { ErrorBoundary } from './components/ErrorBoundary';
4
5
  import { FieldLabel } from './components/FieldLabel';
@@ -48,5 +49,5 @@ import type { UseEditableMapType, UseEditableMapUtilType } from './useEditableMa
48
49
  import { useEditableMap } from './useEditableMap';
49
50
  import { useBreakpoint } from './useMediaQuery';
50
51
  export * from './typing';
51
- export { conversionMomentValue, conversionMomentValue as conversionSubmitValue, convertMoment, dateArrayFormatter, dateFormatterMap, DropdownFooter, editableRowByKey, ErrorBoundary, FieldLabel, FilterDropdown, genCopyable, getFieldPropsOrFormItemProps, InlineErrorFormItem, isBrowser, isDeepEqualReact, isDropdownValueType, isImg, isNil, isUrl, LabelIconTip, lighten, merge, nanoid, objectToMap, omitBoolean, omitUndefined, omitUndefinedAndEmptyArr, operationUnit, parseValueToDay, pickProFormItemProps, pickProProps, proFieldParsingText, ProFormContext, recordKeyToString, resetComponent, runFunction, setAlpha, stringify, transformKeySubmitValue, useBreakpoint, useDebounceFn, useDebounceValue, useDeepCompareEffect, useDeepCompareEffectDebounce, useDeepCompareMemo, useDocumentTitle, useEditableArray, useEditableMap, useFetchData, useLatest, usePrevious, useReactiveRef, useRefCallback, useRefFunction, useStyle, };
52
+ export { autoFocusToFirstChild, conversionMomentValue, conversionMomentValue as conversionSubmitValue, convertMoment, dateArrayFormatter, dateFormatterMap, DropdownFooter, editableRowByKey, ErrorBoundary, FieldLabel, FilterDropdown, genCopyable, getFieldPropsOrFormItemProps, InlineErrorFormItem, isBrowser, isDeepEqualReact, isDropdownValueType, isImg, isNil, isUrl, LabelIconTip, lighten, merge, nanoid, objectToMap, omitBoolean, omitUndefined, omitUndefinedAndEmptyArr, operationUnit, parseValueToDay, pickProFormItemProps, pickProProps, proFieldParsingText, ProFormContext, recordKeyToString, resetComponent, runFunction, setAlpha, stringify, transformKeySubmitValue, useBreakpoint, useDebounceFn, useDebounceValue, useDeepCompareEffect, useDeepCompareEffectDebounce, useDeepCompareMemo, useDocumentTitle, useEditableArray, useEditableMap, useFetchData, useLatest, usePrevious, useReactiveRef, useRefCallback, useRefFunction, useStyle, };
52
53
  export type { ProEllipsis, ProFormInstanceType, ProRequestData, RowEditableConfig, RowEditableType, UseEditableMapType, UseEditableMapUtilType, UseEditableType, UseEditableUtilType, };
package/es/utils/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { lighten, operationUnit, resetComponent, setAlpha, useStyle } from "../provider";
2
+ import { autoFocusToFirstChild } from "./autoFocusToFirstChild";
2
3
  import { DropdownFooter } from "./components/DropdownFooter";
3
4
  import { ErrorBoundary } from "./components/ErrorBoundary";
4
5
  import { FieldLabel } from "./components/FieldLabel";
@@ -43,7 +44,7 @@ import { editableRowByKey, recordKeyToString, useEditableArray } from "./useEdit
43
44
  import { useEditableMap } from "./useEditableMap";
44
45
  import { useBreakpoint } from "./useMediaQuery";
45
46
  export * from "./typing";
46
- export { conversionMomentValue, conversionMomentValue as conversionSubmitValue, convertMoment, dateArrayFormatter, dateFormatterMap, DropdownFooter, editableRowByKey, ErrorBoundary, FieldLabel, FilterDropdown, genCopyable, getFieldPropsOrFormItemProps, InlineErrorFormItem, isBrowser, isDeepEqualReact, isDropdownValueType, isImg, isNil, isUrl, LabelIconTip, lighten, merge, nanoid, objectToMap, omitBoolean, omitUndefined, omitUndefinedAndEmptyArr, operationUnit, parseValueToDay, pickProFormItemProps, pickProProps, proFieldParsingText, ProFormContext, recordKeyToString, resetComponent, runFunction, setAlpha, stringify,
47
+ export { autoFocusToFirstChild, conversionMomentValue, conversionMomentValue as conversionSubmitValue, convertMoment, dateArrayFormatter, dateFormatterMap, DropdownFooter, editableRowByKey, ErrorBoundary, FieldLabel, FilterDropdown, genCopyable, getFieldPropsOrFormItemProps, InlineErrorFormItem, isBrowser, isDeepEqualReact, isDropdownValueType, isImg, isNil, isUrl, LabelIconTip, lighten, merge, nanoid, objectToMap, omitBoolean, omitUndefined, omitUndefinedAndEmptyArr, operationUnit, parseValueToDay, pickProFormItemProps, pickProProps, proFieldParsingText, ProFormContext, recordKeyToString, resetComponent, runFunction, setAlpha, stringify,
47
48
  // function
48
49
  transformKeySubmitValue, useBreakpoint, useDebounceFn, useDebounceValue, useDeepCompareEffect, useDeepCompareEffectDebounce, useDeepCompareMemo, useDocumentTitle,
49
50
  // hooks
@@ -1,4 +1,6 @@
1
1
  import type { DescriptionsProps, FormProps } from 'antd';
2
+ import type { Breakpoint } from 'antd/es/_util/responsiveObserver';
3
+ import { CellSemanticClassNames, CellSemanticStyles } from 'antd/es/descriptions/DescriptionsContext';
2
4
  import React from 'react';
3
5
  import type { ProFieldFCMode } from '../provider';
4
6
  import type { ProCoreActionType, ProEllipsis, ProFieldValueType, ProSchema, ProSchemaComponentTypes, RowEditableConfig, UseEditableMapUtilType } from '../utils';
@@ -9,8 +11,12 @@ export interface DescriptionsItemProps {
9
11
  className?: string;
10
12
  style?: React.CSSProperties;
11
13
  label?: React.ReactNode;
14
+ classNames?: CellSemanticClassNames;
15
+ styles?: CellSemanticStyles;
12
16
  children: React.ReactNode;
13
- span?: number;
17
+ span?: number | 'filled' | {
18
+ [key in Breakpoint]?: number;
19
+ };
14
20
  }
15
21
  /**
16
22
  * 定义列表属性的类型定义,用于定义列表的一列
@@ -11,7 +11,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
11
11
  options?: (string | number | import("antd").CheckboxOptionType<any>)[] | undefined;
12
12
  radioType?: "button" | "radio" | undefined;
13
13
  placeholder?: string | undefined;
14
- variant?: "filled" | "outlined" | "borderless" | undefined;
14
+ variant?: "outlined" | "filled" | "borderless" | undefined;
15
15
  } & {
16
16
  text: string;
17
17
  valueEnum?: import("src/utils/typing").ProFieldValueEnumType | undefined;
@@ -19,7 +19,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
19
19
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
20
20
  params?: any;
21
21
  fieldProps?: any;
22
- variant?: "filled" | "outlined" | "borderless" | undefined;
22
+ variant?: "outlined" | "filled" | "borderless" | undefined;
23
23
  id?: string | undefined;
24
24
  defaultKeyWords?: string | undefined;
25
25
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -6,7 +6,7 @@ export type GroupProps = {
6
6
  options?: CheckboxGroupProps['options'];
7
7
  } & FieldSelectProps;
8
8
  declare const _default: React.ForwardRefExoticComponent<import("src/provider").BaseProFieldFC & import("src/provider").ProRenderFieldPropsType & {
9
- layout?: "vertical" | "horizontal" | undefined;
9
+ layout?: "horizontal" | "vertical" | undefined;
10
10
  options?: (string | number | import("antd/lib/checkbox").CheckboxOptionType<any>)[] | undefined;
11
11
  } & {
12
12
  text: string;
@@ -15,7 +15,7 @@ declare const _default: React.ForwardRefExoticComponent<import("src/provider").B
15
15
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
16
16
  params?: any;
17
17
  fieldProps?: any;
18
- variant?: "filled" | "outlined" | "borderless" | undefined;
18
+ variant?: "outlined" | "filled" | "borderless" | undefined;
19
19
  id?: string | undefined;
20
20
  defaultKeyWords?: string | undefined;
21
21
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -4,7 +4,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
4
4
  text: string | number;
5
5
  format?: string | undefined;
6
6
  showTime?: boolean | undefined;
7
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
8
- picker?: "time" | "date" | "year" | "month" | "week" | "quarter" | undefined;
7
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
8
+ picker?: "time" | "date" | "month" | "week" | "year" | "quarter" | undefined;
9
9
  } & ProFieldLightProps & React.RefAttributes<any>>;
10
10
  export default _default;
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
3
3
  text: string;
4
4
  format?: string | undefined;
5
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
5
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
6
6
  } & React.RefAttributes<any>>;
7
7
  export default _default;
@@ -1,7 +1,7 @@
1
1
  /** 获取展示符号 */
2
2
  export declare function getSymbolByRealValue(realValue: number): "-" | "+" | null;
3
3
  /** 获取颜色 */
4
- export declare function getColorByRealValue(realValue: number /** ,color: string */): "#595959" | "#ff4d4f" | "#52c41a";
4
+ export declare function getColorByRealValue(realValue: number /** ,color: string */): "#52c41a" | "#595959" | "#ff4d4f";
5
5
  /** 获取到最后展示的数字 */
6
6
  export declare function getRealTextWithPrecision(realValue: number, precision?: number): string | number;
7
7
  /**
@@ -15,7 +15,7 @@ declare const _default: React.ForwardRefExoticComponent<import("src/provider").B
15
15
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
16
16
  params?: any;
17
17
  fieldProps?: any;
18
- variant?: "filled" | "outlined" | "borderless" | undefined;
18
+ variant?: "outlined" | "filled" | "borderless" | undefined;
19
19
  id?: string | undefined;
20
20
  defaultKeyWords?: string | undefined;
21
21
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -3,8 +3,8 @@ import type { ProFieldLightProps } from '../../PureProField';
3
3
  declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
4
4
  text: string[];
5
5
  format?: string | undefined;
6
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
6
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
7
7
  showTime?: boolean | undefined;
8
- picker?: "time" | "date" | "year" | "month" | "week" | "quarter" | undefined;
8
+ picker?: "time" | "date" | "month" | "week" | "year" | "quarter" | undefined;
9
9
  } & ProFieldLightProps & React.RefAttributes<any>>;
10
10
  export default _default;
@@ -9,7 +9,7 @@ declare const _default: React.ForwardRefExoticComponent<import("src/provider").B
9
9
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
10
10
  params?: any;
11
11
  fieldProps?: any;
12
- variant?: "filled" | "outlined" | "borderless" | undefined;
12
+ variant?: "outlined" | "filled" | "borderless" | undefined;
13
13
  id?: string | undefined;
14
14
  defaultKeyWords?: string | undefined;
15
15
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -31,7 +31,7 @@ declare const _default: React.ForwardRefExoticComponent<SelectProps<any, import(
31
31
  */
32
32
  fetchDataOnSearch?: boolean | undefined;
33
33
  /** 变体类型 */
34
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
35
- labelVariant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
34
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
35
+ labelVariant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
36
36
  } & ProFieldLightProps & SelectProps<any, import("antd/es/select").DefaultOptionType> & React.RefAttributes<any>>;
37
37
  export default _default;
@@ -43,7 +43,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
43
43
  params?: any;
44
44
  /** 组件的全局设置 */
45
45
  fieldProps?: any;
46
- variant?: "filled" | "outlined" | "borderless" | undefined;
46
+ variant?: "outlined" | "filled" | "borderless" | undefined;
47
47
  id?: string | undefined;
48
48
  /** 默认搜素条件 */
49
49
  defaultKeyWords?: string | undefined;
@@ -3,6 +3,6 @@ import React from 'react';
3
3
  declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
4
4
  text: boolean;
5
5
  fieldProps?: SwitchProps | undefined;
6
- variant?: "filled" | "outlined" | "borderless" | undefined;
6
+ variant?: "outlined" | "filled" | "borderless" | undefined;
7
7
  } & React.RefAttributes<any>>;
8
8
  export default _default;
@@ -3,12 +3,12 @@ import type { ProFieldLightProps } from '../../PureProField';
3
3
  declare const FieldTimeRangePicker: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
4
4
  text: string[] | number[];
5
5
  format?: string | undefined;
6
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
6
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
7
7
  } & ProFieldLightProps & React.RefAttributes<any>>;
8
8
  export { FieldTimeRangePicker };
9
9
  declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
10
10
  text: string | number;
11
11
  format?: string | undefined;
12
- variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
12
+ variant?: "outlined" | "filled" | "borderless" | "underlined" | undefined;
13
13
  } & ProFieldLightProps & React.RefAttributes<any>>;
14
14
  export default _default;
@@ -15,7 +15,7 @@ declare const _default: React.ForwardRefExoticComponent<import("../../../provide
15
15
  request?: import("src/utils/typing").ProFieldRequestData | undefined;
16
16
  params?: any;
17
17
  fieldProps?: any;
18
- variant?: "filled" | "outlined" | "borderless" | undefined;
18
+ variant?: "outlined" | "filled" | "borderless" | undefined;
19
19
  id?: string | undefined;
20
20
  defaultKeyWords?: string | undefined;
21
21
  } & import("../../PureProField").ProFieldLightProps & React.RefAttributes<any>>;
@@ -189,10 +189,7 @@ function BaseFormComponents(props) {
189
189
  const items = (0, _react.useMemo)(() => {
190
190
  return _react.default.Children.toArray(children).map((item, index) => {
191
191
  if (index === 0 && /*#__PURE__*/_react.default.isValidElement(item) && autoFocusFirstInput) {
192
- return /*#__PURE__*/_react.default.cloneElement(item, {
193
- ...item.props,
194
- autoFocus: autoFocusFirstInput
195
- });
192
+ return (0, _utils.autoFocusToFirstChild)(item, autoFocusFirstInput);
196
193
  }
197
194
  return item;
198
195
  });
@@ -109,10 +109,7 @@ const Group = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
109
109
  return null;
110
110
  }
111
111
  if (index === 0 && /*#__PURE__*/_react.default.isValidElement(element) && autoFocus) {
112
- return /*#__PURE__*/_react.default.cloneElement(element, {
113
- ...element.props,
114
- autoFocus
115
- });
112
+ return (0, _utils.autoFocusToFirstChild)(element, autoFocus);
116
113
  }
117
114
  return element;
118
115
  });
@@ -101,7 +101,7 @@ const WithValueFomFiledProps = formFieldProps => {
101
101
  ...(variantFromRest !== undefined && {
102
102
  variant: variantFromRest
103
103
  }),
104
- onBlur: isProFormComponent && !isValidElementForFiledChildren && onBlur
104
+ onBlur: isProFormComponent && !isValidElementForFiledChildren && typeof onBlur === 'function' ? onBlur : undefined
105
105
  }));
106
106
  };
107
107
  /**
@@ -1,8 +1,9 @@
1
1
  import type { ButtonProps, ImageProps, UploadProps } from 'antd';
2
+ import type { UploadRef } from 'antd/es/upload';
2
3
  import React from 'react';
3
4
  import type { ProFormFieldItemProps } from '../../typing';
4
- type PickUploadProps = Pick<UploadProps<any>, 'listType' | 'action' | 'accept' | 'fileList' | 'onChange'>;
5
- export type ProFormUploadButtonProps = ProFormFieldItemProps<UploadProps<any>, HTMLElement> & {
5
+ type PickUploadProps = Pick<UploadProps, 'listType' | 'action' | 'accept' | 'fileList' | 'onChange'>;
6
+ export type ProFormUploadButtonProps = ProFormFieldItemProps<UploadProps, UploadRef> & {
6
7
  /**
7
8
  * @name 上传文件的图标
8
9
  * @default UploadOutlined
@@ -1,4 +1,4 @@
1
- import type { DraggerProps, UploadProps } from 'antd/lib/upload';
1
+ import type { DraggerProps, UploadProps } from 'antd';
2
2
  import React from 'react';
3
3
  import type { ProFormFieldItemProps } from '../../typing';
4
4
  export type ProFormUploadDraggerProps = ProFormFieldItemProps<DraggerProps> & {
@@ -411,7 +411,7 @@ const BaseProLayout = props => {
411
411
  position: 'absolute',
412
412
  ...item
413
413
  }
414
- }, `bg-layout-${index}`);
414
+ }, item.src ? `${item.src}-${index}` : `bg-layout-${index}`);
415
415
  });
416
416
  }
417
417
  return null;