@tiny-codes/react-easy 1.1.2 → 1.2.0
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/CHANGELOG.md +24 -0
- package/es/components/BreakLines/index.d.ts +13 -19
- package/es/components/BreakLines/index.js +2 -3
- package/es/components/BreakLines/index.js.map +1 -1
- package/es/components/ConfigProvider/context.d.ts +20 -26
- package/es/components/ConfigProvider/context.js.map +1 -1
- package/es/components/ConfigProvider/index.d.ts +5 -7
- package/es/components/ConfigProvider/index.js +2 -3
- package/es/components/ConfigProvider/index.js.map +1 -1
- package/es/components/ConfirmAction/index.d.ts +66 -89
- package/es/components/ConfirmAction/index.js +27 -18
- package/es/components/ConfirmAction/index.js.map +1 -1
- package/es/components/ContextMenu/index.d.ts +42 -0
- package/es/components/ContextMenu/index.js +188 -0
- package/es/components/ContextMenu/index.js.map +1 -0
- package/es/components/ContextMenu/style/index.d.ts +3 -0
- package/es/components/ContextMenu/style/index.js +25 -0
- package/es/components/ContextMenu/style/index.js.map +1 -0
- package/es/components/DeleteConfirmAction/index.d.ts +2 -3
- package/es/components/DeleteConfirmAction/index.js +8 -12
- package/es/components/DeleteConfirmAction/index.js.map +1 -1
- package/es/components/EditableText/form.d.ts +150 -0
- package/es/components/EditableText/form.js +359 -0
- package/es/components/EditableText/form.js.map +1 -0
- package/es/components/EditableText/index.d.ts +160 -0
- package/es/components/EditableText/index.js +222 -0
- package/es/components/EditableText/index.js.map +1 -0
- package/es/components/EditableText/style/index.d.ts +3 -0
- package/es/components/EditableText/style/index.js +76 -0
- package/es/components/EditableText/style/index.js.map +1 -0
- package/es/components/FloatDrawer/index.d.ts +89 -86
- package/es/components/FloatDrawer/index.js +43 -20
- package/es/components/FloatDrawer/index.js.map +1 -1
- package/es/components/FloatDrawer/style/index.js +42 -21
- package/es/components/FloatDrawer/style/index.js.map +1 -1
- package/es/components/Loading/index.d.ts +9 -14
- package/es/components/Loading/index.js +7 -6
- package/es/components/Loading/index.js.map +1 -1
- package/es/components/Loading/style/index.js +1 -1
- package/es/components/Loading/style/index.js.map +1 -1
- package/es/components/ModalAction/index.d.ts +98 -139
- package/es/components/ModalAction/index.js +25 -37
- package/es/components/ModalAction/index.js.map +1 -1
- package/es/components/OverflowTags/index.d.ts +30 -8
- package/es/components/OverflowTags/index.js +26 -7
- package/es/components/OverflowTags/index.js.map +1 -1
- package/es/components/OverflowTags/style/index.js +1 -1
- package/es/components/OverflowTags/style/index.js.map +1 -1
- package/es/components/index.d.ts +4 -0
- package/es/components/index.js +2 -0
- package/es/components/index.js.map +1 -1
- package/es/hooks/useRefFunction.d.ts +4 -5
- package/es/hooks/useRefFunction.js +6 -7
- package/es/hooks/useRefFunction.js.map +1 -1
- package/es/hooks/useRefValue.d.ts +2 -3
- package/es/hooks/useRefValue.js +2 -3
- package/es/hooks/useRefValue.js.map +1 -1
- package/es/hooks/useT.js +1 -2
- package/es/hooks/useT.js.map +1 -1
- package/es/hooks/useValidator.d.ts +2 -3
- package/es/hooks/useValidator.js +2 -3
- package/es/hooks/useValidator.js.map +1 -1
- package/es/hooks/useValidatorBuilder.d.ts +41 -61
- package/es/hooks/useValidatorBuilder.js +4 -6
- package/es/hooks/useValidatorBuilder.js.map +1 -1
- package/es/hooks/useValidators.d.ts +62 -83
- package/es/hooks/useValidators.js +3 -4
- package/es/hooks/useValidators.js.map +1 -1
- package/es/locales/index.d.ts +15 -0
- package/es/locales/langs/en-US.d.ts +5 -0
- package/es/locales/langs/en-US.js +5 -0
- package/es/locales/langs/en-US.js.map +1 -1
- package/es/locales/langs/zh-CN.d.ts +5 -0
- package/es/locales/langs/zh-CN.js +5 -0
- package/es/locales/langs/zh-CN.js.map +1 -1
- package/lib/components/BreakLines/index.d.ts +13 -19
- package/lib/components/BreakLines/index.js.map +2 -2
- package/lib/components/ConfigProvider/context.d.ts +20 -26
- package/lib/components/ConfigProvider/context.js.map +2 -2
- package/lib/components/ConfigProvider/index.d.ts +5 -7
- package/lib/components/ConfigProvider/index.js.map +2 -2
- package/lib/components/ConfirmAction/index.d.ts +66 -89
- package/lib/components/ConfirmAction/index.js +9 -0
- package/lib/components/ConfirmAction/index.js.map +2 -2
- package/lib/components/ContextMenu/index.d.ts +42 -0
- package/lib/components/ContextMenu/index.js +190 -0
- package/lib/components/ContextMenu/index.js.map +7 -0
- package/lib/components/ContextMenu/style/index.d.ts +3 -0
- package/lib/components/ContextMenu/style/index.js +48 -0
- package/lib/components/ContextMenu/style/index.js.map +7 -0
- package/lib/components/DeleteConfirmAction/index.d.ts +2 -3
- package/lib/components/DeleteConfirmAction/index.js.map +2 -2
- package/lib/components/EditableText/form.d.ts +150 -0
- package/lib/components/EditableText/form.js +253 -0
- package/lib/components/EditableText/form.js.map +7 -0
- package/lib/components/EditableText/index.d.ts +160 -0
- package/lib/components/EditableText/index.js +181 -0
- package/lib/components/EditableText/index.js.map +7 -0
- package/lib/components/EditableText/style/index.d.ts +3 -0
- package/lib/components/EditableText/style/index.js +118 -0
- package/lib/components/EditableText/style/index.js.map +7 -0
- package/lib/components/FloatDrawer/index.d.ts +89 -86
- package/lib/components/FloatDrawer/index.js +64 -39
- package/lib/components/FloatDrawer/index.js.map +2 -2
- package/lib/components/FloatDrawer/style/index.js +60 -23
- package/lib/components/FloatDrawer/style/index.js.map +2 -2
- package/lib/components/Loading/index.d.ts +9 -14
- package/lib/components/Loading/index.js +13 -4
- package/lib/components/Loading/index.js.map +2 -2
- package/lib/components/Loading/style/index.js +1 -1
- package/lib/components/Loading/style/index.js.map +2 -2
- package/lib/components/ModalAction/index.d.ts +98 -139
- package/lib/components/ModalAction/index.js.map +2 -2
- package/lib/components/OverflowTags/index.d.ts +30 -8
- package/lib/components/OverflowTags/index.js +7 -5
- package/lib/components/OverflowTags/index.js.map +2 -2
- package/lib/components/OverflowTags/style/index.js +1 -1
- package/lib/components/OverflowTags/style/index.js.map +2 -2
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.js +6 -0
- package/lib/components/index.js.map +2 -2
- package/lib/hooks/useRefFunction.d.ts +4 -5
- package/lib/hooks/useRefFunction.js.map +2 -2
- package/lib/hooks/useRefValue.d.ts +2 -3
- package/lib/hooks/useRefValue.js.map +2 -2
- package/lib/hooks/useT.js.map +2 -2
- package/lib/hooks/useValidator.d.ts +2 -3
- package/lib/hooks/useValidator.js.map +2 -2
- package/lib/hooks/useValidatorBuilder.d.ts +41 -61
- package/lib/hooks/useValidatorBuilder.js.map +2 -2
- package/lib/hooks/useValidators.d.ts +62 -83
- package/lib/hooks/useValidators.js.map +2 -2
- package/lib/locales/index.d.ts +15 -0
- package/lib/locales/langs/en-US.d.ts +5 -0
- package/lib/locales/langs/en-US.js +5 -0
- package/lib/locales/langs/en-US.js.map +2 -2
- package/lib/locales/langs/zh-CN.d.ts +5 -0
- package/lib/locales/langs/zh-CN.js +5 -0
- package/lib/locales/langs/zh-CN.js.map +2 -2
- package/package.json +3 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/ContextMenu/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { CSSProperties, ReactNode } from 'react';\nimport { forwardRef, useContext, useImperativeHandle, useMemo } from 'react';\nimport { theme as AntdTheme, ConfigProvider, Typography } from 'antd';\nimport classNames from 'classnames';\nimport type { ItemProps, MenuProps, SeparatorProps, ShowContextMenuParams, SubMenuProps } from 'react-contexify';\nimport { Item, Menu, RightSlot, Separator, Submenu, useContextMenu } from 'react-contexify';\nimport { useRefFunction } from '../../hooks';\nimport useStyle from './style';\nimport 'react-contexify/dist/ReactContexify.css';\n\nexport interface ContextMenuProps extends MenuProps {\n /**\n * - **EN:** Menu items to be displayed\n * - **CN:** 要显示的菜单项\n */\n items: (ContextMenuItem | ContextMenuSeparator | ContextMenuSubmenu)[] | undefined;\n /**\n * - **EN:** Trigger methods to show the menu, default is `['contextMenu']`\n * - **CN:** 触发显示菜单的方式,默认是 `['contextMenu']`\n */\n trigger?: ('click' | 'doubleClick' | 'hover' | 'contextMenu')[];\n triggerProps?: {\n className?: string;\n style?: CSSProperties;\n };\n prefixCls?: string;\n}\n// 上下文菜单组件\nconst ContextMenu = forwardRef<ContextMenuRef, ContextMenuProps>((props, ref) => {\n const {\n id,\n items,\n trigger = ['contextMenu'],\n triggerProps,\n prefixCls: prefixClsInProps,\n className,\n children,\n ...rest\n } = props;\n const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const prefixCls = getPrefixCls('context-menu', prefixClsInProps);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const { show, hideAll } = useContextMenu({ id });\n const eventNames = useMemo<Record<NonNullable<ContextMenuProps['trigger']>[number], [string, string | undefined]>>(\n () => ({\n click: ['onClick', undefined],\n doubleClick: ['onDoubleClick', undefined],\n hover: ['onPointerEnter', 'onPointerLeave'],\n contextMenu: ['onContextMenu', undefined],\n }),\n []\n );\n\n // Show context menu handler\n const handleShow = useRefFunction(\n (event: React.MouseEvent<HTMLElement>, options?: Pick<ShowContextMenuParams, 'position'>) => {\n show({\n id,\n event,\n props,\n position: options?.position,\n });\n }\n );\n // Hide all context menus handler\n const handleHideAll = useRefFunction(() => {\n hideAll();\n });\n const eventHandlers = useMemo(() => {\n const handlers: Record<string, (event: React.MouseEvent<HTMLElement>) => void> = {};\n if (trigger) {\n trigger.forEach((eventType) => {\n const [handlerName, leaveHandlerName] = eventNames[eventType];\n handlers[handlerName] = (event: React.MouseEvent<HTMLElement>) => {\n handleShow(event);\n };\n if (leaveHandlerName) {\n handlers[leaveHandlerName] = handleHideAll;\n }\n });\n }\n return handlers;\n }, [eventNames, trigger]);\n\n // Expose show and hideAll methods to the ref\n useImperativeHandle(\n ref,\n () => ({\n show: handleShow,\n hideAll: handleHideAll,\n }),\n []\n );\n\n return (\n <>\n {children &&\n wrapCSSVar(\n <div\n {...eventHandlers}\n className={classNames(hashId, cssVarCls, prefixCls, `${prefixCls}-trigger`, triggerProps?.className)}\n style={triggerProps?.style}\n >\n {children}\n </div>\n )}\n {wrapCSSVar(\n <Menu\n id={id}\n className={classNames(\n hashId,\n cssVarCls,\n prefixCls,\n `${prefixCls}-menu`,\n {\n [`${prefixCls}-menu-has-items`]: !!items?.length,\n },\n className\n )}\n {...rest}\n >\n {renderItems(items, { theme: props.theme, cmpPrefixCls: prefixCls })}\n </Menu>\n )}\n </>\n );\n});\nContextMenu.displayName = 'ContextMenu';\n\n// Render menu items\nfunction renderItems(\n items: (ContextMenuItem | ContextMenuSeparator | ContextMenuSubmenu)[] | undefined,\n options: Pick<ContextMenuProps, 'theme'> & { cmpPrefixCls: string }\n): ReactNode[] | undefined {\n return items?.map((item, index) => {\n const isSeparator = 'type' in item && item.type === 'separator';\n const isSubmenu = 'type' in item && item.type === 'submenu';\n const menuItem = item as ContextMenuItem;\n\n if (isSeparator) {\n // eslint-disable-next-line react/no-array-index-key\n return <Separator key={`[separator]:${index}`} />;\n }\n\n if (isSubmenu) {\n const subMenu = item as ContextMenuSubmenu;\n return (\n <Submenu {...subMenu} key={subMenu.key}>\n {renderItems(item.items, options)}\n </Submenu>\n );\n }\n\n return (\n <Item\n {...menuItem}\n keyMatcher={\n typeof menuItem.shortcutKey === 'object'\n ? (e) => {\n const shortcutKey = menuItem.shortcutKey as Partial<KeyboardEvent>;\n if (shortcutKey.ctrlKey && !e.ctrlKey) return false;\n if (shortcutKey.altKey && !e.altKey) return false;\n if (shortcutKey.shiftKey && !e.shiftKey) return false;\n if (shortcutKey.metaKey && !e.metaKey) return false;\n if (!shortcutKey.key || shortcutKey.key !== e.key) return false;\n return true;\n }\n : menuItem.shortcutKey\n }\n key={menuItem.key}\n >\n {menuItem.children ? (\n menuItem.children\n ) : (\n <>\n {menuItem.icon}\n <span>{menuItem.label}</span>\n {typeof menuItem.shortcutKey === 'object' && (\n <RightSlot>{getShortcutText(menuItem.shortcutKey, options)}</RightSlot>\n )}\n </>\n )}\n </Item>\n );\n });\n}\n\nfunction getShortcutText(\n event: Partial<Pick<KeyboardEvent, 'ctrlKey' | 'altKey' | 'shiftKey' | 'metaKey' | 'key'>>,\n options: Pick<ContextMenuProps, 'theme'> & { cmpPrefixCls: string }\n): ReactNode[] {\n const { theme, cmpPrefixCls } = options;\n const keys: ReactNode[] = [];\n const Keyboard = (props: { children: ReactNode }) => {\n return (\n <ConfigProvider theme={{ algorithm: theme === 'dark' ? AntdTheme.darkAlgorithm : undefined }}>\n <Typography.Text keyboard className={`${cmpPrefixCls}-shortcut-key`}>\n {props.children}\n </Typography.Text>\n </ConfigProvider>\n );\n };\n if (event.ctrlKey) keys.push(<Keyboard>^</Keyboard>);\n if (event.altKey) keys.push(<Keyboard>⌥</Keyboard>);\n if (event.shiftKey) keys.push(<Keyboard>⇧</Keyboard>);\n if (event.metaKey) keys.push(<Keyboard>⌘</Keyboard>);\n if (event.key) {\n keys.push(<Keyboard>{event.key}</Keyboard>);\n }\n return keys;\n}\n\nexport interface ContextMenuRef {\n show: (event: React.MouseEvent<HTMLElement>) => void;\n hideAll: () => void;\n}\n\nexport interface ContextMenuItem extends Omit<ItemProps, 'children' | 'keyMatcher'> {\n key: string;\n className?: string;\n icon?: ReactNode;\n label?: ReactNode;\n shortcutKey?:\n | Partial<Pick<KeyboardEvent, 'ctrlKey' | 'altKey' | 'shiftKey' | 'metaKey' | 'key'>>\n | ItemProps['keyMatcher'];\n children?: ReactNode;\n}\n\nexport interface ContextMenuSeparator extends SeparatorProps {\n type: 'separator';\n}\n\nexport interface ContextMenuSubmenu extends SubMenuProps {\n key: string;\n type: 'submenu';\n items: (ContextMenuItem | ContextMenuSeparator | ContextMenuSubmenu)[];\n}\n\nexport default ContextMenu;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAqE;AACrE,kBAA+D;AAC/D,wBAAuB;AAEvB,6BAA0E;AAC1E,mBAA+B;AAC/B,mBAAqB;AACrB,4BAAO;AAoBP,IAAM,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|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: (prefixCls: string, rootCls?: string | undefined) => readonly [(node: import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>, string, string];
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/ContextMenu/style/index.ts
|
|
20
|
+
var style_exports = {};
|
|
21
|
+
__export(style_exports, {
|
|
22
|
+
default: () => style_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(style_exports);
|
|
25
|
+
var import_internal = require("antd/es/theme/internal");
|
|
26
|
+
var genStyle = (token) => {
|
|
27
|
+
const { componentCls } = token;
|
|
28
|
+
return {
|
|
29
|
+
[componentCls]: {
|
|
30
|
+
"&-trigger": {
|
|
31
|
+
width: "fit-content"
|
|
32
|
+
},
|
|
33
|
+
"&-menu": {
|
|
34
|
+
padding: 0,
|
|
35
|
+
"&-has-items": {
|
|
36
|
+
padding: "var(--contexify-menu-padding)"
|
|
37
|
+
},
|
|
38
|
+
[`${componentCls}-shortcut-key`]: {
|
|
39
|
+
kbd: {
|
|
40
|
+
fontFamily: "-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,sans-serif"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var style_default = (0, import_internal.genStyleHooks)("ContextMenu", genStyle);
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/ContextMenu/style/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { genStyleHooks } from 'antd/es/theme/internal';\nimport type { AliasToken, GenerateStyle } from 'antd/es/theme/internal';\nimport type { CSSObject } from '@ant-design/cssinjs';\nimport type { FullToken } from '@ant-design/cssinjs-utils';\n\ntype OverflowTagsToken = FullToken<{ ''?: object }, AliasToken, ''>;\n\nconst genStyle: GenerateStyle<OverflowTagsToken> = (token): CSSObject => {\n const { componentCls } = token;\n return {\n [componentCls]: {\n '&-trigger': {\n width: 'fit-content',\n },\n '&-menu': {\n padding: 0,\n '&-has-items': {\n padding: 'var(--contexify-menu-padding)',\n },\n [`${componentCls}-shortcut-key`]: {\n kbd: {\n fontFamily: '-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,sans-serif',\n },\n },\n },\n },\n };\n};\n\nexport default genStyleHooks('ContextMenu' as never, genStyle);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA8B;AAO9B,IAAM,WAA6C,CAAC,UAAqB;AACvE,QAAM,EAAE,aAAa,IAAI;AACzB,SAAO;AAAA,IACL,CAAC,YAAY,GAAG;AAAA,MACd,aAAa;AAAA,QACX,OAAO;AAAA,MACT;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,eAAe;AAAA,UACb,SAAS;AAAA,QACX;AAAA,QACA,CAAC,GAAG,2BAA2B,GAAG;AAAA,UAChC,KAAK;AAAA,YACH,YAAY;AAAA,UACd;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,oBAAQ,+BAAc,eAAwB,QAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ConfirmActionWithStatic } from '../ConfirmAction';
|
|
2
2
|
/**
|
|
3
|
-
* **EN:** Delete operation confirmation box
|
|
4
|
-
*
|
|
5
|
-
* **CN:** 删除操作确认框
|
|
3
|
+
* - **EN:** Delete operation confirmation box
|
|
4
|
+
* - **CN:** 删除操作确认框
|
|
6
5
|
*/
|
|
7
6
|
declare const DeleteConfirmAction: ConfirmActionWithStatic;
|
|
8
7
|
export default DeleteConfirmAction;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/DeleteConfirmAction/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { forwardRef } from 'react';\nimport type { ButtonProps, SwitchProps } from 'antd';\nimport { Button, Switch, Typography } from 'antd';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport { CloseCircleFilled } from '@ant-design/icons';\nimport { type ConfirmActionWithStatic, genRenderer, withDefaultConfirmActionProps } from '../ConfirmAction';\n\nconst renderDeleteConfirmAction = genRenderer({\n confirmType: 'delete',\n danger: true,\n icon: <CloseCircleFilled />,\n});\nconst forwarded = forwardRef(renderDeleteConfirmAction);\n\n/**\n * **EN:** Delete operation confirmation box\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAE3B,kBAA2C;AAE3C,mBAAkC;AAClC,2BAAyF;AAEzF,IAAM,gCAA4B,kCAAY;AAAA,EAC5C,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,MAAM,oCAAC,oCAAkB;AAC3B,CAAC;AACD,IAAM,gBAAY,yBAAW,yBAAyB;
|
|
4
|
+
"sourcesContent": ["import { forwardRef } from 'react';\nimport type { ButtonProps, SwitchProps } from 'antd';\nimport { Button, Switch, Typography } from 'antd';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport { CloseCircleFilled } from '@ant-design/icons';\nimport { type ConfirmActionWithStatic, genRenderer, withDefaultConfirmActionProps } from '../ConfirmAction';\n\nconst renderDeleteConfirmAction = genRenderer({\n confirmType: 'delete',\n danger: true,\n icon: <CloseCircleFilled />,\n});\nconst forwarded = forwardRef(renderDeleteConfirmAction);\n\n/**\n * - **EN:** Delete operation confirmation box\n * - **CN:** 删除操作确认框\n */\nconst DeleteConfirmAction = forwarded as unknown as ConfirmActionWithStatic;\n/**\n * - **EN:** Deletion confirmation box with button type\n * - **CN:** 按钮类型的删除确认框\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nDeleteConfirmAction.Button = withDefaultConfirmActionProps<ButtonProps, 'onClick'>(forwarded as any, {\n triggerComponent: Button,\n triggerEvent: 'onClick',\n triggerProps: {},\n});\n/**\n * - **EN:** Deletion confirmation box with switch type\n * - **CN:** 开关类型的删除确认框\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nDeleteConfirmAction.Switch = withDefaultConfirmActionProps<SwitchProps, 'onChange'>(forwarded as any, {\n triggerComponent: Switch,\n triggerEvent: 'onChange',\n triggerProps: {},\n});\n/**\n * - **EN:** Deletion confirmation box with link type\n * - **CN:** 链接类型的删除确认框\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nDeleteConfirmAction.Link = withDefaultConfirmActionProps<LinkProps, 'onClick'>(forwarded as any, {\n triggerComponent: Typography.Link,\n triggerEvent: 'onClick',\n triggerProps: {\n style: { whiteSpace: 'nowrap' },\n },\n});\n\nexport default DeleteConfirmAction;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAE3B,kBAA2C;AAE3C,mBAAkC;AAClC,2BAAyF;AAEzF,IAAM,gCAA4B,kCAAY;AAAA,EAC5C,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,MAAM,oCAAC,oCAAkB;AAC3B,CAAC;AACD,IAAM,gBAAY,yBAAW,yBAAyB;AAMtD,IAAM,sBAAsB;AAM5B,oBAAoB,aAAS,oDAAsD,WAAkB;AAAA,EACnG,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,cAAc,CAAC;AACjB,CAAC;AAMD,oBAAoB,aAAS,oDAAuD,WAAkB;AAAA,EACpG,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,cAAc,CAAC;AACjB,CAAC;AAMD,oBAAoB,WAAO,oDAAoD,WAAkB;AAAA,EAC/F,kBAAkB,uBAAW;AAAA,EAC7B,cAAc;AAAA,EACd,cAAc;AAAA,IACZ,OAAO,EAAE,YAAY,SAAS;AAAA,EAChC;AACF,CAAC;AAED,IAAO,8BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
2
|
+
import type { ButtonProps, FormItemProps, FormProps, InputProps, SpaceProps } from 'antd';
|
|
3
|
+
import type { TextAreaProps } from 'antd/es/input';
|
|
4
|
+
export interface EditableFormProps<V, IT extends 'Input' | 'TextArea' | RenderInputInterface> {
|
|
5
|
+
prefixCls?: string;
|
|
6
|
+
/**
|
|
7
|
+
* - **EN:** The value to edit
|
|
8
|
+
* - **CN:** 编辑的值
|
|
9
|
+
*/
|
|
10
|
+
value: V | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* - **EN:** Whether the text is required when editing, default is `true`, if `formItemProps.rules`
|
|
13
|
+
* is set, it will override this value
|
|
14
|
+
* - **CN:** 编辑文本时是否必填,默认值为`true`,如果设置了`formItemProps.rules`,将会覆盖此值
|
|
15
|
+
*
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
required?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* - **EN:** Form properties
|
|
21
|
+
* - **CN:** 表单属性
|
|
22
|
+
*/
|
|
23
|
+
formProps?: FormProps;
|
|
24
|
+
/**
|
|
25
|
+
* - **EN:** Form item properties
|
|
26
|
+
* - **CN:** 表单项属性
|
|
27
|
+
*/
|
|
28
|
+
formItemProps?: FormItemProps;
|
|
29
|
+
/**
|
|
30
|
+
* - **EN:** Custom component type for rendering the input box
|
|
31
|
+
* - **CN:** 自定义设置渲染输入框的组件类型
|
|
32
|
+
*
|
|
33
|
+
* @default 'Input'
|
|
34
|
+
*/
|
|
35
|
+
inputComp?: IT;
|
|
36
|
+
/**
|
|
37
|
+
* - **EN:** Input component properties
|
|
38
|
+
* - **CN:** 输入框组件属性
|
|
39
|
+
*/
|
|
40
|
+
inputProps?: IT extends 'TextArea' ? TextAreaProps : IT extends 'Input' ? InputProps : never;
|
|
41
|
+
/**
|
|
42
|
+
* - **EN:** Whether to display as a block-level element, with width 100%
|
|
43
|
+
* - **CN:** 是否显示为块级元素,宽度100%
|
|
44
|
+
*
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
block?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* - **EN:** Semantic class names
|
|
50
|
+
* - **CN:** 语义化类名
|
|
51
|
+
*/
|
|
52
|
+
classNames?: {
|
|
53
|
+
/**
|
|
54
|
+
* - **EN:** Edit mode parent container class name
|
|
55
|
+
* - **CN:** 编辑模式父容器类名
|
|
56
|
+
*/
|
|
57
|
+
wrapper?: string;
|
|
58
|
+
/**
|
|
59
|
+
* - **EN:** Submit button class name
|
|
60
|
+
* - **CN:** 提交按钮类名
|
|
61
|
+
*/
|
|
62
|
+
submitButton?: string;
|
|
63
|
+
/**
|
|
64
|
+
* - **EN:** Cancel button class name
|
|
65
|
+
* - **CN:** 取消按钮类名
|
|
66
|
+
*/
|
|
67
|
+
cancelButton?: string;
|
|
68
|
+
/**
|
|
69
|
+
* - **EN:** Submit button icon class name
|
|
70
|
+
* - **CN:** 提交按钮图标类名
|
|
71
|
+
*/
|
|
72
|
+
submitIcon?: string;
|
|
73
|
+
/**
|
|
74
|
+
* - **EN:** Cancel button icon class name
|
|
75
|
+
* - **CN:** 取消按钮图标类名
|
|
76
|
+
*/
|
|
77
|
+
cancelIcon?: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* - **EN:** Semantic styles
|
|
81
|
+
* - **CN:** 语义化样式
|
|
82
|
+
*/
|
|
83
|
+
styles?: {
|
|
84
|
+
/**
|
|
85
|
+
* - **EN:** Edit mode parent container style
|
|
86
|
+
* - **CN:** 编辑模式父容器样式
|
|
87
|
+
*/
|
|
88
|
+
wrapper?: CSSProperties;
|
|
89
|
+
/**
|
|
90
|
+
* - **EN:** Submit button style
|
|
91
|
+
* - **CN:** 提交按钮样式
|
|
92
|
+
*/
|
|
93
|
+
submitButton?: CSSProperties;
|
|
94
|
+
/**
|
|
95
|
+
* - **EN:** Cancel button style
|
|
96
|
+
* - **CN:** 取消按钮样式
|
|
97
|
+
*/
|
|
98
|
+
cancelButton?: CSSProperties;
|
|
99
|
+
/**
|
|
100
|
+
* - **EN:** Submit button icon style
|
|
101
|
+
* - **CN:** 提交按钮图标样式
|
|
102
|
+
*/
|
|
103
|
+
submitIcon?: CSSProperties;
|
|
104
|
+
/**
|
|
105
|
+
* - **EN:** Cancel button icon style
|
|
106
|
+
* - **CN:** 取消按钮图标样式
|
|
107
|
+
*/
|
|
108
|
+
cancelIcon?: CSSProperties;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* **EN:** Submit and cancel action button alignment
|
|
112
|
+
*
|
|
113
|
+
* **CN:** 提交、取消操作按钮的对齐方式
|
|
114
|
+
*
|
|
115
|
+
* - `start` - align to the top | 顶部对齐
|
|
116
|
+
* - `center` - align to the center | 居中对齐
|
|
117
|
+
* - `end` - align to the bottom | 底部对齐
|
|
118
|
+
*
|
|
119
|
+
* @default 'center'
|
|
120
|
+
*/
|
|
121
|
+
actionAlign?: SpaceProps['align'];
|
|
122
|
+
/**
|
|
123
|
+
* - **EN:** Submit button properties
|
|
124
|
+
* - **CN:** 提交操作按钮属性
|
|
125
|
+
*/
|
|
126
|
+
submitProps?: ButtonProps;
|
|
127
|
+
/**
|
|
128
|
+
* - **EN:** Cancel button properties
|
|
129
|
+
* - **CN:** 取消操作按钮属性
|
|
130
|
+
*/
|
|
131
|
+
cancelProps?: ButtonProps;
|
|
132
|
+
/**
|
|
133
|
+
* - **EN:** Confirm button click event, supports asynchronous operations
|
|
134
|
+
* - **CN:** 确认按钮点击事件,支持异步操作
|
|
135
|
+
*/
|
|
136
|
+
onOk: (value: V | undefined) => void | Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* - **EN:** Cancel button click event, supports asynchronous operations
|
|
139
|
+
* - **CN:** 取消按钮点击事件,支持异步操作
|
|
140
|
+
*/
|
|
141
|
+
onCancel?: () => void | Promise<void>;
|
|
142
|
+
}
|
|
143
|
+
declare const EditableTextForm: <V, IT extends "Input" | RenderInputInterface | "TextArea">(props: EditableFormProps<V, IT>) => import("react/jsx-runtime").JSX.Element;
|
|
144
|
+
export type RenderInputInterface = <V>(props: RenderInputProps<V>) => ReactElement | null;
|
|
145
|
+
export interface RenderInputProps<V> extends Omit<EditableFormProps<V, 'Input'>, 'inputComp' | 'inputProps' | 'onOk' | 'onCancel'> {
|
|
146
|
+
onChange?: (value: V | undefined) => void;
|
|
147
|
+
submit(): Promise<void>;
|
|
148
|
+
cancel(): Promise<void>;
|
|
149
|
+
}
|
|
150
|
+
export default EditableTextForm;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/EditableText/form.tsx
|
|
30
|
+
var form_exports = {};
|
|
31
|
+
__export(form_exports, {
|
|
32
|
+
default: () => form_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(form_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_icons = require("@ant-design/icons");
|
|
39
|
+
var import_useT = __toESM(require("../../hooks/useT"));
|
|
40
|
+
var defaultInputActionGap = 8;
|
|
41
|
+
var EditableTextForm = (props) => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const {
|
|
44
|
+
prefixCls,
|
|
45
|
+
value,
|
|
46
|
+
required = true,
|
|
47
|
+
classNames,
|
|
48
|
+
styles: styleNames,
|
|
49
|
+
inputComp = "Input",
|
|
50
|
+
block: blockInProps = false,
|
|
51
|
+
formProps,
|
|
52
|
+
formItemProps,
|
|
53
|
+
inputProps,
|
|
54
|
+
actionAlign = "center",
|
|
55
|
+
submitProps,
|
|
56
|
+
cancelProps,
|
|
57
|
+
onOk,
|
|
58
|
+
onCancel
|
|
59
|
+
} = props;
|
|
60
|
+
const t = (0, import_useT.default)();
|
|
61
|
+
const { getPrefixCls: getAntPrefixCls } = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
|
|
62
|
+
const [form] = import_antd.Form.useForm();
|
|
63
|
+
const wrapperRef = (0, import_react.useRef)(null);
|
|
64
|
+
const inputRef = (0, import_react.useRef)(null);
|
|
65
|
+
const supportAutoScale = inputComp === "Input" || inputComp === "TextArea";
|
|
66
|
+
const detectorRef = (0, import_react.useRef)(null);
|
|
67
|
+
const actionRef = (0, import_react.useRef)(null);
|
|
68
|
+
const [inputWidth, setInputWidth] = (0, import_react.useState)();
|
|
69
|
+
const [visibility, setVisibility] = (0, import_react.useState)("hidden");
|
|
70
|
+
const [forceBlock, setForceBlock] = (0, import_react.useState)(false);
|
|
71
|
+
const [saving, setSaving] = (0, import_react.useState)(false);
|
|
72
|
+
const inputActionGapRef = (0, import_react.useRef)(0);
|
|
73
|
+
inputActionGapRef.current = pxToNumber(((_a = formItemProps == null ? void 0 : formItemProps.style) == null ? void 0 : _a.marginRight) ?? ((_b = formItemProps == null ? void 0 : formItemProps.style) == null ? void 0 : _b.marginInlineEnd)) || defaultInputActionGap;
|
|
74
|
+
const block = blockInProps || forceBlock;
|
|
75
|
+
(0, import_react.useEffect)(() => {
|
|
76
|
+
form.setFieldsValue({ value });
|
|
77
|
+
}, [form, value]);
|
|
78
|
+
(0, import_react.useEffect)(() => {
|
|
79
|
+
var _a2, _b2;
|
|
80
|
+
let contentWidth = 0;
|
|
81
|
+
const inputElement = (_a2 = inputRef.current) == null ? void 0 : _a2.input;
|
|
82
|
+
if (detectorRef.current && inputElement && supportAutoScale) {
|
|
83
|
+
const inputStyle = getComputedStyle(inputElement);
|
|
84
|
+
contentWidth = detectorRef.current.offsetWidth + pxToNumber(inputStyle.paddingLeft) + pxToNumber(inputStyle.paddingRight) + pxToNumber(inputStyle.borderLeftWidth) + pxToNumber(inputStyle.borderRightWidth);
|
|
85
|
+
setInputWidth(contentWidth);
|
|
86
|
+
}
|
|
87
|
+
const actionWidth = ((_b2 = actionRef.current) == null ? void 0 : _b2.offsetWidth) || 0;
|
|
88
|
+
const gap = inputActionGapRef.current;
|
|
89
|
+
setVisibility("visible");
|
|
90
|
+
const observer = new ResizeObserver(([entity]) => {
|
|
91
|
+
const wrapperWidth = entity.contentRect.width;
|
|
92
|
+
if (contentWidth + actionWidth + gap - wrapperWidth > 1) {
|
|
93
|
+
setForceBlock(true);
|
|
94
|
+
} else {
|
|
95
|
+
setForceBlock(false);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
if (wrapperRef.current) {
|
|
99
|
+
observer.observe(wrapperRef.current);
|
|
100
|
+
}
|
|
101
|
+
return () => observer.disconnect();
|
|
102
|
+
}, [supportAutoScale]);
|
|
103
|
+
const handleCancel = async () => {
|
|
104
|
+
form.resetFields();
|
|
105
|
+
try {
|
|
106
|
+
await (onCancel == null ? void 0 : onCancel());
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error(error);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const handleEscape = async (e) => {
|
|
112
|
+
var _a2;
|
|
113
|
+
if ((inputComp === "Input" || inputComp === "TextArea") && e.key === "Escape") {
|
|
114
|
+
await handleCancel();
|
|
115
|
+
(_a2 = cancelProps == null ? void 0 : cancelProps.onClick) == null ? void 0 : _a2.call(cancelProps, e);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const handleSubmit = async (values) => {
|
|
119
|
+
const { value: value2 } = values;
|
|
120
|
+
try {
|
|
121
|
+
setSaving(true);
|
|
122
|
+
await (onOk == null ? void 0 : onOk(value2));
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error(error);
|
|
125
|
+
} finally {
|
|
126
|
+
setSaving(false);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const renderInput = () => {
|
|
130
|
+
if (inputComp === "Input" || inputComp === "TextArea") {
|
|
131
|
+
const COMP = inputComp === "Input" ? import_antd.Input : import_antd.Input.TextArea;
|
|
132
|
+
return /* @__PURE__ */ React.createElement(
|
|
133
|
+
COMP,
|
|
134
|
+
{
|
|
135
|
+
ref: inputRef,
|
|
136
|
+
placeholder: t("components.EditableText.placeholder"),
|
|
137
|
+
...inputProps,
|
|
138
|
+
style: {
|
|
139
|
+
width: block ? void 0 : inputWidth,
|
|
140
|
+
// Width is 100% in block mode, no need to set width
|
|
141
|
+
...inputProps && "style" in inputProps ? inputProps == null ? void 0 : inputProps.style : {}
|
|
142
|
+
},
|
|
143
|
+
onPressEnter: () => {
|
|
144
|
+
if (inputComp === "Input") {
|
|
145
|
+
form.submit();
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
onKeyUp: handleEscape
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
} else {
|
|
152
|
+
return /* @__PURE__ */ React.createElement(
|
|
153
|
+
CustomInput,
|
|
154
|
+
{
|
|
155
|
+
...props,
|
|
156
|
+
render: inputComp,
|
|
157
|
+
submit: async () => {
|
|
158
|
+
const values = await form.validateFields();
|
|
159
|
+
await handleSubmit(values);
|
|
160
|
+
},
|
|
161
|
+
cancel: handleCancel
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return /* @__PURE__ */ React.createElement("div", { ref: wrapperRef, className: (0, import_classnames.default)(`${prefixCls}-form`, classNames == null ? void 0 : classNames.wrapper), style: styleNames == null ? void 0 : styleNames.wrapper }, /* @__PURE__ */ React.createElement(
|
|
167
|
+
import_antd.Form,
|
|
168
|
+
{
|
|
169
|
+
component: "div",
|
|
170
|
+
layout: "inline",
|
|
171
|
+
form,
|
|
172
|
+
initialValues: { value },
|
|
173
|
+
autoComplete: "off",
|
|
174
|
+
onFinish: handleSubmit,
|
|
175
|
+
...formProps,
|
|
176
|
+
style: {
|
|
177
|
+
visibility,
|
|
178
|
+
...formProps == null ? void 0 : formProps.style
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
/* @__PURE__ */ React.createElement(
|
|
182
|
+
import_antd.Form.Item,
|
|
183
|
+
{
|
|
184
|
+
rules: [{ required, message: t("components.EditableText.requiredMsg") }],
|
|
185
|
+
...formItemProps,
|
|
186
|
+
className: (0, import_classnames.default)(formItemProps == null ? void 0 : formItemProps.className, { [`${getAntPrefixCls("form-item-block")}`]: block }),
|
|
187
|
+
style: {
|
|
188
|
+
marginInlineEnd: defaultInputActionGap,
|
|
189
|
+
...formItemProps == null ? void 0 : formItemProps.style
|
|
190
|
+
},
|
|
191
|
+
name: "value"
|
|
192
|
+
},
|
|
193
|
+
renderInput()
|
|
194
|
+
),
|
|
195
|
+
supportAutoScale && /* @__PURE__ */ React.createElement(
|
|
196
|
+
"span",
|
|
197
|
+
{
|
|
198
|
+
ref: detectorRef,
|
|
199
|
+
style: {
|
|
200
|
+
position: "absolute",
|
|
201
|
+
visibility: "hidden",
|
|
202
|
+
height: 0,
|
|
203
|
+
whiteSpace: "pre"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
value == null ? void 0 : value.toString()
|
|
207
|
+
),
|
|
208
|
+
/* @__PURE__ */ React.createElement(import_antd.Space, { ref: actionRef, className: `${prefixCls}-form-btns`, align: actionAlign, size: 4 }, /* @__PURE__ */ React.createElement(
|
|
209
|
+
import_antd.Button,
|
|
210
|
+
{
|
|
211
|
+
type: "text",
|
|
212
|
+
disabled: saving,
|
|
213
|
+
loading: saving,
|
|
214
|
+
title: t("components.EditableText.save"),
|
|
215
|
+
icon: /* @__PURE__ */ React.createElement(import_icons.CheckSquareFilled, { className: classNames == null ? void 0 : classNames.submitIcon, style: styleNames == null ? void 0 : styleNames.submitIcon }),
|
|
216
|
+
style: styleNames == null ? void 0 : styleNames.submitButton,
|
|
217
|
+
onClick: () => form.submit(),
|
|
218
|
+
...submitProps,
|
|
219
|
+
className: (0, import_classnames.default)(
|
|
220
|
+
`${prefixCls}-form-btn`,
|
|
221
|
+
`${prefixCls}-form-btn-save`,
|
|
222
|
+
classNames == null ? void 0 : classNames.submitButton,
|
|
223
|
+
submitProps == null ? void 0 : submitProps.className
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
), /* @__PURE__ */ React.createElement(
|
|
227
|
+
import_antd.Button,
|
|
228
|
+
{
|
|
229
|
+
type: "text",
|
|
230
|
+
style: styleNames == null ? void 0 : styleNames.cancelButton,
|
|
231
|
+
className: (0, import_classnames.default)(`${prefixCls}-form-btn`, `${prefixCls}-form-btn-close`, classNames == null ? void 0 : classNames.cancelButton),
|
|
232
|
+
title: t("components.EditableText.cancel"),
|
|
233
|
+
icon: /* @__PURE__ */ React.createElement(import_icons.CloseSquareFilled, { className: classNames == null ? void 0 : classNames.cancelIcon, style: styleNames == null ? void 0 : styleNames.cancelIcon }),
|
|
234
|
+
onClick: async (e) => {
|
|
235
|
+
var _a2;
|
|
236
|
+
await handleCancel();
|
|
237
|
+
(_a2 = cancelProps == null ? void 0 : cancelProps.onClick) == null ? void 0 : _a2.call(cancelProps, e);
|
|
238
|
+
},
|
|
239
|
+
...cancelProps
|
|
240
|
+
}
|
|
241
|
+
))
|
|
242
|
+
));
|
|
243
|
+
};
|
|
244
|
+
function CustomInput(props) {
|
|
245
|
+
const { render, value, onChange, ...restProps } = props;
|
|
246
|
+
const useInput = render;
|
|
247
|
+
return useInput({ ...restProps, value, onChange });
|
|
248
|
+
}
|
|
249
|
+
function pxToNumber(px) {
|
|
250
|
+
return px ? parseFloat(px.toString().replace("px", "")) : 0;
|
|
251
|
+
}
|
|
252
|
+
var form_default = EditableTextForm;
|
|
253
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/EditableText/form.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { CSSProperties, ReactElement } from 'react';\nimport { useContext, useEffect, useRef, useState } from 'react';\nimport type { ButtonProps, FormItemProps, FormProps, InputProps, SpaceProps } from 'antd';\nimport { Button, ConfigProvider, Form, Input, Space } from 'antd';\nimport type { InputRef, TextAreaProps } from 'antd/es/input';\nimport names from 'classnames';\nimport { CheckSquareFilled, CloseSquareFilled } from '@ant-design/icons';\nimport useT from '../../hooks/useT';\n\nconst defaultInputActionGap = 8;\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport interface EditableFormProps<V, IT extends 'Input' | 'TextArea' | RenderInputInterface> {\n prefixCls?: string;\n /**\n * - **EN:** The value to edit\n * - **CN:** 编辑的值\n */\n value: V | undefined;\n /**\n * - **EN:** Whether the text is required when editing, default is `true`, if `formItemProps.rules`\n * is set, it will override this value\n * - **CN:** 编辑文本时是否必填,默认值为`true`,如果设置了`formItemProps.rules`,将会覆盖此值\n *\n * @default true\n */\n required?: boolean;\n /**\n * - **EN:** Form properties\n * - **CN:** 表单属性\n */\n formProps?: FormProps;\n /**\n * - **EN:** Form item properties\n * - **CN:** 表单项属性\n */\n formItemProps?: FormItemProps;\n /**\n * - **EN:** Custom component type for rendering the input box\n * - **CN:** 自定义设置渲染输入框的组件类型\n *\n * @default 'Input'\n */\n inputComp?: IT;\n /**\n * - **EN:** Input component properties\n * - **CN:** 输入框组件属性\n */\n inputProps?: IT extends 'TextArea' ? TextAreaProps : IT extends 'Input' ? InputProps : never;\n /**\n * - **EN:** Whether to display as a block-level element, with width 100%\n * - **CN:** 是否显示为块级元素,宽度100%\n *\n * @default false\n */\n block?: boolean;\n /**\n * - **EN:** Semantic class names\n * - **CN:** 语义化类名\n */\n classNames?: {\n /**\n * - **EN:** Edit mode parent container class name\n * - **CN:** 编辑模式父容器类名\n */\n wrapper?: string;\n /**\n * - **EN:** Submit button class name\n * - **CN:** 提交按钮类名\n */\n submitButton?: string;\n /**\n * - **EN:** Cancel button class name\n * - **CN:** 取消按钮类名\n */\n cancelButton?: string;\n /**\n * - **EN:** Submit button icon class name\n * - **CN:** 提交按钮图标类名\n */\n submitIcon?: string;\n /**\n * - **EN:** Cancel button icon class name\n * - **CN:** 取消按钮图标类名\n */\n cancelIcon?: string;\n };\n /**\n * - **EN:** Semantic styles\n * - **CN:** 语义化样式\n */\n styles?: {\n /**\n * - **EN:** Edit mode parent container style\n * - **CN:** 编辑模式父容器样式\n */\n wrapper?: CSSProperties;\n /**\n * - **EN:** Submit button style\n * - **CN:** 提交按钮样式\n */\n submitButton?: CSSProperties;\n /**\n * - **EN:** Cancel button style\n * - **CN:** 取消按钮样式\n */\n cancelButton?: CSSProperties;\n /**\n * - **EN:** Submit button icon style\n * - **CN:** 提交按钮图标样式\n */\n submitIcon?: CSSProperties;\n /**\n * - **EN:** Cancel button icon style\n * - **CN:** 取消按钮图标样式\n */\n cancelIcon?: CSSProperties;\n };\n /**\n * **EN:** Submit and cancel action button alignment\n *\n * **CN:** 提交、取消操作按钮的对齐方式\n *\n * - `start` - align to the top | 顶部对齐\n * - `center` - align to the center | 居中对齐\n * - `end` - align to the bottom | 底部对齐\n *\n * @default 'center'\n */\n actionAlign?: SpaceProps['align'];\n /**\n * - **EN:** Submit button properties\n * - **CN:** 提交操作按钮属性\n */\n submitProps?: ButtonProps;\n /**\n * - **EN:** Cancel button properties\n * - **CN:** 取消操作按钮属性\n */\n cancelProps?: ButtonProps;\n /**\n * - **EN:** Confirm button click event, supports asynchronous operations\n * - **CN:** 确认按钮点击事件,支持异步操作\n */\n onOk: (value: V | undefined) => void | Promise<void>;\n /**\n * - **EN:** Cancel button click event, supports asynchronous operations\n * - **CN:** 取消按钮点击事件,支持异步操作\n */\n onCancel?: () => void | Promise<void>;\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nconst EditableTextForm = <V, IT extends 'Input' | 'TextArea' | RenderInputInterface>(\n props: EditableFormProps<V, IT>\n) => {\n const {\n prefixCls,\n value,\n required = true,\n classNames,\n styles: styleNames,\n inputComp = 'Input' as IT,\n block: blockInProps = false,\n formProps,\n formItemProps,\n inputProps,\n actionAlign = 'center',\n submitProps,\n cancelProps,\n onOk,\n onCancel,\n } = props;\n const t = useT();\n const { getPrefixCls: getAntPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const [form] = Form.useForm<{ value: V | undefined }>();\n const wrapperRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<InputRef>(null);\n const supportAutoScale = inputComp === 'Input' || inputComp === 'TextArea';\n const detectorRef = useRef<HTMLSpanElement>(null);\n const actionRef = useRef<HTMLDivElement>(null);\n const [inputWidth, setInputWidth] = useState<number>();\n const [visibility, setVisibility] = useState<CSSProperties['visibility']>('hidden');\n const [forceBlock, setForceBlock] = useState(false);\n const [saving, setSaving] = useState(false);\n const inputActionGapRef = useRef<number>(0);\n inputActionGapRef.current =\n pxToNumber(formItemProps?.style?.marginRight ?? formItemProps?.style?.marginInlineEnd) || defaultInputActionGap;\n const block = blockInProps || forceBlock;\n\n // Update form value when `value` prop changes\n useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n form.setFieldsValue({ value: value as any });\n }, [form, value]);\n\n // Detect the width of the text and dynamically scale the input width until it reaches the max width of the container.\n // Only built-in Input and TextArea components are supported.\n useEffect(() => {\n let contentWidth = 0;\n const inputElement = inputRef.current?.input;\n if (detectorRef.current && inputElement && supportAutoScale) {\n const inputStyle = getComputedStyle(inputElement);\n contentWidth =\n detectorRef.current.offsetWidth +\n pxToNumber(inputStyle.paddingLeft) +\n pxToNumber(inputStyle.paddingRight) +\n pxToNumber(inputStyle.borderLeftWidth) +\n pxToNumber(inputStyle.borderRightWidth);\n setInputWidth(contentWidth);\n }\n const actionWidth = actionRef.current?.offsetWidth || 0; // Width of action buttons\n const gap = inputActionGapRef.current; // Gap between input box and action buttons\n setVisibility('visible');\n // Listen to the width of the wrapper container, if the input box width is greater than the wrapper container width,\n const observer = new ResizeObserver(([entity]) => {\n const wrapperWidth = entity.contentRect.width;\n // Width deviation greater than 1px is considered overflow, to avoid misjudgment due to pixel density or scaling\n if (contentWidth + actionWidth + gap - wrapperWidth > 1) {\n setForceBlock(true);\n } else {\n setForceBlock(false);\n }\n });\n if (wrapperRef.current) {\n observer.observe(wrapperRef.current);\n }\n return () => observer.disconnect();\n }, [supportAutoScale]);\n\n // Cancel editing\n const handleCancel = async () => {\n form.resetFields();\n try {\n await onCancel?.();\n } catch (error) {\n console.error(error);\n }\n };\n // Pressing the Escape key to cancel editing\n const handleEscape: InputProps['onKeyUp'] = async (e) => {\n if ((inputComp === 'Input' || inputComp === 'TextArea') && e.key === 'Escape') {\n await handleCancel();\n cancelProps?.onClick?.(e as unknown as React.MouseEvent<HTMLElement>);\n }\n };\n // Submit editing\n const handleSubmit = async (values: { value: V | undefined }) => {\n const { value } = values;\n try {\n setSaving(true);\n await onOk?.(value);\n } catch (error) {\n console.error(error);\n } finally {\n setSaving(false);\n }\n };\n\n const renderInput = () => {\n if (inputComp === 'Input' || inputComp === 'TextArea') {\n const COMP = inputComp === 'Input' ? Input : Input.TextArea;\n return (\n <COMP\n ref={inputRef}\n placeholder={t('components.EditableText.placeholder')}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {...(inputProps as any)}\n style={{\n width: block ? undefined : inputWidth, // Width is 100% in block mode, no need to set width\n ...(inputProps && 'style' in inputProps ? inputProps?.style : {}),\n }}\n onPressEnter={() => {\n if (inputComp === 'Input') {\n form.submit();\n }\n }}\n onKeyUp={handleEscape}\n />\n );\n } else {\n return (\n <CustomInput<V>\n {...props}\n render={inputComp}\n submit={async () => {\n const values = await form.validateFields();\n await handleSubmit(values);\n }}\n cancel={handleCancel}\n />\n );\n }\n };\n\n return (\n <div ref={wrapperRef} className={names(`${prefixCls}-form`, classNames?.wrapper)} style={styleNames?.wrapper}>\n <Form\n component=\"div\" // Do not use form tag to avoid conflicts with external form, which may be nested in other forms\n layout=\"inline\"\n form={form}\n initialValues={{ value }}\n autoComplete=\"off\"\n onFinish={handleSubmit}\n {...formProps}\n style={{\n visibility,\n ...formProps?.style,\n }}\n >\n {/* Input box */}\n <Form.Item\n rules={[{ required, message: t('components.EditableText.requiredMsg') }]}\n {...formItemProps}\n className={names(formItemProps?.className, { [`${getAntPrefixCls('form-item-block')}`]: block })}\n style={{\n marginInlineEnd: defaultInputActionGap,\n ...formItemProps?.style,\n }}\n name=\"value\"\n >\n {renderInput()}\n </Form.Item>\n {/* Used to calculate the width of the text content */}\n {supportAutoScale && (\n <span\n ref={detectorRef}\n style={{\n position: 'absolute',\n visibility: 'hidden',\n height: 0,\n whiteSpace: 'pre',\n }}\n >\n {value?.toString()}\n </span>\n )}\n\n {/* Action buttons */}\n <Space ref={actionRef} className={`${prefixCls}-form-btns`} align={actionAlign} size={4}>\n <Button\n type=\"text\"\n disabled={saving}\n loading={saving}\n title={t('components.EditableText.save')}\n icon={<CheckSquareFilled className={classNames?.submitIcon} style={styleNames?.submitIcon} />}\n style={styleNames?.submitButton}\n onClick={() => form.submit()}\n {...submitProps}\n className={names(\n `${prefixCls}-form-btn`,\n `${prefixCls}-form-btn-save`,\n classNames?.submitButton,\n submitProps?.className\n )}\n />\n <Button\n type=\"text\"\n style={styleNames?.cancelButton}\n className={names(`${prefixCls}-form-btn`, `${prefixCls}-form-btn-close`, classNames?.cancelButton)}\n title={t('components.EditableText.cancel')}\n icon={<CloseSquareFilled className={classNames?.cancelIcon} style={styleNames?.cancelIcon} />}\n onClick={async (e) => {\n await handleCancel();\n cancelProps?.onClick?.(e);\n }}\n {...cancelProps}\n />\n </Space>\n </Form>\n </div>\n );\n};\n\nfunction CustomInput<V>(\n props: RenderInputProps<V> & {\n render: RenderInputInterface;\n }\n): ReactElement | null {\n const { render, value, onChange, ...restProps } = props;\n const useInput = render;\n return useInput({ ...restProps, value, onChange });\n}\n\nfunction pxToNumber(px: string | number | null | undefined) {\n return px ? parseFloat(px.toString().replace('px', '')) : 0;\n}\n\nexport type RenderInputInterface = <V>(props: RenderInputProps<V>) => ReactElement | null;\nexport interface RenderInputProps<V>\n extends Omit<EditableFormProps<V, 'Input'>, 'inputComp' | 'inputProps' | 'onOk' | 'onCancel'> {\n onChange?: (value: V | undefined) => void;\n submit(): Promise<void>;\n cancel(): Promise<void>;\n}\n\nexport default EditableTextForm;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAwD;AAExD,kBAA2D;AAE3D,wBAAkB;AAClB,mBAAqD;AACrD,kBAAiB;AAEjB,IAAM,wBAAwB;AA+I9B,IAAM,mBAAmB,CACvB,UACG;AA1JL;AA2JE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO,eAAe;AAAA,IACtB;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,QAAI,YAAAA,SAAK;AACf,QAAM,EAAE,cAAc,gBAAgB,QAAI,yBAAW,2BAAe,aAAa;AACjF,QAAM,CAAC,IAAI,IAAI,iBAAK,QAAkC;AACtD,QAAM,iBAAa,qBAAuB,IAAI;AAC9C,QAAM,eAAW,qBAAiB,IAAI;AACtC,QAAM,mBAAmB,cAAc,WAAW,cAAc;AAChE,QAAM,kBAAc,qBAAwB,IAAI;AAChD,QAAM,gBAAY,qBAAu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