@nutui/nutui-react-taro 2.0.0-alpha.15 → 2.0.0-alpha.17
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/CHANGELOG.md +26 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/ActionSheet.js +2 -2
- package/dist/esm/Address.js +2 -2
- package/dist/esm/Avatar.js +2 -2
- package/dist/esm/Calendar.js +2 -2
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/DatePicker.js +3 -3
- package/dist/esm/Dialog/style/index.js +1 -0
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Divider/style/style.css +1 -1
- package/dist/esm/Form/style/index.js +3 -1
- package/dist/esm/Form/style/style.css +1 -1
- package/dist/esm/Form.js +4 -4
- package/dist/esm/FormItem/style/index.js +1 -1
- package/dist/esm/FormItem/style/style.css +1 -1
- package/dist/esm/FormItem.js +1 -1
- package/dist/esm/ImagePreview.js +2 -2
- package/dist/esm/InputNumber.js +1 -1
- package/dist/esm/Menu/style/style.css +1 -1
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/MenuItem.js +1 -1
- package/dist/esm/NoticeBar.js +1 -1
- package/dist/esm/NumberKeyboard.js +2 -2
- package/dist/esm/Pagination/style/style.css +1 -1
- package/dist/esm/Picker.js +2 -2
- package/dist/esm/Popover.js +3 -3
- package/dist/esm/Popup.js +1 -1
- package/dist/esm/SearchBar.js +1 -1
- package/dist/esm/ShortPassword.js +2 -2
- package/dist/esm/SideNavBar.js +2 -2
- package/dist/esm/Skeleton.js +3 -3
- package/dist/esm/Swipe.js +2 -3
- package/dist/esm/TimeSelect.js +2 -2
- package/dist/esm/{actionsheet.taro-697a594b.js → actionsheet.taro-8e7cbd0f.js} +1 -1
- package/dist/esm/{address.taro-cc879a1d.js → address.taro-3cfe1767.js} +1 -1
- package/dist/esm/{calendar.taro-02195ddb.js → calendar.taro-3568a214.js} +1 -1
- package/dist/esm/{cascader.taro-fb7a0230.js → cascader.taro-91cf3ca6.js} +1 -1
- package/dist/esm/{datepicker.taro-8c9230b6.js → datepicker.taro-108eb7c8.js} +43 -45
- package/dist/esm/form.taro-a348734b.js +1274 -0
- package/dist/esm/formitem.taro-c9ded1ef.js +139 -0
- package/dist/esm/{imagepreview.taro-cfe0a4cc.js → imagepreview.taro-29717406.js} +1 -1
- package/dist/esm/{inputnumber.taro-6657d2c1.js → inputnumber.taro-788b1cd3.js} +5 -5
- package/dist/esm/{menuitem.taro-6aa35a00.js → menuitem.taro-7f8c12cf.js} +11 -8
- package/dist/esm/{noticebar.taro-8d496dd6.js → noticebar.taro-dc895cc5.js} +1 -1
- package/dist/esm/{numberkeyboard.taro-18879f04.js → numberkeyboard.taro-ee984036.js} +1 -1
- package/dist/esm/nutui-react.es.js +22 -22
- package/dist/esm/{picker.taro-6b672469.js → picker.taro-9ca039c4.js} +54 -27
- package/dist/esm/{popover.taro-ba6c323a.js → popover.taro-52c02926.js} +12 -12
- package/dist/esm/{popup.taro-e756f3fc.js → popup.taro-687437a0.js} +1 -0
- package/dist/esm/{searchbar.taro-39351331.js → searchbar.taro-b2d6eff2.js} +2 -2
- package/dist/esm/{shortpassword.taro-cff61e4e.js → shortpassword.taro-4f714afb.js} +1 -1
- package/dist/esm/{sidenavbar.taro-1aefdd3c.js → sidenavbar.taro-03fb1fc6.js} +1 -1
- package/dist/esm/{skeleton.taro-ce714b06.js → skeleton.taro-e29f9f0c.js} +1 -1
- package/dist/esm/{swipe.taro-966af6d3.js → swipe.taro-4eb0cc9a.js} +6 -5
- package/dist/esm/{timeselect.taro-9e37e648.js → timeselect.taro-9de6ab39.js} +1 -1
- package/dist/esm/types/src/packages/button/button.d.ts +1 -0
- package/dist/esm/types/src/packages/datepicker/datepicker.d.ts +11 -17
- package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +11 -17
- package/dist/esm/types/src/packages/datepicker/index.d.ts +1 -0
- package/dist/esm/types/src/packages/datepicker/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/elevator/elevator.d.ts +0 -1
- package/dist/esm/types/src/packages/elevator/elevator.taro.d.ts +0 -1
- package/dist/esm/types/src/packages/form/__tests__/form.spec.d.ts +1 -0
- package/dist/esm/types/src/packages/form/context.d.ts +4 -0
- package/dist/esm/types/src/packages/form/form.d.ts +11 -4
- package/dist/esm/types/src/packages/form/form.taro.d.ts +14 -4
- package/dist/esm/types/src/packages/form/index.d.ts +1 -0
- package/dist/esm/types/src/packages/form/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/form/types.d.ts +4 -52
- package/dist/esm/types/src/packages/formitem/formitem.d.ts +16 -15
- package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +16 -12
- package/dist/esm/types/src/packages/formitem/index.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/types.d.ts +1 -31
- package/dist/esm/types/src/packages/inputnumber/inputnumber.d.ts +1 -1
- package/dist/esm/types/src/packages/inputnumber/inputnumber.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/picker/picker.d.ts +7 -2
- package/dist/esm/types/src/packages/picker/picker.taro.d.ts +7 -2
- package/dist/esm/types/src/packages/sticky/sticky.d.ts +0 -1
- package/dist/esm/types/src/packages/swipe/swipe.d.ts +2 -6
- package/dist/esm/types/src/packages/swipe/swipe.taro.d.ts +2 -6
- package/dist/esm/types/src/packages/toast/Notification.d.ts +4 -1
- package/dist/esm/types/src/utils/is-forward-ref-component.d.ts +1 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +1851 -676
- package/dist/nutui.react.umd.js +1832 -657
- package/dist/packages/actionsheet/actionsheet.scss +6 -6
- package/dist/packages/divider/divider.scss +8 -7
- package/dist/packages/formitem/formitem.scss +1 -13
- package/dist/packages/layout/layout.scss +0 -2
- package/dist/packages/menuitem/menuitem.scss +1 -1
- package/dist/packages/noticebar/noticebar.scss +0 -3
- package/dist/packages/pagination/pagination.scss +8 -30
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/animate/animate.taro.d.ts +3 -3
- package/dist/types/packages/audio/audio.taro.d.ts +28 -8
- package/dist/types/packages/avatar/avatar.taro.d.ts +4 -4
- package/dist/types/packages/avatargroup/avatargroup.taro.d.ts +5 -5
- package/dist/types/packages/button/button.taro.d.ts +4 -4
- package/dist/types/packages/cascader/cascader.taro.d.ts +4 -4
- package/dist/types/packages/checkboxgroup/checkboxgroup.taro.d.ts +3 -3
- package/dist/types/packages/datepicker/datepicker.taro.d.ts +79 -25
- package/dist/types/packages/datepicker/index.taro.d.ts +1 -0
- package/dist/types/packages/divider/divider.taro.d.ts +2 -2
- package/dist/types/packages/drag/drag.taro.d.ts +1 -1
- package/dist/types/packages/elevator/elevator.taro.d.ts +0 -1
- package/dist/types/packages/empty/empty.taro.d.ts +3 -3
- package/dist/types/packages/fixednav/fixednav.taro.d.ts +3 -3
- package/dist/types/packages/form/context.d.ts +3 -0
- package/dist/types/packages/form/form.taro.d.ts +46 -4
- package/dist/types/packages/form/index.taro.d.ts +1 -0
- package/dist/types/packages/form/types.d.ts +4 -52
- package/dist/types/packages/formitem/formitem.taro.d.ts +45 -13
- package/dist/types/packages/formitem/index.taro.d.ts +1 -0
- package/dist/types/packages/formitem/types.d.ts +1 -31
- package/dist/types/packages/grid/grid.taro.d.ts +1 -1
- package/dist/types/packages/infiniteloading/infiniteloading.taro.d.ts +1 -1
- package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +1 -1
- package/dist/types/packages/noticebar/noticebar.taro.d.ts +3 -3
- package/dist/types/packages/overlay/overlay.taro.d.ts +1 -1
- package/dist/types/packages/picker/index.d.ts +4 -0
- package/dist/types/packages/picker/picker.d.ts +23 -0
- package/dist/types/packages/picker/picker.taro.d.ts +7 -2
- package/dist/types/packages/picker/pickerpanel.d.ts +15 -0
- package/dist/types/packages/popover/popover.taro.d.ts +5 -5
- package/dist/types/packages/popup/index.d.ts +3 -0
- package/dist/types/packages/popup/popup.d.ts +22 -0
- package/dist/types/packages/popup/popup.taro.d.ts +2 -2
- package/dist/types/packages/radio/radio.taro.d.ts +2 -2
- package/dist/types/packages/range/range.taro.d.ts +3 -3
- package/dist/types/packages/searchbar/searchbar.taro.d.ts +5 -5
- package/dist/types/packages/step/step.taro.d.ts +3 -3
- package/dist/types/packages/steps/steps.taro.d.ts +1 -1
- package/dist/types/packages/sticky/sticky.taro.d.ts +1 -1
- package/dist/types/packages/swipe/swipe.taro.d.ts +2 -6
- package/dist/types/packages/swiper/swiper.taro.d.ts +1 -1
- package/dist/types/packages/tabs/tabs.taro.d.ts +1 -1
- package/dist/types/packages/tag/tag.taro.d.ts +1 -1
- package/dist/types/packages/timeselect/timeselect.taro.d.ts +2 -2
- package/dist/types/packages/toast/toast.taro.d.ts +4 -4
- package/dist/types/packages/uploader/uploader.taro.d.ts +18 -18
- package/dist/types/utils/is-forward-ref-component.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/form.taro-b06754e8.js +0 -182
- package/dist/esm/formitem.taro-b326809d.js +0 -108
- package/dist/esm/types/src/packages/formitem/formitemcontext.d.ts +0 -6
- package/dist/types/packages/formitem/formitemcontext.d.ts +0 -5
- package/dist/esm/{avatar.taro-8a26cd6c.js → avatar.taro-9ab097d0.js} +1 -1
- /package/dist/esm/types/src/packages/form/{useForm.d.ts → useform.d.ts} +0 -0
- /package/dist/esm/types/src/packages/form/{useForm.taro.d.ts → useform.taro.d.ts} +0 -0
- /package/dist/types/packages/form/{useForm.taro.d.ts → useform.taro.d.ts} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { forwardRef, useRef, useState, useImperativeHandle, useEffect } from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
import { useReady, nextTick } from "@tarojs/taro";
|
|
4
|
-
import { c as cn } from "./bem-cdccae08.js";
|
|
5
4
|
import { u as useTouch } from "./use-touch-ff43512c.js";
|
|
6
5
|
import { g as getRectByTaro } from "./use-client-rect-2bb6c562.js";
|
|
6
|
+
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
7
7
|
function preventDefault(event, isStopPropagation) {
|
|
8
8
|
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
9
9
|
event.preventDefault();
|
|
@@ -13,10 +13,11 @@ function preventDefault(event, isStopPropagation) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
const defaultProps = {
|
|
16
|
+
...ComponentDefaults,
|
|
16
17
|
name: ""
|
|
17
18
|
};
|
|
18
19
|
const Swipe = forwardRef((props, instanceRef) => {
|
|
19
|
-
const
|
|
20
|
+
const classPrefix = "nut-swipe";
|
|
20
21
|
const touch = useTouch();
|
|
21
22
|
useReady(() => {
|
|
22
23
|
const getWidth = async () => {
|
|
@@ -129,7 +130,7 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
129
130
|
const rightWrapper = useRef(null);
|
|
130
131
|
const renderActionContent = (side) => {
|
|
131
132
|
if (props[`${side}Action`]) {
|
|
132
|
-
return React.createElement("div", { id: "left", ref: side === "left" ? leftWrapper : rightWrapper, className: `${
|
|
133
|
+
return React.createElement("div", { id: "left", ref: side === "left" ? leftWrapper : rightWrapper, className: `${classPrefix}__${side}`, onClick: (e) => handleOperate(e, side) }, props[`${side}Action`]);
|
|
133
134
|
}
|
|
134
135
|
return null;
|
|
135
136
|
};
|
|
@@ -163,10 +164,10 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
163
164
|
}, []);
|
|
164
165
|
return React.createElement(
|
|
165
166
|
"div",
|
|
166
|
-
{ ref: root, className: classNames(
|
|
167
|
+
{ ref: root, className: classNames(classPrefix, className), onTouchStart: (e) => onTouchStart(e), onTouchMove: (e) => onTouchMove(e), onTouchEnd: (e) => onTouchEnd(e), style },
|
|
167
168
|
React.createElement(
|
|
168
169
|
"div",
|
|
169
|
-
{ className: `${
|
|
170
|
+
{ className: `${classPrefix}__wrapper`, style: wrapperStyle },
|
|
170
171
|
renderActionContent("left"),
|
|
171
172
|
children,
|
|
172
173
|
renderActionContent("right")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
|
-
import { P as Popup } from "./popup.taro-
|
|
3
|
+
import { P as Popup } from "./popup.taro-687437a0.js";
|
|
4
4
|
import { T as TimeDetail } from "./timedetail.taro-d7aa4c1b.js";
|
|
5
5
|
import { C as ComponentDefaults } from "./typings-11d83a22.js";
|
|
6
6
|
import { u as useConfig } from "./configprovider.taro-372b1525.js";
|
|
@@ -15,6 +15,7 @@ export interface ButtonProps extends BasicComponent {
|
|
|
15
15
|
disabled: boolean;
|
|
16
16
|
icon: React.ReactNode;
|
|
17
17
|
id: string;
|
|
18
|
+
nativeType: 'submit' | 'reset' | 'button';
|
|
18
19
|
onClick: (e: MouseEvent) => void;
|
|
19
20
|
}
|
|
20
21
|
export declare const Button: React.ForwardRefExoticComponent<Partial<ButtonProps> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
className?: string | number;
|
|
8
|
-
}
|
|
9
|
-
export interface DatePickerProps {
|
|
10
|
-
modelValue: Date | null;
|
|
2
|
+
import { PickerOption } from '@/packages/picker/index';
|
|
3
|
+
import { BasicComponent } from '@/utils/typings';
|
|
4
|
+
export interface DatePickerProps extends BasicComponent {
|
|
5
|
+
value?: Date | null;
|
|
6
|
+
defaultValue?: Date | null;
|
|
11
7
|
visible: boolean;
|
|
12
8
|
title: string;
|
|
13
9
|
type: 'date' | 'time' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes';
|
|
14
|
-
|
|
10
|
+
showChinese: boolean;
|
|
15
11
|
minuteStep: number;
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
startDate: Date;
|
|
13
|
+
endDate: Date;
|
|
18
14
|
threeDimensional: boolean;
|
|
19
|
-
className?: string;
|
|
20
|
-
style?: React.CSSProperties;
|
|
21
15
|
formatter: (type: string, option: PickerOption) => PickerOption;
|
|
22
16
|
filter: (type: string, option: PickerOption[]) => PickerOption[];
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
onConfirm: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void;
|
|
25
19
|
onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void;
|
|
26
20
|
}
|
|
27
|
-
export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>>;
|
|
21
|
+
export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>>;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
className?: string | number;
|
|
8
|
-
}
|
|
9
|
-
export interface DatePickerProps {
|
|
10
|
-
modelValue: Date | null;
|
|
2
|
+
import { PickerOption } from '@/packages/picker/index';
|
|
3
|
+
import { BasicComponent } from '@/utils/typings';
|
|
4
|
+
export interface DatePickerProps extends BasicComponent {
|
|
5
|
+
value?: Date | null;
|
|
6
|
+
defaultValue?: Date | null;
|
|
11
7
|
visible: boolean;
|
|
12
8
|
title: string;
|
|
13
9
|
type: 'date' | 'time' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes';
|
|
14
|
-
|
|
10
|
+
showChinese: boolean;
|
|
15
11
|
minuteStep: number;
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
startDate: Date;
|
|
13
|
+
endDate: Date;
|
|
18
14
|
threeDimensional: boolean;
|
|
19
|
-
className?: string;
|
|
20
|
-
style?: React.CSSProperties;
|
|
21
15
|
formatter: (type: string, option: PickerOption) => PickerOption;
|
|
22
16
|
filter: (type: string, option: PickerOption[]) => PickerOption[];
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
onConfirm: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void;
|
|
25
19
|
onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void;
|
|
26
20
|
}
|
|
27
|
-
export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>>;
|
|
21
|
+
export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import React, { FunctionComponent } from 'react';
|
|
2
|
-
import { useForm } from './
|
|
1
|
+
import React, { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { useForm } from './useform';
|
|
3
3
|
import { BasicComponent } from '@/utils/typings';
|
|
4
4
|
import { FormItem } from '../formitem/formitem';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
export interface FormProps extends BasicComponent {
|
|
6
|
+
footer: ReactNode;
|
|
7
|
+
initialValues: any;
|
|
8
|
+
name: string;
|
|
9
|
+
form: any;
|
|
10
|
+
labelPosition: 'top' | 'left' | 'right';
|
|
11
|
+
starPosition: 'left' | 'right';
|
|
12
|
+
onFinish: (values: any) => void;
|
|
13
|
+
onFinishFailed: (values: any, errorFields: any) => void;
|
|
7
14
|
}
|
|
8
15
|
export declare const Form: FunctionComponent<Partial<FormProps> & React.HTMLAttributes<HTMLFormElement>> & {
|
|
9
16
|
Item: typeof FormItem;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import React, { FunctionComponent } from 'react';
|
|
1
|
+
import React, { FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import { BasicComponent } from '@/utils/typings';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
export interface FormProps extends BasicComponent
|
|
3
|
+
import { useForm } from './useform.taro';
|
|
4
|
+
import { FormItem } from '../formitem/formitem.taro';
|
|
5
|
+
export interface FormProps extends BasicComponent {
|
|
6
|
+
footer: ReactNode;
|
|
7
|
+
initialValues: any;
|
|
8
|
+
name: string;
|
|
9
|
+
form: any;
|
|
10
|
+
labelPosition: 'top' | 'left' | 'right';
|
|
11
|
+
starPosition: 'left' | 'right';
|
|
12
|
+
onFinish: (values: any) => void;
|
|
13
|
+
onFinishFailed: (values: any, errorFields: any) => void;
|
|
6
14
|
}
|
|
7
15
|
export declare const Form: FunctionComponent<Partial<FormProps> & React.HTMLAttributes<HTMLFormElement>> & {
|
|
8
16
|
Item: typeof FormItem;
|
|
17
|
+
} & {
|
|
18
|
+
useForm: typeof useForm;
|
|
9
19
|
};
|
|
@@ -1,63 +1,18 @@
|
|
|
1
|
-
export interface BaseForm {
|
|
2
|
-
/**
|
|
3
|
-
* 经 Form.useForm() 创建的 form 控制实例,不提供时会自动创建
|
|
4
|
-
*/
|
|
5
|
-
form: any;
|
|
6
|
-
/**
|
|
7
|
-
* label的位置
|
|
8
|
-
* 可选值 top/left/right
|
|
9
|
-
*/
|
|
10
|
-
labelPosition: string | number;
|
|
11
|
-
/**
|
|
12
|
-
* 表单分组名称
|
|
13
|
-
*/
|
|
14
|
-
formGroupTitle: string;
|
|
15
|
-
starPositon: string;
|
|
16
|
-
/**
|
|
17
|
-
* 表单校验成功回调
|
|
18
|
-
*/
|
|
19
|
-
onFinish: (obj: object) => void;
|
|
20
|
-
/**
|
|
21
|
-
* 表单校验失败回调
|
|
22
|
-
*/
|
|
23
|
-
onFinishFailed: (value: []) => void;
|
|
24
|
-
}
|
|
25
1
|
export interface FormItemRuleWithoutValidator {
|
|
26
2
|
[key: string]: any;
|
|
27
3
|
regex?: RegExp;
|
|
28
4
|
required?: boolean;
|
|
29
5
|
message?: string;
|
|
30
6
|
}
|
|
31
|
-
export
|
|
32
|
-
validator?: (value: any, ruleCfg: FormItemRuleWithoutValidator) => boolean | string | Promise<boolean | string>;
|
|
33
|
-
}
|
|
34
|
-
export interface BaseFormField {
|
|
35
|
-
/**
|
|
36
|
-
* 字段名
|
|
37
|
-
*/
|
|
38
|
-
name: string;
|
|
39
|
-
/**
|
|
40
|
-
* label 标签的文本
|
|
41
|
-
*/
|
|
42
|
-
label: string;
|
|
43
|
-
/**
|
|
44
|
-
* 校验规则,设置字段的校验逻辑
|
|
45
|
-
*/
|
|
46
|
-
rules: FormItemRule[];
|
|
47
|
-
/**
|
|
48
|
-
* 是否禁用表单项
|
|
49
|
-
*/
|
|
50
|
-
disabled: boolean;
|
|
51
|
-
}
|
|
52
|
-
export type StoreValue = string | number;
|
|
7
|
+
export type StoreValue = any;
|
|
53
8
|
export type NamePath = string | number;
|
|
54
9
|
export interface Callbacks<Values = any> {
|
|
55
10
|
onValuesChange?: (values: Values) => void;
|
|
56
11
|
onFinish?: (values: Values) => void;
|
|
57
|
-
onFinishFailed?: (Values:
|
|
12
|
+
onFinishFailed?: (values: Values, errorFields: any) => void;
|
|
58
13
|
}
|
|
59
14
|
export interface Store {
|
|
60
|
-
[name: string]:
|
|
15
|
+
[name: string]: any;
|
|
61
16
|
}
|
|
62
17
|
export interface FormInstance<Values = any> {
|
|
63
18
|
registerField: (entity: FieldEntity) => () => void;
|
|
@@ -68,7 +23,7 @@ export interface FormInstance<Values = any> {
|
|
|
68
23
|
setCallback: (callbacks: Callbacks) => void;
|
|
69
24
|
}
|
|
70
25
|
export interface FieldEntity {
|
|
71
|
-
onStoreChange: () => void;
|
|
26
|
+
onStoreChange: (type?: string) => void;
|
|
72
27
|
getNamePath: () => NamePath;
|
|
73
28
|
props: {
|
|
74
29
|
name: NamePath;
|
|
@@ -77,6 +32,3 @@ export interface FieldEntity {
|
|
|
77
32
|
initialValue?: any;
|
|
78
33
|
};
|
|
79
34
|
}
|
|
80
|
-
export interface IDescriptor {
|
|
81
|
-
[name: string]: string;
|
|
82
|
-
}
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseFormField } from './types';
|
|
3
|
-
import {
|
|
3
|
+
import { Context } from '../form/context';
|
|
4
4
|
import { BasicComponent } from '@/utils/typings';
|
|
5
5
|
type TextAlign = 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'match-parent';
|
|
6
6
|
export interface FormItemProps extends BasicComponent, BaseFormField {
|
|
7
|
-
|
|
7
|
+
required: boolean;
|
|
8
|
+
initialValue: any;
|
|
9
|
+
trigger: string;
|
|
10
|
+
valuePropName: string;
|
|
11
|
+
getValueFromEvent: (...args: any) => any;
|
|
12
|
+
onClick: (event: React.MouseEvent, componentRef: React.MutableRefObject<any>) => void;
|
|
8
13
|
errorMessageAlign: TextAlign;
|
|
9
|
-
showErrorLine: boolean;
|
|
10
|
-
showErrorMessage: boolean;
|
|
11
|
-
initialValue: string;
|
|
12
14
|
}
|
|
13
15
|
declare const defaultProps: FormItemProps;
|
|
14
16
|
export type FieldProps = typeof defaultProps & Partial<BaseFormField>;
|
|
15
|
-
export declare class FormItem extends React.Component<FieldProps
|
|
17
|
+
export declare class FormItem extends React.Component<FieldProps, {
|
|
18
|
+
resetCount: number;
|
|
19
|
+
}> {
|
|
16
20
|
static defaultProps: FormItemProps;
|
|
17
21
|
static contextType: any;
|
|
18
|
-
context: React.ContextType<typeof
|
|
22
|
+
context: React.ContextType<typeof Context>;
|
|
19
23
|
private cancelRegister;
|
|
20
|
-
private
|
|
24
|
+
private componentRef;
|
|
25
|
+
constructor(props: FieldProps);
|
|
21
26
|
componentDidMount(): void;
|
|
22
27
|
componentWillUnmount(): void;
|
|
23
|
-
getControlled: (children: React.ReactElement) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
onChange: (event: React.ChangeEvent<HTMLInputElement> | number | string | string[]) => void;
|
|
27
|
-
};
|
|
28
|
-
onStoreChange: () => void;
|
|
28
|
+
getControlled: (children: React.ReactElement) => any;
|
|
29
|
+
refresh: () => void;
|
|
30
|
+
onStoreChange: (type?: string) => void;
|
|
29
31
|
renderLayout: (childNode: React.ReactNode) => JSX.Element;
|
|
30
|
-
pxCheck: (value: string | number) => string;
|
|
31
32
|
render(): JSX.Element;
|
|
32
33
|
}
|
|
33
34
|
export {};
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BaseFormField } from './types';
|
|
3
|
-
import {
|
|
3
|
+
import { Context } from '../form/context';
|
|
4
4
|
import { BasicComponent } from '@/utils/typings';
|
|
5
5
|
type TextAlign = 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'match-parent';
|
|
6
6
|
export interface FormItemProps extends BasicComponent, BaseFormField {
|
|
7
|
-
|
|
7
|
+
required: boolean;
|
|
8
|
+
initialValue: any;
|
|
9
|
+
trigger: string;
|
|
10
|
+
valuePropName: string;
|
|
11
|
+
getValueFromEvent: (...args: any) => any;
|
|
12
|
+
onClick: (event: React.MouseEvent, componentRef: React.MutableRefObject<any>) => void;
|
|
8
13
|
errorMessageAlign: TextAlign;
|
|
9
|
-
showErrorLine: boolean;
|
|
10
|
-
showErrorMessage: boolean;
|
|
11
14
|
}
|
|
12
15
|
declare const defaultProps: FormItemProps;
|
|
13
16
|
export type FieldProps = typeof defaultProps & Partial<BaseFormField>;
|
|
14
|
-
export declare class FormItem extends React.Component<FieldProps
|
|
17
|
+
export declare class FormItem extends React.Component<FieldProps, {
|
|
18
|
+
resetCount: number;
|
|
19
|
+
}> {
|
|
15
20
|
static defaultProps: FormItemProps;
|
|
16
21
|
static contextType: any;
|
|
17
|
-
context: React.ContextType<typeof
|
|
22
|
+
context: React.ContextType<typeof Context>;
|
|
18
23
|
private cancelRegister;
|
|
24
|
+
private componentRef;
|
|
25
|
+
constructor(props: FieldProps);
|
|
19
26
|
componentDidMount(): void;
|
|
20
27
|
componentWillUnmount(): void;
|
|
21
|
-
getControlled: (children: React.ReactElement) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
onStoreChange: () => void;
|
|
28
|
+
getControlled: (children: React.ReactElement) => any;
|
|
29
|
+
refresh: () => void;
|
|
30
|
+
onStoreChange: (type?: string) => void;
|
|
26
31
|
renderLayout: (childNode: React.ReactNode) => JSX.Element;
|
|
27
|
-
pxCheck: (value: string | number) => string;
|
|
28
32
|
render(): JSX.Element;
|
|
29
33
|
}
|
|
30
34
|
export {};
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
export interface BaseForm {
|
|
2
|
-
/**
|
|
3
|
-
* 经 Form.useForm() 创建的 form 控制实例,不提供时会自动创建
|
|
4
|
-
*/
|
|
5
|
-
form: any;
|
|
6
|
-
/**
|
|
7
|
-
* label的位置
|
|
8
|
-
* 可选值 top/left/right
|
|
9
|
-
*/
|
|
10
|
-
labelPosition: string | number;
|
|
11
|
-
/**
|
|
12
|
-
* 表单分组名称
|
|
13
|
-
*/
|
|
14
|
-
formGroupTitle: string;
|
|
15
|
-
starPositon: string;
|
|
16
|
-
/**
|
|
17
|
-
* 表单校验成功回调
|
|
18
|
-
*/
|
|
19
|
-
onFinish: (obj: object) => void;
|
|
20
|
-
/**
|
|
21
|
-
* 表单校验失败回调
|
|
22
|
-
*/
|
|
23
|
-
onFinishFailed: (value: []) => void;
|
|
24
|
-
}
|
|
25
1
|
export interface FormItemRuleWithoutValidator {
|
|
26
2
|
[key: string]: any;
|
|
27
3
|
regex?: RegExp;
|
|
@@ -49,16 +25,13 @@ export interface BaseFormField {
|
|
|
49
25
|
*/
|
|
50
26
|
disabled: boolean;
|
|
51
27
|
}
|
|
52
|
-
export type StoreValue =
|
|
28
|
+
export type StoreValue = any;
|
|
53
29
|
export type NamePath = string | number;
|
|
54
30
|
export interface Callbacks<Values = any> {
|
|
55
31
|
onValuesChange?: (values: Values) => void;
|
|
56
32
|
onFinish?: (values: Values) => void;
|
|
57
33
|
onFinishFailed?: (Values: Values) => void;
|
|
58
34
|
}
|
|
59
|
-
export interface Store {
|
|
60
|
-
[name: string]: StoreValue;
|
|
61
|
-
}
|
|
62
35
|
export interface FormInstance<Values = any> {
|
|
63
36
|
registerField: (entity: FieldEntity) => () => void;
|
|
64
37
|
getFieldValue: (name: NamePath) => StoreValue;
|
|
@@ -77,6 +50,3 @@ export interface FieldEntity {
|
|
|
77
50
|
initialValue?: any;
|
|
78
51
|
};
|
|
79
52
|
}
|
|
80
|
-
export interface IDescriptor {
|
|
81
|
-
[name: string]: string;
|
|
82
|
-
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
2
|
import { PickerOption } from './types';
|
|
3
3
|
import { BasicComponent } from '@/utils/typings';
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export type PickerActions = {
|
|
5
|
+
open: () => void;
|
|
6
|
+
close: () => void;
|
|
7
|
+
};
|
|
8
|
+
export interface PickerProps extends Omit<BasicComponent, 'children'> {
|
|
9
|
+
visible?: boolean | undefined;
|
|
6
10
|
title?: string;
|
|
7
11
|
options: (PickerOption | PickerOption[])[];
|
|
8
12
|
value?: (number | string)[];
|
|
@@ -13,6 +17,7 @@ export interface PickerProps extends BasicComponent {
|
|
|
13
17
|
onClose?: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void;
|
|
14
18
|
afterClose?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], pickerRef: RefObject<HTMLDivElement>) => void;
|
|
15
19
|
onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void;
|
|
20
|
+
children?: any;
|
|
16
21
|
}
|
|
17
22
|
declare const Picker: React.ForwardRefExoticComponent<Partial<PickerProps> & React.RefAttributes<unknown>>;
|
|
18
23
|
export default Picker;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
2
|
import { PickerOption } from './types';
|
|
3
3
|
import { BasicComponent } from '@/utils/typings';
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export type PickerActions = {
|
|
5
|
+
open: () => void;
|
|
6
|
+
close: () => void;
|
|
7
|
+
};
|
|
8
|
+
export interface PickerProps extends Omit<BasicComponent, 'children'> {
|
|
9
|
+
visible?: boolean | undefined;
|
|
6
10
|
title?: string;
|
|
7
11
|
options: (PickerOption | PickerOption[])[];
|
|
8
12
|
value?: (number | string)[];
|
|
@@ -13,6 +17,7 @@ export interface PickerProps extends BasicComponent {
|
|
|
13
17
|
onClose?: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void;
|
|
14
18
|
afterClose?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], pickerRef: RefObject<HTMLDivElement>) => void;
|
|
15
19
|
onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void;
|
|
20
|
+
children?: any;
|
|
16
21
|
}
|
|
17
22
|
declare const Picker: React.ForwardRefExoticComponent<Partial<PickerProps> & React.RefAttributes<unknown>>;
|
|
18
23
|
export default Picker;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { BasicComponent } from '@/utils/typings';
|
|
2
3
|
export type SwipeSide = 'left' | 'right';
|
|
3
4
|
export interface SwipeInstance {
|
|
4
5
|
open: (side: SwipeSide) => void;
|
|
5
6
|
close: () => void;
|
|
6
7
|
}
|
|
7
|
-
export interface SwipeProps {
|
|
8
|
-
/** 自定义类名 */
|
|
9
|
-
className: string;
|
|
10
|
-
/** 自定义样式 */
|
|
11
|
-
style: React.CSSProperties;
|
|
8
|
+
export interface SwipeProps extends BasicComponent {
|
|
12
9
|
/** 标识符,可以在事件参数中获取到 */
|
|
13
10
|
name?: string | number;
|
|
14
11
|
/** 左侧滑动区域的内容 */
|
|
@@ -34,6 +31,5 @@ export interface SwipeProps {
|
|
|
34
31
|
onTouchStart?: (event: Event) => void;
|
|
35
32
|
onTouchEnd?: (event: Event) => void;
|
|
36
33
|
onTouchMove?: (event: Event) => void;
|
|
37
|
-
children?: React.ReactNode;
|
|
38
34
|
}
|
|
39
35
|
export declare const Swipe: React.ForwardRefExoticComponent<Partial<SwipeProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "onTouchEnd" | "onTouchMove" | "onTouchStart"> & React.RefAttributes<SwipeInstance>>;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { BasicComponent } from '@/utils/typings';
|
|
2
3
|
export type SwipeSide = 'left' | 'right';
|
|
3
4
|
export interface SwipeInstance {
|
|
4
5
|
open: (side: SwipeSide) => void;
|
|
5
6
|
close: () => void;
|
|
6
7
|
}
|
|
7
|
-
export interface SwipeProps {
|
|
8
|
-
/** 自定义类名 */
|
|
9
|
-
className: string;
|
|
10
|
-
/** 自定义样式 */
|
|
11
|
-
style: React.CSSProperties;
|
|
8
|
+
export interface SwipeProps extends BasicComponent {
|
|
12
9
|
/** 标识符,可以在事件参数中获取到 */
|
|
13
10
|
name?: string | number;
|
|
14
11
|
/** 左侧滑动区域的内容 */
|
|
@@ -34,6 +31,5 @@ export interface SwipeProps {
|
|
|
34
31
|
onTouchStart?: (event: Event) => void;
|
|
35
32
|
onTouchEnd?: (event: Event) => void;
|
|
36
33
|
onTouchMove?: (event: Event) => void;
|
|
37
|
-
children?: React.ReactNode;
|
|
38
34
|
}
|
|
39
35
|
export declare const Swipe: React.ForwardRefExoticComponent<Partial<SwipeProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "onTouchEnd" | "onTouchMove" | "onTouchStart"> & React.RefAttributes<SwipeInstance>>;
|
|
@@ -13,7 +13,10 @@ export interface NotificationProps extends BasicComponent {
|
|
|
13
13
|
contentStyle?: React.CSSProperties;
|
|
14
14
|
onClose: () => void;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export interface NotificationState {
|
|
17
|
+
show: boolean;
|
|
18
|
+
}
|
|
19
|
+
export default class Notification extends React.PureComponent<NotificationProps, NotificationState> {
|
|
17
20
|
static newInstance: (properties: NotificationProps, callback: any) => void;
|
|
18
21
|
private closeTimer;
|
|
19
22
|
constructor(props: NotificationProps);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isForwardRefComponent(component: any): any;
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED