@para-ui/core 4.0.53 → 4.0.55

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 (160) hide show
  1. package/Argv/index.js +5 -4
  2. package/AutoButton/index.d.ts +3 -0
  3. package/AutoButton/index.js +19 -6
  4. package/Button/SplitButton.d.ts +3 -0
  5. package/Button/index.d.ts +4 -0
  6. package/Button/index.js +17 -352
  7. package/ButtonGroup/index.js +5 -1
  8. package/Cascader/Cascader.d.ts +3 -0
  9. package/Cascader/index.js +11 -7
  10. package/ComboSelect/index.js +10 -10
  11. package/CycleSelector/index.js +7 -2
  12. package/DatePicker/index.js +10 -4
  13. package/Descriptions/index.js +5 -1
  14. package/Desktop/index.js +4 -1
  15. package/Drawer/index.js +5 -1
  16. package/DynamicMultiBox/index.js +11 -11
  17. package/DynamicMultiBox/interface.d.ts +1 -1
  18. package/FieldForm/ErrorList.d.ts +16 -0
  19. package/FieldForm/FieldFormItem/ItemHolder.d.ts +18 -0
  20. package/FieldForm/FieldFormItem/MemoInput.d.ts +14 -0
  21. package/FieldForm/FieldFormItem/StatusProvider.d.ts +20 -0
  22. package/FieldForm/FieldFormItem/index.d.ts +58 -0
  23. package/FieldForm/Form.d.ts +36 -0
  24. package/FieldForm/FormItemInput.d.ts +21 -0
  25. package/FieldForm/FormItemLabel.d.ts +21 -0
  26. package/FieldForm/FormList.d.ts +23 -0
  27. package/FieldForm/context.d.ts +33 -0
  28. package/FieldForm/hooks/useChildren.d.ts +2 -0
  29. package/FieldForm/hooks/useDebounce.d.ts +1 -0
  30. package/FieldForm/hooks/useForm.d.ts +6 -0
  31. package/FieldForm/hooks/useFormInstance.d.ts +2 -0
  32. package/FieldForm/hooks/useFormItemStatus.d.ts +9 -0
  33. package/FieldForm/hooks/useFrameState.d.ts +3 -0
  34. package/FieldForm/hooks/useItemRef.d.ts +3 -0
  35. package/FieldForm/index.d.ts +30 -0
  36. package/FieldForm/index.js +5326 -0
  37. package/FieldForm/interface.d.ts +2 -0
  38. package/FieldForm/lang/en_US.d.ts +51 -0
  39. package/FieldForm/lang/index.d.ts +105 -0
  40. package/FieldForm/lang/zh_CN.d.ts +51 -0
  41. package/FieldForm/util.d.ts +21 -0
  42. package/Form/index.js +10 -10
  43. package/FormItem/index.js +10 -10
  44. package/FunctionModal/index.js +7 -6
  45. package/Image/index.js +7 -56
  46. package/InputCode/index.js +4 -1
  47. package/Modal/index.js +2 -1
  48. package/OperateBtn/index.js +5 -6
  49. package/PageHeader/index.js +5 -1
  50. package/Pagination/index.js +4 -1
  51. package/PopConfirm/index.js +14 -213
  52. package/PopMenu/index.js +2 -2
  53. package/QuickReply/index.js +6 -7
  54. package/README.md +17 -0
  55. package/Result/index.js +2 -2
  56. package/Selector/index.js +1 -1
  57. package/SelectorPicker/index.js +1 -1
  58. package/Stepper/index.js +1 -1
  59. package/Switch/index.d.ts +4 -0
  60. package/Switch/index.js +5 -4
  61. package/Table/index.js +4 -5
  62. package/Tabs/index.js +8 -9
  63. package/Tag/index.js +87 -55
  64. package/TextEditor/index.d.ts +2 -0
  65. package/TextEditor/index.js +27 -6
  66. package/TimePicker/index.js +9 -3
  67. package/Timeline/index.js +2 -1
  68. package/ToggleButton/index.js +7 -2
  69. package/Transfer/index.d.ts +1 -0
  70. package/Transfer/index.js +125 -121
  71. package/Tree/index.js +6 -5
  72. package/Upload/index.js +13 -11
  73. package/_verture/{Portal-42560ff0.js → Portal-502bb85e.js} +30 -481
  74. package/_verture/{defineProperty-f0e15205.js → defineProperty-6f62bb2a.js} +2 -10
  75. package/_verture/{index-063009f8.js → index-0a300edb.js} +388 -700
  76. package/_verture/{index-f30ae73e.js → index-0e866545.js} +2 -2
  77. package/_verture/index-1856bbeb.js +480 -0
  78. package/_verture/{index-d728b0ce.js → index-320d67c4.js} +4 -3
  79. package/_verture/index-7e60b72c.js +593 -0
  80. package/_verture/isEqual-30b6f859.js +56 -0
  81. package/_verture/{slicedToArray-75fa4188.js → slicedToArray-61604a6c.js} +1 -1
  82. package/_verture/{toConsumableArray-c7a8028f.js → toConsumableArray-599cd94a.js} +1 -1
  83. package/_verture/typeof-adeedc13.js +11 -0
  84. package/_verture/useState-f2419d68.js +353 -0
  85. package/index.d.ts +2 -0
  86. package/index.js +21 -17
  87. package/locale/en-US.d.ts +46 -0
  88. package/locale/index.d.ts +92 -0
  89. package/locale/index.js +92 -0
  90. package/locale/zh-CN.d.ts +46 -0
  91. package/package.json +3 -1
  92. package/umd/Anchor.js +5 -5
  93. package/umd/Argv.js +6 -6
  94. package/umd/AutoBox.js +5 -5
  95. package/umd/AutoButton.js +7 -7
  96. package/umd/AutoTips.js +5 -5
  97. package/umd/Breadcrumbs.js +4 -4
  98. package/umd/Button.js +7 -7
  99. package/umd/ButtonGroup.js +7 -7
  100. package/umd/Cascader.js +5 -5
  101. package/umd/Checkbox.js +4 -4
  102. package/umd/CheckboxGroup.js +4 -4
  103. package/umd/Collapse.js +1 -1
  104. package/umd/ComboSelect.js +4 -4
  105. package/umd/CopyText.js +5 -5
  106. package/umd/CycleSelector.js +7 -7
  107. package/umd/DatePicker.js +7 -7
  108. package/umd/Descriptions.js +6 -6
  109. package/umd/Desktop.js +7 -7
  110. package/umd/Drawer.js +7 -7
  111. package/umd/Dropdown.js +4 -4
  112. package/umd/DynamicMultiBox.js +4 -4
  113. package/umd/FieldForm.js +43 -0
  114. package/umd/Form.js +4 -4
  115. package/umd/FormItem.js +4 -4
  116. package/umd/FunctionModal.js +7 -7
  117. package/umd/Help.js +5 -5
  118. package/umd/Image.js +3 -3
  119. package/umd/InputCode.js +7 -7
  120. package/umd/InputLang.js +5 -5
  121. package/umd/InputNumber.js +4 -4
  122. package/umd/Label.js +4 -4
  123. package/umd/Menu.js +4 -4
  124. package/umd/Modal.js +6 -6
  125. package/umd/MultiBox.js +6 -6
  126. package/umd/Notification.js +3 -3
  127. package/umd/OperateBtn.js +6 -6
  128. package/umd/PageHeader.js +7 -7
  129. package/umd/Pagination.js +7 -7
  130. package/umd/PopConfirm.js +5 -5
  131. package/umd/PopMenu.js +5 -5
  132. package/umd/Popover.js +5 -5
  133. package/umd/QuickReply.js +5 -5
  134. package/umd/Radio.js +4 -4
  135. package/umd/RadioGroup.js +4 -4
  136. package/umd/RangeInput.js +5 -5
  137. package/umd/Result.js +4 -4
  138. package/umd/Search.js +5 -5
  139. package/umd/Select.js +5 -5
  140. package/umd/SelectInput.js +5 -5
  141. package/umd/Selector.js +5 -5
  142. package/umd/SelectorPicker.js +5 -5
  143. package/umd/SingleBox.js +5 -5
  144. package/umd/Slider.js +4 -4
  145. package/umd/Stepper.js +4 -4
  146. package/umd/Switch.js +4 -4
  147. package/umd/Table.js +5 -5
  148. package/umd/Tabs.js +4 -4
  149. package/umd/Tag.js +5 -5
  150. package/umd/TextEditor.js +6 -6
  151. package/umd/TextField.js +5 -5
  152. package/umd/TimePicker.js +7 -7
  153. package/umd/Title.js +3 -3
  154. package/umd/ToggleButton.js +7 -7
  155. package/umd/Tooltip.js +4 -4
  156. package/umd/Transfer.js +8 -8
  157. package/umd/Tree.js +3 -3
  158. package/umd/Upload.js +5 -5
  159. package/umd/locale.js +1 -1
  160. /package/_verture/{modalContext-8a48c400.js → modalContext-3ed7e7f6.js} +0 -0
