@flatbiz/antd 4.4.10 → 4.4.12
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/card-layout/index.css +1 -1
- package/esm/easy-form/index.css +1 -1
- package/esm/easy-form/index.js +1 -1
- package/esm/easy-form/index.js.map +1 -1
- package/esm/form-item-group/index.js +1 -1
- package/esm/form-item-group/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/form-wrapper/index.js.map +1 -1
- package/esm/index.js +1 -1
- package/esm/mention-editor/index.js +2 -1
- package/esm/mention-editor/index.js.map +1 -1
- package/esm/mentions-wrapper/index.js +2 -1
- package/esm/mentions-wrapper/index.js.map +1 -1
- package/esm/pre-defined-class-name/index.css +1 -1
- package/esm/rich-text-editor/index.js.map +1 -1
- package/esm/tree-wrapper/index.js.map +1 -1
- package/esm/upload-wrapper/index.js +1 -1
- package/esm/upload-wrapper/index.js.map +1 -1
- package/index.d.ts +58 -41
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.block-layout{background-color:var(--block-bg-color)}.light-theme .block-layout{color:rgba(0,0,0,.88)}.dark-theme .block-layout{color:hsla(0,0%,100%,.85)}.card-layout{border-radius:6px;padding:15px}.card-layout-title-sign{padding-left:10px;position:relative}.card-layout-title-sign:before{background:var(--color-primary);border-radius:3px;bottom:0;content:"";left:0;position:absolute;top:50%;transform:translateY(-50%);width:3px}.card-layout-title{align-items:center;display:flex;position:relative}.card-layout-title+.card-layout-content{margin-top:8px}.card-layout-title-content{flex:1;font-size:16px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.card-layout-title-extra{margin-left:15px}.card-layout-desc,.card-layout-desc-list{font-size:12px;opacity:.7}.card-layout+.card-layout,.card-layout-desc+.card-layout-content,.card-layout-desc-list+.card-layout-content{margin-top:8px}.card-layout-title-fixed{display:flex;flex-direction:column;height:100%;overflow:hidden}.card-layout-title-fixed>.card-layout-content{flex:1;overflow-y:auto}.card-layout-small{padding:8px 15px}.card-layout-small .card-layout-content{margin-top:0}.card-layout-small .card-layout-title-content{font-size:14px}.card-layout-tight{border-radius:0;padding:0}
|
|
1
|
+
.block-layout{background-color:var(--block-bg-color)}.light-theme .block-layout{color:rgba(0,0,0,.88)}.dark-theme .block-layout{color:hsla(0,0%,100%,.85)}.card-layout{border-radius:6px;padding:15px}.card-layout-title-sign{padding-left:10px;position:relative}.card-layout-title-sign:before{background:var(--color-primary,#1677ff);border-radius:3px;bottom:0;content:"";left:0;position:absolute;top:50%;transform:translateY(-50%);width:3px}.card-layout-title{align-items:center;display:flex;position:relative}.card-layout-title+.card-layout-content{margin-top:8px}.card-layout-title-content{flex:1;font-size:16px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.card-layout-title-extra{margin-left:15px}.card-layout-desc,.card-layout-desc-list{font-size:12px;opacity:.7}.card-layout+.card-layout,.card-layout-desc+.card-layout-content,.card-layout-desc-list+.card-layout-content{margin-top:8px}.card-layout-title-fixed{display:flex;flex-direction:column;height:100%;overflow:hidden}.card-layout-title-fixed>.card-layout-content{flex:1;overflow-y:auto}.card-layout-small{padding:8px 15px}.card-layout-small .card-layout-content{margin-top:0}.card-layout-small .card-layout-title-content{font-size:14px}.card-layout-tight{border-radius:0;padding:0}
|
package/esm/easy-form/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.easy-form{background-color:var(--block-bg-color)}
|
|
1
|
+
.easy-form{background-color:var(--block-bg-color)}.easy-form-anchor{height:0;width:0}
|
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 l}from"../_rollupPluginBabelHelpers-a0769acd.js";import{isUndefinedOrNull as t,dom as i}from"@flatbiz/utils";import{useMemo as n,useRef as a,Fragment as o,Children as s}from"react";import{BoxGrid as m}from"../box-grid/index.js";import{fbaHooks as f}from"../fba-hooks/index.js";import{FormWrapper as u}from"../form-wrapper/index.js";import{jsxs as d,jsx as c}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 p=["column","forceColumn","children","width","gridGutter","labelWidth","labelItemVertical","labelAlign","formItemGap"];var x=function x(v){var h=f.useResponsivePoint()||"";var g=v.column,b=v.forceColumn,y=v.children,j=v.width,w=v.gridGutter,I=v.labelWidth,N=v.labelItemVertical,G=v.labelAlign,C=v.formItemGap,A=e(v,p);var W=n((function(){if(b){var r=24/b;return{xs:r,sm:r,md:r,lg:r,xl:r,xxl:r}}if(!g){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[g]}),[g,b]);var k=function r(){return s.toArray(y).map((function(r,e){if(r.props["hidden"])return null;if(r.type["domTypeName"]==="BoxGridCol")return c(o,{children:r},e);var t=undefined;if(r.type["domTypeName"]==="FormItemWrapper"){t=r.props["span"];if(t){if(h==="xs"){t=24}else if(h==="sm"){t=t>12?t:12}}}return c(m.Col,l({},W,{span:t,children:r}),e)})).filter(Boolean)};var B=n((function(){if(["xs","sm"].includes(h)||!j){return{}}return{width:j}}),[h]);var P=t(w)?[15,0]:w;var R=a(null);var V=n((function(){try{if(R.current){var r=i.findParentsElement(R.current,(function(r){var e;return(e=r.classList)==null||e.contains==null?void 0:e.contains("easy-form")}));return r?true:false}return undefined}catch(r){return false}}),[R.current]);var T=n((function(){var r="";if(I){r+="form-label-"+I}if(N){r+=" form-label-value-vertical"}if(G){r+=" form-label-align-"+G}if(C){r+=" form-formitem-gap-"+C}return r}),[I,N,G,C]);return d(o,{children:[c("div",{className:"easy-form-anchor",ref:R}),V===true?c("div",{style:l({},B,A.style),className:r(T,"easy-form","easy-form-nested",A.className),children:c(m.Row,{gutter:P,children:k()})}):undefined,V===false?c(u,l({},A,{labelWidth:I,labelAlign:G,labelItemVertical:N,formItemGap:C,style:l({},B,A.style),className:r("easy-form",A.className),autoComplete:"off",children:c(m.Row,{gutter:P,children:k()})})):undefined]})};export{x 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. 布局网格以当前节点的宽度来计算的,不是屏幕宽度\n * 2. EasyForm 子节点包含 hidden = true 会被忽略\n * 3. 通过 column 可定义一行显示几列FormItem\n * 4. demo:https://fex.qa.tcshuke.com/docs/admin/main/form/label\n * 5. 通过 labelItemVertical 可定义 formitem 竖直布局\n * 6. 通过 formItemGap 可定义 formItem竖直方向间隙\n * 7. 通过 forceColumn 可强制定义一行显示几列,不考虑响应式\n * 8. 通过 labelWidth 可控制Form内部所有label的宽度(可实现整齐效果)\n\n * 例如\n * <EasyForm column={3}>\n <Form.Item name=\"field1\" label=\"条件1\">\n <Input placeholder=\"请输入\" allowClear={true} />\n </Form.Item>\n <Form.Item name=\"field2\" label=\"条件2\">\n <Input placeholder=\"请输入\" allowClear={true} />\n </Form.Item>\n <!-- !!!可通过使用 BoxGrid.Col 包裹元素来自定义网格占比 !!! -->\n <BoxGrid.Col span={24}>\n <Form.Item name=\"field5\" label=\"条件5\">\n <Input placeholder=\"请输入\" allowClear={true} />\n </Form.Item>\n </BoxGrid.Col>\n <Form.Item name=\"field6\" label=\"条件6\">\n <Input placeholder=\"请输入\" allowClear={true} />\n </Form.Item>\n </EasyForm>\n * ```\n */\nexport const EasyForm = (props: EasyFormProps) => {\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 return (\n <BoxGrid.Col key={index} {...gridSize}>\n {item}\n </BoxGrid.Col>\n );\n })\n .filter(Boolean);\n };\n\n const screenType = fbaHooks.useResponsivePoint() || '';\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","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","BoxGrid","Col","_extends","filter","Boolean","screenType","fbaHooks","useResponsivePoint","innerStyle","includes","gutter","isUndefinedOrNull","FormWrapper","style","className","_classNames","autoComplete","Row"],"m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wB,GACpD,IAAMC,EAAa1B,GAAQ,WAEzB,GAAI,CAAC,KAAM,MAAM2B,SAASJ,GAAc,MAAQ7B,EAAO,CACrD,MAAO,EACT,CACA,MAAO,CAAEA,MAAAA,EACX,GAAG,CAAC6B,IAEJ,IAAMK,EAAUC,EAAkBlC,GAAc,CAAC,GAAI,GAAKA,EAE1D,OACEqB,EAACc,EAAWV,KACNxB,EAAU,CACdmC,MAAKX,EAAOM,CAAAA,EAAAA,EAAe9B,EAAWmC,OACtCC,UAAWC,EAAWrC,EAAWoC,UAAW,aAC5CE,aAAa,MAAKzC,SAElBuB,EAACE,EAAQiB,IAAG,CAACP,OAAQA,EAAOnC,SAAEgB,QAGpC"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/easy-form/form.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { dom, isUndefinedOrNull } from '@flatbiz/utils';\nimport { Children, Fragment, ReactNode, useMemo, useRef } 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: ReactNode;\n};\n\n/**\n * 简单Form布局,可自定义网格布局\n * ```\n * 1. demo:https://fex.qa.tcshuke.com/docs/admin/main/form/grid\n * 2. EasyForm可嵌套使用,嵌套内部的<EasyForm />节点Form属性失效,例如属性form、initialValues等都失效\n * 3. 布局网格以当前节点的宽度来计算的,不是屏幕宽度\n * 4. EasyForm 子节点包含 hidden = true 会被忽略\n * 5. 通过 column 可定义一行显示几列FormItem\n * 6. 通过 labelItemVertical 可定义 formitem 竖直布局\n * 7. 通过 formItemGap 可定义 formItem竖直方向间隙\n * 8. 通过 forceColumn 可强制定义一行显示几列,不考虑响应式\n * 9. 通过 labelWidth 可控制Form内部所有label的宽度(可实现整齐效果)\n * 10. 自定义栅格占位格数,见下方`例如`\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 {\n column,\n forceColumn,\n children,\n width,\n gridGutter,\n labelWidth,\n labelItemVertical,\n labelAlign,\n formItemGap,\n ...otherProps\n } = 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 }, [column, forceColumn]);\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 const anchorRef = useRef<HTMLDivElement>(null);\n\n // 是否嵌套EasyForm节点\n const isNestedEasyForm = useMemo(() => {\n try {\n if (anchorRef.current) {\n const target = dom.findParentsElement(anchorRef.current, (node) => {\n return node.classList?.contains?.('easy-form');\n });\n return target ? true : false;\n }\n return undefined;\n } catch (error) {\n return false;\n }\n }, [anchorRef.current]);\n\n const fromLayoutClassName = useMemo(() => {\n let cn = '';\n if (labelWidth) {\n cn += `form-label-${labelWidth}`;\n }\n if (labelItemVertical) {\n cn += ` form-label-value-vertical`;\n }\n if (labelAlign) {\n cn += ` form-label-align-${labelAlign}`;\n }\n if (formItemGap) {\n cn += ` form-formitem-gap-${formItemGap}`;\n }\n return cn;\n }, [labelWidth, labelItemVertical, labelAlign, formItemGap]);\n\n return (\n <Fragment>\n <div className=\"easy-form-anchor\" ref={anchorRef}></div>\n {isNestedEasyForm === true ? (\n <div\n style={{ ...innerStyle, ...otherProps.style }}\n className={classNames(fromLayoutClassName, 'easy-form', 'easy-form-nested', otherProps.className)}\n >\n <BoxGrid.Row gutter={gutter}>{getFormRowChildren()}</BoxGrid.Row>\n </div>\n ) : undefined}\n {isNestedEasyForm === false ? (\n <FormWrapper\n {...otherProps}\n labelWidth={labelWidth}\n labelAlign={labelAlign}\n labelItemVertical={labelItemVertical}\n formItemGap={formItemGap}\n style={{ ...innerStyle, ...otherProps.style }}\n className={classNames('easy-form', otherProps.className)}\n autoComplete=\"off\"\n >\n <BoxGrid.Row gutter={gutter}>{getFormRowChildren()}</BoxGrid.Row>\n </FormWrapper>\n ) : undefined}\n </Fragment>\n );\n};\n"],"names":["EasyForm","props","screenType","fbaHooks","useResponsivePoint","column","forceColumn","children","width","gridGutter","labelWidth","labelItemVertical","labelAlign","formItemGap","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","anchorRef","useRef","isNestedEasyForm","current","target","dom","findParentsElement","node","_node$classList","classList","contains","error","fromLayoutClassName","cn","_jsxs","className","ref","style","_classNames","Row","FormWrapper","autoComplete"],"mappings":";mvBAmFaA,EAAW,SAAXA,EAAYC,GACvB,IAAMC,EAAaC,EAASC,sBAAwB,GAEpD,IACEC,EAUEJ,EAVFI,OACAC,EASEL,EATFK,YACAC,EAQEN,EARFM,SACAC,EAOEP,EAPFO,MACAC,EAMER,EANFQ,WACAC,EAKET,EALFS,WACAC,EAIEV,EAJFU,kBACAC,EAGEX,EAHFW,WACAC,EAEEZ,EAFFY,YACGC,EAAUC,EACXd,EAAKe,GAET,IAAMC,EAAWC,GAAQ,WACvB,GAAIZ,EAAa,CACf,IAAMa,EAAM,GAAKb,EACjB,MAAO,CAAEc,GAAID,EAAKE,GAAIF,EAAKG,GAAIH,EAAKI,GAAIJ,EAAKK,GAAIL,EAAKM,IAAKN,EAC7D,CACA,IAAKd,EAAQ,CACX,MAAO,CAAEe,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,IAAK,GAChD,EAAG,CAAEL,GAAI,GAAIC,GAAI,GAAIC,GAAI,GAAIC,GAAI,EAAGC,GAAI,EAAGC,IAAK,IAElD,OAAOC,EAAUrB,EACnB,GAAG,CAACA,EAAQC,IAEZ,IAAMqB,EAAqB,SAArBA,IACJ,OAAOC,EAASC,QAAQtB,GACrBuB,KAAI,SAACC,EAAWC,GACf,GAAID,EA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O+C,CACR,GAAE,CAAClD,EAAYC,EAAmBC,EAAYC,IAE/C,OACEgD,EAAC1B,EAAQ,CAAA5B,UACP2B,EAAA,MAAA,CAAK4B,UAAU,mBAAmBC,IAAKhB,IACtCE,IAAqB,KACpBf,EAAA,MAAA,CACE8B,MAAKxB,EAAOG,CAAAA,EAAAA,EAAe7B,EAAWkD,OACtCF,UAAWG,EAAWN,EAAqB,YAAa,mBAAoB7C,EAAWgD,WAAWvD,SAElG2B,EAACI,EAAQ4B,IAAG,CAACrB,OAAQA,EAAOtC,SAAEoB,QAE9BU,UACHY,IAAqB,MACpBf,EAACiC,EAAW3B,KACN1B,EAAU,CACdJ,WAAYA,EACZE,WAAYA,EACZD,kBAAmBA,EACnBE,YAAaA,EACbmD,MAAKxB,EAAOG,CAAAA,EAAAA,EAAe7B,EAAWkD,OACtCF,UAAWG,EAAW,YAAanD,EAAWgD,WAC9CM,aAAa,MAAK7D,SAElB2B,EAACI,EAAQ4B,IAAG,CAACrB,OAAQA,EAAOtC,SAAEoB,SAE9BU,YAGV"}
|
|
@@ -3,5 +3,5 @@ import './../fba-hooks/index.css';
|
|
|
3
3
|
import './../flex-layout/index.css';
|
|
4
4
|
import './index.css';
|
|
5
5
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
6
|
-
import{_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{classNames as r}from"@dimjs/utils/cjs/class-names";import{fbaHooks as t}from"../fba-hooks/index.js";import{jsxs as i,jsx as o}from"react/jsx-runtime";import{Form as l}from"antd";import{useMemo as
|
|
6
|
+
import{_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{classNames as r}from"@dimjs/utils/cjs/class-names";import{fbaHooks as t}from"../fba-hooks/index.js";import{jsxs as i,jsx as o}from"react/jsx-runtime";import{Form as l}from"antd";import{useMemo as a,isValidElement as n,cloneElement as s}from"react";import{FlexLayout as m}from"../flex-layout/index.js";import"@dimjs/lang/cjs/is-array";import"@wove/react/cjs/hooks";import"@flatbiz/utils";import"../use-responsive-point-21b8c601.js";var f=function l(a){var n;var s="form-item-group-card";var m=t.useThemeToken();var f={"--form-item-group-colorPrimary":m.colorPrimary};return i("div",{className:r(s,a.className),style:e({},f,a.style),children:[a.title?o("div",{className:r(s+"-title",(n={},n[s+"-title-sign"]=a.titleSign===true,n)),children:a.title}):null,a.children]})};f.defaultProps={titleSign:true};var u=function t(i){var f=a((function(){var r=[];var t=[];var l=i.groupConfigList.filter((function(e){return!e.hidden}));l.forEach((function(i){if(i.before){t.push(n(i.before)?i.before:o("div",{className:"union-before-text",children:i.before}))}if(i.width){t.push(s(i.mainItem,{style:e({width:i.width},i.mainItem.props.style)}))}else{r.push(t.length);t.push(i.mainItem)}if(i.after){t.push(n(i.after)?i.after:o("div",{className:"union-after-text",children:i.after}))}}));return{flexElementList:t,fullIndex:r}}),[i.groupConfigList]);return o(l.Item,{label:i.label,className:r("form-item-group-horizontal-union",i.className),style:i.style,hidden:i.hidden,required:i.required,colon:i.colon,children:o(m,{direction:"horizontal",gap:i.gap===undefined?15:i.gap,fullIndex:f.fullIndex,style:i.flexLayoutStyle,className:i.flexLayoutClassName,children:f.flexElementList.map((function(e,r){return s(e,{key:r})}))})})};var d={HorizontalUnion:u,Card:f};export{d as FormItemGroup};
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-item-group/card/index.tsx","@flatbiz/antd/src/form-item-group/horizontal-union/index.tsx","@flatbiz/antd/src/form-item-group/index.ts"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { CSSProperties, FC, ReactElement } from 'react';\nimport { fbaHooks } from '../../fba-hooks';\nimport './style.less';\n\nexport type FormItemCardProps = {\n title?: string | ReactElement;\n children: ReactElement | ReactElement[];\n className?: string;\n style?: CSSProperties;\n titleSign?: boolean;\n};\nexport const FormItemCard: FC<FormItemCardProps> = (props) => {\n const classNamePrefix = 'form-item-group-card';\n\n const theme = fbaHooks.useThemeToken();\n\n const style = { '--form-item-group-colorPrimary': theme.colorPrimary } as CSSProperties;\n\n return (\n <div className={classNames(classNamePrefix, props.className)} style={{ ...style, ...props.style }}>\n {props.title ? (\n <div\n className={classNames(`${classNamePrefix}-title`, {\n [`${classNamePrefix}-title-sign`]: props.titleSign === true,\n })}\n >\n {props.title}\n </div>\n ) : null}\n {props.children}\n </div>\n );\n};\n\nFormItemCard.defaultProps = {\n titleSign: true,\n};\n","import { classNames } from '@dimjs/utils';\nimport { Form } from 'antd';\nimport { cloneElement, CSSProperties, isValidElement, ReactElement, useMemo } from 'react';\nimport { FlexLayout } from '../../flex-layout';\nimport './style.less';\n\nexport type FormItemHorizontalUnionProps = {\n className?: string;\n style?: CSSProperties;\n label?: string | ReactElement;\n groupConfigList: {\n hidden?: boolean;\n before?: ReactElement | string;\n /**\n * 设置宽度\n * ```\n * 1. 自适应可设置:auto\n * 2. 可设置具体数值\n * 3. 不设置会在铺满flex剩余空间\n * 4. 多个未设置会等分铺满剩余空间\n * ```\n */\n width?: number | string;\n mainItem: ReactElement;\n after?: ReactElement | string;\n }[];\n gap?: number;\n flexLayoutStyle?: CSSProperties;\n hidden?: boolean;\n required?: boolean;\n colon?: boolean;\n};\n\n/**\n * FormItem 水平布局\n * ```\n * Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/input\n * ```\n * @param props\n * @returns\n */\nexport const FormItemHorizontalUnion = (props: FormItemHorizontalUnionProps) => {\n const groupFlexElementData = useMemo(() => {\n const fullIndex = [] as number[];\n const flexElementList = [] as Array<ReactElement>;\n const groupConfigList = props.groupConfigList.filter((item) => !item.hidden);\n groupConfigList.forEach((item) => {\n if (item.before) {\n flexElementList.push(\n isValidElement(item.before) ? (\n (item.before as ReactElement)\n ) : (\n <div className=\"union-before-text\">{item.before}</div>\n ),\n );\n }\n if (item.width) {\n flexElementList.push(\n cloneElement(item.mainItem, {\n style: { width: item.width, ...item.mainItem.props.style },\n }),\n );\n } else {\n fullIndex.push(flexElementList.length);\n flexElementList.push(item.mainItem);\n }\n if (item.after) {\n flexElementList.push(\n isValidElement(item.after) ? (\n (item.after as ReactElement)\n ) : (\n <div className=\"union-after-text\">{item.after}</div>\n ),\n );\n }\n });\n return {\n flexElementList,\n fullIndex,\n };\n }, [props.groupConfigList]);\n\n return (\n <Form.Item\n label={props.label}\n className={classNames('form-item-group-horizontal-union', props.className)}\n style={props.style}\n hidden={props.hidden}\n required={props.required}\n colon={props.colon}\n >\n <FlexLayout\n direction=\"horizontal\"\n gap={props.gap === undefined ? 15 : props.gap}\n fullIndex={groupFlexElementData.fullIndex}\n style={props.flexLayoutStyle}\n >\n {groupFlexElementData.flexElementList.map((item, index) => {\n return cloneElement(item, { key: index });\n })}\n </FlexLayout>\n </Form.Item>\n );\n};\n","import { FormItemCard } from './card';\nimport { FormItemHorizontalUnion } from './horizontal-union';\n\nexport const FormItemGroup = {\n HorizontalUnion: FormItemHorizontalUnion,\n Card: FormItemCard,\n};\n"],"names":["FormItemCard","props","_classNames2","classNamePrefix","theme","fbaHooks","useThemeToken","style","colorPrimary","_jsxs","className","_classNames","_extends","children","title","_jsx","titleSign","defaultProps","FormItemHorizontalUnion","groupFlexElementData","useMemo","fullIndex","flexElementList","groupConfigList","filter","item","hidden","forEach","before","push","isValidElement","width","cloneElement","mainItem","length","after","Form","Item","label","required","colon","FlexLayout","direction","gap","undefined","flexLayoutStyle","map","index","key","FormItemGroup","HorizontalUnion","Card"],"mappings":";mfAYO,IAAMA,EAAsC,SAAtCA,EAAuCC,GAAU,IAAAC,EAC5D,IAAMC,EAAkB,uBAExB,IAAMC,EAAQC,EAASC,gBAEvB,IAAMC,EAAQ,CAAE,iCAAkCH,EAAMI,cAExD,OACEC,EAAA,MAAA,CAAKC,UAAWC,EAAWR,EAAiBF,EAAMS,WAAYH,MAAKK,EAAOL,CAAAA,EAAAA,EAAUN,EAAMM,OAAQM,SAC/FZ,CAAAA,EAAMa,MACLC,EAAA,MAAA,CACEL,UAAWC,EAAcR,EAAeD,UAAAA,KAAAA,EAClCC,EAA+BF,eAAAA,EAAMe,YAAc,KAAId,IAC1DW,SAEFZ,EAAMa,QAEP,KACHb,EAAMY,WAGb,EAEAb,EAAaiB,aAAe,CAC1BD,UAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-item-group/card/index.tsx","@flatbiz/antd/src/form-item-group/horizontal-union/index.tsx","@flatbiz/antd/src/form-item-group/index.ts"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { CSSProperties, FC, ReactElement } from 'react';\nimport { fbaHooks } from '../../fba-hooks';\nimport './style.less';\n\nexport type FormItemCardProps = {\n title?: string | ReactElement;\n children: ReactElement | ReactElement[];\n className?: string;\n style?: CSSProperties;\n titleSign?: boolean;\n};\nexport const FormItemCard: FC<FormItemCardProps> = (props) => {\n const classNamePrefix = 'form-item-group-card';\n\n const theme = fbaHooks.useThemeToken();\n\n const style = { '--form-item-group-colorPrimary': theme.colorPrimary } as CSSProperties;\n\n return (\n <div className={classNames(classNamePrefix, props.className)} style={{ ...style, ...props.style }}>\n {props.title ? (\n <div\n className={classNames(`${classNamePrefix}-title`, {\n [`${classNamePrefix}-title-sign`]: props.titleSign === true,\n })}\n >\n {props.title}\n </div>\n ) : null}\n {props.children}\n </div>\n );\n};\n\nFormItemCard.defaultProps = {\n titleSign: true,\n};\n","import { classNames } from '@dimjs/utils';\nimport { Form } from 'antd';\nimport { cloneElement, CSSProperties, isValidElement, ReactElement, useMemo } from 'react';\nimport { FlexLayout } from '../../flex-layout';\nimport './style.less';\n\nexport type FormItemHorizontalUnionProps = {\n className?: string;\n style?: CSSProperties;\n label?: string | ReactElement;\n groupConfigList: {\n hidden?: boolean;\n before?: ReactElement | string;\n /**\n * 设置宽度\n * ```\n * 1. 自适应可设置:auto\n * 2. 可设置具体数值\n * 3. 不设置会在铺满flex剩余空间\n * 4. 多个未设置会等分铺满剩余空间\n * ```\n */\n width?: number | string;\n mainItem: ReactElement;\n after?: ReactElement | string;\n }[];\n gap?: number;\n flexLayoutStyle?: CSSProperties;\n flexLayoutClassName?: string;\n hidden?: boolean;\n required?: boolean;\n colon?: boolean;\n};\n\n/**\n * FormItem 水平布局\n * ```\n * Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/input\n * ```\n * @param props\n * @returns\n */\nexport const FormItemHorizontalUnion = (props: FormItemHorizontalUnionProps) => {\n const groupFlexElementData = useMemo(() => {\n const fullIndex = [] as number[];\n const flexElementList = [] as Array<ReactElement>;\n const groupConfigList = props.groupConfigList.filter((item) => !item.hidden);\n groupConfigList.forEach((item) => {\n if (item.before) {\n flexElementList.push(\n isValidElement(item.before) ? (\n (item.before as ReactElement)\n ) : (\n <div className=\"union-before-text\">{item.before}</div>\n ),\n );\n }\n if (item.width) {\n flexElementList.push(\n cloneElement(item.mainItem, {\n style: { width: item.width, ...item.mainItem.props.style },\n }),\n );\n } else {\n fullIndex.push(flexElementList.length);\n flexElementList.push(item.mainItem);\n }\n if (item.after) {\n flexElementList.push(\n isValidElement(item.after) ? (\n (item.after as ReactElement)\n ) : (\n <div className=\"union-after-text\">{item.after}</div>\n ),\n );\n }\n });\n return {\n flexElementList,\n fullIndex,\n };\n }, [props.groupConfigList]);\n\n return (\n <Form.Item\n label={props.label}\n className={classNames('form-item-group-horizontal-union', props.className)}\n style={props.style}\n hidden={props.hidden}\n required={props.required}\n colon={props.colon}\n >\n <FlexLayout\n direction=\"horizontal\"\n gap={props.gap === undefined ? 15 : props.gap}\n fullIndex={groupFlexElementData.fullIndex}\n style={props.flexLayoutStyle}\n className={props.flexLayoutClassName}\n >\n {groupFlexElementData.flexElementList.map((item, index) => {\n return cloneElement(item, { key: index });\n })}\n </FlexLayout>\n </Form.Item>\n );\n};\n","import { FormItemCard } from './card';\nimport { FormItemHorizontalUnion } from './horizontal-union';\n\nexport const FormItemGroup = {\n HorizontalUnion: FormItemHorizontalUnion,\n Card: FormItemCard,\n};\n"],"names":["FormItemCard","props","_classNames2","classNamePrefix","theme","fbaHooks","useThemeToken","style","colorPrimary","_jsxs","className","_classNames","_extends","children","title","_jsx","titleSign","defaultProps","FormItemHorizontalUnion","groupFlexElementData","useMemo","fullIndex","flexElementList","groupConfigList","filter","item","hidden","forEach","before","push","isValidElement","width","cloneElement","mainItem","length","after","Form","Item","label","required","colon","FlexLayout","direction","gap","undefined","flexLayoutStyle","flexLayoutClassName","map","index","key","FormItemGroup","HorizontalUnion","Card"],"mappings":";mfAYO,IAAMA,EAAsC,SAAtCA,EAAuCC,GAAU,IAAAC,EAC5D,IAAMC,EAAkB,uBAExB,IAAMC,EAAQC,EAASC,gBAEvB,IAAMC,EAAQ,CAAE,iCAAkCH,EAAMI,cAExD,OACEC,EAAA,MAAA,CAAKC,UAAWC,EAAWR,EAAiBF,EAAMS,WAAYH,MAAKK,EAAOL,CAAAA,EAAAA,EAAUN,EAAMM,OAAQM,SAC/FZ,CAAAA,EAAMa,MACLC,EAAA,MAAA,CACEL,UAAWC,EAAcR,EAAeD,UAAAA,KAAAA,EAClCC,EAA+BF,eAAAA,EAAMe,YAAc,KAAId,IAC1DW,SAEFZ,EAAMa,QAEP,KACHb,EAAMY,WAGb,EAEAb,EAAaiB,aAAe,CAC1BD,UAAW,MCMN,IAAME,EAA0B,SAA1BA,EAA2BjB,GACtC,IAAMkB,EAAuBC,GAAQ,WACnC,IAAMC,EAAY,GAClB,IAAMC,EAAkB,GACxB,IAAMC,EAAkBtB,EAAMsB,gBAAgBC,QAAO,SAACC,GAAI,OAAMA,EAAKC,UACrEH,EAAgBI,SAAQ,SAACF,GACvB,GAAIA,EAAKG,OAAQ,CACfN,EAAgBO,KACdC,EAAeL,EAAKG,QACjBH,EAAKG,OAENb,EAAA,MAAA,CAAKL,UAAU,oBAAmBG,SAAEY,EAAKG,SAG/C,CACA,GAAIH,EAAKM,MAAO,CACdT,EAAgBO,KACdG,EAAaP,EAAKQ,SAAU,CAC1B1B,MAAKK,EAAA,CAAImB,MAAON,EAAKM,OAAUN,EAAKQ,SAAShC,MAAMM,SAGzD,KAAO,CACLc,EAAUQ,KAAKP,EAAgBY,QAC/BZ,EAAgBO,KAAKJ,EAAKQ,SAC5B,CACA,GAAIR,EAAKU,MAAO,CACdb,EAAgBO,KACdC,EAAeL,EAAKU,OACjBV,EAAKU,MAENpB,EAAA,MAAA,CAAKL,UAAU,mBAAkBG,SAAEY,EAAKU,QAG9C,CACF,IACA,MAAO,CACLb,gBAAAA,EACAD,UAAAA,EAEJ,GAAG,CAACpB,EAAMsB,kBAEV,OACER,EAACqB,EAAKC,KAAI,CACRC,MAAOrC,EAAMqC,MACb5B,UAAWC,EAAW,mCAAoCV,EAAMS,WAChEH,MAAON,EAAMM,MACbmB,OAAQzB,EAAMyB,OACda,SAAUtC,EAAMsC,SAChBC,MAAOvC,EAAMuC,MAAM3B,SAEnBE,EAAC0B,EAAU,CACTC,UAAU,aACVC,IAAK1C,EAAM0C,MAAQC,UAAY,GAAK3C,EAAM0C,IAC1CtB,UAAWF,EAAqBE,UAChCd,MAAON,EAAM4C,gBACbnC,UAAWT,EAAM6C,oBAAoBjC,SAEpCM,EAAqBG,gBAAgByB,KAAI,SAACtB,EAAMuB,GAC/C,OAAOhB,EAAaP,EAAM,CAAEwB,IAAKD,UAK3C,ECtGO,IAAME,EAAgB,CAC3BC,gBAAiBjC,EACjBkC,KAAMpD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import './index.css';
|
|
3
3
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
4
|
-
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?:
|
|
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 * 2. 可设置`auto`自适应\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?: boolean;\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":";mfA0EA,IAAMA,EAA0B,SAA1BA,EAA2BC,GAC/B,IAAQC,EAA+CD,EAA/CC,QAASC,EAAsCF,EAAtCE,SAAUC,EAA4BH,EAA5BG,eAAmBC,EAAIC,EAAKL,EAAKM,GAE5D,IAAMC,EAAWH,EAAKI,eAAe,SACrC,GAAID,GAAYJ,EAAgB,CAC9BC,EAAK,SAAWD,EAAeC,EAAK,SACtC,CACA,IAAMK,EAAYC,EAAaR,EAAUS,EAAaT,EAASF,MAAOI,EAAM,OAC5E,GAAIH,EAAS,CACX,OAAOA,EAAQQ,EACjB,CACA,GAAIT,EAAMY,QAAUZ,EAAMa,MAAO,CAC/B,OACEC,EAAA,MAAA,CAAKC,MAAO,CAAEC,QAAS,OAAQC,WAAY,UAAWf,SACnDF,CAAAA,EAAMY,OAASM,EAAA,OAAA,CAAMH,MAAO,CAAEI,YAAa,IAAKjB,SAAEF,EAAMY,SAAiB,KAC1EM,EAAA,MAAA,CAAKH,MAAO,CAAEK,KAAM,GAAIlB,SAAEO,IACzBT,EAAMa,MAAQK,EAAA,OAAA,CAAMH,MAAO,CAAEM,WAAY,IAAKnB,SAAEF,EAAMa,QAAgB,OAG7E,CACA,OAAOJ,CACT,MAUaa,EAAkB,SAAlBA,EAAmBtB,GAC9B,IACEC,EAWED,EAXFC,QACAsB,EAUEvB,EAVFuB,QACAC,EASExB,EATFwB,WACAC,EAQEzB,EARFyB,kBACAC,EAOE1B,EAPF0B,WACAxB,EAMEF,EANFE,SACAU,EAKEZ,EALFY,OACAC,EAIEb,EAJFa,MACAV,EAGEH,EAHFG,eACAwB,EAEE3B,EAFF2B,gBACGvB,EAAIC,EACLL,EAAK4B,GAET,IAAMC,EAAiBC,GAAQ,WAC7B,IAAIC,EAAK,GACT,GAAIP,EAAY,CACdO,sBAAyBP,CAC3B,CACA,GAAIC,EAAmB,CACrBM,GAAuC,iCACzC,CACA,GAAIL,EAAY,CACdK,6BAAgCL,CAClC,CAEA,OAAOK,CACR,GAAE,CAACP,EAAYC,EAAmBC,IAEnC,GAAIH,EAAS,OAAO,KAEpB,OACEL,EAACc,EAAKC,KAAIC,EAAA,CAACC,UAAWR,GAAqBvB,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-wrapper/form-wrapper.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { Form, FormProps } from 'antd';\nimport { ReactNode, useMemo } from 'react';\n\nexport type FormWrapperProps<Values = any> = FormProps<Values> & {\n children: ReactNode;\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/form-wrapper/form-wrapper.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { Form, FormProps } from 'antd';\nimport { ReactNode, useMemo } from 'react';\n\nexport type FormWrapperProps<Values = any> = FormProps<Values> & {\n children: ReactNode;\n /**\n * label宽度,Form内部所有FormItem label都生效\n * ```\n * 1. 可设置数值\n * 2. 可设置`auto`自适应\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 /** labelItem 竖直布局 */\n labelItemVertical?: boolean;\n /** label 对齐方式 */\n labelAlign?: 'left' | 'right';\n /** formItem之间竖直间距,默认值:24 */\n formItemGap?: '15' | '8' | '5' | '0';\n};\n\n/**\n * Form 包装组件,添加对formItem的布局控制\n * ```\n * 1. 内置布局样式使用 preDefinedClassName.form\n * ```\n */\nexport const FormWrapper = (props: FormWrapperProps) => {\n const { labelWidth, labelItemVertical, labelAlign, formItemGap, ...rest } = props;\n\n const innerClassName = useMemo(() => {\n let cn = '';\n if (labelWidth) {\n cn += `form-label-${labelWidth}`;\n }\n if (labelItemVertical) {\n cn += ` form-label-value-vertical`;\n }\n if (labelAlign) {\n cn += ` form-label-align-${labelAlign}`;\n }\n if (formItemGap) {\n cn += ` form-formitem-gap-${formItemGap}`;\n }\n return cn;\n }, [labelWidth, labelItemVertical, labelAlign, formItemGap]);\n\n return <Form {...rest} className={classNames(innerClassName, rest.className)}></Form>;\n};\n"],"names":["FormWrapper","props","labelWidth","labelItemVertical","labelAlign","formItemGap","rest","_objectWithoutPropertiesLoose","_excluded","innerClassName","useMemo","cn","_jsx","Form","_extends","className","_classNames"],"mappings":";qSA4CaA,EAAc,SAAdA,EAAeC,GAC1B,IAAQC,EAAoED,EAApEC,WAAYC,EAAwDF,EAAxDE,kBAAmBC,EAAqCH,EAArCG,WAAYC,EAAyBJ,EAAzBI,YAAgBC,EAAIC,EAAKN,EAAKO,GAEjF,IAAMC,EAAiBC,GAAQ,WAC7B,IAAIC,EAAK,GACT,GAAIT,EAAY,CACdS,iBAAoBT,CACtB,CACA,GAAIC,EAAmB,CACrBQ,GAAkC,4BACpC,CACA,GAAIP,EAAY,CACdO,wBAA2BP,CAC7B,CACA,GAAIC,EAAa,CACfM,yBAA4BN,CAC9B,CACA,OAAOM,CACR,GAAE,CAACT,EAAYC,EAAmBC,EAAYC,IAE/C,OAAOO,EAACC,EAAIC,KAAKR,EAAI,CAAES,UAAWC,EAAWP,EAAgBH,EAAKS,aACpE"}
|
package/esm/index.js
CHANGED
|
@@ -119,5 +119,5 @@ import './tree-selector-wrapper/index.css';
|
|
|
119
119
|
import './tree-wrapper/index.css';
|
|
120
120
|
import './index.css';
|
|
121
121
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
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"@
|
|
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"@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";
|
|
123
123
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
+
import './../fba-hooks/index.css';
|
|
2
3
|
import './index.css';
|
|
3
4
|
/*! @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
|
|
5
|
+
import{a as r,_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{hooks as n}from"@wove/react/cjs/hooks";import{Flex as o,Button as t}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/utils";import"ahooks";import"../fba-hooks/index.js";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";var p=["prefix","operations"];var s=function s(v){var f=a({});var m=a();var d=a(0);var h=v.prefix,g=v.operations,x=g===void 0?[]:g,C=r(v,p);var b=function r(e){var n=v.value||"";var o=(B==null?void 0:B.selectionStart)||d.current;var t=(e.codeAdapter==null?void 0:e.codeAdapter())||""+e.codePrefix+k(e.codePrefix);var a=t.length+((h==null?void 0:h.length)||0)+2;if(n){n=n.slice(0,o)+y(t)+n.slice(o)}else{n=y(t)}v.onChange==null?void 0:v.onChange(n);if(v.onSelectParam){v.onSelectParam({code:t,type:e.type,value:undefined},h)}d.current+=a};var j=function r(e){var n;d.current=((n=v.value)==null?void 0:n.length)||0;if(v.onBlur){v.onBlur(e)}};var y=n.useCallbackRef((function(r){return(h||"")+"{"+r+"}"}));var k=n.useCallbackRef((function(r){var e=f.current;if(e[r]>=0){e[r]+=1}else{e[r]=0}return e[r]}));var B=i((function(){return m.current?m.current.getInputInstance():null}),[m.current]);var P=i((function(){var r=(v.params||[]).map((function(r){return y(r.code)}));var e=new Set(r);return Array.from(e)}),[v.params]);return u("div",{children:[x&&x.length>0&&c(o,{gap:4,style:{marginBottom:8},children:x.map((function(r){return c(t,{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:P,value:v.value,onBlur:j,onChange:v.onChange,onCursorChange:function r(e){d.current=e}}))]})};export{s as MetionEditor};
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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":";
|
|
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":";0eA0CaA,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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AME,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,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
+
import './../fba-hooks/index.css';
|
|
2
3
|
import './index.css';
|
|
3
4
|
/*! @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{
|
|
5
|
+
import{a as r,_ as e}from"../_rollupPluginBabelHelpers-a0769acd.js";import{hooks as n}from"@wove/react/cjs/hooks";import{toArray as t}from"@flatbiz/utils";import{useEventListener as o}from"ahooks";import{Mentions as i}from"antd";import{forwardRef as a,useRef as l,useState as u,useMemo as s,useImperativeHandle as v}from"react";import{fbaHooks as c}from"../fba-hooks/index.js";import{jsx as f}from"react/jsx-runtime";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";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=a((function(a,h){var m=a.value,k=a.onChange,y=a.onClick,S=a.onCursorChange,P=a.onSelect,w=a.options,C=a.prefix,R=r(a,p);var b=n.useId(undefined,"overall-input");var x=l();var W=u(0),j=W[0],A=W[1];var E=l(false);var I=m||"";var K=s((function(){if(w){return d({overallKeyWords:w||[],value:I})}return[]}),[w,I]);var q=function r(){var e;return(e=x.current)==null?void 0:e.textarea};c.useEffectCustom((function(){S==null?void 0:S(j||0)}),[j]);o("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;A(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;A(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){E.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){E.current=false}k==null?void 0:k(c)}}}),{target:function r(){return document.querySelector("#"+b)}});o("keyup",(function(r){var e;var n=((e=q())==null?void 0:e.selectionStart)||0;if(["ArrowUp","ArrowDown"].includes(r.code)){A(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("#"+b)}});var B=n.useCallbackRef((function(r){var e;if(R.disabled)return;if(E.current){E.current=false;return}var n=((e=q())==null?void 0:e.selectionStart)||0;A(n);k==null?void 0:k(r)}));var L=n.useCallbackRef((function(r){var e;var n=((e=q())==null?void 0:e.selectionStart)||0;A(n);y==null?void 0:y(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 $=function r(e,n){var t;var o=((t=e.value)==null?void 0:t.length)||0;A((function(r){return r+o}));if(P){P(e,n)}};var _=s((function(){var r=t(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]);v(h,(function(){return{getInputInstance:q}}));return f(i,e({notFoundContent:f("div",{children:"暂无数据"}),rows:3},R,{prefix:C,style:e({width:"100%"},R.style),id:b,value:I,ref:x,onSelect:$,onChange:B,onClick:L,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};
|
|
5
6
|
//# 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 { 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,OACnC,IAAMG,EAAUH,EACbI,QAAQ,MAAO,OACfA,QAAQ,MAAO,O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AAS,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
|
+
{"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 { forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react';\nimport { fbaHooks } from '../fba-hooks';\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":";8eAEO,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,EAAMI,KAAKnB,EAAOC,UAAY,KAAM,CAClDgB,EAAUG,KAAKF,EAAMG,MACvB,CACA,IAAMC,EAAuC,GAC7CL,EAAUR,SAAQ,SAACc,GACjBD,EAAUF,KAAK,CAAEI,MAAOD,EAAO,EAAGE,IAAKF,EAAOb,EAAKP,QACrD,IACAK,EAAaY,KAAKE,EACpB,IACA,OAAOd,CACT,EAKO,IAAMkB,EAAmC,SAAnCA,EAAoC1B,GAI/C,IAAK,IAAIqB,EAAQ,EAAGA,EAAQrB,EAAO2B,iBAAiBxB,OAAQkB,IAAS,CACnE,IAAMO,EAAU5B,EAAO2B,iBAAiBN,GAA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,QAAQ3G,EAAKT,QAAU,KACzE,OAAO8E,GAAUqC,EAAKjH,OAAS4E,EAAO9E,MAAME,OAAS,MAAQ,IAC7D,EACFqC,QAAS0D,IAGf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.form-item-label-70.ant-form-item .ant-form-item-label{width:70px}.form-item-label-80.ant-form-item .ant-form-item-label{width:80px}.form-item-label-90.ant-form-item .ant-form-item-label{width:90px}.form-item-label-100.ant-form-item .ant-form-item-label{width:100px}.form-item-label-110.ant-form-item .ant-form-item-label{width:110px}.form-item-label-120.ant-form-item .ant-form-item-label{width:120px}.form-item-label-130.ant-form-item .ant-form-item-label{width:130px}.form-item-label-140.ant-form-item .ant-form-item-label{width:140px}.form-item-label-150.ant-form-item .ant-form-item-label{width:150px}.form-item-label-160.ant-form-item .ant-form-item-label{width:160px}.form-item-label-170.ant-form-item .ant-form-item-label{width:170px}.form-item-label-180.ant-form-item .ant-form-item-label{width:180px}.form-item-label-190.ant-form-item .ant-form-item-label{width:190px}.form-item-label-200.ant-form-item .ant-form-item-label{width:200px}.form-item-label-auto:
|
|
1
|
+
.form-item-label-70.ant-form-item .ant-form-item-label{width:70px}.form-item-label-80.ant-form-item .ant-form-item-label{width:80px}.form-item-label-90.ant-form-item .ant-form-item-label{width:90px}.form-item-label-100.ant-form-item .ant-form-item-label{width:100px}.form-item-label-110.ant-form-item .ant-form-item-label{width:110px}.form-item-label-120.ant-form-item .ant-form-item-label{width:120px}.form-item-label-130.ant-form-item .ant-form-item-label{width:130px}.form-item-label-140.ant-form-item .ant-form-item-label{width:140px}.form-item-label-150.ant-form-item .ant-form-item-label{width:150px}.form-item-label-160.ant-form-item .ant-form-item-label{width:160px}.form-item-label-170.ant-form-item .ant-form-item-label{width:170px}.form-item-label-180.ant-form-item .ant-form-item-label{width:180px}.form-item-label-190.ant-form-item .ant-form-item-label{width:190px}.form-item-label-200.ant-form-item .ant-form-item-label{width:200px}.form-item-label-auto.ant-form-item .ant-form-item-row{flex-direction:row!important}.form-item-label-auto.ant-form-item .ant-form-item-label{width:auto!important}.form-item-label-auto.ant-form-item .ant-form-item-control{flex:1!important}.form-item-label-align-left.ant-form-item .ant-form-item-label{text-align:left}.form-item-label-align-right.ant-form-item .ant-form-item-label{text-align:right}.ant-form-item.form-item-label-value-vertical>.ant-form-item-row{flex-direction:column}.ant-form-item.form-item-label-value-vertical>.ant-form-item-row>.ant-form-item-label{text-align:left;width:100%}.ant-form-item.form-item-label-value-vertical>.ant-form-item-row>.ant-form-item-control{flex:initial}.form-label-70 .ant-form-item-label{width:70px}.form-label-80 .ant-form-item-label{width:80px}.form-label-90 .ant-form-item-label{width:90px}.form-label-100 .ant-form-item-label{width:100px}.form-label-110 .ant-form-item-label{width:110px}.form-label-120 .ant-form-item-label{width:120px}.form-label-130 .ant-form-item-label{width:130px}.form-label-140 .ant-form-item-label{width:140px}.form-label-150 .ant-form-item-label{width:150px}.form-label-160 .ant-form-item-label{width:160px}.form-label-170 .ant-form-item-label{width:170px}.form-label-180 .ant-form-item-label{width:180px}.form-label-190 .ant-form-item-label{width:190px}.form-label-200 .ant-form-item-label{width:200px}.form-label-auto .ant-form-item-label{width:auto}.form-label-align-left .ant-form-item-label{text-align:left}.form-label-align-right .ant-form-item-label{text-align:right}.form-label-value-vertical .ant-form-item:not(.form-item-label-auto) .ant-form-item-row{flex-direction:column}.form-label-value-vertical .ant-form-item:not(.form-item-label-auto) .ant-form-item-label{text-align:left;width:100%}.form-label-value-vertical .ant-form-item:not(.form-item-label-auto) .ant-form-item-control{flex:initial}.form-formitem-gap-15{margin-bottom:-15px}.form-formitem-gap-15 .ant-form-item{margin-bottom:15px}.form-formitem-gap-8{margin-bottom:-8px}.form-formitem-gap-8 .ant-form-item{margin-bottom:8px}.form-formitem-gap-5{margin-bottom:-5px}.form-formitem-gap-5 .ant-form-item{margin-bottom:5px}.form-formitem-gap-0,.form-formitem-gap-0 .ant-form-item{margin-bottom:0}
|
|
@@ -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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AAC,SAAA,SAAAC,EAAAC,GAAA,IAEbC,EACAC,EACAC,EApNpB,IAAIC,EAAA,SAsNiBrE,GAtNrB,IAuNc,OAAAgE,EAAOD,QAAQO,QAAOtE,GAAK,UAAA,EAALA,EAAOiD,UAAW,UAvN7C,CAAC,MAAAsB,GAAW,OAAON,EAAAM,EAAM,GAiNtB,IACQL,EAAOJ,EAASI,OAChBM,EAAO,IAAIC,KAAK,CAACP,GAAOA,EAAKQ,KAAM,CAAErF,KAAM6E,EAAK7E,OACrC,OAAA0E,QAAAY,QAAMzG,GAAa,UAAA,EAAbA,EAAgBsG,IAAtBI,eAA2BC,GApN1D,IAoNoBT,EAAWS,EACjB,OAAAb,EAAOD,QAAQY,QAAQP,GArN5B,CAAC,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,EA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