@agentscope-ai/design 1.0.13 → 1.0.14

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.
Files changed (49) hide show
  1. package/lib/components/commonComponents/AlertDialog/index.d.ts +37 -325
  2. package/lib/components/commonComponents/AlertDialog/index.js +151 -3
  3. package/lib/components/commonComponents/AlertDialog/index.style.js +2 -14
  4. package/lib/components/commonComponents/Drawer/index.style.js +2 -42
  5. package/lib/components/commonComponents/Modal/index.d.ts +16 -2
  6. package/lib/components/commonComponents/Modal/index.js +71 -3
  7. package/lib/components/commonComponents/Modal/index.style.js +2 -62
  8. package/lib/components/commonComponents/PromptsEditor/VarRender.d.ts +1 -1
  9. package/lib/components/mobileComponents/MobileAlertDialog/demo/demo1.d.ts +3 -0
  10. package/lib/components/mobileComponents/MobileAlertDialog/demo/demo1.js +20 -0
  11. package/lib/components/mobileComponents/MobileAlertDialog/demo/demo2.d.ts +3 -0
  12. package/lib/components/mobileComponents/MobileAlertDialog/demo/demo2.js +50 -0
  13. package/lib/components/mobileComponents/MobileAlertDialog/index.d.ts +38 -0
  14. package/lib/components/mobileComponents/MobileAlertDialog/index.js +188 -0
  15. package/lib/components/mobileComponents/MobileAlertDialog/index.style.d.ts +1 -0
  16. package/lib/components/mobileComponents/MobileAlertDialog/index.style.js +22 -0
  17. package/lib/components/mobileComponents/MobileDrawer/Confirm.d.ts +46 -0
  18. package/lib/components/mobileComponents/MobileDrawer/Confirm.js +63 -0
  19. package/lib/components/mobileComponents/MobileDrawer/demo/demo1.d.ts +2 -0
  20. package/lib/components/mobileComponents/MobileDrawer/demo/demo1.js +49 -0
  21. package/lib/components/mobileComponents/MobileDrawer/demo/demo2.d.ts +7 -0
  22. package/lib/components/mobileComponents/MobileDrawer/demo/demo2.js +90 -0
  23. package/lib/components/mobileComponents/MobileDrawer/demo/demo3.d.ts +2 -0
  24. package/lib/components/mobileComponents/MobileDrawer/demo/demo3.js +64 -0
  25. package/lib/components/mobileComponents/MobileDrawer/demo/demo4.d.ts +2 -0
  26. package/lib/components/mobileComponents/MobileDrawer/demo/demo4.js +99 -0
  27. package/lib/components/mobileComponents/MobileDrawer/demo/demo5.d.ts +2 -0
  28. package/lib/components/mobileComponents/MobileDrawer/demo/demo5.js +73 -0
  29. package/lib/components/mobileComponents/MobileDrawer/index.d.ts +16 -0
  30. package/lib/components/{commonComponents/Modal/pc.js → mobileComponents/MobileDrawer/index.js} +25 -52
  31. package/lib/components/mobileComponents/MobileDrawer/index.style.d.ts +1 -0
  32. package/lib/components/mobileComponents/MobileDrawer/index.style.js +44 -0
  33. package/lib/components/mobileComponents/MobileModal/demo/basic.d.ts +1 -0
  34. package/lib/components/mobileComponents/MobileModal/demo/basic.js +49 -0
  35. package/lib/components/mobileComponents/MobileModal/demo/styles.d.ts +1 -0
  36. package/lib/components/mobileComponents/MobileModal/demo/styles.js +158 -0
  37. package/lib/components/mobileComponents/MobileModal/demo/width.d.ts +1 -0
  38. package/lib/components/mobileComponents/MobileModal/demo/width.js +68 -0
  39. package/lib/components/mobileComponents/MobileModal/index.d.ts +43 -0
  40. package/lib/components/{commonComponents/Modal/mobile.js → mobileComponents/MobileModal/index.js} +45 -11
  41. package/lib/components/mobileComponents/MobileModal/index.style.d.ts +1 -0
  42. package/lib/components/mobileComponents/MobileModal/index.style.js +70 -0
  43. package/lib/index.d.ts +7 -1
  44. package/lib/index.js +9 -1
  45. package/lib/libs/env/index.d.ts +1 -1
  46. package/lib/typings.d.ts +0 -2
  47. package/package.json +11 -3
  48. package/lib/components/commonComponents/Modal/mobile.d.ts +0 -28
  49. package/lib/components/commonComponents/Modal/pc.d.ts +0 -28
