@tiny-codes/react-easy 1.1.3 → 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 +15 -0
- package/es/components/ConfirmAction/index.d.ts +8 -0
- package/es/components/ConfirmAction/index.js +15 -0
- 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/EditableText/form.d.ts +12 -6
- package/es/components/EditableText/form.js +106 -56
- package/es/components/EditableText/form.js.map +1 -1
- package/es/components/EditableText/index.d.ts +31 -9
- package/es/components/EditableText/index.js +13 -7
- package/es/components/EditableText/index.js.map +1 -1
- package/es/components/Loading/index.d.ts +2 -2
- package/es/components/Loading/index.js +5 -5
- package/es/components/Loading/index.js.map +1 -1
- package/es/components/index.d.ts +2 -0
- package/es/components/index.js +1 -0
- package/es/components/index.js.map +1 -1
- package/lib/components/ConfirmAction/index.d.ts +8 -0
- 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/EditableText/form.d.ts +12 -6
- package/lib/components/EditableText/form.js +69 -39
- package/lib/components/EditableText/form.js.map +2 -2
- package/lib/components/EditableText/index.d.ts +31 -9
- package/lib/components/EditableText/index.js +12 -5
- package/lib/components/EditableText/index.js.map +2 -2
- package/lib/components/Loading/index.d.ts +2 -2
- package/lib/components/Loading/index.js +4 -4
- package/lib/components/Loading/index.js.map +2 -2
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +3 -0
- package/lib/components/index.js.map +2 -2
- package/package.json +3 -2
|
@@ -0,0 +1,190 @@
|
|
|
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/ContextMenu/index.tsx
|
|
30
|
+
var ContextMenu_exports = {};
|
|
31
|
+
__export(ContextMenu_exports, {
|
|
32
|
+
default: () => ContextMenu_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(ContextMenu_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_react_contexify = require("react-contexify");
|
|
39
|
+
var import_hooks = require("../../hooks");
|
|
40
|
+
var import_style = __toESM(require("./style"));
|
|
41
|
+
var import_ReactContexify = require("react-contexify/dist/ReactContexify.css");
|
|
42
|
+
var ContextMenu = (0, import_react.forwardRef)((props, ref) => {
|
|
43
|
+
const {
|
|
44
|
+
id,
|
|
45
|
+
items,
|
|
46
|
+
trigger = ["contextMenu"],
|
|
47
|
+
triggerProps,
|
|
48
|
+
prefixCls: prefixClsInProps,
|
|
49
|
+
className,
|
|
50
|
+
children,
|
|
51
|
+
...rest
|
|
52
|
+
} = props;
|
|
53
|
+
const { getPrefixCls } = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
|
|
54
|
+
const prefixCls = getPrefixCls("context-menu", prefixClsInProps);
|
|
55
|
+
const [wrapCSSVar, hashId, cssVarCls] = (0, import_style.default)(prefixCls);
|
|
56
|
+
const { show, hideAll } = (0, import_react_contexify.useContextMenu)({ id });
|
|
57
|
+
const eventNames = (0, import_react.useMemo)(
|
|
58
|
+
() => ({
|
|
59
|
+
click: ["onClick", void 0],
|
|
60
|
+
doubleClick: ["onDoubleClick", void 0],
|
|
61
|
+
hover: ["onPointerEnter", "onPointerLeave"],
|
|
62
|
+
contextMenu: ["onContextMenu", void 0]
|
|
63
|
+
}),
|
|
64
|
+
[]
|
|
65
|
+
);
|
|
66
|
+
const handleShow = (0, import_hooks.useRefFunction)(
|
|
67
|
+
(event, options) => {
|
|
68
|
+
show({
|
|
69
|
+
id,
|
|
70
|
+
event,
|
|
71
|
+
props,
|
|
72
|
+
position: options == null ? void 0 : options.position
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
const handleHideAll = (0, import_hooks.useRefFunction)(() => {
|
|
77
|
+
hideAll();
|
|
78
|
+
});
|
|
79
|
+
const eventHandlers = (0, import_react.useMemo)(() => {
|
|
80
|
+
const handlers = {};
|
|
81
|
+
if (trigger) {
|
|
82
|
+
trigger.forEach((eventType) => {
|
|
83
|
+
const [handlerName, leaveHandlerName] = eventNames[eventType];
|
|
84
|
+
handlers[handlerName] = (event) => {
|
|
85
|
+
handleShow(event);
|
|
86
|
+
};
|
|
87
|
+
if (leaveHandlerName) {
|
|
88
|
+
handlers[leaveHandlerName] = handleHideAll;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return handlers;
|
|
93
|
+
}, [eventNames, trigger]);
|
|
94
|
+
(0, import_react.useImperativeHandle)(
|
|
95
|
+
ref,
|
|
96
|
+
() => ({
|
|
97
|
+
show: handleShow,
|
|
98
|
+
hideAll: handleHideAll
|
|
99
|
+
}),
|
|
100
|
+
[]
|
|
101
|
+
);
|
|
102
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children && wrapCSSVar(
|
|
103
|
+
/* @__PURE__ */ React.createElement(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
...eventHandlers,
|
|
107
|
+
className: (0, import_classnames.default)(hashId, cssVarCls, prefixCls, `${prefixCls}-trigger`, triggerProps == null ? void 0 : triggerProps.className),
|
|
108
|
+
style: triggerProps == null ? void 0 : triggerProps.style
|
|
109
|
+
},
|
|
110
|
+
children
|
|
111
|
+
)
|
|
112
|
+
), wrapCSSVar(
|
|
113
|
+
/* @__PURE__ */ React.createElement(
|
|
114
|
+
import_react_contexify.Menu,
|
|
115
|
+
{
|
|
116
|
+
id,
|
|
117
|
+
className: (0, import_classnames.default)(
|
|
118
|
+
hashId,
|
|
119
|
+
cssVarCls,
|
|
120
|
+
prefixCls,
|
|
121
|
+
`${prefixCls}-menu`,
|
|
122
|
+
{
|
|
123
|
+
[`${prefixCls}-menu-has-items`]: !!(items == null ? void 0 : items.length)
|
|
124
|
+
},
|
|
125
|
+
className
|
|
126
|
+
),
|
|
127
|
+
...rest
|
|
128
|
+
},
|
|
129
|
+
renderItems(items, { theme: props.theme, cmpPrefixCls: prefixCls })
|
|
130
|
+
)
|
|
131
|
+
));
|
|
132
|
+
});
|
|
133
|
+
ContextMenu.displayName = "ContextMenu";
|
|
134
|
+
function renderItems(items, options) {
|
|
135
|
+
return items == null ? void 0 : items.map((item, index) => {
|
|
136
|
+
const isSeparator = "type" in item && item.type === "separator";
|
|
137
|
+
const isSubmenu = "type" in item && item.type === "submenu";
|
|
138
|
+
const menuItem = item;
|
|
139
|
+
if (isSeparator) {
|
|
140
|
+
return /* @__PURE__ */ React.createElement(import_react_contexify.Separator, { key: `[separator]:${index}` });
|
|
141
|
+
}
|
|
142
|
+
if (isSubmenu) {
|
|
143
|
+
const subMenu = item;
|
|
144
|
+
return /* @__PURE__ */ React.createElement(import_react_contexify.Submenu, { ...subMenu, key: subMenu.key }, renderItems(item.items, options));
|
|
145
|
+
}
|
|
146
|
+
return /* @__PURE__ */ React.createElement(
|
|
147
|
+
import_react_contexify.Item,
|
|
148
|
+
{
|
|
149
|
+
...menuItem,
|
|
150
|
+
keyMatcher: typeof menuItem.shortcutKey === "object" ? (e) => {
|
|
151
|
+
const shortcutKey = menuItem.shortcutKey;
|
|
152
|
+
if (shortcutKey.ctrlKey && !e.ctrlKey)
|
|
153
|
+
return false;
|
|
154
|
+
if (shortcutKey.altKey && !e.altKey)
|
|
155
|
+
return false;
|
|
156
|
+
if (shortcutKey.shiftKey && !e.shiftKey)
|
|
157
|
+
return false;
|
|
158
|
+
if (shortcutKey.metaKey && !e.metaKey)
|
|
159
|
+
return false;
|
|
160
|
+
if (!shortcutKey.key || shortcutKey.key !== e.key)
|
|
161
|
+
return false;
|
|
162
|
+
return true;
|
|
163
|
+
} : menuItem.shortcutKey,
|
|
164
|
+
key: menuItem.key
|
|
165
|
+
},
|
|
166
|
+
menuItem.children ? menuItem.children : /* @__PURE__ */ React.createElement(React.Fragment, null, menuItem.icon, /* @__PURE__ */ React.createElement("span", null, menuItem.label), typeof menuItem.shortcutKey === "object" && /* @__PURE__ */ React.createElement(import_react_contexify.RightSlot, null, getShortcutText(menuItem.shortcutKey, options)))
|
|
167
|
+
);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function getShortcutText(event, options) {
|
|
171
|
+
const { theme, cmpPrefixCls } = options;
|
|
172
|
+
const keys = [];
|
|
173
|
+
const Keyboard = (props) => {
|
|
174
|
+
return /* @__PURE__ */ React.createElement(import_antd.ConfigProvider, { theme: { algorithm: theme === "dark" ? import_antd.theme.darkAlgorithm : void 0 } }, /* @__PURE__ */ React.createElement(import_antd.Typography.Text, { keyboard: true, className: `${cmpPrefixCls}-shortcut-key` }, props.children));
|
|
175
|
+
};
|
|
176
|
+
if (event.ctrlKey)
|
|
177
|
+
keys.push(/* @__PURE__ */ React.createElement(Keyboard, null, "^"));
|
|
178
|
+
if (event.altKey)
|
|
179
|
+
keys.push(/* @__PURE__ */ React.createElement(Keyboard, null, "⌥"));
|
|
180
|
+
if (event.shiftKey)
|
|
181
|
+
keys.push(/* @__PURE__ */ React.createElement(Keyboard, null, "⇧"));
|
|
182
|
+
if (event.metaKey)
|
|
183
|
+
keys.push(/* @__PURE__ */ React.createElement(Keyboard, null, "⌘"));
|
|
184
|
+
if (event.key) {
|
|
185
|
+
keys.push(/* @__PURE__ */ React.createElement(Keyboard, null, event.key));
|
|
186
|
+
}
|
|
187
|
+
return keys;
|
|
188
|
+
}
|
|
189
|
+
var ContextMenu_default = ContextMenu;
|
|
190
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -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,kBAAc,yBAA6C,CAAC,OAAO,QAAQ;AAC/E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,UAAU,CAAC,aAAa;AAAA,IACxB;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,EAAE,aAAa,QAAI,yBAAW,2BAAe,aAAa;AAChE,QAAM,YAAY,aAAa,gBAAgB,gBAAgB;AAC/D,QAAM,CAAC,YAAY,QAAQ,SAAS,QAAI,aAAAA,SAAS,SAAS;AAC1D,QAAM,EAAE,MAAM,QAAQ,QAAI,uCAAe,EAAE,GAAG,CAAC;AAC/C,QAAM,iBAAa;AAAA,IACjB,OAAO;AAAA,MACL,OAAO,CAAC,WAAW,MAAS;AAAA,MAC5B,aAAa,CAAC,iBAAiB,MAAS;AAAA,MACxC,OAAO,CAAC,kBAAkB,gBAAgB;AAAA,MAC1C,aAAa,CAAC,iBAAiB,MAAS;AAAA,IAC1C;AAAA,IACA,CAAC;AAAA,EACH;AAGA,QAAM,iBAAa;AAAA,IACjB,CAAC,OAAsC,YAAsD;AAC3F,WAAK;AAAA,QACH;AAAA,QACA;AAAA,QACA;AAAA,QACA,U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,WAAW,GAAG,+BACrC,MAAM,QACT,CACF;AAAA,EAEJ;AACA,MAAI,MAAM;AAAS,SAAK,KAAK,oCAAC,gBAAS,GAAC,CAAW;AACnD,MAAI,MAAM;AAAQ,SAAK,KAAK,oCAAC,gBAAS,GAAC,CAAW;AAClD,MAAI,MAAM;AAAU,SAAK,KAAK,oCAAC,gBAAS,GAAC,CAAW;AACpD,MAAI,MAAM;AAAS,SAAK,KAAK,oCAAC,gBAAS,GAAC,CAAW;AACnD,MAAI,MAAM,KAAK;AACb,SAAK,KAAK,oCAAC,gBAAU,MAAM,GAAI,CAAW;AAAA,EAC5C;AACA,SAAO;AACT;AA4BA,IAAO,sBAAQ;",
|
|
6
|
+
"names": ["useStyle", "classNames", "AntdTheme"]
|
|
7
|
+
}
|
|
@@ -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,13 +1,13 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
1
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
2
2
|
import type { ButtonProps, FormItemProps, FormProps, InputProps, SpaceProps } from 'antd';
|
|
3
3
|
import type { TextAreaProps } from 'antd/es/input';
|
|
4
|
-
export interface EditableFormProps<IT extends 'Input' | 'TextArea'> {
|
|
4
|
+
export interface EditableFormProps<V, IT extends 'Input' | 'TextArea' | RenderInputInterface> {
|
|
5
5
|
prefixCls?: string;
|
|
6
6
|
/**
|
|
7
7
|
* - **EN:** The value to edit
|
|
8
8
|
* - **CN:** 编辑的值
|
|
9
9
|
*/
|
|
10
|
-
value:
|
|
10
|
+
value: V | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* - **EN:** Whether the text is required when editing, default is `true`, if `formItemProps.rules`
|
|
13
13
|
* is set, it will override this value
|
|
@@ -37,7 +37,7 @@ export interface EditableFormProps<IT extends 'Input' | 'TextArea'> {
|
|
|
37
37
|
* - **EN:** Input component properties
|
|
38
38
|
* - **CN:** 输入框组件属性
|
|
39
39
|
*/
|
|
40
|
-
inputProps?: IT extends 'TextArea' ? TextAreaProps : InputProps;
|
|
40
|
+
inputProps?: IT extends 'TextArea' ? TextAreaProps : IT extends 'Input' ? InputProps : never;
|
|
41
41
|
/**
|
|
42
42
|
* - **EN:** Whether to display as a block-level element, with width 100%
|
|
43
43
|
* - **CN:** 是否显示为块级元素,宽度100%
|
|
@@ -133,12 +133,18 @@ export interface EditableFormProps<IT extends 'Input' | 'TextArea'> {
|
|
|
133
133
|
* - **EN:** Confirm button click event, supports asynchronous operations
|
|
134
134
|
* - **CN:** 确认按钮点击事件,支持异步操作
|
|
135
135
|
*/
|
|
136
|
-
onOk: (value:
|
|
136
|
+
onOk: (value: V | undefined) => void | Promise<void>;
|
|
137
137
|
/**
|
|
138
138
|
* - **EN:** Cancel button click event, supports asynchronous operations
|
|
139
139
|
* - **CN:** 取消按钮点击事件,支持异步操作
|
|
140
140
|
*/
|
|
141
141
|
onCancel?: () => void | Promise<void>;
|
|
142
142
|
}
|
|
143
|
-
declare const EditableTextForm: <IT extends "Input" | "TextArea">(
|
|
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
|
+
}
|
|
144
150
|
export default EditableTextForm;
|
|
@@ -38,29 +38,31 @@ var import_classnames = __toESM(require("classnames"));
|
|
|
38
38
|
var import_icons = require("@ant-design/icons");
|
|
39
39
|
var import_useT = __toESM(require("../../hooks/useT"));
|
|
40
40
|
var defaultInputActionGap = 8;
|
|
41
|
-
var EditableTextForm = ({
|
|
42
|
-
prefixCls,
|
|
43
|
-
value,
|
|
44
|
-
required = true,
|
|
45
|
-
classNames,
|
|
46
|
-
styles: styleNames,
|
|
47
|
-
inputComp = "Input",
|
|
48
|
-
block: blockInProps = false,
|
|
49
|
-
formProps,
|
|
50
|
-
formItemProps,
|
|
51
|
-
inputProps,
|
|
52
|
-
actionAlign = "center",
|
|
53
|
-
submitProps,
|
|
54
|
-
cancelProps,
|
|
55
|
-
onOk,
|
|
56
|
-
onCancel
|
|
57
|
-
}) => {
|
|
41
|
+
var EditableTextForm = (props) => {
|
|
58
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;
|
|
59
60
|
const t = (0, import_useT.default)();
|
|
60
61
|
const { getPrefixCls: getAntPrefixCls } = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
|
|
61
62
|
const [form] = import_antd.Form.useForm();
|
|
62
63
|
const wrapperRef = (0, import_react.useRef)(null);
|
|
63
64
|
const inputRef = (0, import_react.useRef)(null);
|
|
65
|
+
const supportAutoScale = inputComp === "Input" || inputComp === "TextArea";
|
|
64
66
|
const detectorRef = (0, import_react.useRef)(null);
|
|
65
67
|
const actionRef = (0, import_react.useRef)(null);
|
|
66
68
|
const [inputWidth, setInputWidth] = (0, import_react.useState)();
|
|
@@ -70,15 +72,15 @@ var EditableTextForm = ({
|
|
|
70
72
|
const inputActionGapRef = (0, import_react.useRef)(0);
|
|
71
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;
|
|
72
74
|
const block = blockInProps || forceBlock;
|
|
73
|
-
const InputComp = inputComp === "TextArea" ? import_antd.Input.TextArea : import_antd.Input;
|
|
74
75
|
(0, import_react.useEffect)(() => {
|
|
75
76
|
form.setFieldsValue({ value });
|
|
76
77
|
}, [form, value]);
|
|
77
78
|
(0, import_react.useEffect)(() => {
|
|
78
79
|
var _a2, _b2;
|
|
79
80
|
let contentWidth = 0;
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
const inputElement = (_a2 = inputRef.current) == null ? void 0 : _a2.input;
|
|
82
|
+
if (detectorRef.current && inputElement && supportAutoScale) {
|
|
83
|
+
const inputStyle = getComputedStyle(inputElement);
|
|
82
84
|
contentWidth = detectorRef.current.offsetWidth + pxToNumber(inputStyle.paddingLeft) + pxToNumber(inputStyle.paddingRight) + pxToNumber(inputStyle.borderLeftWidth) + pxToNumber(inputStyle.borderRightWidth);
|
|
83
85
|
setInputWidth(contentWidth);
|
|
84
86
|
}
|
|
@@ -97,7 +99,7 @@ var EditableTextForm = ({
|
|
|
97
99
|
observer.observe(wrapperRef.current);
|
|
98
100
|
}
|
|
99
101
|
return () => observer.disconnect();
|
|
100
|
-
}, []);
|
|
102
|
+
}, [supportAutoScale]);
|
|
101
103
|
const handleCancel = async () => {
|
|
102
104
|
form.resetFields();
|
|
103
105
|
try {
|
|
@@ -108,7 +110,7 @@ var EditableTextForm = ({
|
|
|
108
110
|
};
|
|
109
111
|
const handleEscape = async (e) => {
|
|
110
112
|
var _a2;
|
|
111
|
-
if (e.key === "Escape") {
|
|
113
|
+
if ((inputComp === "Input" || inputComp === "TextArea") && e.key === "Escape") {
|
|
112
114
|
await handleCancel();
|
|
113
115
|
(_a2 = cancelProps == null ? void 0 : cancelProps.onClick) == null ? void 0 : _a2.call(cancelProps, e);
|
|
114
116
|
}
|
|
@@ -124,6 +126,43 @@ var EditableTextForm = ({
|
|
|
124
126
|
setSaving(false);
|
|
125
127
|
}
|
|
126
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
|
+
};
|
|
127
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(
|
|
128
167
|
import_antd.Form,
|
|
129
168
|
{
|
|
@@ -151,23 +190,9 @@ var EditableTextForm = ({
|
|
|
151
190
|
},
|
|
152
191
|
name: "value"
|
|
153
192
|
},
|
|
154
|
-
|
|
155
|
-
InputComp,
|
|
156
|
-
{
|
|
157
|
-
ref: inputRef,
|
|
158
|
-
placeholder: t("components.EditableText.placeholder"),
|
|
159
|
-
...inputProps,
|
|
160
|
-
style: {
|
|
161
|
-
width: block ? void 0 : inputWidth,
|
|
162
|
-
// Width is 100% in block mode, no need to set width
|
|
163
|
-
...inputProps == null ? void 0 : inputProps.style
|
|
164
|
-
},
|
|
165
|
-
onPressEnter: () => form.submit(),
|
|
166
|
-
onKeyUp: handleEscape
|
|
167
|
-
}
|
|
168
|
-
)
|
|
193
|
+
renderInput()
|
|
169
194
|
),
|
|
170
|
-
/* @__PURE__ */ React.createElement(
|
|
195
|
+
supportAutoScale && /* @__PURE__ */ React.createElement(
|
|
171
196
|
"span",
|
|
172
197
|
{
|
|
173
198
|
ref: detectorRef,
|
|
@@ -178,7 +203,7 @@ var EditableTextForm = ({
|
|
|
178
203
|
whiteSpace: "pre"
|
|
179
204
|
}
|
|
180
205
|
},
|
|
181
|
-
value
|
|
206
|
+
value == null ? void 0 : value.toString()
|
|
182
207
|
),
|
|
183
208
|
/* @__PURE__ */ React.createElement(import_antd.Space, { ref: actionRef, className: `${prefixCls}-form-btns`, align: actionAlign, size: 4 }, /* @__PURE__ */ React.createElement(
|
|
184
209
|
import_antd.Button,
|
|
@@ -216,6 +241,11 @@ var EditableTextForm = ({
|
|
|
216
241
|
))
|
|
217
242
|
));
|
|
218
243
|
};
|
|
244
|
+
function CustomInput(props) {
|
|
245
|
+
const { render, value, onChange, ...restProps } = props;
|
|
246
|
+
const useInput = render;
|
|
247
|
+
return useInput({ ...restProps, value, onChange });
|
|
248
|
+
}
|
|
219
249
|
function pxToNumber(px) {
|
|
220
250
|
return px ? parseFloat(px.toString().replace("px", "")) : 0;
|
|
221
251
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/EditableText/form.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { CSSProperties } from 'react';\nimport type React 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;\nexport interface EditableFormProps<IT extends 'Input' | 'TextArea'> {\n prefixCls?: string;\n /**\n * - **EN:** The value to edit\n * - **CN:** 编辑的值\n */\n value: string | 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 : InputProps;\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: string) => void | Promise<void>;\n /**\n * - **EN:** Cancel button click event, supports asynchronous operations\n * - **CN:** 取消按钮点击事件,支持异步操作\n */\n onCancel?: () => void | Promise<void>;\n}\n\nconst EditableTextForm = <IT extends 'Input' | 'TextArea'>({\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}: EditableFormProps<IT>) => {\n const t = useT();\n const { getPrefixCls: getAntPrefixCls } = useContext(ConfigProvider.ConfigContext);\n const [form] = Form.useForm<{ value?: string }>();\n const wrapperRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<InputRef>(null);\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 const InputComp = inputComp === 'TextArea' ? Input.TextArea : Input;\n\n // Update form value when `value` prop changes\n useEffect(() => {\n form.setFieldsValue({ value });\n }, [form, value]);\n\n // Detect the width of the text and dynamically adjust the input width\n useEffect(() => {\n let contentWidth = 0;\n if (detectorRef.current && inputRef.current?.input) {\n const inputStyle = getComputedStyle(inputRef.current.input);\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 }, []);\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 (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: string }) => {\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 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 <InputComp\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,\n }}\n onPressEnter={() => form.submit()}\n onKeyUp={handleEscape}\n />\n </Form.Item>\n {/* Used to calculate the width of the text content */}\n <span\n ref={detectorRef}\n style={{\n position: 'absolute',\n visibility: 'hidden',\n height: 0,\n whiteSpace: 'pre',\n }}\n >\n {value}\n </span>\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 pxToNumber(px: string | number | null | undefined) {\n return px ? parseFloat(px.toString().replace('px', '')) : 0;\n}\n\nexport default EditableTextForm;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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,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