@agentscope-ai/design 1.0.14 → 1.0.15

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.
@@ -1,188 +0,0 @@
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 AlertDialog = function AlertDialog(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
- AlertDialog[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 AlertDialog;
@@ -1,38 +0,0 @@
1
- import { ModalProps } from "../../../index";
2
- import { SyntheticEvent } from 'react';
3
- export interface AlertDialogProps 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 AlertDialogStaticProps = Omit<AlertDialogProps, 'type' | 'open'>;
30
- declare const _default: {
31
- (props: AlertDialogProps): JSX.Element;
32
- success: (props?: AlertDialogStaticProps) => void;
33
- info: (props?: AlertDialogStaticProps) => void;
34
- warning: (props?: AlertDialogStaticProps) => void;
35
- error: (props?: AlertDialogStaticProps) => void;
36
- confirm: (props?: AlertDialogStaticProps) => void;
37
- };
38
- export default _default;
@@ -1,152 +0,0 @@
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 { getCommonConfig } from "../../../config";
15
- import { useStyle } from "./index.style";
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- import { jsxs as _jsxs } from "react/jsx-runtime";
18
- import { Fragment as _Fragment } from "react/jsx-runtime";
19
- var getCommonProps = function getCommonProps(props) {
20
- var renderTitle = function renderTitle(_ref) {
21
- var type = _ref.type,
22
- title = _ref.title;
23
- var _getCommonConfig = getCommonConfig(),
24
- antPrefix = _getCommonConfig.antPrefix;
25
- switch (type) {
26
- case 'success':
27
- return /*#__PURE__*/_jsxs(Flex, {
28
- align: "center",
29
- gap: 8,
30
- className: "leading-[28px]",
31
- children: [/*#__PURE__*/_jsx(CheckCircleOutlined, {
32
- style: {
33
- color: "var(--".concat(antPrefix, "-color-success)"),
34
- fontSize: 18,
35
- margin: '0 3px'
36
- }
37
- }), title]
38
- });
39
- case 'warning':
40
- case 'confirm':
41
- return /*#__PURE__*/_jsxs(Flex, {
42
- align: "center",
43
- gap: 8,
44
- className: "leading-[28px]",
45
- children: [/*#__PURE__*/_jsx(ExclamationCircleOutlined, {
46
- style: {
47
- color: "var(--".concat(antPrefix, "-color-warning)"),
48
- fontSize: 18,
49
- margin: '0 3px'
50
- }
51
- }), title]
52
- });
53
- case 'info':
54
- return /*#__PURE__*/_jsxs(Flex, {
55
- align: "center",
56
- gap: 8,
57
- className: "leading-[28px]",
58
- children: [/*#__PURE__*/_jsx(InfoCircleOutlined, {
59
- style: {
60
- color: "var(--".concat(antPrefix, "-color-info)"),
61
- fontSize: 18,
62
- margin: '0 3px'
63
- }
64
- }), title]
65
- });
66
- case 'error':
67
- return /*#__PURE__*/_jsxs(Flex, {
68
- align: "center",
69
- gap: 8,
70
- className: "leading-[28px]",
71
- children: [/*#__PURE__*/_jsx(CloseCircleOutlined, {
72
- style: {
73
- color: "var(--".concat(antPrefix, "-color-error)"),
74
- fontSize: 18,
75
- margin: '0 3px'
76
- }
77
- }), title]
78
- });
79
- default:
80
- return $i18n.get({
81
- id: 'components.commonComponents.AlertDialog.Prompt',
82
- dm: '提示'
83
- });
84
- }
85
- };
86
- var children = props.children,
87
- _props$type = props.type,
88
- type = _props$type === void 0 ? 'info' : _props$type,
89
- _props$danger = props.danger,
90
- danger = _props$danger === void 0 ? false : _props$danger,
91
- title = props.title,
92
- _props$width = props.width,
93
- width = _props$width === void 0 ? '400px' : _props$width,
94
- _props$className = props.className,
95
- className = _props$className === void 0 ? '' : _props$className,
96
- restProps = _objectWithoutProperties(props, _excluded);
97
- return {
98
- width: width,
99
- transitionName: '',
100
- restProps: restProps,
101
- closeIcon: null,
102
- title: renderTitle({
103
- type: type,
104
- title: title
105
- }),
106
- okButtonProps: {
107
- danger: type === 'error' || type === 'warning' || danger
108
- },
109
- destroyOnClose: true,
110
- className: classNames(className, 'animate-in', "".concat(getCommonConfig().sparkPrefix, "-alert-dialog")),
111
- content: props.content || children,
112
- children: children
113
- };
114
- };
115
- var AlertDialog = function AlertDialog(props) {
116
- var commonProps = getCommonProps(props);
117
- var Style = useStyle();
118
- return /*#__PURE__*/_jsxs(_Fragment, {
119
- children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
120
- width: commonProps.width,
121
- transitionName: ""
122
- }, commonProps.restProps), {}, {
123
- closeIcon: null,
124
- title: commonProps.title,
125
- okButtonProps: commonProps.okButtonProps || {},
126
- destroyOnClose: commonProps.destroyOnClose,
127
- className: commonProps.className,
128
- children: commonProps.content || commonProps.children
129
- }))]
130
- });
131
- };
132
- var staticFns = ['success', 'info', 'warning', 'error', 'confirm'];
133
- staticFns.forEach(function (type) {
134
- AlertDialog[type] = function (props) {
135
- var commonProps = getCommonProps(_objectSpread(_objectSpread({}, props), {}, {
136
- type: type
137
- }));
138
- function Content() {
139
- var Style = useStyle();
140
- return /*#__PURE__*/_jsxs(_Fragment, {
141
- children: [/*#__PURE__*/_jsx(Style, {}), commonProps.content]
142
- });
143
- }
144
-
145
- // @ts-ignore
146
- return Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, commonProps), commonProps.restProps), {}, {
147
- content: /*#__PURE__*/_jsx(Content, {}),
148
- icon: null
149
- }));
150
- };
151
- });
152
- export default AlertDialog;