@@ -1,4 +1,72 @@
1
- import PCModal from "./pc";
2
- import MobileModal from "./mobile";
3
- var SparkModal = MOBILE ? MobileModal : PCModal;
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["showDivider", "closable"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ import { getCommonConfig } from "../../../config";
11
+ import { CloseOutlined } from '@agentscope-ai/icons-override-antd';
12
+ import { Modal } from 'antd';
13
+ import classNames from 'classnames';
14
+ import { useStyle } from "./index.style";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ import { jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { Fragment as _Fragment } from "react/jsx-runtime";
18
+ var SparkModal = function SparkModal(props) {
19
+ var Style = useStyle();
20
+ var _getCommonConfig = getCommonConfig(),
21
+ sparkPrefix = _getCommonConfig.sparkPrefix;
22
+ var _props$showDivider = props.showDivider,
23
+ showDivider = _props$showDivider === void 0 ? true : _props$showDivider,
24
+ _props$closable = props.closable,
25
+ closable = _props$closable === void 0 ? true : _props$closable,
26
+ restProps = _objectWithoutProperties(props, _excluded);
27
+ var renderFooter = function renderFooter(originNode) {
28
+ return props.info ? /*#__PURE__*/_jsxs("div", {
29
+ className: "".concat(sparkPrefix, "-modal-footer-wrapper"),
30
+ children: [/*#__PURE__*/_jsx("span", {
31
+ className: "".concat(sparkPrefix, "-modal-footer-info"),
32
+ children: props.info
33
+ }), /*#__PURE__*/_jsx("div", {
34
+ className: "".concat(sparkPrefix, "-modal-footer-origin-node"),
35
+ children: originNode
36
+ })]
37
+ }) : originNode;
38
+ };
39
+ var mergedCloseIcon = closable ? props.closeIcon || /*#__PURE__*/_jsx(CloseOutlined, {
40
+ className: "".concat(sparkPrefix, "-modal-title-close"),
41
+ onClick: function onClick(e) {
42
+ var _props$onCancel;
43
+ (_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 || _props$onCancel.call(props, e);
44
+ }
45
+ }) : null;
46
+ var mergedFooter = props.footer === undefined ? renderFooter : props.footer;
47
+ return /*#__PURE__*/_jsxs(_Fragment, {
48
+ children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({}, restProps), {}, {
49
+ closeIcon: null,
50
+ title: /*#__PURE__*/_jsxs("div", {
51
+ className: "".concat(sparkPrefix, "-modal-title-wrapper"),
52
+ children: [/*#__PURE__*/_jsx("div", {
53
+ className: "".concat(sparkPrefix, "-modal-title"),
54
+ children: props.title
55
+ }), mergedCloseIcon]
56
+ }),
57
+ wrapClassName: classNames("".concat(sparkPrefix, "-modal"), _defineProperty({}, "".concat(sparkPrefix, "-show-divider"), showDivider), props.wrapClassName, 'animate-in'),
58
+ footer: mergedFooter,
59
+ transitionName: ""
60
+ }))]
61
+ });
62
+ };
63
+ SparkModal.useModal = Modal.useModal;
64
+ SparkModal.success = Modal.success;
65
+ SparkModal.error = Modal.error;
66
+ SparkModal.warning = Modal.warning;
67
+ SparkModal.info = Modal.info;
68
+ SparkModal.confirm = Modal.confirm;
69
+ SparkModal.SMALL_WIDTH = 640;
70
+ SparkModal.MEDIUM_WIDTH = 800;
71
+ SparkModal.LARGE_WIDTH = 960;
4
72
  export default SparkModal;
@@ -1,67 +1,7 @@
1
- var _templateObject, _templateObject2;
1
+ var _templateObject;
2
2
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
3
  import createGlobalStyle from "../../../libs/createStyle";
