@event-chat/antd-item 0.3.1 → 0.3.2
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/dist/FormContainer.d.ts +9 -0
- package/dist/FormContainer.d.ts.map +1 -0
- package/dist/FormContainer.js +29 -0
- package/dist/FormEvent.d.ts.map +1 -1
- package/dist/FormEvent.js +3 -11
- package/dist/FormInput.d.ts +9 -6
- package/dist/FormInput.d.ts.map +1 -1
- package/dist/FormInput.js +10 -8
- package/dist/FormItem.d.ts +6 -5
- package/dist/FormItem.d.ts.map +1 -1
- package/dist/FormItem.js +29 -22
- package/dist/FormList.d.ts +5 -5
- package/dist/FormList.d.ts.map +1 -1
- package/dist/FormList.js +9 -16
- package/dist/FormProvider.d.ts +10 -0
- package/dist/FormProvider.d.ts.map +1 -0
- package/dist/FormProvider.js +25 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/utils.d.ts +10 -7
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +16 -2
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { FormEventContextInstance } from './utils';
|
|
3
|
+
declare const FormContainer: FC<PropsWithChildren<FormContainerProps>>;
|
|
4
|
+
export default FormContainer;
|
|
5
|
+
interface FormContainerProps {
|
|
6
|
+
value?: unknown;
|
|
7
|
+
onChange?: (value: unknown, emit?: FormEventContextInstance['emit']) => void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=FormContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormContainer.d.ts","sourceRoot":"","sources":["../src/FormContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAa,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAA6C,MAAM,SAAS,CAAC;AAE9F,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAwB5D,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,wBAAwB,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;CAC9E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useFormCom, useFormEvent, useFormInstance } from "./utils.js";
|
|
4
|
+
const FormContainer = ({ children, value, onChange })=>{
|
|
5
|
+
const Form = useFormCom();
|
|
6
|
+
const form = useFormInstance();
|
|
7
|
+
const { focusField, ...formIns } = form;
|
|
8
|
+
const { emit } = useFormEvent();
|
|
9
|
+
useEffect(()=>{
|
|
10
|
+
form.setFieldValue('input', value);
|
|
11
|
+
}, [
|
|
12
|
+
form,
|
|
13
|
+
value
|
|
14
|
+
]);
|
|
15
|
+
return /*#__PURE__*/ jsx(Form, {
|
|
16
|
+
form: {
|
|
17
|
+
...formIns,
|
|
18
|
+
focusField: focusField ?? (()=>{})
|
|
19
|
+
},
|
|
20
|
+
component: false,
|
|
21
|
+
onValuesChange: ({ input })=>onChange?.(input, emit),
|
|
22
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
23
|
+
name: "input",
|
|
24
|
+
children: children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const src_FormContainer = FormContainer;
|
|
29
|
+
export { src_FormContainer as default };
|
package/dist/FormEvent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormEvent.d.ts","sourceRoot":"","sources":["../src/FormEvent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"FormEvent.d.ts","sourceRoot":"","sources":["../src/FormEvent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAuC,MAAM,SAAS,CAAC;AAwBjF,QAAA,MAAM,SAAS,GACb,IAAI,SAAS,MAAM,EACnB,KAAK,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EAC5C,UAAU,GAAG,OAAO,EACpB,2CAMC,iBAAiB,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,4CAwBvD,CAAC;AAEF,eAAe,SAAS,CAAC;AAGzB,UAAU,SAAS,CACjB,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,KAAK,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,EAC5C,UAAU,GAAG,OAAO,CACpB,SAAQ,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC9C,IAAI,CAAC,EAAE,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAClD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,IAAI,CAAC;CACb"}
|
package/dist/FormEvent.js
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
value: {
|
|
6
|
-
group,
|
|
7
|
-
name,
|
|
8
|
-
emit
|
|
9
|
-
},
|
|
10
|
-
children: children
|
|
11
|
-
});
|
|
12
|
-
const FormProvider = /*#__PURE__*/ memo(FormProviderInner);
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { FormProvider } from "./FormProvider.js";
|
|
4
|
+
import { getStringValue, useForm, useFormCom } from "./utils.js";
|
|
13
5
|
const FormInitialization = ({ children, form, group, name, ...props })=>{
|
|
14
6
|
const Form = useFormCom();
|
|
15
7
|
const [formInstance] = useForm({
|
package/dist/FormInput.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { EventChatOptions, NamepathType, useEventChat } from '@event-chat/core';
|
|
2
2
|
import { ForwardedRef } from 'react';
|
|
3
3
|
import { ZodType } from 'zod';
|
|
4
|
-
|
|
5
|
-
declare const
|
|
6
|
-
|
|
4
|
+
import { FormInputInstance } from './utils';
|
|
5
|
+
declare const InputInner: <Schema extends ZodType>({ name, callback, onChange, ...props }: FormInputProps<Schema>, ref?: ForwardedRef<FormInputInstance>) => null;
|
|
6
|
+
declare const FormInput: (<Schema extends ZodType>(props: FormInputProps<Schema> & {
|
|
7
|
+
ref?: ForwardedRef<FormInputInstance>;
|
|
7
8
|
}) => ReturnType<typeof InputInner>) & {
|
|
8
9
|
displayName?: string;
|
|
9
10
|
};
|
|
10
11
|
export default FormInput;
|
|
11
|
-
export interface FormInputProps<
|
|
12
|
-
name?:
|
|
13
|
-
|
|
12
|
+
export interface FormInputProps<Schema extends ZodType> extends Omit<OptionsType<Schema>, 'callback' | 'group'> {
|
|
13
|
+
name?: NamepathType;
|
|
14
|
+
callback?: (target: Parameters<NonNullable<OptionsType<Schema>['callback']>>[0], options: ReturnType<typeof useEventChat>) => void;
|
|
15
|
+
onChange?: (value: Parameters<NonNullable<OptionsType<Schema>['callback']>>[0]['detail'], options: ReturnType<typeof useEventChat>) => void;
|
|
14
16
|
}
|
|
17
|
+
type OptionsType<Schema extends ZodType> = EventChatOptions<NamepathType, Schema, string, string, undefined>;
|
|
15
18
|
//# sourceMappingURL=FormInput.d.ts.map
|
package/dist/FormInput.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormInput.d.ts","sourceRoot":"","sources":["../src/FormInput.tsx"],"names":[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AAQ,CAAC,EAAE,CACT,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAC5E,OAAO,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,KACrC,IAAI,CAAC;CACX;AAED,KAAK,WAAW,CAAC,MAAM,SAAS,OAAO,IAAI,gBAAgB,CACzD,YAAY,EACZ,MAAM,EACN,MAAM,EACN,MAAM,EACN,SAAS,CACV,CAAC"}
|
package/dist/FormInput.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { createToken, useEventChat } from "@event-chat/core";
|
|
3
|
-
import { forwardRef, useMemo } from "react";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useMemo } from "react";
|
|
4
3
|
import { useFormEvent } from "./utils.js";
|
|
5
4
|
const isDefined = (value)=>void 0 !== value;
|
|
6
5
|
const convertPath = (path)=>('object' == typeof path ? [
|
|
@@ -10,7 +9,7 @@ const convertPath = (path)=>('object' == typeof path ? [
|
|
|
10
9
|
]).filter(isDefined);
|
|
11
10
|
const InputInner = ({ name, callback, onChange, ...props }, ref)=>{
|
|
12
11
|
const { group, parent } = useFormEvent();
|
|
13
|
-
const
|
|
12
|
+
const fieldName = useMemo(()=>{
|
|
14
13
|
const itemName = convertPath(name);
|
|
15
14
|
const namePaths = convertPath(parent).concat(itemName);
|
|
16
15
|
return (0 === namePaths.length ? [
|
|
@@ -20,17 +19,20 @@ const InputInner = ({ name, callback, onChange, ...props }, ref)=>{
|
|
|
20
19
|
name,
|
|
21
20
|
parent
|
|
22
21
|
]);
|
|
23
|
-
const result = useEventChat(
|
|
22
|
+
const result = useEventChat(fieldName, {
|
|
24
23
|
...props,
|
|
25
24
|
callback: (record)=>{
|
|
26
|
-
callback?.(record);
|
|
25
|
+
callback?.(record, result);
|
|
27
26
|
onChange?.(record.detail, result);
|
|
28
27
|
},
|
|
29
28
|
group
|
|
30
29
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
useImperativeHandle(ref, ()=>({
|
|
31
|
+
emit: result.emit
|
|
32
|
+
}), [
|
|
33
|
+
result
|
|
34
|
+
]);
|
|
35
|
+
return null;
|
|
34
36
|
};
|
|
35
37
|
const FormInput = /*#__PURE__*/ forwardRef(InputInner);
|
|
36
38
|
if ('production' !== process.env.NODE_ENV) FormInput.displayName = 'FormInput';
|
package/dist/FormItem.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { NamepathType } from '@event-chat/core';
|
|
2
2
|
import { FormItemProps as FormItemRawProps } from 'antd';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
3
|
+
import { ReactNode, RefObject } from 'react';
|
|
4
4
|
import { ZodType } from 'zod';
|
|
5
5
|
import { FormInputProps } from './FormInput';
|
|
6
|
-
import { FormEventInstance } from './utils';
|
|
7
|
-
declare const FormItem: <
|
|
6
|
+
import { FormEventInstance, FormInputInstance } from './utils';
|
|
7
|
+
declare const FormItem: <Schema extends ZodType, ValueType = unknown>({ async, children, initialValue, item, name, rules, schema, type, callback, debug, onChange, transform, ...props }: FormItemProps<Schema, ValueType>) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default FormItem;
|
|
9
|
-
interface FormItemProps<
|
|
10
|
-
children?: ReactNode | ((form: FormEventInstance<
|
|
9
|
+
interface FormItemProps<Schema extends ZodType, ValueType = unknown> extends Omit<FormItemRawProps, 'children' | 'initialValue' | 'name'>, FormInputProps<Schema> {
|
|
10
|
+
children?: ReactNode | ((form: FormEventInstance<NamepathType, string | undefined, ValueType>) => ReactNode);
|
|
11
11
|
initialValue?: unknown;
|
|
12
|
+
item?: RefObject<FormInputInstance>;
|
|
12
13
|
transform?: (value: unknown) => unknown;
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=FormItem.d.ts.map
|
package/dist/FormItem.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormItem.d.ts","sourceRoot":"","sources":["../src/FormItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FormItem.d.ts","sourceRoot":"","sources":["../src/FormItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAIlB,MAAM,SAAS,CAAC;AAEjB,QAAA,MAAM,QAAQ,GAAI,MAAM,SAAS,OAAO,EAAE,SAAS,GAAG,OAAO,EAAE,oHAc5D,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,4CA4ClC,CAAC;AAEF,eAAe,QAAQ,CAAC;AAExB,UAAU,aAAa,CAAC,MAAM,SAAS,OAAO,EAAE,SAAS,GAAG,OAAO,CACjE,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,cAAc,GAAG,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC;IAC5F,QAAQ,CAAC,EACL,SAAS,GACT,CAAC,CAAC,IAAI,EAAE,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,CAAC,KAAK,SAAS,CAAC,CAAC;IAC1F,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CACzC"}
|
package/dist/FormItem.js
CHANGED
|
@@ -1,39 +1,46 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { checkDetail } from "@event-chat/core";
|
|
3
3
|
import FormInput from "./FormInput.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { FormItemProvider } from "./FormProvider.js";
|
|
5
|
+
import { useFormCom, useFormInstance, useFormItemEmit } from "./utils.js";
|
|
6
|
+
const FormItem = ({ async, children, initialValue, item, name, rules, schema, type, callback, debug, onChange, transform, ...props })=>{
|
|
7
|
+
const { group, name: formName } = useFormInstance();
|
|
8
|
+
const [inputRef, emit] = useFormItemEmit(item);
|
|
7
9
|
const Form = useFormCom();
|
|
8
10
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
9
11
|
children: [
|
|
10
|
-
/*#__PURE__*/ jsx(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
/*#__PURE__*/ jsx(FormItemProvider, {
|
|
13
|
+
emit: emit,
|
|
14
|
+
children: /*#__PURE__*/ jsx(Form.Item, {
|
|
15
|
+
...props,
|
|
16
|
+
initialValue: initialValue,
|
|
17
|
+
name: name,
|
|
18
|
+
rules: schema ? (rules ?? []).concat([
|
|
19
|
+
{
|
|
20
|
+
validator: (_, value)=>checkDetail(value, {
|
|
21
|
+
async,
|
|
22
|
+
schema
|
|
23
|
+
}),
|
|
24
|
+
transform
|
|
25
|
+
}
|
|
26
|
+
]) : rules,
|
|
27
|
+
children: 'function' == typeof children ? (form)=>children({
|
|
28
|
+
...form,
|
|
29
|
+
name: formName,
|
|
30
|
+
group,
|
|
31
|
+
emit
|
|
32
|
+
}) : children
|
|
33
|
+
})
|
|
29
34
|
}),
|
|
30
35
|
void 0 !== name && /*#__PURE__*/ jsx(Form.Item, {
|
|
31
36
|
...props,
|
|
32
37
|
name: name,
|
|
38
|
+
rules: rules,
|
|
33
39
|
hidden: true,
|
|
34
40
|
children: /*#__PURE__*/ jsx(FormInput, {
|
|
35
41
|
async: async,
|
|
36
42
|
name: name,
|
|
43
|
+
ref: inputRef,
|
|
37
44
|
schema: schema,
|
|
38
45
|
type: type,
|
|
39
46
|
callback: callback,
|
package/dist/FormList.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { NamepathType } from '@event-chat/core';
|
|
2
1
|
import { Form as FormRaw } from 'antd';
|
|
3
|
-
import { ComponentProps } from 'react';
|
|
2
|
+
import { ComponentProps, RefObject } from 'react';
|
|
4
3
|
import { ZodType } from 'zod';
|
|
5
4
|
import { FormInputProps } from './FormInput';
|
|
6
|
-
|
|
5
|
+
import { FormInputInstance } from './utils';
|
|
6
|
+
declare const FormList: <Schema extends ZodType>({ async, initialValue, item, name, rules, schema, type, callback, children, debug, onChange, ...props }: FormListProps<Schema>) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
7
|
export default FormList;
|
|
8
|
-
interface FormListProps<
|
|
9
|
-
|
|
8
|
+
interface FormListProps<Schema extends ZodType> extends Omit<ComponentProps<typeof FormRaw.List>, 'name'>, FormInputProps<Schema> {
|
|
9
|
+
item?: RefObject<FormInputInstance>;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=FormList.d.ts.map
|
package/dist/FormList.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormList.d.ts","sourceRoot":"","sources":["../src/FormList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormList.d.ts","sourceRoot":"","sources":["../src/FormList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAA+B,MAAM,SAAS,CAAC;AAKzE,QAAA,MAAM,QAAQ,GAAI,MAAM,SAAS,OAAO,EAAE,yGAavC,aAAa,CAAC,MAAM,CAAC,mDA8CvB,CAAC;AAEF,eAAe,QAAQ,CAAC;AAExB,UAAU,aAAa,CAAC,MAAM,SAAS,OAAO,CAC5C,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC;IACjF,IAAI,CAAC,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;CACrC"}
|
package/dist/FormList.js
CHANGED
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { checkDetail } from "@event-chat/core";
|
|
3
|
-
import {
|
|
3
|
+
import { useMemo } from "react";
|
|
4
4
|
import FormInput from "./FormInput.js";
|
|
5
|
-
import {
|
|
5
|
+
import { FormItemProvider } from "./FormProvider.js";
|
|
6
|
+
import { useFormCom, useFormItemEmit } from "./utils.js";
|
|
6
7
|
const isNamepath = (value)=>'string' == typeof value || Number.isInteger(value);
|
|
7
|
-
const
|
|
8
|
-
const record = useFormEvent();
|
|
9
|
-
return /*#__PURE__*/ jsx(FormEventContext.Provider, {
|
|
10
|
-
value: {
|
|
11
|
-
...record,
|
|
12
|
-
parent
|
|
13
|
-
},
|
|
14
|
-
children: children
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
const ListItem = /*#__PURE__*/ memo(FormListInner);
|
|
18
|
-
const FormList = ({ async, initialValue, name, rules, schema, type, callback, children, debug, onChange, ...props })=>{
|
|
8
|
+
const FormList = ({ async, initialValue, item, name, rules, schema, type, callback, children, debug, onChange, ...props })=>{
|
|
19
9
|
const Form = useFormCom();
|
|
20
10
|
const fieldName = useMemo(()=>(Array.isArray(name) ? name.filter(isNamepath) : void 0) ?? (isNamepath(name) ? name : void 0), [
|
|
21
11
|
name
|
|
22
12
|
]);
|
|
13
|
+
const [inputRef, emit] = useFormItemEmit(item);
|
|
23
14
|
return fieldName ? /*#__PURE__*/ jsxs(Fragment, {
|
|
24
15
|
children: [
|
|
25
16
|
/*#__PURE__*/ jsx(Form.List, {
|
|
@@ -34,8 +25,9 @@ const FormList = ({ async, initialValue, name, rules, schema, type, callback, ch
|
|
|
34
25
|
})
|
|
35
26
|
}
|
|
36
27
|
]) : rules,
|
|
37
|
-
children: (fields, options, metas)=>/*#__PURE__*/ jsx(
|
|
38
|
-
|
|
28
|
+
children: (fields, options, metas)=>/*#__PURE__*/ jsx(FormItemProvider, {
|
|
29
|
+
parent: name,
|
|
30
|
+
emit: emit,
|
|
39
31
|
children: children(fields, options, metas)
|
|
40
32
|
})
|
|
41
33
|
}),
|
|
@@ -46,6 +38,7 @@ const FormList = ({ async, initialValue, name, rules, schema, type, callback, ch
|
|
|
46
38
|
children: /*#__PURE__*/ jsx(FormInput, {
|
|
47
39
|
async: async,
|
|
48
40
|
name: fieldName,
|
|
41
|
+
ref: inputRef,
|
|
49
42
|
schema: schema,
|
|
50
43
|
type: type,
|
|
51
44
|
callback: callback,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NamepathType } from '@event-chat/core';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import { FormEventContextInstance, FormInputInstance } from './utils';
|
|
4
|
+
interface FormItemProviderProps extends Pick<FormInputInstance, 'emit'> {
|
|
5
|
+
parent?: NamepathType;
|
|
6
|
+
}
|
|
7
|
+
declare const FormProvider: import("react").NamedExoticComponent<PropsWithChildren<FormEventContextInstance>>;
|
|
8
|
+
declare const FormItemProvider: import("react").NamedExoticComponent<PropsWithChildren<FormItemProviderProps>>;
|
|
9
|
+
export { FormItemProvider, FormProvider };
|
|
10
|
+
//# sourceMappingURL=FormProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormProvider.d.ts","sourceRoot":"","sources":["../src/FormProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAM,iBAAiB,EAAQ,MAAM,OAAO,CAAC;AACpD,OAAO,EAEL,wBAAwB,EACxB,iBAAiB,EAElB,MAAM,SAAS,CAAC;AAwBjB,UAAU,qBAAsB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACrE,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,QAAA,MAAM,YAAY,mFAA0B,CAAC;AAC7C,QAAA,MAAM,gBAAgB,gFAA8B,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { FormEventContext, useFormEvent } from "./utils.js";
|
|
4
|
+
const FormProviderInner = ({ children, group, name, emit })=>/*#__PURE__*/ jsx(FormEventContext.Provider, {
|
|
5
|
+
value: {
|
|
6
|
+
group,
|
|
7
|
+
name,
|
|
8
|
+
emit
|
|
9
|
+
},
|
|
10
|
+
children: children
|
|
11
|
+
});
|
|
12
|
+
const FormItemProviderInner = ({ children, parent, emit })=>{
|
|
13
|
+
const record = useFormEvent();
|
|
14
|
+
return /*#__PURE__*/ jsx(FormEventContext.Provider, {
|
|
15
|
+
value: {
|
|
16
|
+
...record,
|
|
17
|
+
parent,
|
|
18
|
+
emit
|
|
19
|
+
},
|
|
20
|
+
children: children
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const FormProvider = /*#__PURE__*/ memo(FormProviderInner);
|
|
24
|
+
const FormItemProvider = /*#__PURE__*/ memo(FormItemProviderInner);
|
|
25
|
+
export { FormItemProvider, FormProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import FormContainer from './FormContainer';
|
|
1
2
|
import FormEventInner from './FormEvent';
|
|
2
3
|
import FormItem from './FormItem';
|
|
3
4
|
import FormList from './FormList';
|
|
@@ -7,6 +8,7 @@ declare const FormEvent: typeof FormEventInner & FormExtraInstance;
|
|
|
7
8
|
export * from './utils';
|
|
8
9
|
export default FormEvent;
|
|
9
10
|
interface FormExtraInstance {
|
|
11
|
+
Container: typeof FormContainer;
|
|
10
12
|
Item: typeof FormItem;
|
|
11
13
|
List: typeof FormList;
|
|
12
14
|
observer: typeof observer;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,aAAa,CAAC;AACzC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAW,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE9E,QAAA,MAAM,QAAQ,GAAI,SAAS,gBAAgB,KAAG,IAE7C,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,OAAO,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,cAAc,MAAM,aAAa,CAAC;AACzC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAW,gBAAgB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE9E,QAAA,MAAM,QAAQ,GAAI,SAAS,gBAAgB,KAAG,IAE7C,CAAC;AAEF,QAAA,MAAM,SAAS,EAAE,OAAO,cAAc,GAAG,iBAOvC,CAAC;AAEH,cAAc,SAAS,CAAC;AACxB,eAAe,SAAS,CAAC;AAEzB,UAAU,iBAAiB;IACzB,SAAS,EAAE,OAAO,aAAa,CAAC;IAChC,IAAI,EAAE,OAAO,QAAQ,CAAC;IACtB,IAAI,EAAE,OAAO,QAAQ,CAAC;IACtB,QAAQ,EAAE,OAAO,QAAQ,CAAC;IAC1B,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,eAAe,CAAC;CACzC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import FormContainer from "./FormContainer.js";
|
|
1
2
|
import FormEvent from "./FormEvent.js";
|
|
2
3
|
import FormItem from "./FormItem.js";
|
|
3
4
|
import FormList from "./FormList.js";
|
|
@@ -7,6 +8,7 @@ const observer = (FormCom)=>{
|
|
|
7
8
|
AntdCom.form = FormCom;
|
|
8
9
|
};
|
|
9
10
|
const src_FormEvent = Object.assign(FormEvent, {
|
|
11
|
+
Container: FormContainer,
|
|
10
12
|
Item: FormItem,
|
|
11
13
|
List: FormList,
|
|
12
14
|
observer,
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventDetailType, NamepathType } from '@event-chat/core';
|
|
1
|
+
import { EventDetailType, ExcludeKey, NamepathType } from '@event-chat/core';
|
|
2
2
|
import { Form, FormItemProps } from 'antd';
|
|
3
|
-
import { ComponentProps, FC, ReactNode } from 'react';
|
|
3
|
+
import { ComponentProps, FC, ReactNode, RefObject } from 'react';
|
|
4
4
|
export declare const AntdCom: {
|
|
5
5
|
form?: FormBaseInstance;
|
|
6
6
|
};
|
|
@@ -9,25 +9,28 @@ export declare const getStringValue: <T extends NamepathType | undefined>(values
|
|
|
9
9
|
export declare const useForm: <Name extends string, Group extends string | undefined = undefined, ValueType = unknown>(options?: FormOptions<Name, Group>, formInit?: FormEventInstance<Name, Group, ValueType>) => readonly [import("antd").FormInstance<ValueType> & {
|
|
10
10
|
group: Group | undefined;
|
|
11
11
|
name: string;
|
|
12
|
-
emit: <Detail, CustomName extends NamepathType>(detail: Omit<EventDetailType<Detail, CustomName>,
|
|
12
|
+
emit: <Detail, CustomName extends NamepathType>(detail: Omit<EventDetailType<Detail, CustomName>, ExcludeKey>) => void;
|
|
13
13
|
}];
|
|
14
14
|
export declare const useFormInstance: <ValueType>() => Omit<import("antd").FormInstance<ValueType>, "focusField"> & {
|
|
15
15
|
focusField?: NonNullable<ComponentProps<typeof Form>["form"]>["focusField"];
|
|
16
16
|
} & {
|
|
17
17
|
group: string | undefined;
|
|
18
18
|
name: NamepathType | undefined;
|
|
19
|
-
emit: (<Detail, CustomName extends NamepathType>(record: Omit<EventDetailType<Detail, CustomName>,
|
|
19
|
+
emit: (<Detail, CustomName extends NamepathType>(record: Omit<EventDetailType<Detail, CustomName>, ExcludeKey>) => void) | undefined;
|
|
20
20
|
};
|
|
21
21
|
export declare const useFormCom: <ValueType = unknown>() => FormBaseInstance<ValueType>;
|
|
22
22
|
export declare const useFormEvent: () => FormEventContextInstance;
|
|
23
|
+
export declare const useFormItemEmit: (item?: RefObject<FormInputInstance>) => readonly [RefObject<FormInputInstance>, <Detail, CustomName extends NamepathType>(record: Omit<EventDetailType<Detail, CustomName>, ExcludeKey>) => void];
|
|
23
24
|
export interface FormEventContextInstance {
|
|
24
25
|
group?: string;
|
|
25
26
|
name?: NamepathType;
|
|
26
27
|
parent?: NamepathType;
|
|
27
|
-
emit?: <Detail, CustomName extends NamepathType>(record: Omit<EventDetailType<Detail, CustomName>,
|
|
28
|
+
emit?: <Detail, CustomName extends NamepathType>(record: Omit<EventDetailType<Detail, CustomName>, ExcludeKey>) => void;
|
|
28
29
|
}
|
|
29
30
|
export interface FormEventInstance<Name extends NamepathType, Group extends string | undefined = undefined, ValueType = unknown> extends FormInsType<ValueType>, FormOptions<Name, Group> {
|
|
30
|
-
emit?: <Detail, CustomName extends NamepathType>(record: Omit<EventDetailType<Detail, CustomName>,
|
|
31
|
+
emit?: <Detail, CustomName extends NamepathType>(record: Omit<EventDetailType<Detail, CustomName>, ExcludeKey>) => void;
|
|
32
|
+
}
|
|
33
|
+
export interface FormInputInstance extends Required<Pick<FormEventContextInstance, 'emit'>> {
|
|
31
34
|
}
|
|
32
35
|
export type FormBaseInstance<ValueType = unknown> = FormType<ValueType> & {
|
|
33
36
|
Item: FC<Pick<FormItemProps, 'hidden' | 'initialValue' | 'name' | 'rules'> & {
|
|
@@ -43,6 +46,6 @@ type FormOptions<Name extends NamepathType, Group extends string | undefined = u
|
|
|
43
46
|
group?: Group;
|
|
44
47
|
name?: Name;
|
|
45
48
|
};
|
|
46
|
-
type FormType<ValueType = unknown> = (props: Pick<ComponentProps<typeof Form<ValueType>>, 'children' | 'form' | 'name'> & React.RefAttributes<FormInsType<ValueType>>) => React.ReactElement;
|
|
49
|
+
type FormType<ValueType = unknown> = (props: Pick<ComponentProps<typeof Form<ValueType>>, 'children' | 'component' | 'form' | 'name' | 'onValuesChange'> & React.RefAttributes<FormInsType<ValueType>>) => React.ReactElement;
|
|
47
50
|
export {};
|
|
48
51
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,YAAY,EAGb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,MAAM,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C;CAClD,CAAC;AAGF,MAAM,MAAM,WAAW,CAAC,SAAS,GAAG,OAAO,IAAI,IAAI,CACjD,WAAW,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAC3D,YAAY,CACb,GAAG;IACF,UAAU,CAAC,EAAE,WAAW,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;CAC7E,CAAC;AAEF,KAAK,WAAW,CAAC,IAAI,SAAS,YAAY,EAAE,KAAK,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,IAAI;IAC1F,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,KAAK,QAAQ,CAAC,SAAS,GAAG,OAAO,IAAI,CACnC,KAAK,EAAE,IAAI,CACT,cAAc,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EACtC,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,gBAAgB,CAC9D,GACC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,KAC1C,KAAK,CAAC,YAAY,CAAC"}
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createToken, useEventChat } from "@event-chat/core";
|
|
2
2
|
import { Form } from "antd";
|
|
3
|
-
import { createContext, useContext, useMemo } from "react";
|
|
3
|
+
import { createContext, useCallback, useContext, useMemo, useRef } from "react";
|
|
4
4
|
import zod from "zod";
|
|
5
5
|
const AntdCom = {};
|
|
6
6
|
const FormEventContext = createContext({});
|
|
@@ -72,4 +72,18 @@ const useFormEvent = ()=>{
|
|
|
72
72
|
const record = useContext(FormEventContext);
|
|
73
73
|
return record;
|
|
74
74
|
};
|
|
75
|
-
|
|
75
|
+
const useFormItemEmit = (item)=>{
|
|
76
|
+
const itemRef = useRef(null);
|
|
77
|
+
const emit = useCallback((detail)=>{
|
|
78
|
+
const inputRef = item ?? itemRef;
|
|
79
|
+
inputRef.current?.emit(detail);
|
|
80
|
+
}, [
|
|
81
|
+
item,
|
|
82
|
+
itemRef
|
|
83
|
+
]);
|
|
84
|
+
return [
|
|
85
|
+
item ?? itemRef,
|
|
86
|
+
emit
|
|
87
|
+
];
|
|
88
|
+
};
|
|
89
|
+
export { AntdCom, FormEventContext, getStringValue, useForm, useFormCom, useFormEvent, useFormInstance, useFormItemEmit };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event-chat/antd-item",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"storybook-react-rsbuild": "^3.1.0",
|
|
30
30
|
"tsd": "^0.33.0",
|
|
31
31
|
"typescript-eslint": "^8.48.0",
|
|
32
|
-
"@event-chat/core": "0.2.
|
|
32
|
+
"@event-chat/core": "0.2.6"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@event-chat/core": "*",
|