@flatbiz/antd 4.2.85 → 4.2.87
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/button-operate/index.js +2 -1
- package/esm/button-operate/index.js.map +1 -1
- package/esm/button-wrapper/index.js +2 -1
- package/esm/button-wrapper/index.js.map +1 -1
- package/esm/card-wrapper/index.css +1 -0
- package/esm/card-wrapper/index.js +5 -0
- package/esm/card-wrapper/index.js.map +1 -0
- package/esm/config-provider-wrapper/index.js +2 -1
- package/esm/config-provider-wrapper/index.js.map +1 -1
- package/esm/create-drawer-wrapper-model/index.js.map +1 -1
- package/esm/create-modal-wrapper-model/index.js.map +1 -1
- package/esm/dialog-alert/index.js +2 -1
- package/esm/dialog-alert/index.js.map +1 -1
- package/esm/dialog-confirm/index.js +2 -1
- package/esm/dialog-confirm/index.js.map +1 -1
- package/esm/dialog-drawer/index.js +2 -1
- package/esm/dialog-drawer/index.js.map +1 -1
- package/esm/dialog-drawer-content/index.js +2 -1
- package/esm/dialog-drawer-content/index.js.map +1 -1
- package/esm/dialog-loading/index.js.map +1 -1
- package/esm/dialog-modal/index.js +2 -1
- package/esm/dialog-modal/index.js.map +1 -1
- package/esm/drawer-wrapper/index.js.map +1 -1
- package/esm/dropdown-menu-wrapper/index.js +2 -1
- package/esm/dropdown-menu-wrapper/index.js.map +1 -1
- package/esm/easy-table/index.js +2 -1
- package/esm/easy-table/index.js.map +1 -1
- package/esm/editable-table/index.js +10 -1
- package/esm/editable-table/index.js.map +1 -1
- package/esm/fba-app/index.css +1 -1
- package/esm/fba-app/index.js +3 -1
- package/esm/fba-app/index.js.map +1 -1
- package/esm/fba-hooks/index.js +1 -1
- package/esm/fba-hooks/index.js.map +1 -1
- package/esm/flex-layout/index.js.map +1 -1
- package/esm/index-ac189a77.js +3 -0
- package/esm/index-ac189a77.js.map +1 -0
- package/esm/index.js +6 -5
- package/esm/label-value-layout/index.css +1 -1
- package/esm/label-value-layout/index.js +1 -1
- package/esm/label-value-layout/index.js.map +1 -1
- package/esm/local-loading/index.js.map +1 -1
- package/esm/pre-defined-class-name/index.css +1 -1
- package/esm/rich-text-editor/index.js +1 -1
- package/esm/rich-text-editor/index.js.map +1 -1
- package/esm/rule-describe/index.js +1 -1
- package/esm/rule-describe/index.js.map +1 -1
- package/esm/selector-wrapper/index.js +1 -1
- package/esm/selector-wrapper/index.js.map +1 -1
- package/esm/simple-layout/index.css +1 -1
- package/esm/simple-layout/index.js.map +1 -1
- package/esm/table-cell-render/index.js +2 -1
- package/esm/table-cell-render/index.js.map +1 -1
- package/esm/tag-list-select/index.js +1 -1
- package/esm/tag-list-select/index.js.map +1 -1
- package/esm/text-css-ellipsis/index.css +1 -1
- package/esm/text-css-ellipsis/index.js +1 -1
- package/esm/text-css-ellipsis/index.js.map +1 -1
- package/esm/text-overflow-render/index.js +2 -1
- package/esm/text-overflow-render/index.js.map +1 -1
- package/esm/tips-title/index.css +1 -1
- package/esm/tree-selector-wrapper/index.js.map +1 -1
- package/esm/tree-wrapper/index.css +1 -1
- package/esm/tree-wrapper/index.js +2 -1
- package/esm/tree-wrapper/index.js.map +1 -1
- package/esm/types/index.js.map +1 -1
- package/index.d.ts +208 -121
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/fba-hooks/use-array-change.ts","@flatbiz/antd/src/fba-hooks/use-effect-custom.ts","@flatbiz/antd/src/fba-hooks/use-effect-custom-async.ts","@flatbiz/antd/src/fba-hooks/use-previous.ts","@flatbiz/antd/src/fba-hooks/use-safe-state.ts","@flatbiz/antd/src/fba-hooks/use-theme.ts","@flatbiz/antd/src/fba-hooks/index.ts"],"sourcesContent":["import { isArray } from '@dimjs/lang';\nimport { hooks } from '@wove/react';\nimport { useRef } from 'react';\n\nexport const useArrayChange = <T>(defautDataList: Array<T>, forceUpdate = true) => {\n const changeListRef = useRef<Array<T>>(defautDataList);\n const update = hooks.useForceUpdate();\n const arrayOperate = {\n add: hooks.useCallbackRef((dataItem: T | Array<T>, isUnshift?: boolean) => {\n if (isUnshift) {\n const targetList = isArray(dataItem) ? dataItem : [dataItem];\n changeListRef.current = [...targetList, ...changeListRef.current];\n } else {\n changeListRef.current = changeListRef.current.concat(dataItem);\n }\n forceUpdate && update();\n }),\n update: hooks.useCallbackRef((index: number, dataItem: T) => {\n const target = changeListRef.current[index];\n if (target) {\n changeListRef.current[index] = { ...target, ...dataItem };\n }\n forceUpdate && update();\n }),\n delete: hooks.useCallbackRef((index: number) => {\n const deleteItem = changeListRef.current.splice(index, 1);\n forceUpdate && update();\n return deleteItem;\n }),\n resetList: hooks.useCallbackRef((dataList: Array<T>) => {\n changeListRef.current = dataList;\n forceUpdate && update();\n }),\n getList: hooks.useCallbackRef(() => {\n return changeListRef.current;\n }),\n };\n return [changeListRef.current, arrayOperate] as const;\n};\n","import { DependencyList, EffectCallback, useEffect } from 'react';\n\nexport const useEffectCustom = (fn: EffectCallback, deps: DependencyList) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useEffect(fn, deps);\n};\n","import { DependencyList, useEffect } from 'react';\n\nexport const useEffectCustomAsync = (fn: () => Promise<void>, deps: DependencyList) => {\n useEffect(() => {\n async function asyncFunction() {\n await fn();\n }\n void asyncFunction();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n};\n","import { useRef } from 'react';\n\nexport type ShouldUpdateFunc<T> = (prev: T | undefined, next: T) => boolean;\n\nconst defaultShouldUpdate = <T>(a?: T, b?: T) => !Object.is(a, b);\n\nexport function usePrevious<T>(\n state: T,\n shouldUpdate: ShouldUpdateFunc<T> = defaultShouldUpdate,\n): T | undefined {\n const prevRef = useRef<T>();\n const curRef = useRef<T>();\n\n if (shouldUpdate(curRef.current, state)) {\n prevRef.current = curRef.current;\n curRef.current = state;\n }\n\n return prevRef.current;\n}\n","import { hooks } from '@wove/react';\nimport { Dispatch, SetStateAction, useState } from 'react';\n\nexport const useSafeState = <S extends undefined | unknown>(\n initialState?: S | (() => S),\n): [S, Dispatch<SetStateAction<S>>] => {\n const [state, setState] = useState(initialState as S);\n const isMounted = hooks.useIsMounted();\n\n return [\n state,\n (value) => {\n if (isMounted.current) {\n return setState(value);\n }\n },\n ];\n};\n","import { theme } from 'antd';\n\nexport const useThemeToken = () => {\n const { token } = theme.useToken();\n return token;\n};\n","import { useArrayChange } from './use-array-change';\nimport { useEffectCustom } from './use-effect-custom';\nimport { useEffectCustomAsync } from './use-effect-custom-async';\nimport { usePrevious } from './use-previous';\nimport { useResponsivePoint } from './use-responsive-point';\nimport { useSafeState } from './use-safe-state';\nimport { useThemeToken } from './use-theme';\n\nexport const fbaHooks = {\n useEffectCustom: useEffectCustom,\n useEffectCustomAsync: useEffectCustomAsync,\n useThemeToken: useThemeToken,\n useArrayChange: useArrayChange,\n usePrevious: usePrevious,\n useResponsivePoint: useResponsivePoint,\n useSafeState: useSafeState,\n};\n"],"names":["useArrayChange","defautDataList","forceUpdate","changeListRef","useRef","update","_hooks","useForceUpdate","arrayOperate","add","useCallbackRef","dataItem","isUnshift","targetList","_isArray","current","concat","index","target","_extends","delete","deleteItem","splice","resetList","dataList","getList","useEffectCustom","fn","deps","useEffect","useEffectCustomAsync","asyncFunction","Promise","$return","$error","resolve","then","$await_1","$boundEx","defaultShouldUpdate","a","b","Object","is","usePrevious","state","shouldUpdate","prevRef","curRef","useSafeState","initialState","_useState","useState","setState","isMounted","useIsMounted","value","useThemeToken","_theme$useToken","theme","useToken","token","fbaHooks","useResponsivePoint"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/fba-hooks/use-array-change.ts","@flatbiz/antd/src/fba-hooks/use-effect-custom.ts","@flatbiz/antd/src/fba-hooks/use-effect-custom-async.ts","@flatbiz/antd/src/fba-hooks/use-memo-custom.ts","@flatbiz/antd/src/fba-hooks/use-previous.ts","@flatbiz/antd/src/fba-hooks/use-safe-state.ts","@flatbiz/antd/src/fba-hooks/use-theme.ts","@flatbiz/antd/src/fba-hooks/index.ts"],"sourcesContent":["import { isArray } from '@dimjs/lang';\nimport { hooks } from '@wove/react';\nimport { useRef } from 'react';\n\nexport const useArrayChange = <T>(defautDataList: Array<T>, forceUpdate = true) => {\n const changeListRef = useRef<Array<T>>(defautDataList);\n const update = hooks.useForceUpdate();\n const arrayOperate = {\n add: hooks.useCallbackRef((dataItem: T | Array<T>, isUnshift?: boolean) => {\n if (isUnshift) {\n const targetList = isArray(dataItem) ? dataItem : [dataItem];\n changeListRef.current = [...targetList, ...changeListRef.current];\n } else {\n changeListRef.current = changeListRef.current.concat(dataItem);\n }\n forceUpdate && update();\n }),\n update: hooks.useCallbackRef((index: number, dataItem: T) => {\n const target = changeListRef.current[index];\n if (target) {\n changeListRef.current[index] = { ...target, ...dataItem };\n }\n forceUpdate && update();\n }),\n delete: hooks.useCallbackRef((index: number) => {\n const deleteItem = changeListRef.current.splice(index, 1);\n forceUpdate && update();\n return deleteItem;\n }),\n resetList: hooks.useCallbackRef((dataList: Array<T>) => {\n changeListRef.current = dataList;\n forceUpdate && update();\n }),\n getList: hooks.useCallbackRef(() => {\n return changeListRef.current;\n }),\n };\n return [changeListRef.current, arrayOperate] as const;\n};\n","import { DependencyList, EffectCallback, useEffect } from 'react';\n\nexport const useEffectCustom = (fn: EffectCallback, deps: DependencyList) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useEffect(fn, deps);\n};\n","import { DependencyList, useEffect } from 'react';\n\nexport const useEffectCustomAsync = (fn: () => Promise<void>, deps: DependencyList) => {\n useEffect(() => {\n async function asyncFunction() {\n await fn();\n }\n void asyncFunction();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n};\n","import { DependencyList, useMemo } from 'react';\n/**\n * 自定义控制 useMemo 依赖\n */\nexport const useMemoCustom = <T>(fn: () => T, deps?: DependencyList) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo<T>(fn, deps);\n};\n","import { useRef } from 'react';\n\nexport type ShouldUpdateFunc<T> = (prev: T | undefined, next: T) => boolean;\n\nconst defaultShouldUpdate = <T>(a?: T, b?: T) => !Object.is(a, b);\n\nexport function usePrevious<T>(\n state: T,\n shouldUpdate: ShouldUpdateFunc<T> = defaultShouldUpdate,\n): T | undefined {\n const prevRef = useRef<T>();\n const curRef = useRef<T>();\n\n if (shouldUpdate(curRef.current, state)) {\n prevRef.current = curRef.current;\n curRef.current = state;\n }\n\n return prevRef.current;\n}\n","import { hooks } from '@wove/react';\nimport { Dispatch, SetStateAction, useState } from 'react';\n\nexport const useSafeState = <S extends undefined | unknown>(\n initialState?: S | (() => S),\n): [S, Dispatch<SetStateAction<S>>] => {\n const [state, setState] = useState(initialState as S);\n const isMounted = hooks.useIsMounted();\n\n return [\n state,\n (value) => {\n if (isMounted.current) {\n return setState(value);\n }\n },\n ];\n};\n","import { theme } from 'antd';\n\nexport const useThemeToken = () => {\n const { token } = theme.useToken();\n return token;\n};\n","import { useArrayChange } from './use-array-change';\nimport { useEffectCustom } from './use-effect-custom';\nimport { useEffectCustomAsync } from './use-effect-custom-async';\nimport { useMemoCustom } from './use-memo-custom';\nimport { usePrevious } from './use-previous';\nimport { useResponsivePoint } from './use-responsive-point';\nimport { useSafeState } from './use-safe-state';\nimport { useThemeToken } from './use-theme';\n\nexport const fbaHooks = {\n useEffectCustom: useEffectCustom,\n useEffectCustomAsync: useEffectCustomAsync,\n useThemeToken: useThemeToken,\n useArrayChange: useArrayChange,\n usePrevious: usePrevious,\n useResponsivePoint: useResponsivePoint,\n useSafeState: useSafeState,\n useMemoCustom: useMemoCustom,\n};\n"],"names":["useArrayChange","defautDataList","forceUpdate","changeListRef","useRef","update","_hooks","useForceUpdate","arrayOperate","add","useCallbackRef","dataItem","isUnshift","targetList","_isArray","current","concat","index","target","_extends","delete","deleteItem","splice","resetList","dataList","getList","useEffectCustom","fn","deps","useEffect","useEffectCustomAsync","asyncFunction","Promise","$return","$error","resolve","then","$await_1","$boundEx","useMemoCustom","useMemo","defaultShouldUpdate","a","b","Object","is","usePrevious","state","shouldUpdate","prevRef","curRef","useSafeState","initialState","_useState","useState","setState","isMounted","useIsMounted","value","useThemeToken","_theme$useToken","theme","useToken","token","fbaHooks","useResponsivePoint"],"mappings":";4TAIO,IAAMA,EAAiB,SAAjBA,EAAqBC,EAA0BC,GAAuB,GAAvBA,SAAW,EAAA,CAAXA,EAAc,IAAI,CAC5E,IAAMC,EAAgBC,EAAiBH,GACvC,IAAMI,EAASC,EAAMC,iBACrB,IAAMC,EAAe,CACnBC,IAAKH,EAAMI,gBAAe,SAACC,EAAwBC,GACjD,GAAIA,EAAW,CACb,IAAMC,EAAaC,EAAQH,GAAYA,EAAW,CAACA,GACnDR,EAAcY,QAAO,GAAAC,OAAOH,EAAeV,EAAcY,QAC3D,KAAO,CACLZ,EAAcY,QAAUZ,EAAcY,QAAQC,OAAOL,EACvD,CACAT,GAAeG,GACjB,IACAA,OAAQC,EAAMI,gBAAe,SAACO,EAAeN,GAC3C,IAAMO,EAASf,EAAcY,QAAQE,GACrC,GAAIC,EAAQ,CACVf,EAAcY,QAAQE,GAAME,EAAQD,GAAAA,EAAWP,EACjD,CACAT,GAAeG,GACjB,IACAe,OAAQd,EAAMI,gBAAe,SAACO,GAC5B,IAAMI,EAAalB,EAAcY,QAAQO,OAAOL,EAAO,GACvDf,GAAeG,IACf,OAAOgB,CACT,IACAE,UAAWjB,EAAMI,gBAAe,SAACc,GAC/BrB,EAAcY,QAAUS,EACxBtB,GAAeG,GACjB,IACAoB,QAASnB,EAAMI,gBAAe,WAC5B,OAAOP,EAAcY,YAGzB,MAAO,CAACZ,EAAcY,QAASP,EACjC,ECpCO,IAAMkB,EAAkB,SAAlBA,EAAmBC,EAAoBC,GAElD,OAAOC,EAAUF,EAAIC,EACvB,ECHO,IAAME,EAAuB,SAAvBA,EAAwBH,EAAyBC,GAC5DC,GAAU,WACR,SAAeE,IAAf,OAAA,IAAAC,SAAA,SAAAC,EAAAC,GACE,OAAAF,QAAAG,QAAMR,KAANS,MAAU,SAAAC,GALhB,IAAI,OAAAJ,GAAK,CAAC,MAAAK,GAAW,OAAOJ,EAAAI,EAAM,CAAC,GAAAJ,EAKnB,GACX,MACIH,GAEN,GAAEH,EACL,ECNO,IAAMW,EAAgB,SAAhBA,EAAoBZ,EAAaC,GAE5C,OAAOY,EAAWb,EAAIC,EACxB,ECHA,IAAMa,EAAsB,SAAtBA,EAA0BC,EAAOC,GAAK,OAAMC,OAAOC,GAAGH,EAAGC,EAAE,EAE1D,SAASG,EACdC,EACAC,GACe,GADfA,SAAiC,EAAA,CAAjCA,EAAoCP,CAAmB,CAEvD,IAAMQ,EAAU7C,IAChB,IAAM8C,EAAS9C,IAEf,GAAI4C,EAAaE,EAAOnC,QAASgC,GAAQ,CACvCE,EAAQlC,QAAUmC,EAAOnC,QACzBmC,EAAOnC,QAAUgC,CACnB,CAEA,OAAOE,EAAQlC,OACjB,CChBO,IAAMoC,EAAe,SAAfA,EACXC,GAEA,IAAAC,EAA0BC,EAASF,GAA5BL,EAAKM,EAAA,GAAEE,EAAQF,EAAA,GACtB,IAAMG,EAAYlD,EAAMmD,eAExB,MAAO,CACLV,EACA,SAACW,GACC,GAAIF,EAAUzC,QAAS,CACrB,OAAOwC,EAASG,EAClB,CACF,EAEJ,ECfO,IAAMC,EAAgB,SAAhBA,IACX,IAAAC,EAAkBC,EAAMC,WAAhBC,EAAKH,EAALG,MACR,OAAOA,CACT,ECIO,IAAMC,EAAW,CACtBtC,gBAAiBA,EACjBI,qBAAsBA,EACtB6B,cAAeA,EACf3D,eAAgBA,EAChB8C,YAAaA,EACbmB,mBAAoBA,EACpBd,aAAcA,EACdZ,cAAeA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/flex-layout/flex-layout.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { toArray } from '@flatbiz/utils';\nimport { Children, cloneElement, CSSProperties, ReactElement, ReactNode } from 'react';\nimport './style.less';\n\nexport type FlexLayoutProps = {\n className?: string;\n fullIndex
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/flex-layout/flex-layout.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { toArray } from '@flatbiz/utils';\nimport { Children, cloneElement, CSSProperties, ReactElement, ReactNode } from 'react';\nimport './style.less';\n\nexport type FlexLayoutProps = {\n className?: string;\n /** 子组件铺满的索引值,从0开始 */\n fullIndex: number | number[];\n /**方向,默认值vertical */\n direction?: 'vertical' | 'horizontal';\n onClick?: () => void;\n style?: CSSProperties;\n /** 间隙尺寸 */\n gap?: number;\n children?: ReactNode | null | Array<ReactNode | null>;\n};\n/**\n * flex布局,主要用于Flex结构性布局\n * ```\n * 4.2.87版本中将fullIndex改为了必填属性,如果在升级中遇到问题,不确定怎么写,可设置 fullIndex=[] 保持原样\n * ```\n */\nexport const FlexLayout = (props: FlexLayoutProps) => {\n const childrens = Children.toArray(props.children) as ReactElement[];\n const direction = props.direction || 'vertical';\n const gap = props.gap ? props.gap : 0;\n const fullIndexList = toArray<number>(props.fullIndex);\n\n return (\n <div\n className={classNames('v-flex-layout', `v-flex-${direction}`, props.className)}\n style={props.style}\n onClick={props.onClick}\n >\n {childrens.map((children, index) => {\n const childrenStyle = children.props?.style || {};\n const style = fullIndexList.includes(index)\n ? { flex: 1, ...childrenStyle }\n : { flexShrink: 0, ...childrenStyle };\n if (index < childrens.length - 1 && gap > 0) {\n if (direction === 'horizontal') {\n style.marginRight = gap;\n } else {\n style.marginBottom = gap;\n }\n }\n return cloneElement(children, { style, key: index });\n })}\n </div>\n );\n};\n"],"names":["FlexLayout","props","childrens","Children","toArray","children","direction","gap","fullIndexList","fullIndex","_jsx","className","_classNames","style","onClick","map","index","_children$props","childrenStyle","includes","_extends","flex","flexShrink","length","marginRight","marginBottom","cloneElement","key"],"mappings":";+PAuBaA,EAAa,SAAbA,EAAcC,GACzB,IAAMC,EAAYC,EAASC,QAAQH,EAAMI,UACzC,IAAMC,EAAYL,EAAMK,WAAa,WACrC,IAAMC,EAAMN,EAAMM,IAAMN,EAAMM,IAAM,EACpC,IAAMC,EAAgBJ,EAAgBH,EAAMQ,WAE5C,OACEC,EAAA,MAAA,CACEC,UAAWC,EAAW,gBAAe,UAAYN,EAAaL,EAAMU,WACpEE,MAAOZ,EAAMY,MACbC,QAASb,EAAMa,QAAQT,SAEtBH,EAAUa,KAAI,SAACV,EAAUW,GAAU,IAAAC,EAClC,IAAMC,IAAgBD,EAAAZ,EAASJ,QAAK,UAAA,EAAdgB,EAAgBJ,QAAS,CAAA,EAC/C,IAAMA,EAAQL,EAAcW,SAASH,GAAMI,EAAA,CACrCC,KAAM,GAAMH,GAAaE,EAAA,CACzBE,WAAY,GAAMJ,GACxB,GAAIF,EAAQd,EAAUqB,OAAS,GAAKhB,EAAM,EAAG,CAC3C,GAAID,IAAc,aAAc,CAC9BO,EAAMW,YAAcjB,CACtB,KAAO,CACLM,EAAMY,aAAelB,CACvB,CACF,CACA,OAAOmB,EAAarB,EAAU,CAAEQ,MAAAA,EAAOc,IAAKX,QAIpD"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
2
|
+
import{extend as e}from"@dimjs/utils/cjs/extend";var r={TreeWrapper:{requestError:"数据加载异常..."},FbaDialogModal:{cancelText:"cancel"}};var a={TreeWrapper:{requestError:"数据加载异常..."},FbaDialogModal:{cancelText:"取消"}};var o=function o(l,n){var s=a;if(l==="en"){s=r}window["__fba_locale_message"]=e(true,{},s,n)};var l=function e(){var r=window["__fba_locale_message"];return r||{}};export{l as g,o as s};
|
|
3
|
+
//# sourceMappingURL=index-ac189a77.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-ac189a77.js","sources":["@flatbiz/antd/src/_utils/i18n/en.ts","@flatbiz/antd/src/_utils/i18n/zh-cn.ts","@flatbiz/antd/src/_utils/i18n/index.ts"],"sourcesContent":["import { TFbaLocale } from '../../types';\n\nexport const en: TFbaLocale = {\n TreeWrapper: {\n /** 数据加载异常,默认文案 */\n requestError: '数据加载异常...',\n },\n FbaDialogModal: {\n cancelText: 'cancel',\n },\n};\n","import { TFbaLocale } from '../../types';\n\nexport const zhCn: TFbaLocale = {\n TreeWrapper: {\n /** 数据加载异常,默认文案 */\n requestError: '数据加载异常...',\n },\n FbaDialogModal: {\n cancelText: '取消',\n },\n};\n","import { extend } from '@dimjs/utils';\nimport { TFbaLocale, TLocale } from '../../types';\nimport { en } from './en';\nimport { zhCn } from './zh-cn';\n\n/**\n * 设置 @flatbiz/antd中的国际化语言\n * @param locale\n * @param customLocaleMessage\n */\nexport const setFbaLocaleMessage = (locale: TLocale, customLocaleMessage?: Partial<TFbaLocale>) => {\n let localeMessage = zhCn;\n if (locale === 'en') {\n localeMessage = en;\n }\n window['__fba_locale_message'] = extend(true, {}, localeMessage, customLocaleMessage);\n};\n\n/**\n * 读取 @flatbiz/antd中的国际化语言\n * @param key\n * @returns\n */\nexport const getFbaLocaleMessage = () => {\n const localeMessage = window['__fba_locale_message'] as TFbaLocale;\n return localeMessage || {};\n};\n"],"names":["en","TreeWrapper","requestError","FbaDialogModal","cancelText","zhCn","setFbaLocaleMessage","locale","customLocaleMessage","localeMessage","window","_extend","getFbaLocaleMessage"],"mappings":";iDAEO,IAAMA,EAAiB,CAC5BC,YAAa,CAEXC,aAAc,aAEhBC,eAAgB,CACdC,WAAY,WCNT,IAAMC,EAAmB,CAC9BJ,YAAa,CAEXC,aAAc,aAEhBC,eAAgB,CACdC,WAAY,OCET,IAAME,EAAsB,SAAtBA,EAAuBC,EAAiBC,GACnD,IAAIC,EAAgBJ,EACpB,GAAIE,IAAW,KAAM,CACnBE,EAAgBT,CAClB,CACAU,OAAO,wBAA0BC,EAAO,KAAM,GAAIF,EAAeD,EACnE,MAOaI,EAAsB,SAAtBA,IACX,IAAMH,EAAgBC,OAAO,wBAC7B,OAAOD,GAAiB,CAAA,CAC1B"}
|
package/esm/index.js
CHANGED
|
@@ -7,11 +7,13 @@ import './button-operate/index.css';
|
|
|
7
7
|
import './button-wrapper/index.css';
|
|
8
8
|
import './config-provider-wrapper/index.css';
|
|
9
9
|
import './fba-hooks/index.css';
|
|
10
|
+
import './types/index.css';
|
|
10
11
|
import './fba-utils/index.css';
|
|
11
12
|
import './dropdown-menu-wrapper/index.css';
|
|
12
13
|
import './dialog-confirm/index.css';
|
|
13
14
|
import './dialog-modal/index.css';
|
|
14
15
|
import './flex-layout/index.css';
|
|
16
|
+
import './card-wrapper/index.css';
|
|
15
17
|
import './cascader-wrapper/index.css';
|
|
16
18
|
import './request-status/index.css';
|
|
17
19
|
import './check-list/index.css';
|
|
@@ -24,7 +26,6 @@ import './data-render/index.css';
|
|
|
24
26
|
import './date-picker-wrapper/index.css';
|
|
25
27
|
import './date-range-picker-wrapper/index.css';
|
|
26
28
|
import './date-range-picker-wrapper-form-item/index.css';
|
|
27
|
-
import './types/index.css';
|
|
28
29
|
import './dialog-alert/index.css';
|
|
29
30
|
import './dialog-drawer/index.css';
|
|
30
31
|
import './dialog-drawer-content/index.css';
|
|
@@ -47,7 +48,10 @@ import './icon-wrapper/index.css';
|
|
|
47
48
|
import './editable-field-provider/index.css';
|
|
48
49
|
import './editable-table/index.css';
|
|
49
50
|
import './selector-wrapper/index.css';
|
|
51
|
+
import './switch-wrapper/index.css';
|
|
50
52
|
import './upload-wrapper/index.css';
|
|
53
|
+
import './table-cell-render/index.css';
|
|
54
|
+
import './tag-list-select/index.css';
|
|
51
55
|
import './input-wrapper/index.css';
|
|
52
56
|
import './input-text-area-wrapper/index.css';
|
|
53
57
|
import './editor-wrapper/index.css';
|
|
@@ -80,9 +84,6 @@ import './selector-wrapper-simple/index.css';
|
|
|
80
84
|
import './sms-count-down/index.css';
|
|
81
85
|
import './styles/index.css';
|
|
82
86
|
import './switch-confirm-wrapper/index.css';
|
|
83
|
-
import './switch-wrapper/index.css';
|
|
84
|
-
import './table-cell-render/index.css';
|
|
85
|
-
import './tag-list-select/index.css';
|
|
86
87
|
import './tabs-wrapper/index.css';
|
|
87
88
|
import './tag-group/index.css';
|
|
88
89
|
import './tag-wrapper/index.css';
|
|
@@ -96,5 +97,5 @@ import './tree-selector-wrapper/index.css';
|
|
|
96
97
|
import './tree-wrapper/index.css';
|
|
97
98
|
import './index.css';
|
|
98
99
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
99
|
-
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{ButtonOperate,ButtonOperateItemContent}from"./button-operate/index.js";export{ButtonWrapper}from"./button-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{ConfigProviderWrapper}from"./config-provider-wrapper/index.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{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{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{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{FormItemWrapper}from"./form-item-wrapper/index.js";export{FormListWrapper}from"./form-list-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{LabelValueLayout}from"./label-value-layout/index.js";export{LocalLoading}from"./local-loading/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-e98b9352.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{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{styles}from"./styles/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{TextOverflowRender}from"./text-overflow-render/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-fc015ef2.js";import"@flatbiz/utils";import"antd";import"react/jsx-runtime";import"@dimjs/utils/cjs/class-names";import"react";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"@wove/react/cjs/hooks";import"@ant-design/icons/es/icons/LoadingOutlined";import"@ant-design/icons/es/icons/RedoOutlined";import"@dimjs/utils/cjs/extend";import"@dimjs/model";import"@dimjs/model-react";import"@wove/react/cjs/create-ctx";import"@ant-design/icons/es/icons/CloseCircleOutlined";import"@flatbiz/antd";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"@dimjs/lang/cjs/is-array";import"react-dom/client";import"./dom-4d04aa64.js";import"./context-1f2093c6.js";import"ahooks";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"@dimjs/lang/cjs/is-number";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/get";import"@dimjs/utils/cjs/json";import"pubsub-js";import"@dimjs/lang/cjs/is-object";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";
|
|
100
|
+
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{ButtonOperate,ButtonOperateItemContent}from"./button-operate/index.js";export{ButtonWrapper}from"./button-wrapper/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{ConfigProviderWrapper}from"./config-provider-wrapper/index.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{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{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{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{FormItemWrapper}from"./form-item-wrapper/index.js";export{FormListWrapper}from"./form-list-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{LabelValueLayout}from"./label-value-layout/index.js";export{LocalLoading}from"./local-loading/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-e98b9352.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{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{styles}from"./styles/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{TextOverflowRender}from"./text-overflow-render/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-fc015ef2.js";import"@flatbiz/utils";import"antd";import"react/jsx-runtime";import"@dimjs/utils/cjs/class-names";import"react";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"@wove/react/cjs/hooks";import"@ant-design/icons/es/icons/LoadingOutlined";import"@ant-design/icons/es/icons/RedoOutlined";import"@dimjs/utils/cjs/extend";import"@dimjs/model";import"@dimjs/model-react";import"@wove/react/cjs/create-ctx";import"@ant-design/icons/es/icons/CloseCircleOutlined";import"@flatbiz/antd";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"./index-ac189a77.js";import"./time-53b3f55f.js";import"@dimjs/lang/cjs/is-array";import"react-dom/client";import"./dom-4d04aa64.js";import"./context-1f2093c6.js";import"ahooks";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"@dimjs/lang/cjs/is-number";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/get";import"@dimjs/utils/cjs/json";import"pubsub-js";import"@dimjs/lang/cjs/is-object";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";
|
|
100
101
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.v-label-value-layout .ant-descriptions-item-label{color:rgba(0,0,0,.45);flex-shrink:0;width:var(--v-label-value-layout-
|
|
1
|
+
.v-label-value-layout .ant-descriptions-item-label{color:rgba(0,0,0,.45);flex-shrink:0;width:var(--v-label-value-layout-Width)}.v-label-value-layout .ant-descriptions-item{padding-bottom:8px}.v-label-value-layout .ant-descriptions-item-content{color:rgba(0,0,0,.85);font-weight:400}.v-label-value-layout.ant-descriptions-bordered .ant-descriptions-item-label{padding:8px 10px}.v-label-value-layout-border{border:1px solid #dedede;border-radius:5px;margin-top:20px;padding:10px 10px 2px}.v-label-value-layout:not(.ant-descriptions-bordered) .ant-descriptions-item-label{display:inline-block;text-align:left}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import './index.css';
|
|
3
3
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
4
|
-
import{classNames as r}from"@dimjs/utils/cjs/class-names";import{_ as e}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{getUuid as l}from"@flatbiz/utils";import{Descriptions as t}from"antd";import{useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";var n=function n(i){var u=i.labelWidth==="auto"?"auto":(i.labelWidth||120)+"px";var m=e({"--v-label-value-layout-
|
|
4
|
+
import{classNames as r}from"@dimjs/utils/cjs/class-names";import{_ as e}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{getUuid as l}from"@flatbiz/utils";import{Descriptions as t}from"antd";import{useMemo as a}from"react";import{jsx as o}from"react/jsx-runtime";var n=function n(i){var u=i.labelWidth==="auto"?"auto":(i.labelWidth||120)+"px";var m=e({"--v-label-value-layout-Width":u},i.style);var s=r("v-label-value-layout",i.className);var p=a((function(){var r=i.options.filter((function(r){return!r.hidden}));return r.map((function(r){return e({key:l()},r)}))}),[i.options]);return o(t,{column:i.column||1,bordered:i.bordered,size:"small",className:s,style:m,children:p.map((function(r){return o(t.Item,{label:r.label,span:r.span,children:r.value},r.key)}))})};export{n as LabelValueLayout};
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/label-value-layout/label-value-layout.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { getUuid } from '@flatbiz/utils';\nimport { Descriptions } from 'antd';\nimport { CSSProperties, ReactElement, useMemo } from 'react';\nimport './style.less';\n\nexport type LabelValueLayoutProps = {\n options: {\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/label-value-layout/label-value-layout.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { getUuid } from '@flatbiz/utils';\nimport { Descriptions } from 'antd';\nimport { CSSProperties, ReactElement, useMemo } from 'react';\nimport './style.less';\n\nexport type LabelValueLayoutProps = {\n options: {\n label: string | ReactElement;\n value?: string | number | ReactElement | null;\n span?: number;\n hidden?: boolean;\n }[];\n labelWidth?: number | 'auto';\n // 一行占几组,默认1\n column?: number;\n /** 添加边框 */\n bordered?: boolean;\n className?: string;\n style?: CSSProperties;\n};\n\n/**\n * options[].span 是 Description.Item 的数量。 span={2} 会占用两个 DescriptionItem 的宽度\n * options[].hidden 是否隐藏 Description.Item\n */\nexport const LabelValueLayout = (props: LabelValueLayoutProps) => {\n const labelWidth = props.labelWidth === 'auto' ? 'auto' : `${props.labelWidth || 120}px`;\n const style = { '--v-label-value-layout-Width': labelWidth, ...props.style } as CSSProperties;\n const className = classNames('v-label-value-layout', props.className);\n\n const options = useMemo(() => {\n const dataList = props.options.filter((item) => !item.hidden);\n return dataList.map((item) => {\n return { key: getUuid(), ...item };\n });\n }, [props.options]);\n\n return (\n <Descriptions\n column={props.column || 1}\n bordered={props.bordered}\n size=\"small\"\n className={className}\n style={style}\n >\n {options.map((item) => {\n return (\n <Descriptions.Item key={item.key} label={item.label} span={item.span}>\n {item.value}\n </Descriptions.Item>\n );\n })}\n </Descriptions>\n );\n};\n"],"names":["LabelValueLayout","props","labelWidth","style","_extends","className","_classNames","options","useMemo","dataList","filter","item","hidden","map","key","getUuid","_jsx","Descriptions","column","bordered","size","children","Item","label","span","value"],"mappings":";gRA0BaA,EAAmB,SAAnBA,EAAoBC,GAC/B,IAAMC,EAAaD,EAAMC,aAAe,OAAS,QAAYD,EAAMC,YAAc,KAAO,KACxF,IAAMC,EAAKC,EAAA,CAAK,+BAAgCF,GAAeD,EAAME,OACrE,IAAME,EAAYC,EAAW,uBAAwBL,EAAMI,WAE3D,IAAME,EAAUC,GAAQ,WACtB,IAAMC,EAAWR,EAAMM,QAAQG,QAAO,SAACC,GAAI,OAAMA,EAAKC,UACtD,OAAOH,EAASI,KAAI,SAACF,GACnB,OAAAP,EAAA,CAASU,IAAKC,KAAcJ,EAC9B,GACF,GAAG,CAACV,EAAMM,UAEV,OACES,EAACC,EAAY,CACXC,OAAQjB,EAAMiB,QAAU,EACxBC,SAAUlB,EAAMkB,SAChBC,KAAK,QACLf,UAAWA,EACXF,MAAOA,EAAMkB,SAEZd,EAAQM,KAAI,SAACF,GACZ,OACEK,EAACC,EAAaK,KAAI,CAAgBC,MAAOZ,EAAKY,MAAOC,KAAMb,EAAKa,KAAKH,SAClEV,EAAKc,OADgBd,EAAKG,SAOvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/local-loading/context.ts","@flatbiz/antd/src/local-loading/local-loading.tsx","@flatbiz/antd/src/local-loading/index.ts"],"sourcesContent":["import { TPlainObject } from '@flatbiz/utils';\nimport { createCtx } from '@wove/react';\n\nexport const [useLocalLoadingCtx, LocalLoadingCtxProvider] = createCtx<{\n onRequest: (params?: TPlainObject) => void;\n}>();\n","import { isDeepEqual } from '@dimjs/lang';\nimport { classNames } from '@dimjs/utils';\nimport { TAny, toArray, TPlainObject } from '@flatbiz/utils';\nimport { Button, Result, Spin } from 'antd';\nimport {\n CSSProperties,\n forwardRef,\n ReactElement,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { dynamicNode } from '../dynamic-node';\nimport { fbaHooks } from '../fba-hooks';\nimport { LocalLoadingCtxProvider } from './context';\nimport './style.less';\n\nexport type LocalLoadingServiceConfig = {\n onRequest: (params?: TAny) => Promise<TPlainObject>;\n params?: TPlainObject;\n /** 标记serviceConfig.params中无效参数,被设置的params key 不传入服务接口入参 */\n invalidParamKey?: string[];\n};\n\nexport interface LocalLoadingProps {\n /** 接口数据配置 */\n serviceConfig: LocalLoadingServiceConfig;\n /** children 为函数,参数【respData】为接口返回数据 */\n children: (respData?: TAny) => ReactElement;\n /**\n * 是否异步,默认:false\n * ```\n * true(异步):onRequest、react dom渲染同步执行\n * false(同步):onRequest有结果了才渲染 react dom\n * ```\n */\n isAsync?: boolean;\n /** 自定义异常渲染处理 */\n errorRender?: (error?: TAny) => ReactElement;\n /** loading高度,默认值:100;isAsync = true 无效 */\n loadingHeight?: number | string;\n className?: string;\n style?: CSSProperties;\n contentStyle?: CSSProperties;\n}\n\nexport type LocalLoadingRefApi = {\n onRefresh: (params?: TPlainObject) => void;\n};\n\n/**\n * 局部加载,包含接口数据处理逻辑\n * ```\n * 包括\n * 1. loading显示效果\n * 2. error显示效果\n * 3. 获取服务数据\n * 4. 当 serviceConfig.params 值与上一次值不相等时,会主动发起服务调用\n * ```\n * @param props\n * @returns\n */\nexport const LocalLoadingInner = forwardRef<LocalLoadingRefApi, LocalLoadingProps>((props, ref) => {\n const { serviceConfig, isAsync, children, errorRender } = props;\n const [status, setStatus] = useState<'success' | 'error' | 'init'>('init');\n const [respData, setRespData] = useState<TAny>();\n const loadingHeight = props.loadingHeight === undefined ? 100 : props.loadingHeight;\n const rootRef = useRef<HTMLDivElement>(null);\n const loadingKeyRef = useRef<string>();\n const errorRef = useRef<string>();\n\n const prevParams = fbaHooks.usePrevious(serviceConfig.params);\n\n // 用于直接发起接口调用,不能用于比较\n const serviceParams = useMemo(() => {\n if (!serviceConfig.params || toArray(serviceConfig.invalidParamKey).length === 0) {\n return serviceConfig.params;\n }\n const newParams = { ...serviceConfig.params };\n serviceConfig.invalidParamKey?.forEach((key) => {\n newParams[key] = undefined;\n });\n return newParams;\n }, [serviceConfig]);\n\n const openLoading = () => {\n errorRef.current = undefined;\n loadingKeyRef.current = dynamicNode.append({\n content: <Spin spinning={true}></Spin>,\n getContainer: () => {\n return rootRef.current as HTMLElement;\n },\n }).elementId;\n };\n\n const closeLoading = () => {\n dynamicNode.remove(loadingKeyRef.current);\n };\n\n const onInitRequest = async (params?: TPlainObject) => {\n try {\n openLoading();\n const respData = await serviceConfig.onRequest({\n ...serviceParams,\n ...params,\n });\n setStatus('success');\n setRespData(respData);\n } catch (error) {\n console.error(error);\n setStatus('error');\n errorRef.current = error.message;\n } finally {\n closeLoading();\n }\n };\n\n fbaHooks.useEffectCustomAsync(onInitRequest, []);\n\n fbaHooks.useEffectCustom(() => {\n if (prevParams) {\n if (!isDeepEqual(serviceConfig.params, prevParams)) {\n void onInitRequest();\n }\n }\n }, [prevParams, serviceConfig.params]);\n\n useImperativeHandle(ref, () => {\n return { onRefresh: onInitRequest };\n });\n\n if (status === 'error') {\n if (errorRender) {\n return errorRender(respData);\n }\n return (\n <LocalLoadingCtxProvider value={{ onRequest: onInitRequest }}>\n <div className=\"local-loading-error\">\n <div className=\"local-loading-area\" ref={rootRef}></div>\n <Result\n status=\"error\"\n subTitle={errorRef.current || '数据处理异常'}\n extra={[\n <Button\n type=\"primary\"\n ghost\n key=\"console\"\n size=\"small\"\n onClick={() => {\n setStatus('init');\n setTimeout(() => {\n void onInitRequest();\n }, 100);\n }}\n >\n 重新获取\n </Button>,\n ]}\n />\n </div>\n </LocalLoadingCtxProvider>\n );\n }\n\n if (status !== 'success' && !isAsync) {\n return (\n <div\n className=\"fba-local-loading-process\"\n style={{\n height: loadingHeight,\n display: 'flex',\n justifyContent: 'center',\n position: 'relative',\n backgroundColor: '#fff',\n }}\n >\n <div className=\"local-loading-area\" ref={rootRef}></div>\n </div>\n );\n }\n\n return (\n <LocalLoadingCtxProvider value={{ onRequest: onInitRequest }}>\n <div className={classNames('fba-local-loading', props.className)} style={props.style}>\n <div className=\"local-loading-area\" ref={rootRef}></div>\n <div className=\"local-loading-content\" style={props.contentStyle}>\n {children(respData)}\n </div>\n </div>\n </LocalLoadingCtxProvider>\n );\n});\n","import { TPlainObject } from '@flatbiz/utils';\nimport { fbaUtils } from '../fba-utils';\nimport { useLocalLoadingCtx } from './context';\nimport { LocalLoadingInner } from './local-loading';\n\n/**\n * 局部加载,包含接口数据处理逻辑\n * ```\n * 包括\n * 1. loading显示效果\n * 2. error显示效果\n * 3. 获取服务数据\n * 4. 当 serviceConfig.params 值与上一次值不相等时,会主动发起服务调用\n * ```\n */\nexport const LocalLoading = fbaUtils.attachPropertiesToComponent(LocalLoadingInner, {\n useLocalLoading: () => {\n const ctx = useLocalLoadingCtx();\n return {\n onRequest: (params?: TPlainObject) => {\n ctx.onRequest(params);\n },\n };\n },\n});\n"],"names":["_createCtx","_createCtx2","useLocalLoadingCtx","LocalLoadingCtxProvider","LocalLoadingInner","forwardRef","props","ref","serviceConfig","isAsync","children","errorRender","_useState","useState","status","setStatus","_useState2","respData","setRespData","loadingHeight","undefined","rootRef","useRef","loadingKeyRef","errorRef","prevParams","fbaHooks","usePrevious","params","serviceParams","useMemo","_serviceConfig$invali","toArray","invalidParamKey","length","newParams","_extends","forEach","key","openLoading","current","dynamicNode","append","content","_jsx","Spin","spinning","getContainer","elementId","closeLoading","remove","onInitRequest","Promise","$return","$error","$Try_1_Finally","$Try_1_Exit","$Try_1_Value","call","this","$boundEx","bind","_respData","$Try_1_Post","$Try_1_Catch","error","console","message","resolve","onRequest","then","$await_2","useEffectCustomAsync","useEffectCustom","_isDeepEqual","useImperativeHandle","onRefresh","value","_jsxs","className","Result","subTitle","extra","Button","type","ghost","size","onClick","setTimeout","style","height","display","justifyContent","position","backgroundColor","_classNames","contentStyle","LocalLoading","fbaUtils","attachPropertiesToComponent","useLocalLoading","ctx"],"mappings":";oxBAGO,IAAAA,EAAsDC,IAA/CC,EAAkBF,EAAA,GAAEG,EAAuBH,EAAA,GC4DlD,IAAMI,EAAoBC,GAAkD,SAACC,EAAOC,GACzF,IAAQC,EAAkDF,EAAlDE,cAAeC,EAAmCH,EAAnCG,QAASC,EAA0BJ,EAA1BI,SAAUC,EAAgBL,EAAhBK,YAC1C,IAAAC,EAA4BC,EAAuC,QAA5DC,EAAMF,EAAA,GAAEG,EAASH,EAAA,GACxB,IAAAI,EAAgCH,IAAzBI,EAAQD,EAAA,GAAEE,EAAWF,EAAA,GAC5B,IAAMG,EAAgBb,EAAMa,gBAAkBC,UAAY,IAAMd,EAAMa,cACtE,IAAME,EAAUC,EAAuB,MACvC,IAAMC,EAAgBD,IACtB,IAAME,EAAWF,IAEjB,IAAMG,EAAaC,EAASC,YAAYnB,EAAcoB,QAGtD,IAAMC,EAAgBC,GAAQ,WAAM,IAAAC,EAClC,IAAKvB,EAA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qBxE,IAAKc,IACzCuB,EAAA,MAAA,CAAKmC,UAAU,wBAAwBU,MAAOnF,EAAM0F,aAAatF,SAC9DA,EAASO,SAKpB,ICjLO,IAAMgF,EAAeC,EAASC,4BAA4B/F,EAAmB,CAClFgG,gBAAiB,SAAAA,IACf,IAAMC,EAAMnG,IACZ,MAAO,CACLmE,UAAW,SAAAA,EAACzC,GACVyE,EAAIhC,UAAUzC,EAChB,EAEJ"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/local-loading/context.ts","@flatbiz/antd/src/local-loading/local-loading.tsx","@flatbiz/antd/src/local-loading/index.ts"],"sourcesContent":["import { TPlainObject } from '@flatbiz/utils';\nimport { createCtx } from '@wove/react';\n\nexport const [useLocalLoadingCtx, LocalLoadingCtxProvider] = createCtx<{\n onRequest: (params?: TPlainObject) => void;\n}>();\n","import { isDeepEqual } from '@dimjs/lang';\nimport { classNames } from '@dimjs/utils';\nimport { TAny, toArray, TPlainObject } from '@flatbiz/utils';\nimport { Button, Result, Spin } from 'antd';\nimport {\n CSSProperties,\n forwardRef,\n ReactElement,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { dynamicNode } from '../dynamic-node';\nimport { fbaHooks } from '../fba-hooks';\nimport { LocalLoadingCtxProvider } from './context';\nimport './style.less';\n\nexport type LocalLoadingServiceConfig = {\n onRequest: (params?: TAny) => Promise<TAny>;\n params?: TPlainObject;\n /** 标记serviceConfig.params中无效参数,被设置的params key 不传入服务接口入参 */\n invalidParamKey?: string[];\n};\n\nexport interface LocalLoadingProps {\n /** 接口数据配置 */\n serviceConfig: LocalLoadingServiceConfig;\n /** children 为函数,参数【respData】为接口返回数据 */\n children: (respData?: TAny) => ReactElement;\n /**\n * 是否异步,默认:false\n * ```\n * true(异步):onRequest、react dom渲染同步执行\n * false(同步):onRequest有结果了才渲染 react dom\n * ```\n */\n isAsync?: boolean;\n /** 自定义异常渲染处理 */\n errorRender?: (error?: TAny) => ReactElement;\n /** loading高度,默认值:100;isAsync = true 无效 */\n loadingHeight?: number | string;\n className?: string;\n style?: CSSProperties;\n contentStyle?: CSSProperties;\n}\n\nexport type LocalLoadingRefApi = {\n onRefresh: (params?: TPlainObject) => void;\n};\n\n/**\n * 局部加载,包含接口数据处理逻辑\n * ```\n * 包括\n * 1. loading显示效果\n * 2. error显示效果\n * 3. 获取服务数据\n * 4. 当 serviceConfig.params 值与上一次值不相等时,会主动发起服务调用\n * ```\n * @param props\n * @returns\n */\nexport const LocalLoadingInner = forwardRef<LocalLoadingRefApi, LocalLoadingProps>((props, ref) => {\n const { serviceConfig, isAsync, children, errorRender } = props;\n const [status, setStatus] = useState<'success' | 'error' | 'init'>('init');\n const [respData, setRespData] = useState<TAny>();\n const loadingHeight = props.loadingHeight === undefined ? 100 : props.loadingHeight;\n const rootRef = useRef<HTMLDivElement>(null);\n const loadingKeyRef = useRef<string>();\n const errorRef = useRef<string>();\n\n const prevParams = fbaHooks.usePrevious(serviceConfig.params);\n\n // 用于直接发起接口调用,不能用于比较\n const serviceParams = useMemo(() => {\n if (!serviceConfig.params || toArray(serviceConfig.invalidParamKey).length === 0) {\n return serviceConfig.params;\n }\n const newParams = { ...serviceConfig.params };\n serviceConfig.invalidParamKey?.forEach((key) => {\n newParams[key] = undefined;\n });\n return newParams;\n }, [serviceConfig]);\n\n const openLoading = () => {\n errorRef.current = undefined;\n loadingKeyRef.current = dynamicNode.append({\n content: <Spin spinning={true}></Spin>,\n getContainer: () => {\n return rootRef.current as HTMLElement;\n },\n }).elementId;\n };\n\n const closeLoading = () => {\n dynamicNode.remove(loadingKeyRef.current);\n };\n\n const onInitRequest = async (params?: TPlainObject) => {\n try {\n openLoading();\n const respData = await serviceConfig.onRequest({\n ...serviceParams,\n ...params,\n });\n setStatus('success');\n setRespData(respData);\n } catch (error) {\n console.error(error);\n setStatus('error');\n errorRef.current = error.message;\n } finally {\n closeLoading();\n }\n };\n\n fbaHooks.useEffectCustomAsync(onInitRequest, []);\n\n fbaHooks.useEffectCustom(() => {\n if (prevParams) {\n if (!isDeepEqual(serviceConfig.params, prevParams)) {\n void onInitRequest();\n }\n }\n }, [prevParams, serviceConfig.params]);\n\n useImperativeHandle(ref, () => {\n return { onRefresh: onInitRequest };\n });\n\n if (status === 'error') {\n if (errorRender) {\n return errorRender(respData);\n }\n return (\n <LocalLoadingCtxProvider value={{ onRequest: onInitRequest }}>\n <div className=\"local-loading-error\">\n <div className=\"local-loading-area\" ref={rootRef}></div>\n <Result\n status=\"error\"\n subTitle={errorRef.current || '数据处理异常'}\n extra={[\n <Button\n type=\"primary\"\n ghost\n key=\"console\"\n size=\"small\"\n onClick={() => {\n setStatus('init');\n setTimeout(() => {\n void onInitRequest();\n }, 100);\n }}\n >\n 重新获取\n </Button>,\n ]}\n />\n </div>\n </LocalLoadingCtxProvider>\n );\n }\n\n if (status !== 'success' && !isAsync) {\n return (\n <div\n className=\"fba-local-loading-process\"\n style={{\n height: loadingHeight,\n display: 'flex',\n justifyContent: 'center',\n position: 'relative',\n backgroundColor: '#fff',\n }}\n >\n <div className=\"local-loading-area\" ref={rootRef}></div>\n </div>\n );\n }\n\n return (\n <LocalLoadingCtxProvider value={{ onRequest: onInitRequest }}>\n <div className={classNames('fba-local-loading', props.className)} style={props.style}>\n <div className=\"local-loading-area\" ref={rootRef}></div>\n <div className=\"local-loading-content\" style={props.contentStyle}>\n {children(respData)}\n </div>\n </div>\n </LocalLoadingCtxProvider>\n );\n});\n","import { TPlainObject } from '@flatbiz/utils';\nimport { fbaUtils } from '../fba-utils';\nimport { useLocalLoadingCtx } from './context';\nimport { LocalLoadingInner } from './local-loading';\n\n/**\n * 局部加载,包含接口数据处理逻辑\n * ```\n * 包括\n * 1. loading显示效果\n * 2. error显示效果\n * 3. 获取服务数据\n * 4. 当 serviceConfig.params 值与上一次值不相等时,会主动发起服务调用\n * ```\n */\nexport const LocalLoading = fbaUtils.attachPropertiesToComponent(LocalLoadingInner, {\n useLocalLoading: () => {\n const ctx = useLocalLoadingCtx();\n return {\n onRequest: (params?: TPlainObject) => {\n ctx.onRequest(params);\n },\n };\n },\n});\n"],"names":["_createCtx","_createCtx2","useLocalLoadingCtx","LocalLoadingCtxProvider","LocalLoadingInner","forwardRef","props","ref","serviceConfig","isAsync","children","errorRender","_useState","useState","status","setStatus","_useState2","respData","setRespData","loadingHeight","undefined","rootRef","useRef","loadingKeyRef","errorRef","prevParams","fbaHooks","usePrevious","params","serviceParams","useMemo","_serviceConfig$invali","toArray","invalidParamKey","length","newParams","_extends","forEach","key","openLoading","current","dynamicNode","append","content","_jsx","Spin","spinning","getContainer","elementId","closeLoading","remove","onInitRequest","Promise","$return","$error","$Try_1_Finally","$Try_1_Exit","$Try_1_Value","call","this","$boundEx","bind","_respData","$Try_1_Post","$Try_1_Catch","error","console","message","resolve","onRequest","then","$await_2","useEffectCustomAsync","useEffectCustom","_isDeepEqual","useImperativeHandle","onRefresh","value","_jsxs","className","Result","subTitle","extra","Button","type","ghost","size","onClick","setTimeout","style","height","display","justifyContent","position","backgroundColor","_classNames","contentStyle","LocalLoading","fbaUtils","attachPropertiesToComponent","useLocalLoading","ctx"],"mappings":";oxBAGO,IAAAA,EAAsDC,IAA/CC,EAAkBF,EAAA,GAAEG,EAAuBH,EAAA,GC4DlD,IAAMI,EAAoBC,GAAkD,SAACC,EAAOC,GACzF,IAAQC,EAAkDF,EAAlDE,cAAeC,EAAmCH,EAAnCG,QAASC,EAA0BJ,EAA1BI,SAAUC,EAAgBL,EAAhBK,YAC1C,IAAAC,EAA4BC,EAAuC,QAA5DC,EAAMF,EAAA,GAAEG,EAASH,EAAA,GACxB,IAAAI,EAAgCH,IAAzBI,EAAQD,EAAA,GAAEE,EAAWF,EAAA,GAC5B,IAAMG,EAAgBb,EAAMa,gBAAkBC,UAAY,IAAMd,EAAMa,cACtE,IAAME,EAAUC,EAAuB,MACvC,IAAMC,EAAgBD,IACtB,IAAME,EAAWF,IAEjB,IAAMG,EAAaC,EAASC,YAAYnB,EAAco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AAOnF,EAAMmF,MAAM/E,UACnFkC,EAAA,MAAA,CAAKmC,UAAU,qBAAqBxE,IAAKc,IACzCuB,EAAA,MAAA,CAAKmC,UAAU,wBAAwBU,MAAOnF,EAAM0F,aAAatF,SAC9DA,EAASO,SAKpB,ICjLO,IAAMgF,EAAeC,EAASC,4BAA4B/F,EAAmB,CAClFgG,gBAAiB,SAAAA,IACf,IAAMC,EAAMnG,IACZ,MAAO,CACLmE,UAAW,SAAAA,EAACzC,GACVyE,EAAIhC,UAAUzC,EAChB,EAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.form-item-label-70.ant-form-item .ant-form-item-label{width:70px
|
|
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-label{width:auto}.form-item-label-align-left .ant-form-item-label{text-align:left}.form-item-label-align-right .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%!important}.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 .ant-form-item-row{flex-direction:column}.form-label-value-vertical .ant-form-item .ant-form-item-label{text-align:left;width:100%}.form-label-value-vertical .ant-form-item .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}
|
|
@@ -3,5 +3,5 @@ import './../dynamic-node/index.css';
|
|
|
3
3
|
import './../fba-hooks/index.css';
|
|
4
4
|
import './index.css';
|
|
5
5
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
6
|
-
import{a as e,_ as n}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{classNames as t}from"@dimjs/utils/cjs/class-names";import{hooks as r}from"@wove/react/cjs/hooks";import{Editor as i}from"@tinymce/tinymce-react";import{useKeyPress as o}from"ahooks";import{Fragment as a,useRef as l,useState as s}from"react";import c from"@ant-design/icons/es/icons/PlusCircleOutlined";import{Image as
|
|
6
|
+
import{a as e,_ as n}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{classNames as t}from"@dimjs/utils/cjs/class-names";import{hooks as r}from"@wove/react/cjs/hooks";import{Editor as i}from"@tinymce/tinymce-react";import{useKeyPress as o}from"ahooks";import{Fragment as a,useRef as l,useState as s}from"react";import c from"@ant-design/icons/es/icons/PlusCircleOutlined";import{Image as u}from"antd";import{dynamicNode as m}from"../dynamic-node/index.js";import{fbaHooks as d}from"../fba-hooks/index.js";import{jsx as p,Fragment as f,jsxs as v}from"react/jsx-runtime";import"react-dom/client";import"../dom-4d04aa64.js";import"@dimjs/lang/cjs/is-array";import"../use-responsive-point-21b8c601.js";var g=function e(n){var t=n.visible,r=n.url;d.useEffectCustom((function(){if(t){m.append({content:p(c,{onClick:n.close,className:"preview-image-popup-close",twoToneColor:"#1890ff"})})}else{m.remove()}}),[t]);if(!r)return p(f,{});return p(a,{children:p(u,{style:{left:"100px"},preview:{className:"preview-image-popup",maskStyle:{backgroundColor:"rgba(0,0,0,0.85)"},visible:t,src:r,onVisibleChange:function e(){n.close()}}},r)})};var h=["onUploadImage","onChange","className"];var y=function a(c){var u,m,d,f;var y=c.onUploadImage,b=c.onChange,C=c.className,k=e(c,h);var x=l(null);var w=s(""),_=w[0],j=w[1];var E=((u=c.init)==null?void 0:u.img_ratio)||[{min:0,max:1e3,ratio:.5},{min:1e3,ratio:.3}];o((function(){return true}),(function(e){try{if(e.type==="keyup"&&e.key==="Escape"){var n;var t=(n=x.current)==null?void 0:n.editorContainer.classList.contains("tox-fullscreen");if(t){var r;(r=x.current)==null?void 0:r.editorCommands.execCommand("mceFullScreen")}}}catch(e){}}),{events:["keydown","keyup"]});var I=r.useCallbackRef((function(e,n){try{if(e.keyCode==27){var t;var r=(t=x.current)==null?void 0:t.editorContainer.classList.contains("tox-fullscreen");if(r){var i;(i=x.current)==null?void 0:i.editorCommands.execCommand("mceFullScreen")}}}catch(e){}c.onKeyDown==null?void 0:c.onKeyDown(e,n)}));var S=r.useCallbackRef((function(e,n){x.current=n;n.on("FullscreenStateChanged",(function(e){c.onFullScreenChange==null?void 0:c.onFullScreenChange(e.state)}));try{var t;(t=n.iframeElement)==null||(t=t.contentDocument)==null?void 0:t.addEventListener("click",(function(e){var n;if(c.imgPreview&&((n=e.target)==null?void 0:n["tagName"])==="IMG"){j(e.target["src"])}}),true)}catch(e){}k.onInit==null?void 0:k.onInit(e,n)}));var F=r.useCallbackRef((function(e,n){x.current=n;k.onEditorChange==null?void 0:k.onEditorChange(e,n);b==null?void 0:b(e)}));var N="https://file.40017.cn/tcsk/tinymce@6.4.1";var P=function e(n){if(E.length===0)return 1;for(var t=0;t<E.length;t++){var r=E[t];if(r.max){if(n>=r.min&&n<=r.max)return r.ratio}else{if(n>=r.min)return r.ratio}}return 1};var z=r.useCallbackRef((function(e,n){try{var t=n.node.children||[];if(t.length===1&&t[0].nodeName==="IMG"){t[0].setAttribute("style","display:none");var r=document.createElement("img");r.src=t[0].getAttribute("src");r.onload=function(){var n=P(r.width);e.execCommand("mceInsertContent",true,'<img src="'+r.src+'" width="'+r.width*n+'" height="'+r.height*n+'" />')}}}catch(e){}}));return v("div",{className:t("v-editor-wrapper",C),children:[p(i,n({tinymceScriptSrc:N+"/tinymce.min.js"},k,{onInit:S,onKeyDown:I,onEditorChange:F,init:n({promotion:false,language:"zh-Hans",height:500,paste_data_images:y?true:false,paste_postprocess:z,autosave_ask_before_unload:false,base_url:N,autoresize_bottom_margin:0,images_upload_handler:function e(n){return new Promise((function(e,t){var r,i,o;var a=function(n){try{return e(Promise.reject((n==null?void 0:n.message)||"图片上传异常"))}catch(e){return t(e)}};try{r=n.blob();i=new File([r],r.name,{type:r.type});return Promise.resolve(y==null?void 0:y(i)).then((function(n){try{o=n;return e(Promise.resolve(o))}catch(e){return a(e)}}),a)}catch(e){a(e)}}))},plugins:"lists link image advlist charmap preview fullscreen code table help codesample "+(((m=c.init)==null?void 0:m.plugins_append)||""),toolbar:"undo redo fullscreen preview | bold italic underline strikethrough |"+"fontsize blocks |"+"forecolor backcolor removeformat |"+"numlist bullist advlist |"+"alignleft aligncenter alignright alignjustify |"+"outdent indent |"+"hr image link code codesample |"+(((d=c.init)==null?void 0:d.toolbar_append)||""),font_size_formats:"8px 10px 12px 14px 16px 18px 24px 36px 48px"},c.init,{content_style:"img {max-width:100%;} table{width:100%} "+((f=c.init)==null?void 0:f.content_style)})})),p(g,{visible:!!_,url:_,close:function e(){j("")}})]})};export{y as RichTextEditor};
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -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 { TAny } from '@flatbiz/utils';\nimport { Editor, IAllProps } from '@tinymce/tinymce-react';\nimport { hooks } from '@wove/react';\nimport { useKeyPress } from 'ahooks';\nimport { useRef, useState } from 'react';\nimport { 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 // value?: string;\n /** 上传图片服务 */\n onUploadImage?: (file: File) => Promise<string>;\n className?: string;\n /** 图片点击预览 */\n imgPreview?: boolean;\n init?: IAllProps['init'] & {\n /**\n * 通过粘贴图片创建的img标签,显示压缩比例,此处min、max是和指图片宽度\n * 1. 默认值:[{ min: 0, max: 1000, ratio: 0.5 }, { min: 1000, ratio: 0.3 }]\n */\n img_ratio?: { min: number; max?: number; ratio: number }[];\n /** 插件添加;自定义plugins后失效 */\n plugins_append?: string;\n /** 工具栏添加;自定义toolbar后失效 */\n toolbar_append?: string;\n };\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 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 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 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) {\n return Promise.reject(error?.message || '图片上传异常');\n }\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 }}\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$init2","_props$init3","_props$init4","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","_","_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","_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","message","$boundEx","file","File","name","resolve","then","$await_6","plugins","plugins_append","toolbar","toolbar_append","font_size_formats","content_style"],"mappings":";+rBAOO,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,qDCGawB,EAAiB,SAAjBA,EAAkB1B,GAA+B,IAA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AA7B,EAAM2C,OAANd,UAAAA,EAAAA,EAAYsG,iBAAkB,IACjCC,kBAAmB,+CAChBpI,EAAM2C,KAAI,CACb0F,cAAa,6CAAAvG,EAA6C9B,EAAM2C,OAAI,UAAA,EAAVb,EAAYuG,oBAG1E7H,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 { type TAny } from '@flatbiz/utils';\nimport { Editor, type IAllProps } from '@tinymce/tinymce-react';\nimport { hooks } from '@wove/react';\nimport { useKeyPress } from 'ahooks';\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 // value?: string;\n /** 上传图片服务 */\n onUploadImage?: (file: File) => Promise<string>;\n className?: string;\n /** 图片点击预览 */\n imgPreview?: boolean;\n init?: IAllProps['init'] & {\n /**\n * 通过粘贴图片创建的img标签,显示压缩比例,此处min、max是和指图片宽度\n * 1. 默认值:[{ min: 0, max: 1000, ratio: 0.5 }, { min: 1000, ratio: 0.3 }]\n */\n img_ratio?: { min: number; max?: number; ratio: number }[];\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 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 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\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 }}\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$init2","_props$init3","_props$init4","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","_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","message","$boundEx","file","File","name","resolve","then","$await_6","plugins","plugins_append","toolbar","toolbar_append","font_size_formats","content_style"],"mappings":";+rBAOO,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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B,CAAC,MAAAI,GAAW,OAAOH,EAAAG,EAAM,CAAC,GAAAH,EA6LtB,CAAC,MAAO7D,GAAY6D,EAAZ7D,EAET,CAAC,GACF,EAEDuE,QACE,qFACCxG,EAAA5B,EAAM2C,mBAANf,EAAYyG,iBAAkB,IACjCC,QACE,uEACA,oBACA,qCACA,4BACA,kDACA,mBACA,qCACCzG,EAAA7B,EAAM2C,OAANd,UAAAA,EAAAA,EAAY0G,iBAAkB,IACjCC,kBAAmB,+CAChBxI,EAAM2C,KAAI,CACb8F,cAAa,6CAAA3G,EAA6C9B,EAAM2C,OAAI,UAAA,EAAVb,EAAY2G,oBAG1EjI,EAACT,EAAO,CACNE,UAAWuC,EACXtC,IAAKsC,EACL7B,MAAO,SAAAA,IACL8B,EAAc,GAChB,MAIR"}
|
|
@@ -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{classNames as e}from"@dimjs/utils/cjs/class-names";import{isUndefinedOrNull as i}from"@flatbiz/utils";import{fbaHooks as l}from"../fba-hooks/index.js";import{FlexLayout as t}from"../flex-layout/index.js";import{jsxs as r,jsx as s}from"react/jsx-runtime";import"../_rollupPluginBabelHelpers-fc015ef2.js";import"@dimjs/lang/cjs/is-array";import"@wove/react/cjs/hooks";import"react";import"../use-responsive-point-21b8c601.js";import"antd";var c=function c(a){var
|
|
6
|
+
import{classNames as e}from"@dimjs/utils/cjs/class-names";import{isUndefinedOrNull as i}from"@flatbiz/utils";import{fbaHooks as l}from"../fba-hooks/index.js";import{FlexLayout as t}from"../flex-layout/index.js";import{jsxs as r,jsx as s}from"react/jsx-runtime";import"../_rollupPluginBabelHelpers-fc015ef2.js";import"@dimjs/lang/cjs/is-array";import"@wove/react/cjs/hooks";import"react";import"../use-responsive-point-21b8c601.js";import"antd";var c=function c(a){var n=i(a.showTitleIndex)?true:a.showTitleIndex;var m=l.useThemeToken();var d={"--rule-describe-colorPrimary":m.colorPrimary};return r("div",{className:e("v-rule-describe",a.className),style:d,children:[a.title?s("div",{className:e("v-rule-describe-title",{"v-rule-describe-title-sign":a.titleSign}),children:a.title}):null,a.ruleDataList.map((function(e,i){if(n&&e.title){return r("div",{className:"v-rule-describe-item",children:[r(t,{fullIndex:1,direction:"horizontal",className:"v-rule-describe-item-title",style:a.ruleItemTitleStyle,children:[r("span",{className:"v-rule-describe-item-title-index",children:[i+1,". "]}),s("span",{className:"v-rule-describe-item-title-content",children:e.title})]}),e.desc?r(t,{direction:"horizontal",className:"v-rule-describe-item-desc",style:a.ruleItemDescStyle,fullIndex:1,children:[s("span",{className:"v-rule-describe-item-title-index"}),s("span",{className:"v-rule-describe-item-title-content",children:e.desc})]}):null]},i)}return r("div",{className:"v-rule-describe-item",children:[e.title?s("div",{className:"v-rule-describe-item-title",style:a.ruleItemTitleStyle,children:e.title}):null,e.desc?s("div",{className:"v-rule-describe-item-desc",style:a.ruleItemDescStyle,children:e.desc}):null]},i)}))]})};export{c as RuleDescribe};
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/rule-describe/rule-describe.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { isUndefinedOrNull } from '@flatbiz/utils';\nimport { CSSProperties, ReactElement } from 'react';\nimport { fbaHooks } from '../fba-hooks';\nimport { FlexLayout } from '../flex-layout';\nimport './style.less';\n\nexport type RuleDataItem = {\n title?: string | ReactElement;\n desc?: string | ReactElement;\n};\nexport type RuleDescribeProps = {\n title?: string;\n showTitleIndex?: boolean;\n ruleDataList: RuleDataItem[];\n titleSign?: boolean;\n className?: string;\n ruleItemTitleStyle?: CSSProperties;\n ruleItemDescStyle?: CSSProperties;\n};\n\nexport const RuleDescribe = (props: RuleDescribeProps) => {\n const showTitleIndex = isUndefinedOrNull(props.showTitleIndex) ? true : props.showTitleIndex;\n\n const theme = fbaHooks.useThemeToken();\n\n const style = { '--rule-describe-colorPrimary': theme.colorPrimary } as CSSProperties;\n\n return (\n <div className={classNames('v-rule-describe', props.className)} style={style}>\n {props.title ? (\n <div\n className={classNames('v-rule-describe-title', { 'v-rule-describe-title-sign': props.titleSign })}\n >\n {props.title}\n </div>\n ) : null}\n {props.ruleDataList.map((item, index) => {\n if (showTitleIndex && item.title) {\n return (\n <div key={index} className=\"v-rule-describe-item\">\n <FlexLayout\n direction=\"horizontal\"\n className=\"v-rule-describe-item-title\"\n style={props.ruleItemTitleStyle}\n >\n <span className=\"v-rule-describe-item-title-index\">{index + 1}. </span>\n <span className=\"v-rule-describe-item-title-content\">{item.title}</span>\n </FlexLayout>\n {item.desc ? (\n <FlexLayout\n direction=\"horizontal\"\n className=\"v-rule-describe-item-desc\"\n style={props.ruleItemDescStyle}\n >\n <span className=\"v-rule-describe-item-title-index\"></span>\n <span className=\"v-rule-describe-item-title-content\">{item.desc}</span>\n </FlexLayout>\n ) : null}\n </div>\n );\n }\n return (\n <div key={index} className=\"v-rule-describe-item\">\n {item.title ? (\n <div className=\"v-rule-describe-item-title\" style={props.ruleItemTitleStyle}>\n {item.title}\n </div>\n ) : null}\n {item.desc ? (\n <div className=\"v-rule-describe-item-desc\" style={props.ruleItemDescStyle}>\n {item.desc}\n </div>\n ) : null}\n </div>\n );\n })}\n </div>\n );\n};\n"],"names":["RuleDescribe","props","showTitleIndex","isUndefinedOrNull","theme","fbaHooks","useThemeToken","style","colorPrimary","_jsxs","className","_classNames","children","title","_jsx","titleSign","ruleDataList","map","item","index","FlexLayout","direction","ruleItemTitleStyle","desc","ruleItemDescStyle"],"mappings":";gcAqBaA,EAAe,SAAfA,EAAgBC,GAC3B,IAAMC,EAAiBC,EAAkBF,EAAMC,gBAAkB,KAAOD,EAAMC,eAE9E,IAAME,EAAQC,EAASC,gBAEvB,IAAMC,EAAQ,CAAE,+BAAgCH,EAAMI,cAEtD,OACEC,EAAA,MAAA,CAAKC,UAAWC,EAAW,kBAAmBV,EAAMS,WAAYH,MAAOA,EAAMK,SAC1EX,CAAAA,EAAMY,MACLC,EAAA,MAAA,CACEJ,UAAWC,EAAW,wBAAyB,CAAE,6BAA8BV,EAAMc,YAAaH,SAEjGX,EAAMY,QAEP,KACHZ,EAAMe,aAAaC,KAAI,SAACC,EAAMC,GAC7B,GAAIjB,GAAkBgB,EAAKL,MAAO,CAChC,OACEJ,EAAA,MAAA,CAAiBC,UAAU,uBAAsBE,SAAA,CAC/CH,EAACW,EAAU,CACTC,UAAU,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["@flatbiz/antd/src/rule-describe/rule-describe.tsx"],"sourcesContent":["import { classNames } from '@dimjs/utils';\nimport { isUndefinedOrNull } from '@flatbiz/utils';\nimport { CSSProperties, ReactElement } from 'react';\nimport { fbaHooks } from '../fba-hooks';\nimport { FlexLayout } from '../flex-layout';\nimport './style.less';\n\nexport type RuleDataItem = {\n title?: string | ReactElement;\n desc?: string | ReactElement;\n};\nexport type RuleDescribeProps = {\n title?: string;\n showTitleIndex?: boolean;\n ruleDataList: RuleDataItem[];\n titleSign?: boolean;\n className?: string;\n ruleItemTitleStyle?: CSSProperties;\n ruleItemDescStyle?: CSSProperties;\n};\n\nexport const RuleDescribe = (props: RuleDescribeProps) => {\n const showTitleIndex = isUndefinedOrNull(props.showTitleIndex) ? true : props.showTitleIndex;\n\n const theme = fbaHooks.useThemeToken();\n\n const style = { '--rule-describe-colorPrimary': theme.colorPrimary } as CSSProperties;\n\n return (\n <div className={classNames('v-rule-describe', props.className)} style={style}>\n {props.title ? (\n <div\n className={classNames('v-rule-describe-title', { 'v-rule-describe-title-sign': props.titleSign })}\n >\n {props.title}\n </div>\n ) : null}\n {props.ruleDataList.map((item, index) => {\n if (showTitleIndex && item.title) {\n return (\n <div key={index} className=\"v-rule-describe-item\">\n <FlexLayout\n fullIndex={1}\n direction=\"horizontal\"\n className=\"v-rule-describe-item-title\"\n style={props.ruleItemTitleStyle}\n >\n <span className=\"v-rule-describe-item-title-index\">{index + 1}. </span>\n <span className=\"v-rule-describe-item-title-content\">{item.title}</span>\n </FlexLayout>\n {item.desc ? (\n <FlexLayout\n direction=\"horizontal\"\n className=\"v-rule-describe-item-desc\"\n style={props.ruleItemDescStyle}\n fullIndex={1}\n >\n <span className=\"v-rule-describe-item-title-index\"></span>\n <span className=\"v-rule-describe-item-title-content\">{item.desc}</span>\n </FlexLayout>\n ) : null}\n </div>\n );\n }\n return (\n <div key={index} className=\"v-rule-describe-item\">\n {item.title ? (\n <div className=\"v-rule-describe-item-title\" style={props.ruleItemTitleStyle}>\n {item.title}\n </div>\n ) : null}\n {item.desc ? (\n <div className=\"v-rule-describe-item-desc\" style={props.ruleItemDescStyle}>\n {item.desc}\n </div>\n ) : null}\n </div>\n );\n })}\n </div>\n );\n};\n"],"names":["RuleDescribe","props","showTitleIndex","isUndefinedOrNull","theme","fbaHooks","useThemeToken","style","colorPrimary","_jsxs","className","_classNames","children","title","_jsx","titleSign","ruleDataList","map","item","index","FlexLayout","fullIndex","direction","ruleItemTitleStyle","desc","ruleItemDescStyle"],"mappings":";gcAqBaA,EAAe,SAAfA,EAAgBC,GAC3B,IAAMC,EAAiBC,EAAkBF,EAAMC,gBAAkB,KAAOD,EAAMC,eAE9E,IAAME,EAAQC,EAASC,gBAEvB,IAAMC,EAAQ,CAAE,+BAAgCH,EAAMI,cAEtD,OACEC,EAAA,MAAA,CAAKC,UAAWC,EAAW,kBAAmBV,EAAMS,WAAYH,MAAOA,EAAMK,SAC1EX,CAAAA,EAAMY,MACLC,EAAA,MAAA,CACEJ,UAAWC,EAAW,wBAAyB,CAAE,6BAA8BV,EAAMc,YAAaH,SAEjGX,EAAMY,QAEP,KACHZ,EAAMe,aAAaC,KAAI,SAACC,EAAMC,GAC7B,GAAIjB,GAAkBgB,EAAKL,MAAO,CAChC,OACEJ,EAAA,MAAA,CAAiBC,UAAU,uBAAsBE,SAAA,CAC/CH,EAACW,EAAU,CACTC,UAAW,EACXC,UAAU,aACVZ,UAAU,6BACVH,MAAON,EAAMsB,mBAAmBX,UAEhCH,EAAA,OAAA,CAAMC,UAAU,mCAAkCE,SAAEO,CAAAA,EAAQ,EAAE,QAC9DL,EAAA,OAAA,CAAMJ,UAAU,qCAAoCE,SAAEM,EAAKL,WAE5DK,EAAKM,KACJf,EAACW,EAAU,CACTE,UAAU,aACVZ,UAAU,4BACVH,MAAON,EAAMwB,kBACbJ,UAAW,EAAET,UAEbE,EAAA,OAAA,CAAMJ,UAAU,qCAChBI,EAAA,OAAA,CAAMJ,UAAU,qCAAoCE,SAAEM,EAAKM,UAE3D,OApBIL,EAuBd,CACA,OACEV,EAAA,MAAA,CAAiBC,UAAU,uBAAsBE,SAC9CM,CAAAA,EAAKL,MACJC,EAAA,MAAA,CAAKJ,UAAU,6BAA6BH,MAAON,EAAMsB,mBAAmBX,SACzEM,EAAKL,QAEN,KACHK,EAAKM,KACJV,EAAA,MAAA,CAAKJ,UAAU,4BAA4BH,MAAON,EAAMwB,kBAAkBb,SACvEM,EAAKM,OAEN,OAVIL,EAad,MAGN"}
|
|
@@ -3,5 +3,5 @@ import './../request-status/index.css';
|
|
|
3
3
|
import './../fba-hooks/index.css';
|
|
4
4
|
import './index.css';
|
|
5
5
|
/*! @flatjs/forge MIT @flatbiz/antd */
|
|
6
|
-
import e from"@ant-design/icons/es/icons/RedoOutlined";import{isString as r}from"@dimjs/lang/cjs/is-string";import{hooks as n}from"@wove/react/cjs/hooks";import{a as t,_ as o}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{isUndefinedOrNull as u,toArray as s,valueIsEqual as i,arrayFind as a}from"@flatbiz/utils";import{Select as l,Button as c}from"antd";import{useState as f,useMemo as v,useRef as d}from"react";import{RequestStatus as h}from"../request-status/index.js";import{isDeepEqual as
|
|
6
|
+
import e from"@ant-design/icons/es/icons/RedoOutlined";import{isString as r}from"@dimjs/lang/cjs/is-string";import{hooks as n}from"@wove/react/cjs/hooks";import{a as t,_ as o}from"../_rollupPluginBabelHelpers-fc015ef2.js";import{isUndefinedOrNull as u,toArray as s,valueIsEqual as i,arrayFind as a}from"@flatbiz/utils";import{Select as l,Button as c}from"antd";import{useState as f,useMemo as v,useRef as d}from"react";import{RequestStatus as h}from"../request-status/index.js";import{isDeepEqual as p}from"@dimjs/lang/cjs/is-deep-equal";import{isArray as m}from"@dimjs/lang/cjs/is-array";import{get as g}from"@dimjs/utils/cjs/get";import{json as C}from"@dimjs/utils/cjs/json";import q from"pubsub-js";import{fbaHooks as w}from"../fba-hooks/index.js";import{isObject as y}from"@dimjs/lang/cjs/is-object";import{jsx as _,jsxs as b}from"react/jsx-runtime";import"@dimjs/utils/cjs/extend";import"../use-responsive-point-21b8c601.js";var j=function e(r){var n=r.cacheKey,t=r.serviceConfig,o=r.hasOuterSelectorList,s=r.outerSelectorList,i=r.onRespDataChange,a=r.onSelectorRequestError,l=r.onChange,c=r.useCache,d=r.fieldNames;var h=t==null?void 0:t.params;var y=(t==null?void 0:t.requiredParamsKeys)||[];var _=h&&Object.keys(h).length>0;var b=f(),j=b[0],R=b[1];var S=f(),L=S[0],O=S[1];var P=f(Date.now()),A=P[0],k=P[1];var x=v((function(){try{if(_){var e=JSON.stringify(C.sort(h));if(e==="{}"){return undefined}return e}}catch(e){}return undefined}),[_,h]);var N=""+x;var E=x+"_status";var D=n+"_"+N;var I=w.usePrevious(x);var K=w.usePrevious(h);var M=function e(r){if(t!=null&&t.onRequestResultAdapter){return t==null?void 0:t.onRequestResultAdapter(r)}if(d!=null&&d.list){var n=g(r,d==null?void 0:d.list);return m(n)?n:[]}return r};var B=function e(){var r;return(r=window["__selector_wrapper_"])==null?void 0:r[n]};var J=function e(){var r;return(r=B())==null?void 0:r[N]};var T=function e(){var r;return(r=B())==null?void 0:r[E]};var V=function e(r,t){if(!window["__selector_wrapper_"]){window["__selector_wrapper_"]={}}if(!window["__selector_wrapper_"][n]){window["__selector_wrapper_"][n]={}}window["__selector_wrapper_"][n][r]=t};var z=function e(r){V(E,r);O(r)};var F=function e(){return new Promise((function(e,r){var n,o;var u=function(n){try{console.error(n);z("request-error");R(undefined);setTimeout((function(){q.publish(D,{status:"request-error"})}));a==null?void 0:a(n);return e(Promise.reject())}catch(e){return r(e)}};try{z("request-progress");return Promise.resolve(t==null||t.onRequest==null?void 0:t.onRequest(h||{})).then((function(r){try{n=r;o=M(n)||[];V(N,o);z("request-success");setTimeout((function(){q.publish(D,{status:"request-success",respData:o})}));return e(o)}catch(e){return u(e)}}),u)}catch(e){u(e)}}))};w.useEffectCustomAsync((function(){return new Promise((function(e,r){var n,f,v,d,m,g;if(o){O("request-success");R(s);i==null?void 0:i(s);return e()}if(y.length>0){n=h?y.find((function(e){return u(h[e])})):true;if(n){R([]);O("no-dependencies-params");if(I){l==null?void 0:l(undefined)}return e()}if(c===false){if(p(h,K)){return e()}var C=function(){try{return e()}catch(e){return r(e)}};var w=function(e){try{console.error(e);O("request-error");R(undefined);a==null?void 0:a(e);return C()}catch(e){return r(e)}};try{O("request-progress");return Promise.resolve(t==null||t.onRequest==null?void 0:t.onRequest(h||{})).then((function(e){try{f=e;v=M(f)||[];O("request-success");R(v);i==null?void 0:i(v);return C()}catch(e){return w(e)}}),w)}catch(e){w(e)}}return _.call(this)}function _(){d=T();if(d==="request-success"){m=J();R(m);O(d);i==null?void 0:i(m);return e()}if(d==="request-progress"){O(d);q.subscribe(D,(function(e,r){var n=r.status,t=r.respData;if(n==="request-success"){O(n);R(t);i==null?void 0:i(t)}else{O("request-error");R(undefined)}}));return e()}var n=function(){try{return e()}catch(e){return r(e)}};var t=function(e){try{console.error(e);O("request-error");R(undefined);a==null?void 0:a(e);return n()}catch(e){return r(e)}};try{return Promise.resolve(F()).then((function(e){try{g=e;R(g);O("request-success");i==null?void 0:i(g);return n()}catch(e){return t(e)}}),t)}catch(e){t(e)}}return _.call(this)}))}),[JSON.stringify(h),s,A]);var H=function e(){k(Date.now())};return{requestStatus:L,stateSelectorList:j,serviceRequestParamsStringify:x,onRefreshRequest:H}};var R=function e(r,n){var t=s(r);t=t.map((function(e){if(y(e))return e[n];return e}));return t};var S=["serviceConfig","showAllOption","onSelectorListChange","onSelectorListAllChange","onSelectorRequestError","onLabelRenderAdapter","requestMessageConfig","selectorList","modelKey","fieldNames","value","labelInValue","useCache"];var L=function u(f){var p=f.serviceConfig,m=f.showAllOption,g=f.onSelectorListChange,C=f.onSelectorListAllChange,q=f.onSelectorRequestError,w=f.onLabelRenderAdapter,y=f.requestMessageConfig,L=f.selectorList,O=f.modelKey,P=f.fieldNames,A=f.value,k=f.labelInValue,x=f.useCache,N=t(f,S);var E=d(true);var D=f.hasOwnProperty("selectorList");var I=o({label:"label",value:"value",disabled:"disabled"},P);var K=I.label,M=I.value,B=I.disabled;var J=v((function(){var e;if(!m)return null;var r=m===true;return e={},e[K]=r?"全部":m.label,e[M]=r?"":m.value,e}),[K,M,m]);var T=i(f.mode,["multiple"]);var V=j({fieldNames:I,cacheKey:O,hasOuterSelectorList:D,onChange:f.onChange,serviceConfig:p,outerSelectorList:L,onRespDataChange:function e(r){if(E.current){g==null?void 0:g(r||[]);E.current=false}C==null?void 0:C(r||[])},onSelectorRequestError:q,useCache:x===undefined?true:x}),z=V.requestStatus,F=V.stateSelectorList,H=V.onRefreshRequest;var W=n.useCallbackRef((function(e){if(k){if(T){f.onChange==null?void 0:f.onChange(e,e)}else{f.onChange==null?void 0:f.onChange(e[0],e)}}else{var r=e.map((function(e){return e[M]}));if(T){f.onChange==null?void 0:f.onChange(r,e)}else{f.onChange==null?void 0:f.onChange(r[0],e[0])}}}));var G=n.useCallbackRef((function(e,r){if(!r)return f.onChange==null?void 0:f.onChange(undefined);var n=s(r);var t=[];n.forEach((function(e){if(m&&J&&e.value===J[M]){t.push(J)}else{var r=a(F||[],e.value,M);if(r){t.push(r)}}}));W(t)}));var Q=v((function(){if(z!=="request-success")return[];if(!F||F.length===0)return[];if(!J)return F;return[J].concat(F)}),[J,z,F]);var U=z==="request-progress";var X=v((function(){var e=R(A,M);return T?e:e[0]}),[T,M,A]);var Y=n.useCallbackRef((function(e,n){var t=s(n.children);var o="";t.forEach((function(e){if(r(e))o+=e}));return o.toLowerCase().indexOf(e.toLowerCase())>=0}));return _(l,o({showSearch:true,allowClear:true,popupMatchSelectWidth:false,filterOption:Y},N,{style:o({width:"100%"},f.style),value:X,loading:U,onChange:G,fieldNames:undefined,suffixIcon:z==="request-error"?_(e,{spin:U,onClick:H}):N.suffixIcon,notFoundContent:_(h,{status:z,loading:U,messageConfig:o({"request-init":"暂无数据"},y),errorButton:_(c,{type:"primary",onClick:H,children:"重新获取数据"})}),children:Q.map((function(e,r){var n=e[M];var t=e[K];return b(l.Option,{value:n,label:t,disabled:e[B],children:[f.showIcon?_("span",{className:"v-selector-item-icon",children:f.icon==null?void 0:f.icon(e,r)}):null,w?w(e):t]},n+"-"+r)}))}))};export{L as SelectorWrapper};
|
|
7
7
|
//# sourceMappingURL=index.js.map
|