@@ -9,7 +9,7 @@ import DatePicker from '../DatePicker/index.js';
9
9
  import Select from '../Select/index.js';
10
10
  import { TextField } from '../TextField/index.js';
11
11
  import { Popover } from '../Popover/index.js';
12
- import { Button } from '../Button/index.js';
12
+ import { B as Button } from '../_verture/index-7e60b72c.js';
13
13
  import { G as GlobalContext } from '../_verture/index-ca413216.js';
14
14
  import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
15
15
  import HelperText from '../HelperText/index.js';
@@ -19,6 +19,9 @@ import 'rc-picker/es/generate/dayjs';
19
19
  import '../Tag/index.js';
20
20
  import '../_verture/tslib.es6-55ed4bd2.js';
21
21
  import '@para-ui/icons/EditOutline';
22
+ import '../_verture/toConsumableArray-599cd94a.js';
23
+ import '../_verture/slicedToArray-61604a6c.js';
24
+ import '../_verture/typeof-adeedc13.js';
22
25
  import '../AutoTips/index.js';
23
26
  import '../Tooltip/index.js';
24
27
  import 'rc-tooltip';
@@ -28,7 +31,7 @@ import '@paraview/lib';
28
31
  import '../_verture/tinycolor-ece3542d.js';
29
32
  import '../_verture/useGlobalProps-4ae1a007.js';
