@simpleform/form 2.1.14 → 2.2.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.
- package/README.md +1 -1
- package/README_CN.md +1 -1
- package/lib/context.d.ts +1 -1
- package/lib/{item-core.d.ts → core.d.ts} +5 -5
- package/lib/css/main.css +1 -1
- package/lib/form-item.d.ts +1 -1
- package/lib/form.d.ts +1 -1
- package/lib/hooks.d.ts +2 -2
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -1
- package/lib/store.d.ts +24 -23
- package/lib/typings.d.ts +1 -0
- package/lib/utils/type.d.ts +25 -21
- package/lib/utils/utils.d.ts +6 -5
- package/lib/validator/index.d.ts +1 -1
- package/package.json +1 -1
- package/lib/components/Tooltip/index.d.ts +0 -7
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# `@simpleform/form`
|
|
2
2
|
English | [中文说明](./README_CN.md)
|
|
3
3
|
|
|
4
|
-
[](https://www.npmjs.com/package/@simpleform/form)
|
|
5
5
|
|
|
6
6
|
> The underlying form component, Binding of form values to display and update events is accomplished through callback functions.
|
|
7
7
|
|
package/README_CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](./README.md) | 中文说明
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@simpleform/form)
|
|
6
6
|
|
|
7
7
|
> 表单底层组件,通过回调函数方式实现表单值的显示和更新事件的绑定.
|
|
8
8
|
|
package/lib/context.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormProps } from './form';
|
|
3
|
-
export declare const SimpleFormContext: React.Context<Omit<import(".").ItemProps, "children"> & import("./
|
|
3
|
+
export declare const SimpleFormContext: React.Context<Omit<import(".").ItemProps, "children"> & import("./core").ItemCoreProps & {
|
|
4
4
|
component?: React.ComponentType<any> | React.ForwardRefExoticComponent<any> | null;
|
|
5
5
|
} & Pick<FormProps, "form">>;
|
|
6
6
|
export declare const FormInitialValuesContext: React.Context<unknown>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { getValueFromEvent } from './utils/utils';
|
|
2
|
+
import { FormPathType, getValueFromEvent } from './utils/utils';
|
|
3
3
|
import { FormRule } from './validator';
|
|
4
4
|
import { FormProps } from './form';
|
|
5
5
|
type TriggerType = string;
|
|
6
6
|
export type FormEventHandler<V = unknown, A = unknown> = (obj: {
|
|
7
|
-
name?:
|
|
7
|
+
name?: FormPathType;
|
|
8
8
|
value?: V;
|
|
9
9
|
}, values?: A) => void;
|
|
10
10
|
export interface ItemCoreProps {
|
|
11
|
-
name?:
|
|
11
|
+
name?: FormPathType;
|
|
12
12
|
nonform?: boolean;
|
|
13
13
|
index?: number;
|
|
14
14
|
trigger?: TriggerType;
|
|
15
15
|
validateTrigger?: TriggerType | TriggerType[];
|
|
16
16
|
valueProp?: string | ((type: string) => string);
|
|
17
17
|
valueGetter?: typeof getValueFromEvent;
|
|
18
|
-
valueSetter?:
|
|
18
|
+
valueSetter?: (value: any) => unknown;
|
|
19
19
|
rules?: FormRule[];
|
|
20
20
|
initialValue?: unknown;
|
|
21
21
|
errorClassName?: string;
|
|
@@ -29,7 +29,7 @@ export interface ItemCoreProps {
|
|
|
29
29
|
}) => React.ReactNode);
|
|
30
30
|
}
|
|
31
31
|
export declare function getRulesTriggers(rules?: ItemCoreProps['rules']): string[];
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function mergeTriggers(trigger: ItemCoreProps['trigger'], validateTrigger: ItemCoreProps['validateTrigger'], ruleTriggers: Array<TriggerType>): Set<string>;
|
|
33
33
|
export declare const ItemCore: {
|
|
34
34
|
(props: ItemCoreProps): React.JSX.Element;
|
|
35
35
|
displayName: string;
|
package/lib/css/main.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.field-item:not(:last-child){margin-bottom:16px}.field-item .label__container{font-size:14px;line-height:normal;overflow-wrap:break-word;word-break:break-all}.field-item .label__container .label__tooltip{cursor:help;-webkit-writing-mode:horizontal-tb;-ms-writing-mode:lr-tb;writing-mode:horizontal-tb;-webkit-margin-start:4px;margin-inline-start:4px}.field-item .label__container--required label:before{display:inline-block;-webkit-margin-end:4px;color:#ff4d4f;content:"*";font-family:SimSun,sans-serif;font-size:14px;line-height:1;margin-inline-end:4px}.field-item .control__container{position:relative}.field-item .control__container .item__control{margin-left:0;margin-right:0;overflow-wrap:break-word;padding:.1px;word-break:break-word}.field-item .control__container .item__suffix{font-size:14px;margin-left:10px;margin-top:3px}.field-item .control__container .item__footer{margin-top:8px;width:100%}.field-item .control__container .item__message{color:red;font-size:12px}.field-item .control__container--error .item__control .ant-checkbox,.field-item .control__container--error .item__control .ant-input,.field-item .control__container--error .item__control .ant-input-number,.field-item .control__container--error .item__control .ant-mentions,.field-item .control__container--error .item__control .ant-picker,.field-item .control__container--error .item__control .ant-radio,.field-item .control__container--error .item__control .ant-rate,.field-item .control__container--error .item__control .ant-select .ant-select-selector,.field-item .control__container--error .item__control .ant-slider,.field-item .control__container--error .item__control .ant-switch,.field-item .control__container--error .item__control .ant-upload{border-color:#ff4d4f}.field-item .control__container--error .item__control .ant-checkbox:hover,.field-item .control__container--error .item__control .ant-input-number:hover,.field-item .control__container--error .item__control .ant-input:hover,.field-item .control__container--error .item__control .ant-mentions:hover,.field-item .control__container--error .item__control .ant-picker:hover,.field-item .control__container--error .item__control .ant-radio:hover,.field-item .control__container--error .item__control .ant-rate:hover,.field-item .control__container--error .item__control .ant-select .ant-select-selector:hover,.field-item .control__container--error .item__control .ant-slider:hover,.field-item .control__container--error .item__control .ant-switch:hover,.field-item .control__container--error .item__control .ant-upload:hover{border-color:#ff7875;border-right-width:1px!important;-webkit-box-shadow:0 0 0 2px rgba(255,77,79,.2);box-shadow:0 0 0 2px rgba(255,77,79,.2);outline:0}.field-item--horizontal{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:100%}.field-item--horizontal>.label__container{padding-right:8px;text-align:right;width:100px}.field-item--horizontal>.control__container{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.field-item--vertical{display:inline-block;width:100%}.field-item--vertical>.label__container{padding-bottom:8px;width:auto}.field-item--error{margin-bottom:3px}.field-item--inline{vertical-align:top;width:auto}.field-item--compact{margin:0;padding:0}.svg-icon{height:1.1em;vertical-align:-.2em;width:1.1em;fill:currentColor;outline:none;overflow:hidden}
|
|
1
|
+
.field-item:not(:last-child){margin-bottom:16px}.field-item .label__container{font-size:14px;line-height:normal;overflow-wrap:break-word;word-break:break-all}.field-item .label__container .label__tooltip{cursor:help;-webkit-writing-mode:horizontal-tb;-ms-writing-mode:lr-tb;writing-mode:horizontal-tb;-webkit-margin-start:4px;margin-inline-start:4px}.field-item .label__container--required label:before{display:inline-block;-webkit-margin-end:4px;color:#ff4d4f;content:"*";font-family:SimSun,sans-serif;font-size:14px;line-height:1;margin-inline-end:4px}.field-item .control__container{position:relative}.field-item .control__container .item__control{margin-left:0;margin-right:0;overflow-wrap:break-word;padding:.1px;word-break:break-word}.field-item .control__container .item__suffix{font-size:14px;margin-left:10px;margin-top:3px}.field-item .control__container .item__footer{margin-top:8px;width:100%}.field-item .control__container .item__message{color:red;font-size:12px}.field-item .control__container--error .item__control .ant-checkbox,.field-item .control__container--error .item__control .ant-input,.field-item .control__container--error .item__control .ant-input-number,.field-item .control__container--error .item__control .ant-mentions,.field-item .control__container--error .item__control .ant-picker,.field-item .control__container--error .item__control .ant-radio,.field-item .control__container--error .item__control .ant-rate,.field-item .control__container--error .item__control .ant-select .ant-select-selector,.field-item .control__container--error .item__control .ant-slider,.field-item .control__container--error .item__control .ant-switch,.field-item .control__container--error .item__control .ant-upload{border-color:#ff4d4f}.field-item .control__container--error .item__control .ant-checkbox:hover,.field-item .control__container--error .item__control .ant-input-number:hover,.field-item .control__container--error .item__control .ant-input:hover,.field-item .control__container--error .item__control .ant-mentions:hover,.field-item .control__container--error .item__control .ant-picker:hover,.field-item .control__container--error .item__control .ant-radio:hover,.field-item .control__container--error .item__control .ant-rate:hover,.field-item .control__container--error .item__control .ant-select .ant-select-selector:hover,.field-item .control__container--error .item__control .ant-slider:hover,.field-item .control__container--error .item__control .ant-switch:hover,.field-item .control__container--error .item__control .ant-upload:hover{border-color:#ff7875;border-right-width:1px!important;-webkit-box-shadow:0 0 0 2px rgba(255,77,79,.2);box-shadow:0 0 0 2px rgba(255,77,79,.2);outline:0}.field-item--horizontal{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;width:100%}.field-item--horizontal>.label__container{padding-right:8px;text-align:right;width:100px}.field-item--horizontal>.control__container{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.field-item--vertical{display:inline-block;width:100%}.field-item--vertical>.label__container{padding-bottom:8px;width:auto}.field-item--error{margin-bottom:3px}.field-item--inline{vertical-align:top;width:auto}.field-item--compact{margin:0;padding:0}.svg-icon{height:1.1em;vertical-align:-.2em;width:1.1em;fill:currentColor;outline:none;overflow:hidden}
|
package/lib/form-item.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
2
|
import { ItemProps } from './components/Item';
|
|
3
|
-
import { ItemCoreProps } from './
|
|
3
|
+
import { ItemCoreProps } from './core';
|
|
4
4
|
export type FormItemOptions<P = ItemProps> = Omit<P, 'children'> & ItemCoreProps & {
|
|
5
5
|
component?: React.ComponentType<any> | React.ForwardRefExoticComponent<any> | null;
|
|
6
6
|
};
|
package/lib/form.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type FormProps<V = any, P = ItemProps> = {
|
|
|
21
21
|
} & FormItemOptions<P> & CreateFormProps;
|
|
22
22
|
export declare function Form(props: FormProps): React.JSX.Element;
|
|
23
23
|
export declare namespace Form {
|
|
24
|
-
var Item: React.ForwardRefExoticComponent<Omit<ItemProps, "children"> & import("./
|
|
24
|
+
var Item: React.ForwardRefExoticComponent<Omit<ItemProps, "children"> & import("./core").ItemCoreProps & {
|
|
25
25
|
component?: React.ComponentType<any> | React.ForwardRefExoticComponent<any> | null;
|
|
26
26
|
} & {
|
|
27
27
|
className?: string;
|
package/lib/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SimpleForm } from './store';
|
|
2
2
|
import { FormPathType } from './utils/utils';
|
|
3
3
|
export declare function useSimpleForm<T>(values?: T): SimpleForm<T>;
|
|
4
|
-
export declare function useFormError(form?: SimpleForm, path?:
|
|
5
|
-
export declare function useFormValues<V>(form: SimpleForm<V>, path?: FormPathType): Partial<V> | undefined;
|
|
4
|
+
export declare function useFormError(form?: SimpleForm, path?: FormPathType): readonly [string | boolean | undefined, import("react").Dispatch<import("react").SetStateAction<string | boolean | undefined>>];
|
|
5
|
+
export declare function useFormValues<V>(form: SimpleForm<V>, path?: FormPathType | Array<FormPathType>): Partial<V> | undefined;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './core';
|
|
2
2
|
export * from './form';
|
|
3
3
|
export * from './form-item';
|
|
4
4
|
export * from './store';
|
|
5
5
|
export * from './context';
|
|
6
6
|
export * from './hooks';
|
|
7
|
-
export * from './components/Tooltip';
|
|
8
7
|
export * from './components/Item';
|
|
9
8
|
export * from './utils/utils';
|
|
10
9
|
export * from './validator';
|