@ant-design/pro-components 3.1.4-0 → 3.1.6-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 (214) hide show
  1. package/dist/pro-components.min.js +1 -1
  2. package/es/card/ProCard.js +15 -7
  3. package/es/card/components/Card/index.js +43 -19
  4. package/es/card/components/Card/style.js +12 -1
  5. package/es/card/components/Statistic/index.js +2 -2
  6. package/es/card/components/StatisticCard/index.js +1 -1
  7. package/es/card/typing.d.ts +27 -8
  8. package/es/field/AllProField.d.ts +2 -0
  9. package/es/field/AllProField.js +3 -0
  10. package/es/field/PureProField.d.ts +2 -0
  11. package/es/field/PureProField.js +2 -0
  12. package/es/field/components/Cascader/index.js +8 -1
  13. package/es/field/components/Checkbox/index.js +5 -1
  14. package/es/field/components/ColorPicker/index.d.ts +1 -1
  15. package/es/field/components/DatePicker/index.d.ts +1 -1
  16. package/es/field/components/DatePicker/index.js +13 -1
  17. package/es/field/components/Digit/index.js +20 -3
  18. package/es/field/components/Money/index.js +51 -3
  19. package/es/field/components/Password/index.js +12 -11
  20. package/es/field/components/Radio/index.js +5 -1
  21. package/es/field/components/RangePicker/index.d.ts +1 -1
  22. package/es/field/components/Segmented/index.js +2 -1
  23. package/es/field/components/Select/SearchSelect/index.js +3 -5
  24. package/es/field/components/Select/index.d.ts +1 -1
  25. package/es/field/components/Select/index.js +1 -1
  26. package/es/field/components/Switch/index.js +10 -2
  27. package/es/field/components/Text/index.js +7 -1
  28. package/es/field/components/TextArea/index.js +6 -3
  29. package/es/field/components/TimePicker/index.js +10 -1
  30. package/es/field/components/TreeSelect/index.d.ts +2 -12
  31. package/es/field/components/TreeSelect/index.js +31 -17
  32. package/es/form/BaseForm/BaseForm.js +4 -3
  33. package/es/form/BaseForm/Submitter/index.d.ts +1 -1
  34. package/es/form/components/Digit/DigitRange.js +5 -2
  35. package/es/form/components/Digit/index.js +7 -2
  36. package/es/form/components/FormItem/FormItemRender/index.d.ts +1 -1
  37. package/es/form/components/FormItem/FormItemRender/index.js +10 -2
  38. package/es/form/components/FormItem/Group/index.js +12 -2
  39. package/es/form/components/List/ListContainer.js +2 -1
  40. package/es/form/components/Select/index.js +11 -1
  41. package/es/form/layouts/DrawerForm/index.d.ts +4 -4
  42. package/es/form/layouts/DrawerForm/index.js +1 -1
  43. package/es/form/layouts/LightFilter/index.js +22 -31
  44. package/es/form/layouts/LoginForm/index.js +10 -9
  45. package/es/form/layouts/LoginFormPage/index.js +17 -16
  46. package/es/form/layouts/ModalForm/index.d.ts +2 -2
  47. package/es/form/layouts/ProForm/index.d.ts +1 -1
  48. package/es/form/layouts/QueryFilter/Actions.js +2 -1
  49. package/es/form/layouts/QueryFilter/index.js +40 -23
  50. package/es/form/layouts/StepsForm/index.js +2 -2
  51. package/es/layout/ProLayout.d.ts +3 -3
  52. package/es/layout/ProLayout.js +13 -25
  53. package/es/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
  54. package/es/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
  55. package/es/layout/components/FooterToolbar/index.d.ts +1 -1
  56. package/es/layout/components/FooterToolbar/index.js +2 -2
  57. package/es/layout/components/GlobalFooter/index.js +3 -3
  58. package/es/layout/components/GlobalHeader/ActionsContent.js +6 -6
  59. package/es/layout/components/GlobalHeader/index.js +1 -1
  60. package/es/layout/components/GridContent/index.js +1 -1
  61. package/es/layout/components/Help/ProHelpPanel.js +11 -10
  62. package/es/layout/components/PageContainer/index.js +9 -9
  63. package/es/layout/components/PageHeader/index.js +10 -10
  64. package/es/layout/components/SettingDrawer/BlockCheckbox.js +2 -2
  65. package/es/layout/components/SettingDrawer/LayoutChange.js +3 -2
  66. package/es/layout/components/SettingDrawer/RegionalChange.js +3 -2
  67. package/es/layout/components/SettingDrawer/ThemeColor.js +3 -2
  68. package/es/layout/components/SettingDrawer/index.js +5 -4
  69. package/es/layout/components/SiderMenu/BaseMenu.js +3 -3
  70. package/es/layout/components/SiderMenu/SiderMenu.js +5 -5
  71. package/es/layout/components/TopNavHeader/index.js +3 -3
  72. package/es/layout/utils/getBreadcrumbProps.js +1 -1
  73. package/es/list/Item.d.ts +3 -3
  74. package/es/list/Item.js +8 -1
  75. package/es/list/ListView.js +1 -2
  76. package/es/list/ProListBase.d.ts +1 -1
  77. package/es/list/ProListBase.js +43 -37
  78. package/es/list/style/index.js +13 -0
  79. package/es/provider/index.d.ts +2 -2
  80. package/es/table/Table.js +14 -5
  81. package/es/table/components/Alert/index.js +6 -5
  82. package/es/table/components/ColumnSetting/index.js +9 -9
  83. package/es/table/components/DragSortTable/index.js +8 -4
  84. package/es/table/components/EditableTable/index.d.ts +1 -1
  85. package/es/table/components/EditableTable/index.js +5 -70
  86. package/es/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
  87. package/es/table/components/ListToolBar/HeaderMenu.js +4 -3
  88. package/es/table/components/ListToolBar/index.js +15 -12
  89. package/es/table/components/ListToolBar/style.js +2 -2
  90. package/es/table/components/ToolBar/DensityIcon.d.ts +2 -2
  91. package/es/table/components/ToolBar/DensityIcon.js +6 -3
  92. package/es/table/components/ToolBar/FullscreenIcon.d.ts +1 -1
  93. package/es/table/components/ToolBar/FullscreenIcon.js +11 -5
  94. package/es/table/useFetchData.js +4 -1
  95. package/es/table/utils/cellRenderToFromItem.js +1 -1
  96. package/es/table/utils/useDragSort.js +1 -1
  97. package/es/utils/components/DropdownFooter/index.d.ts +1 -1
  98. package/es/utils/components/FieldLabel/index.js +1 -1
  99. package/es/utils/components/FilterDropdown/index.d.ts +1 -1
  100. package/es/utils/components/FilterDropdown/index.js +1 -1
  101. package/es/utils/components/InlineErrorFormItem/index.js +5 -4
  102. package/es/utils/components/LabelIconTip/index.js +2 -2
  103. package/es/utils/hooks/useFetchData/index.js +0 -2
  104. package/es/utils/isUrl/index.js +1 -1
  105. package/es/utils/proFieldParsingText/index.d.ts +2 -2
  106. package/es/utils/proFieldParsingText/index.js +2 -2
  107. package/guidelines/components/pro-card.md +5 -4
  108. package/lib/card/ProCard.js +15 -7
  109. package/lib/card/components/Card/index.js +43 -19
  110. package/lib/card/components/Card/style.js +12 -1
  111. package/lib/card/components/Statistic/index.js +2 -2
  112. package/lib/card/components/StatisticCard/index.js +1 -1
  113. package/lib/card/typing.d.ts +27 -8
  114. package/lib/field/AllProField.d.ts +2 -0
  115. package/lib/field/AllProField.js +3 -0
  116. package/lib/field/PureProField.d.ts +2 -0
  117. package/lib/field/PureProField.js +2 -0
  118. package/lib/field/components/Cascader/index.js +8 -1
  119. package/lib/field/components/Checkbox/index.js +5 -1
  120. package/lib/field/components/ColorPicker/index.d.ts +1 -1
  121. package/lib/field/components/DatePicker/index.d.ts +1 -1
  122. package/lib/field/components/DatePicker/index.js +13 -1
  123. package/lib/field/components/Digit/index.js +20 -3
  124. package/lib/field/components/Money/index.js +50 -2
  125. package/lib/field/components/Password/index.js +11 -10
  126. package/lib/field/components/Percent/util.d.ts +1 -1
  127. package/lib/field/components/Radio/index.js +5 -1
  128. package/lib/field/components/RangePicker/index.d.ts +1 -1
  129. package/lib/field/components/Segmented/index.js +2 -1
  130. package/lib/field/components/Select/SearchSelect/index.js +2 -4
  131. package/lib/field/components/Select/index.d.ts +1 -1
  132. package/lib/field/components/Select/index.js +1 -1
  133. package/lib/field/components/Switch/index.js +10 -2
  134. package/lib/field/components/Text/index.js +7 -1
  135. package/lib/field/components/TextArea/index.js +6 -3
  136. package/lib/field/components/TimePicker/index.js +10 -1
  137. package/lib/field/components/TreeSelect/index.d.ts +2 -12
  138. package/lib/field/components/TreeSelect/index.js +30 -16
  139. package/lib/form/BaseForm/BaseForm.js +4 -3
  140. package/lib/form/BaseForm/Submitter/index.d.ts +1 -1
  141. package/lib/form/components/Digit/DigitRange.js +5 -2
  142. package/lib/form/components/Digit/index.js +7 -2
  143. package/lib/form/components/FormItem/FormItemRender/index.d.ts +1 -1
  144. package/lib/form/components/FormItem/FormItemRender/index.js +10 -2
  145. package/lib/form/components/FormItem/Group/index.js +12 -2
  146. package/lib/form/components/List/ListContainer.js +2 -1
  147. package/lib/form/components/Select/index.js +11 -1
  148. package/lib/form/layouts/DrawerForm/index.d.ts +4 -4
  149. package/lib/form/layouts/DrawerForm/index.js +1 -1
  150. package/lib/form/layouts/LightFilter/index.js +21 -30
  151. package/lib/form/layouts/LoginForm/index.js +10 -9
  152. package/lib/form/layouts/LoginFormPage/index.js +17 -16
  153. package/lib/form/layouts/ModalForm/index.d.ts +2 -2
  154. package/lib/form/layouts/ProForm/index.d.ts +1 -1
  155. package/lib/form/layouts/QueryFilter/Actions.js +2 -1
  156. package/lib/form/layouts/QueryFilter/index.js +39 -22
  157. package/lib/form/layouts/StepsForm/index.js +2 -2
  158. package/lib/layout/ProLayout.d.ts +3 -3
  159. package/lib/layout/ProLayout.js +13 -25
  160. package/lib/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
  161. package/lib/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
  162. package/lib/layout/components/FooterToolbar/index.d.ts +1 -1
  163. package/lib/layout/components/FooterToolbar/index.js +2 -2
  164. package/lib/layout/components/GlobalFooter/index.js +3 -3
  165. package/lib/layout/components/GlobalHeader/ActionsContent.js +6 -6
  166. package/lib/layout/components/GlobalHeader/index.js +1 -1
  167. package/lib/layout/components/GridContent/index.js +1 -1
  168. package/lib/layout/components/Help/ProHelpPanel.js +11 -10
  169. package/lib/layout/components/PageContainer/index.js +9 -9
  170. package/lib/layout/components/PageHeader/index.js +10 -10
  171. package/lib/layout/components/SettingDrawer/BlockCheckbox.js +2 -2
  172. package/lib/layout/components/SettingDrawer/LayoutChange.js +3 -2
  173. package/lib/layout/components/SettingDrawer/RegionalChange.js +3 -2
  174. package/lib/layout/components/SettingDrawer/ThemeColor.js +3 -2
  175. package/lib/layout/components/SettingDrawer/index.js +5 -4
  176. package/lib/layout/components/SiderMenu/BaseMenu.js +3 -3
  177. package/lib/layout/components/SiderMenu/SiderMenu.js +5 -5
  178. package/lib/layout/components/TopNavHeader/index.js +3 -3
  179. package/lib/layout/utils/getBreadcrumbProps.js +1 -1
  180. package/lib/list/Item.d.ts +3 -3
  181. package/lib/list/Item.js +8 -1
  182. package/lib/list/ListView.js +1 -2
  183. package/lib/list/ProListBase.d.ts +1 -1
  184. package/lib/list/ProListBase.js +42 -36
  185. package/lib/list/style/index.js +13 -0
  186. package/lib/provider/index.d.ts +2 -2
  187. package/lib/table/Table.js +14 -5
  188. package/lib/table/components/Alert/index.js +6 -5
  189. package/lib/table/components/ColumnSetting/index.js +9 -9
  190. package/lib/table/components/DragSortTable/index.js +8 -4
  191. package/lib/table/components/EditableTable/index.d.ts +1 -1
  192. package/lib/table/components/EditableTable/index.js +5 -70
  193. package/lib/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
  194. package/lib/table/components/ListToolBar/HeaderMenu.js +4 -3
  195. package/lib/table/components/ListToolBar/index.js +15 -12
  196. package/lib/table/components/ListToolBar/style.js +2 -2
  197. package/lib/table/components/ToolBar/DensityIcon.d.ts +2 -2
  198. package/lib/table/components/ToolBar/DensityIcon.js +6 -3
  199. package/lib/table/components/ToolBar/FullscreenIcon.d.ts +1 -1
  200. package/lib/table/components/ToolBar/FullscreenIcon.js +11 -5
  201. package/lib/table/useFetchData.js +4 -1
  202. package/lib/table/utils/cellRenderToFromItem.js +1 -1
  203. package/lib/table/utils/useDragSort.js +1 -1
  204. package/lib/utils/components/DropdownFooter/index.d.ts +1 -1
  205. package/lib/utils/components/FieldLabel/index.js +1 -1
  206. package/lib/utils/components/FilterDropdown/index.d.ts +1 -1
  207. package/lib/utils/components/FilterDropdown/index.js +1 -1
  208. package/lib/utils/components/InlineErrorFormItem/index.js +5 -4
  209. package/lib/utils/components/LabelIconTip/index.js +2 -2
  210. package/lib/utils/hooks/useFetchData/index.js +0 -2
  211. package/lib/utils/isUrl/index.js +1 -1
  212. package/lib/utils/proFieldParsingText/index.d.ts +2 -2
  213. package/lib/utils/proFieldParsingText/index.js +2 -2
  214. package/package.json +31 -30
@@ -7,7 +7,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  /**
8
8
  * 最基本的组件,就是个普通的 Input
9
9
  *
10
- * @param
10
+ * @param text
11
+ * @param mode
12
+ * @param render
13
+ * @param formItemRender
14
+ * @param fieldProps
15
+ * @param emptyText
16
+ * @param ref
11
17
  */
12
18
  const FieldText = ({
13
19
  text,
@@ -7,7 +7,8 @@ import FieldTextAreaReadonly from "./readonly";
7
7
  /**
8
8
  * 最基本的组件,就是个普通的 Input.TextArea
9
9
  *
10
- * @param
10
+ * @param props
11
+ * @param ref
11
12
  */
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const FieldTextArea = (props, ref) => {
@@ -36,8 +37,10 @@ const FieldTextArea = (props, ref) => {
36
37
  const dom = /*#__PURE__*/_jsx(Input.TextArea, {
37
38
  ref: ref,
38
39
  rows: 3,
39
- onKeyPress: e => {
40
- if (e.key === 'Enter') e.stopPropagation();
40
+ onKeyDown: e => {
41
+ if (e.key === 'Enter') {
42
+ e.stopPropagation();
43
+ }
41
44
  },
42
45
  placeholder: intl.getMessage('tableForm.inputPlaceholder', '请输入'),
43
46
  ...fieldProps
@@ -99,7 +99,16 @@ const FieldTimePicker = ({
99
99
  /**
100
100
  * 时间区间选择
101
101
  *
102
- * @param param0
102
+ * @param text
103
+ * @param light
104
+ * @param label
105
+ * @param mode
106
+ * @param lightLabel
107
+ * @param format
108
+ * @param render
109
+ * @param formItemRender
110
+ * @param fieldProps
111
+ * @param variant
103
112
  * @param ref
104
113
  */
105
114
  const FieldTimeRangePickerComponents = ({
@@ -1,12 +1,6 @@
1
- import type { RadioGroupProps, TreeSelectProps } from 'antd';
1
+ import type { TreeSelectProps } from 'antd';
2
2
  import React from 'react';
3
- import type { FieldSelectProps } from '../Select';
4
- export type GroupProps = {
5
- options?: RadioGroupProps['options'];
6
- radioType?: 'button' | 'radio';
7
- variant?: 'outlined' | 'borderless' | 'filled';
8
- } & FieldSelectProps;
9
- export type TreeSelectFieldProps = TreeSelectProps<any> & {
3
+ export type TreeSelectFieldProps = TreeSelectProps & {
10
4
  /**
11
5
  * 当搜索关键词发生变化时是否请求远程数据
12
6
  *
@@ -15,10 +9,6 @@ export type TreeSelectFieldProps = TreeSelectProps<any> & {
15
9
  fetchDataOnSearch?: boolean;
16
10
  };
17
11
  declare const _default: React.ForwardRefExoticComponent<import("../../../provider").BaseProFieldFC & import("../../../provider").ProRenderFieldPropsType & {
18
- options?: (string | number | import("antd").CheckboxOptionType<any>)[] | undefined;
19
- radioType?: "button" | "radio" | undefined;
20
- variant?: "outlined" | "filled" | "borderless" | undefined;
21
- } & {
22
12
  text: string;
23
13
  valueEnum?: import("src/utils/typing").ProFieldValueEnumType | undefined;
24
14
  debounceTime?: number | undefined;
@@ -1,4 +1,4 @@
1
- import { useControlledState } from '@rc-component/util';
1
+ import { omit, useControlledState } from '@rc-component/util';
2
2
  import { ConfigProvider, Spin, TreeSelect } from 'antd';
3
3
  import { clsx } from 'clsx';
4
4
  import React, { useCallback, useContext, useImperativeHandle, useMemo, useRef, useState } from 'react';
@@ -11,10 +11,17 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
11
11
  /**
12
12
  * Tree select
13
13
  * A function that returns a React component.
14
+
15
+ * @param formItemRender
16
+ * @param mode
17
+ * @param light
18
+ * @param label
19
+ * @param render
20
+ * @param propsVariant
21
+ * @param rest
14
22
  * @param ref
15
23
  */
16
24
  const FieldTreeSelect = ({
17
- radioType,
18
25
  formItemRender,
19
26
  mode,
20
27
  light,
@@ -30,17 +37,22 @@ const FieldTreeSelect = ({
30
37
  const treeSelectRef = useRef(null);
31
38
  const [open, setOpen] = useState(false);
32
39
  const {
33
- onSearch,
34
40
  onClear,
35
41
  onChange: propsOnChange,
36
42
  onBlur,
37
43
  showSearch,
38
- autoClearSearchValue,
39
- treeData,
40
44
  fetchDataOnSearch,
41
- searchValue: propsSearchValue,
45
+ onSearch: propsOnSearch,
46
+ autoClearSearchValue: propsAutoClearSearchValue,
47
+ searchValue: propsSearchValueProp,
42
48
  ...fieldProps
43
- } = rest.fieldProps;
49
+ } = omit(rest.fieldProps, ['treeData']);
50
+ const showSearchConfig = typeof showSearch === 'object' ? showSearch : {};
51
+ const onSearch = showSearchConfig?.onSearch !== undefined ? showSearchConfig.onSearch : propsOnSearch;
52
+ //兼容过时API autoClearSearchValue
53
+ const autoClearSearchValue = showSearchConfig?.autoClearSearchValue !== undefined ? showSearchConfig.autoClearSearchValue : propsAutoClearSearchValue;
54
+ //兼容过时API searchValue
55
+ const propsSearchValue = showSearchConfig?.searchValue !== undefined ? showSearchConfig.searchValue : propsSearchValueProp;
44
56
  const variant = propsVariant ?? fieldProps?.variant;
45
57
  const intl = useIntl();
46
58
  const [loading, options, fetchData] = useFieldFetchData({
@@ -134,14 +146,23 @@ const FieldTreeSelect = ({
134
146
  } : undefined,
135
147
  ...fieldProps,
136
148
  treeData: options,
137
- showSearch: showSearch,
149
+ showSearch: showSearch ? {
150
+ ...showSearchConfig,
151
+ searchValue: searchValue,
152
+ autoClearSearchValue: autoClearSearchValue,
153
+ onSearch: value => {
154
+ // fix 不支持请求的情况下不刷新options
155
+ if (fetchDataOnSearch && rest?.request) {
156
+ fetchData(value);
157
+ }
158
+ setSearchValue(value);
159
+ }
160
+ } : showSearch,
138
161
  style: {
139
162
  minWidth: 60,
140
163
  ...fieldProps.style
141
164
  },
142
165
  allowClear: fieldProps.allowClear !== false,
143
- searchValue: searchValue,
144
- autoClearSearchValue: autoClearSearchValue,
145
166
  onClear: () => {
146
167
  onClear?.();
147
168
  fetchData(undefined);
@@ -150,13 +171,6 @@ const FieldTreeSelect = ({
150
171
  }
151
172
  },
152
173
  onChange: onChange,
153
- onSearch: value => {
154
- // fix 不支持请求的情况下不刷新options
155
- if (fetchDataOnSearch && rest?.request) {
156
- fetchData(value);
157
- }
158
- setSearchValue(value);
159
- },
160
174
  onBlur: event => {
161
175
  setSearchValue(undefined);
162
176
  fetchData(undefined);
@@ -590,7 +590,7 @@ export function BaseForm(props) {
590
590
  children: /*#__PURE__*/_jsx(FormListContext.Provider, {
591
591
  value: {},
592
592
  children: /*#__PURE__*/_jsx(Form, {
593
- onKeyPress: event => {
593
+ onKeyDown: event => {
594
594
  if (!isKeyPressSubmit) return;
595
595
  if (event.key === 'Enter') {
596
596
  formRef.current?.submit();
@@ -598,7 +598,7 @@ export function BaseForm(props) {
598
598
  },
599
599
  autoComplete: "off",
600
600
  form: form,
601
- ...omit(propRest, ['ref', 'labelWidth', 'autoFocusFirstInput']),
601
+ ...omit(propRest, ['ref', 'labelWidth', 'autoFocusFirstInput', 'rootClassName']),
602
602
  ref: instance => {
603
603
  if (!formRef.current) return;
604
604
  formRef.current.nativeElement = instance?.nativeElement;
@@ -622,7 +622,8 @@ export function BaseForm(props) {
622
622
  onValuesChange: (changedValues, values) => {
623
623
  propRest?.onValuesChange?.(transformKey(changedValues, !!omitNil), transformKey(values, !!omitNil));
624
624
  },
625
- className: clsx(props.className, prefixCls, hashId),
625
+ className: props.className,
626
+ rootClassName: clsx(prefixCls, hashId, props.rootClassName),
626
627
  onFinish: onFinish,
627
628
  children: /*#__PURE__*/_jsx(BaseFormComponents, {
628
629
  transformKey: transformKey,
@@ -26,7 +26,7 @@ export type SubmitterProps<T = Record<string, any>> = {
26
26
  render?: ((props: SubmitterProps & T & {
27
27
  submit: () => void;
28
28
  reset: () => void;
29
- }, dom: JSX.Element[]) => React.ReactNode[] | React.ReactNode | false) | false;
29
+ }, dom: React.JSX.Element[]) => React.ReactNode[] | React.ReactNode | false) | false;
30
30
  };
31
31
  /**
32
32
  * FormFooter 的组件,可以自动进行一些配置
@@ -4,9 +4,12 @@ import { ProConfigProvider } from "../../../provider";
4
4
  import ProFormField from "../Field";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  /**
7
- * 数组选择组件
7
+ * 数字范围输入组件
8
8
  *
9
- * @param
9
+ * @param fieldProps
10
+ * @param proFieldProps
11
+ * @param rest
12
+ * @param ref
10
13
  */
11
14
  const ProFormDigit = ({
12
15
  fieldProps,
@@ -4,9 +4,14 @@ import { ProConfigProvider } from "../../../provider";
4
4
  import ProFormField from "../Field";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  /**
7
- * 数组选择组件
7
+ * 数字输入组件
8
8
  *
9
- * @param
9
+ * @param fieldProps
10
+ * @param min
11
+ * @param proFieldProps
12
+ * @param max
13
+ * @param rest
14
+ * @param ref
10
15
  */
11
16
  const ProFormDigit = ({
12
17
  fieldProps,
@@ -62,7 +62,7 @@ export declare function pickControlProps(props: FormControlInjectProps): {
62
62
  onChange: (value: any) => void;
63
63
  };
64
64
  /**
65
- * 提取props中的 value、onChangeid 属性
65
+ * 提取 props 中的 value、onChangeid 及无障碍属性(aria-describedby、aria-invalid、aria-required)
66
66
  */
67
67
  export declare function pickControlPropsWithId(props: FormControlInjectProps): {
68
68
  id: string;
@@ -84,14 +84,22 @@ export function pickControlProps(props) {
84
84
  onChange: value => props.onChange(value?.target ? value.target.value : value)
85
85
  };
86
86
  }
87
+ const ARIA_CONTROL_ATTRS = ['aria-describedby', 'aria-invalid', 'aria-required'];
87
88
 
88
89
  /**
89
- * 提取props中的 value、onChangeid 属性
90
+ * 提取 props 中的 value、onChangeid 及无障碍属性(aria-describedby、aria-invalid、aria-required)
90
91
  */
91
92
  export function pickControlPropsWithId(props) {
93
+ const ariaAttrs = ARIA_CONTROL_ATTRS.reduce((acc, key) => {
94
+ if (props[key] !== undefined) {
95
+ acc[key] = props[key];
96
+ }
97
+ return acc;
98
+ }, {});
92
99
  return {
93
100
  ...pickControlProps(props),
94
- id: props.id
101
+ id: props.id,
102
+ ...ariaAttrs
95
103
  };
96
104
  }
97
105
 
@@ -117,7 +117,7 @@ const Group = /*#__PURE__*/React.forwardRef((props, ref) => {
117
117
  display: 'none'
118
118
  },
119
119
  children: hiddenChildren
120
- }) : null];
120
+ }, "hidden") : null];
121
121
  }, [children, RowWrapper, Wrapper, autoFocus]);
122
122
  return wrapSSR( /*#__PURE__*/_jsx(ColWrapper, {
123
123
  children: /*#__PURE__*/_jsxs("div", {
@@ -127,11 +127,19 @@ const Group = /*#__PURE__*/React.forwardRef((props, ref) => {
127
127
  style: style,
128
128
  ref: ref,
129
129
  children: [hiddenDoms, (title || tooltip || extra) && /*#__PURE__*/_jsx("div", {
130
- className: `${className}-title ${hashId}`.trim(),
130
+ role: "button",
131
+ tabIndex: 0,
132
+ className: clsx(`${className}-title`, hashId),
131
133
  style: titleStyle,
132
134
  onClick: () => {
133
135
  setCollapsed(!collapsed);
134
136
  },
137
+ onKeyDown: e => {
138
+ if (e.key === 'Enter' || e.key === ' ') {
139
+ e.preventDefault();
140
+ setCollapsed(!collapsed);
141
+ }
142
+ },
135
143
  children: extra ? /*#__PURE__*/_jsxs("div", {
136
144
  style: {
137
145
  display: 'flex',
@@ -140,7 +148,9 @@ const Group = /*#__PURE__*/React.forwardRef((props, ref) => {
140
148
  justifyContent: 'space-between'
141
149
  },
142
150
  children: [titleDom, /*#__PURE__*/_jsx("span", {
151
+ role: "presentation",
143
152
  onClick: e => e.stopPropagation(),
153
+ onKeyDown: e => e.stopPropagation(),
144
154
  children: extra
145
155
  })]
146
156
  }) : titleDom
@@ -1,6 +1,7 @@
1
1
  import { PlusOutlined } from '@ant-design/icons';
2
2
  import { omit } from '@rc-component/util';
3
3
  import { Button } from 'antd';
4
+ import { clsx } from 'clsx';
4
5
  import { useContext, useMemo, useRef, useState } from 'react';
5
6
  import { ProProvider, useIntl } from "../../../provider";
6
7
  import { nanoid, runFunction } from "../../../utils";
@@ -97,7 +98,7 @@ const ProFormListContainer = props => {
97
98
  creatorButtonText = intl.getMessage('editableTable.action.add', '添加一行数据')
98
99
  } = creatorButtonProps || {};
99
100
  return /*#__PURE__*/_jsx(Button, {
100
- className: `${prefixCls}-creator-button-${position} ${hashId || ''}`.trim(),
101
+ className: clsx(`${prefixCls}-creator-button-${position}`, hashId),
101
102
  type: "dashed",
102
103
  loading: loading,
103
104
  block: true,
@@ -8,7 +8,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
8
8
  /**
9
9
  * 选择框
10
10
  *
11
- * @param
11
+ * @param fieldProps
12
+ * @param children
13
+ * @param params
14
+ * @param proFieldProps
15
+ * @param mode
16
+ * @param valueEnum
17
+ * @param request
18
+ * @param showSearch
19
+ * @param options
20
+ * @param rest
21
+ * @param ref
12
22
  */
13
23
  const ProFormSelectComponents = ({
14
24
  fieldProps,
@@ -3,8 +3,8 @@ import React from 'react';
3
3
  import type { CommonFormProps } from '../../BaseForm';
4
4
  export type CustomizeResizeType = {
5
5
  onResize?: () => void;
6
- maxWidth?: DrawerProps['width'];
7
- minWidth?: DrawerProps['width'];
6
+ maxWidth?: DrawerProps['size'];
7
+ minWidth?: DrawerProps['size'];
8
8
  };
9
9
  export type DrawerFormProps<T = Record<string, any>, U = Record<string, any>> = Omit<FormProps, 'onFinish' | 'title'> & CommonFormProps<T, U> & {
10
10
  /**
@@ -22,7 +22,7 @@ export type DrawerFormProps<T = Record<string, any>, U = Record<string, any>> =
22
22
  /** @name 提交数据时,禁用取消按钮的超时时间(毫秒)。 */
23
23
  submitTimeout?: number;
24
24
  /** @name 用于触发抽屉打开的 dom ,只能设置一个*/
25
- trigger?: JSX.Element;
25
+ trigger?: React.JSX.Element;
26
26
  /** @name 受控的打开关闭 */
27
27
  open?: DrawerProps['open'];
28
28
  /** @name 打开关闭的事件 */
@@ -32,7 +32,7 @@ export type DrawerFormProps<T = Record<string, any>, U = Record<string, any>> =
32
32
  /** @name 抽屉的标题 */
33
33
  title?: DrawerProps['title'];
34
34
  /** @name 抽屉的宽度 */
35
- width?: DrawerProps['width'];
35
+ width?: DrawerProps['size'];
36
36
  /**
37
37
  *
38
38
  * @name draggableDrawer
@@ -51,7 +51,7 @@ function DrawerForm({
51
51
  wrapSSR,
52
52
  hashId
53
53
  } = useStyle(baseClassName);
54
- const getCls = className => `${baseClassName}-${className} ${hashId}`;
54
+ const getCls = className => `${baseClassName}-${className}`;
55
55
  const [, forceUpdate] = useState([]);
56
56
  const [loading, setLoading] = useState(false);
57
57
  const [resizableDrawer, setResizableDrawer] = useState(false);
@@ -2,7 +2,7 @@ import { FilterOutlined } from '@ant-design/icons';
2
2
  import { omit } from '@rc-component/util';
3
3
  import { ConfigProvider } from 'antd';
4
4
  import { clsx } from 'clsx';
5
- import React, { useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
5
+ import React, { useContext, useImperativeHandle, useMemo, useRef, useState } from 'react';
6
6
  import { useIntl } from "../../../provider";
7
7
  import { FieldLabel, FilterDropdown } from "../../../utils";
8
8
  import { BaseForm } from "../../BaseForm";
@@ -35,16 +35,22 @@ const LightFilterContainer = props => {
35
35
  hashId
36
36
  } = useStyle(lightFilterClassName);
37
37
  const [open, setOpen] = useState(false);
38
- const [moreValues, setMoreValues] = useState(() => {
39
- return {
40
- ...values
41
- };
42
- });
43
- useEffect(() => {
44
- setMoreValues({
45
- ...values
38
+ const [moreValues, setMoreValues] = useState(() => ({
39
+ ...values
40
+ }));
41
+ const collapseLabelNode = useMemo(() => {
42
+ if (collapseLabel) return collapseLabel;
43
+ if (collapse) {
44
+ return /*#__PURE__*/_jsx(FilterOutlined, {
45
+ className: clsx(`${lightFilterClassName}-collapse-icon`, hashId)
46
+ });
47
+ }
48
+ return /*#__PURE__*/_jsx(FieldLabel, {
49
+ variant: variant,
50
+ size: size,
51
+ label: intl.getMessage('form.lightFilter.more', '更多筛选')
46
52
  });
47
- }, [values]);
53
+ }, [collapseLabel, collapse, lightFilterClassName, hashId, variant, size, intl]);
48
54
  const {
49
55
  collapseItems,
50
56
  outsideItems
@@ -66,27 +72,12 @@ const LightFilterContainer = props => {
66
72
  outsideItems: outsideItemsArr
67
73
  };
68
74
  }, [props.items]);
69
- const renderCollapseLabelRender = () => {
70
- if (collapseLabel) {
71
- return collapseLabel;
72
- }
73
- if (collapse) {
74
- return /*#__PURE__*/_jsx(FilterOutlined, {
75
- className: `${lightFilterClassName}-collapse-icon ${hashId}`.trim()
76
- });
77
- }
78
- return /*#__PURE__*/_jsx(FieldLabel, {
79
- variant: variant,
80
- size: size,
81
- label: intl.getMessage('form.lightFilter.more', '更多筛选')
82
- });
83
- };
84
75
  return wrapSSR( /*#__PURE__*/_jsx("div", {
85
76
  className: clsx(lightFilterClassName, hashId, `${lightFilterClassName}-${size}`, {
86
77
  [`${lightFilterClassName}-effective`]: Object.keys(values).some(key => Array.isArray(values[key]) ? values[key].length > 0 : values[key])
87
78
  }),
88
79
  children: /*#__PURE__*/_jsxs("div", {
89
- className: `${lightFilterClassName}-container ${hashId}`.trim(),
80
+ className: clsx(`${lightFilterClassName}-container`, hashId),
90
81
  children: [outsideItems.map((child, index) => {
91
82
  if (!child?.props) {
92
83
  return child;
@@ -99,7 +90,7 @@ const LightFilterContainer = props => {
99
90
  } = child?.props || {};
100
91
  const newPlacement = fieldProps?.placement ? fieldProps?.placement : placement;
101
92
  return /*#__PURE__*/_jsx("div", {
102
- className: `${lightFilterClassName}-item ${hashId}`.trim(),
93
+ className: clsx(`${lightFilterClassName}-item`, hashId),
103
94
  children: /*#__PURE__*/React.cloneElement(child, {
104
95
  fieldProps: {
105
96
  ...child.props.fieldProps,
@@ -117,7 +108,7 @@ const LightFilterContainer = props => {
117
108
  })
118
109
  }, key || index);
119
110
  }), collapseItems.length ? /*#__PURE__*/_jsx("div", {
120
- className: `${lightFilterClassName}-item ${hashId}`.trim(),
111
+ className: clsx(`${lightFilterClassName}-item`, hashId),
121
112
  children: /*#__PURE__*/_jsx(FilterDropdown, {
122
113
  padding: 24,
123
114
  open: open,
@@ -126,7 +117,7 @@ const LightFilterContainer = props => {
126
117
  },
127
118
  placement: placement,
128
119
  popoverProps: popoverProps,
129
- label: renderCollapseLabelRender(),
120
+ label: collapseLabelNode,
130
121
  footerRender: footerRender,
131
122
  footer: {
132
123
  onConfirm: () => {
@@ -169,7 +160,7 @@ const LightFilterContainer = props => {
169
160
  }
170
161
  const newPlacement = fieldProps?.placement ? fieldProps?.placement : placement;
171
162
  return /*#__PURE__*/_jsx("div", {
172
- className: `${lightFilterClassName}-line ${hashId}`.trim(),
163
+ className: clsx(`${lightFilterClassName}-line`, hashId),
173
164
  children: /*#__PURE__*/React.cloneElement(child, {
174
165
  fieldProps: {
175
166
  ...newFieldProps,
@@ -244,7 +235,7 @@ function LightFilter(props) {
244
235
  onValuesChange(newValues, newAllValues);
245
236
  }
246
237
  }
247
- });
238
+ }, JSON.stringify(values || {}));
248
239
  },
249
240
  formRef: formRef,
250
241
  formItemProps: {
@@ -46,14 +46,15 @@ function LoginForm(props) {
46
46
  wrapSSR,
47
47
  hashId
48
48
  } = useStyle(baseClassName);
49
- const getCls = className => `${baseClassName}-${className} ${hashId}`;
49
+ const getCls = className => `${baseClassName}-${className}`;
50
50
 
51
51
  /** 生成logo 的dom,如果是string 设置为图片 如果是个 dom 就原样保留 */
52
52
  const logoDom = useMemo(() => {
53
53
  if (!logo) return null;
54
54
  if (typeof logo === 'string') {
55
55
  return /*#__PURE__*/_jsx("img", {
56
- src: logo
56
+ src: logo,
57
+ alt: ""
57
58
  });
58
59
  }
59
60
  return logo;
@@ -62,22 +63,22 @@ function LoginForm(props) {
62
63
  className: clsx(getCls('container'), hashId),
63
64
  style: containerStyle,
64
65
  children: [/*#__PURE__*/_jsxs("div", {
65
- className: `${getCls('top')} ${hashId}`.trim(),
66
+ className: clsx(getCls('top'), hashId),
66
67
  children: [title || logoDom ? /*#__PURE__*/_jsxs("div", {
67
- className: `${getCls('header')}`,
68
+ className: clsx(getCls('header'), hashId),
68
69
  children: [logoDom ? /*#__PURE__*/_jsx("span", {
69
- className: getCls('logo'),
70
+ className: clsx(getCls('logo'), hashId),
70
71
  children: logoDom
71
72
  }) : null, title ? /*#__PURE__*/_jsx("span", {
72
- className: getCls('title'),
73
+ className: clsx(getCls('title'), hashId),
73
74
  children: title
74
75
  }) : null]
75
76
  }) : null, subTitle ? /*#__PURE__*/_jsx("div", {
76
- className: getCls('desc'),
77
+ className: clsx(getCls('desc'), hashId),
77
78
  children: subTitle
78
79
  }) : null]
79
80
  }), /*#__PURE__*/_jsxs("div", {
80
- className: getCls('main'),
81
+ className: clsx(getCls('main'), hashId),
81
82
  style: {
82
83
  width: 328,
83
84
  ...contentStyle
@@ -88,7 +89,7 @@ function LoginForm(props) {
88
89
  submitter: submitter,
89
90
  children: [message, children]
90
91
  }), actions ? /*#__PURE__*/_jsx("div", {
91
- className: getCls('main-other'),
92
+ className: clsx(getCls('main-other'), hashId),
92
93
  style: otherStyle,
93
94
  children: actions
94
95
  }) : null]
@@ -49,14 +49,15 @@ export function LoginFormPage(props) {
49
49
  wrapSSR,
50
50
  hashId
51
51
  } = useStyle(baseClassName);
52
- const getCls = className => `${baseClassName}-${className} ${hashId}`.trim();
52
+ const getCls = className => `${baseClassName}-${className}`;
53
53
 
54
54
  /** 生成logo 的dom,如果是string 设置为图片 如果是个 dom 就原样保留 */
55
55
  const logoDom = useMemo(() => {
56
56
  if (!logo) return null;
57
57
  if (typeof logo === 'string') {
58
58
  return /*#__PURE__*/_jsx("img", {
59
- src: logo
59
+ src: logo,
60
+ alt: ""
60
61
  });
61
62
  }
62
63
  return logo;
@@ -96,43 +97,43 @@ export function LoginFormPage(props) {
96
97
  }) : null, /*#__PURE__*/_jsxs("div", {
97
98
  className: clsx(baseClassName, hashId),
98
99
  children: [/*#__PURE__*/_jsx("div", {
99
- className: getCls('notice'),
100
+ className: clsx(getCls('notice'), hashId),
100
101
  children: activityConfig && /*#__PURE__*/_jsxs("div", {
101
- className: getCls('notice-activity'),
102
+ className: clsx(getCls('notice-activity'), hashId),
102
103
  style: activityConfig.style,
103
104
  children: [activityConfig.title && /*#__PURE__*/_jsx("div", {
104
- className: getCls('notice-activity-title'),
105
+ className: clsx(getCls('notice-activity-title'), hashId),
105
106
  children: activityConfig.title
106
107
  }), activityConfig.subTitle && /*#__PURE__*/_jsx("div", {
107
- className: getCls('notice-activity-subTitle'),
108
+ className: clsx(getCls('notice-activity-subTitle'), hashId),
108
109
  children: activityConfig.subTitle
109
110
  }), activityConfig.action && /*#__PURE__*/_jsx("div", {
110
- className: getCls('notice-activity-action'),
111
+ className: clsx(getCls('notice-activity-action'), hashId),
111
112
  children: activityConfig.action
112
113
  })]
113
114
  })
114
115
  }), /*#__PURE__*/_jsx("div", {
115
- className: getCls('left'),
116
+ className: clsx(getCls('left'), hashId),
116
117
  children: /*#__PURE__*/_jsxs("div", {
117
- className: getCls('container'),
118
+ className: clsx(getCls('container'), hashId),
118
119
  style: containerStyle,
119
120
  children: [/*#__PURE__*/_jsxs("div", {
120
- className: getCls('top'),
121
+ className: clsx(getCls('top'), hashId),
121
122
  children: [title || logoDom ? /*#__PURE__*/_jsxs("div", {
122
- className: getCls('header'),
123
+ className: clsx(getCls('header'), hashId),
123
124
  children: [logoDom ? /*#__PURE__*/_jsx("span", {
124
- className: getCls('logo'),
125
+ className: clsx(getCls('logo'), hashId),
125
126
  children: logoDom
126
127
  }) : null, title ? /*#__PURE__*/_jsx("span", {
127
- className: getCls('title'),
128
+ className: clsx(getCls('title'), hashId),
128
129
  children: title
129
130
  }) : null]
130
131
  }) : null, subTitle ? /*#__PURE__*/_jsx("div", {
131
- className: getCls('desc'),
132
+ className: clsx(getCls('desc'), hashId),
132
133
  children: subTitle
133
134
  }) : null]
134
135
  }), /*#__PURE__*/_jsxs("div", {
135
- className: getCls('main'),
136
+ className: clsx(getCls('main'), hashId),
136
137
  style: mainStyle,
137
138
  children: [/*#__PURE__*/_jsxs(ProForm, {
138
139
  isKeyPressSubmit: true,
@@ -140,7 +141,7 @@ export function LoginFormPage(props) {
140
141
  submitter: submitter,
141
142
  children: [message, children]
142
143
  }), actions ? /*#__PURE__*/_jsx("div", {
143
- className: getCls('other'),
144
+ className: clsx(getCls('other'), hashId),
144
145
  style: otherStyle,
145
146
  children: actions
146
147
  }) : null]