30
33
  import '@para-ui/icons/Plus';
31
- import '../_verture/defineProperty-f0e15205.js';
34
+ import '../_verture/defineProperty-6f62bb2a.js';
32
35
  import 'rc-picker';
33
36
  import '@para-ui/icons/CloseCircleF';
34
37
  import '@para-ui/icons/Calendar';
@@ -50,6 +53,8 @@ import '../Loading/index.js';
50
53
  import '@para-ui/icons/LoadingF';
51
54
  import '@para-ui/icons/PreviewClose';
52
55
  import '@para-ui/icons/PreviewOpen';
56
+ import '@para-ui/icons/CheckCircleF';
57
+ import '@para-ui/icons/WarningCircle';
53
58
 
54
59
  var en = {
55
60
  placeholder: 'Please select',
@@ -1,8 +1,8 @@
1
1
  import dayjsGenerateConfig from 'rc-picker/es/generate/dayjs';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { Button } from '../Button/index.js';
3
+ import { B as Button } from '../_verture/index-7e60b72c.js';
4
4
  import { Tag } from '../Tag/index.js';
5
- import { a as _defineProperty } from '../_verture/defineProperty-f0e15205.js';
5
+ import { _ as _defineProperty } from '../_verture/defineProperty-6f62bb2a.js';
6
6
  import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
7
7
  import React__default, { forwardRef, useImperativeHandle } from 'react';
8
8
  import clsx from 'clsx';
@@ -28,14 +28,20 @@ import '../AutoTips/index.js';
28
28
  import 'rc-tooltip';
29
29
  import 'rc-tooltip/lib/placements';
30
30
  import '@para-ui/icons/Forbid';
31
- import 'rc-dropdown';
31
+ import '@para-ui/icons/CheckCircleF';
32
+ import '@para-ui/icons/WarningCircle';
33
+ import '@para-ui/icons/WarningCircleF';
32
34
  import '../_verture/usePopupContainer-635f66f4.js';
33
- import 'dayjs';
34
35
  import '@para-ui/icons/Close';
35
36
  import '@para-ui/icons/EditOutline';
37
+ import '../_verture/toConsumableArray-599cd94a.js';
38
+ import '../_verture/slicedToArray-61604a6c.js';
39
+ import '../_verture/typeof-adeedc13.js';
36
40
  import '../_verture/tinycolor-ece3542d.js';
37
41
  import '../_verture/useGlobalProps-4ae1a007.js';
38
42
  import '@para-ui/icons/Plus';
43
+ import 'rc-dropdown';
44
+ import 'dayjs';
39
45
  import '../Help/index.js';
40
46
  import '@para-ui/icons/Help';
41
47
 
@@ -3,7 +3,7 @@ import { useState, useEffect, Fragment as Fragment$1 } from 'react';
3
3
  import { Title } from '../Title/index.js';
4
4
  import AutoTips from '../AutoTips/index.js';
5
5
  import CollapseBox from '../CollapseBox/index.js';
6
- import { Button } from '../Button/index.js';
6
+ import { B as Button } from '../_verture/index-7e60b72c.js';
7
7
  import clsx from 'clsx';
8
8
  import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
9
9
  import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
@@ -28,6 +28,10 @@ import '../_verture/index-bde7aabe.js';
28
28
  import 'rc-dropdown';
29
29
  import '../_verture/usePopupContainer-635f66f4.js';
30
30
  import 'dayjs';
31
+ import '@para-ui/icons/CheckCircleF';
32
+ import '@para-ui/icons/WarningCircle';
33
+ import '@para-ui/icons/CloseCircleF';
34
+ import '@para-ui/icons/WarningCircleF';
31
35
  import '../_verture/index-ca413216.js';
32
36
 
33
37
  var en = {
package/Desktop/index.js CHANGED
@@ -5,7 +5,7 @@ import { DeepClone } from '@paraview/lib';
5
5
  import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
6
6
  import AutoTips from '../AutoTips/index.js';
7
7
  import NavigateBefore from '@para-ui/icons/Left';
8
- import { Button } from '../Button/index.js';
8
+ import { B as Button } from '../_verture/index-7e60b72c.js';
9
9
  import ReactDOM from 'react-dom';
10
10
  import { Tooltip } from '../Tooltip/index.js';
11
11
  import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
@@ -31,6 +31,9 @@ import 'rc-tooltip';
31
31
  import 'rc-tooltip/lib/placements';
32
32
  import '@para-ui/icons/Forbid';
33
33
  import '@para-ui/icons/Down';
34
+ import '@para-ui/icons/CheckCircleF';
35
+ import '@para-ui/icons/WarningCircle';
36
+ import '@para-ui/icons/WarningCircleF';
34
37
 
35
38
  var en = {
36
39
  createDir: 'Create Folder',
package/Drawer/index.js CHANGED
@@ -3,7 +3,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import { useState, useRef, useEffect } from 'react';
4
4
  import clsx from 'clsx';
5
5
  import RcDrawer from 'rc-drawer';
6
- import { Button } from '../Button/index.js';
6
+ import { B as Button } from '../_verture/index-7e60b72c.js';
7
7
  import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
8
8
  import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
9
9
  import AutoTips from '../AutoTips/index.js';
@@ -19,6 +19,10 @@ import '../_verture/index-bde7aabe.js';
19
19
  import 'rc-dropdown';
20
20
  import '../_verture/usePopupContainer-635f66f4.js';
21
21
  import 'dayjs';
22
+ import '@para-ui/icons/CheckCircleF';
23
+ import '@para-ui/icons/WarningCircle';
24
+ import '@para-ui/icons/CloseCircleF';
25
+ import '@para-ui/icons/WarningCircleF';
22
26
  import '../_verture/index-ca413216.js';
23
27
 
24
28
  var en = {
@@ -52,17 +52,16 @@ import '@para-ui/icons/Up';
52
52
  import '../MultiBox/index.js';
53
53
  import '@para-ui/icons/Internet';
54
54
  import '../Table/index.js';
55
- import '../Button/index.js';
55
+ import '../_verture/index-7e60b72c.js';
56
+ import '@para-ui/icons/CheckCircleF';
57
+ import '@para-ui/icons/WarningCircle';
58
+ import '@para-ui/icons/WarningCircleF';
56
59
  import '@para-ui/icons/ScreenF';
57
60
  import '@para-ui/icons/UpTriangleF';
58
61
  import '@para-ui/icons/DownTriangleF';
59
62
  import '../Radio/index.js';
60
63
  import '../OperateBtn/index.js';
61
64
  import '@para-ui/icons/More';
62
- import '../PopConfirm/index.js';
63
- import '@para-ui/icons/CheckCircleF';
64
- import '@para-ui/icons/WarningCircle';
65
- import '@para-ui/icons/WarningCircleF';
66
65
  import '@para-ui/icons/Refresh';
67
66
  import '../Pagination/index.js';
68
67
  import '@para-ui/icons/Left';
@@ -71,10 +70,11 @@ import '@para-ui/icons/Right';
71
70
  import '@para-ui/icons/DoubleLeft';
72
71
  import '@para-ui/icons/DoubleRight';
73
72
  import '../ScrollBar/index.js';
74
- import '../_verture/index-d728b0ce.js';
75
- import '../_verture/toConsumableArray-c7a8028f.js';
76
- import '../_verture/slicedToArray-75fa4188.js';
77
- import '../_verture/defineProperty-f0e15205.js';
73
+ import '../_verture/index-320d67c4.js';
74
+ import '../_verture/toConsumableArray-599cd94a.js';
75
+ import '../_verture/slicedToArray-61604a6c.js';
76
+ import '../_verture/defineProperty-6f62bb2a.js';
77
+ import '../_verture/typeof-adeedc13.js';
78
78
  import '../_verture/index-8ac46bd9.js';
79
79
  import '../_verture/typeof-6ec38efd.js';
80
80
  import 'rc-tree';
@@ -400,7 +400,7 @@ styleInject(css_248z);
400
400
  const DynamicMultiBox = props => {
401
401
  const {
402
402
  rowKey = 'id',
403
- valueList,
403
+ valueList = [],
404
404
  config = [],
405
405
  errors = [],
406
406
  isSort = false,
@@ -855,7 +855,7 @@ const DynamicMultiBox = props => {
855
855
  children: [jsxs("div", Object.assign({
856
856
  className: "multi-value-content"
857
857
  }, {
858
- children: [renderTitle, isSort ? jsx(dist.exports.ReactSortable, Object.assign({
858
+ children: [renderTitle, isSort && Array.isArray(valueList) && valueList.length > 0 ? jsx(dist.exports.ReactSortable, Object.assign({
859
859
  id: rowKey,
860
860
  list: valueList,
861
861
  handle: '.sort-handler',
@@ -119,7 +119,7 @@ export interface IMultiValueProps {
119
119
  /**
120
120
  * 表单value集合
121
121
  */
122
- valueList: IValueList[];
122
+ valueList?: IValueList[];
123
123
  /**
124
124
  * 表单错误集合
125
125
  */
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @author yaoxue
3
+ * @date 2024/08/21
4
+ * @description 错误列表
5
+ */
6
+ import { FC, ReactNode } from 'react';
7
+ import type { ValidateStatus } from './FieldFormItem';
8
+ export interface ErrorListProps {
9
+ helperText?: ReactNode;
10
+ helpStatus?: ValidateStatus;
11
+ errors?: ReactNode[];
12
+ warnings?: ReactNode[];
13
+ onVisibleChanged?: (visible: boolean) => void;
14
+ }
15
+ declare const ErrorList: FC<ErrorListProps>;
16
+ export default ErrorList;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @author yaoxue
3
+ * @date 2024/08/20
4
+ * @description 表单项容器
5
+ */
6
+ import { ReactNode } from 'react';
7
+ import type { Meta } from 'rc-field-form/lib/interface';
8
+ import type { ReportMetaChange } from '../context';
9
+ import type { FormItemProps } from './index';
10
+ export interface ItemHolderProps extends FormItemProps {
11
+ fieldId?: string;
12
+ errors: ReactNode[];
13
+ warnings: ReactNode[];
14
+ meta: Meta;
15
+ onSubItemMetaChange: ReportMetaChange;
16
+ }
17
+ declare function ItemHolder(props: ItemHolderProps): import("react/jsx-runtime").JSX.Element;
18
+ export default ItemHolder;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @author yaoxue
3
+ * @date 2024/08/21
4
+ * @description MemoInput
5
+ */
6
+ import React from 'react';
7
+ interface MemoInputProps {
8
+ control: object;
9
+ update: any;
10
+ children: React.ReactNode;
11
+ childProps: any[];
12
+ }
13
+ declare const _default: React.MemoExoticComponent<({ children }: MemoInputProps) => JSX.Element>;
14
+ export default _default;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @author yaoxue
3
+ * @date 2024/08/22
4
+ * @description 状态管理
5
+ */
6
+ import { ReactNode } from 'react';
7
+ import type { Meta } from 'rc-field-form/lib/interface';
8
+ import type { ValidateStatus } from './index';
9
+ interface StatusProviderProps {
10
+ children?: ReactNode;
11
+ validateStatus?: ValidateStatus;
12
+ prefixCls?: string;
13
+ meta: Meta;
14
+ errors: ReactNode[];
15
+ warnings: ReactNode[];
16
+ hasFeedback?: boolean;
17
+ noStyle?: boolean;
18
+ }
19
+ declare function StatusProvider({ children, errors, warnings, hasFeedback, validateStatus, prefixCls, meta, noStyle }: StatusProviderProps): import("react/jsx-runtime").JSX.Element;
20
+ export default StatusProvider;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @author yaoxue
3
+ * @date 2024/08/19
4
+ * @description 表单项
5
+ */
6
+ import { ReactNode, ReactElement, CSSProperties } from 'react';
7
+ import type { FieldProps } from 'rc-field-form/lib/Field';
8
+ import type { Meta } from 'rc-field-form/lib/interface';
9
+ import type { FormInstance, FormItemLayout } from '../Form';
10
+ import type { FormItemInputProps } from '../FormItemInput';
11
+ import type { FormItemLabelProps } from '../FormItemLabel';
12
+ import type { ReportMetaChange } from '../context';
13
+ import useFormItemStatus from '../hooks/useFormItemStatus';
14
+ type RenderChildren<Values = any> = (form: FormInstance<Values>) => ReactNode;
15
+ type RcFieldProps<Values = any> = Omit<FieldProps<Values>, 'children'>;
16
+ type ChildrenType<Values = any> = RenderChildren<Values> | ReactNode;
17
+ declare const ValidateStatuses: readonly ["success", "warning", "error", "validating", ""];
18
+ export type ValidateStatus = (typeof ValidateStatuses)[number];
19
+ export type FeedbackIcons = (itemStatus: {
20
+ status: ValidateStatus;
21
+ errors?: ReactNode[];
22
+ warnings?: ReactNode[];
23
+ }) => {
24
+ [key in ValidateStatus]?: ReactNode;
25
+ };
26
+ export interface FormItemProps<Values = any> extends FormItemLabelProps, FormItemInputProps, RcFieldProps<Values> {
27
+ noStyle?: boolean;
28
+ style?: CSSProperties;
29
+ className?: string;
30
+ children?: ChildrenType<Values>;
31
+ id?: string;
32
+ hasFeedback?: boolean;
33
+ validateStatus?: ValidateStatus;
34
+ required?: boolean;
35
+ hidden?: boolean;
36
+ initialValue?: any;
37
+ messageVariables?: Record<string, string>;
38
+ layout?: FormItemLayout;
39
+ hideError?: boolean;
40
+ disabled?: boolean;
41
+ size?: 'small' | 'medium' | 'large';
42
+ }
43
+ export interface ItemHolderProps extends FormItemProps {
44
+ errors: ReactNode[];
45
+ warnings: ReactNode[];
46
+ meta: Meta;
47
+ children?: ReactNode;
48
+ fieldId?: string;
49
+ isRequired?: boolean;
50
+ onSubItemMetaChange: ReportMetaChange;
51
+ }
52
+ declare function InternalFormItem<Values = any>(props: FormItemProps<Values>): ReactElement;
53
+ type InternalFormItemType = typeof InternalFormItem;
54
+ type CompoundedComponent = InternalFormItemType & {
55
+ useStatus: typeof useFormItemStatus;
56
+ };
57
+ declare const FieldFormItem: CompoundedComponent;
58
+ export default FieldFormItem;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @author yaoxue
3
+ * @date 2024/08/19
4
+ * @description 表单
5
+ */
6
+ import React, { PropsWithChildren, RefAttributes, ReactElement, ReactNode } from 'react';
7
+ import { useWatch } from 'rc-field-form';
8
+ import type { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
9
+ import type { FormRef } from 'rc-field-form/lib/interface';
10
+ import type { FormLabelAlign } from './interface';
11
+ import type { FormInstance } from './hooks/useForm';
12
+ import useForm from './hooks/useForm';
13
+ import type { FeedbackIcons } from './FieldFormItem';
14
+ export type RequiredMark = boolean | 'optional' | ((labelNode: ReactNode, info: {
15
+ required: boolean;
16
+ }) => ReactNode);
17
+ export type FormLayout = 'horizontal' | 'vertical';
18
+ export type FormItemLayout = 'horizontal' | 'vertical';
19
+ export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form'> {
20
+ colon?: boolean;
21
+ name?: string;
22
+ layout?: FormLayout;
23
+ labelAlign?: FormLabelAlign;
24
+ labelWrap?: boolean;
25
+ labelWidth?: number | string;
26
+ form?: FormInstance<Values>;
27
+ feedbackIcons?: FeedbackIcons;
28
+ disabled?: boolean;
29
+ requiredMark?: RequiredMark;
30
+ size?: 'small' | 'medium' | 'large';
31
+ }
32
+ declare const FieldForm: (<Values = any>(props: FormProps<Values> & {
33
+ children?: React.ReactNode;
34
+ } & React.RefAttributes<FormRef<Values>>) => ReactElement) & Pick<React.FC<{}>, "displayName">;
35
+ export { useForm, useWatch, type FormInstance };
36
+ export default FieldForm;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @author yaoxue
3
+ * @date 2024/08/21
4
+ * @description 表单项输入框
5
+ */
6
+ import { FC, ReactNode } from 'react';
7
+ import type { ValidateStatus } from './FieldFormItem';
8
+ interface FormItemInputMiscProps {
9
+ children: ReactNode;
10
+ errors: ReactNode[];
11
+ warnings: ReactNode[];
12
+ marginBottom?: number | null;
13
+ onErrorVisibleChanged?: (visible: boolean) => void;
14
+ }
15
+ export interface FormItemInputProps {
16
+ status?: ValidateStatus;
17
+ helperText?: ReactNode;
18
+ fieldId?: string;
19
+ }
20
+ declare const FormItemInput: FC<FormItemInputProps & FormItemInputMiscProps>;
21
+ export default FormItemInput;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @author yaoxue
3
+ * @date 2024/08/22
4
+ * @description 表单项标签
5
+ */
6
+ import { FC, ReactNode } from 'react';
7
+ import { FormLabelAlign } from './interface';
8
+ import type { LabelProps } from '../Label';
9
+ export interface FormItemLabelProps {
10
+ fieldId?: string;
11
+ labelAlign?: FormLabelAlign;
12
+ labelWrap?: boolean;
13
+ labelWidth?: number | string;
14
+ label?: ReactNode;
15
+ labelProps?: Omit<LabelProps, 'label'>;
16
+ hideLabel?: boolean;
17
+ colon?: boolean;
18
+ layout?: 'horizontal' | 'vertical';
19
+ }
20
+ declare const FormItemLabel: FC<FormItemLabelProps>;
21
+ export default FormItemLabel;
@@ -0,0 +1,23 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import type { StoreValue, ValidatorRule } from 'rc-field-form/lib/interface';
3
+ export interface FormListFieldData {
4
+ name: number;
5
+ key: number;
6
+ error?: any;
7
+ }
8
+ export interface FormListOperation {
9
+ add: (defaultValue?: StoreValue, insertIndex?: number) => void;
10
+ remove: (index: number | number[]) => void;
11
+ move: (from: number, to: number) => void;
12
+ }
13
+ export interface FormListProps {
14
+ name: string | number | (string | number)[];
15
+ rules?: ValidatorRule[];
16
+ initialValue?: any[];
17
+ children: (fields: FormListFieldData[], operation: FormListOperation, meta: {
18
+ errors: ReactNode[];
19
+ warnings: ReactNode[];
20
+ }) => ReactNode;
21
+ }
22
+ declare const FormList: FC<FormListProps>;
23
+ export default FormList;
@@ -0,0 +1,33 @@
1
+ import React, { FC, ReactElement, Key, ReactNode } from 'react';
2
+ import type { FormProviderProps as RcFormProviderProps } from 'rc-field-form/lib/FormContext';
3
+ import type { Meta } from 'rc-field-form/lib/interface';
4
+ import type { FormLabelAlign } from './interface';
5
+ import type { FormInstance, FormLayout } from './Form';
6
+ import type { ValidateStatus } from './FieldFormItem';
7
+ export declare const FormProvider: FC<RcFormProviderProps>;
8
+ export interface FormContextProps {
9
+ name?: string;
10
+ labelAlign?: FormLabelAlign;
11
+ labelWrap?: boolean;
12
+ labelWidth?: number | string;
13
+ labelMaxWidth?: number | string;
14
+ layout: FormLayout;
15
+ colon?: boolean;
16
+ itemRef: (name: (string | number)[]) => (node: ReactElement) => void;
17
+ form?: FormInstance;
18
+ prefixCls?: string;
19
+ disabled?: boolean;
20
+ size?: 'small' | 'medium' | 'large';
21
+ }
22
+ export declare const FormContext: React.Context<FormContextProps>;
23
+ export type ReportMetaChange = (meta: Meta, uniqueKeys: Key[]) => void;
24
+ export declare const NoStyleItemContext: React.Context<ReportMetaChange | null>;
25
+ export interface FormItemStatusContextProps {
26
+ isFormItemInput?: boolean;
27
+ status?: ValidateStatus;
28
+ errors?: ReactNode[];
29
+ warnings?: ReactNode[];
30
+ hasFeedback?: boolean;
31
+ feedbackIcon?: ReactNode;
32
+ }
33
+ export declare const FormItemInputContext: React.Context<FormItemStatusContextProps>;
@@ -0,0 +1,2 @@
1
+ import type { FormItemProps } from '../FieldFormItem';
2
+ export default function useChildren(children?: FormItemProps['children']): FormItemProps['children'];
@@ -0,0 +1 @@
1
+ export default function useDebounce<T>(value: T[]): T[];
@@ -0,0 +1,6 @@
1
+ import type { FormInstance as RcFormInstance } from 'rc-field-form';
2
+ import type { NamePath } from '../interface';
3
+ export interface FormInstance<Values = any> extends RcFormInstance<Values> {
4
+ getFieldInstance: (name: NamePath) => any;
5
+ }
6
+ export default function useForm<Values = any>(form?: FormInstance<Values>): [FormInstance<Values>];
@@ -0,0 +1,2 @@
1
+ import type { FormInstance } from './useForm';
2
+ export default function useFormInstance<Value = any>(): FormInstance<Value>;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import type { ValidateStatus } from '../FieldFormItem';
3
+ type UseFormItemStatus = () => {
4
+ status?: ValidateStatus;
5
+ errors: ReactNode[];
6
+ warnings: ReactNode[];
7
+ };
8
+ declare const useFormItemStatus: UseFormItemStatus;
9
+ export default useFormItemStatus;
@@ -0,0 +1,3 @@
1
+ type Updater<ValueType> = (prev?: ValueType) => ValueType;
2
+ export default function useFrameState<ValueType>(defaultValue: ValueType): [ValueType, (updater: Updater<ValueType>) => void];
3
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { InternalNamePath } from '../interface';
3
+ export default function useItemRef(): (name: InternalNamePath, children: any) => React.Ref<any> | undefined;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @author yaoxue
3
+ * @date 2024/08/19
4
+ * @description 表单
5
+ */
6
+ import type { Rule, RuleObject, RuleRender } from 'rc-field-form/lib/interface';
7
+ import { FormProvider } from './context';
8
+ import InternalForm, { useForm, useWatch } from './Form';
9
+ import type { FormInstance as FieldFormInstance, FormProps as FieldFormProps } from './Form';
10
+ import ErrorList from './ErrorList';
11
+ import type { ErrorListProps } from './ErrorList';
12
+ import Item from './FieldFormItem';
13
+ import type { FormItemProps as FieldFormItemProps } from './FieldFormItem';
14
+ import List from './FormList';
15
+ import type { FormListFieldData as FieldFormListFieldData, FormListOperation as FieldFormListOperation, FormListProps as FieldFormListProps } from './FormList';
16
+ import useFormInstance from './hooks/useFormInstance';
17
+ import './index.scss';
18
+ type InternalFormType = typeof InternalForm;
19
+ type CompoundedComponent = InternalFormType & {
20
+ useForm: typeof useForm;
21
+ useFormInstance: typeof useFormInstance;
22
+ useWatch: typeof useWatch;
23
+ Item: typeof Item;
24
+ List: typeof List;
25
+ ErrorList: typeof ErrorList;
26
+ Provider: typeof FormProvider;
27
+ };
28
+ declare const FieldForm: CompoundedComponent;
29
+ export type { ErrorListProps, FieldFormInstance, FieldFormItemProps, FieldFormListFieldData, FieldFormListOperation, FieldFormListProps, FieldFormProps, Rule, RuleObject, RuleRender };
30
+ export default FieldForm;