4
- export var useStyle = MOBILE ? createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-modal {\n .", "-modal {\n min-width: 300px;\n max-width: 80vw;\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n padding: 0 !important;\n }\n .", "-modal-title {\n min-height: 24px;\n }\n \n .", "-modal-content {\n padding: 0;\n border: 1px solid var(--", "-color-border-secondary);\n \n .", "-modal-header {\n padding: 20px 20px 16px;\n margin-bottom: 0;\n \n .", "-modal-title {\n font-size: 18px;\n font-weight: 500;\n line-height: 32px;\n color: var(--", "-color-text);\n \n .", "-modal-title-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 16px;\n \n .", "-modal-title {\n flex: 1;\n display: flex;\n justify-content: center;\n text-align: center;\n }\n\n .", "-modal-title-padding {\n padding-left: 32px;\n }\n \n .", "-modal-title-close {\n font-size: 20px;\n cursor: pointer;\n }\n }\n }\n }\n \n .", "-modal-body {\n max-height: 60vh;\n padding: 0 20px;\n font-size: 14px;\n color: var(--", "-color-text);\n }\n \n .", "-modal-footer {\n padding: 16px 20px 20px;\n margin-top: 0;\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n .", "-btn {\n flex: 1;\n }\n \n .", "-modal-footer-wrapper {\n flex: 1;\n display: flex;\n justify-content: space-between;\n align-items: center;\n \n .", "-modal-footer-info {\n font-size: 14px;\n font-weight: normal;\n line-height: 24px;\n color: var(--", "-color-text-tertiary);\n }\n \n .", "-modal-footer-origin-node {\n display: flex;\n gap: 12px;\n }\n }\n }\n \n .", "-modal-close {\n width: 32px;\n height: 32px;\n top: 16px;\n right: 16px;\n \n .", "-modal-close-icon {\n color: var(--", "-color-text);\n }\n \n &:hover {\n background: none;\n }\n }\n }\n}\n\n.", "-show-divider {\n .", "-modal-content {\n .", "-modal-header {\n border-bottom: 1px solid var(--", "-color-border-secondary);\n }\n .", "-modal-body {\n padding: 16px 20px;\n }\n .", "-modal-footer {\n border-top: 1px solid var(--", "-color-border-secondary);\n }\n }\n}\n"])), function (p) {
5
- return p.sparkPrefix;
6
- }, function (p) {
7
- return p.antPrefix;
8
- }, function (p) {
9
- return p.antPrefix;
10
- }, function (p) {
11
- return p.antPrefix;
12
- }, function (p) {
13
- return p.antPrefix;
14
- }, function (p) {
15
- return p.antPrefix;
16
- }, function (p) {
17
- return p.antPrefix;
18
- }, function (p) {
19
- return p.antPrefix;
20
- }, function (p) {
21
- return p.sparkPrefix;
22
- }, function (p) {
23
- return p.sparkPrefix;
24
- }, function (p) {
25
- return p.sparkPrefix;
26
- }, function (p) {
27
- return p.sparkPrefix;
28
- }, function (p) {
29
- return p.antPrefix;
30
- }, function (p) {
31
- return p.antPrefix;
32
- }, function (p) {
33
- return p.antPrefix;
34
- }, function (p) {
35
- return p.antPrefix;
36
- }, function (p) {
37
- return p.sparkPrefix;
38
- }, function (p) {
39
- return p.sparkPrefix;
40
- }, function (p) {
41
- return p.antPrefix;
42
- }, function (p) {
43
- return p.sparkPrefix;
44
- }, function (p) {
45
- return p.antPrefix;
46
- }, function (p) {
47
- return p.antPrefix;
48
- }, function (p) {
49
- return p.antPrefix;
50
- }, function (p) {
51
- return p.sparkPrefix;
52
- }, function (p) {
53
- return p.antPrefix;
54
- }, function (p) {
55
- return p.antPrefix;
56
- }, function (p) {
57
- return p.antPrefix;
58
- }, function (p) {
59
- return p.antPrefix;
60
- }, function (p) {
61
- return p.antPrefix;
62
- }, function (p) {
63
- return p.antPrefix;
64
- }) : createGlobalStyle(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n.", "-modal {\n .", "-modal-title {\n min-height: 24px;\n }\n \n .", "-modal-content {\n padding: 0;\n border: 1px solid var(--", "-color-border-secondary);\n \n .", "-modal-header {\n padding: 18px 20px;\n margin-bottom: 0;\n \n .", "-modal-title {\n line-height: 28px;\n \n .", "-modal-title-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n \n .", "-modal-title {\n flex: 1;\n }\n \n .", "-modal-title-close {\n cursor: pointer;\n }\n }\n }\n }\n \n .", "-modal-body {\n padding: 20px;\n color: var(--", "-color-text-secondary);\n }\n \n .", "-modal-footer {\n padding: 16px 20px;\n margin-top: 0;\n \n .", "-modal-footer-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n \n .", "-modal-footer-info {\n font-size: 14px;\n font-weight: normal;\n line-height: 24px;\n color: var(--", "-color-text-tertiary);\n }\n \n .", "-modal-footer-origin-node {\n display: flex;\n gap: 12px;\n }\n }\n }\n \n .", "-modal-close {\n width: 32px;\n height: 32px;\n top: 16px;\n right: 16px;\n \n .", "-modal-close-icon {\n color: var(--", "-color-text);\n }\n \n &:hover {\n background: none;\n }\n }\n }\n}\n\n.", "-show-divider {\n .", "-modal-content {\n .", "-modal-header {\n border-bottom: 1px solid var(--", "-color-border-secondary);\n }\n \n .", "-modal-footer {\n border-top: 1px solid var(--", "-color-border-secondary);\n }\n }\n}\n"])), function (p) {
4
+ export var useStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-modal {\n .", "-modal-title {\n min-height: 24px;\n }\n \n .", "-modal-content {\n padding: 0;\n border: 1px solid var(--", "-color-border-secondary);\n \n .", "-modal-header {\n padding: 18px 20px;\n margin-bottom: 0;\n \n .", "-modal-title {\n line-height: 28px;\n \n .", "-modal-title-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n \n .", "-modal-title {\n flex: 1;\n }\n \n .", "-modal-title-close {\n cursor: pointer;\n }\n }\n }\n }\n \n .", "-modal-body {\n padding: 20px;\n color: var(--", "-color-text-secondary);\n }\n \n .", "-modal-footer {\n padding: 16px 20px;\n margin-top: 0;\n \n .", "-modal-footer-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n \n .", "-modal-footer-info {\n font-size: 14px;\n font-weight: normal;\n line-height: 24px;\n color: var(--", "-color-text-tertiary);\n }\n \n .", "-modal-footer-origin-node {\n display: flex;\n gap: 12px;\n }\n }\n }\n \n .", "-modal-close {\n width: 32px;\n height: 32px;\n top: 16px;\n right: 16px;\n \n .", "-modal-close-icon {\n color: var(--", "-color-text);\n }\n \n &:hover {\n background: none;\n }\n }\n }\n}\n\n.", "-show-divider {\n .", "-modal-content {\n .", "-modal-header {\n border-bottom: 1px solid var(--", "-color-border-secondary);\n }\n \n .", "-modal-footer {\n border-top: 1px solid var(--", "-color-border-secondary);\n }\n }\n}\n"])), function (p) {
65
5
  return p.sparkPrefix;
