@flatbiz/antd 4.2.9 → 4.2.11

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.
File without changes
@@ -0,0 +1,5 @@
1
+ /* eslint-disable */
2
+ import './index.css';
3
+ /*! @flatjs/forge MIT @flatbiz/antd */
4
+ import{_ as e,a}from"../_rollupPluginBabelHelpers-1f4d8910.js";import{hooks as r}from"@wove/react/cjs/hooks";import{isUndefinedOrNull as o}from"@flatbiz/utils";import{Checkbox as l}from"antd";import{jsx as n}from"react/jsx-runtime";var t=["checkedValue","unCheckedValue","onChange","value"];var u=function u(c){var i=c.checkedValue,m=c.unCheckedValue,h=c.onChange,f=c.value,s=e(c,t);var v=r.useCallbackRef((function(e){var a=e.target.checked;h==null?void 0:h(a?i:m)}));return n(l,a({},s,{checked:!o(f)&&i===f,onChange:v}))};export{u as CheckboxWrapper};
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/checkbox-wrapper/checkbox-wrapper.tsx"],"sourcesContent":["import { isUndefinedOrNull } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Checkbox, CheckboxProps } from 'antd';\n\nexport type CheckboxWrapperProps = Omit<CheckboxProps, 'checked' | 'defaultChecked' | 'onChange'> & {\n value?: string | number | boolean;\n checkedValue: string | number | boolean;\n unCheckedValue: string | number | boolean;\n onChange?: (value: string | number | boolean) => void;\n};\n/**\n * 解决 Checkbox 只能接收boolean的限制,与Form.Item结合使用最佳\n * ```\n * 1. value 为状态值,不局限于boolean,可以为 [string | number | boolean]\n * 2. checkedValue 选中值\n * 3. unCheckedValue 未选中值\n * 4. 与 Form.Item 结合使用,不再需要配置 valuePropName\n * <Form.Item name=\"fieldName\">\n * <CheckboxWrapper checkedValue={2} unCheckedValue={1} />\n * </Form.Item>\n * ```\n */\nexport const CheckboxWrapper = (props: CheckboxWrapperProps) => {\n const { checkedValue, unCheckedValue, onChange, value, ...otherProps } = props;\n const onChangeHandle = hooks.useCallbackRef((event) => {\n const checked = event.target.checked;\n onChange?.(checked ? checkedValue : unCheckedValue);\n });\n\n return (\n <Checkbox\n {...otherProps}\n checked={!isUndefinedOrNull(value) && checkedValue === value}\n onChange={onChangeHandle}\n />\n );\n};\n"],"names":["CheckboxWrapper","props","checkedValue","unCheckedValue","onChange","value","otherProps","_objectWithoutPropertiesLoose","_excluded","onChangeHandle","_hooks","useCallbackRef","event","checked","target","_jsx","Checkbox","_extends","isUndefinedOrNull"],"mappings":";uSAsBaA,EAAkB,SAAlBA,EAAmBC,GAC9B,IAAQC,EAAiED,EAAjEC,aAAcC,EAAmDF,EAAnDE,eAAgBC,EAAmCH,EAAnCG,SAAUC,EAAyBJ,EAAzBI,MAAUC,EAAUC,EAAKN,EAAKO,GAC9E,IAAMC,EAAiBC,EAAMC,gBAAe,SAACC,GAC3C,IAAMC,EAAUD,EAAME,OAAOD,QAC7BT,GAAQ,UAAA,EAARA,EAAWS,EAAUX,EAAeC,EACtC,IAEA,OACEY,EAACC,EAAQC,KACHX,EAAU,CACdO,SAAUK,EAAkBb,IAAUH,IAAiBG,EACvDD,SAAUK,IAGhB"}
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
2
  import './index.css';
3
3
  /*! @flatjs/forge MIT @flatbiz/antd */
