@flatbiz/antd 4.4.9 → 4.4.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.
- package/esm/easy-form/index.js +1 -1
- package/esm/easy-form/index.js.map +1 -1
- package/esm/form-item-wrapper/index.js +1 -1
- package/esm/form-item-wrapper/index.js.map +1 -1
- package/esm/index.js +2 -1
- package/esm/mention-editor/index.css +0 -0
- package/esm/mention-editor/index.js +5 -0
- package/esm/mention-editor/index.js.map +1 -0
- package/esm/mentions-wrapper/index.js +1 -2
- package/esm/mentions-wrapper/index.js.map +1 -1
- package/esm/rich-text-editor/index.js.map +1 -1
- package/index.d.ts +107 -30
- package/package.json +1 -1
package/esm/easy-form/index.js
CHANGED
|
@@ -4,5 +4,5 @@ import './../fba-hooks/index.css';
|
|
|
4
4
|
import './../form-wrapper/index.css';
|
|
5
5
|
import './index.css';
|
|
6
6
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
7
|
-
import{classNames as r}from"@dimjs/utils/cjs/class-names";import{a as
|
|
7
|
+
import{classNames as r}from"@dimjs/utils/cjs/class-names";import{a as e,_ as o}from"../_rollupPluginBabelHelpers-a0769acd.js";import{isUndefinedOrNull as i}from"@flatbiz/utils";import{useMemo as s,Children as m,Fragment as t}from"react";import{BoxGrid as l}from"../box-grid/index.js";import{fbaHooks as n}from"../fba-hooks/index.js";import{FormWrapper as a}from"../form-wrapper/index.js";import{jsx as p}from"react/jsx-runtime";import"@dimjs/lang/cjs/is-number";import"ahooks";import"@dimjs/lang/cjs/is-array";import"@wove/react/cjs/hooks";import"../use-responsive-point-21b8c601.js";import"antd";var u=["column","forceColumn","children","width","gridGutter"];var d=function d(x){var f=n.useResponsivePoint()||"";var c=x.column,v=x.forceColumn,g=x.children,h=x.width,j=x.gridGutter,y=e(x,u);var b=s((function(){if(v){var r=24/v;return{xs:r,sm:r,md:r,lg:r,xl:r,xxl:r}}if(!c){return{xs:24,sm:12,md:12,lg:8,xl:8,xxl:6}}var e={1:{xs:24,sm:24,md:24,lg:24,xl:24,xxl:24},2:{xs:24,sm:12,md:12,lg:12,xl:12,xxl:12},3:{xs:24,sm:12,md:12,lg:8,xl:8,xxl:8},4:{xs:24,sm:12,md:12,lg:6,xl:6,xxl:6}};return e[c]}),[]);var w=function r(){return m.toArray(g).map((function(r,e){if(r.props["hidden"])return null;if(r.type["domTypeName"]==="BoxGridCol")return p(t,{children:r},e);var i=undefined;if(r.type["domTypeName"]==="FormItemWrapper"){i=r.props["span"];if(i){if(f==="xs"){i=24}else if(f==="sm"){i=i>12?i:12}}}return p(l.Col,o({},b,{span:i,children:r}),e)})).filter(Boolean)};var C=s((function(){if(["xs","sm"].includes(f)||!h){return{}}return{width:h}}),[f]);var N=i(j)?[15,0]:j;return p(a,o({},y,{style:o({},C,y.style),className:r(y.className,"easy-form"),autoComplete:"off",children:p(l.Row,{gutter:N,children:w()})}))};export{d as EasyForm};
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/easy-form/form.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { isUndefinedOrNull } from '@flatbiz/utils';\nimport { Children, Fragment, ReactElement, useMemo } from 'react';\nimport { BoxGrid } from '../box-grid';\nimport { BoxRowProps } from '../box-grid/row';\nimport { fbaHooks } from '../fba-hooks';\nimport { FormWrapper, FormWrapperProps } from '../form-wrapper';\nimport './style.less';\n\nexport type EasyFormProps = Omit<FormWrapperProps, 'children'> & {\n /**\n * 定义一行显示几列(当外层宽度尺寸大于 992px(lg) 时,一行显示几列), 默认值:3\n * ```\n * 1. 当外层宽度尺寸小于992px(lg),为xs、sm、md情况下不受column值影响(column=1除外)\n * 2. 宽度尺寸定义\n * xs: 宽度 < 576px\n * sm: 宽度 ≥ 576px\n * md: 宽度 ≥ 768px\n * lg: 宽度 ≥ 992px\n * xl: 宽度 ≥ 1200px\n * xxl: 宽度 ≥ 1600px\n * 3. 列数尺寸定义\n * {\n * 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n * 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n * 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n * 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n * };\n * ```\n */\n column?: 1 | 2 | 3 | 4;\n /**\n * 强制定义一行显示几列,不考虑响应式\n * ```\n * 1. 优先级大于column\n * 2. 建议优先使用column配置\n * ```\n */\n forceColumn?: 1 | 2 | 3 | 4;\n /**\n * Form显示宽度,可数值、可百分比;在小屏幕尺寸(xs、sm)上无效\n */\n width?: number | string;\n /** 网格间距 */\n gridGutter?: BoxRowProps['gutter'];\n children: ReactElement | ReactElement[];\n};\n\n/**\n * 简单Form布局,可自定义网格布局\n * ```\n * 1.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/easy-form/form.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { isUndefinedOrNull } from '@flatbiz/utils';\nimport { Children, Fragment, ReactElement, useMemo } from 'react';\nimport { BoxGrid } from '../box-grid';\nimport { BoxRowProps } from '../box-grid/row';\nimport { fbaHooks } from '../fba-hooks';\nimport { FormWrapper, FormWrapperProps } from '../form-wrapper';\nimport './style.less';\n\nexport type EasyFormProps = Omit<FormWrapperProps, 'children'> & {\n /**\n * 定义一行显示几列(当外层宽度尺寸大于 992px(lg) 时,一行显示几列), 默认值:3\n * ```\n * 1. 当外层宽度尺寸小于992px(lg),为xs、sm、md情况下不受column值影响(column=1除外)\n * 2. 宽度尺寸定义\n * xs: 宽度 < 576px\n * sm: 宽度 ≥ 576px\n * md: 宽度 ≥ 768px\n * lg: 宽度 ≥ 992px\n * xl: 宽度 ≥ 1200px\n * xxl: 宽度 ≥ 1600px\n * 3. 列数尺寸定义\n * {\n * 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n * 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n * 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n * 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n * };\n * ```\n */\n column?: 1 | 2 | 3 | 4;\n /**\n * 强制定义一行显示几列,不考虑响应式\n * ```\n * 1. 优先级大于column\n * 2. 建议优先使用column配置\n * ```\n */\n forceColumn?: 1 | 2 | 3 | 4;\n /**\n * Form显示宽度,可数值、可百分比;在小屏幕尺寸(xs、sm)上无效\n */\n width?: number | string;\n /** 网格间距 */\n gridGutter?: BoxRowProps['gutter'];\n children: ReactElement | ReactElement[];\n};\n\n/**\n * 简单Form布局,可自定义网格布局\n * ```\n * 1. demo:https://fex.qa.tcshuke.com/docs/admin/main/form/label\n * 2. 布局网格以当前节点的宽度来计算的,不是屏幕宽度\n * 3. EasyForm 子节点包含 hidden = true 会被忽略\n * 4. 通过 column 可定义一行显示几列FormItem\n * 5. 通过 labelItemVertical 可定义 formitem 竖直布局\n * 6. 通过 formItemGap 可定义 formItem竖直方向间隙\n * 7. 通过 forceColumn 可强制定义一行显示几列,不考虑响应式\n * 8. 通过 labelWidth 可控制Form内部所有label的宽度(可实现整齐效果)\n * 9. 自定义栅格占位格数,见下方`例如`\n\n * 例如\n * <EasyForm column={3}>\n *\t <Form.Item name=\"field1\" label=\"条件1\">\n *\t <Input placeholder=\"请输入\" allowClear={true} />\n *\t </Form.Item>\n *\t <Form.Item name=\"field2\" label=\"条件2\">\n *\t <Input placeholder=\"请输入\" allowClear={true} />\n *\t </Form.Item>\n *\t <!-- !!自定义栅格占位格数第一种方式:可通过使用 BoxGrid.Col 包裹元素来自定义网格占比 -->\n *\t <BoxGrid.Col span={24}>\n *\t <Form.Item name=\"field5\" label=\"条件5\">\n *\t \t<Input placeholder=\"请输入\" allowClear={true} />\n *\t </Form.Item>\n *\t </BoxGrid.Col>\n *\t <!-- !!自定义栅格占位格数第二种方式:如果为FormItemWrapper组件,可设置span属性 -->\n *\t <FormItemWrapper name=\"field6\" label=\"条件6\" span={24}>\n *\t <Input placeholder=\"请输入\" allowClear={true} />\n *\t </FormItemWrapper>\n * </EasyForm>\n * ```\n */\nexport const EasyForm = (props: EasyFormProps) => {\n const screenType = fbaHooks.useResponsivePoint() || '';\n\n const { column, forceColumn, children, width, gridGutter, ...otherProps } = props;\n\n const gridSize = useMemo(() => {\n if (forceColumn) {\n const num = 24 / forceColumn;\n return { xs: num, sm: num, md: num, lg: num, xl: num, xxl: num };\n }\n if (!column) {\n return { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 6 };\n }\n const columnMap = {\n 1: { xs: 24, sm: 24, md: 24, lg: 24, xl: 24, xxl: 24 },\n 2: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },\n 3: { xs: 24, sm: 12, md: 12, lg: 8, xl: 8, xxl: 8 },\n 4: { xs: 24, sm: 12, md: 12, lg: 6, xl: 6, xxl: 6 },\n };\n return columnMap[column];\n }, []);\n\n const getFormRowChildren = () => {\n return Children.toArray(children)\n .map((item: any, index) => {\n if (item.props['hidden']) return null;\n if (item.type['domTypeName'] === 'BoxGridCol') return <Fragment key={index}>{item}</Fragment>;\n let span: number | undefined = undefined;\n if (item.type['domTypeName'] === 'FormItemWrapper') {\n span = item.props['span'] as number;\n if (span) {\n if (screenType === 'xs') {\n span = 24;\n } else if (screenType === 'sm') {\n span = span > 12 ? span : 12;\n }\n }\n }\n return (\n <BoxGrid.Col key={index} {...gridSize} span={span}>\n {item}\n </BoxGrid.Col>\n );\n })\n .filter(Boolean);\n };\n\n const innerStyle = useMemo(() => {\n /** 小屏幕不控制宽度 */\n if (['xs', 'sm'].includes(screenType) || !width) {\n return {};\n }\n return { width };\n }, [screenType]);\n\n const gutter = (isUndefinedOrNull(gridGutter) ? [15, 0] : gridGutter) as BoxRowProps['gutter'];\n\n return (\n <FormWrapper\n {...otherProps}\n style={{ ...innerStyle, ...otherProps.style }}\n className={classNames(otherProps.className, 'easy-form')}\n autoComplete=\"off\"\n >\n <BoxGrid.Row gutter={gutter}>{getFormRowChildren()}</BoxGrid.Row>\n </FormWrapper>\n );\n};\n"],"names":["EasyForm","props","screenType","fbaHooks","useResponsivePoint","column","forceColumn","children","width","gridGutter","otherProps","_objectWithoutPropertiesLoose","_excluded","gridSize","useMemo","num","xs","sm","md","lg","xl","xxl","columnMap","getFormRowChildren","Children","toArray","map","item","index","type","_jsx","Fragment","span","undefined","BoxGrid","Col","_extends","filter","Boolean","innerStyle","includes","gutter","isUndefinedOrNull","FormWrapper","style","className","_classNames","autoComplete","Row"],"mappings":";wpBAkFaA,EAAW,SAAXA,EAAYC,GACvB,IAAMC,EAAaC,EAASC,sBAAwB,GAEpD,IAAQC,EAAoEJ,EAApEI,OAAQC,EAA4DL,EAA5DK,YAAaC,EAA+CN,EAA/CM,SAAUC,EAAqCP,EAArCO,MAAOC,EAA8BR,EAA9BQ,WAAeC,EAAUC,EAAKV,EAAKW,GAEjF,IAAMC,EAAWC,GAAQ,WACvB,GAAIR,EAAa,CACf,IAAMS,EAAM,GAAKT,EACjB,MAAO,CAAEU,GAAID,EAAKE,GAAIF,EAAKG,GAAIH,EAAKI,GAAIJ,EAAKK,GAAIL,EAAKM,IAAKN,EAC7D,CACA,IAAKV,EAAQ,CACX,MAAO,CAAEW,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,EAAGC,GAAI,EAAGC,IAAK,EACtD,CACA,IAAMC,EAAY,CAChB,EAAG,CAAEN,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,IAAK,IAClD,EAAG,CAAEL,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,IAAK,IAClD,EAAG,CAAEL,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,EAAGC,GAAI,EAAGC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
import{a as
|
|
4
|
+
import{a as e,_ as r}from"../_rollupPluginBabelHelpers-a0769acd.js";import{classNames as l}from"@dimjs/utils/cjs/class-names";import{composeProps as a}from"@flatbiz/utils";import{Form as i}from"antd";import{useMemo as t,isValidElement as n,cloneElement as m}from"react";import{jsx as o,jsxs as f}from"react/jsx-runtime";var p=["wrapper","children","inputNormalize"],u=["wrapper","isClear","labelWidth","labelItemVertical","labelAlign","children","before","after","inputNormalize","outputNormalize"];var s=function r(l){var i=l.wrapper,t=l.children,n=l.inputNormalize,u=e(l,p);var s=u.hasOwnProperty("value");if(s&&n){u["value"]=n(u["value"])}var c=m(t,a(t.props,u,true));if(i){return i(c)}if(l.before||l.after){return f("div",{style:{display:"flex",alignItems:"center"},children:[l.before?o("span",{style:{marginRight:10},children:l.before}):null,o("div",{style:{flex:1},children:c}),l.after?o("span",{style:{marginLeft:10},children:l.after}):null]})}return c};var c=function a(m){var f=m.wrapper,p=m.isClear,c=m.labelWidth,d=m.labelItemVertical,b=m.labelAlign,v=m.children,h=m.before,N=m.after,z=m.inputNormalize,g=m.outputNormalize,y=e(m,u);var w=t((function(){var e="";if(c){e+="form-item-label-"+c}if(d){e+=" form-item-label-value-vertical"}if(b){e+=" form-item-label-align-"+b}return e}),[c,d,b]);if(p)return null;return o(i.Item,r({normalize:g},y,{className:l(w,y.className),children:n(v)?o(s,{wrapper:f,before:h,after:N,inputNormalize:z,children:v}):v}))};c["domTypeName"]="FormItemWrapper";export{c as FormItemWrapper};
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-item-wrapper/form-item-wrapper.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { composeProps, TAny } from '@flatbiz/utils';\nimport { Form, FormItemProps } from 'antd';\nimport { cloneElement, isValidElement, ReactElement, ReactNode, useMemo } from 'react';\n\nexport interface FormItemWrapperProps extends FormItemProps {\n wrapper?: (children: ReactNode) => ReactElement;\n /** 设置wrapper后,before、after失效 */\n before?: ReactNode;\n /** 设置wrapper后,before、after失效 */\n after?: ReactNode;\n /** value 序列化处理 */\n inputNormalize?: (value?: TAny) => TAny;\n /**\n * onChange 参数序列化处理\n * 如果设置 normalize 属性,outputNormalize将失效\n */\n outputNormalize?: (value?: TAny) => TAny;\n /** 是否清除 Form.Item */\n isClear?: boolean;\n /**\n * label宽度\n * ```\n * 1. 如果想控制Form下所有label,可使用FormWrapper组件 替换 Form组件,在FormWrapper上设置属性\n * ```\n */\n labelWidth?:\n | 'auto'\n | '70'\n | '80'\n | '90'\n | '100'\n | '110'\n | '120'\n | '130'\n | '140'\n | '150'\n | '160'\n | '170'\n | '180'\n | '190'\n | '200';\n\n /**\n * labelItem 竖直布局\n * ```\n * 1. 如果想控制Form下所有labelItem,可使用FormWrapper组件 替换 Form组件,在FormWrapper上设置属性\n * ```\n */\n labelItemVertical?: true;\n /**\n * label 对齐方式\n * ```\n * 1. 如果想控制Form下所有labelAlign,可使用FormWrapper组件 替换 Form组件,在FormWrapper上设置属性\n * ```\n */\n labelAlign?: 'left' | 'right';\n}\n\ntype FormItemWrapperChildrenProps = Pick<\n FormItemWrapperProps,\n 'wrapper' | 'after' | 'before' | 'inputNormalize'\n> & {\n children: ReactElement;\n};\n\nconst FormItemWrapperChildren = (props: FormItemWrapperChildrenProps) => {\n const { wrapper, children, inputNormalize, ...rest } = props;\n // composeProps 合并执行 Form.Item 传的 onChange 以及组件本身的方法\n const hasValue = rest.hasOwnProperty('value');\n if (hasValue && inputNormalize) {\n rest['value'] = inputNormalize(rest['value']);\n }\n const _children = cloneElement(children, composeProps(children.props, rest, true));\n if (wrapper) {\n return wrapper(_children);\n }\n if (props.before || props.after) {\n return (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {props.before ? <span style={{ marginRight: 10 }}>{props.before}</span> : null}\n <div style={{ flex: 1 }}>{_children}</div>\n {props.after ? <span style={{ marginLeft: 10 }}>{props.after}</span> : null}\n </div>\n );\n }\n return _children;\n};\n\n/**\n * 对 Form.Item 包装处理\n * ```\n * 1. 为 children 增加 before、after\n * 2. 对输入、输出数据进行序列化处理\n * 3. 内置布局样式使用 preDefinedClassName.formItem\n * ```\n */\nexport const FormItemWrapper = (props: FormItemWrapperProps) => {\n const {\n wrapper,\n isClear,\n labelWidth,\n labelItemVertical,\n labelAlign,\n children,\n before,\n after,\n inputNormalize,\n outputNormalize,\n ...rest\n } = props;\n\n const innerClassName = useMemo(() => {\n let cn = '';\n if (labelWidth) {\n cn += `form-item-label-${labelWidth}`;\n }\n if (labelItemVertical) {\n cn += ` form-label-value-vertical`;\n }\n if (labelAlign) {\n cn += ` form-label-align-${labelAlign}`;\n }\n return cn;\n }, [labelWidth, labelItemVertical, labelAlign]);\n\n if (isClear) return null;\n\n return (\n <Form.Item normalize={outputNormalize} {...rest} className={classNames(innerClassName, rest.className)}>\n {isValidElement(children) ? (\n <FormItemWrapperChildren\n wrapper={wrapper}\n before={before}\n after={after}\n inputNormalize={inputNormalize}\n >\n {children}\n </FormItemWrapperChildren>\n ) : (\n children\n )}\n </Form.Item>\n );\n};\n"],"names":["FormItemWrapperChildren","props","wrapper","children","inputNormalize","rest","_objectWithoutPropertiesLoose","_excluded","hasValue","hasOwnProperty","_children","cloneElement","composeProps","before","after","_jsxs","style","display","alignItems","_jsx","marginRight","flex","marginLeft","FormItemWrapper","isClear","labelWidth","labelItemVertical","labelAlign","outputNormalize","_excluded2","innerClassName","useMemo","cn","Form","Item","_extends","normalize","className","_classNames","isValidElement"],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-item-wrapper/form-item-wrapper.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { composeProps, TAny } from '@flatbiz/utils';\nimport { Form, FormItemProps } from 'antd';\nimport { cloneElement, isValidElement, ReactElement, ReactNode, useMemo } from 'react';\n\nexport interface FormItemWrapperProps extends FormItemProps {\n wrapper?: (children: ReactNode) => ReactElement;\n /** 设置wrapper后,before、after失效 */\n before?: ReactNode;\n /** 设置wrapper后,before、after失效 */\n after?: ReactNode;\n /** value 序列化处理 */\n inputNormalize?: (value?: TAny) => TAny;\n /**\n * onChange 参数序列化处理\n * 如果设置 normalize 属性,outputNormalize将失效\n */\n outputNormalize?: (value?: TAny) => TAny;\n /** 是否清除 Form.Item */\n isClear?: boolean;\n /**\n * label宽度\n * ```\n * 1. 如果想控制Form下所有label,可使用FormWrapper组件 替换 Form组件,在FormWrapper上设置属性\n * ```\n */\n labelWidth?:\n | 'auto'\n | '70'\n | '80'\n | '90'\n | '100'\n | '110'\n | '120'\n | '130'\n | '140'\n | '150'\n | '160'\n | '170'\n | '180'\n | '190'\n | '200';\n\n /**\n * labelItem 竖直布局\n * ```\n * 1. 如果想控制Form下所有labelItem,可使用FormWrapper组件 替换 Form组件,在FormWrapper上设置属性\n * ```\n */\n labelItemVertical?: true;\n /**\n * label 对齐方式\n * ```\n * 1. 如果想控制Form下所有labelAlign,可使用FormWrapper组件 替换 Form组件,在FormWrapper上设置属性\n * ```\n */\n labelAlign?: 'left' | 'right';\n /**\n * 栅格占位格数,最大值:24\n * ```\n * 1. 当 FormItemWrapper 处在 EasyForm 直接子节点中有效,即FormItemWrapper在EasyForm栅格中的占位格数;\n * ```\n */\n span?: number;\n}\n\ntype FormItemWrapperChildrenProps = Pick<\n FormItemWrapperProps,\n 'wrapper' | 'after' | 'before' | 'inputNormalize'\n> & {\n children: ReactElement;\n};\n\nconst FormItemWrapperChildren = (props: FormItemWrapperChildrenProps) => {\n const { wrapper, children, inputNormalize, ...rest } = props;\n // composeProps 合并执行 Form.Item 传的 onChange 以及组件本身的方法\n const hasValue = rest.hasOwnProperty('value');\n if (hasValue && inputNormalize) {\n rest['value'] = inputNormalize(rest['value']);\n }\n const _children = cloneElement(children, composeProps(children.props, rest, true));\n if (wrapper) {\n return wrapper(_children);\n }\n if (props.before || props.after) {\n return (\n <div style={{ display: 'flex', alignItems: 'center' }}>\n {props.before ? <span style={{ marginRight: 10 }}>{props.before}</span> : null}\n <div style={{ flex: 1 }}>{_children}</div>\n {props.after ? <span style={{ marginLeft: 10 }}>{props.after}</span> : null}\n </div>\n );\n }\n return _children;\n};\n\n/**\n * 对 Form.Item 包装处理\n * ```\n * 1. 为 children 增加 before、after\n * 2. 对输入、输出数据进行序列化处理\n * 3. 内置布局样式使用 preDefinedClassName.formItem\n * ```\n */\nexport const FormItemWrapper = (props: FormItemWrapperProps) => {\n const {\n wrapper,\n isClear,\n labelWidth,\n labelItemVertical,\n labelAlign,\n children,\n before,\n after,\n inputNormalize,\n outputNormalize,\n ...rest\n } = props;\n\n const innerClassName = useMemo(() => {\n let cn = '';\n if (labelWidth) {\n cn += `form-item-label-${labelWidth}`;\n }\n if (labelItemVertical) {\n cn += ` form-item-label-value-vertical`;\n }\n if (labelAlign) {\n cn += ` form-item-label-align-${labelAlign}`;\n }\n\n return cn;\n }, [labelWidth, labelItemVertical, labelAlign]);\n\n if (isClear) return null;\n\n return (\n <Form.Item normalize={outputNormalize} {...rest} className={classNames(innerClassName, rest.className)}>\n {isValidElement(children) ? (\n <FormItemWrapperChildren\n wrapper={wrapper}\n before={before}\n after={after}\n inputNormalize={inputNormalize}\n >\n {children}\n </FormItemWrapperChildren>\n ) : (\n children\n )}\n </Form.Item>\n );\n};\n\nFormItemWrapper['domTypeName'] = 'FormItemWrapper';\n"],"names":["FormItemWrapperChildren","props","wrapper","children","inputNormalize","rest","_objectWithoutPropertiesLoose","_excluded","hasValue","hasOwnProperty","_children","cloneElement","composeProps","before","after","_jsxs","style","display","alignItems","_jsx","marginRight","flex","marginLeft","FormItemWrapper","isClear","labelWidth","labelItemVertical","labelAlign","outputNormalize","_excluded2","innerClassName","useMemo","cn","Form","Item","_extends","normalize","className","_classNames","isValidElement"],"mappings":";mfAyEA,IAAMA,EAA0B,SAA1BA,EAA2BC,GAC/B,IAAQC,EAA+CD,EAA/CC,QAASC,EAAsCF,EAAtCE,SAAUC,E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EAAI,CAAEgC,UAAWC,EAAWR,EAAgBzB,EAAKgC,WAAWlC,SACpGoC,EAAepC,GACdgB,EAACnB,EAAuB,CACtBE,QAASA,EACTW,OAAQA,EACRC,MAAOA,EACPV,eAAgBA,EAAeD,SAE9BA,IAGHA,IAIR,EAEAoB,EAAgB,eAAiB"}
|
package/esm/index.js
CHANGED
|
@@ -81,6 +81,7 @@ import './input-search-wrapper/index.css';
|
|
|
81
81
|
import './json-editor/index.css';
|
|
82
82
|
import './label-value-layout/index.css';
|
|
83
83
|
import './local-loading/index.css';
|
|
84
|
+
import './mention-editor/index.css';
|
|
84
85
|
import './mentions-wrapper/index.css';
|
|
85
86
|
import './modal-action/index.css';
|
|
86
87
|
import './modal-wrapper/index.css';
|
|
@@ -118,5 +119,5 @@ import './tree-selector-wrapper/index.css';
|
|
|
118
119
|
import './tree-wrapper/index.css';
|
|
119
120
|
import './index.css';
|
|
120
121
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
121
|
-
export{AceEditorGroovy}from"./ace-editor-groovy/index.js";export{AceEditorJava}from"./ace-editor-java/index.js";export{AceEditorJson}from"./ace-editor-json/index.js";export{AceEditorMysql}from"./ace-editor-mysql/index.js";export{AceEditorXml}from"./ace-editor-xml/index.js";export{AlertWrapper}from"./alert-wrapper/index.js";export{AmountFenInput}from"./amount-fen-input/index.js";export{AmountFenInputFormItem}from"./amount-fen-input-form-item/index.js";export{AnchorSteps}from"./anchor-steps/index.js";export{B as BlockLayout}from"./index-1f45bfd5.js";export{Bootstrap}from"./bootstrap/index.js";export{BoxGrid,useBoxBreakpoint}from"./box-grid/index.js";export{ButtonOperate,ButtonOperateItemContent}from"./button-operate/index.js";export{ButtonWrapper}from"./button-wrapper/index.js";export{CardLayout}from"./card-layout/index.js";export{CardWrapper}from"./card-wrapper/index.js";export{CascaderWrapper}from"./cascader-wrapper/index.js";export{CheckList}from"./check-list/index.js";export{CheckboxWrapper}from"./checkbox-wrapper/index.js";export{ColorPickerWrapper}from"./color-picker-wrapper/index.js";export{C as ConfigProviderWrapper}from"./index-7f4ad045.js";export{createDrawerWrapperModel}from"./create-drawer-wrapper-model/index.js";export{createModalWrapperModel}from"./create-modal-wrapper-model/index.js";export{CssNodeHover}from"./css-node-hover/index.js";export{DataRender}from"./data-render/index.js";export{DatePickerWrapper}from"./date-picker-wrapper/index.js";export{DateRangePickerWrapper}from"./date-range-picker-wrapper/index.js";export{DateRangePickerWrapperFormItem}from"./date-range-picker-wrapper-form-item/index.js";export{dialogAlert}from"./dialog-alert/index.js";export{dialogConfirm}from"./dialog-confirm/index.js";export{dialogDrawer}from"./dialog-drawer/index.js";export{DialogDrawerContent}from"./dialog-drawer-content/index.js";export{dialogLoading}from"./dialog-loading/index.js";export{dialogModal}from"./dialog-modal/index.js";export{DragCollapse}from"./drag-collapse/index.js";export{DragCollapseFormList}from"./drag-collapse-form-list/index.js";export{DragEditableTable}from"./drag-editable-table/index.js";export{DragFormList}from"./drag-form-list/index.js";export{DragTable}from"./drag-table/index.js";export{DrawerWrapper}from"./drawer-wrapper/index.js";export{DropdownMenuWrapper}from"./dropdown-menu-wrapper/index.js";export{dynamicNode}from"./dynamic-node/index.js";export{EasyForm}from"./easy-form/index.js";export{EasyTable}from"./easy-table/index.js";export{EditableField}from"./editable-field/index.js";export{EditableFieldProvider}from"./editable-field-provider/index.js";export{EditableTable}from"./editable-table/index.js";export{EditorWrapper}from"./editor-wrapper/index.js";export{ErrorBoundaryWrapper}from"./error-boundary-wrapper/index.js";export{FbaApp}from"./fba-app/index.js";export{fbaHooks}from"./fba-hooks/index.js";export{fbaUtils}from"./fba-utils/index.js";export{FileImport}from"./file-import/index.js";export{FileSelect}from"./file-select/index.js";export{FlexLayout}from"./flex-layout/index.js";export{FormGrid}from"./form-grid/index.js";export{FormItemGroup}from"./form-item-group/index.js";export{FormItemHidden}from"./form-item-hidden/index.js";export{FormItemText}from"./form-item-text/index.js";export{FormItemWrapper}from"./form-item-wrapper/index.js";export{FormListWrapper}from"./form-list-wrapper/index.js";export{FormWrapper}from"./form-wrapper/index.js";export{Gap}from"./gap/index.js";export{IconWrapper}from"./icon-wrapper/index.js";export{InputSearchWrapper}from"./input-search-wrapper/index.js";export{InputTextAreaWrapper}from"./input-text-area-wrapper/index.js";export{InputWrapper}from"./input-wrapper/index.js";export{JsonEditor}from"./json-editor/index.js";export{LabelValueLayout}from"./label-value-layout/index.js";export{LocalLoading}from"./local-loading/index.js";export{MentionsWrapper}from"./mentions-wrapper/index.js";export{ModalAction}from"./modal-action/index.js";export{ModalWrapper}from"./modal-wrapper/index.js";export{PageFixedFooter}from"./page-fixed-footer/index.js";export{Page404}from"./page404/index.js";export{P as PaginationWrapper}from"./index-6677fbfc.js";export{Permission}from"./permission/index.js";export{preDefinedClassName}from"./pre-defined-class-name/index.js";export{RadioGroupWrapper}from"./radio-group-wrapper/index.js";export{RelationTree}from"./relation-tree/index.js";export{RequestStatus}from"./request-status/index.js";export{RichTextEditor}from"./rich-text-editor/index.js";export{RichTextViewer}from"./rich-text-viewer/index.js";export{RollLocationCenter}from"./roll-location-center/index.js";export{RollLocationInView}from"./roll-location-in-view/index.js";export{RuleDescribe}from"./rule-describe/index.js";export{SearchForm}from"./search-form/index.js";export{SearchMenu}from"./search-menu/index.js";export{SelectorWrapper}from"./selector-wrapper/index.js";export{SelectorWrapperSearch}from"./selector-wrapper-search/index.js";export{SelectorWrapperSimple}from"./selector-wrapper-simple/index.js";export{SimpleLayout}from"./simple-layout/index.js";export{SmsCountDown}from"./sms-count-down/index.js";export{SplitWrapper}from"./split-wrapper/index.js";export{styles}from"./styles/index.js";export{SvgHttpView}from"./svg-http-view/index.js";export{SwitchConfirmWrapper}from"./switch-confirm-wrapper/index.js";export{SwitchWrapper}from"./switch-wrapper/index.js";export{tableCellRender}from"./table-cell-render/index.js";export{TableScrollbar}from"./table-scrollbar/index.js";export{TableTitleTooltip}from"./table-title-tooltip/index.js";export{TabsWrapper}from"./tabs-wrapper/index.js";export{TagGroup}from"./tag-group/index.js";export{TagListSelect}from"./tag-list-select/index.js";export{TagWrapper}from"./tag-wrapper/index.js";export{TextCssEllipsis}from"./text-css-ellipsis/index.js";export{TextOverflow}from"./text-overflow/index.js";export{TextOverflowRender}from"./text-overflow-render/index.js";export{TextSymbolWrapper}from"./text-symbol-wrapper/index.js";export{TimePickerWrapper}from"./time-picker-wrapper/index.js";export{TimeRangePickerWrapper}from"./time-range-picker-wrapper/index.js";export{TimeRangePickerWrapperFormItem}from"./time-range-picker-wrapper-form-item/index.js";export{TipsTitle}from"./tips-title/index.js";export{TipsWrapper}from"./tips-wrapper/index.js";export{TreeSelectorWrapper}from"./tree-selector-wrapper/index.js";export{TreeWrapper}from"./tree-wrapper/index.js";export{UploadWrapper}from"./upload-wrapper/index.js";import"./_rollupPluginBabelHelpers-a0769acd.js";import"@dimjs/utils/cjs/class-names";import"@wove/react/cjs/hooks";import"@dimjs/lang/cjs/is-object";import"@flatbiz/utils";import"react";import"react-ace";import"./ext-language_tools-0c27f877.js";import"react/jsx-runtime";import"./mode-json-062fdb24.js";import"sql-formatter";import"antd";import"xml-formatter";import"@dimjs/utils/cjs/get";import"@dimjs/lang/cjs/is-number";import"ahooks";import"@ant-design/icons/es/icons/MoreOutlined";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/lang/cjs/is-plain-object";import"@dimjs/lang/cjs/is-string";import"@dimjs/lang/cjs/is-promise";import"@ant-design/icons/es/icons/LoadingOutlined";import"@dimjs/lang/cjs/is-array";import"@dimjs/utils/cjs/extend";import"@ant-design/icons/es/icons/RedoOutlined";import"@dimjs/model";import"@dimjs/model-react";import"@wove/react/cjs/create-ctx";import"@ant-design/icons/es/icons/CloseCircleOutlined";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"./time-53b3f55f.js";import"react-dom/client";import"./dom-4d04aa64.js";import"./context-1f2093c6.js";import"@dimjs/lang/cjs/is-null";import"@dimjs/utils/cjs/array";import"@dnd-kit/core";import"@dnd-kit/sortable";import"@ant-design/icons/es/icons/DragOutlined";import"@dnd-kit/utilities";import"@dnd-kit/modifiers";import"@ant-design/icons/es/icons/SaveOutlined";import"@ant-design/icons/es/icons/ExclamationCircleFilled";import"@ant-design/icons/es/icons/DownOutlined";import"@ant-design/icons/es/icons/UpOutlined";import"react-is";import"@ant-design/icons/es/icons/CloseOutlined";import"@ant-design/icons/es/icons/CheckOutlined";import"@ant-design/icons/es/icons/EditOutlined";import"./context-25d0b686.js";import"@ant-design/icons/es/icons/PlusOutlined";import"@dimjs/lang/cjs/is-boolean";import"@ant-design/icons/es/icons/DeleteOutlined";import"@wove/react/cjs/editor";import"./use-responsive-point-21b8c601.js";import"@dimjs/lang/cjs/is-deep-equal";import"@tinymce/tinymce-react";import"@ant-design/icons/es/icons/PlusCircleOutlined";import"@ant-design/icons/es/icons/FullscreenOutlined";import"@dimjs/utils/cjs/json";import"pubsub-js";import"react-split";import"@dimjs/lang/cjs/is-empty";import"@ant-design/icons/es/icons/QuestionCircleOutlined";import"dayjs/plugin/isSameOrAfter";import"dayjs/plugin/isSameOrBefore";import"@ant-design/icons/es/icons/CaretDownFilled";import"dequal";import"@dimjs/utils/cjs/tree";import"react-dom";
|
|
122
|
+
export{AceEditorGroovy}from"./ace-editor-groovy/index.js";export{AceEditorJava}from"./ace-editor-java/index.js";export{AceEditorJson}from"./ace-editor-json/index.js";export{AceEditorMysql}from"./ace-editor-mysql/index.js";export{AceEditorXml}from"./ace-editor-xml/index.js";export{AlertWrapper}from"./alert-wrapper/index.js";export{AmountFenInput}from"./amount-fen-input/index.js";export{AmountFenInputFormItem}from"./amount-fen-input-form-item/index.js";export{AnchorSteps}from"./anchor-steps/index.js";export{B as BlockLayout}from"./index-1f45bfd5.js";export{Bootstrap}from"./bootstrap/index.js";export{BoxGrid,useBoxBreakpoint}from"./box-grid/index.js";export{ButtonOperate,ButtonOperateItemContent}from"./button-operate/index.js";export{ButtonWrapper}from"./button-wrapper/index.js";export{CardLayout}from"./card-layout/index.js";export{CardWrapper}from"./card-wrapper/index.js";export{CascaderWrapper}from"./cascader-wrapper/index.js";export{CheckList}from"./check-list/index.js";export{CheckboxWrapper}from"./checkbox-wrapper/index.js";export{ColorPickerWrapper}from"./color-picker-wrapper/index.js";export{C as ConfigProviderWrapper}from"./index-7f4ad045.js";export{createDrawerWrapperModel}from"./create-drawer-wrapper-model/index.js";export{createModalWrapperModel}from"./create-modal-wrapper-model/index.js";export{CssNodeHover}from"./css-node-hover/index.js";export{DataRender}from"./data-render/index.js";export{DatePickerWrapper}from"./date-picker-wrapper/index.js";export{DateRangePickerWrapper}from"./date-range-picker-wrapper/index.js";export{DateRangePickerWrapperFormItem}from"./date-range-picker-wrapper-form-item/index.js";export{dialogAlert}from"./dialog-alert/index.js";export{dialogConfirm}from"./dialog-confirm/index.js";export{dialogDrawer}from"./dialog-drawer/index.js";export{DialogDrawerContent}from"./dialog-drawer-content/index.js";export{dialogLoading}from"./dialog-loading/index.js";export{dialogModal}from"./dialog-modal/index.js";export{DragCollapse}from"./drag-collapse/index.js";export{DragCollapseFormList}from"./drag-collapse-form-list/index.js";export{DragEditableTable}from"./drag-editable-table/index.js";export{DragFormList}from"./drag-form-list/index.js";export{DragTable}from"./drag-table/index.js";export{DrawerWrapper}from"./drawer-wrapper/index.js";export{DropdownMenuWrapper}from"./dropdown-menu-wrapper/index.js";export{dynamicNode}from"./dynamic-node/index.js";export{EasyForm}from"./easy-form/index.js";export{EasyTable}from"./easy-table/index.js";export{EditableField}from"./editable-field/index.js";export{EditableFieldProvider}from"./editable-field-provider/index.js";export{EditableTable}from"./editable-table/index.js";export{EditorWrapper}from"./editor-wrapper/index.js";export{ErrorBoundaryWrapper}from"./error-boundary-wrapper/index.js";export{FbaApp}from"./fba-app/index.js";export{fbaHooks}from"./fba-hooks/index.js";export{fbaUtils}from"./fba-utils/index.js";export{FileImport}from"./file-import/index.js";export{FileSelect}from"./file-select/index.js";export{FlexLayout}from"./flex-layout/index.js";export{FormGrid}from"./form-grid/index.js";export{FormItemGroup}from"./form-item-group/index.js";export{FormItemHidden}from"./form-item-hidden/index.js";export{FormItemText}from"./form-item-text/index.js";export{FormItemWrapper}from"./form-item-wrapper/index.js";export{FormListWrapper}from"./form-list-wrapper/index.js";export{FormWrapper}from"./form-wrapper/index.js";export{Gap}from"./gap/index.js";export{IconWrapper}from"./icon-wrapper/index.js";export{InputSearchWrapper}from"./input-search-wrapper/index.js";export{InputTextAreaWrapper}from"./input-text-area-wrapper/index.js";export{InputWrapper}from"./input-wrapper/index.js";export{JsonEditor}from"./json-editor/index.js";export{LabelValueLayout}from"./label-value-layout/index.js";export{LocalLoading}from"./local-loading/index.js";export{MetionEditor}from"./mention-editor/index.js";export{MentionsWrapper}from"./mentions-wrapper/index.js";export{ModalAction}from"./modal-action/index.js";export{ModalWrapper}from"./modal-wrapper/index.js";export{PageFixedFooter}from"./page-fixed-footer/index.js";export{Page404}from"./page404/index.js";export{P as PaginationWrapper}from"./index-6677fbfc.js";export{Permission}from"./permission/index.js";export{preDefinedClassName}from"./pre-defined-class-name/index.js";export{RadioGroupWrapper}from"./radio-group-wrapper/index.js";export{RelationTree}from"./relation-tree/index.js";export{RequestStatus}from"./request-status/index.js";export{RichTextEditor}from"./rich-text-editor/index.js";export{RichTextViewer}from"./rich-text-viewer/index.js";export{RollLocationCenter}from"./roll-location-center/index.js";export{RollLocationInView}from"./roll-location-in-view/index.js";export{RuleDescribe}from"./rule-describe/index.js";export{SearchForm}from"./search-form/index.js";export{SearchMenu}from"./search-menu/index.js";export{SelectorWrapper}from"./selector-wrapper/index.js";export{SelectorWrapperSearch}from"./selector-wrapper-search/index.js";export{SelectorWrapperSimple}from"./selector-wrapper-simple/index.js";export{SimpleLayout}from"./simple-layout/index.js";export{SmsCountDown}from"./sms-count-down/index.js";export{SplitWrapper}from"./split-wrapper/index.js";export{styles}from"./styles/index.js";export{SvgHttpView}from"./svg-http-view/index.js";export{SwitchConfirmWrapper}from"./switch-confirm-wrapper/index.js";export{SwitchWrapper}from"./switch-wrapper/index.js";export{tableCellRender}from"./table-cell-render/index.js";export{TableScrollbar}from"./table-scrollbar/index.js";export{TableTitleTooltip}from"./table-title-tooltip/index.js";export{TabsWrapper}from"./tabs-wrapper/index.js";export{TagGroup}from"./tag-group/index.js";export{TagListSelect}from"./tag-list-select/index.js";export{TagWrapper}from"./tag-wrapper/index.js";export{TextCssEllipsis}from"./text-css-ellipsis/index.js";export{TextOverflow}from"./text-overflow/index.js";export{TextOverflowRender}from"./text-overflow-render/index.js";export{TextSymbolWrapper}from"./text-symbol-wrapper/index.js";export{TimePickerWrapper}from"./time-picker-wrapper/index.js";export{TimeRangePickerWrapper}from"./time-range-picker-wrapper/index.js";export{TimeRangePickerWrapperFormItem}from"./time-range-picker-wrapper-form-item/index.js";export{TipsTitle}from"./tips-title/index.js";export{TipsWrapper}from"./tips-wrapper/index.js";export{TreeSelectorWrapper}from"./tree-selector-wrapper/index.js";export{TreeWrapper}from"./tree-wrapper/index.js";export{UploadWrapper}from"./upload-wrapper/index.js";import"./_rollupPluginBabelHelpers-a0769acd.js";import"@dimjs/utils/cjs/class-names";import"@wove/react/cjs/hooks";import"@dimjs/lang/cjs/is-object";import"@flatbiz/utils";import"react";import"react-ace";import"./ext-language_tools-0c27f877.js";import"react/jsx-runtime";import"./mode-json-062fdb24.js";import"sql-formatter";import"antd";import"xml-formatter";import"@dimjs/utils/cjs/get";import"@dimjs/lang/cjs/is-number";import"ahooks";import"@ant-design/icons/es/icons/MoreOutlined";import"@dimjs/lang/cjs/is-undefined";import"@dimjs/lang/cjs/is-plain-object";import"@dimjs/lang/cjs/is-string";import"@dimjs/lang/cjs/is-promise";import"@ant-design/icons/es/icons/LoadingOutlined";import"@dimjs/lang/cjs/is-array";import"@dimjs/utils/cjs/extend";import"@ant-design/icons/es/icons/RedoOutlined";import"@dimjs/model";import"@dimjs/model-react";import"@wove/react/cjs/create-ctx";import"@ant-design/icons/es/icons/CloseCircleOutlined";import"antd/es/locale/en_US";import"antd/es/locale/zh_CN";import"dayjs";import"dayjs/locale/en";import"dayjs/locale/zh-cn";import"dayjs/plugin/advancedFormat";import"dayjs/plugin/customParseFormat";import"dayjs/plugin/localeData";import"dayjs/plugin/utc";import"dayjs/plugin/weekday";import"dayjs/plugin/weekOfYear";import"dayjs/plugin/weekYear";import"./time-53b3f55f.js";import"react-dom/client";import"./dom-4d04aa64.js";import"./context-1f2093c6.js";import"@dimjs/lang/cjs/is-null";import"@dimjs/utils/cjs/array";import"@dnd-kit/core";import"@dnd-kit/sortable";import"@ant-design/icons/es/icons/DragOutlined";import"@dnd-kit/utilities";import"@dnd-kit/modifiers";import"@ant-design/icons/es/icons/SaveOutlined";import"@ant-design/icons/es/icons/ExclamationCircleFilled";import"@ant-design/icons/es/icons/DownOutlined";import"@ant-design/icons/es/icons/UpOutlined";import"react-is";import"@ant-design/icons/es/icons/CloseOutlined";import"@ant-design/icons/es/icons/CheckOutlined";import"@ant-design/icons/es/icons/EditOutlined";import"./context-25d0b686.js";import"@ant-design/icons/es/icons/PlusOutlined";import"@dimjs/lang/cjs/is-boolean";import"@ant-design/icons/es/icons/DeleteOutlined";import"@wove/react/cjs/editor";import"./use-responsive-point-21b8c601.js";import"@dimjs/lang/cjs/is-deep-equal";import"@flatbiz/antd";import"@tinymce/tinymce-react";import"@ant-design/icons/es/icons/PlusCircleOutlined";import"@ant-design/icons/es/icons/FullscreenOutlined";import"@dimjs/utils/cjs/json";import"pubsub-js";import"react-split";import"@dimjs/lang/cjs/is-empty";import"@ant-design/icons/es/icons/QuestionCircleOutlined";import"dayjs/plugin/isSameOrAfter";import"dayjs/plugin/isSameOrBefore";import"@ant-design/icons/es/icons/CaretDownFilled";import"dequal";import"@dimjs/utils/cjs/tree";import"react-dom";
|
|
122
123
|
//# sourceMappingURL=index.js.map
|
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import './index.css';
|
|
3
|
+
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
4
|
+
import{a as r,_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{hooks as n}from"@wove/react/cjs/hooks";import{Flex as t,Button as o}from"antd";import{useRef as a,useMemo as i}from"react";import{MentionsWrapper as l}from"../mentions-wrapper/index.js";import{jsxs as u,jsx as c}from"react/jsx-runtime";import"@flatbiz/antd";import"@flatbiz/utils";import"ahooks";var f=["prefix","operations"];var p=function p(v){var s=a({});var m=a();var d=a(0);var h=v.prefix,g=v.operations,x=g===void 0?[]:g,C=r(v,f);var b=function r(e){var n=v.value||"";var t=(P==null?void 0:P.selectionStart)||d.current;var o=(e.codeAdapter==null?void 0:e.codeAdapter())||""+e.codePrefix+B(e.codePrefix);var a=o.length+((h==null?void 0:h.length)||0)+2;if(n){n=n.slice(0,t)+k(o)+n.slice(t)}else{n=k(o)}v.onChange==null?void 0:v.onChange(n);if(v.onSelectParam){v.onSelectParam({code:o,type:e.type,value:undefined},h)}d.current+=a};var y=function r(e){var n;d.current=((n=v.value)==null?void 0:n.length)||0;if(v.onBlur){v.onBlur(e)}};var k=n.useCallbackRef((function(r){return(h||"")+"{"+r+"}"}));var B=n.useCallbackRef((function(r){var e=s.current;if(e[r]>=0){e[r]+=1}else{e[r]=0}return e[r]}));var P=i((function(){return m.current?m.current.getInputInstance():null}),[m.current]);var j=i((function(){var r=(v.params||[]).map((function(r){return k(r.code)}));var e=new Set(r);return Array.from(e)}),[v.params]);return u("div",{children:[x&&x.length>0&&c(t,{gap:4,style:{marginBottom:8},children:x.map((function(r){return c(o,{type:"text",icon:r.icon,onClick:function e(){return b(r)},children:r.label&&c("span",{children:r.label})},r.type)}))}),c(l,e({},C,{ref:m,prefix:h,options:j,value:v.value,onBlur:y,onChange:v.onChange,onCursorChange:function r(e){d.current=e}}))]})};export{p as MetionEditor};
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/mention-editor/metion-editor.tsx"],"sourcesContent":["import { type TAny } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { Button, Flex } from 'antd';\nimport { useMemo, useRef, type ReactElement } from 'react';\nimport { MentionsWrapper, type MentionsWrapperProps } from '../mentions-wrapper/mentions';\nimport { type ParamItem } from './types';\n\nexport type OperationPresetProps = {\n /** icon */\n icon: ReactElement;\n /** 模版参数文案 */\n label?: string;\n /** 模版参数类型 */\n type: string;\n /** 自增code前缀 */\n codePrefix: string;\n /** 自定义生成模版参数code */\n codeAdapter?: () => string | undefined;\n};\n\nexport type MetionEditorProps = Omit<MentionsWrapperProps, 'prefix'> & {\n /**\n * onChange\n * @item 点击的预设模版参数\n */\n onSelectParam?: (item: ParamItem, prefix?: string) => void;\n /** 模版参数前缀 & | $ */\n prefix?: string;\n /** editor 支持添加的模版参数类型 */\n operations?: OperationPresetProps[];\n /** 模版参数列表 */\n params?: ParamItem[] | undefined;\n};\n\n/**\n * 基于MetionWrapper封装的模版字符串配置组件\n * 1. 提供变量,数字,链接等可选的模版参数\n * 2. 不同类型模版参数可配置多个\n * 3. mention 会根据 传入的params自动推断出关键字\n * 4. 模版参数建议都以${_xxx}为格式\n * 5. Demo: https://fex.qa.tcshuke.com/docs/admin/main/widget?key=mention-editor\n */\nexport const MetionEditor = (props: MetionEditorProps) => {\n const iMap = useRef<Record<string, number>>({});\n const mentionRef = useRef<TAny>();\n const curPosition = useRef<number>(0);\n\n const { prefix, operations = [], ...otherProps } = props;\n\n const onAddParam = (opt: OperationPresetProps) => {\n let content = props.value || '';\n const position = inputInstance?.selectionStart || curPosition.current;\n const param = opt.codeAdapter?.() || `${opt.codePrefix}${getIndex(opt.codePrefix)}`;\n const addPos = param.length + (prefix?.length || 0) + 2;\n if (content) {\n content = content.slice(0, position) + getOptionCode(param) + content.slice(position);\n } else {\n content = getOptionCode(param);\n }\n props.onChange?.(content);\n if (props.onSelectParam) {\n props.onSelectParam(\n {\n code: param,\n type: opt.type as any,\n value: undefined,\n },\n prefix,\n );\n }\n curPosition.current += addPos;\n };\n\n const onInputBlur = (e) => {\n curPosition.current = props.value?.length || 0;\n if (props.onBlur) {\n props.onBlur(e);\n }\n };\n\n const getOptionCode = hooks.useCallbackRef((code: string) => {\n return (prefix || '') + '{' + code + '}';\n });\n\n const getIndex = hooks.useCallbackRef((code) => {\n const indexMap = iMap.current;\n if (indexMap[code] >= 0) {\n indexMap[code] += 1;\n } else {\n indexMap[code] = 0;\n }\n return indexMap[code];\n });\n\n const inputInstance = useMemo(() => {\n return mentionRef.current ? mentionRef.current.getInputInstance() : null;\n }, [mentionRef.current]);\n\n const options = useMemo(() => {\n const options = (props.params || []).map((item) => getOptionCode(item.code));\n const optionSet = new Set(options);\n return Array.from(optionSet);\n }, [props.params]);\n\n return (\n <div>\n {operations && operations.length > 0 && (\n <Flex gap={4} style={{ marginBottom: 8 }}>\n {operations.map((operation) => {\n return (\n <Button\n key={operation.type}\n type=\"text\"\n icon={operation.icon}\n onClick={() => onAddParam(operation)}\n >\n {operation.label && <span>{operation.label}</span>}\n </Button>\n );\n })}\n </Flex>\n )}\n <MentionsWrapper\n {...otherProps}\n ref={mentionRef}\n prefix={prefix}\n options={options}\n value={props.value}\n onBlur={onInputBlur}\n onChange={props.onChange}\n onCursorChange={(position) => {\n curPosition.current = position;\n }}\n />\n </div>\n );\n};\n"],"names":["MetionEditor","props","iMap","useRef","mentionRef","curPosition","prefix","_props$operations","operations","otherProps","_objectWithoutPropertiesLoose","_excluded","onAddParam","opt","content","value","position","inputInstance","selectionStart","current","param","codeAdapter","codePrefix","getIndex","addPos","length","slice","getOptionCode","onChange","onSelectParam","code","type","undefined","onInputBlur","e","_props$value","onBlur","_hooks","useCallbackRef","indexMap","useMemo","getInputInstance","options","params","map","item","optionSet","Set","Array","from","_jsxs","children","_jsx","Flex","gap","style","marginBottom","operation","Button","icon","onClick","label","MentionsWrapper","_extends","ref","onCursorChange"],"mappings":";qZA0CaA,EAAe,SAAfA,EAAgBC,GAC3B,IAAMC,EAAOC,EAA+B,CAAA,GAC5C,IAAMC,EAAaD,IACnB,IAAME,EAAcF,EAAe,GAEnC,IAAQG,EAA2CL,EAA3CK,OAAMC,EAAqCN,EAAnCO,WAAAA,EAAUD,SAAG,EAAA,GAAEA,EAAKE,EAAUC,EAAKT,EAAKU,GAExD,IAAMC,EAAa,SAAbA,EAAcC,GAClB,IAAIC,EAAUb,EAAMc,OAAS,GAC7B,IAAMC,GAAWC,GAAa,UAAA,EAAbA,EAAeC,iBAAkBb,EAAYc,QAC9D,IAAMC,GAAQP,EAAIQ,aAAW,UAAA,EAAfR,EAAIQ,gBAAsBR,GAAAA,EAAIS,WAAaC,EAASV,EAAIS,YACtE,IAAME,EAASJ,EAAMK,SAAUnB,GAAAA,UAAAA,EAAAA,EAAQmB,SAAU,GAAK,EACtD,GAAIX,EAAS,CACXA,EAAUA,EAAQY,MAAM,EAAGV,GAAYW,EAAcP,GAASN,EAAQY,MAAMV,EAC9E,KAAO,CACLF,EAAUa,EAAcP,EAC1B,CACAnB,EAAM2B,UAAN3B,UAAAA,EAAAA,EAAM2B,SAAWd,GACjB,GAAIb,EAAM4B,cAAe,CACvB5B,EAAM4B,cACJ,CACEC,KAAMV,EACNW,KAAMlB,EAAIkB,KACVhB,MAAOiB,WAET1B,EAEJ,CACAD,EAAYc,SAAWK,GAGzB,IAAMS,EAAc,SAAdA,EAAeC,GAAM,IAAAC,EACzB9B,EAAYc,UAAUgB,EAAAlC,EAAMc,QAANoB,UAAAA,EAAAA,EAAaV,SAAU,EAC7C,GAAIxB,EAAMmC,OAAQ,CAChBnC,EAAMmC,OAAOF,EACf,GAGF,IAAMP,EAAgBU,EAAMC,gBAAe,SAACR,GAC1C,OAAQxB,GAAU,IAAM,IAAMwB,EAAO,GACvC,IAEA,IAAMP,EAAWc,EAAMC,gBAAe,SAACR,GACrC,IAAMS,EAAWrC,EAAKiB,QACtB,GAAIoB,EAAST,IAAS,EAAG,CACvBS,EAAST,IAAS,CACpB,KAAO,CACLS,EAAST,GAAQ,CACnB,CACA,OAAOS,EAAST,EAClB,IAEA,IAAMb,EAAgBuB,GAAQ,WAC5B,OAAOpC,EAAWe,QAAUf,EAAWe,QAAQsB,mBAAqB,IACtE,GAAG,CAACrC,EAAWe,UAEf,IAAMuB,EAAUF,GAAQ,WACtB,IAAME,GAAWzC,EAAM0C,QAAU,IAAIC,KAAI,SAACC,GAAI,OAAKlB,EAAckB,EAAKf,SACtE,IAAMgB,EAAY,IAAIC,IAAIL,GAC1B,OAAOM,MAAMC,KAAKH,EACpB,GAAG,CAAC7C,EAAM0C,SAEV,OACEO,EAAA,MAAA,CAAAC,SAAA,CACG3C,GAAcA,EAAWiB,OAAS,GACjC2B,EAACC,EAAI,CAACC,IAAK,EAAGC,MAAO,CAAEC,aAAc,GAAIL,SACtC3C,EAAWoC,KAAI,SAACa,GACf,OACEL,EAACM,EAAM,CAEL3B,KAAK,OACL4B,KAAMF,EAAUE,KAChBC,QAAS,SAAAA,IAAA,OAAMhD,EAAW6C,EAAW,EAAAN,SAEpCM,EAAUI,OAAST,EAAA,OAAA,CAAAD,SAAOM,EAAUI,SALhCJ,EAAU1B,WAWzBqB,EAACU,EAAeC,KACVtD,EAAU,CACduD,IAAK5D,EACLE,OAAQA,EACRoC,QAASA,EACT3B,MAAOd,EAAMc,MACbqB,OAAQH,EACRL,SAAU3B,EAAM2B,SAChBqC,eAAgB,SAAAA,EAACjD,GACfX,EAAYc,QAAUH,CACxB,OAIR"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import './../fba-hooks/index.css';
|
|
3
2
|
import './index.css';
|
|
4
3
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
5
|
-
import{a as r,_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{hooks as n}from"@wove/react/cjs/hooks";import{
|
|
4
|
+
import{a as r,_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{hooks as n}from"@wove/react/cjs/hooks";import{fbaHooks as t}from"@flatbiz/antd";import{toArray as o}from"@flatbiz/utils";import{useEventListener as i}from"ahooks";import{Mentions as a}from"antd";import{forwardRef as l,useRef as u,useState as s,useMemo as v,useImperativeHandle as c}from"react";import{jsx as f}from"react/jsx-runtime";var d=function r(e){if(!e.value||!e.overallKeyWords.length)return[];var n=Array.from(new Set(e.overallKeyWords||[]));var t=[];n.forEach((function(r){var n;if(!((n=e.value)!=null&&n.includes(r)))return;var o=r.replace(/\$/g,"\\$").replace(/\{/g,"\\{").replace(/\}/g,"\\}").replace(/\]/g,"\\]").replace(/\[/g,"\\[");var i=new RegExp(o,"g");var a=[];var l;while((l=i.exec(e.value))!==null){a.push(l.index)}var u=[];a.forEach((function(e){u.push({start:e+1,end:e+r.length})}));t.push(u)}));return t};var g=function r(e){for(var n=0;n<e.keyWordsPosition.length;n++){var t=e.keyWordsPosition[n].find((function(r){return e.cursorPosition>=r.start&&e.cursorPosition<r.end}));if(t)return t}return undefined};var p=["value","onChange","onClick","onCursorChange","onSelect","options","prefix"];var h=l((function(l,h){var m=l.value,k=l.onChange,S=l.onClick,y=l.onCursorChange,P=l.onSelect,w=l.options,C=l.prefix,R=r(l,p);var W=n.useId(undefined,"overall-input");var b=u();var x=s(0),A=x[0],E=x[1];var j=u(false);var I=m||"";var K=v((function(){if(w){return d({overallKeyWords:w||[],value:I})}return[]}),[w,I]);var q=function r(){var e;return(e=b.current)==null?void 0:e.textarea};t.useEffectCustom((function(){y==null?void 0:y(A||0)}),[A]);i("keydown",(function(r){var e,n;var t=(e=q())==null?void 0:e.selectionStart;var o=(n=q())==null?void 0:n.selectionEnd;if(["ArrowLeft","ArrowRight"].includes(r.code)){var i=0;if(r.code==="ArrowLeft"){if(t-1<0)return;i=t-1;E(i);var a=g({keyWordsPosition:K,cursorPosition:i});if(a){var l;(l=q())==null?void 0:l.setSelectionRange(a.start,a.start)}}else if(r.code==="ArrowRight"){if(t+1>I.length)return;i=t+1;E(i);var u=g({keyWordsPosition:K,cursorPosition:i});if(u){var s;(s=q())==null?void 0:s.setSelectionRange(u.end-1,u.end-1)}}}else if(r.code==="Backspace"){if(t!==o){return}var v=g({keyWordsPosition:K,cursorPosition:t-1});if(v){j.current=true;var c=I.substring(0,v.start-1)+I.substring(v.end);setTimeout((function(){var r;(r=q())==null?void 0:r.setSelectionRange(v.start-1,v.start-1)}),50);if(!c){j.current=false}k==null?void 0:k(c)}}}),{target:function r(){return document.querySelector("#"+W)}});i("keyup",(function(r){var e;var n=((e=q())==null?void 0:e.selectionStart)||0;if(["ArrowUp","ArrowDown"].includes(r.code)){E(n);var t=g({keyWordsPosition:K,cursorPosition:n});if(t){if(n-t.start<t.end-n){var o;(o=q())==null?void 0:o.setSelectionRange(t.start-1,t.start-1)}else{var i;(i=q())==null?void 0:i.setSelectionRange(t.end,t.end)}}}}),{target:function r(){return document.querySelector("#"+W)}});var z=n.useCallbackRef((function(r){var e;if(R.disabled)return;if(j.current){j.current=false;return}var n=((e=q())==null?void 0:e.selectionStart)||0;E(n);k==null?void 0:k(r)}));var B=n.useCallbackRef((function(r){var e;var n=((e=q())==null?void 0:e.selectionStart)||0;E(n);S==null?void 0:S(r.target.value);var t=g({keyWordsPosition:K,cursorPosition:n});if(t){if(n-t.start<t.end-n){var o;(o=q())==null?void 0:o.setSelectionRange(t.start-1,t.start-1)}else{var i;(i=q())==null?void 0:i.setSelectionRange(t.end,t.end)}}}));var L=function r(e,n){var t;var o=((t=e.value)==null?void 0:t.length)||0;E((function(r){return r+o}));if(P){P(e,n)}};var $=v((function(){var r=o(C);return(w==null?void 0:w.map((function(e){var n=e;for(var t=0;t<r.length;t++){var o=r[t];if(n.startsWith(o)){n=n.replace(o,"");break}}return{label:n,value:n}})))||[]}),[w,C]);c(h,(function(){return{getInputInstance:q}}));return f(a,e({notFoundContent:f("div",{children:"暂无数据"}),rows:3},R,{prefix:C,style:e({width:"100%"},R.style),id:W,value:I,ref:b,onSelect:L,onChange:z,onClick:B,split:"",validateSearch:function r(e){if(!$.length)return false;var n=$.find((function(r){return e.indexOf(r.value)>=0}));return n&&e.length>n.value.length?false:true},options:$}))}));export{h as MentionsWrapper};
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/mentions-wrapper/utils.ts","@flatbiz/antd/src/mentions-wrapper/mentions.tsx"],"sourcesContent":["import { type OverallKeyWordsPosition } from './types';\n\nexport const getOverallKeyWordsPosition = (params: { overallKeyWords: string[]; value?: string }) => {\n if (!params.value || !params.overallKeyWords.length) return [];\n const overallKeyWordsNew = Array.from(new Set(params.overallKeyWords || []));\n const positionItem: OverallKeyWordsPosition[][] = [];\n overallKeyWordsNew.forEach((item) => {\n if (!params.value?.includes(item)) return;\n const newItem = item\n .replace(/\\$/g, '\\\\$')\n .replace(/\\{/g, '\\\\{')\n .replace(/\\}/g, '\\\\}')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\[/g, '\\\\[');\n const regex = new RegExp(newItem, 'g');\n const positions: number[] = [];\n let match;\n // console.log\n while ((match = regex.exec(params.value)) !== null) {\n positions.push(match.index as number);\n }\n const innerList: OverallKeyWordsPosition[] = [];\n positions.forEach((temp) => {\n innerList.push({ start: temp + 1, end: temp + item.length });\n });\n positionItem.push(innerList);\n });\n return positionItem;\n};\n\n/**\n * 判断光标是否处在关键词位置内\n */\nexport const judgmentCursorInKeyWordsPosition = (params: {\n keyWordsPosition: OverallKeyWordsPosition[][];\n cursorPosition: number;\n}) => {\n for (let index = 0; index < params.keyWordsPosition.length; index++) {\n const element = params.keyWordsPosition[index].find((temp) => {\n return params.cursorPosition >= temp.start && params.cursorPosition < temp.end;\n });\n if (element) return element;\n }\n return undefined;\n};\n","import { toArray, type TAny } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { useEventListener } from 'ahooks';\nimport { Mentions, type MentionProps } from 'antd';\nimport { useMemo, useRef, useState } from 'react';\nimport { fbaHooks } from '../fba-hooks';\nimport { getOverallKeyWordsPosition, judgmentCursorInKeyWordsPosition } from './utils';\n\nexport type MentionsWrapperProps = Omit<\n MentionProps,\n | 'value'\n | 'onChange'\n | 'onClick'\n | 'onCursorChange'\n | 'options'\n | 'id'\n | 'split'\n | 'validateSearch'\n | 'ref'\n | 'prefix'\n> & {\n value?: string;\n onChange?: (value?: string) => void;\n /** 设置列表提示关键字,例如:@、$等 */\n prefix?: string | string[];\n onClick?: (value?: string) => void;\n /** 光标移动回调 */\n onCursorChange?: (position: number) => void;\n /**\n * 输入框内整体关键词列表\n * ```\n * 整体关键词交互\n * 1. 光标可整体移动\n * 2. 光标不会存在关键词内部\n * 3. 删除时,整体删除\n * ```\n */\n options?: string[];\n};\n\n/**\n * 基于Antd Mentions进行二次封装,可实现输入内关键字整体控制,包括光标移动、关键词删除等\n * ```\n * 可实现\n * 1. 控制光标输入\n * 2. 可设置关键词,光标不会出现在关键词内部\n * 3. 可整体删除关键词\n *\n * 应用场景例如:\n * 1. 公式输入\n * (【xx金额1】+【xx金额2】)*2\n * <MentionsWrapper prefix=\"$\" options={['【xx金额1】', '【xx金额2】']}/>\n *\n * 2. 短信模板设置\n * 您的订单号为${订单号},订单交易时间为${订单时间}\n * <MentionsWrapper prefix=\"$\" options={['${订单号}', '${订单时间}']}/>\n *\n * demo:https://fex.qa.tcshuke.com/docs/admin/main/other/widget\n * ```\n *\n */\nexport const MentionsWrapper = (props: MentionsWrapperProps) => {\n const { value, onChange, onClick, onCursorChange, options, prefix, ...otherProps } = props;\n const id = hooks.useId(undefined, 'overall-input');\n const inputInnerRef = useRef<TAny>();\n const [cursorPosition, setCursorPosition] = useState(0);\n const invalidOnChangeRef = useRef(false);\n const valueNew = value || '';\n /** 关键词位置 */\n const overallKeyWordsPosition = useMemo(() => {\n if (options) {\n return getOverallKeyWordsPosition({\n overallKeyWords: options || [],\n value: valueNew,\n });\n }\n return [];\n }, [options, valueNew]);\n\n const getInputInstance = () => {\n return inputInnerRef.current?.textarea;\n };\n\n fbaHooks.useEffectCustom(() => {\n onCursorChange?.(cursorPosition || 0);\n }, [cursorPosition]);\n\n useEventListener(\n 'keydown',\n (ev) => {\n const selectionStart = getInputInstance()?.selectionStart as number;\n if (['ArrowLeft', 'ArrowRight'].includes(ev.code)) {\n let positionValue = 0;\n if (ev.code === 'ArrowLeft') {\n if (selectionStart - 1 < 0) return;\n positionValue = selectionStart - 1;\n setCursorPosition(positionValue);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: positionValue,\n });\n if (targret) {\n getInputInstance()?.setSelectionRange(targret.start, targret.start);\n }\n } else if (ev.code === 'ArrowRight') {\n if (selectionStart + 1 > valueNew.length) return;\n positionValue = selectionStart + 1;\n setCursorPosition(positionValue);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: positionValue,\n });\n if (targret) {\n getInputInstance()?.setSelectionRange(targret.end - 1, targret.end - 1);\n }\n }\n } else if (ev.code === 'Backspace') {\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: selectionStart - 1,\n });\n if (targret) {\n invalidOnChangeRef.current = true;\n const result = valueNew.substring(0, targret.start - 1) + valueNew.substring(targret.end);\n setTimeout(() => {\n getInputInstance()?.setSelectionRange(targret.start - 1, targret.start - 1);\n }, 50);\n if (!result) {\n invalidOnChangeRef.current = false;\n }\n onChange?.(result);\n }\n }\n },\n {\n target: () => {\n return document.querySelector(`#${id}`);\n },\n },\n );\n useEventListener(\n 'keyup',\n (ev) => {\n const selectionStart = getInputInstance()?.selectionStart || 0;\n if (['ArrowUp', 'ArrowDown'].includes(ev.code)) {\n setCursorPosition(selectionStart);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: selectionStart,\n });\n if (targret) {\n if (selectionStart - targret.start < targret.end - selectionStart) {\n getInputInstance()?.setSelectionRange(targret.start - 1, targret.start - 1);\n } else {\n getInputInstance()?.setSelectionRange(targret.end, targret.end);\n }\n }\n }\n },\n {\n target: () => {\n return document.querySelector(`#${id}`);\n },\n },\n );\n\n const onInputChange = hooks.useCallbackRef((value) => {\n if (otherProps.disabled) return;\n if (invalidOnChangeRef.current) {\n invalidOnChangeRef.current = false;\n return;\n }\n const selectionStart = getInputInstance()?.selectionStart || 0;\n setCursorPosition(selectionStart);\n onChange?.(value);\n });\n\n const onInputClick = hooks.useCallbackRef((event) => {\n const selectionStart = getInputInstance()?.selectionStart || 0;\n setCursorPosition(selectionStart);\n onClick?.(event.target.value);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: selectionStart,\n });\n if (targret) {\n if (selectionStart - targret.start < targret.end - selectionStart) {\n getInputInstance()?.setSelectionRange(targret.start - 1, targret.start - 1);\n } else {\n getInputInstance()?.setSelectionRange(targret.end, targret.end);\n }\n }\n });\n\n const mentionOptions = useMemo(() => {\n const prefixList = toArray<string>(prefix);\n return (\n options?.map((item) => {\n let opValue = item;\n for (let index = 0; index < prefixList.length; index++) {\n const element = prefixList[index];\n if (opValue.startsWith(element)) {\n opValue = opValue.replace(element, '');\n break;\n }\n }\n return { label: opValue, value: opValue };\n }) || []\n );\n }, [options, prefix]);\n\n return (\n <Mentions\n notFoundContent={<div>暂无数据</div>}\n rows={3}\n {...otherProps}\n prefix={prefix}\n style={{ width: '100%', ...otherProps.style }}\n id={id}\n value={valueNew}\n ref={inputInnerRef}\n onChange={onInputChange}\n onClick={onInputClick}\n split=\"\"\n validateSearch={(text: string) => {\n if (!mentionOptions.length) return false;\n const target = mentionOptions.find((item) => text.indexOf(item.value) >= 0);\n return target && text.length > target.value.length ? false : true;\n }}\n options={mentionOptions}\n />\n );\n};\n"],"names":["getOverallKeyWordsPosition","params","value","overallKeyWords","length","overallKeyWordsNew","Array","from","Set","positionItem","forEach","item","_params$value","includes","newItem","replace","regex","RegExp","positions","match","exec","push","index","innerList","temp","start","end","judgmentCursorInKeyWordsPosition","keyWordsPosition","element","find","cursorPosition","undefined","MentionsWrapper","props","onChange","onClick","onCursorChange","options","prefix","otherProps","_objectWithoutPropertiesLoose","_excluded","id","_hooks","useId","inputInnerRef","useRef","_useState","useState","setCursorPosition","invalidOnChangeRef","valueNew","overallKeyWordsPosition","useMemo","getInputInstance","_inputInnerRef$curren","current","textarea","fbaHooks","useEffectCustom","useEventListener","ev","_getInputInstance","selectionStart","code","positionValue","targret","_getInputInstance2","setSelectionRange","_getInputInstance3","result","substring","setTimeout","_getInputInstance4","target","document","querySelector","_getInputInstance5","_getInputInstance6","_getInputInstance7","onInputChange","useCallbackRef","_getInputInstance8","disabled","onInputClick","event","_getInputInstance9","_getInputInstance10","_getInputInstance11","mentionOptions","prefixList","toArray","map","opValue","startsWith","label","_jsx","Mentions","_extends","notFoundContent","children","rows","style","width","ref","split","validateSearch","text","indexOf"],"mappings":";qcAEO,IAAMA,EAA6B,SAA7BA,EAA8BC,GACzC,IAAKA,EAAOC,QAAUD,EAAOE,gBAAgBC,OAAQ,MAAO,GAC5D,IAAMC,EAAqBC,MAAMC,KAAK,IAAIC,IAAIP,EAAOE,iBAAmB,KACxE,IAAMM,EAA4C,GAClDJ,EAAmBK,SAAQ,SAACC,GAAS,IAAAC,EACnC,MAAIA,EAACX,EAAOC,QAAPU,MAAAA,EAAcC,SAASF,IAAO,OACnC,IAAMG,EAAUH,EACbI,QAAQ,MAAO,OACfA,QAAQ,MAAO,OACfA,QAAQ,MAAO,OACfA,QAAQ,MAAO,OACfA,QAAQ,MAAO,OAClB,IAAMC,EAAQ,IAAIC,OAAOH,EAAS,KAClC,IAAMI,EAAsB,GAC5B,IAAIC,EAEJ,OAAQA,EAAQH,EA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OzE,MAAME,OAAS,MAAQ,IAC7D,EACFkC,QAASoD,IAGf"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/mentions-wrapper/utils.ts","@flatbiz/antd/src/mentions-wrapper/mentions.tsx"],"sourcesContent":["import { type OverallKeyWordsPosition } from './types';\n\nexport const getOverallKeyWordsPosition = (params: { overallKeyWords: string[]; value?: string }) => {\n if (!params.value || !params.overallKeyWords.length) return [];\n const overallKeyWordsNew = Array.from(new Set(params.overallKeyWords || []));\n const positionItem: OverallKeyWordsPosition[][] = [];\n overallKeyWordsNew.forEach((item) => {\n if (!params.value?.includes(item)) return;\n const newItem = item\n .replace(/\\$/g, '\\\\$')\n .replace(/\\{/g, '\\\\{')\n .replace(/\\}/g, '\\\\}')\n .replace(/\\]/g, '\\\\]')\n .replace(/\\[/g, '\\\\[');\n const regex = new RegExp(newItem, 'g');\n const positions: number[] = [];\n let match;\n // console.log\n while ((match = regex.exec(params.value)) !== null) {\n positions.push(match.index as number);\n }\n const innerList: OverallKeyWordsPosition[] = [];\n positions.forEach((temp) => {\n innerList.push({ start: temp + 1, end: temp + item.length });\n });\n positionItem.push(innerList);\n });\n return positionItem;\n};\n\n/**\n * 判断光标是否处在关键词位置内\n */\nexport const judgmentCursorInKeyWordsPosition = (params: {\n keyWordsPosition: OverallKeyWordsPosition[][];\n cursorPosition: number;\n}) => {\n for (let index = 0; index < params.keyWordsPosition.length; index++) {\n const element = params.keyWordsPosition[index].find((temp) => {\n return params.cursorPosition >= temp.start && params.cursorPosition < temp.end;\n });\n if (element) return element;\n }\n return undefined;\n};\n","import { fbaHooks } from '@flatbiz/antd';\nimport { toArray, type TAny } from '@flatbiz/utils';\nimport { hooks } from '@wove/react';\nimport { useEventListener } from 'ahooks';\nimport { Mentions, type MentionProps } from 'antd';\nimport { forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { getOverallKeyWordsPosition, judgmentCursorInKeyWordsPosition } from './utils';\n\nexport type MentionsWrapperRef = {\n getInputInstance: () => any;\n};\nexport type MentionsWrapperProps = Omit<\n MentionProps,\n | 'value'\n | 'onChange'\n | 'onClick'\n | 'onCursorChange'\n | 'options'\n | 'id'\n | 'split'\n | 'validateSearch'\n | 'ref'\n | 'prefix'\n> & {\n value?: string;\n onChange?: (value?: string) => void;\n /** 设置列表提示关键字,例如:@、$等 */\n prefix?: string | string[];\n onClick?: (value?: string) => void;\n /** 光标移动回调 */\n onCursorChange?: (position: number) => void;\n /**\n * 输入框内整体关键词列表\n * ```\n * 整体关键词交互\n * 1. 光标可整体移动\n * 2. 光标不会存在关键词内部\n * 3. 删除时,整体删除\n * ```\n */\n options?: string[];\n};\n\n/**\n * 基于Antd Mentions进行二次封装,可实现输入内关键字整体控制,包括光标移动、关键词删除等\n * ```\n * 可实现\n * 1. 控制光标输入\n * 2. 可设置关键词,光标不会出现在关键词内部\n * 3. 可整体删除关键词\n *\n * 应用场景例如:\n * 1. 公式输入\n * (【xx金额1】+【xx金额2】)*2\n * <MentionsWrapper prefix=\"$\" options={['【xx金额1】', '【xx金额2】']}/>\n *\n * 2. 短信模板设置\n * 您的订单号为${订单号},订单交易时间为${订单时间}\n * <MentionsWrapper prefix=\"$\" options={['${订单号}', '${订单时间}']}/>\n *\n * demo:https://fex.qa.tcshuke.com/docs/admin/main/other/widget\n * ```\n *\n */\nexport const MentionsWrapper = forwardRef<MentionsWrapperRef, MentionsWrapperProps>(\n (props: MentionsWrapperProps, ref) => {\n const { value, onChange, onClick, onCursorChange, onSelect, options, prefix, ...otherProps } = props;\n const id = hooks.useId(undefined, 'overall-input');\n const inputInnerRef = useRef<TAny>();\n const [cursorPosition, setCursorPosition] = useState(0);\n const invalidOnChangeRef = useRef(false);\n const valueNew = value || '';\n /** 关键词位置 */\n const overallKeyWordsPosition = useMemo(() => {\n if (options) {\n return getOverallKeyWordsPosition({\n overallKeyWords: options || [],\n value: valueNew,\n });\n }\n return [];\n }, [options, valueNew]);\n\n const getInputInstance = () => {\n return inputInnerRef.current?.textarea;\n };\n\n fbaHooks.useEffectCustom(() => {\n onCursorChange?.(cursorPosition || 0);\n }, [cursorPosition]);\n\n useEventListener(\n 'keydown',\n (ev) => {\n const selectionStart = getInputInstance()?.selectionStart as number;\n const selectionEnd = getInputInstance()?.selectionEnd as number;\n if (['ArrowLeft', 'ArrowRight'].includes(ev.code)) {\n let positionValue = 0;\n if (ev.code === 'ArrowLeft') {\n if (selectionStart - 1 < 0) return;\n positionValue = selectionStart - 1;\n setCursorPosition(positionValue);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: positionValue,\n });\n if (targret) {\n getInputInstance()?.setSelectionRange(targret.start, targret.start);\n }\n } else if (ev.code === 'ArrowRight') {\n if (selectionStart + 1 > valueNew.length) return;\n positionValue = selectionStart + 1;\n setCursorPosition(positionValue);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: positionValue,\n });\n if (targret) {\n getInputInstance()?.setSelectionRange(targret.end - 1, targret.end - 1);\n }\n }\n } else if (ev.code === 'Backspace') {\n /** 选中关键字/关键字+文字 的情况,直接删除 */\n if (selectionStart !== selectionEnd) {\n return;\n }\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: selectionStart - 1,\n });\n if (targret) {\n invalidOnChangeRef.current = true;\n const result = valueNew.substring(0, targret.start - 1) + valueNew.substring(targret.end);\n setTimeout(() => {\n getInputInstance()?.setSelectionRange(targret.start - 1, targret.start - 1);\n }, 50);\n if (!result) {\n invalidOnChangeRef.current = false;\n }\n onChange?.(result);\n }\n }\n },\n {\n target: () => {\n return document.querySelector(`#${id}`);\n },\n },\n );\n\n useEventListener(\n 'keyup',\n (ev) => {\n const selectionStart = getInputInstance()?.selectionStart || 0;\n if (['ArrowUp', 'ArrowDown'].includes(ev.code)) {\n setCursorPosition(selectionStart);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: selectionStart,\n });\n if (targret) {\n if (selectionStart - targret.start < targret.end - selectionStart) {\n getInputInstance()?.setSelectionRange(targret.start - 1, targret.start - 1);\n } else {\n getInputInstance()?.setSelectionRange(targret.end, targret.end);\n }\n }\n }\n },\n {\n target: () => {\n return document.querySelector(`#${id}`);\n },\n },\n );\n\n const onInputChange = hooks.useCallbackRef((value) => {\n if (otherProps.disabled) return;\n if (invalidOnChangeRef.current) {\n invalidOnChangeRef.current = false;\n return;\n }\n const selectionStart = getInputInstance()?.selectionStart || 0;\n setCursorPosition(selectionStart);\n onChange?.(value);\n });\n\n const onInputClick = hooks.useCallbackRef((event) => {\n const selectionStart = getInputInstance()?.selectionStart || 0;\n setCursorPosition(selectionStart);\n onClick?.(event.target.value);\n const targret = judgmentCursorInKeyWordsPosition({\n keyWordsPosition: overallKeyWordsPosition,\n cursorPosition: selectionStart,\n });\n if (targret) {\n if (selectionStart - targret.start < targret.end - selectionStart) {\n getInputInstance()?.setSelectionRange(targret.start - 1, targret.start - 1);\n } else {\n getInputInstance()?.setSelectionRange(targret.end, targret.end);\n }\n }\n });\n\n const onHandleSelect = (options, prefix) => {\n const addPos: number = options.value?.length || 0;\n setCursorPosition((prePos) => prePos + addPos);\n if (onSelect) {\n onSelect(options, prefix);\n }\n };\n\n const mentionOptions = useMemo(() => {\n const prefixList = toArray<string>(prefix);\n return (\n options?.map((item) => {\n let opValue = item;\n for (let index = 0; index < prefixList.length; index++) {\n const element = prefixList[index];\n if (opValue.startsWith(element)) {\n opValue = opValue.replace(element, '');\n break;\n }\n }\n return { label: opValue, value: opValue };\n }) || []\n );\n }, [options, prefix]);\n\n useImperativeHandle(ref, () => {\n return {\n getInputInstance,\n };\n });\n\n return (\n <Mentions\n notFoundContent={<div>暂无数据</div>}\n rows={3}\n {...otherProps}\n prefix={prefix}\n style={{ width: '100%', ...otherProps.style }}\n id={id}\n value={valueNew}\n ref={inputInnerRef}\n onSelect={onHandleSelect}\n onChange={onInputChange}\n onClick={onInputClick}\n split=\"\"\n validateSearch={(text: string) => {\n if (!mentionOptions.length) return false;\n const target = mentionOptions.find((item) => text.indexOf(item.value) >= 0);\n return target && text.length > target.value.length ? false : true;\n }}\n options={mentionOptions}\n />\n );\n },\n);\n"],"names":["getOverallKeyWordsPosition","params","value","overallKeyWords","length","overallKeyWordsNew","Array","from","Set","positionItem","forEach","item","_params$value","includes","newItem","replace","regex","RegExp","positions","match","exec","push","index","innerList","temp","start","end","judgmentCursorInKeyWordsPosition","keyWordsPosition","element","find","cursorPosition","undefined","MentionsWrapper","forwardRef","props","ref","onChange","onClick","onCursorChange","onSelect","options","prefix","otherProps","_objectWithoutPropertiesLoose","_excluded","id","_hooks","useId","inputInnerRef","useRef","_useState","useState","setCursorPosition","invalidOnChangeRef","valueNew","overallKeyWordsPosition","useMemo","getInputInstance","_inputInnerRef$curren","current","textarea","fbaHooks","useEffectCustom","useEventListener","ev","_getInputInstance","_getInputInstance2","selectionStart","selectionEnd","code","positionValue","targret","_getInputInstance3","setSelectionRange","_getInputInstance4","result","substring","setTimeout","_getInputInstance5","target","document","querySelector","_getInputInstance6","_getInputInstance7","_getInputInstance8","onInputChange","useCallbackRef","_getInputInstance9","disabled","onInputClick","event","_getInputInstance10","_getInputInstance11","_getInputInstance12","onHandleSelect","_options$value","addPos","prePos","mentionOptions","prefixList","toArray","map","opValue","startsWith","label","useImperativeHandle","_jsx","Mentions","_extends","notFoundContent","children","rows","style","width","split","validateSearch","text","indexOf"],"mappings":";yZAEO,IAAMA,EAA6B,SAA7BA,EAA8BC,GACzC,IAAKA,EAAOC,QAAUD,EAAOE,gBAAgBC,OAAQ,MAAO,GAC5D,IAAMC,EAAqBC,MAAMC,KAAK,IAAIC,IAAIP,EAAOE,iBAAmB,KACxE,IAAMM,EAA4C,GAClDJ,EAAmBK,SAAQ,SAACC,GAAS,IAAAC,EACnC,MAAIA,EAACX,EAAOC,QAAPU,MAAAA,EAAcC,SAASF,IAAO,O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iF,EAAQC,WAAW3E,GAAU,CAC/B0E,EAAUA,EAAQxF,QAAQc,EAAS,IACnC,KACF,CACF,CACA,MAAO,CAAE4E,MAAOF,EAASrG,MAAOqG,EACjC,MAAK,EAEV,GAAG,CAAC9D,EAASC,IAEbgE,EAAoBtE,GAAK,WACvB,MAAO,CACLsB,iBAAAA,EAEJ,IAEA,OACEiD,EAACC,EAAQC,EAAA,CACPC,gBAAiBH,EAAA,MAAA,CAAAI,SAAK,SACtBC,KAAM,GACFrE,EAAU,CACdD,OAAQA,EACRuE,MAAKJ,EAAA,CAAIK,MAAO,QAAWvE,EAAWsE,OACtCnE,GAAIA,EACJ5C,MAAOqD,EACPnB,IAAKa,EACLT,SAAUuD,EACV1D,SAAUiD,EACVhD,QAASoD,EACTyB,MAAM,GACNC,eAAgB,SAAAA,EAACC,GACf,IAAKlB,EAAe/F,OAAQ,OAAO,MACnC,IAAM4E,EAASmB,EAAerE,MAAK,SAACnB,GAAI,OAAK0G,EAAKC,QAAQ3G,EAAKT,QAAU,KACzE,OAAO8E,GAAUqC,EAAKjH,OAAS4E,EAAO9E,MAAME,OAAS,MAAQ,IAC7D,EACFqC,QAAS0D,IAGf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/rich-text-editor/preview/preview.tsx","@flatbiz/antd/src/rich-text-editor/rich-text-editor.tsx"],"sourcesContent":["import { PlusCircleOutlined } from '@ant-design/icons';\nimport { Image } from 'antd';\nimport { Fragment } from 'react';\nimport { dynamicNode } from '../../dynamic-node';\nimport { fbaHooks } from '../../fba-hooks';\nimport './preview.less';\n\nexport const Preview = (props) => {\n const { visible, url } = props;\n\n fbaHooks.useEffectCustom(() => {\n if (visible) {\n dynamicNode.append({\n content: (\n <PlusCircleOutlined\n onClick={props.close}\n className=\"preview-image-popup-close\"\n twoToneColor=\"#1890ff\"\n />\n ),\n });\n } else {\n dynamicNode.remove();\n }\n }, [visible]);\n\n if (!url) return <></>;\n\n return (\n <Fragment>\n <Image\n key={url}\n style={{ left: '100px' }}\n preview={{\n className: 'preview-image-popup',\n maskStyle: { backgroundColor: 'rgba(0,0,0,0.85)' },\n visible,\n src: url,\n onVisibleChange: () => {\n props.close();\n },\n }}\n />\n </Fragment>\n );\n};\n","import { classNames } from '@dimjs/utils';\nimport { getStrByteLen, type TAny } from '@flatbiz/utils';\nimport { Editor, type IAllProps } from '@tinymce/tinymce-react';\nimport { hooks } from '@wove/react';\nimport { useKeyPress } from 'ahooks';\nimport { message } from 'antd';\nimport { useRef, useState } from 'react';\nimport { type Editor as TinyMCEEditor } from 'tinymce';\nimport { Preview } from './preview';\nimport './style.less';\n\nexport interface RichTextEditorProps extends Omit<IAllProps, 'onChange' | 'init'> {\n onChange?: (data?: string) => void;\n /** 上传图片服务 */\n onUploadImage?: (file: File) => Promise<string>;\n className?: string;\n /** 图片点击预览 */\n imgPreview?: boolean;\n init?: IAllProps['init'] & {\n /**\n * 通过粘贴图片创建的img标签,显示压缩比例,此处min、max是和指图片宽度\n * ```\n * 1. 默认值:[{ min: 0, max: 1000, ratio: 0.5 }, { min: 1000, ratio: 0.3 }]\n * ```\n */\n img_ratio?: { min: number; max?: number; ratio: number }[];\n /**\n * 粘贴文本大小限制\n * ```\n * 1. limit 限制大小,单位KB,例如限制2M,值为2*1024\n * 2. 限制提示文案\n * ```\n */\n paste_text_limit?: {\n limit: number;\n message: string;\n };\n /** 插件添加;自定义plugins后失效 */\n plugins_append?: string;\n /** 工具栏添加;自定义toolbar后失效 */\n toolbar_append?: string;\n };\n /** 点击全屏按钮回调 */\n onFullScreenChange?: (state?: boolean) => void;\n}\n\n/**\n * 富文本编辑器,配置参考tinymce https://www.tiny.cloud/docs/tinymce/6\n * @param props\n * @returns\n * ```\n * 1. 如果需要粘贴上传图片服务,需要提供 onUploadImage 上传图片接口\n * 2. 获取富文本实例,通过onInit(_, editor)函数获取\n * 3. 预览富文本数据,使用 RichTextViewer 组件\n * 4. 添加其他插件使用方式,配置 init.plugins_append、init.toolbar_append\n * <RichTextEditor init={{ plugins_append: 'codesample', toolbar_append: 'codesample' }} />\n * 5. 可通过设置 init.plugins、init.toolbar 完全自定义插件、工具栏\n * 6. 其他插件\n * emoticons 表情插件\n * 7. 可通过设置 init.img_ratio 设置通过粘贴上传的图片压缩显示比例\n * 默认比例:[{ min: 0, max: 1000, ratio: 0.5 }, { min: 1000, ratio: 0.3 }]\n * ```\n */\nexport const RichTextEditor = (props: RichTextEditorProps) => {\n const { onUploadImage, onChange, className, ...otherProps } = props;\n\n const editorRef = useRef<TAny>(null);\n const [previewUrl, setPreviewUrl] = useState('');\n const imgRatio = props.init?.img_ratio || [\n { min: 0, max: 1000, ratio: 0.5 },\n { min: 1000, ratio: 0.3 },\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 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 const onKeyDown = hooks.useCallbackRef((event, editor: TinyMCEEditor) => {\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.onKeyDown?.(event, editor);\n });\n\n const onInit = hooks.useCallbackRef((_, editor: TinyMCEEditor) => {\n editorRef.current = editor;\n editor.on('FullscreenStateChanged', (e) => {\n props.onFullScreenChange?.(e.state);\n });\n try {\n editor.iframeElement?.contentDocument?.addEventListener(\n 'click',\n (event) => {\n if (props.imgPreview && event.target?.['tagName'] === 'IMG') {\n setPreviewUrl(event.target['src']);\n }\n },\n true,\n );\n } catch (error) {\n //\n }\n otherProps.onInit?.(_, editor);\n });\n\n const onEditorChange = hooks.useCallbackRef((a: string, editor: TinyMCEEditor) => {\n editorRef.current = editor;\n otherProps.onEditorChange?.(a, editor);\n onChange?.(a);\n });\n\n const tinymceBaseUrl = 'https://file.40017.cn/tcsk/tinymce@6.4.1';\n\n const getImgRatio = (width: number) => {\n if (imgRatio.length === 0) return 1;\n for (let index = 0; index < imgRatio.length; index++) {\n const element = imgRatio[index];\n if (element.max) {\n if (width >= element.min && width <= element.max) return element.ratio;\n } else {\n if (width >= element.min) return element.ratio;\n }\n }\n return 1;\n };\n\n const paste_postprocess = hooks.useCallbackRef((editor, args) => {\n try {\n const nodes = (args.node.children || []) as unknown as HTMLElement[];\n if (nodes.length === 1 && nodes[0].nodeName === 'IMG') {\n nodes[0].setAttribute('style', `display:none`);\n const img = document.createElement('img');\n img.src = nodes[0].getAttribute('src') as string;\n img.onload = () => {\n const ratio = getImgRatio(img.width);\n editor.execCommand(\n 'mceInsertContent',\n true,\n `<img src=\"${img.src}\" width=\"${img.width * ratio}\" height=\"${img.height * ratio}\" />`,\n );\n };\n }\n } catch (error) {\n //\n }\n });\n\n const paste_preprocess = hooks.useCallbackRef((_plugin, args) => {\n const paste_text_limit = props.init?.paste_text_limit;\n if (paste_text_limit) {\n const byteLen = getStrByteLen(args.content);\n if (byteLen > 1024 * paste_text_limit.limit) {\n message.error(paste_text_limit.message);\n args.content = '';\n }\n }\n });\n\n return (\n <div className={classNames('v-editor-wrapper', className)}>\n <Editor\n // apiKey=\"ds6j8so4g3d2cycidbhgkds36q0phy1uqd9jd8bot91sfe5l\"\n tinymceScriptSrc={`${tinymceBaseUrl}/tinymce.min.js`}\n {...otherProps}\n onInit={onInit}\n onKeyDown={onKeyDown}\n onEditorChange={onEditorChange}\n init={{\n promotion: false,\n language: 'zh-Hans',\n height: 500,\n paste_data_images: onUploadImage ? true : false,\n paste_postprocess,\n paste_preprocess,\n autosave_ask_before_unload: false,\n base_url: tinymceBaseUrl,\n autoresize_bottom_margin: 0,\n images_upload_handler: async (blobInfo) => {\n try {\n const blob = blobInfo.blob();\n const file = new File([blob], blob.name, { type: blob.type });\n const respData = await onUploadImage?.(file);\n return Promise.resolve(respData as string);\n } catch (error: any) {\n return Promise.reject(error?.message || '图片上传异常');\n }\n },\n plugins:\n 'lists link image advlist charmap preview fullscreen code table help codesample ' +\n (props.init?.plugins_append || ''),\n toolbar:\n 'undo redo fullscreen preview | bold italic underline strikethrough |' +\n 'fontsize blocks |' +\n 'forecolor backcolor removeformat |' +\n 'numlist bullist advlist |' +\n 'alignleft aligncenter alignright alignjustify |' +\n 'outdent indent |' +\n 'hr image link code codesample |' +\n (props.init?.toolbar_append || ''),\n font_size_formats: '8px 10px 12px 14px 16px 18px 24px 36px 48px',\n ...props.init,\n content_style: `img {max-width:100%;} table{width:100%} ${props.init?.content_style}`,\n convert_urls: false,\n }}\n />\n <Preview\n visible={!!previewUrl}\n url={previewUrl}\n close={() => {\n setPreviewUrl('');\n }}\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":["Preview","props","visible","url","fbaHooks","useEffectCustom","dynamicNode","append","content","_jsx","_PlusCircleOutlined","onClick","close","className","twoToneColor","remove","_Fragment","Fragment","children","Image","style","left","preview","maskStyle","backgroundColor","src","onVisibleChange","RichTextEditor","_props$init","_props$init3","_props$init4","_props$init5","onUploadImage","onChange","otherProps","_objectWithoutPropertiesLoose","_excluded","editorRef","useRef","_useState","useState","previewUrl","setPreviewUrl","imgRatio","init","img_ratio","min","max","ratio","useKeyPress","event","type","key","_editorRef$current","isFull","current","editorContainer","classList","contains","_editorRef$current2","editorCommands","execCommand","error","events","onKeyDown","_hooks","useCallbackRef","editor","keyCode","_editorRef$current3","_editorRef$current4","onInit","_","on","e","onFullScreenChange","state","_editor$iframeElement","iframeElement","contentDocument","addEventListener","_event$target","imgPreview","target","onEditorChange","a","tinymceBaseUrl","getImgRatio","width","length","index","element","paste_postprocess","args","nodes","node","nodeName","setAttribute","img","document","createElement","getAttribute","onload","height","paste_preprocess","_plugin","_props$init2","paste_text_limit","byteLen","getStrByteLen","limit","message","_jsxs","_classNames","Editor","_extends","tinymceScriptSrc","promotion","language","paste_data_images","autosave_ask_before_unload","base_url","autoresize_bottom_margin","images_upload_handler","blobInfo","Promise","$return","$error","blob","_file","respData","$Try_5_Catch","reject","$boundEx","file","File","name","resolve","then","$await_6","plugins","plugins_append","toolbar","toolbar_append","font_size_formats","content_style","convert_urls"],"mappings":";2vBAOO,IAAMA,EAAU,SAAVA,EAAWC,GACtB,IAAQC,EAAiBD,EAAjBC,QAASC,EAAQF,EAARE,IAEjBC,EAASC,iBAAgB,WACvB,GAAIH,EAAS,CACXI,EAAYC,OAAO,CACjBC,QACEC,EAAAC,EAAA,CACEC,QAASV,EAAMW,MACfC,UAAU,4BACVC,aAAa,aAIrB,KAAO,CACLR,EAAYS,QACd,CACF,GAAG,CAACb,IAEJ,IAAKC,EAAK,OAAOM,EAAAO,GAAI,GAErB,OACEP,EAACQ,EAAQ,CAAAC,SACPT,EAACU,EAAK,CAEJC,MAAO,CAAEC,KAAM,SACfC,QAAS,CACPT,UAAW,sBACXU,UAAW,CAAEC,gBAAiB,oBAC9BtB,QAAAA,EACAuB,IAAKtB,EACLuB,gBAAiB,SAAAA,IACfzB,EAAMW,OACR,IATGT,IAcb,qDCkBawB,EAAiB,SAAjBA,EAAkB1B,GAA+B,IAAA2B,EAAAC,EAAAC,EAAAC,EAC5D,IAAQC,EAAsD/B,EAAtD+B,cAAeC,EAAuChC,EAAvCgC,SAAUpB,EAA6BZ,EAA7BY,UAAcqB,EAAUC,EAAKlC,EAAKmC,GAEnE,IAAMC,EAAYC,EAAa,MAC/B,IAAAC,EAAoCC,EAAS,IAAtCC,EAA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AC,MAAAG,GAAW,OAAOF,EAAAE,EAAM,CAAC,GAAAF,EAsNtB,CAAC,MAAOrE,GAAYqE,EAAZrE,EAET,CAAC,GACF,EACD8E,QACE,qFACC/G,EAAA5B,EAAM2C,mBAANf,EAAYgH,iBAAkB,IACjCC,QACE,uEACA,oBACA,qCACA,4BACA,kDACA,mBACA,qCACChH,EAAA7B,EAAM2C,OAANd,UAAAA,EAAAA,EAAYiH,iBAAkB,IACjCC,kBAAmB,+CAChB/I,EAAM2C,KAAI,CACbqG,cAAa,6CAAAlH,EAA6C9B,EAAM2C,OAANb,UAAAA,EAAAA,EAAYkH,eACtEC,aAAc,WAGlBzI,EAACT,EAAO,CACNE,UAAWuC,EACXtC,IAAKsC,EACL7B,MAAO,SAAAA,IACL8B,EAAc,GAChB,MAIR"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/rich-text-editor/preview/preview.tsx","@flatbiz/antd/src/rich-text-editor/rich-text-editor.tsx"],"sourcesContent":["import { PlusCircleOutlined } from '@ant-design/icons';\nimport { Image } from 'antd';\nimport { Fragment } from 'react';\nimport { dynamicNode } from '../../dynamic-node';\nimport { fbaHooks } from '../../fba-hooks';\nimport './preview.less';\n\nexport const Preview = (props) => {\n const { visible, url } = props;\n\n fbaHooks.useEffectCustom(() => {\n if (visible) {\n dynamicNode.append({\n content: (\n <PlusCircleOutlined\n onClick={props.close}\n className=\"preview-image-popup-close\"\n twoToneColor=\"#1890ff\"\n />\n ),\n });\n } else {\n dynamicNode.remove();\n }\n }, [visible]);\n\n if (!url) return <></>;\n\n return (\n <Fragment>\n <Image\n key={url}\n style={{ left: '100px' }}\n preview={{\n className: 'preview-image-popup',\n maskStyle: { backgroundColor: 'rgba(0,0,0,0.85)' },\n visible,\n src: url,\n onVisibleChange: () => {\n props.close();\n },\n }}\n />\n </Fragment>\n );\n};\n","import { classNames } from '@dimjs/utils';\nimport { getStrByteLen, type TAny } from '@flatbiz/utils';\nimport { Editor, type IAllProps } from '@tinymce/tinymce-react';\nimport { hooks } from '@wove/react';\nimport { useKeyPress } from 'ahooks';\nimport { message } from 'antd';\nimport { useRef, useState } from 'react';\nimport { type Editor as TinyMCEEditor } from 'tinymce';\nimport { Preview } from './preview';\nimport './style.less';\n\nexport interface RichTextEditorProps extends Omit<IAllProps, 'onChange' | 'init'> {\n onChange?: (data?: string) => void;\n /** 上传图片服务 */\n onUploadImage?: (file: File) => Promise<string>;\n className?: string;\n /** 图片点击预览 */\n imgPreview?: boolean;\n init?: IAllProps['init'] & {\n /**\n * 通过粘贴图片创建的img标签,显示压缩比例,此处min、max是和指图片宽度\n * ```\n * 1. 默认值:[{ min: 0, max: 1000, ratio: 0.5 }, { min: 1000, ratio: 0.3 }]\n * ```\n */\n img_ratio?: { min: number; max?: number; ratio: number }[];\n /**\n * 粘贴文本大小限制\n * ```\n * 1. limit 限制大小,单位KB,例如限制2M,值为2*1024\n * 2. 限制提示文案\n * ```\n */\n paste_text_limit?: {\n limit: number;\n message: string;\n };\n /** 插件添加;自定义plugins后失效 */\n plugins_append?: string;\n /** 工具栏添加;自定义toolbar后失效 */\n toolbar_append?: string;\n };\n /** 点击全屏按钮回调 */\n onFullScreenChange?: (state?: boolean) => void;\n}\n\n/**\n * 富文本编辑器,配置参考tinymce https://www.tiny.cloud/docs/tinymce/6\n * @param props\n * @returns\n * ```\n * 1. 修改高度 init={{ height: 300 }}\n * 2. 如果需要粘贴上传图片服务,需要提供 onUploadImage 上传图片接口\n * 3. 获取富文本实例,通过onInit(_, editor)函数获取\n * 4. 预览富文本数据,使用 RichTextViewer 组件\n * 5. 添加其他插件使用方式,配置 init.plugins_append、init.toolbar_append\n * <RichTextEditor init={{ plugins_append: 'codesample', toolbar_append: 'codesample' }} />\n * 6. 可通过设置 init.plugins、init.toolbar 完全自定义插件、工具栏\n * 7. 其他插件\n * emoticons 表情插件\n * 8. 可通过设置 init.img_ratio 设置通过粘贴上传的图片压缩显示比例\n * 默认比例:[{ min: 0, max: 1000, ratio: 0.5 }, { min: 1000, ratio: 0.3 }]\n * ```\n */\nexport const RichTextEditor = (props: RichTextEditorProps) => {\n const { onUploadImage, onChange, className, ...otherProps } = props;\n\n const editorRef = useRef<TAny>(null);\n const [previewUrl, setPreviewUrl] = useState('');\n const imgRatio = props.init?.img_ratio || [\n { min: 0, max: 1000, ratio: 0.5 },\n { min: 1000, ratio: 0.3 },\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 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 const onKeyDown = hooks.useCallbackRef((event, editor: TinyMCEEditor) => {\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.onKeyDown?.(event, editor);\n });\n\n const onInit = hooks.useCallbackRef((_, editor: TinyMCEEditor) => {\n editorRef.current = editor;\n editor.on('FullscreenStateChanged', (e) => {\n props.onFullScreenChange?.(e.state);\n });\n try {\n editor.iframeElement?.contentDocument?.addEventListener(\n 'click',\n (event) => {\n if (props.imgPreview && event.target?.['tagName'] === 'IMG') {\n setPreviewUrl(event.target['src']);\n }\n },\n true,\n );\n } catch (error) {\n //\n }\n otherProps.onInit?.(_, editor);\n });\n\n const onEditorChange = hooks.useCallbackRef((a: string, editor: TinyMCEEditor) => {\n editorRef.current = editor;\n otherProps.onEditorChange?.(a, editor);\n onChange?.(a);\n });\n\n const tinymceBaseUrl = 'https://file.40017.cn/tcsk/tinymce@6.4.1';\n\n const getImgRatio = (width: number) => {\n if (imgRatio.length === 0) return 1;\n for (let index = 0; index < imgRatio.length; index++) {\n const element = imgRatio[index];\n if (element.max) {\n if (width >= element.min && width <= element.max) return element.ratio;\n } else {\n if (width >= element.min) return element.ratio;\n }\n }\n return 1;\n };\n\n const paste_postprocess = hooks.useCallbackRef((editor, args) => {\n try {\n const nodes = (args.node.children || []) as unknown as HTMLElement[];\n if (nodes.length === 1 && nodes[0].nodeName === 'IMG') {\n nodes[0].setAttribute('style', `display:none`);\n const img = document.createElement('img');\n img.src = nodes[0].getAttribute('src') as string;\n img.onload = () => {\n const ratio = getImgRatio(img.width);\n editor.execCommand(\n 'mceInsertContent',\n true,\n `<img src=\"${img.src}\" width=\"${img.width * ratio}\" height=\"${img.height * ratio}\" />`,\n );\n };\n }\n } catch (error) {\n //\n }\n });\n\n const paste_preprocess = hooks.useCallbackRef((_plugin, args) => {\n const paste_text_limit = props.init?.paste_text_limit;\n if (paste_text_limit) {\n const byteLen = getStrByteLen(args.content);\n if (byteLen > 1024 * paste_text_limit.limit) {\n message.error(paste_text_limit.message);\n args.content = '';\n }\n }\n });\n\n return (\n <div className={classNames('v-editor-wrapper', className)}>\n <Editor\n // apiKey=\"ds6j8so4g3d2cycidbhgkds36q0phy1uqd9jd8bot91sfe5l\"\n tinymceScriptSrc={`${tinymceBaseUrl}/tinymce.min.js`}\n {...otherProps}\n onInit={onInit}\n onKeyDown={onKeyDown}\n onEditorChange={onEditorChange}\n init={{\n promotion: false,\n language: 'zh-Hans',\n height: 500,\n paste_data_images: onUploadImage ? true : false,\n paste_postprocess,\n paste_preprocess,\n autosave_ask_before_unload: false,\n base_url: tinymceBaseUrl,\n autoresize_bottom_margin: 0,\n images_upload_handler: async (blobInfo) => {\n try {\n const blob = blobInfo.blob();\n const file = new File([blob], blob.name, { type: blob.type });\n const respData = await onUploadImage?.(file);\n return Promise.resolve(respData as string);\n } catch (error: any) {\n return Promise.reject(error?.message || '图片上传异常');\n }\n },\n plugins:\n 'lists link image advlist charmap preview fullscreen code table help codesample ' +\n (props.init?.plugins_append || ''),\n toolbar:\n 'undo redo fullscreen preview | bold italic underline strikethrough |' +\n 'fontsize blocks |' +\n 'forecolor backcolor removeformat |' +\n 'numlist bullist advlist |' +\n 'alignleft aligncenter alignright alignjustify |' +\n 'outdent indent |' +\n 'hr image link code codesample |' +\n (props.init?.toolbar_append || ''),\n font_size_formats: '8px 10px 12px 14px 16px 18px 24px 36px 48px',\n ...props.init,\n content_style: `img {max-width:100%;} table{width:100%} ${props.init?.content_style}`,\n convert_urls: false,\n }}\n />\n <Preview\n visible={!!previewUrl}\n url={previewUrl}\n close={() => {\n setPreviewUrl('');\n }}\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":["Preview","props","visible","url","fbaHooks","useEffectCustom","dynamicNode","append","content","_jsx","_PlusCircleOutlined","onClick","close","className","twoToneColor","remove","_Fragment","Fragment","children","Image","style","left","preview","maskStyle","backgroundColor","src","onVisibleChange","RichTextEditor","_props$init","_props$init3","_props$init4","_props$init5","onUploadImage","onChange","otherProps","_objectWithoutPropertiesLoose","_excluded","editorRef","useRef","_useState","useState","previewUrl","setPreviewUrl","imgRatio","init","img_ratio","min","max","ratio","useKeyPress","event","type","key","_editorRef$current","isFull","current","editorContainer","classList","contains","_editorRef$current2","editorCommands","execCommand","error","events","onKeyDown","_hooks","useCallbackRef","editor","keyCode","_editorRef$current3","_editorRef$current4","onInit","_","on","e","onFullScreenChange","state","_editor$iframeElement","iframeElement","contentDocument","addEventListener","_event$target","imgPreview","target","onEditorChange","a","tinymceBaseUrl","getImgRatio","width","length","index","element","paste_postprocess","args","nodes","node","nodeName","setAttribute","img","document","createElement","getAttribute","onload","height","paste_preprocess","_plugin","_props$init2","paste_text_limit","byteLen","getStrByteLen","limit","message","_jsxs","_classNames","Editor","_extends","tinymceScriptSrc","promotion","language","paste_data_images","autosave_ask_before_unload","base_url","autoresize_bottom_margin","images_upload_handler","blobInfo","Promise","$return","$error","blob","_file","respData","$Try_5_Catch","reject","$boundEx","file","File","name","resolve","then","$await_6","plugins","plugins_append","toolbar","toolbar_append","font_size_formats","content_style","convert_urls"],"mappings":";2vBAOO,IAAMA,EAAU,SAAVA,EAAWC,GACtB,IAAQC,EAAiBD,EAAjBC,QAASC,EAAQF,EAARE,IAEjBC,EAASC,iBAAgB,WACvB,GAAIH,EAAS,CACXI,EAAYC,OAAO,CACjBC,QACEC,EAAAC,EAAA,CACEC,QAASV,EAAMW,MACfC,UAAU,4BACVC,aAAa,aAIrB,KAAO,CACLR,EAAYS,QACd,CACF,GAAG,CAACb,IAEJ,IAAKC,EAAK,OAAOM,EAAAO,GAAI,GAErB,OACEP,EAACQ,EAAQ,CAAAC,SACPT,EAACU,EAAK,CAEJC,MAAO,CAAEC,KAAM,SACfC,QAAS,CACPT,UAAW,sBACXU,UAAW,CAAEC,gBAAiB,oBAC9BtB,QAAAA,EACAuB,IAAKtB,EACLuB,gBAAiB,SAAAA,IACfzB,EAAMW,OACR,IATGT,IAcb,qDCmBawB,EAAiB,SAAjBA,EAAkB1B,GAA+B,IAAA2B,EAAAC,EAAAC,EAAAC,EAC5D,IAAQC,EAAsD/B,EAAtD+B,cAAeC,EAAuChC,EAAvCgC,SAAUpB,EAA6BZ,EAA7BY,UAAcqB,EAAUC,EAAKlC,EAAKmC,GAEnE,IAAMC,EAAYC,EAAa,MAC/B,IAAAC,EAAoCC,EAAS,IAAtCC,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAChC,IAAMI,IAAWf,EAAA3B,EAAM2C,OAANhB,UAAAA,EAAAA,EAAYiB,YAAa,CACxC,CAAEC,IAAK,EAAGC,IAAK,IAAMC,MAAO,IAC5B,CAAEF,IAAK,IAAME,MAAO,KAYtBC,GACE,WAAA,OAAM,IACN,IAAA,SAACC,GACC,I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B,EAAM2C,OAANd,UAAAA,EAAAA,EAAYiH,iBAAkB,IACjCC,kBAAmB,+CAChB/I,EAAM2C,KAAI,CACbqG,cAAa,6CAAAlH,EAA6C9B,EAAM2C,OAANb,UAAAA,EAAAA,EAAYkH,eACtEC,aAAc,WAGlBzI,EAACT,EAAO,CACNE,UAAWuC,EACXtC,IAAKsC,EACL7B,MAAO,SAAAA,IACL8B,EAAc,GAChB,MAIR"}
|
package/index.d.ts
CHANGED
|
@@ -964,6 +964,13 @@ export interface FormItemWrapperProps extends FormItemProps {
|
|
|
964
964
|
* ```
|
|
965
965
|
*/
|
|
966
966
|
labelAlign?: "left" | "right";
|
|
967
|
+
/**
|
|
968
|
+
* 栅格占位格数,最大值:24
|
|
969
|
+
* ```
|
|
970
|
+
* 1. 当 FormItemWrapper 处在 EasyForm 直接子节点中有效,即FormItemWrapper在EasyForm栅格中的占位格数;
|
|
971
|
+
* ```
|
|
972
|
+
*/
|
|
973
|
+
span?: number;
|
|
967
974
|
}
|
|
968
975
|
/**
|
|
969
976
|
* 对 Form.Item 包装处理
|
|
@@ -973,7 +980,10 @@ export interface FormItemWrapperProps extends FormItemProps {
|
|
|
973
980
|
* 3. 内置布局样式使用 preDefinedClassName.formItem
|
|
974
981
|
* ```
|
|
975
982
|
*/
|
|
976
|
-
export declare const FormItemWrapper:
|
|
983
|
+
export declare const FormItemWrapper: {
|
|
984
|
+
(props: FormItemWrapperProps): import("react/jsx-runtime").JSX.Element | null;
|
|
985
|
+
domTypeName: string;
|
|
986
|
+
};
|
|
977
987
|
export type DateRangePickerWrapperFormItemProps = Omit<FormItemWrapperProps, "name"> & {
|
|
978
988
|
/**
|
|
979
989
|
* 开始的时间name
|
|
@@ -1961,32 +1971,35 @@ export type EasyFormProps = Omit<FormWrapperProps, "children"> & {
|
|
|
1961
1971
|
/**
|
|
1962
1972
|
* 简单Form布局,可自定义网格布局
|
|
1963
1973
|
* ```
|
|
1964
|
-
* 1.
|
|
1965
|
-
* 2.
|
|
1966
|
-
* 3.
|
|
1967
|
-
* 4.
|
|
1974
|
+
* 1. demo:https://fex.qa.tcshuke.com/docs/admin/main/form/label
|
|
1975
|
+
* 2. 布局网格以当前节点的宽度来计算的,不是屏幕宽度
|
|
1976
|
+
* 3. EasyForm 子节点包含 hidden = true 会被忽略
|
|
1977
|
+
* 4. 通过 column 可定义一行显示几列FormItem
|
|
1968
1978
|
* 5. 通过 labelItemVertical 可定义 formitem 竖直布局
|
|
1969
1979
|
* 6. 通过 formItemGap 可定义 formItem竖直方向间隙
|
|
1970
1980
|
* 7. 通过 forceColumn 可强制定义一行显示几列,不考虑响应式
|
|
1971
|
-
*
|
|
1981
|
+
* 8. 通过 labelWidth 可控制Form内部所有label的宽度(可实现整齐效果)
|
|
1982
|
+
* 9. 自定义栅格占位格数,见下方`例如`
|
|
1983
|
+
|
|
1972
1984
|
* 例如
|
|
1973
1985
|
* <EasyForm column={3}>
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1986
|
+
* <Form.Item name="field1" label="条件1">
|
|
1987
|
+
* <Input placeholder="请输入" allowClear={true} />
|
|
1988
|
+
* </Form.Item>
|
|
1989
|
+
* <Form.Item name="field2" label="条件2">
|
|
1990
|
+
* <Input placeholder="请输入" allowClear={true} />
|
|
1991
|
+
* </Form.Item>
|
|
1992
|
+
* <!-- !!自定义栅格占位格数第一种方式:可通过使用 BoxGrid.Col 包裹元素来自定义网格占比 -->
|
|
1993
|
+
* <BoxGrid.Col span={24}>
|
|
1994
|
+
* <Form.Item name="field5" label="条件5">
|
|
1995
|
+
* <Input placeholder="请输入" allowClear={true} />
|
|
1996
|
+
* </Form.Item>
|
|
1997
|
+
* </BoxGrid.Col>
|
|
1998
|
+
* <!-- !!自定义栅格占位格数第二种方式:如果为FormItemWrapper组件,可设置span属性 -->
|
|
1999
|
+
* <FormItemWrapper name="field6" label="条件6" span={24}>
|
|
2000
|
+
* <Input placeholder="请输入" allowClear={true} />
|
|
2001
|
+
* </FormItemWrapper>
|
|
2002
|
+
* </EasyForm>
|
|
1990
2003
|
* ```
|
|
1991
2004
|
*/
|
|
1992
2005
|
export declare const EasyForm: (props: EasyFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3053,6 +3066,9 @@ export declare const LocalLoading: import("react").ForwardRefExoticComponent<Loc
|
|
|
3053
3066
|
onRequest: (params?: TPlainObject) => void;
|
|
3054
3067
|
};
|
|
3055
3068
|
};
|
|
3069
|
+
export type MentionsWrapperRef = {
|
|
3070
|
+
getInputInstance: () => any;
|
|
3071
|
+
};
|
|
3056
3072
|
export type MentionsWrapperProps = Omit<MentionProps, "value" | "onChange" | "onClick" | "onCursorChange" | "options" | "id" | "split" | "validateSearch" | "ref" | "prefix"> & {
|
|
3057
3073
|
value?: string;
|
|
3058
3074
|
onChange?: (value?: string) => void;
|
|
@@ -3093,7 +3109,67 @@ export type MentionsWrapperProps = Omit<MentionProps, "value" | "onChange" | "on
|
|
|
3093
3109
|
* ```
|
|
3094
3110
|
*
|
|
3095
3111
|
*/
|
|
3096
|
-
export declare const MentionsWrapper:
|
|
3112
|
+
export declare const MentionsWrapper: import("react").ForwardRefExoticComponent<Omit<MentionProps, "split" | "id" | "value" | "prefix" | "options" | "ref" | "onChange" | "onClick" | "onCursorChange" | "validateSearch"> & {
|
|
3113
|
+
value?: string | undefined;
|
|
3114
|
+
onChange?: ((value?: string) => void) | undefined;
|
|
3115
|
+
/** 设置列表提示关键字,例如:@、$等 */
|
|
3116
|
+
prefix?: string | string[] | undefined;
|
|
3117
|
+
onClick?: ((value?: string) => void) | undefined;
|
|
3118
|
+
/** 光标移动回调 */
|
|
3119
|
+
onCursorChange?: ((position: number) => void) | undefined;
|
|
3120
|
+
/**
|
|
3121
|
+
* 输入框内整体关键词列表
|
|
3122
|
+
* ```
|
|
3123
|
+
* 整体关键词交互
|
|
3124
|
+
* 1. 光标可整体移动
|
|
3125
|
+
* 2. 光标不会存在关键词内部
|
|
3126
|
+
* 3. 删除时,整体删除
|
|
3127
|
+
* ```
|
|
3128
|
+
*/
|
|
3129
|
+
options?: string[] | undefined;
|
|
3130
|
+
} & import("react").RefAttributes<MentionsWrapperRef>>;
|
|
3131
|
+
export type ParamItem = {
|
|
3132
|
+
/** 模版参数code */
|
|
3133
|
+
code: string;
|
|
3134
|
+
/** 模版参数类型 文本/数字/链接 */
|
|
3135
|
+
type: "text" | "number" | "link";
|
|
3136
|
+
/** 模版参数 value */
|
|
3137
|
+
value: TAny;
|
|
3138
|
+
} & Record<string, TAny>;
|
|
3139
|
+
export type OperationPresetProps = {
|
|
3140
|
+
/** icon */
|
|
3141
|
+
icon: ReactElement;
|
|
3142
|
+
/** 模版参数文案 */
|
|
3143
|
+
label?: string;
|
|
3144
|
+
/** 模版参数类型 */
|
|
3145
|
+
type: string;
|
|
3146
|
+
/** 自增code前缀 */
|
|
3147
|
+
codePrefix: string;
|
|
3148
|
+
/** 自定义生成模版参数code */
|
|
3149
|
+
codeAdapter?: () => string | undefined;
|
|
3150
|
+
};
|
|
3151
|
+
export type MetionEditorProps = Omit<MentionsWrapperProps, "prefix"> & {
|
|
3152
|
+
/**
|
|
3153
|
+
* onChange
|
|
3154
|
+
* @item 点击的预设模版参数
|
|
3155
|
+
*/
|
|
3156
|
+
onSelectParam?: (item: ParamItem, prefix?: string) => void;
|
|
3157
|
+
/** 模版参数前缀 & | $ */
|
|
3158
|
+
prefix?: string;
|
|
3159
|
+
/** editor 支持添加的模版参数类型 */
|
|
3160
|
+
operations?: OperationPresetProps[];
|
|
3161
|
+
/** 模版参数列表 */
|
|
3162
|
+
params?: ParamItem[] | undefined;
|
|
3163
|
+
};
|
|
3164
|
+
/**
|
|
3165
|
+
* 基于MetionWrapper封装的模版字符串配置组件
|
|
3166
|
+
* 1. 提供变量,数字,链接等可选的模版参数
|
|
3167
|
+
* 2. 不同类型模版参数可配置多个
|
|
3168
|
+
* 3. mention 会根据 传入的params自动推断出关键字
|
|
3169
|
+
* 4. 模版参数建议都以${_xxx}为格式
|
|
3170
|
+
* 5. Demo: https://fex.qa.tcshuke.com/docs/admin/main/widget?key=mention-editor
|
|
3171
|
+
*/
|
|
3172
|
+
export declare const MetionEditor: (props: MetionEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
3097
3173
|
export type onClick = (e?: React.MouseEvent<HTMLElement>) => void;
|
|
3098
3174
|
export interface ModalActionProps {
|
|
3099
3175
|
children: ReactElement | ((data: {
|
|
@@ -3351,15 +3427,16 @@ export interface RichTextEditorProps extends Omit<IAllProps, "onChange" | "init"
|
|
|
3351
3427
|
* @param props
|
|
3352
3428
|
* @returns
|
|
3353
3429
|
* ```
|
|
3354
|
-
* 1.
|
|
3355
|
-
* 2.
|
|
3356
|
-
* 3.
|
|
3357
|
-
* 4.
|
|
3430
|
+
* 1. 修改高度 init={{ height: 300 }}
|
|
3431
|
+
* 2. 如果需要粘贴上传图片服务,需要提供 onUploadImage 上传图片接口
|
|
3432
|
+
* 3. 获取富文本实例,通过onInit(_, editor)函数获取
|
|
3433
|
+
* 4. 预览富文本数据,使用 RichTextViewer 组件
|
|
3434
|
+
* 5. 添加其他插件使用方式,配置 init.plugins_append、init.toolbar_append
|
|
3358
3435
|
* <RichTextEditor init={{ plugins_append: 'codesample', toolbar_append: 'codesample' }} />
|
|
3359
|
-
*
|
|
3360
|
-
*
|
|
3436
|
+
* 6. 可通过设置 init.plugins、init.toolbar 完全自定义插件、工具栏
|
|
3437
|
+
* 7. 其他插件
|
|
3361
3438
|
* emoticons 表情插件
|
|
3362
|
-
*
|
|
3439
|
+
* 8. 可通过设置 init.img_ratio 设置通过粘贴上传的图片压缩显示比例
|
|
3363
3440
|
* 默认比例:[{ min: 0, max: 1000, ratio: 0.5 }, { min: 1000, ratio: 0.3 }]
|
|
3364
3441
|
* ```
|
|
3365
3442
|
*/
|