@para-ui/core 4.0.52 → 4.0.54
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.
- package/Button/index.js +2 -2
- package/Cascader/Cascader.d.ts +3 -0
- package/Cascader/index.js +11 -8
- package/ComboSelect/index.js +5 -5
- package/CycleSelector/index.js +2 -2
- package/DatePicker/index.js +2 -2
- package/DynamicMultiBox/index.js +7 -7
- package/DynamicMultiBox/interface.d.ts +1 -1
- package/FieldForm/ErrorList.d.ts +16 -0
- package/FieldForm/FieldFormItem/ItemHolder.d.ts +18 -0
- package/FieldForm/FieldFormItem/MemoInput.d.ts +14 -0
- package/FieldForm/FieldFormItem/StatusProvider.d.ts +20 -0
- package/FieldForm/FieldFormItem/index.d.ts +58 -0
- package/FieldForm/Form.d.ts +36 -0
- package/FieldForm/FormItemInput.d.ts +21 -0
- package/FieldForm/FormItemLabel.d.ts +21 -0
- package/FieldForm/FormList.d.ts +23 -0
- package/FieldForm/context.d.ts +33 -0
- package/FieldForm/hooks/useChildren.d.ts +2 -0
- package/FieldForm/hooks/useDebounce.d.ts +1 -0
- package/FieldForm/hooks/useForm.d.ts +6 -0
- package/FieldForm/hooks/useFormInstance.d.ts +2 -0
- package/FieldForm/hooks/useFormItemStatus.d.ts +9 -0
- package/FieldForm/hooks/useFrameState.d.ts +3 -0
- package/FieldForm/hooks/useItemRef.d.ts +3 -0
- package/FieldForm/index.d.ts +30 -0
- package/FieldForm/index.js +5326 -0
- package/FieldForm/interface.d.ts +2 -0
- package/FieldForm/lang/en_US.d.ts +51 -0
- package/FieldForm/lang/index.d.ts +105 -0
- package/FieldForm/lang/zh_CN.d.ts +51 -0
- package/FieldForm/util.d.ts +21 -0
- package/Form/index.js +6 -6
- package/FormItem/index.js +6 -6
- package/FunctionModal/index.js +2 -2
- package/Image/index.js +5 -55
- package/PopMenu/index.js +2 -2
- package/README.md +15 -0
- package/Result/index.js +2 -2
- package/Selector/index.js +1 -1
- package/SelectorPicker/index.js +1 -1
- package/Switch/index.d.ts +4 -0
- package/Switch/index.js +3 -2
- package/Table/index.js +433 -498
- package/Tag/index.js +2 -2
- package/TextEditor/index.d.ts +2 -0
- package/TextEditor/index.js +27 -6
- package/TimePicker/index.js +2 -2
- package/Tooltip/index.js +26 -27
- package/Transfer/index.d.ts +1 -0
- package/Transfer/index.js +120 -119
- package/Tree/index.js +4 -4
- package/Upload/index.js +9 -7
- package/_verture/{Portal-f9bedb3a.js → Portal-502bb85e.js} +29 -481
- package/_verture/{index-5b0d1c7d.js → index-0a300edb.js} +387 -700
- package/_verture/index-1856bbeb.js +480 -0
- package/_verture/{index-ba8815d0.js → index-320d67c4.js} +2 -2
- package/_verture/{index-887e5e11.js → index-43c653bb.js} +1 -1
- package/_verture/isEqual-30b6f859.js +56 -0
- package/_verture/{slicedToArray-75fa4188.js → slicedToArray-61604a6c.js} +1 -1
- package/_verture/{toConsumableArray-c7a8028f.js → toConsumableArray-599cd94a.js} +1 -1
- package/_verture/useState-f2419d68.js +353 -0
- package/index.d.ts +2 -0
- package/index.js +15 -11
- package/locale/en-US.d.ts +46 -0
- package/locale/index.d.ts +92 -0
- package/locale/index.js +92 -0
- package/locale/zh-CN.d.ts +46 -0
- package/package.json +3 -1
- package/umd/Anchor.js +5 -5
- package/umd/Argv.js +5 -5
- package/umd/AutoBox.js +5 -5
- package/umd/AutoButton.js +6 -6
- package/umd/AutoTips.js +5 -5
- package/umd/Breadcrumbs.js +4 -4
- package/umd/Button.js +5 -5
- package/umd/ButtonGroup.js +6 -6
- package/umd/Cascader.js +5 -5
- package/umd/Checkbox.js +4 -4
- package/umd/CheckboxGroup.js +4 -4
- package/umd/Collapse.js +1 -1
- package/umd/ComboSelect.js +5 -5
- package/umd/CopyText.js +5 -5
- package/umd/CycleSelector.js +5 -5
- package/umd/DatePicker.js +5 -5
- package/umd/Descriptions.js +6 -6
- package/umd/Desktop.js +5 -5
- package/umd/Drawer.js +5 -5
- package/umd/Dropdown.js +4 -4
- package/umd/DynamicMultiBox.js +5 -5
- package/umd/FieldForm.js +43 -0
- package/umd/Form.js +5 -5
- package/umd/FormItem.js +5 -5
- package/umd/FunctionModal.js +5 -5
- package/umd/Help.js +5 -5
- package/umd/Image.js +3 -3
- package/umd/InputCode.js +5 -5
- package/umd/InputLang.js +5 -5
- package/umd/InputNumber.js +4 -4
- package/umd/Label.js +4 -4
- package/umd/Menu.js +4 -4
- package/umd/Modal.js +5 -5
- package/umd/MultiBox.js +6 -6
- package/umd/Notification.js +3 -3
- package/umd/OperateBtn.js +5 -5
- package/umd/PageHeader.js +5 -5
- package/umd/Pagination.js +5 -5
- package/umd/PopConfirm.js +5 -5
- package/umd/PopMenu.js +5 -5
- package/umd/Popover.js +5 -5
- package/umd/QuickReply.js +5 -5
- package/umd/Radio.js +4 -4
- package/umd/RadioGroup.js +4 -4
- package/umd/RangeInput.js +5 -5
- package/umd/Result.js +4 -4
- package/umd/Search.js +5 -5
- package/umd/Select.js +5 -5
- package/umd/SelectInput.js +5 -5
- package/umd/Selector.js +5 -5
- package/umd/SelectorPicker.js +5 -5
- package/umd/SingleBox.js +5 -5
- package/umd/Slider.js +4 -4
- package/umd/Stepper.js +4 -4
- package/umd/Switch.js +4 -4
- package/umd/Table.js +6 -6
- package/umd/Tabs.js +4 -4
- package/umd/Tag.js +5 -5
- package/umd/TextEditor.js +6 -6
- package/umd/TextField.js +5 -5
- package/umd/TimePicker.js +5 -5
- package/umd/Title.js +3 -3
- package/umd/ToggleButton.js +5 -5
- package/umd/Tooltip.js +4 -4
- package/umd/Transfer.js +7 -7
- package/umd/Tree.js +3 -3
- package/umd/Upload.js +5 -5
- package/umd/locale.js +1 -1
- /package/_verture/{modalContext-f68b51a2.js → modalContext-6ac2e323.js} +0 -0
package/Button/index.js
CHANGED
|
@@ -253,11 +253,11 @@ const InternalButton = props => {
|
|
|
253
253
|
})), renderBtnIcon('end')]
|
|
254
254
|
}));
|
|
255
255
|
}
|
|
256
|
-
return jsxs("button", Object.assign({
|
|
256
|
+
return jsxs("button", Object.assign({
|
|
257
257
|
disabled: disabled,
|
|
258
258
|
type: "button",
|
|
259
259
|
className: makeCls()
|
|
260
|
-
}, {
|
|
260
|
+
}, restProps, {
|
|
261
261
|
children: [renderBtnIcon('start'), children && jsx("span", Object.assign({
|
|
262
262
|
className: 'button-label'
|
|
263
263
|
}, {
|
package/Cascader/Cascader.d.ts
CHANGED
|
@@ -87,6 +87,9 @@ export interface MultipleCascaderProps<OptionType extends BaseOptionType = Defau
|
|
|
87
87
|
export type CascaderProps<OptionType extends BaseOptionType = DefaultOptionType> = SingleCascaderProps<OptionType> | MultipleCascaderProps<OptionType>;
|
|
88
88
|
export type InternalCascaderProps<OptionType extends BaseOptionType = DefaultOptionType> = Omit<SingleCascaderProps<OptionType> | MultipleCascaderProps<OptionType>, 'onChange'> & {
|
|
89
89
|
onChange?: (value: SingleValueType | SingleValueType[], selectOptions: OptionType[] | OptionType[][]) => void;
|
|
90
|
+
error?: boolean;
|
|
91
|
+
hideErrorDom?: boolean;
|
|
92
|
+
helperText?: string;
|
|
90
93
|
};
|
|
91
94
|
export type CascaderRef = Omit<BaseSelectRef, 'scrollTo'>;
|
|
92
95
|
declare const Cascader: (<OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props: React.PropsWithChildren<CascaderProps<OptionType>> & {
|
package/Cascader/index.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { C as Cascader } from '../_verture/index-
|
|
2
|
-
export { C as default } from '../_verture/index-
|
|
1
|
+
import { C as Cascader } from '../_verture/index-0a300edb.js';
|
|
2
|
+
export { C as default } from '../_verture/index-0a300edb.js';
|
|
3
3
|
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
|
-
import '../_verture/
|
|
6
|
-
import '../_verture/
|
|
5
|
+
import '../_verture/index-1856bbeb.js';
|
|
6
|
+
import '../_verture/defineProperty-6f62bb2a.js';
|
|
7
|
+
import '../_verture/typeof-adeedc13.js';
|
|
8
|
+
import '../_verture/toConsumableArray-599cd94a.js';
|
|
9
|
+
import '../_verture/slicedToArray-61604a6c.js';
|
|
10
|
+
import '../_verture/Portal-502bb85e.js';
|
|
7
11
|
import 'react';
|
|
8
12
|
import 'react-dom';
|
|
9
|
-
import '../_verture/
|
|
10
|
-
import '../_verture/
|
|
11
|
-
import '../_verture/defineProperty-6f62bb2a.js';
|
|
13
|
+
import '../_verture/useState-f2419d68.js';
|
|
14
|
+
import '../_verture/typeof-6ec38efd.js';
|
|
12
15
|
import 'rc-motion';
|
|
13
16
|
import 'clsx';
|
|
14
|
-
import '../_verture/typeof-6ec38efd.js';
|
|
15
17
|
import 'rc-tree/lib/utils/conductUtil';
|
|
16
18
|
import '@para-ui/icons/Right';
|
|
17
19
|
import '@para-ui/icons/Down';
|
|
@@ -29,3 +31,4 @@ import '../AutoTips/index.js';
|
|
|
29
31
|
import '@paraview/lib';
|
|
30
32
|
import '../_verture/useFormatMessage-1fc7c957.js';
|
|
31
33
|
import '../_verture/index-ca413216.js';
|
|
34
|
+
import '../HelperText/index.js';
|
package/ComboSelect/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import SearchIcon from '@para-ui/icons/Search';
|
|
|
6
6
|
import Close from '@para-ui/icons/Close';
|
|
7
7
|
import CloseCircleF from '@para-ui/icons/CloseCircleF';
|
|
8
8
|
import Table from '../Table/index.js';
|
|
9
|
-
import { T as Tree } from '../_verture/index-
|
|
9
|
+
import { T as Tree } from '../_verture/index-320d67c4.js';
|
|
10
10
|
import { Button } from '../Button/index.js';
|
|
11
11
|
import { D as Dropdown } from '../_verture/index-bde7aabe.js';
|
|
12
12
|
import { Popover } from '../Popover/index.js';
|
|
@@ -24,8 +24,6 @@ import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
|
24
24
|
import { Search } from '../Search/index.js';
|
|
25
25
|
import LoadingOutlined from '@para-ui/icons/LoadingF';
|
|
26
26
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
27
|
-
import '../_verture/typeof-adeedc13.js';
|
|
28
|
-
import '../_verture/slicedToArray-75fa4188.js';
|
|
29
27
|
import '../Checkbox/index.js';
|
|
30
28
|
import '../Help/index.js';
|
|
31
29
|
import '@para-ui/icons/Help';
|
|
@@ -37,7 +35,6 @@ import '@para-ui/icons/UpTriangleF';
|
|
|
37
35
|
import '@para-ui/icons/DownTriangleF';
|
|
38
36
|
import '@para-ui/icons/Panel';
|
|
39
37
|
import '../Empty/index.js';
|
|
40
|
-
import '../_verture/defineProperty-6f62bb2a.js';
|
|
41
38
|
import '../_verture/index-0f5ee6f7.js';
|
|
42
39
|
import '../_verture/sortable.esm-76fe46a4.js';
|
|
43
40
|
import '../Radio/index.js';
|
|
@@ -63,7 +60,10 @@ import '@para-ui/icons/Right';
|
|
|
63
60
|
import '@para-ui/icons/DoubleLeft';
|
|
64
61
|
import '@para-ui/icons/DoubleRight';
|
|
65
62
|
import '../ScrollBar/index.js';
|
|
66
|
-
import '../_verture/toConsumableArray-
|
|
63
|
+
import '../_verture/toConsumableArray-599cd94a.js';
|
|
64
|
+
import '../_verture/slicedToArray-61604a6c.js';
|
|
65
|
+
import '../_verture/defineProperty-6f62bb2a.js';
|
|
66
|
+
import '../_verture/typeof-adeedc13.js';
|
|
67
67
|
import '../_verture/index-8ac46bd9.js';
|
|
68
68
|
import '../_verture/typeof-6ec38efd.js';
|
|
69
69
|
import 'rc-tree';
|
package/CycleSelector/index.js
CHANGED
|
@@ -19,8 +19,8 @@ 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-
|
|
23
|
-
import '../_verture/slicedToArray-
|
|
22
|
+
import '../_verture/toConsumableArray-599cd94a.js';
|
|
23
|
+
import '../_verture/slicedToArray-61604a6c.js';
|
|
24
24
|
import '../_verture/typeof-adeedc13.js';
|
|
25
25
|
import '../AutoTips/index.js';
|
|
26
26
|
import '../Tooltip/index.js';
|
package/DatePicker/index.js
CHANGED
|
@@ -33,8 +33,8 @@ import '../_verture/usePopupContainer-635f66f4.js';
|
|
|
33
33
|
import 'dayjs';
|
|
34
34
|
import '@para-ui/icons/Close';
|
|
35
35
|
import '@para-ui/icons/EditOutline';
|
|
36
|
-
import '../_verture/toConsumableArray-
|
|
37
|
-
import '../_verture/slicedToArray-
|
|
36
|
+
import '../_verture/toConsumableArray-599cd94a.js';
|
|
37
|
+
import '../_verture/slicedToArray-61604a6c.js';
|
|
38
38
|
import '../_verture/typeof-adeedc13.js';
|
|
39
39
|
import '../_verture/tinycolor-ece3542d.js';
|
|
40
40
|
import '../_verture/useGlobalProps-4ae1a007.js';
|
package/DynamicMultiBox/index.js
CHANGED
|
@@ -52,13 +52,10 @@ 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 '../_verture/typeof-adeedc13.js';
|
|
56
|
-
import '../_verture/slicedToArray-75fa4188.js';
|
|
57
55
|
import '../Button/index.js';
|
|
58
56
|
import '@para-ui/icons/ScreenF';
|
|
59
57
|
import '@para-ui/icons/UpTriangleF';
|
|
60
58
|
import '@para-ui/icons/DownTriangleF';
|
|
61
|
-
import '../_verture/defineProperty-6f62bb2a.js';
|
|
62
59
|
import '../Radio/index.js';
|
|
63
60
|
import '../OperateBtn/index.js';
|
|
64
61
|
import '@para-ui/icons/More';
|
|
@@ -74,8 +71,11 @@ import '@para-ui/icons/Right';
|
|
|
74
71
|
import '@para-ui/icons/DoubleLeft';
|
|
75
72
|
import '@para-ui/icons/DoubleRight';
|
|
76
73
|
import '../ScrollBar/index.js';
|
|
77
|
-
import '../_verture/index-
|
|
78
|
-
import '../_verture/toConsumableArray-
|
|
74
|
+
import '../_verture/index-320d67c4.js';
|
|
75
|
+
import '../_verture/toConsumableArray-599cd94a.js';
|
|
76
|
+
import '../_verture/slicedToArray-61604a6c.js';
|
|
77
|
+
import '../_verture/defineProperty-6f62bb2a.js';
|
|
78
|
+
import '../_verture/typeof-adeedc13.js';
|
|
79
79
|
import '../_verture/index-8ac46bd9.js';
|
|
80
80
|
import '../_verture/typeof-6ec38efd.js';
|
|
81
81
|
import 'rc-tree';
|
|
@@ -401,7 +401,7 @@ styleInject(css_248z);
|
|
|
401
401
|
const DynamicMultiBox = props => {
|
|
402
402
|
const {
|
|
403
403
|
rowKey = 'id',
|
|
404
|
-
valueList,
|
|
404
|
+
valueList = [],
|
|
405
405
|
config = [],
|
|
406
406
|
errors = [],
|
|
407
407
|
isSort = false,
|
|
@@ -856,7 +856,7 @@ const DynamicMultiBox = props => {
|
|
|
856
856
|
children: [jsxs("div", Object.assign({
|
|
857
857
|
className: "multi-value-content"
|
|
858
858
|
}, {
|
|
859
|
-
children: [renderTitle, isSort ? jsx(dist.exports.ReactSortable, Object.assign({
|
|
859
|
+
children: [renderTitle, isSort && Array.isArray(valueList) && valueList.length > 0 ? jsx(dist.exports.ReactSortable, Object.assign({
|
|
860
860
|
id: rowKey,
|
|
861
861
|
list: valueList,
|
|
862
862
|
handle: '.sort-handler',
|
|
@@ -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 @@
|
|
|
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,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,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;
|