@jswork/react-ant-form-schema 1.0.8 → 1.0.10
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/main.cjs.js +1 -1
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.d.mts +16 -3
- package/dist/main.d.ts +16 -3
- package/dist/main.esm.js +1 -1
- package/dist/main.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +4 -4
package/dist/main.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var d=Object.defineProperty;var n=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var i=(t,e,r)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a=(t,e)=>{for(var r in e||(e={}))A.call(e,r)&&i(t,r,e[r]);if(n)for(var r of n(e))N.call(e,r)&&i(t,r,e[r]);return t}
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var d=Object.defineProperty,g=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var n=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var i=(t,e,r)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a=(t,e)=>{for(var r in e||(e={}))A.call(e,r)&&i(t,r,e[r]);if(n)for(var r of n(e))N.call(e,r)&&i(t,r,e[r]);return t},h=(t,e)=>g(t,P(e)),y=(t,e)=>d(t,"name",{value:e,configurable:!0});var C=(t,e)=>{var r={};for(var o in t)A.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&n)for(var o of n(t))e.indexOf(o)<0&&N.call(t,o)&&(r[o]=t[o]);return r};var _classnames = require('classnames'); var _classnames2 = _interopRequireDefault(_classnames);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _antd = require('antd');var _niceformreact = require('@ebay/nice-form-react'); var _niceformreact2 = _interopRequireDefault(_niceformreact);function c(t,e){let r=a({},t);for(let o in e)e[o]&&typeof e[o]=="object"&&!Array.isArray(e[o])?r[o]=c(r[o]||{},e[o]):r[o]=e[o];return r}y(c,"deepMerge");var F="react-ant-form-schema",_={layout:"vertical",wrapperProps:{labelCol:{span:4}}},j={header:null,actionsClassName:""},k=_react2.default.forwardRef((t,e)=>{var p,f;let l=a(a({},j),t),{className:r,meta:o,header:w,children:x,actionsClassName:M}=l,R=C(l,["className","meta","header","children","actionsClassName"]),S=x,m=c(_,o),b=((f=(p=m==null?void 0:m.wrapperProps)==null?void 0:p.labelCol)==null?void 0:f.span)||4;return _react2.default.createElement(_antd.Form,h(a({"data-component":F,className:_classnames2.default.call(void 0, F,r)},R),{ref:e}),w,_react2.default.createElement(_niceformreact2.default,{meta:m}),_react2.default.createElement(_antd.Form.Item,{wrapperCol:{offset:b},className:M,style:{marginBottom:0}},S))}),u=k;var O=u;exports.default = O;
|
|
2
2
|
|
|
3
3
|
module.exports = exports.default;
|
|
4
4
|
//# sourceMappingURL=main.cjs.js.map
|
package/dist/main.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/ap7/github/react-ant-form-schema/packages/lib/dist/main.cjs.js","../src/index.tsx","../src/utils.ts","../src/main.tsx"],"names":["deepMerge","target","source","result","__spreadValues","key","Array","isArray","CLASS_NAME","DEFAULT_META","layout","wrapperProps","labelCol","span","defaultProps","header","actionsClassName","ReactAntdFormSchema","React","forwardRef","props","ref","_b","_c","_a","className","meta","children","rest","footerNode","_meta","_offset","Form","data-component","cx","NiceForm","Item","wrapperCol","offset","style","marginBottom","index_default","main_default"],"mappings":"AAAA,6KAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,qBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,SAAA,CAAA,cAAA,CAAA,CAAA,CAAA,
|
|
1
|
+
{"version":3,"sources":["/Users/ap7/github/react-ant-form-schema/packages/lib/dist/main.cjs.js","../src/index.tsx","../src/utils.ts","../src/main.tsx"],"names":["deepMerge","target","source","result","__spreadValues","key","Array","isArray","CLASS_NAME","DEFAULT_META","layout","wrapperProps","labelCol","span","defaultProps","header","actionsClassName","ReactAntdFormSchema","React","forwardRef","props","ref","_b","_c","_a","className","meta","children","rest","footerNode","_meta","_offset","Form","data-component","cx","NiceForm","Item","wrapperCol","offset","style","marginBottom","index_default","main_default"],"mappings":"AAAA,6KAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,CAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,yBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,qBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,SAAA,CAAA,cAAA,CAAA,CAAA,CAAA,MAAK,CAAC,SAAO,CAAA,oBAAuB,CAAC,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAiB,GAAA,CAAI,CAAC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,UAAC,CAAA,CAAA,CAAA,CAAA,YAAyB,CAAC,CAAA,CAAA,CAAA,QAAM,CAAM,CAAC,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAC,CAAA,CAAA,CAAA,CAAI,EAAE,CAAA,GAAA,CAAA,IAAO,EAAA,GAAA,CAAA,EAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAA,CAAc,CAAC,CAAC,CAAC,CAAA,EAAA,CAAA,CAAA,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B,CAAAA,CE1Df,IAAAyB,CAAAA,CAAezB,CAAAA,CAAAA,oBAAAA","file":"/Users/ap7/github/react-ant-form-schema/packages/lib/dist/main.cjs.js","sourcesContent":[null,"import cx from 'classnames';\nimport React, { ReactNode } from 'react';\nimport { Form, FormInstance, FormProps } from 'antd';\nimport NiceForm, { NiceFormMeta } from '@ebay/nice-form-react';\nimport { deepMerge } from './utils';\n\nconst CLASS_NAME = 'react-ant-form-schema';\nconst DEFAULT_META = {\n layout: 'vertical',\n wrapperProps: {\n labelCol: {\n span: 4,\n },\n },\n};\n\nexport type ReactAntdFormSchemaProps = {\n /**\n * The form schema meta data.\n */\n meta: NiceFormMeta;\n /**\n * The header content.\n */\n header?: ReactNode;\n /**\n * The form actions className.\n */\n actionsClassName?: string;\n} & FormProps;\n\nconst defaultProps: Partial<ReactAntdFormSchemaProps> = {\n header: null,\n actionsClassName: '',\n};\n\nconst ReactAntdFormSchema = React.forwardRef<FormInstance, ReactAntdFormSchemaProps>(\n (props, ref) => {\n const { className, meta, header, children, actionsClassName, ...rest } = {\n ...defaultProps,\n ...props,\n };\n const footerNode = children as ReactNode;\n const _meta = deepMerge(DEFAULT_META, meta) as NiceFormMeta;\n const _offset = _meta?.wrapperProps?.labelCol?.span || 4;\n\n return (\n <Form data-component={CLASS_NAME} className={cx(CLASS_NAME, className)} {...rest} ref={ref}>\n {header}\n <NiceForm meta={_meta} />\n <Form.Item\n wrapperCol={{ offset: _offset }}\n className={actionsClassName}\n style={{ marginBottom: 0 }}>\n {footerNode}\n </Form.Item>\n </Form>\n );\n }\n);\n\nexport default ReactAntdFormSchema;\n","/**\n * @Author: aric 1290657123@qq.com\n * @Date: 2025-10-18 21:20:55\n * @LastEditors: aric 1290657123@qq.com\n * @LastEditTime: 2025-10-22 08:55:52\n */\n\ntype AnyObject = { [key: string]: any };\n\nexport function deepMerge(target: AnyObject, source: AnyObject) {\n const result = { ...target };\n for (const key in source) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n result[key] = deepMerge(result[key] || {}, source[key]);\n } else {\n result[key] = source[key];\n }\n }\n return result;\n}\n","import ReactAntdFormSchema from '.';\nimport { ReactAntdFormSchemaProps } from '.';\n\nexport default ReactAntdFormSchema;\nexport type { ReactAntdFormSchemaProps };\n"]}
|
package/dist/main.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FormProps } from 'antd';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { FormProps, FormInstance } from 'antd';
|
|
3
3
|
import { NiceFormMeta } from '@ebay/nice-form-react';
|
|
4
4
|
|
|
5
5
|
type ReactAntdFormSchemaProps = {
|
|
@@ -16,6 +16,19 @@ type ReactAntdFormSchemaProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
actionsClassName?: string;
|
|
18
18
|
} & FormProps;
|
|
19
|
-
declare const ReactAntdFormSchema:
|
|
19
|
+
declare const ReactAntdFormSchema: React.ForwardRefExoticComponent<{
|
|
20
|
+
/**
|
|
21
|
+
* The form schema meta data.
|
|
22
|
+
*/
|
|
23
|
+
meta: NiceFormMeta;
|
|
24
|
+
/**
|
|
25
|
+
* The header content.
|
|
26
|
+
*/
|
|
27
|
+
header?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* The form actions className.
|
|
30
|
+
*/
|
|
31
|
+
actionsClassName?: string;
|
|
32
|
+
} & FormProps<any> & React.RefAttributes<FormInstance<any>>>;
|
|
20
33
|
|
|
21
34
|
export { type ReactAntdFormSchemaProps, ReactAntdFormSchema as default };
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FormProps } from 'antd';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { FormProps, FormInstance } from 'antd';
|
|
3
3
|
import { NiceFormMeta } from '@ebay/nice-form-react';
|
|
4
4
|
|
|
5
5
|
type ReactAntdFormSchemaProps = {
|
|
@@ -16,7 +16,20 @@ type ReactAntdFormSchemaProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
actionsClassName?: string;
|
|
18
18
|
} & FormProps;
|
|
19
|
-
declare const ReactAntdFormSchema:
|
|
19
|
+
declare const ReactAntdFormSchema: React.ForwardRefExoticComponent<{
|
|
20
|
+
/**
|
|
21
|
+
* The form schema meta data.
|
|
22
|
+
*/
|
|
23
|
+
meta: NiceFormMeta;
|
|
24
|
+
/**
|
|
25
|
+
* The header content.
|
|
26
|
+
*/
|
|
27
|
+
header?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* The form actions className.
|
|
30
|
+
*/
|
|
31
|
+
actionsClassName?: string;
|
|
32
|
+
} & FormProps<any> & React.RefAttributes<FormInstance<any>>>;
|
|
20
33
|
|
|
21
34
|
// @ts-ignore
|
|
22
35
|
export = ReactAntdFormSchema;
|
package/dist/main.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var d=Object.defineProperty;var n=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var i=(t,e,r)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a=(t,e)=>{for(var r in e||(e={}))A.call(e,r)&&i(t,r,e[r]);if(n)for(var r of n(e))N.call(e,r)&&i(t,r,e[r]);return t}
|
|
1
|
+
var d=Object.defineProperty,g=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var n=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var i=(t,e,r)=>e in t?d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,a=(t,e)=>{for(var r in e||(e={}))A.call(e,r)&&i(t,r,e[r]);if(n)for(var r of n(e))N.call(e,r)&&i(t,r,e[r]);return t},h=(t,e)=>g(t,P(e)),y=(t,e)=>d(t,"name",{value:e,configurable:!0});var C=(t,e)=>{var r={};for(var o in t)A.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(t!=null&&n)for(var o of n(t))e.indexOf(o)<0&&N.call(t,o)&&(r[o]=t[o]);return r};import L from"classnames";import s from"react";import{Form as E}from"antd";import T from"@ebay/nice-form-react";function c(t,e){let r=a({},t);for(let o in e)e[o]&&typeof e[o]=="object"&&!Array.isArray(e[o])?r[o]=c(r[o]||{},e[o]):r[o]=e[o];return r}y(c,"deepMerge");var F="react-ant-form-schema",_={layout:"vertical",wrapperProps:{labelCol:{span:4}}},j={header:null,actionsClassName:""},k=s.forwardRef((t,e)=>{var p,f;let l=a(a({},j),t),{className:r,meta:o,header:w,children:x,actionsClassName:M}=l,R=C(l,["className","meta","header","children","actionsClassName"]),S=x,m=c(_,o),b=((f=(p=m==null?void 0:m.wrapperProps)==null?void 0:p.labelCol)==null?void 0:f.span)||4;return s.createElement(E,h(a({"data-component":F,className:L(F,r)},R),{ref:e}),w,s.createElement(T,{meta:m}),s.createElement(E.Item,{wrapperCol:{offset:b},className:M,style:{marginBottom:0}},S))}),u=k;var O=u;export{O as default};
|
|
2
2
|
//# sourceMappingURL=main.esm.js.map
|
package/dist/main.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.tsx","../src/utils.ts","../src/main.tsx"],"sourcesContent":["import cx from 'classnames';\nimport React, {
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx","../src/utils.ts","../src/main.tsx"],"sourcesContent":["import cx from 'classnames';\nimport React, { ReactNode } from 'react';\nimport { Form, FormInstance, FormProps } from 'antd';\nimport NiceForm, { NiceFormMeta } from '@ebay/nice-form-react';\nimport { deepMerge } from './utils';\n\nconst CLASS_NAME = 'react-ant-form-schema';\nconst DEFAULT_META = {\n layout: 'vertical',\n wrapperProps: {\n labelCol: {\n span: 4,\n },\n },\n};\n\nexport type ReactAntdFormSchemaProps = {\n /**\n * The form schema meta data.\n */\n meta: NiceFormMeta;\n /**\n * The header content.\n */\n header?: ReactNode;\n /**\n * The form actions className.\n */\n actionsClassName?: string;\n} & FormProps;\n\nconst defaultProps: Partial<ReactAntdFormSchemaProps> = {\n header: null,\n actionsClassName: '',\n};\n\nconst ReactAntdFormSchema = React.forwardRef<FormInstance, ReactAntdFormSchemaProps>(\n (props, ref) => {\n const { className, meta, header, children, actionsClassName, ...rest } = {\n ...defaultProps,\n ...props,\n };\n const footerNode = children as ReactNode;\n const _meta = deepMerge(DEFAULT_META, meta) as NiceFormMeta;\n const _offset = _meta?.wrapperProps?.labelCol?.span || 4;\n\n return (\n <Form data-component={CLASS_NAME} className={cx(CLASS_NAME, className)} {...rest} ref={ref}>\n {header}\n <NiceForm meta={_meta} />\n <Form.Item\n wrapperCol={{ offset: _offset }}\n className={actionsClassName}\n style={{ marginBottom: 0 }}>\n {footerNode}\n </Form.Item>\n </Form>\n );\n }\n);\n\nexport default ReactAntdFormSchema;\n","/**\n * @Author: aric 1290657123@qq.com\n * @Date: 2025-10-18 21:20:55\n * @LastEditors: aric 1290657123@qq.com\n * @LastEditTime: 2025-10-22 08:55:52\n */\n\ntype AnyObject = { [key: string]: any };\n\nexport function deepMerge(target: AnyObject, source: AnyObject) {\n const result = { ...target };\n for (const key in source) {\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n result[key] = deepMerge(result[key] || {}, source[key]);\n } else {\n result[key] = source[key];\n }\n }\n return result;\n}\n","import ReactAntdFormSchema from '.';\nimport { ReactAntdFormSchemaProps } from '.';\n\nexport default ReactAntdFormSchema;\nexport type { ReactAntdFormSchemaProps };\n"],"mappings":"8nBAAA,OAAOA,MAAQ,aACf,OAAOC,MAA0B,QACjC,OAASC,QAAAA,MAAqC,OAC9C,OAAOC,MAAgC,wBCMhC,SAASC,EAAUC,EAAmBC,EAAiB,CAC5D,IAAMC,EAASC,EAAA,GAAKH,GACpB,QAAWI,KAAOH,EACZA,EAAOG,CAAAA,GAAQ,OAAOH,EAAOG,CAAAA,GAAS,UAAY,CAACC,MAAMC,QAAQL,EAAOG,CAAAA,CAAI,EAC9EF,EAAOE,CAAAA,EAAOL,EAAUG,EAAOE,CAAAA,GAAQ,CAAC,EAAGH,EAAOG,CAAAA,CAAI,EAEtDF,EAAOE,CAAAA,EAAOH,EAAOG,CAAAA,EAGzB,OAAOF,CACT,CAVgBH,EAAAA,EAAAA,aDHhB,IAAMQ,EAAa,wBACbC,EAAe,CACnBC,OAAQ,WACRC,aAAc,CACZC,SAAU,CACRC,KAAM,CACR,CACF,CACF,EAiBMC,EAAkD,CACtDC,OAAQ,KACRC,iBAAkB,EACpB,EAEMC,EAAsBC,EAAMC,WAChC,CAACC,EAAOC,IAAAA,CArCV,IAAAC,EAAAC,EAsCI,IAAyEC,EAAAC,IAAA,GACpEX,GACAM,GAFGM,WAAAA,EAAWC,KAAAA,EAAMZ,OAAAA,EAAQa,SAAAA,EAAUZ,iBAAAA,CAtC/C,EAsC6EQ,EAATK,EAAAA,EAASL,EAATK,CAAxDH,YAAWC,OAAMZ,SAAQa,WAAUZ,qBAIrCc,EAAaF,EACbG,EAAQC,EAAUvB,EAAckB,CAAAA,EAChCM,IAAUF,GAAAA,EAAAA,GAAAA,YAAAA,EAAOpB,eAAPoB,YAAAA,EAAqBnB,WAArBmB,YAAAA,EAA+BlB,OAAQ,EAEvD,OACEK,EAAA,cAACgB,EAAAA,EAAAA,EAAAA,CAAKC,iBAAgB3B,EAAYkB,UAAWU,EAAG5B,EAAYkB,CAAAA,GAAgBG,GAA3EK,CAAiFb,IAAKA,IACpFN,EACDG,EAAA,cAACmB,EAAAA,CAASV,KAAMI,IAChBb,EAAA,cAACgB,EAAKI,KAAI,CACRC,WAAY,CAAEC,OAAQP,CAAQ,EAC9BP,UAAWV,EACXyB,MAAO,CAAEC,aAAc,CAAE,GACxBZ,CAAAA,CAAAA,CAIT,CAAA,EAGFa,EAAe1B,EE1Df,IAAA2B,EAAeC","names":["cx","React","Form","NiceForm","deepMerge","target","source","result","__spreadValues","key","Array","isArray","CLASS_NAME","DEFAULT_META","layout","wrapperProps","labelCol","span","defaultProps","header","actionsClassName","ReactAntdFormSchema","React","forwardRef","props","ref","_b","_c","_a","__spreadValues","className","meta","children","rest","footerNode","_meta","deepMerge","_offset","Form","data-component","cx","NiceForm","Item","wrapperCol","offset","style","marginBottom","index_default","main_default","ReactAntdFormSchema"]}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cx from 'classnames';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
3
|
import { Form, FormInstance, FormProps } from 'antd';
|
|
4
4
|
import NiceForm, { NiceFormMeta } from '@ebay/nice-form-react';
|
|
5
5
|
import { deepMerge } from './utils';
|
|
@@ -34,8 +34,8 @@ const defaultProps: Partial<ReactAntdFormSchemaProps> = {
|
|
|
34
34
|
actionsClassName: '',
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
const ReactAntdFormSchema
|
|
38
|
-
(props, ref
|
|
37
|
+
const ReactAntdFormSchema = React.forwardRef<FormInstance, ReactAntdFormSchemaProps>(
|
|
38
|
+
(props, ref) => {
|
|
39
39
|
const { className, meta, header, children, actionsClassName, ...rest } = {
|
|
40
40
|
...defaultProps,
|
|
41
41
|
...props,
|
|
@@ -45,7 +45,7 @@ const ReactAntdFormSchema: FC<ReactAntdFormSchemaProps> = React.forwardRef(
|
|
|
45
45
|
const _offset = _meta?.wrapperProps?.labelCol?.span || 4;
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<Form data-component={CLASS_NAME} className={cx(CLASS_NAME, className)} ref={ref}
|
|
48
|
+
<Form data-component={CLASS_NAME} className={cx(CLASS_NAME, className)} {...rest} ref={ref}>
|
|
49
49
|
{header}
|
|
50
50
|
<NiceForm meta={_meta} />
|
|
51
51
|
<Form.Item
|