66
6
  }, function (p) {
67
7
  return p.antPrefix;
@@ -2,5 +2,5 @@ import { DecorationSet, ViewPlugin, ViewUpdate } from '@codemirror/view';
2
2
  declare const _default: ViewPlugin<{
3
3
  placeholders: DecorationSet;
4
4
  update(update: ViewUpdate): void;
5
- }>[];
5
+ }, undefined>[];
6
6
  export default _default;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const App: React.FC;
3
+ export default App;
@@ -0,0 +1,20 @@
1
+ import { Button } from "../../../..";
2
+ import React from 'react';
3
+ import MobileAlertDialog from '..';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { Fragment as _Fragment } from "react/jsx-runtime";
6
+ var App = function App() {
7
+ return /*#__PURE__*/_jsx(_Fragment, {
8
+ children: /*#__PURE__*/_jsx(Button, {
9
+ onClick: function onClick() {
10
+ return MobileAlertDialog.info({
11
+ title: 'Title here',
12
+ children: 'This information content passed into this AlertDialog.',
13
+ centered: true
14
+ });
15
+ },
16
+ children: "Open AlertDialog(Info)"
17
+ })
18
+ });
19
+ };
20
+ export default App;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const App: React.FC;
3
+ export default App;
@@ -0,0 +1,50 @@
1
+ import { Button } from "../../../..";
2
+ import { Flex } from 'antd';
3
+ import React from 'react';
4
+ import MobileAlertDialog from '..';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ var App = function App() {
8
+ return /*#__PURE__*/_jsxs(Flex, {
9
+ vertical: true,
10
+ gap: 24,
11
+ children: [/*#__PURE__*/_jsx(Button, {
12
+ onClick: function onClick() {
13
+ return MobileAlertDialog.success({
14
+ title: 'Title here',
15
+ children: 'This information content passed into this AlertDialog.',
16
+ centered: true
17
+ });
18
+ },
19
+ children: "Success"
20
+ }), /*#__PURE__*/_jsx(Button, {
21
+ onClick: function onClick() {
22
+ return MobileAlertDialog.warning({
23
+ title: 'Title here',
24
+ children: 'This information content passed into this AlertDialog.',
25
+ centered: true
26
+ });
27
+ },
28
+ children: "Warning"
29
+ }), /*#__PURE__*/_jsx(Button, {
30
+ onClick: function onClick() {
31
+ return MobileAlertDialog.error({
32
+ title: 'Title here',
33
+ children: 'This information content passed into this AlertDialog.',
34
+ centered: true
35
+ });
36
+ },
37
+ children: "Error"
38
+ }), /*#__PURE__*/_jsx(Button, {
39
+ onClick: function onClick() {
40
+ return MobileAlertDialog.confirm({
41
+ title: 'Title here',
42
+ children: 'This information content passed into this AlertDialog.',
43
+ centered: true
44
+ });
45
+ },
46
+ children: "Confirm"
47
+ })]
48
+ });
49
+ };
50
+ export default App;
@@ -0,0 +1,38 @@
1
+ import { ModalProps } from "../../../index";
2
+ import { SyntheticEvent } from 'react';
3
+ export interface MobileAlertDialogProps extends ModalProps {
4
+ /**
5
+ * @description 类型
6
+ * @descriptionEn type
7
+ * @default info
8
+ */
9
+ type?: 'success' | 'info' | 'warning' | 'error' | 'confirm';
10
+ /**
11
+ * @description 确认按钮是否带有danger属性
12
+ * @descriptionEn whether the confirm button has a danger property
13
+ * @default false
14
+ */
15
+ danger?: boolean;
16
+ /**
17
+ * @description 内容
18
+ * @descriptionEn content
19
+ * @default -
20
+ */
21
+ content?: React.ReactNode;
22
+ /**
23
+ * @description 关闭时触发的回调函数
24
+ * @descriptionEn callback function triggered when closed
25
+ * @default -
26
+ */
27
+ onClose?: (e: SyntheticEvent<Element, Event>) => any;
28
+ }
29
+ type MobileAlertDialogStaticProps = Omit<MobileAlertDialogProps, 'type' | 'open'>;
30
+ declare const _default: {
31
+ (props: MobileAlertDialogProps): JSX.Element;
32
+ success: (props?: MobileAlertDialogStaticProps) => void;
33
+ info: (props?: MobileAlertDialogStaticProps) => void;
34
+ warning: (props?: MobileAlertDialogStaticProps) => void;
35
+ error: (props?: MobileAlertDialogStaticProps) => void;
36
+ confirm: (props?: MobileAlertDialogStaticProps) => void;
37
+ };
38
+ export default _default;
@@ -0,0 +1,188 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["children", "type", "danger", "title", "width", "className"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ import $i18n from "../../../i18n";
11
+ import { CheckCircleOutlined, CloseCircleOutlined, ExclamationCircleOutlined, InfoCircleOutlined } from "@agentscope-ai/icons-override-antd";
12
+ import { Flex, Modal } from 'antd';
13
+ import classNames from 'classnames';
14
+ import { useEffect } from 'react';
15
+ import { getCommonConfig } from "../../../config";
16
+ import { useStyle } from "./index.style";
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { Fragment as _Fragment } from "react/jsx-runtime";
20
+ var lockBodyScroll = function lockBodyScroll() {
21
+ var originalStyle = window.getComputedStyle(document.body).overflow;
22
+ var originalPosition = window.getComputedStyle(document.body).position;
23
+ var scrollY = window.scrollY;
24
+ document.body.style.overflow = 'hidden';
25
+ document.body.style.position = 'fixed';
26
+ document.body.style.width = '100%';
27
+ document.body.style.top = "-".concat(scrollY, "px");
28
+
29
+ // 返回解锁函数
30
+ return function () {
31
+ document.body.style.overflow = originalStyle;
32
+ document.body.style.position = originalPosition;
33
+ document.body.style.width = '';
34
+ document.body.style.top = '';
35
+ window.scrollTo(0, scrollY);
36
+ };
37
+ };
38
+ var getCommonProps = function getCommonProps(props) {
39
+ var renderTitle = function renderTitle(_ref) {
40
+ var type = _ref.type,
41
+ title = _ref.title;
42
+ var _getCommonConfig = getCommonConfig(),
43
+ antPrefix = _getCommonConfig.antPrefix;
44
+ switch (type) {
45
+ case 'success':
46
+ return /*#__PURE__*/_jsxs(Flex, {
47
+ align: "center",
48
+ gap: 8,
49
+ className: "leading-[28px]",
50
+ children: [/*#__PURE__*/_jsx(CheckCircleOutlined, {
51
+ style: {
52
+ color: "var(--".concat(antPrefix, "-color-success)"),
53
+ fontSize: 18,
54
+ margin: '0 3px'
55
+ }
56
+ }), title]
57
+ });
58
+ case 'warning':
59
+ case 'confirm':
60
+ return /*#__PURE__*/_jsxs(Flex, {
61
+ align: "center",
62
+ gap: 8,
63
+ className: "leading-[28px]",
64
+ children: [/*#__PURE__*/_jsx(ExclamationCircleOutlined, {
65
+ style: {
66
+ color: "var(--".concat(antPrefix, "-color-warning)"),
67
+ fontSize: 18,
68
+ margin: '0 3px'
69
+ }
70
+ }), title]
71
+ });
72
+ case 'info':
73
+ return /*#__PURE__*/_jsxs(Flex, {
74
+ align: "center",
75
+ gap: 8,
76
+ className: "leading-[28px]",
77
+ children: [/*#__PURE__*/_jsx(InfoCircleOutlined, {
78
+ style: {
79
+ color: "var(--".concat(antPrefix, "-color-info)"),
80
+ fontSize: 18,
81
+ margin: '0 3px'
82
+ }
83
+ }), title]
84
+ });
85
+ case 'error':
86
+ return /*#__PURE__*/_jsxs(Flex, {
87
+ align: "center",
88
+ gap: 8,
89
+ className: "leading-[28px]",
90
+ children: [/*#__PURE__*/_jsx(CloseCircleOutlined, {
91
+ style: {
92
+ color: "var(--".concat(antPrefix, "-color-error)"),
93
+ fontSize: 18,
94
+ margin: '0 3px'
95
+ }
96
+ }), title]
97
+ });
98
+ default:
99
+ return $i18n.get({
100
+ id: 'components.commonComponents.AlertDialog.Prompt',
101
+ dm: '提示'
102
+ });
103
+ }
104
+ };
105
+ var children = props.children,
106
+ _props$type = props.type,
107
+ type = _props$type === void 0 ? 'info' : _props$type,
108
+ _props$danger = props.danger,
109
+ danger = _props$danger === void 0 ? false : _props$danger,
110
+ title = props.title,
111
+ _props$width = props.width,
112
+ width = _props$width === void 0 ? 'auto' : _props$width,
113
+ _props$className = props.className,
114
+ className = _props$className === void 0 ? '' : _props$className,
115
+ restProps = _objectWithoutProperties(props, _excluded);
116
+ return {
117
+ width: width,
118
+ transitionName: '',
119
+ restProps: restProps,
120
+ closeIcon: null,
121
+ title: renderTitle({
122
+ type: type,
123
+ title: title
124
+ }),
125
+ okButtonProps: {
126
+ danger: type === 'error' || type === 'warning' || danger
127
+ },
128
+ destroyOnClose: true,
129
+ className: classNames(className, 'animate-in', "".concat(getCommonConfig().sparkPrefix, "-alert-dialog")),
130
+ content: props.content || children,
131
+ children: children
132
+ };
133
+ };
134
+ var MobileAlertDialog = function MobileAlertDialog(props) {
135
+ var commonProps = getCommonProps(props);
136
+ var Style = useStyle();
137
+
138
+ // 移动端:禁止 body 滚动
139
+ useEffect(function () {
140
+ if (props.open) {
141
+ var unlock = lockBodyScroll();
142
+ return unlock;
143
+ }
144
+ }, [props.open]);
145
+ return /*#__PURE__*/_jsxs(_Fragment, {
146
+ children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
147
+ width: commonProps.width,
148
+ transitionName: ""
149
+ }, commonProps.restProps), {}, {
150
+ closeIcon: null,
151
+ title: commonProps.title,
152
+ okButtonProps: commonProps.okButtonProps || {},
153
+ destroyOnClose: commonProps.destroyOnClose,
154
+ className: commonProps.className,
155
+ children: commonProps.content || commonProps.children
156
+ }))]
157
+ });
158
+ };
159
+ var staticFns = ['success', 'info', 'warning', 'error', 'confirm'];
160
+ staticFns.forEach(function (type) {
161
+ MobileAlertDialog[type] = function (props) {
162
+ var commonProps = getCommonProps(_objectSpread(_objectSpread({}, props), {}, {
163
+ type: type
164
+ }));
165
+ var unlock = lockBodyScroll();
166
+ function Content() {
167
+ var Style = useStyle();
168
+ return /*#__PURE__*/_jsxs(_Fragment, {
169
+ children: [/*#__PURE__*/_jsx(Style, {}), commonProps.content]
170
+ });
171
+ }
172
+
173
+ // @ts-ignore
174
+ return Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, commonProps), commonProps.restProps), {}, {
175
+ content: /*#__PURE__*/_jsx(Content, {}),
176
+ icon: null,
177
+ afterClose: function afterClose() {
178
+ var _commonProps$restProp;
179
+ unlock();
180
+ if ((_commonProps$restProp = commonProps.restProps) !== null && _commonProps$restProp !== void 0 && _commonProps$restProp.afterClose) {
181
+ var _commonProps$restProp2;
182
+ (_commonProps$restProp2 = commonProps.restProps).afterClose.apply(_commonProps$restProp2, arguments);
183
+ }
184
+ }
185
+ }));
186
+ };
187
+ });
188
+ export default MobileAlertDialog;
@@ -0,0 +1 @@
1
+ export declare const useStyle: () => () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ var _templateObject;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ import createGlobalStyle from "../../../libs/createStyle";
4
+ export var useStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.", "-alert-dialog {\n min-width: 300px;\n max-width: 80vw !important;\n\n .", "-modal-body {\n padding: 0 0 12px 32px;\n font-size: 14px;\n color: var(--", "-color-text-secondary);\n }\n \n .", "-modal-content {\n padding: 20px;\n }\n\n .", "-modal-confirm-content {\n padding: 0 0 12px 32px;\n font-size: 14px;\n color: var(--", "-color-text-secondary);\n }\n\n .", "-modal-confirm-paragraph {\n max-width: 100%;\n }\n .", "-modal-confirm-btns {\n display: flex;\n justify-content: space-between;\n gap: 8px;\n .", "-btn {\n flex: 1;\n }\n }\n}\n"])), function (p) {
5
+ return p.sparkPrefix;
6
+ }, function (p) {
7
+ return p.antPrefix;
8
+ }, function (p) {
9
+ return p.antPrefix;
10
+ }, function (p) {
11
+ return p.antPrefix;
12
+ }, function (p) {
13
+ return p.antPrefix;
14
+ }, function (p) {
15
+ return p.antPrefix;
16
+ }, function (p) {
17
+ return p.antPrefix;
18
+ }, function (p) {
19
+ return p.antPrefix;
20
+ }, function (p) {
21
+ return p.antPrefix;
22
+ });
@@ -0,0 +1,46 @@
1
+ import { ButtonProps, DrawerProps } from "../../..";
2
+ import React from 'react';
3
+ export interface DrawerConfirmProps extends DrawerProps {
4
+ /**
5
+ * @description 自定义底部内容
6
+ * @descriptionEn custom footer content
7
+ */
8
+ footer?: React.ReactNode;
9
+ /**
10
+ * @description 点击确定回调
11
+ * @descriptionEn click ok button callback
12
+ */
13
+ onOk?: () => void;
14
+ /**
15
+ * @description 确认按钮文字
16
+ * @descriptionEn ok button text
17
+ */
18
+ okText?: string;
19
+ /**
20
+ * @description 确认按钮属性
21
+ * @descriptionEn ok button props
22
+ */
23
+ okButtonProps?: ButtonProps;
24
+ /**
25
+ * @description 点击取消回调
26
+ * @descriptionEn click cancel button callback
27
+ */
28
+ onCancel?: () => void;
29
+ /**
30
+ * @description 取消按钮文字
31
+ * @descriptionEn cancel button text
32
+ */
33
+ cancelText?: string;
34
+ /**
35
+ * @description 取消按钮属性
36
+ * @descriptionEn cancel button props
37
+ */
38
+ cancelButtonProps?: ButtonProps;
39
+ /**
40
+ * @description 底部额外内容
41
+ * @descriptionEn footer extra content
42
+ */
43
+ info?: React.ReactNode;
44
+ }
45
+ declare const DrawerConfirm: React.FC<DrawerConfirmProps>;
46
+ export default DrawerConfirm;
@@ -0,0 +1,63 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["onOk", "onCancel", "okText", "okButtonProps", "cancelText", "cancelButtonProps", "info", "footer"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
+ import { getCommonConfig } from "../../../config";
11
+ import { Button, Drawer } from "../../..";
12
+ import React from 'react';
13
+ import { useStyle } from "./index.style";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ import { jsxs as _jsxs } from "react/jsx-runtime";
16
+ import { Fragment as _Fragment } from "react/jsx-runtime";
17
+ var DrawerConfirm = function DrawerConfirm(props) {
18
+ var onOk = props.onOk,
19
+ onCancel = props.onCancel,
20
+ _props$okText = props.okText,
21
+ okText = _props$okText === void 0 ? '确定' : _props$okText,
22
+ okButtonProps = props.okButtonProps,
23
+ _props$cancelText = props.cancelText,
24
+ cancelText = _props$cancelText === void 0 ? '取消' : _props$cancelText,
25
+ cancelButtonProps = props.cancelButtonProps,
26
+ info = props.info,
27
+ footer = props.footer,
28
+ rest = _objectWithoutProperties(props, _excluded);
29
+ var Style = useStyle();
30
+ var commonConfig = getCommonConfig();
31
+ var antPrefix = commonConfig.antPrefix;
32
+ var handleCancel = function handleCancel(e) {
33
+ if (onCancel) {
34
+ onCancel();
35
+ } else {
36
+ var _rest$onClose;
37
+ (_rest$onClose = rest.onClose) === null || _rest$onClose === void 0 || _rest$onClose.call(rest, e);
38
+ }
39
+ };
40
+ return /*#__PURE__*/_jsxs(_Fragment, {
41
+ children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({}, rest), {}, {
42
+ footer: footer || /*#__PURE__*/_jsxs(_Fragment, {
43
+ children: [/*#__PURE__*/_jsx("div", {
44
+ className: "".concat(antPrefix, "-drawer-footer-info"),
45
+ children: info
46
+ }), /*#__PURE__*/_jsxs("div", {
47
+ className: "".concat(antPrefix, "-drawer-footer-buttons"),
48
+ children: [/*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
49
+ onClick: handleCancel
50
+ }, cancelButtonProps), {}, {
51
+ children: cancelText
52
+ })), /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
53
+ type: "primary",
54
+ onClick: onOk
55
+ }, okButtonProps), {}, {
56
+ children: okText
57
+ }))]
58
+ })]
59
+ })
60
+ }))]
61
+ });
62
+ };
63
+ export default DrawerConfirm;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;