@tiny-codes/react-easy 1.0.2 → 1.0.4
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 +23 -1
- package/es/components/BreakLines/index.js +43 -26
- package/es/components/BreakLines/index.js.map +1 -1
- package/es/components/ConfigProvider/context.js +3 -3
- package/es/components/ConfigProvider/context.js.map +1 -1
- package/es/components/ConfigProvider/index.js +37 -35
- package/es/components/ConfigProvider/index.js.map +1 -1
- package/es/components/ConfirmAction/index.d.ts +74 -6
- package/es/components/ConfirmAction/index.js +210 -104
- package/es/components/ConfirmAction/index.js.map +1 -1
- package/es/components/DeleteConfirmAction/index.js +22 -20
- package/es/components/DeleteConfirmAction/index.js.map +1 -1
- package/es/components/ModalAction/index.d.ts +45 -5
- package/es/components/ModalAction/index.js +393 -209
- package/es/components/ModalAction/index.js.map +1 -1
- package/es/components/index.d.ts +5 -1
- package/es/components/index.js +10 -7
- package/es/components/index.js.map +1 -1
- package/es/hooks/index.js +4 -4
- package/es/hooks/index.js.map +1 -1
- package/es/hooks/useContextValidator.js +7 -12
- package/es/hooks/useContextValidator.js.map +1 -1
- package/es/hooks/useLocalizedText.js +6 -4
- package/es/hooks/useLocalizedText.js.map +1 -1
- package/es/hooks/useRefFunction.js +13 -6
- package/es/hooks/useRefFunction.js.map +1 -1
- package/es/hooks/useT.js +11 -8
- package/es/hooks/useT.js.map +1 -1
- package/es/hooks/useValidator.js +7 -4
- package/es/hooks/useValidator.js.map +1 -1
- package/es/hooks/useValidatorBuilder.js +146 -117
- package/es/hooks/useValidatorBuilder.js.map +1 -1
- package/es/hooks/useValidators.js +94 -58
- package/es/hooks/useValidators.js.map +1 -1
- package/es/index.js +2 -2
- package/es/index.js.map +1 -1
- package/es/locales/index.js +19 -13
- package/es/locales/index.js.map +1 -1
- package/es/locales/langs/en-US.js +20 -20
- package/es/locales/langs/en-US.js.map +1 -1
- package/es/locales/langs/en.js +1 -1
- package/es/locales/langs/en.js.map +1 -1
- package/es/locales/langs/zh-CN.js +20 -20
- package/es/locales/langs/zh-CN.js.map +1 -1
- package/es/utils/index.js +1 -1
- package/es/utils/index.js.map +1 -1
- package/lib/components/BreakLines/index.js +50 -37
- package/lib/components/BreakLines/index.js.map +7 -1
- package/lib/components/ConfigProvider/context.js +35 -6
- package/lib/components/ConfigProvider/context.js.map +7 -1
- package/lib/components/ConfigProvider/index.js +56 -42
- package/lib/components/ConfigProvider/index.js.map +7 -1
- package/lib/components/ConfirmAction/index.d.ts +74 -6
- package/lib/components/ConfirmAction/index.js +194 -138
- package/lib/components/ConfirmAction/index.js.map +7 -1
- package/lib/components/DeleteConfirmAction/index.js +50 -51
- package/lib/components/DeleteConfirmAction/index.js.map +7 -1
- package/lib/components/ModalAction/index.d.ts +45 -5
- package/lib/components/ModalAction/index.js +303 -243
- package/lib/components/ModalAction/index.js.map +7 -1
- package/lib/components/index.d.ts +5 -1
- package/lib/components/index.js +63 -10
- package/lib/components/index.js.map +7 -1
- package/lib/hooks/index.js +49 -5
- package/lib/hooks/index.js.map +7 -1
- package/lib/hooks/useContextValidator.js +47 -11
- package/lib/hooks/useContextValidator.js.map +7 -1
- package/lib/hooks/useLocalizedText.js +41 -15
- package/lib/hooks/useLocalizedText.js.map +7 -1
- package/lib/hooks/useRefFunction.js +34 -21
- package/lib/hooks/useRefFunction.js.map +7 -1
- package/lib/hooks/useT.js +43 -11
- package/lib/hooks/useT.js.map +7 -1
- package/lib/hooks/useValidator.js +41 -12
- package/lib/hooks/useValidator.js.map +7 -1
- package/lib/hooks/useValidatorBuilder.js +149 -132
- package/lib/hooks/useValidatorBuilder.js.map +7 -1
- package/lib/hooks/useValidators.js +104 -67
- package/lib/hooks/useValidators.js.map +7 -1
- package/lib/index.js +26 -3
- package/lib/index.js.map +7 -1
- package/lib/locales/index.js +58 -15
- package/lib/locales/index.js.map +7 -1
- package/lib/locales/langs/en-US.js +46 -22
- package/lib/locales/langs/en-US.js.map +7 -1
- package/lib/locales/langs/en.js +37 -3
- package/lib/locales/langs/en.js.map +7 -1
- package/lib/locales/langs/zh-CN.js +46 -22
- package/lib/locales/langs/zh-CN.js.map +7 -1
- package/lib/utils/index.js +1 -2
- package/lib/utils/index.js.map +7 -1
- package/package.json +14 -15
- package/es/hooks/useValidateContext.d.ts +0 -2
- package/es/hooks/useValidateContext.js +0 -16
- package/es/hooks/useValidateContext.js.map +0 -1
- package/lib/hooks/useValidateContext.d.ts +0 -2
- package/lib/hooks/useValidateContext.js +0 -16
- package/lib/hooks/useValidateContext.js.map +0 -1
|
@@ -8,7 +8,7 @@ import type { LinkProps } from 'antd/es/typography/Link';
|
|
|
8
8
|
* **CN:** 提交表单时不关闭弹框的Symbol,在编辑表单组件的`onSave`事件中返回时生效
|
|
9
9
|
*/
|
|
10
10
|
export declare const SubmitWithoutClosingSymbol: unique symbol;
|
|
11
|
-
export type ModalActionProps<FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object> = Omit<ModalProps, 'onOk'> & ModalActionTrigger<TP, E> & {
|
|
11
|
+
export type ModalActionProps<FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object> = Omit<ModalProps, 'onOk'> & ModalActionTrigger<FD, CP, TP, E> & {
|
|
12
12
|
/**
|
|
13
13
|
* **EN:** Form editing component, do not use the Form component inside the component, the form
|
|
14
14
|
* component and form instance are automatically created by the parent component
|
|
@@ -102,7 +102,7 @@ export interface FormCompPropsConstraint<FD> {
|
|
|
102
102
|
*/
|
|
103
103
|
triggerEventData?: any[];
|
|
104
104
|
}
|
|
105
|
-
export interface ModalActionTrigger<TP extends object, E extends keyof TP> {
|
|
105
|
+
export interface ModalActionTrigger<FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP> {
|
|
106
106
|
/**
|
|
107
107
|
* **EN:** Trigger component, click to show the dialog
|
|
108
108
|
*
|
|
@@ -114,7 +114,18 @@ export interface ModalActionTrigger<TP extends object, E extends keyof TP> {
|
|
|
114
114
|
*
|
|
115
115
|
* **CN:** 触发器组件的Props属性
|
|
116
116
|
*/
|
|
117
|
-
triggerProps?: TP
|
|
117
|
+
triggerProps?: TP & {
|
|
118
|
+
/**
|
|
119
|
+
* **EN:** Set a custom function to determine whether to show the trigger button
|
|
120
|
+
*
|
|
121
|
+
* **CN:** 设置一个自定义函数,用于判断是否显示触发器按钮
|
|
122
|
+
*
|
|
123
|
+
* @default true
|
|
124
|
+
*
|
|
125
|
+
* @param formProps Form component props | 表单组件的props
|
|
126
|
+
*/
|
|
127
|
+
show?: boolean | ((formProps?: Omit<CP, keyof FormCompPropsConstraint<FD>>) => boolean);
|
|
128
|
+
};
|
|
118
129
|
/**
|
|
119
130
|
* **EN:** The event name that triggers the dialog
|
|
120
131
|
*
|
|
@@ -149,7 +160,7 @@ export declare const genModalActionRenderer: (defaultProps: Partial<ModalActionP
|
|
|
149
160
|
* @param WrappedComponent ModalAction component | ModalAction组件
|
|
150
161
|
* @param defaultProps Default properties | 默认属性
|
|
151
162
|
*/
|
|
152
|
-
export declare const withDefaultModalActionProps: <FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object>(WrappedComponent: ComponentType<
|
|
163
|
+
export declare const withDefaultModalActionProps: <FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object>(WrappedComponent: ComponentType<Omit<ModalProps, "onOk"> & ModalActionTrigger<FD, CP, TP, E> & {
|
|
153
164
|
/**
|
|
154
165
|
* **EN:** Form editing component, do not use the Form component inside the component, the form
|
|
155
166
|
* component and form instance are automatically created by the parent component
|
|
@@ -177,7 +188,36 @@ export declare const withDefaultModalActionProps: <FD extends object, CP extends
|
|
|
177
188
|
*
|
|
178
189
|
* **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
|
|
179
190
|
*/
|
|
180
|
-
afterOk?: (data?: any) => void;
|
|
191
|
+
afterOk?: ((data?: any) => void) | undefined;
|
|
192
|
+
} & RefAttributes<ModalActionRef<CRef>>>, defaultProps?: Partial<ModalActionProps<FD, CP, TP, E, CRef>> | (() => Partial<ModalActionProps<FD, CP, TP, E, CRef>>) | undefined) => import("react").ForwardRefExoticComponent<Omit<ModalProps, "onOk"> & ModalActionTrigger<FD, CP, TP, E> & {
|
|
193
|
+
/**
|
|
194
|
+
* **EN:** Form editing component, do not use the Form component inside the component, the form
|
|
195
|
+
* component and form instance are automatically created by the parent component
|
|
196
|
+
*
|
|
197
|
+
* **CN:** 表单编辑组件,组件内部不要使用Form组件,表单组件及表单实例由父组件自动创建
|
|
198
|
+
*/
|
|
199
|
+
formComp: ComponentType<CP & RefAttributes<CRef>>;
|
|
200
|
+
/**
|
|
201
|
+
* **EN:** Props of the form editing component
|
|
202
|
+
*
|
|
203
|
+
* **CN:** 表单编辑组件的Props属性
|
|
204
|
+
*/
|
|
205
|
+
formProps?: Omit<CP, keyof FormCompPropsConstraint<FD_1>> | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* **EN:** The callback when clicks the confirmation button, support asynchronous saving, return
|
|
208
|
+
* `SubmitWithoutClosingSymbol` can prevent the dialog from closing, return other values will be
|
|
209
|
+
* passed to the `afterOk` event, if any
|
|
210
|
+
*
|
|
211
|
+
* **CN:** 点击确认按钮的回调,支持异步保存,返回`SubmitWithoutClosingSymbol`可以阻止弹框关闭,返回其他值会传递给`afterOk`事件,如果有的话
|
|
212
|
+
*/
|
|
213
|
+
onOk?: ((formData: FD, ...args: Parameters<TP[E]>) => unknown | Promise<unknown>) | undefined;
|
|
214
|
+
/**
|
|
215
|
+
* **EN:** The callback after the confirmation event is completed, it will not be triggered when
|
|
216
|
+
* it fails, the parameter is the return value of `onOk`
|
|
217
|
+
*
|
|
218
|
+
* **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
|
|
219
|
+
*/
|
|
220
|
+
afterOk?: ((data?: any) => void) | undefined;
|
|
181
221
|
} & RefAttributes<ModalActionRef<CRef>>>;
|
|
182
222
|
/**
|
|
183
223
|
* **EN:** ModalAction component type
|