@ioca/react 1.3.83 → 1.3.84
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/lib/cjs/components/input/input.js +3 -2
- package/lib/cjs/components/input/input.js.map +1 -1
- package/lib/cjs/components/modal/content.js +37 -0
- package/lib/cjs/components/modal/content.js.map +1 -0
- package/lib/cjs/components/modal/modal.js +3 -29
- package/lib/cjs/components/modal/modal.js.map +1 -1
- package/lib/cjs/components/popconfirm/popconfirm.js +2 -2
- package/lib/cjs/components/popconfirm/popconfirm.js.map +1 -1
- package/lib/css/index.css +1 -1
- package/lib/css/index.css.map +1 -1
- package/lib/es/components/input/input.js +3 -2
- package/lib/es/components/input/input.js.map +1 -1
- package/lib/es/components/modal/content.js +33 -0
- package/lib/es/components/modal/content.js.map +1 -0
- package/lib/es/components/modal/modal.js +5 -31
- package/lib/es/components/modal/modal.js.map +1 -1
- package/lib/es/components/popconfirm/popconfirm.js +2 -2
- package/lib/es/components/popconfirm/popconfirm.js.map +1 -1
- package/lib/index.js +35 -33
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import Button from '../button/button.js';
|
|
4
|
+
import Helpericon from '../utils/helpericon/helpericon.js';
|
|
5
|
+
|
|
6
|
+
function Content(props) {
|
|
7
|
+
const { title, footer, hideCloseButton, footerLeft, okButtonProps, cancelButtonProps, children, onOk, onClose, } = props;
|
|
8
|
+
const showHeader = title || !hideCloseButton;
|
|
9
|
+
const handleOk = async () => {
|
|
10
|
+
const ret = await onOk?.();
|
|
11
|
+
if (ret === false)
|
|
12
|
+
return;
|
|
13
|
+
onClose?.();
|
|
14
|
+
};
|
|
15
|
+
const renderFooter = useMemo(() => {
|
|
16
|
+
if (footer || footer === null)
|
|
17
|
+
return footer;
|
|
18
|
+
const propsOk = Object.assign({
|
|
19
|
+
children: "确定",
|
|
20
|
+
onClick: handleOk,
|
|
21
|
+
}, okButtonProps);
|
|
22
|
+
const propsCancel = Object.assign({
|
|
23
|
+
secondary: true,
|
|
24
|
+
children: "关闭",
|
|
25
|
+
onClick: onClose,
|
|
26
|
+
}, cancelButtonProps);
|
|
27
|
+
return (jsxs(Fragment, { children: [footerLeft, jsx(Button, { ...propsOk }), jsx(Button, { ...propsCancel })] }));
|
|
28
|
+
}, [footer, okButtonProps, cancelButtonProps]);
|
|
29
|
+
return (jsxs(Fragment, { children: [showHeader && (jsxs("header", { className: 'i-modal-header', children: [title && jsx("b", { children: title }), jsx(Helpericon, { active: !hideCloseButton, className: 'i-modal-close', onClick: onClose })] })), jsx("div", { className: 'i-modal-content', children: children }), jsx("footer", { className: 'i-modal-footer', children: renderFooter })] }));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Content as default };
|
|
33
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sources":["../../../../packages/components/modal/content.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport Button from \"../button\";\nimport Helpericon from \"../utils/helpericon\";\nimport \"./index.css\";\nimport { IModalContent } from \"./type\";\n\nexport default function Content(props: IModalContent) {\n\tconst {\n\t\ttitle,\n\t\tfooter,\n\t\thideCloseButton,\n\t\tfooterLeft,\n\t\tokButtonProps,\n\t\tcancelButtonProps,\n\t\tchildren,\n\t\tonOk,\n\t\tonClose,\n\t} = props;\n\tconst showHeader = title || !hideCloseButton;\n\n\tconst handleOk = async () => {\n\t\tconst ret = await onOk?.();\n\n\t\tif (ret === false) return;\n\n\t\tonClose?.();\n\t};\n\n\tconst renderFooter = useMemo(() => {\n\t\tif (footer || footer === null) return footer;\n\n\t\tconst propsOk = Object.assign(\n\t\t\t{\n\t\t\t\tchildren: \"确定\",\n\t\t\t\tonClick: handleOk,\n\t\t\t},\n\t\t\tokButtonProps\n\t\t);\n\t\tconst propsCancel = Object.assign(\n\t\t\t{\n\t\t\t\tsecondary: true,\n\t\t\t\tchildren: \"关闭\",\n\t\t\t\tonClick: onClose,\n\t\t\t},\n\t\t\tcancelButtonProps\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{footerLeft}\n\t\t\t\t<Button {...propsOk} />\n\t\t\t\t<Button {...propsCancel} />\n\t\t\t</>\n\t\t);\n\t}, [footer, okButtonProps, cancelButtonProps]);\n\n\treturn (\n\t\t<>\n\t\t\t{showHeader && (\n\t\t\t\t<header className='i-modal-header'>\n\t\t\t\t\t{title && <b>{title}</b>}\n\n\t\t\t\t\t<Helpericon\n\t\t\t\t\t\tactive={!hideCloseButton}\n\t\t\t\t\t\tclassName='i-modal-close'\n\t\t\t\t\t\tonClick={onClose}\n\t\t\t\t\t/>\n\t\t\t\t</header>\n\t\t\t)}\n\n\t\t\t<div className='i-modal-content'>{children}</div>\n\n\t\t\t<footer className='i-modal-footer'>{renderFooter}</footer>\n\t\t</>\n\t);\n}\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;AAMwB,SAAA,OAAO,CAAC,KAAoB,EAAA;IACnD,MAAM,EACL,KAAK,EACL,MAAM,EACN,eAAe,EACf,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,OAAO,GACP,GAAG,KAAK;AACT,IAAA,MAAM,UAAU,GAAG,KAAK,IAAI,CAAC,eAAe;AAE5C,IAAA,MAAM,QAAQ,GAAG,YAAW;AAC3B,QAAA,MAAM,GAAG,GAAG,MAAM,IAAI,IAAI;QAE1B,IAAI,GAAG,KAAK,KAAK;YAAE;QAEnB,OAAO,IAAI;AACZ,KAAC;AAED,IAAA,MAAM,YAAY,GAAG,OAAO,CAAC,MAAK;AACjC,QAAA,IAAI,MAAM,IAAI,MAAM,KAAK,IAAI;AAAE,YAAA,OAAO,MAAM;AAE5C,QAAA,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAC5B;AACC,YAAA,QAAQ,EAAE,IAAI;AACd,YAAA,OAAO,EAAE,QAAQ;SACjB,EACD,aAAa,CACb;AACD,QAAA,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAChC;AACC,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,QAAQ,EAAE,IAAI;AACd,YAAA,OAAO,EAAE,OAAO;SAChB,EACD,iBAAiB,CACjB;AAED,QAAA,QACCA,IACE,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CAAA,UAAU,EACXC,GAAA,CAAC,MAAM,EAAK,EAAA,GAAA,OAAO,EAAI,CAAA,EACvBA,IAAC,MAAM,EAAA,EAAA,GAAK,WAAW,EAAI,CAAA,CAAA,EAAA,CACzB;KAEJ,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,iBAAiB,CAAC,CAAC;IAE9C,QACCF,IACE,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CAAA,UAAU,KACVD,iBAAQ,SAAS,EAAC,gBAAgB,EAAA,QAAA,EAAA,CAChC,KAAK,IAAIE,qBAAI,KAAK,EAAA,CAAK,EAExBA,GAAA,CAAC,UAAU,EAAA,EACV,MAAM,EAAE,CAAC,eAAe,EACxB,SAAS,EAAC,eAAe,EACzB,OAAO,EAAE,OAAO,EACf,CAAA,CAAA,EAAA,CACM,CACT,EAEDA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,iBAAiB,EAAA,QAAA,EAAE,QAAQ,EAAO,CAAA,EAEjDA,GAAQ,CAAA,QAAA,EAAA,EAAA,SAAS,EAAC,gBAAgB,YAAE,YAAY,EAAA,CAAU,CACxD,EAAA,CAAA;AAEL;;;;"}
|
|
@@ -1,44 +1,18 @@
|
|
|
1
|
-
import { jsx, jsxs
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { useState, useRef, useEffect
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { useKeydown } from '../../js/hooks.js';
|
|
6
|
-
import
|
|
7
|
-
import Helpericon from '../utils/helpericon/helpericon.js';
|
|
6
|
+
import Content from './content.js';
|
|
8
7
|
import useModal from './useModal.js';
|
|
9
8
|
|
|
10
|
-
function DefaultContent(props) {
|
|
11
|
-
const { title, footer, hideCloseButton, footerLeft, okButtonProps, cancelButtonProps, children, onOk, onClose, } = props;
|
|
12
|
-
const showHeader = title || !hideCloseButton;
|
|
13
|
-
const handleOk = async () => {
|
|
14
|
-
const ret = await onOk?.();
|
|
15
|
-
if (ret === false)
|
|
16
|
-
return;
|
|
17
|
-
onClose?.();
|
|
18
|
-
};
|
|
19
|
-
const renderFooter = useMemo(() => {
|
|
20
|
-
if (footer || footer === null)
|
|
21
|
-
return footer;
|
|
22
|
-
const propsOk = Object.assign({
|
|
23
|
-
children: "确定",
|
|
24
|
-
onClick: handleOk,
|
|
25
|
-
}, okButtonProps);
|
|
26
|
-
const propsCancel = Object.assign({
|
|
27
|
-
secondary: true,
|
|
28
|
-
children: "关闭",
|
|
29
|
-
onClick: onClose,
|
|
30
|
-
}, cancelButtonProps);
|
|
31
|
-
return (jsxs(Fragment, { children: [footerLeft, jsx(Button, { ...propsOk }), jsx(Button, { ...propsCancel })] }));
|
|
32
|
-
}, [footer, okButtonProps, cancelButtonProps]);
|
|
33
|
-
return (jsxs(Fragment, { children: [showHeader && (jsxs("header", { className: 'i-modal-header', children: [title && jsx("b", { children: title }), jsx(Helpericon, { active: !hideCloseButton, className: 'i-modal-close', onClick: onClose })] })), jsx("div", { className: 'i-modal-content', children: children }), jsx("footer", { className: 'i-modal-footer', children: renderFooter })] }));
|
|
34
|
-
}
|
|
35
9
|
function Modal(props) {
|
|
36
10
|
const { visible, title, footer, okButtonProps, cancelButtonProps, closable = true, hideBackdrop, backdropClosable = true, hideCloseButton, disableEsc, width, height, customized, fixed, hideShadow, children, style, className, keepDOM, footerLeft, onClick, onVisibleChange, onClose, onOk, ...restProps } = props;
|
|
37
11
|
const [show, setShow] = useState(visible);
|
|
38
12
|
const [active, setActive] = useState(false);
|
|
39
13
|
const [bounced, setBounced] = useState(false);
|
|
40
14
|
const toggable = useRef(true);
|
|
41
|
-
const handleShow = () => {
|
|
15
|
+
const handleShow = async () => {
|
|
42
16
|
if (!toggable.current)
|
|
43
17
|
return;
|
|
44
18
|
(!keepDOM || !show) && setShow(true);
|
|
@@ -102,7 +76,7 @@ function Modal(props) {
|
|
|
102
76
|
e.stopPropagation();
|
|
103
77
|
handleClick();
|
|
104
78
|
onClick?.(e);
|
|
105
|
-
}, ...restProps, children: [customized && children, !customized && (jsx(
|
|
79
|
+
}, ...restProps, children: [customized && children, !customized && (jsx(Content, { title: title, hideCloseButton: hideCloseButton, footer: footer, okButtonProps: okButtonProps, cancelButtonProps: cancelButtonProps, children: children, footerLeft: footerLeft, onOk: onOk, onClose: handleHide }))] }) }), document?.body ?? null);
|
|
106
80
|
}
|
|
107
81
|
Modal.useModal = useModal;
|
|
108
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sources":["../../../../packages/components/modal/modal.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport { useEffect,
|
|
1
|
+
{"version":3,"file":"modal.js","sources":["../../../../packages/components/modal/modal.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useKeydown } from \"../../js/hooks\";\nimport Content from \"./content\";\nimport \"./index.css\";\nimport { CompositionModal, IModal } from \"./type\";\nimport useModal from \"./useModal\";\n\nfunction Modal(props: IModal) {\n\tconst {\n\t\tvisible,\n\t\ttitle,\n\t\tfooter,\n\t\tokButtonProps,\n\t\tcancelButtonProps,\n\t\tclosable = true,\n\t\thideBackdrop,\n\t\tbackdropClosable = true,\n\t\thideCloseButton,\n\t\tdisableEsc,\n\t\twidth,\n\t\theight,\n\t\tcustomized,\n\t\tfixed,\n\t\thideShadow,\n\t\tchildren,\n\t\tstyle,\n\t\tclassName,\n\t\tkeepDOM,\n\t\tfooterLeft,\n\t\tonClick,\n\t\tonVisibleChange,\n\t\tonClose,\n\t\tonOk,\n\t\t...restProps\n\t} = props;\n\tconst [show, setShow] = useState(visible);\n\tconst [active, setActive] = useState(false);\n\tconst [bounced, setBounced] = useState(false);\n\tconst toggable = useRef(true);\n\n\tconst handleShow = async () => {\n\t\tif (!toggable.current) return;\n\n\t\t(!keepDOM || !show) && setShow(true);\n\t\ttoggable.current = false;\n\n\t\tsetTimeout(() => {\n\t\t\tsetActive(true);\n\t\t\tonVisibleChange?.(true);\n\t\t\ttoggable.current = true;\n\t\t}, 24);\n\t};\n\n\tconst handleHide = () => {\n\t\tif (!toggable.current) return;\n\t\ttoggable.current = false;\n\n\t\tif (!closable) {\n\t\t\tsetBounced(true);\n\t\t\tsetTimeout(() => {\n\t\t\t\tsetBounced(false);\n\t\t\t\ttoggable.current = true;\n\t\t\t}, 400);\n\t\t\treturn;\n\t\t}\n\n\t\tsetActive(false);\n\t\tsetTimeout(() => {\n\t\t\t!keepDOM && setShow(false);\n\t\t\ttoggable.current = true;\n\t\t\tonVisibleChange?.(false);\n\t\t\tonClose?.();\n\t\t}, 240);\n\t};\n\n\tconst handleBackdropClick = function () {\n\t\tbackdropClosable && handleHide();\n\t};\n\n\tuseKeydown(\n\t\t(e) => {\n\t\t\tif (e.code !== \"Escape\" || !visible) return;\n\t\t\thandleHide();\n\t\t},\n\t\t{ disabled: disableEsc }\n\t);\n\n\tuseEffect(() => {\n\t\tvisible ? handleShow() : handleHide();\n\t}, [visible]);\n\n\tconst handleClick = () => {\n\t\tif (typeof document === \"undefined\") return;\n\t\tdocument.documentElement.click();\n\t};\n\n\tif (!show) return null;\n\n\treturn createPortal(\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\t\"i-modal-container\",\n\t\t\t\t{\n\t\t\t\t\t\"i-modal-backdrop\": !hideBackdrop,\n\t\t\t\t\t\"i-modal-customized\": customized,\n\t\t\t\t\t\"i-modal-active\": active,\n\t\t\t\t\tfixed,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={style}\n\t\t\tonClick={handleBackdropClick}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={classNames(\"i-modal\", {\n\t\t\t\t\tbounced,\n\t\t\t\t\tshadow: !hideShadow,\n\t\t\t\t})}\n\t\t\t\tstyle={{\n\t\t\t\t\twidth,\n\t\t\t\t\theight,\n\t\t\t\t}}\n\t\t\t\tonClick={(e) => {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\thandleClick();\n\t\t\t\t\tonClick?.(e);\n\t\t\t\t}}\n\t\t\t\t{...restProps}\n\t\t\t>\n\t\t\t\t{customized && children}\n\n\t\t\t\t{!customized && (\n\t\t\t\t\t<Content\n\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t\thideCloseButton={hideCloseButton}\n\t\t\t\t\t\tfooter={footer}\n\t\t\t\t\t\tokButtonProps={okButtonProps}\n\t\t\t\t\t\tcancelButtonProps={cancelButtonProps}\n\t\t\t\t\t\tchildren={children}\n\t\t\t\t\t\tfooterLeft={footerLeft}\n\t\t\t\t\t\tonOk={onOk}\n\t\t\t\t\t\tonClose={handleHide}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>,\n\t\tdocument?.body ?? null\n\t);\n}\n\nModal.useModal = useModal;\n\nexport default Modal as CompositionModal;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;AASA,SAAS,KAAK,CAAC,KAAa,EAAA;IAC3B,MAAM,EACL,OAAO,EACP,KAAK,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,QAAQ,GAAG,IAAI,EACf,YAAY,EACZ,gBAAgB,GAAG,IAAI,EACvB,eAAe,EACf,UAAU,EACV,KAAK,EACL,MAAM,EACN,UAAU,EACV,KAAK,EACL,UAAU,EACV,QAAQ,EACR,KAAK,EACL,SAAS,EACT,OAAO,EACP,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AA,EAAA,CAAA,UAAU,IAAI,QAAQ,EAEtB,CAAC,UAAU,KACXD,GAAA,CAAC,OAAO,EAAA,EACP,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,UAAU,EAAA,CAClB,CACF,CAAA,EAAA,CACI,EACD,CAAA,EACN,QAAQ,EAAE,IAAI,IAAI,IAAI,CACtB;AACF;AAEA,KAAK,CAAC,QAAQ,GAAG,QAAQ;;;;"}
|
|
@@ -14,7 +14,7 @@ const defaultCancel = {
|
|
|
14
14
|
secondary: true,
|
|
15
15
|
};
|
|
16
16
|
const Popconfirm = (props) => {
|
|
17
|
-
const { trigger = "click", visible, icon = jsx(Icon, { icon: jsx(InfoOutlined, {}), className: 'error' }), content, okButtonProps, cancelButtonProps, children, align = "end", position = "top", offset = 12, extra, onOk, onClose, ...restProps } = props;
|
|
17
|
+
const { trigger = "click", visible, icon = jsx(Icon, { icon: jsx(InfoOutlined, {}), className: 'error', size: '1.2em' }), content, okButtonProps, cancelButtonProps, children, align = "end", position = "top", offset = 12, extra, onOk, onClose, ...restProps } = props;
|
|
18
18
|
const state = useReactive({
|
|
19
19
|
loading: false,
|
|
20
20
|
visible,
|
|
@@ -45,7 +45,7 @@ const Popconfirm = (props) => {
|
|
|
45
45
|
await onClose?.();
|
|
46
46
|
state.visible = false;
|
|
47
47
|
};
|
|
48
|
-
const popconfirmContent = (jsxs("div", { className: 'i-popconfirm', children: [jsxs(Flex, { gap:
|
|
48
|
+
const popconfirmContent = (jsxs("div", { className: 'i-popconfirm', children: [jsxs(Flex, { gap: '.5em', children: [icon, jsx("div", { className: 'i-popconfirm-content', children: content })] }), jsxs(Flex, { gap: 12, justify: 'flex-end', className: 'mt-8 i-popconfirm-footer', children: [cancelButtonProps !== null && (jsx(Button, { ...cancel, onClick: handleCancel })), extra, okButtonProps !== null && (jsx(Button, { loading: state.loading, ...ok, onClick: handleOk }))] })] }));
|
|
49
49
|
return (jsx(Popup, { content: popconfirmContent, ...restProps, trigger: trigger, visible: state.visible, align: align, offset: offset, position: position, onVisibleChange: handleVisibleChange, children: children }));
|
|
50
50
|
};
|
|
51
51
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popconfirm.js","sources":["../../../../packages/components/popconfirm/popconfirm.tsx"],"sourcesContent":["import { InfoOutlined } from \"@ricons/material\";\nimport { useReactive } from \"ahooks\";\nimport { MouseEvent } from \"react\";\nimport Button from \"../button\";\nimport { IButton } from \"../button/type\";\nimport Flex from \"../flex\";\nimport Icon from \"../icon\";\nimport Popup from \"../popup\";\nimport \"./index.css\";\nimport { IPopconfirm } from \"./type\";\n\nconst defaultOk = {\n\tchildren: \"确定\",\n};\n\nconst defaultCancel = {\n\tchildren: \"取消\",\n\tsecondary: true,\n};\n\nconst Popconfirm = (props: IPopconfirm) => {\n\tconst {\n\t\ttrigger = \"click\",\n\t\tvisible,\n\t\ticon = <Icon icon={<InfoOutlined />} className='error' />,\n\t\tcontent,\n\t\tokButtonProps,\n\t\tcancelButtonProps,\n\t\tchildren,\n\t\talign = \"end\",\n\t\tposition = \"top\",\n\t\toffset = 12,\n\t\textra,\n\t\tonOk,\n\t\tonClose,\n\t\t...restProps\n\t} = props;\n\n\tconst state = useReactive({\n\t\tloading: false,\n\t\tvisible,\n\t});\n\n\tconst ok: IButton = okButtonProps\n\t\t? Object.assign({}, defaultOk, okButtonProps)\n\t\t: defaultOk;\n\tconst cancel: IButton = cancelButtonProps\n\t\t? Object.assign({}, defaultCancel, cancelButtonProps)\n\t\t: defaultCancel;\n\n\tconst handleVisibleChange = (v: boolean) => {\n\t\tstate.visible = v;\n\t\trestProps.onVisibleChange?.(v);\n\t};\n\n\tconst handleOk = async (e: MouseEvent<HTMLElement>) => {\n\t\tstate.loading = true;\n\t\tok.onClick?.(e);\n\n\t\tonOk?.()\n\t\t\t?.then(() => {\n\t\t\t\tstate.visible = false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tstate.loading = false;\n\t\t\t});\n\t};\n\n\tconst handleCancel = async (e: MouseEvent<HTMLElement>) => {\n\t\tcancel.onClick?.(e);\n\t\tawait onClose?.();\n\t\tstate.visible = false;\n\t};\n\n\tconst popconfirmContent = (\n\t\t<div className='i-popconfirm'>\n\t\t\t<Flex gap=
|
|
1
|
+
{"version":3,"file":"popconfirm.js","sources":["../../../../packages/components/popconfirm/popconfirm.tsx"],"sourcesContent":["import { InfoOutlined } from \"@ricons/material\";\nimport { useReactive } from \"ahooks\";\nimport { MouseEvent } from \"react\";\nimport Button from \"../button\";\nimport { IButton } from \"../button/type\";\nimport Flex from \"../flex\";\nimport Icon from \"../icon\";\nimport Popup from \"../popup\";\nimport \"./index.css\";\nimport { IPopconfirm } from \"./type\";\n\nconst defaultOk = {\n\tchildren: \"确定\",\n};\n\nconst defaultCancel = {\n\tchildren: \"取消\",\n\tsecondary: true,\n};\n\nconst Popconfirm = (props: IPopconfirm) => {\n\tconst {\n\t\ttrigger = \"click\",\n\t\tvisible,\n\t\ticon = <Icon icon={<InfoOutlined />} className='error' size='1.2em' />,\n\t\tcontent,\n\t\tokButtonProps,\n\t\tcancelButtonProps,\n\t\tchildren,\n\t\talign = \"end\",\n\t\tposition = \"top\",\n\t\toffset = 12,\n\t\textra,\n\t\tonOk,\n\t\tonClose,\n\t\t...restProps\n\t} = props;\n\n\tconst state = useReactive({\n\t\tloading: false,\n\t\tvisible,\n\t});\n\n\tconst ok: IButton = okButtonProps\n\t\t? Object.assign({}, defaultOk, okButtonProps)\n\t\t: defaultOk;\n\tconst cancel: IButton = cancelButtonProps\n\t\t? Object.assign({}, defaultCancel, cancelButtonProps)\n\t\t: defaultCancel;\n\n\tconst handleVisibleChange = (v: boolean) => {\n\t\tstate.visible = v;\n\t\trestProps.onVisibleChange?.(v);\n\t};\n\n\tconst handleOk = async (e: MouseEvent<HTMLElement>) => {\n\t\tstate.loading = true;\n\t\tok.onClick?.(e);\n\n\t\tonOk?.()\n\t\t\t?.then(() => {\n\t\t\t\tstate.visible = false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tstate.loading = false;\n\t\t\t});\n\t};\n\n\tconst handleCancel = async (e: MouseEvent<HTMLElement>) => {\n\t\tcancel.onClick?.(e);\n\t\tawait onClose?.();\n\t\tstate.visible = false;\n\t};\n\n\tconst popconfirmContent = (\n\t\t<div className='i-popconfirm'>\n\t\t\t<Flex gap='.5em'>\n\t\t\t\t{icon}\n\t\t\t\t<div className='i-popconfirm-content'>{content}</div>\n\t\t\t</Flex>\n\n\t\t\t<Flex\n\t\t\t\tgap={12}\n\t\t\t\tjustify='flex-end'\n\t\t\t\tclassName='mt-8 i-popconfirm-footer'\n\t\t\t>\n\t\t\t\t{cancelButtonProps !== null && (\n\t\t\t\t\t<Button {...cancel} onClick={handleCancel} />\n\t\t\t\t)}\n\t\t\t\t{extra}\n\t\t\t\t{okButtonProps !== null && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t{...ok}\n\t\t\t\t\t\tonClick={handleOk}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Flex>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<Popup\n\t\t\tcontent={popconfirmContent}\n\t\t\t{...restProps}\n\t\t\ttrigger={trigger}\n\t\t\tvisible={state.visible}\n\t\t\talign={align}\n\t\t\toffset={offset}\n\t\t\tposition={position}\n\t\t\tonVisibleChange={handleVisibleChange}\n\t\t>\n\t\t\t{children}\n\t\t</Popup>\n\t);\n};\n\nexport default Popconfirm;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;AAWA,MAAM,SAAS,GAAG;AACjB,IAAA,QAAQ,EAAE,IAAI;CACd;AAED,MAAM,aAAa,GAAG;AACrB,IAAA,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(props) => {
|
|
|
1122
1122
|
};
|
|
1123
1123
|
List$1.Item = Item$4;
|
|
1124
1124
|
|
|
1125
|
-
const Content$
|
|
1125
|
+
const Content$2 = (props) => {
|
|
1126
1126
|
const { ref, getContainer = (trigger) => {
|
|
1127
1127
|
if (typeof document === "undefined")
|
|
1128
1128
|
return null;
|
|
@@ -1366,7 +1366,7 @@ function Popup(props) {
|
|
|
1366
1366
|
...restProps,
|
|
1367
1367
|
...eventMaps[trigger],
|
|
1368
1368
|
});
|
|
1369
|
-
}), state.show && (jsx(Content$
|
|
1369
|
+
}), state.show && (jsx(Content$2, { ref: contentRef, arrow: arrow && trigger !== "contextmenu", style: { ...style, ...state.style }, arrowProps: state.arrowProps, className: className, ...contentTouch, trigger: triggerRef.current, getContainer: getContainer, children: content }))] }));
|
|
1370
1370
|
}
|
|
1371
1371
|
|
|
1372
1372
|
const { Item: ListItem } = List$1;
|
|
@@ -1816,6 +1816,32 @@ Form.useForm = useForm;
|
|
|
1816
1816
|
Form.Field = Field;
|
|
1817
1817
|
Form.useConfig = useConfig;
|
|
1818
1818
|
|
|
1819
|
+
function Content$1(props) {
|
|
1820
|
+
const { title, footer, hideCloseButton, footerLeft, okButtonProps, cancelButtonProps, children, onOk, onClose, } = props;
|
|
1821
|
+
const showHeader = title || !hideCloseButton;
|
|
1822
|
+
const handleOk = async () => {
|
|
1823
|
+
const ret = await onOk?.();
|
|
1824
|
+
if (ret === false)
|
|
1825
|
+
return;
|
|
1826
|
+
onClose?.();
|
|
1827
|
+
};
|
|
1828
|
+
const renderFooter = useMemo(() => {
|
|
1829
|
+
if (footer || footer === null)
|
|
1830
|
+
return footer;
|
|
1831
|
+
const propsOk = Object.assign({
|
|
1832
|
+
children: "确定",
|
|
1833
|
+
onClick: handleOk,
|
|
1834
|
+
}, okButtonProps);
|
|
1835
|
+
const propsCancel = Object.assign({
|
|
1836
|
+
secondary: true,
|
|
1837
|
+
children: "关闭",
|
|
1838
|
+
onClick: onClose,
|
|
1839
|
+
}, cancelButtonProps);
|
|
1840
|
+
return (jsxs(Fragment, { children: [footerLeft, jsx(Button, { ...propsOk }), jsx(Button, { ...propsCancel })] }));
|
|
1841
|
+
}, [footer, okButtonProps, cancelButtonProps]);
|
|
1842
|
+
return (jsxs(Fragment, { children: [showHeader && (jsxs("header", { className: 'i-modal-header', children: [title && jsx("b", { children: title }), jsx(Helpericon, { active: !hideCloseButton, className: 'i-modal-close', onClick: onClose })] })), jsx("div", { className: 'i-modal-content', children: children }), jsx("footer", { className: 'i-modal-footer', children: renderFooter })] }));
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1819
1845
|
function useModal() {
|
|
1820
1846
|
const ref = useRef(null);
|
|
1821
1847
|
const handleOpen = (props) => {
|
|
@@ -1843,38 +1869,13 @@ function useModal() {
|
|
|
1843
1869
|
};
|
|
1844
1870
|
}
|
|
1845
1871
|
|
|
1846
|
-
function DefaultContent(props) {
|
|
1847
|
-
const { title, footer, hideCloseButton, footerLeft, okButtonProps, cancelButtonProps, children, onOk, onClose, } = props;
|
|
1848
|
-
const showHeader = title || !hideCloseButton;
|
|
1849
|
-
const handleOk = async () => {
|
|
1850
|
-
const ret = await onOk?.();
|
|
1851
|
-
if (ret === false)
|
|
1852
|
-
return;
|
|
1853
|
-
onClose?.();
|
|
1854
|
-
};
|
|
1855
|
-
const renderFooter = useMemo(() => {
|
|
1856
|
-
if (footer || footer === null)
|
|
1857
|
-
return footer;
|
|
1858
|
-
const propsOk = Object.assign({
|
|
1859
|
-
children: "确定",
|
|
1860
|
-
onClick: handleOk,
|
|
1861
|
-
}, okButtonProps);
|
|
1862
|
-
const propsCancel = Object.assign({
|
|
1863
|
-
secondary: true,
|
|
1864
|
-
children: "关闭",
|
|
1865
|
-
onClick: onClose,
|
|
1866
|
-
}, cancelButtonProps);
|
|
1867
|
-
return (jsxs(Fragment, { children: [footerLeft, jsx(Button, { ...propsOk }), jsx(Button, { ...propsCancel })] }));
|
|
1868
|
-
}, [footer, okButtonProps, cancelButtonProps]);
|
|
1869
|
-
return (jsxs(Fragment, { children: [showHeader && (jsxs("header", { className: 'i-modal-header', children: [title && jsx("b", { children: title }), jsx(Helpericon, { active: !hideCloseButton, className: 'i-modal-close', onClick: onClose })] })), jsx("div", { className: 'i-modal-content', children: children }), jsx("footer", { className: 'i-modal-footer', children: renderFooter })] }));
|
|
1870
|
-
}
|
|
1871
1872
|
function Modal(props) {
|
|
1872
1873
|
const { visible, title, footer, okButtonProps, cancelButtonProps, closable = true, hideBackdrop, backdropClosable = true, hideCloseButton, disableEsc, width, height, customized, fixed, hideShadow, children, style, className, keepDOM, footerLeft, onClick, onVisibleChange, onClose, onOk, ...restProps } = props;
|
|
1873
1874
|
const [show, setShow] = useState(visible);
|
|
1874
1875
|
const [active, setActive] = useState(false);
|
|
1875
1876
|
const [bounced, setBounced] = useState(false);
|
|
1876
1877
|
const toggable = useRef(true);
|
|
1877
|
-
const handleShow = () => {
|
|
1878
|
+
const handleShow = async () => {
|
|
1878
1879
|
if (!toggable.current)
|
|
1879
1880
|
return;
|
|
1880
1881
|
(!keepDOM || !show) && setShow(true);
|
|
@@ -1938,7 +1939,7 @@ function Modal(props) {
|
|
|
1938
1939
|
e.stopPropagation();
|
|
1939
1940
|
handleClick();
|
|
1940
1941
|
onClick?.(e);
|
|
1941
|
-
}, ...restProps, children: [customized && children, !customized && (jsx(
|
|
1942
|
+
}, ...restProps, children: [customized && children, !customized && (jsx(Content$1, { title: title, hideCloseButton: hideCloseButton, footer: footer, okButtonProps: okButtonProps, cancelButtonProps: cancelButtonProps, children: children, footerLeft: footerLeft, onOk: onOk, onClose: handleHide }))] }) }), document?.body ?? null);
|
|
1942
1943
|
}
|
|
1943
1944
|
Modal.useModal = useModal;
|
|
1944
1945
|
|
|
@@ -2709,7 +2710,7 @@ const Textarea = (props) => {
|
|
|
2709
2710
|
};
|
|
2710
2711
|
|
|
2711
2712
|
const Input = ((props) => {
|
|
2712
|
-
const { ref, type = "text", label, name, value = props.initValue ?? "", initValue = "", prepend, append, labelInline, className, status = "normal", message, tip, clear, width, hideVisible, border, required, onChange, onEnter, style, ...restProps } = props;
|
|
2713
|
+
const { ref, type = "text", label, name, value = props.initValue ?? "", initValue = "", prepend, append, labelInline, className, status = "normal", message, tip, clear, width, hideVisible, border, required, maxLength, onChange, onEnter, style, ...restProps } = props;
|
|
2713
2714
|
const state = useReactive({
|
|
2714
2715
|
value,
|
|
2715
2716
|
type,
|
|
@@ -2748,6 +2749,7 @@ const Input = ((props) => {
|
|
|
2748
2749
|
type: state.type,
|
|
2749
2750
|
name,
|
|
2750
2751
|
value: state.value,
|
|
2752
|
+
maxLength,
|
|
2751
2753
|
className: classNames("i-input", `i-input-${type}`),
|
|
2752
2754
|
onChange: handleChange,
|
|
2753
2755
|
onKeyDown: handleKeydown,
|
|
@@ -2758,7 +2760,7 @@ const Input = ((props) => {
|
|
|
2758
2760
|
return (jsx(InputContainer, { label: label, labelInline: labelInline, className: className, style: { width, ...style }, tip: message ?? tip, status: status, required: required, children: jsxs("div", { className: classNames("i-input-item", {
|
|
2759
2761
|
[`i-input-${status}`]: status !== "normal",
|
|
2760
2762
|
"i-input-borderless": !border,
|
|
2761
|
-
}), children: [prepend && jsx("div", { className: 'i-input-prepend', children: prepend }), jsx("input", { ...inputProps }), jsx(Helpericon, { active: !!clearable || showHelper, icon: HelperIcon, onClick: handleHelperClick }), append && jsx("div", { className: 'i-input-append', children: append })] }) }));
|
|
2763
|
+
}), children: [prepend && jsx("div", { className: 'i-input-prepend', children: prepend }), jsx("input", { ...inputProps }), maxLength && state.value?.length > 0 && (jsxs("span", { className: 'color-8 pr-4 font-sm', children: [state.value.length, " / ", maxLength] })), jsx(Helpericon, { active: !!clearable || showHelper, icon: HelperIcon, onClick: handleHelperClick }), append && jsx("div", { className: 'i-input-append', children: append })] }) }));
|
|
2762
2764
|
});
|
|
2763
2765
|
Input.Textarea = Textarea;
|
|
2764
2766
|
Input.Number = Number;
|
|
@@ -3477,7 +3479,7 @@ const defaultCancel = {
|
|
|
3477
3479
|
secondary: true,
|
|
3478
3480
|
};
|
|
3479
3481
|
const Popconfirm = (props) => {
|
|
3480
|
-
const { trigger = "click", visible, icon = jsx(Icon, { icon: jsx(InfoOutlined, {}), className: 'error' }), content, okButtonProps, cancelButtonProps, children, align = "end", position = "top", offset = 12, extra, onOk, onClose, ...restProps } = props;
|
|
3482
|
+
const { trigger = "click", visible, icon = jsx(Icon, { icon: jsx(InfoOutlined, {}), className: 'error', size: '1.2em' }), content, okButtonProps, cancelButtonProps, children, align = "end", position = "top", offset = 12, extra, onOk, onClose, ...restProps } = props;
|
|
3481
3483
|
const state = useReactive({
|
|
3482
3484
|
loading: false,
|
|
3483
3485
|
visible,
|
|
@@ -3508,7 +3510,7 @@ const Popconfirm = (props) => {
|
|
|
3508
3510
|
await onClose?.();
|
|
3509
3511
|
state.visible = false;
|
|
3510
3512
|
};
|
|
3511
|
-
const popconfirmContent = (jsxs("div", { className: 'i-popconfirm', children: [jsxs(Flex, { gap:
|
|
3513
|
+
const popconfirmContent = (jsxs("div", { className: 'i-popconfirm', children: [jsxs(Flex, { gap: '.5em', children: [icon, jsx("div", { className: 'i-popconfirm-content', children: content })] }), jsxs(Flex, { gap: 12, justify: 'flex-end', className: 'mt-8 i-popconfirm-footer', children: [cancelButtonProps !== null && (jsx(Button, { ...cancel, onClick: handleCancel })), extra, okButtonProps !== null && (jsx(Button, { loading: state.loading, ...ok, onClick: handleOk }))] })] }));
|
|
3512
3514
|
return (jsx(Popup, { content: popconfirmContent, ...restProps, trigger: trigger, visible: state.visible, align: align, offset: offset, position: position, onVisibleChange: handleVisibleChange, children: children }));
|
|
3513
3515
|
};
|
|
3514
3516
|
|