4
- import{Editor as e}from"@wove/react/cjs/editor";import{a as t}from"../_rollupPluginBabelHelpers-1f4d8910.js";import{hooks as i}from"@wove/react/cjs/hooks";import{jsx as r}from"react/jsx-runtime";var a=function a(l){var n=i.useCallbackRef((function(e,t){var i=t.getContent();var r=i?i:undefined;l.onChange==null?void 0:l.onChange(r)}));return r("div",{className:"v-editor-wrapper",children:r(e,t({value:l.value,cdnTinyMce:"https://file.40017.cn/tcsk/tinymce/tinymce.min.js",init:t({height:l.height||300,menubar:true,language:"zh_CN",paste_retain_style_properties:"all",table_default_styles:{width:"100%"},plugins:"advlist lists image charmap preview visualblocks code hr print media table paste help template fullscreen",toolbar:["undo redo fullscreen preview","formatselect bold italic backcolor bullist numlist","outdent indent alignleft aligncenter alignright alignjustify","textmark untextmark code preview","template link image help"].join("|"),fontsize_formats:"8px 10px 12px 14px 16px 18px 24px 36px 48px",autoresize_bottom_margin:50},l.editorInitParams)},l.editorProps,{onEditorChange:n}))})};export{a as EditorWrapper};
4
+ import{Editor as e}from"@wove/react/cjs/editor";import{a as t}from"../_rollupPluginBabelHelpers-1f4d8910.js";import{hooks as r}from"@wove/react/cjs/hooks";import{useKeyPress as n}from"ahooks";import{useRef as a}from"react";import{jsx as o}from"react/jsx-runtime";var i=function i(l){var c=a(null);var u=r.useCallbackRef((function(e,t){var r=t.getContent();var n=r?r:undefined;l.onChange==null?void 0:l.onChange(n)}));var s=r.useCallbackRef((function(e,t,r){return new Promise((function(n,a){var o;var i=function(){try{return n()}catch(e){return a(e)}};var c=function(e){try{r(e.message);return i()}catch(e){return a(e)}};try{return Promise.resolve(l.onUploadImage==null?void 0:l.onUploadImage(e.blob())).then((function(e){try{o=e;t(o);return i()}catch(e){return c(e)}}),c)}catch(e){c(e)}}))}));n((function(){return true}),(function(e){try{if(e.type==="keyup"&&e.key==="Escape"){var t;var r=(t=c.current)==null?void 0:t.editorContainer.classList.contains("tox-fullscreen");if(r){var n;(n=c.current)==null?void 0:n.editorCommands.execCommand("mceFullScreen")}}}catch(e){}}),{events:["keydown","keyup"]});return o("div",{className:"v-editor-wrapper",children:o(e,t({value:l.value,cdnTinyMce:"https://file.40017.cn/tcsk/tinymce/tinymce.min.js",init:t({paste_data_images:!!l.onUploadImage,images_upload_handler:s,height:l.height||300,menubar:true,language:"zh_CN",paste_retain_style_properties:"all",table_default_styles:{width:"100%"},plugins:"advlist lists image charmap preview visualblocks code hr print media table paste help template fullscreen",toolbar:["undo redo fullscreen preview","formatselect bold italic backcolor bullist numlist","outdent indent alignleft aligncenter alignright alignjustify","textmark untextmark code preview","template link image help"].join("|"),fontsize_formats:"8px 10px 12px 14px 16px 18px 24px 36px 48px",autoresize_bottom_margin:50},l.editorInitParams,{setup:function e(t){var r;c.current=t;(r=l.editorInitParams)==null?void 0:r.setup(t)}})},l.editorProps,{onKeyDown:function e(t){var r;try{if(t.keyCode==27){var n;var a=(n=c.current)==null?void 0:n.editorContainer.classList.contains("tox-fullscreen");if(a){var o;(o=c.current)==null?void 0:o.editorCommands.execCommand("mceFullScreen")}}}catch(e){}(r=l.editorProps)==null?void 0:r.onKeyDown(t)},onEditorChange:u}))})};export{i as EditorWrapper};
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/editor-wrapper/editor-wrapper.tsx"],"sourcesContent":["import { TPlainObject } from '@flatbiz/utils';\nimport { Editor, hooks } from '@wove/react';\nimport { CSSProperties } from 'react';\nimport './style.less';\nimport { varStyles } from './types';\n\nexport type EditorWrapperProps = {\n onChange?: (data?: string) => void;\n value?: string;\n editorInitParams?: TPlainObject;\n editorProps?: TPlainObject;\n varStyle?: Record<varStyles, CSSProperties['color']>;\n height?: number | string;\n};\n\n/**\n * 富文本编辑器,配置参考tinymce\n * @param props\n * @returns\n */\nexport const EditorWrapper = (props: EditorWrapperProps) => {\n const onChange = hooks.useCallbackRef((_, editor) => {\n const content = editor.getContent();\n const respValue = content ? content : undefined;\n props.onChange?.(respValue);\n });\n\n // const varStyleString = useMemo(() => {\n // const merge = { ...defaultVarStyle, ...props.varStyle };\n // let varStyleString = '';\n // Object.keys(merge).map((key) => {\n // varStyleString += `${key}:${merge[key]};`;\n // });\n // return varStyleString;\n // }, [props.varStyle]);\n\n return (\n <div className=\"v-editor-wrapper\">\n <Editor\n value={props.value}\n cdnTinyMce=\"https://file.40017.cn/tcsk/tinymce/tinymce.min.js\"\n init={{\n height: props.height || 300,\n menubar: true,\n language: 'zh_CN',\n paste_retain_style_properties: 'all',\n table_default_styles: {\n width: '100%',\n },\n plugins:\n 'advlist lists image charmap preview visualblocks code hr print media table paste help template fullscreen',\n toolbar: [\n 'undo redo fullscreen preview',\n 'formatselect bold italic backcolor bullist numlist',\n 'outdent indent alignleft aligncenter alignright alignjustify',\n 'textmark untextmark code preview',\n 'template link image help',\n ].join('|'),\n fontsize_formats: '8px 10px 12px 14px 16px 18px 24px 36px 48px',\n autoresize_bottom_margin: 50,\n // templates: [\n // editorTemplates.block,\n // editorTemplates.primary_p,\n // editorTemplates.secondary_p,\n // editorTemplates.warning_p,\n // editorTemplates.danger_p,\n // editorTemplates.success_p,\n // editorTemplates.p,\n // ],\n // template_replace_values: {\n // varStyle: varStyleString,\n // },\n // template_preview_replace_values: {\n // varStyle: varStyleString,\n // },\n ...props.editorInitParams,\n }}\n {...props.editorProps}\n onEditorChange={onChange}\n />\n </div>\n );\n};\n\n/**\n * undo redo\n * codesample\n * fontselect fontsizeselect formatselect\n * image media link anchor\n * preview save print\n * emoticons(表情)\n */\n"],"names":["EditorWrapper","props","onChange","_hooks","useCallbackRef","_","editor","content","getContent","respValue","undefined","_jsx","className","children","_Editor","_extends","value","cdnTinyMce","init","height","menubar","language","paste_retain_style_properties","table_default_styles","width","plugins","toolbar","join","fontsize_formats","autoresize_bottom_margin","editorInitParams","editorProps","onEditorChange"],"mappings":";uMAoBaA,EAAgB,SAAhBA,EAAiBC,GAC5B,IAAMC,EAAWC,EAAMC,gBAAe,SAACC,EAAGC,GACxC,IAAMC,EAAUD,EAAOE,aACvB,IAAMC,EAAYF,EAAUA,EAAUG,UACtCT,EAAMC,UAAND,UAAAA,EAAAA,EAAMC,SAAWO,EACnB,IAWA,OACEE,EAAA,MAAA,CAAKC,UAAU,mBAAkBC,SAC/BF,EAAAG,EAAAC,EAAA,CACEC,MAAOf,EAAMe,MACbC,WAAW,oDACXC,KAAIH,EAAA,CACFI,OAAQlB,EAAMkB,QAAU,IACxBC,QAAS,KACTC,SAAU,QACVC,8BAA+B,MAC/BC,qBAAsB,CACpBC,MAAO,QAETC,QACE,4GACFC,QAAS,CACP,+BACA,qDACA,+DACA,mCACA,4BACAC,KAAK,KACPC,iBAAkB,8CAClBC,yBAA0B,IAgBvB5B,EAAM6B,mBAEP7B,EAAM8B,YAAW,CACrBC,eAAgB9B,MAIxB"}
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/editor-wrapper/editor-wrapper.tsx"],"sourcesContent":["import { TAny, TPlainObject } from '@flatbiz/utils';\nimport { Editor, hooks } from '@wove/react';\nimport { useKeyPress } from 'ahooks';\nimport { useRef } from 'react';\nimport './style.less';\n\nexport type EditorWrapperProps = {\n onChange?: (data?: string) => void;\n value?: string;\n editorInitParams?: TPlainObject;\n editorProps?: TPlainObject;\n // varStyle?: Record<varStyles, CSSProperties['color']>;\n height?: number | string;\n /** 上传图片服务 */\n onUploadImage?: (file: File) => Promise<string>;\n};\n\n/**\n * 富文本编辑器,配置参考tinymce\n * @param props\n * @returns\n * ```\n * 1. 如果需要粘贴上传图片服务,需要提供 onUploadImage 上传图片接口\n * 2. 如果不需要粘贴上传图片,可配置 editorInitParams.paste_data_images = false\n * 3. 获取富文本实例,通过editorInitParams.setup(editor)函数获取\n *\n * ```\n */\nexport const EditorWrapper = (props: EditorWrapperProps) => {\n const editorRef = useRef<TAny>(null);\n\n const onChange = hooks.useCallbackRef((_, editor) => {\n const content = editor.getContent();\n const respValue = content ? content : undefined;\n props.onChange?.(respValue);\n });\n\n // const varStyleString = useMemo(() => {\n // const merge = { ...defaultVarStyle, ...props.varStyle };\n // let varStyleString = '';\n // Object.keys(merge).map((key) => {\n // varStyleString += `${key}:${merge[key]};`;\n // });\n // return varStyleString;\n // }, [props.varStyle]);\n\n const images_upload_handler = hooks.useCallbackRef(async (blobInfo, success, failure) => {\n try {\n const respData = await props.onUploadImage?.(blobInfo.blob());\n success(respData);\n } catch (error) {\n failure(error.message);\n }\n });\n\n useKeyPress(\n () => true,\n (event) => {\n try {\n if (event.type === 'keyup' && event.key === 'Escape') {\n const isFull = editorRef.current?.editorContainer.classList.contains('tox-fullscreen');\n if (isFull) {\n editorRef.current?.editorCommands.execCommand('mceFullScreen');\n }\n }\n } catch (error) {\n // 异常不处理\n }\n },\n {\n events: ['keydown', 'keyup'],\n },\n );\n\n return (\n <div className=\"v-editor-wrapper\">\n <Editor\n value={props.value}\n cdnTinyMce=\"https://file.40017.cn/tcsk/tinymce/tinymce.min.js\"\n init={{\n paste_data_images: !!props.onUploadImage,\n images_upload_handler,\n height: props.height || 300,\n menubar: true,\n language: 'zh_CN',\n paste_retain_style_properties: 'all',\n table_default_styles: {\n width: '100%',\n },\n plugins:\n 'advlist lists image charmap preview visualblocks code hr print media table paste help template fullscreen',\n toolbar: [\n 'undo redo fullscreen preview',\n 'formatselect bold italic backcolor bullist numlist',\n 'outdent indent alignleft aligncenter alignright alignjustify',\n 'textmark untextmark code preview',\n 'template link image help',\n ].join('|'),\n fontsize_formats: '8px 10px 12px 14px 16px 18px 24px 36px 48px',\n autoresize_bottom_margin: 50,\n // templates: [\n // editorTemplates.block,\n // editorTemplates.primary_p,\n // editorTemplates.secondary_p,\n // editorTemplates.warning_p,\n // editorTemplates.danger_p,\n // editorTemplates.success_p,\n // editorTemplates.p,\n // ],\n // template_replace_values: {\n // varStyle: varStyleString,\n // },\n // template_preview_replace_values: {\n // varStyle: varStyleString,\n // },\n ...props.editorInitParams,\n setup: (editor) => {\n editorRef.current = editor;\n props.editorInitParams?.setup(editor);\n },\n }}\n {...props.editorProps}\n onKeyDown={(event) => {\n try {\n if (event.keyCode == 27) {\n const isFull = editorRef.current?.editorContainer.classList.contains('tox-fullscreen');\n if (isFull) {\n editorRef.current?.editorCommands.execCommand('mceFullScreen');\n }\n }\n } catch (error) {\n // 异常不处理\n }\n props.editorProps?.onKeyDown(event);\n }}\n onEditorChange={onChange}\n />\n </div>\n );\n};\n\n/**\n * undo redo\n * codesample\n * fontselect fontsizeselect formatselect\n * image media link anchor\n * preview save print\n * emoticons(表情)\n */\n"],"names":["EditorWrapper","props","editorRef","useRef","onChange","_hooks","useCallbackRef","_","editor","content","getContent","respValue","undefined","images_upload_handler","blobInfo","success","failure","Promise","$return","$error","respData","$Try_1_Post","$boundEx","$Try_1_Catch","error","message","resolve","onUploadImage","blob","then","$await_4","useKeyPress","event","type","key","_editorRef$current","isFull","current","editorContainer","classList","contains","_editorRef$current2","editorCommands","execCommand","events","_jsx","className","children","_Editor","_extends","value","cdnTinyMce","init","paste_data_images","height","menubar","language","paste_retain_style_properties","table_default_styles","width","plugins","toolbar","join","fontsize_formats","autoresize_bottom_margin","editorInitParams","setup","_props$editorInitPara","editorProps","onKeyDown","_props$editorProps","keyCode","_editorRef$current3","_editorRef$current4","onEditorChange"],"mappings":";2QA4BaA,EAAgB,SAAhBA,EAAiBC,GAC5B,IAAMC,EAAYC,EAAa,MAE/B,IAAMC,EAAWC,EAAMC,gBAAe,SAACC,EAAGC,GACxC,IAAMC,EAAUD,EAAOE,aACvB,IAAMC,EAAYF,EAAUA,EAAUG,UACtCX,EAAMG,UAANH,UAAAA,EAAAA,EAAMG,SAAWO,EACnB,IAWA,IAAME,EAAwBR,EAAMC,gBAAe,SAAOQ,EAAUC,EAASC,GAA1B,OAAA,IAAAC,SAAA,SAAAC,EAAAC,GAAA,IAEzCC,EAhDZ,IAAIC,aAAJ,IAAI,OAAAH,GAAK,CAAC,MAAAI,GAAW,OAAOH,EAAAG,EAAM,GAAlC,IAAIC,EAAA,SAkDSC,GAlDb,IAmDMR,EAAQQ,EAAMC,SAnDpB,OAAOJ,GAAE,CAAC,MAAAC,GAAW,OAAOH,EAAAG,EAAM,GA+C9B,IACmB,OAAAL,QAAAS,QAAMzB,EAAM0B,2BAAN1B,EAAM0B,cAAgBb,EAASc,SAArCC,eAA4CC,GAhDnE,IAgDYV,EAAWU,EACjBf,EAAQK,GAjDd,OAAOC,GAAE,CAAC,MAAAC,GAAW,OAAOC,EAAAD,EAAM,CAAC,GAAAC,EAkD9B,CAAC,MAAOC,GAAOD,EAAPC,EAET,CAAC,OAGHO,GACE,WAAA,OAAM,IACN,IAAA,SAACC,GACC,IACE,GAAIA,EAAMC,OAAS,SAAWD,EAAME,MAAQ,SAAU,CAAA,IAAAC,EACpD,IAAMC,GAAMD,EAAGjC,EAAUmC,UAAO,UAAA,EAAjBF,EAAmBG,gBAAgBC,UAAUC,SAAS,kBACrE,GAAIJ,EAAQ,CAAA,IAAAK,GACVA,EAAAvC,EAAUmC,UAAO,UAAA,EAAjBI,EAAmBC,eAAeC,YAAY,gBAChD,CACF,CACD,CAAC,MAAOnB,GACP,CAEJ,GACA,CACEoB,OAAQ,CAAC,UAAW,WAIxB,OACEC,EAAA,MAAA,CAAKC,UAAU,mBAAkBC,SAC/BF,EAAAG,EAAAC,EAAA,CACEC,MAAOjD,EAAMiD,MACbC,WAAW,oDACXC,KAAIH,EAAA,CACFI,oBAAqBpD,EAAM0B,cAC3Bd,sBAAAA,EACAyC,OAAQrD,EAAMqD,QAAU,IACxBC,QAAS,KACTC,SAAU,QACVC,8BAA+B,MAC/BC,qBAAsB,CACpBC,MAAO,QAETC,QACE,4GACFC,QAAS,CACP,+BACA,qDACA,+DACA,mCACA,4BACAC,KAAK,KACPC,iBAAkB,8CAClBC,yBAA0B,IAgBvB/D,EAAMgE,iBAAgB,CACzBC,MAAO,SAAAA,EAAC1D,GAAW,IAAA2D,EACjBjE,EAAUmC,QAAU7B,GACpB2D,EAAAlE,EAAMgE,mBAANE,UAAAA,EAAAA,EAAwBD,MAAM1D,EAChC,KAEEP,EAAMmE,YAAW,CACrBC,UAAW,SAAAA,EAACrC,GAAU,IAAAsC,EACpB,IACE,GAAItC,EAAMuC,SAAW,GAAI,CAAA,IAAAC,EACvB,IAAMpC,GAAMoC,EAAGtE,EAAUmC,UAAO,UAAA,EAAjBmC,EAAmBlC,gBAAgBC,UAAUC,SAAS,kBACrE,GAAIJ,EAAQ,CAAA,IAAAqC,GACVA,EAAAvE,EAAUmC,UAAO,UAAA,EAAjBoC,EAAmB/B,eAAeC,YAAY,gBAChD,CACF,CACD,CAAC,MAAOnB,GACP,EAEF8C,EAAArE,EAAMmE,cAANE,UAAAA,EAAAA,EAAmBD,UAAUrC,EAC7B,EACF0C,eAAgBtE,MAIxB"}
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
2
  import './index.css';
3
3
  /*! @flatjs/forge MIT @flatbiz/antd */
4
- import{_ as e,a as o}from"../_rollupPluginBabelHelpers-1f4d8910.js";import{hooks as t}from"@wove/react/cjs/hooks";import{isUndefinedOrNull as l}from"@flatbiz/utils";import{Tooltip as r,Switch as a}from"antd";import{jsx as i}from"react/jsx-runtime";var n=["checkedValue","unCheckedValue","onChange","value","tooltipProps","tooltipTitle"];var u=function u(c){var p=c.checkedValue,f=c.unCheckedValue,m=c.onChange,s=c.value,h=c.tooltipProps,v=c.tooltipTitle,d=e(c,n);var k=t.useCallbackRef((function(e){m==null?void 0:m(e?p:f)}));var C;if(typeof v==="function"){C=v(s)}else{C=v}return i(r,o({placement:"top"},h,{title:C,children:i(a,o({},d,{checked:!l(s)&&p===s,onChange:k}))}))};export{u as SwitchWrapper};
4
+ import{_ as e,a as o}from"../_rollupPluginBabelHelpers-1f4d8910.js";import{hooks as t}from"@wove/react/cjs/hooks";import{isUndefinedOrNull as r}from"@flatbiz/utils";import{Tooltip as l,Switch as a}from"antd";import{jsx as n}from"react/jsx-runtime";var i=["checkedValue","unCheckedValue","onChange","value","tooltipProps","tooltipTitle"];var c=function c(u){var p=u.checkedValue,f=u.unCheckedValue,h=u.onChange,m=u.value,s=u.tooltipProps,d=u.tooltipTitle,v=e(u,i);var k=t.useCallbackRef((function(e){h==null?void 0:h(e?p:f)}));var C;if(typeof d==="function"){C=d(m)}else{C=d}if(C){return n(l,o({placement:"top"},s,{title:C,children:n(a,o({},v,{checked:!r(m)&&p===m,onChange:k}))}))}return n(a,o({},v,{checked:!r(m)&&p===m,onChange:k}))};export{c as SwitchWrapper};
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/switch-wrapper/switch-wrapper.tsx"],"sourcesContent":["import { isUndefinedOrNull } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Switch, SwitchProps, Tooltip, TooltipProps } from 'antd';\ntype SwitchWrapperValue = string | number | boolean;\n\nexport type SwitchWrapperProps = Omit<SwitchProps, 'checked' | 'defaultChecked' | 'onChange'> & {\n value?: SwitchWrapperValue;\n checkedValue: SwitchWrapperValue;\n unCheckedValue: SwitchWrapperValue;\n onChange?: (value: SwitchWrapperValue) => void;\n tooltipProps?: Omit<TooltipProps, 'title'>;\n tooltipTitle?: string | ((value?: SwitchWrapperValue) => string | undefined);\n};\n/**\n * 解决SwitchForm.Item 使用只能接收boolean的限制\n * ```\n * 1. value 为状态值,不局限于boolean,可以为 [string | number | boolean]\n * 2. checkedValue 选中值\n * 3. unCheckedValue 未选中值\n * 4. 与 Form.Item 组合使用最佳\n * <Form.Item name=\"fieldName\" >\n * <SwitchWrapper checkedValue={2} unCheckedValue={1} />\n * </Form.Item>\n * 5. 可设置tooltip效果数据显示\n * ```\n */\nexport const SwitchWrapper = (props: SwitchWrapperProps) => {\n const { checkedValue, unCheckedValue, onChange, value, tooltipProps, tooltipTitle, ...otherProps } = props;\n const onChangeHandle = hooks.useCallbackRef((checked) => {\n onChange?.(checked ? checkedValue : unCheckedValue);\n });\n\n let tipTitle: string | undefined;\n\n if (typeof tooltipTitle === 'function') {\n tipTitle = tooltipTitle(value);\n } else {\n tipTitle = tooltipTitle;\n }\n\n return (\n <Tooltip placement=\"top\" {...tooltipProps} title={tipTitle}>\n <Switch\n {...otherProps}\n checked={!isUndefinedOrNull(value) && checkedValue === value}\n onChange={onChangeHandle}\n />\n </Tooltip>\n );\n};\n"],"names":["SwitchWrapper","props","checkedValue","unCheckedValue","onChange","value","tooltipProps","tooltipTitle","otherProps","_objectWithoutPropertiesLoose","_excluded","onChangeHandle","_hooks","useCallbackRef","checked","tipTitle","_jsx","Tooltip","_extends","placement","title","children","Switch","isUndefinedOrNull"],"mappings":";qVA0BaA,EAAgB,SAAhBA,EAAiBC,GAC5B,IAAQC,EAA6FD,EAA7FC,aAAcC,EAA+EF,EAA/EE,eAAgBC,EAA+DH,EAA/DG,SAAUC,EAAqDJ,EAArDI,MAAOC,EAA8CL,EAA9CK,aAAcC,EAAgCN,EAAhCM,aAAiBC,EAAUC,EAAKR,EAAKS,GAC1G,IAAMC,EAAiBC,EAAMC,gBAAe,SAACC,GAC3CV,GAAQ,UAAA,EAARA,EAAWU,EAAUZ,EAAeC,EACtC,IAEA,IAAIY,EAEJ,UAAWR,IAAiB,WAAY,CACtCQ,EAAWR,EAAaF,EAC1B,KAAO,CACLU,EAAWR,CACb,CAEA,OACES,EAACC,EAAOC,EAAA,CAACC,UAAU,OAAUb,EAAY,CAAEc,MAAOL,EAASM,SACzDL,EAACM,EAAMJ,KACDV,EAAU,CACdM,SAAUS,EAAkBlB,IAAUH,IAAiBG,EACvDD,SAAUO,OAIlB"}
1
+ {"version":3,"file":"index.js","sources":["@flatbiz/antd/src/switch-wrapper/switch-wrapper.tsx"],"sourcesContent":["import { isUndefinedOrNull } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Switch, SwitchProps, Tooltip, TooltipProps } from 'antd';\n\nexport type SwitchWrapperProps = Omit<SwitchProps, 'checked' | 'defaultChecked' | 'onChange'> & {\n value?: string | number | boolean;\n checkedValue: string | number | boolean;\n unCheckedValue: string | number | boolean;\n onChange?: (value: string | number | boolean) => void;\n tooltipProps?: Omit<TooltipProps, 'title'>;\n tooltipTitle?: string | ((value?: string | number | boolean) => string | undefined);\n};\n/**\n * 解决Switch只能接收boolean的限制,与Form.Item结合使用最佳\n * ```\n * 1. value 为状态值,不局限于boolean,可以为 [string | number | boolean]\n * 2. checkedValue 选中值\n * 3. unCheckedValue 未选中值\n * 4. 与 Form.Item 结合使用,不再需要配置 valuePropName\n * <Form.Item name=\"fieldName\">\n * <SwitchWrapper checkedValue={2} unCheckedValue={1} />\n * </Form.Item>\n * 5. 可设置tooltip效果数据显示\n * ```\n */\nexport const SwitchWrapper = (props: SwitchWrapperProps) => {\n const { checkedValue, unCheckedValue, onChange, value, tooltipProps, tooltipTitle, ...otherProps } = props;\n const onChangeHandle = hooks.useCallbackRef((checked) => {\n onChange?.(checked ? checkedValue : unCheckedValue);\n });\n\n let tipTitle: string | undefined;\n\n if (typeof tooltipTitle === 'function') {\n tipTitle = tooltipTitle(value);\n } else {\n tipTitle = tooltipTitle;\n }\n\n if (tipTitle) {\n return (\n <Tooltip placement=\"top\" {...tooltipProps} title={tipTitle}>\n <Switch\n {...otherProps}\n checked={!isUndefinedOrNull(value) && checkedValue === value}\n onChange={onChangeHandle}\n />\n </Tooltip>\n );\n }\n\n return (\n <Switch\n {...otherProps}\n checked={!isUndefinedOrNull(value) && checkedValue === value}\n onChange={onChangeHandle}\n />\n );\n};\n"],"names":["SwitchWrapper","props","checkedValue","unCheckedValue","onChange","value","tooltipProps","tooltipTitle","otherProps","_objectWithoutPropertiesLoose","_excluded","onChangeHandle","_hooks","useCallbackRef","checked","tipTitle","_jsx","Tooltip","_extends","placement","title","children","Switch","isUndefinedOrNull"],"mappings":";qVAyBaA,EAAgB,SAAhBA,EAAiBC,GAC5B,IAAQC,EAA6FD,EAA7FC,aAAcC,EAA+EF,EAA/EE,eAAgBC,EAA+DH,EAA/DG,SAAUC,EAAqDJ,EAArDI,MAAOC,EAA8CL,EAA9CK,aAAcC,EAAgCN,EAAhCM,aAAiBC,EAAUC,EAAKR,EAAKS,GAC1G,IAAMC,EAAiBC,EAAMC,gBAAe,SAACC,GAC3CV,GAAQ,UAAA,EAARA,EAAWU,EAAUZ,EAAeC,EACtC,IAEA,IAAIY,EAEJ,UAAWR,IAAiB,WAAY,CACtCQ,EAAWR,EAAaF,EAC1B,KAAO,CACLU,EAAWR,CACb,CAEA,GAAIQ,EAAU,CACZ,OACEC,EAACC,EAAOC,EAAA,CAACC,UAAU,OAAUb,EAAY,CAAEc,MAAOL,EAASM,SACzDL,EAACM,EAAMJ,KACDV,EAAU,CACdM,SAAUS,EAAkBlB,IAAUH,IAAiBG,EACvDD,SAAUO,OAIlB,CAEA,OACEK,EAACM,EAAMJ,KACDV,EAAU,CACdM,SAAUS,EAAkBlB,IAAUH,IAAiBG,EACvDD,SAAUO,IAGhB"}
package/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { API, ModelType } from '@dimjs/model';
5
5
  import { DateFormatType, TAny, TNoopDefine, TPlainObject } from '@flatbiz/utils';
6
- import { ButtonProps, CascaderProps, DrawerProps, DropdownProps, FormInstance, FormItemProps, InputNumberProps, InputProps, ModalProps, PopconfirmProps, RadioGroupProps, RowProps, SelectProps, SpaceProps, SwitchProps, TableProps, TabsProps, TimePickerProps, TimeRangePickerProps, TooltipProps, TreeProps, TreeSelectProps, UploadProps } from 'antd';
6
+ import { ButtonProps, CascaderProps, CheckboxProps, DrawerProps, DropdownProps, FormInstance, FormItemProps, InputNumberProps, InputProps, ModalProps, PopconfirmProps, RadioGroupProps, RowProps, SelectProps, SpaceProps, SwitchProps, TableProps, TabsProps, TimePickerProps, TimeRangePickerProps, TooltipProps, TreeProps, TreeSelectProps, UploadProps } from 'antd';
7
7
  import { ConfigProviderProps } from 'antd/es/config-provider';
8
8
  import { PickerDateProps } from 'antd/es/date-picker/generatePicker';
9
9
  import { CheckboxGroupProps } from 'antd/lib/checkbox';
@@ -170,6 +170,25 @@ export type CheckListItemProps = {
170
170
  export declare const CheckList: (<T extends "radio" | "multi">(props: CheckListProps<T>) => JSX.Element) & {
171
171
  Item: (props: CheckListItemProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
172
172
  };
173
+ export type CheckboxWrapperProps = Omit<CheckboxProps, "checked" | "defaultChecked" | "onChange"> & {
174
+ value?: string | number | boolean;
175
+ checkedValue: string | number | boolean;
176
+ unCheckedValue: string | number | boolean;
177
+ onChange?: (value: string | number | boolean) => void;
178
+ };
179
+ /**
180
+ * 解决 Checkbox 只能接收boolean的限制,与Form.Item结合使用最佳
181
+ * ```
182
+ * 1. value 为状态值,不局限于boolean,可以为 [string | number | boolean]
183
+ * 2. checkedValue 选中值
184
+ * 3. unCheckedValue 未选中值
185
+ * 4. 与 Form.Item 结合使用,不再需要配置 valuePropName
186
+ * <Form.Item name="fieldName">
187
+ * <CheckboxWrapper checkedValue={2} unCheckedValue={1} />
188
+ * </Form.Item>
189
+ * ```
190
+ */
191
+ export declare const CheckboxWrapper: (props: CheckboxWrapperProps) => JSX.Element;
173
192
  export type ConfigProviderWrapperProps = Omit<ConfigProviderProps, "locale"> & {
174
193
  locale?: "en" | "zh-cn";
175
194
  };
@@ -1042,19 +1061,25 @@ export type EditableTableProps = {
1042
1061
  rules?: FormListProps["rules"];
1043
1062
  };
1044
1063
  export declare const EditableTable: (props: EditableTableProps) => JSX.Element;
1045
- export type varStyles = "--fa-color-primary" | "--fa-color-secondary" | "--fa-color-warning" | "--fa-color-danger" | "--fa-color-success" | "--editor-card-bgcolor";
1046
1064
  export type EditorWrapperProps = {
1047
1065
  onChange?: (data?: string) => void;
1048
1066
  value?: string;
1049
1067
  editorInitParams?: TPlainObject;
1050
1068
  editorProps?: TPlainObject;
1051
- varStyle?: Record<varStyles, CSSProperties["color"]>;
1052
1069
  height?: number | string;
1070
+ /** 上传图片服务 */
1071
+ onUploadImage?: (file: File) => Promise<string>;
1053
1072
  };
1054
1073
  /**
1055
1074
  * 富文本编辑器,配置参考tinymce
1056
1075
  * @param props
1057
1076
  * @returns
1077
+ * ```
1078
+ * 1. 如果需要粘贴上传图片服务,需要提供 onUploadImage 上传图片接口
1079
+ * 2. 如果不需要粘贴上传图片,可配置 editorInitParams.paste_data_images = false
1080
+ * 3. 获取富文本实例,通过editorInitParams.setup(editor)函数获取
1081
+ *
1082
+ * ```
1058
1083
  */
1059
1084
  export declare const EditorWrapper: (props: EditorWrapperProps) => JSX.Element;
1060
1085
  export type ShouldUpdateFunc<T> = (prev: T | undefined, next: T) => boolean;
@@ -1715,23 +1740,22 @@ export interface SmsCountDownProps {
1715
1740
  }
1716
1741
  export declare const SmsCountDown: FC<SmsCountDownProps>;
1717
1742
  export declare const styles: () => void;
1718
- export type SwitchWrapperValue = string | number | boolean;
1719
1743
  export type SwitchWrapperProps = Omit<SwitchProps, "checked" | "defaultChecked" | "onChange"> & {
1720
- value?: SwitchWrapperValue;
1721
- checkedValue: SwitchWrapperValue;
1722
- unCheckedValue: SwitchWrapperValue;
1723
- onChange?: (value: SwitchWrapperValue) => void;
1744
+ value?: string | number | boolean;
1745
+ checkedValue: string | number | boolean;
1746
+ unCheckedValue: string | number | boolean;
1747
+ onChange?: (value: string | number | boolean) => void;
1724
1748
  tooltipProps?: Omit<TooltipProps, "title">;
1725
- tooltipTitle?: string | ((value?: SwitchWrapperValue) => string | undefined);
1749
+ tooltipTitle?: string | ((value?: string | number | boolean) => string | undefined);
1726
1750
  };
1727
1751
  /**
1728
- * 解决SwitchForm.Item 使用只能接收boolean的限制
1752
+ * 解决Switch只能接收boolean的限制,与Form.Item结合使用最佳
1729
1753
  * ```
1730
1754
  * 1. value 为状态值,不局限于boolean,可以为 [string | number | boolean]
1731
1755
  * 2. checkedValue 选中值
1732
1756
  * 3. unCheckedValue 未选中值
1733
- * 4. 与 Form.Item 组合使用最佳
1734
- * <Form.Item name="fieldName" >
1757
+ * 4. 与 Form.Item 结合使用,不再需要配置 valuePropName
1758
+ * <Form.Item name="fieldName">
1735
1759
  * <SwitchWrapper checkedValue={2} unCheckedValue={1} />
1736
1760
  * </Form.Item>
1737
1761
  * 5. 可设置tooltip效果数据显示
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flatbiz/antd",
3
- "version": "4.2.9",
4
- "description": "flat-biz oss ui components",
3
+ "version": "4.2.11",
4
+ "description": "flat-biz ui components",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
7
7
  "files": [