@event-chat/antd-item 0.3.17 → 0.3.20

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.
@@ -1,11 +1,11 @@
1
1
  import { Form as FormRaw } from 'antd';
2
2
  import { ComponentProps, RefObject } from 'react';
3
- import { ZodType } from 'zod';
3
+ import z from 'zod';
4
4
  import { FormInputProps } from './FormInput';
5
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;
6
+ declare const FormList: <Schema extends z.ZodArray | z.ZodOptional<z.ZodArray>>({ async, initialValue, item, name, rules, schema: sma, type, callback, children, debug, onChange, ...props }: FormListProps<Schema>) => import("react/jsx-runtime").JSX.Element | null;
7
7
  export default FormList;
8
- interface FormListProps<Schema extends ZodType> extends Omit<ComponentProps<typeof FormRaw.List>, 'name'>, FormInputProps<Schema> {
8
+ interface FormListProps<Schema extends z.ZodArray | z.ZodOptional<z.ZodArray>> extends Omit<ComponentProps<typeof FormRaw.List>, 'name'>, FormInputProps<Schema> {
9
9
  item?: RefObject<FormInputInstance>;
10
10
  }
11
11
  //# sourceMappingURL=FormList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormList.d.ts","sourceRoot":"","sources":["../src/FormList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,MAAM,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAW,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAC7B,OAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,iBAAiB,EAA+B,MAAM,SAAS,CAAA;AAKxE,QAAA,MAAM,QAAQ,GAAI,MAAM,SAAS,OAAO,EAAE,yGAavC,aAAa,CAAC,MAAM,CAAC,mDA8CvB,CAAA;AAED,eAAe,QAAQ,CAAA;AAEvB,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,CAAA;CACpC"}
1
+ {"version":3,"file":"FormList.d.ts","sourceRoot":"","sources":["../src/FormList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,MAAM,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAW,MAAM,OAAO,CAAA;AAC1D,OAAO,CAAC,MAAM,KAAK,CAAA;AACnB,OAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,iBAAiB,EAA+B,MAAM,SAAS,CAAA;AAKxE,QAAA,MAAM,QAAQ,GAAI,MAAM,SAAS,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,8GAatE,aAAa,CAAC,MAAM,CAAC,mDAgDvB,CAAA;AAED,eAAe,QAAQ,CAAA;AAEvB,UAAU,aAAa,CAAC,MAAM,SAAS,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAC3E,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,CAAA;CACpC"}
package/dist/FormList.js CHANGED
@@ -1,12 +1,16 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { checkDetail } from "@event-chat/core";
3
3
  import { useMemo } from "react";
4
+ import zod from "zod";
4
5
  import FormInput from "./FormInput.js";
5
6
  import { FormItemProvider } from "./FormProvider.js";
6
7
  import { useFormCom, useFormItemEmit } from "./utils.js";
7
8
  const isNamepath = (value)=>'string' == typeof value || Number.isInteger(value);
8
- const FormList = ({ async, initialValue, item, name, rules, schema, type, callback, children, debug, onChange, ...props })=>{
9
+ const FormList = ({ async, initialValue, item, name, rules, schema: sma, type, callback, children, debug, onChange, ...props })=>{
9
10
  const Form = useFormCom();
11
+ const schema = useMemo(()=>sma ?? zod.array(zod.unknown()), [
12
+ sma
13
+ ]);
10
14
  const fieldName = useMemo(()=>(Array.isArray(name) ? name.filter(isNamepath) : void 0) ?? (isNamepath(name) ? name : void 0), [
11
15
  name
12
16
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event-chat/antd-item",
3
- "version": "0.3.17",
3
+ "version": "0.3.20",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "storybook-react-rsbuild": "^3.1.0",
32
32
  "tsd": "^0.33.0",
33
33
  "typescript-eslint": "^8.48.0",
34
- "@event-chat/core": "0.2.14"
34
+ "@event-chat/core": "0.2.17"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@event-chat/core": "*",