@agentscope-ai/design 1.0.7 → 1.0.9
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/antd/styles/alert.style.d.ts +2 -10
- package/lib/antd/styles/alert.style.js +11 -12
- package/lib/antd/styles/breadcrumb.style.d.ts +2 -18
- package/lib/antd/styles/breadcrumb.style.js +13 -15
- package/lib/antd/styles/button.style.d.ts +2 -80
- package/lib/antd/styles/button.style.js +63 -47
- package/lib/antd/styles/dropdown.style.d.ts +2 -15
- package/lib/antd/styles/dropdown.style.js +27 -16
- package/lib/antd/styles/floatButton.style.d.ts +2 -8
- package/lib/antd/styles/floatButton.style.js +13 -12
- package/lib/antd/styles/index.style.d.ts +4 -18
- package/lib/antd/styles/index.style.js +52 -53
- package/lib/antd/styles/inputNumber.style.d.ts +2 -18
- package/lib/antd/styles/inputNumber.style.js +23 -17
- package/lib/antd/styles/message.style.d.ts +2 -5
- package/lib/antd/styles/message.style.js +9 -10
- package/lib/antd/styles/notification.style.d.ts +2 -46
- package/lib/antd/styles/notification.style.js +31 -29
- package/lib/antd/styles/popover.style.d.ts +2 -13
- package/lib/antd/styles/popover.style.js +15 -14
- package/lib/antd/styles/radio.style.d.ts +2 -24
- package/lib/antd/styles/radio.style.js +29 -18
- package/lib/antd/styles/segment.style.d.ts +2 -7
- package/lib/antd/styles/segment.style.js +11 -12
- package/lib/antd/styles/select.style.d.ts +2 -31
- package/lib/antd/styles/select.style.js +51 -28
- package/lib/antd/styles/slider.style.d.ts +2 -22
- package/lib/antd/styles/slider.style.js +19 -21
- package/lib/antd/styles/table.style.d.ts +2 -5
- package/lib/antd/styles/table.style.js +7 -10
- package/lib/antd/styles/tooltip.style.d.ts +2 -8
- package/lib/antd/styles/tooltip.style.js +13 -11
- package/lib/antd/themes/_readme.txt +1 -0
- package/lib/antd/themes/bailianTheme.json +1 -1
- package/lib/antd/themes/generateThemeByToken.d.ts +1 -1
- package/lib/antd/themes/generateThemeByToken.js +1 -1
- package/lib/components/commonComponents/AlertDialog/demo/demo1.js +13 -79
- package/lib/components/commonComponents/AlertDialog/demo/demo2.js +44 -64
- package/lib/components/commonComponents/AlertDialog/index.d.ts +14 -1
- package/lib/components/commonComponents/AlertDialog/index.js +25 -17
- package/lib/components/commonComponents/AlertDialog/index.style.d.ts +1 -17
- package/lib/components/commonComponents/AlertDialog/index.style.js +16 -30
- package/lib/components/commonComponents/Anchor/demo/demo1.d.ts +0 -4
- package/lib/components/commonComponents/Anchor/demo/demo1.js +3 -4
- package/lib/components/commonComponents/Anchor/demo/demo2.d.ts +0 -4
- package/lib/components/commonComponents/Anchor/demo/demo2.js +3 -5
- package/lib/components/commonComponents/Anchor/index.js +7 -3
- package/lib/components/commonComponents/Anchor/index.style.d.ts +1 -14
- package/lib/components/commonComponents/Anchor/index.style.js +18 -23
- package/lib/components/commonComponents/Avatar/index.js +11 -7
- package/lib/components/commonComponents/Avatar/index.style.d.ts +1 -7
- package/lib/components/commonComponents/Avatar/index.style.js +6 -21
- package/lib/components/commonComponents/Breadcrumb/index.js +10 -7
- package/lib/components/commonComponents/Breadcrumb/index.style.d.ts +1 -107
- package/lib/components/commonComponents/Breadcrumb/index.style.js +32 -60
- package/lib/components/commonComponents/Button/index.js +27 -5
- package/lib/components/commonComponents/Card/index.js +23 -20
- package/lib/components/commonComponents/Card/index.style.d.ts +1 -71
- package/lib/components/commonComponents/Card/index.style.js +24 -46
- package/lib/components/commonComponents/Checkbox/index.js +13 -10
- package/lib/components/commonComponents/Checkbox/index.style.d.ts +1 -34
- package/lib/components/commonComponents/Checkbox/index.style.js +50 -38
- package/lib/components/commonComponents/CodeBlock/index.js +16 -13
- package/lib/components/commonComponents/CodeBlock/index.style.d.ts +1 -354
- package/lib/components/commonComponents/CodeBlock/index.style.js +26 -72
- package/lib/components/commonComponents/Collapse/index.js +7 -3
- package/lib/components/commonComponents/Collapse/index.style.d.ts +1 -57
- package/lib/components/commonComponents/Collapse/index.style.js +34 -47
- package/lib/components/commonComponents/CollapsePanel/index.d.ts +10 -0
- package/lib/components/commonComponents/CollapsePanel/index.js +56 -44
- package/lib/components/commonComponents/CollapsePanel/index.style.d.ts +1 -287
- package/lib/components/commonComponents/CollapsePanel/index.style.js +42 -97
- package/lib/components/commonComponents/ConfigProvider/index.js +11 -8
- package/lib/components/commonComponents/DatePicker/index.js +45 -39
- package/lib/components/commonComponents/DatePicker/index.style.d.ts +1 -102
- package/lib/components/commonComponents/DatePicker/index.style.js +66 -61
- package/lib/components/commonComponents/Descriptions/index.js +14 -10
- package/lib/components/commonComponents/Descriptions/index.style.d.ts +1 -17
- package/lib/components/commonComponents/Descriptions/index.style.js +32 -29
- package/lib/components/commonComponents/Drawer/Confirm.d.ts +1 -1
- package/lib/components/commonComponents/Drawer/Confirm.js +26 -24
- package/lib/components/commonComponents/Drawer/index.js +15 -11
- package/lib/components/commonComponents/Drawer/index.style.d.ts +1 -84
- package/lib/components/commonComponents/Drawer/index.style.js +44 -54
- package/lib/components/commonComponents/Dropdown/index.d.ts +1 -2
- package/lib/components/commonComponents/Dropdown/index.js +15 -12
- package/lib/components/commonComponents/Dropdown/index.style.d.ts +1 -78
- package/lib/components/commonComponents/Dropdown/index.style.js +48 -40
- package/lib/components/commonComponents/EllipsisTip/index.js +14 -10
- package/lib/components/commonComponents/EllipsisTip/index.style.d.ts +1 -10
- package/lib/components/commonComponents/EllipsisTip/index.style.js +6 -24
- package/lib/components/commonComponents/Empty/index.js +46 -44
- package/lib/components/commonComponents/Empty/index.style.d.ts +1 -113
- package/lib/components/commonComponents/Empty/index.style.js +22 -51
- package/lib/components/commonComponents/Empty/svg/Illustrate.js +2 -2
- package/lib/components/commonComponents/FileIcon/index.js +27 -24
- package/lib/components/commonComponents/FileIcon/index.style.d.ts +1 -61
- package/lib/components/commonComponents/FileIcon/index.style.js +20 -42
- package/lib/components/commonComponents/FloatButton/demo/demo1.js +1 -1
- package/lib/components/commonComponents/FloatButton/demo/demo2.js +1 -1
- package/lib/components/commonComponents/Form/index.js +6 -5
- package/lib/components/commonComponents/Form/index.style.d.ts +1 -53
- package/lib/components/commonComponents/Form/index.style.js +26 -38
- package/lib/components/commonComponents/HelpIcon/index.js +25 -20
- package/lib/components/commonComponents/HelpIcon/index.style.d.ts +1 -16
- package/lib/components/commonComponents/HelpIcon/index.style.js +16 -29
- package/lib/components/commonComponents/IconButton/index.js +15 -11
- package/lib/components/commonComponents/IconButton/index.style.d.ts +1 -11
- package/lib/components/commonComponents/IconButton/index.style.js +10 -24
- package/lib/components/commonComponents/IconFont/index.d.ts +1 -2
- package/lib/components/commonComponents/IconFont/index.js +14 -9
- package/lib/components/commonComponents/IconFont/index.style.d.ts +1 -67
- package/lib/components/commonComponents/IconFont/index.style.js +14 -44
- package/lib/components/commonComponents/Image/index.js +8 -5
- package/lib/components/commonComponents/Image/index.style.d.ts +1 -22
- package/lib/components/commonComponents/Image/index.style.js +16 -30
- package/lib/components/commonComponents/Input/index.js +17 -11
- package/lib/components/commonComponents/Input/index.style.d.ts +1 -70
- package/lib/components/commonComponents/Input/index.style.js +46 -42
- package/lib/components/commonComponents/Modal/index.js +19 -16
- package/lib/components/commonComponents/Modal/index.style.d.ts +1 -111
- package/lib/components/commonComponents/Modal/index.style.js +54 -72
- package/lib/components/commonComponents/Pagination/index.d.ts +1 -1
- package/lib/components/commonComponents/Pagination/index.js +36 -31
- package/lib/components/commonComponents/Pagination/index.style.d.ts +1 -49
- package/lib/components/commonComponents/Pagination/index.style.js +26 -42
- package/lib/components/commonComponents/Popconfirm/demo/demo1.js +13 -0
- package/lib/components/commonComponents/Popconfirm/demo/demo2.d.ts +3 -0
- package/lib/components/commonComponents/Popconfirm/demo/demo2.js +49 -0
- package/lib/components/commonComponents/Popconfirm/index.d.ts +9 -2
- package/lib/components/commonComponents/Popconfirm/index.js +50 -8
- package/lib/components/commonComponents/PromptsEditor/VarRender.d.ts +6 -0
- package/lib/components/commonComponents/PromptsEditor/VarRender.js +84 -0
- package/lib/components/commonComponents/PromptsEditor/VarSelectInput.d.ts +6 -0
- package/lib/components/commonComponents/PromptsEditor/VarSelectInput.js +60 -0
- package/lib/components/commonComponents/PromptsEditor/demo/basic.d.ts +1 -0
- package/lib/components/commonComponents/PromptsEditor/demo/basic.js +30 -0
- package/lib/components/commonComponents/PromptsEditor/index.d.ts +42 -0
- package/lib/components/commonComponents/PromptsEditor/index.js +134 -0
- package/lib/components/commonComponents/RadioButton/index.js +9 -10
- package/lib/components/commonComponents/RadioButton/index.style.d.ts +1 -72
- package/lib/components/commonComponents/RadioButton/index.style.js +52 -63
- package/lib/components/commonComponents/Result/index.style.d.ts +1 -3
- package/lib/components/commonComponents/Result/index.style.js +4 -16
- package/lib/components/commonComponents/Select/demo/demo2.js +0 -1
- package/lib/components/commonComponents/SlateEditor/elements/Var.js +11 -8
- package/lib/components/commonComponents/SlateEditor/elements/index.style.d.ts +1 -14
- package/lib/components/commonComponents/SlateEditor/elements/index.style.js +4 -21
- package/lib/components/commonComponents/SlateEditor/index.js +34 -31
- package/lib/components/commonComponents/SlateEditor/index.style.d.ts +1 -28
- package/lib/components/commonComponents/SlateEditor/index.style.js +4 -36
- package/lib/components/commonComponents/Slider/{slider.input.d.ts → Input/index.d.ts} +1 -1
- package/lib/components/commonComponents/Slider/Input/index.js +91 -0
- package/lib/components/commonComponents/Slider/Input/index.style.d.ts +1 -0
- package/lib/components/commonComponents/Slider/Input/index.style.js +22 -0
- package/lib/components/commonComponents/Slider/demo/demo4.d.ts +3 -0
- package/lib/components/commonComponents/Slider/demo/demo4.js +33 -0
- package/lib/components/commonComponents/Slider/demo/demo5.d.ts +3 -0
- package/lib/components/commonComponents/Slider/demo/demo5.js +34 -0
- package/lib/components/commonComponents/Slider/index.d.ts +2 -2
- package/lib/components/commonComponents/Slider/index.js +11 -7
- package/lib/components/commonComponents/Slider/index.style.d.ts +1 -7
- package/lib/components/commonComponents/Slider/index.style.js +10 -22
- package/lib/components/commonComponents/SliderSelector/index.js +38 -35
- package/lib/components/commonComponents/SliderSelector/index.style.d.ts +1 -38
- package/lib/components/commonComponents/SliderSelector/index.style.js +20 -37
- package/lib/components/commonComponents/Spinner/index.d.ts +4 -4
- package/lib/components/commonComponents/Spinner/index.js +28 -24
- package/lib/components/commonComponents/Spinner/index.style.d.ts +1 -79
- package/lib/components/commonComponents/Spinner/index.style.js +30 -61
- package/lib/components/commonComponents/Statistic/index.js +7 -3
- package/lib/components/commonComponents/Statistic/index.style.d.ts +1 -15
- package/lib/components/commonComponents/Statistic/index.style.js +14 -26
- package/lib/components/commonComponents/Steps/index.js +10 -6
- package/lib/components/commonComponents/Steps/index.style.d.ts +1 -162
- package/lib/components/commonComponents/Steps/index.style.js +68 -78
- package/lib/components/commonComponents/Switch/index.js +13 -10
- package/lib/components/commonComponents/Switch/index.style.d.ts +1 -25
- package/lib/components/commonComponents/Switch/index.style.js +22 -33
- package/lib/components/commonComponents/Table/index.js +10 -6
- package/lib/components/commonComponents/Table/index.style.d.ts +1 -52
- package/lib/components/commonComponents/Table/index.style.js +18 -32
- package/lib/components/commonComponents/Tabs/index.js +35 -29
- package/lib/components/commonComponents/Tabs/index.style.d.ts +1 -55
- package/lib/components/commonComponents/Tabs/index.style.js +38 -44
- package/lib/components/commonComponents/Tag/demo/demo2.js +0 -1
- package/lib/components/commonComponents/Tag/demo/demo3.js +0 -2
- package/lib/components/commonComponents/Tag/index.js +14 -10
- package/lib/components/commonComponents/Tag/index.style.d.ts +1 -56
- package/lib/components/commonComponents/Tag/index.style.js +54 -58
- package/lib/components/commonComponents/TimePicker/index.js +36 -30
- package/lib/components/commonComponents/TimePicker/index.style.d.ts +1 -71
- package/lib/components/commonComponents/TimePicker/index.style.js +54 -50
- package/lib/components/commonComponents/Tooltip/index.js +14 -13
- package/lib/components/commonComponents/Tooltip/index.style.d.ts +1 -24
- package/lib/components/commonComponents/Tooltip/index.style.js +26 -32
- package/lib/components/commonComponents/Upload/index.js +15 -9
- package/lib/components/commonComponents/Upload/index.style.d.ts +1 -125
- package/lib/components/commonComponents/Upload/index.style.js +80 -90
- package/lib/index.d.ts +3 -2
- package/lib/index.js +10 -5
- package/lib/libs/env/index.js +1 -1
- package/lib/libs/newCreateStyle/index.d.ts +7 -0
- package/lib/libs/newCreateStyle/index.js +26 -0
- package/llms/index.llms.txt +43 -43
- package/package.json +11 -8
- package/lib/components/commonComponents/Popconfirm/demo/demo.js +0 -155
- package/lib/components/commonComponents/Slider/slider.input.js +0 -76
- package/lib/components/commonComponents/spark.style.d.ts +0 -45
- package/lib/components/commonComponents/spark.style.js +0 -62
- /package/lib/components/commonComponents/Popconfirm/demo/{demo.d.ts → demo1.d.ts} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Button, Popconfirm } from "../../../..";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
var App = function App() {
|
|
5
|
+
return /*#__PURE__*/_jsx(Popconfirm, {
|
|
6
|
+
title: "Title here",
|
|
7
|
+
description: "Descriptive content explaining the action or outcome.",
|
|
8
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
9
|
+
children: "Open Popconfirm"
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export default App;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Button, Popconfirm } from "../../../..";
|
|
2
|
+
import { Flex } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
var App = function App() {
|
|
7
|
+
return /*#__PURE__*/_jsxs(Flex, {
|
|
8
|
+
vertical: true,
|
|
9
|
+
gap: 24,
|
|
10
|
+
children: [/*#__PURE__*/_jsx(Popconfirm, {
|
|
11
|
+
title: "Title here",
|
|
12
|
+
description: "Descriptive content explaining the action or outcome.",
|
|
13
|
+
type: "info",
|
|
14
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
15
|
+
children: "Info"
|
|
16
|
+
})
|
|
17
|
+
}), /*#__PURE__*/_jsx(Popconfirm, {
|
|
18
|
+
title: "Title here",
|
|
19
|
+
description: "Descriptive content explaining the action or outcome.",
|
|
20
|
+
type: "success",
|
|
21
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
22
|
+
children: "Success"
|
|
23
|
+
})
|
|
24
|
+
}), /*#__PURE__*/_jsx(Popconfirm, {
|
|
25
|
+
title: "Title here",
|
|
26
|
+
description: "Descriptive content explaining the action or outcome.",
|
|
27
|
+
type: "warning",
|
|
28
|
+
okText: "Primary Danger",
|
|
29
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
30
|
+
children: "Warning"
|
|
31
|
+
})
|
|
32
|
+
}), /*#__PURE__*/_jsx(Popconfirm, {
|
|
33
|
+
title: "Title here",
|
|
34
|
+
description: "Descriptive content explaining the action or outcome.",
|
|
35
|
+
type: "error",
|
|
36
|
+
okText: "Primary Danger",
|
|
37
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
38
|
+
children: "Error"
|
|
39
|
+
})
|
|
40
|
+
}), /*#__PURE__*/_jsx(Popconfirm, {
|
|
41
|
+
title: "Title here",
|
|
42
|
+
description: "Descriptive content explaining the action or outcome.",
|
|
43
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
44
|
+
children: "Confirm"
|
|
45
|
+
})
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export default App;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { PopconfirmProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
3
|
+
export interface SparkPopconfirmProps extends PopconfirmProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 类型
|
|
6
|
+
* @descriptionEn type of the popconfirm
|
|
7
|
+
* @default 'confirm'
|
|
8
|
+
*/
|
|
9
|
+
type?: 'info' | 'warning' | 'error' | 'success' | 'confirm';
|
|
10
|
+
}
|
|
11
|
+
declare const SparkPopconfirm: React.ForwardRefExoticComponent<SparkPopconfirmProps & React.RefAttributes<any>>;
|
|
4
12
|
export default SparkPopconfirm;
|
|
5
|
-
export type SparkPopconfirmProps = PopconfirmProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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 = ["icon"];
|
|
2
|
+
var _excluded = ["icon", "type", "okButtonProps"];
|
|
3
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
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
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; }
|
|
@@ -8,22 +8,64 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
8
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
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
10
|
import { getCommonConfig } from "../../..";
|
|
11
|
-
import { ExclamationCircleOutlined } from
|
|
11
|
+
import { CheckCircleOutlined, CloseCircleOutlined, ExclamationCircleOutlined, InfoCircleOutlined } from '@agentscope-ai/icons-override-antd';
|
|
12
12
|
import { Popconfirm } from 'antd';
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
var SparkPopconfirm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
16
|
-
var commonConfig = getCommonConfig();
|
|
17
|
-
var antPrefix = commonConfig.antPrefix;
|
|
18
16
|
var icon = props.icon,
|
|
17
|
+
_props$type = props.type,
|
|
18
|
+
type = _props$type === void 0 ? 'confirm' : _props$type,
|
|
19
|
+
okButtonProps = props.okButtonProps,
|
|
19
20
|
rest = _objectWithoutProperties(props, _excluded);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
var _getCommonConfig = getCommonConfig(),
|
|
22
|
+
antPrefix = _getCommonConfig.antPrefix;
|
|
23
|
+
var getMergedIcon = function getMergedIcon() {
|
|
24
|
+
if (icon) return icon;
|
|
25
|
+
if (type === 'confirm') return /*#__PURE__*/_jsx(ExclamationCircleOutlined, {
|
|
26
|
+
style: {
|
|
27
|
+
color: "var(--".concat(antPrefix, "-color-warning)")
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
if (type === 'info') return /*#__PURE__*/_jsx(InfoCircleOutlined, {
|
|
31
|
+
style: {
|
|
32
|
+
color: "var(--".concat(antPrefix, "-color-info)")
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (type === 'warning') return /*#__PURE__*/_jsx(ExclamationCircleOutlined, {
|
|
36
|
+
style: {
|
|
37
|
+
color: "var(--".concat(antPrefix, "-color-warning)")
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
if (type === 'error') return /*#__PURE__*/_jsx(CloseCircleOutlined, {
|
|
41
|
+
style: {
|
|
42
|
+
color: "var(--".concat(antPrefix, "-color-error)")
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (type === 'success') return /*#__PURE__*/_jsx(CheckCircleOutlined, {
|
|
46
|
+
style: {
|
|
47
|
+
color: "var(--".concat(antPrefix, "-color-success)")
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return /*#__PURE__*/_jsx(ExclamationCircleOutlined, {
|
|
23
51
|
style: {
|
|
24
52
|
color: "var(--".concat(antPrefix, "-color-warning)")
|
|
25
53
|
}
|
|
26
|
-
})
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var getMergedOkButtonProps = function getMergedOkButtonProps() {
|
|
57
|
+
var innerOkButtonProps = {};
|
|
58
|
+
if (['warning', 'error'].includes(type)) {
|
|
59
|
+
innerOkButtonProps.danger = true;
|
|
60
|
+
}
|
|
61
|
+
return _objectSpread(_objectSpread({}, innerOkButtonProps), okButtonProps || {});
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/_jsx(Popconfirm, _objectSpread(_objectSpread({}, rest), {}, {
|
|
64
|
+
ref: ref,
|
|
65
|
+
icon: getMergedIcon()
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
,
|
|
68
|
+
okButtonProps: getMergedOkButtonProps()
|
|
27
69
|
}));
|
|
28
70
|
});
|
|
29
71
|
export default SparkPopconfirm;
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
9
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
12
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
import { Decoration, EditorView, MatchDecorator, ViewPlugin, WidgetType } from '@codemirror/view';
|
|
16
|
+
|
|
17
|
+
// Placeholder Widget 类
|
|
18
|
+
var PlaceholderWidget = /*#__PURE__*/function (_WidgetType) {
|
|
19
|
+
_inherits(PlaceholderWidget, _WidgetType);
|
|
20
|
+
var _super = _createSuper(PlaceholderWidget);
|
|
21
|
+
function PlaceholderWidget(name) {
|
|
22
|
+
var _this;
|
|
23
|
+
_classCallCheck(this, PlaceholderWidget);
|
|
24
|
+
_this = _super.call(this);
|
|
25
|
+
_this.name = name;
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
_createClass(PlaceholderWidget, [{
|
|
29
|
+
key: "eq",
|
|
30
|
+
value: function eq(other) {
|
|
31
|
+
return other.name == this.name;
|
|
32
|
+
}
|
|
33
|
+
}, {
|
|
34
|
+
key: "toDOM",
|
|
35
|
+
value: function toDOM() {
|
|
36
|
+
var wrap = document.createElement('span');
|
|
37
|
+
wrap.setAttribute('aria-hidden', 'true');
|
|
38
|
+
wrap.className = 'cm-prompt-var';
|
|
39
|
+
wrap.textContent = "${".concat(this.name, "}");
|
|
40
|
+
return wrap;
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
key: "ignoreEvent",
|
|
44
|
+
value: function ignoreEvent() {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}]);
|
|
48
|
+
return PlaceholderWidget;
|
|
49
|
+
}(WidgetType); // Placeholder 匹配器
|
|
50
|
+
var placeholderMatcher = new MatchDecorator({
|
|
51
|
+
regexp: /\$\{(\w+)\}/g,
|
|
52
|
+
decoration: function decoration(match) {
|
|
53
|
+
return Decoration.replace({
|
|
54
|
+
widget: new PlaceholderWidget(match[1])
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Placeholder 插件
|
|
60
|
+
var placeholders = ViewPlugin.fromClass( /*#__PURE__*/function () {
|
|
61
|
+
function _class2(view) {
|
|
62
|
+
_classCallCheck(this, _class2);
|
|
63
|
+
_defineProperty(this, "placeholders", void 0);
|
|
64
|
+
this.placeholders = placeholderMatcher.createDeco(view);
|
|
65
|
+
}
|
|
66
|
+
_createClass(_class2, [{
|
|
67
|
+
key: "update",
|
|
68
|
+
value: function update(_update) {
|
|
69
|
+
this.placeholders = placeholderMatcher.updateDeco(_update, this.placeholders);
|
|
70
|
+
}
|
|
71
|
+
}]);
|
|
72
|
+
return _class2;
|
|
73
|
+
}(), {
|
|
74
|
+
decorations: function decorations(instance) {
|
|
75
|
+
return instance.placeholders;
|
|
76
|
+
},
|
|
77
|
+
provide: function provide(plugin) {
|
|
78
|
+
return EditorView.atomicRanges.of(function (view) {
|
|
79
|
+
var _view$plugin;
|
|
80
|
+
return ((_view$plugin = view.plugin(plugin)) === null || _view$plugin === void 0 ? void 0 : _view$plugin.placeholders) || Decoration.none;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
export default [placeholders];
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
import { autocompletion } from '@codemirror/autocomplete';
|
|
14
|
+
export default function () {
|
|
15
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
16
|
+
var config = arguments.length > 1 ? arguments[1] : undefined;
|
|
17
|
+
var onCreate = config.onCreate,
|
|
18
|
+
createBtnText = config.createBtnText;
|
|
19
|
+
return autocompletion({
|
|
20
|
+
override: [function (context) {
|
|
21
|
+
var word = context.matchBefore(/\/(\w+)?/);
|
|
22
|
+
if (!word) return null;
|
|
23
|
+
if (word && word.from == word.to && !context.explicit) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
from: word === null || word === void 0 ? void 0 : word.from,
|
|
28
|
+
options: (onCreate ? [].concat(_toConsumableArray(data), [{
|
|
29
|
+
label: '/NEW_VAR',
|
|
30
|
+
boost: -99
|
|
31
|
+
}]) : data).map(function (item) {
|
|
32
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
33
|
+
displayLabel: item.label === '/NEW_VAR' ? createBtnText : item.label.slice(1),
|
|
34
|
+
apply: function apply(view, completion, from, to) {
|
|
35
|
+
if (completion.label === '/NEW_VAR') {
|
|
36
|
+
view.dispatch({
|
|
37
|
+
changes: {
|
|
38
|
+
from: from,
|
|
39
|
+
to: to,
|
|
40
|
+
insert: ''
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return onCreate === null || onCreate === void 0 ? void 0 : onCreate();
|
|
44
|
+
}
|
|
45
|
+
var variableName = completion.label.slice(1);
|
|
46
|
+
var variableText = "${".concat(variableName, "}");
|
|
47
|
+
view.dispatch({
|
|
48
|
+
changes: {
|
|
49
|
+
from: from,
|
|
50
|
+
to: to,
|
|
51
|
+
insert: variableText
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
})
|
|
57
|
+
};
|
|
58
|
+
}]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Basic(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { PromptsEditor } from "../../../..";
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export default function Basic() {
|
|
11
|
+
var _useState = useState("# \u89D2\u8272\n\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684Prompt\u7F16\u5199\u5DE5\u7A0B\u5E08\uFF0C\u64C5\u957F\u7F16\u5199\u5404\u79CD\u7C7B\u578B\u7684Prompt\u3002\n\n# \u6280\u80FD\n1. \u4F60\u64C5\u957F\u7F16\u5199\u5404\u79CD\u7C7B\u578B\u7684Prompt\u3002\n2. \u4F60\u64C5\u957F\u7F16\u5199\u5404\u79CD\u7C7B\u578B\u7684Prompt\u3002\n3. \u4F60\u64C5\u957F\u7F16\u5199\u5404\u79CD\u7C7B\u578B\u7684Prompt\u3002\n\n\n# \u4EFB\u52A1\n\u6839\u636E\u8F93\u5165\u7684Prompt\u6A21\u677F\uFF0C\u751F\u6210\u7B26\u5408\u8981\u6C42\u7684Prompt\u3002\n\n# \u8F93\u5165\n- Prompt\u6A21\u677F\uFF1A\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684Prompt\u7F16\u5199\u5DE5\u7A0B\u5E08\uFF0C\u64C5\u957F\u7F16\u5199\u5404\u79CD\u7C7B\u578B\u7684Prompt\u3002\n\n# \u8F93\u51FA\n- Prompt\uFF1A\u7B26\u5408\u8981\u6C42\u7684Prompt\u3002"),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
value = _useState2[0],
|
|
14
|
+
setValue = _useState2[1];
|
|
15
|
+
return /*#__PURE__*/_jsx(PromptsEditor, {
|
|
16
|
+
onCreate: function onCreate() {
|
|
17
|
+
return alert(1);
|
|
18
|
+
},
|
|
19
|
+
value: value,
|
|
20
|
+
onChange: setValue,
|
|
21
|
+
maxLength: 5000,
|
|
22
|
+
variables: [{
|
|
23
|
+
code: 'city'
|
|
24
|
+
}, {
|
|
25
|
+
code: 'foo'
|
|
26
|
+
}, {
|
|
27
|
+
code: 'user'
|
|
28
|
+
}]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface PromptsEditorProps {
|
|
2
|
+
/**
|
|
3
|
+
* @description 可以输入内容的最大长度
|
|
4
|
+
* @descriptionEn Maximum length of input content
|
|
5
|
+
*/
|
|
6
|
+
maxLength?: number;
|
|
7
|
+
/**
|
|
8
|
+
* @description 输入的内容
|
|
9
|
+
* @descriptionEn Input content value
|
|
10
|
+
*/
|
|
11
|
+
value: string;
|
|
12
|
+
/**
|
|
13
|
+
* @description 输入内容的类名
|
|
14
|
+
* @descriptionEn CSS class name for the input content
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @description 输入内容的回调
|
|
19
|
+
* @descriptionEn Callback function when input value changes
|
|
20
|
+
*/
|
|
21
|
+
onChange?: (value: string) => void;
|
|
22
|
+
/**
|
|
23
|
+
* @description 可以插入的变量列表
|
|
24
|
+
* @descriptionEn Available variables for insertion
|
|
25
|
+
*/
|
|
26
|
+
variables?: Array<{
|
|
27
|
+
code: string;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* @description 新增变量的触发回调
|
|
31
|
+
* @descriptionEn Callback function to create new variable
|
|
32
|
+
*/
|
|
33
|
+
onCreate?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* @description 新增变量的按钮文本
|
|
36
|
+
* @descriptionEn Text of the create variable button
|
|
37
|
+
*/
|
|
38
|
+
createBtnText?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const langExtensionsMap: Record<string, any[]>;
|
|
41
|
+
declare const CodeMirrorWrapper: (props: PromptsEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export default CodeMirrorWrapper;
|
|
@@ -0,0 +1,134 @@
|
|
|
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 _templateObject, _templateObject2;
|
|
3
|
+
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; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
5
|
+
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); }
|
|
6
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
17
|
+
// @ts-nocheck
|
|
18
|
+
import { SparkEnterLine } from '@agentscope-ai/icons';
|
|
19
|
+
import { markdown } from '@codemirror/lang-markdown';
|
|
20
|
+
import { vscodeDark, vscodeLight } from '@uiw/codemirror-theme-vscode';
|
|
21
|
+
import CodeMirror from '@uiw/react-codemirror';
|
|
22
|
+
import { ConfigProvider, theme } from 'antd';
|
|
23
|
+
import { createStyles } from 'antd-style';
|
|
24
|
+
import classNames from 'classnames';
|
|
25
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
26
|
+
import VarRender from "./VarRender";
|
|
27
|
+
import VarSelectInput from "./VarSelectInput";
|
|
28
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
|
+
var useStyles = createStyles(function (_ref) {
|
|
31
|
+
var css = _ref.css,
|
|
32
|
+
token = _ref.token;
|
|
33
|
+
return {
|
|
34
|
+
onCreate: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .cm-tooltip li:last-of-type {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 40px;\n border-top: 1px solid ", ";\n border-radius: 0 !important;\n background-color: ", " !important;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0 !important;\n }\n\n .cm-tooltip ul {\n margin-bottom: 40px !important;\n }\n\n .cm-tooltip li:first-of-type {\n border-top: none !important;\n }\n "])), token.colorBorderSecondary, token.colorBgContainer),
|
|
35
|
+
cm: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .cm-line {\n color: ", ";\n }\n .cm-line span {\n color: ", ";\n }\n\n .cm-editor {\n position: absolute !important;\n background-color: transparent !important;\n\n top: 0;\n left: 8px;\n right: 0;\n bottom: 30px;\n }\n .cm-focused {\n outline: none;\n }\n\n .cm-content {\n width: 100%;\n padding: 8px 0;\n white-space: break-spaces;\n }\n\n .cm-line {\n line-height: 24px;\n }\n\n .cm-prompt-var {\n font-size: inherit;\n color: ", " !important;\n background-color: ", " !important;\n line-height: 1.7;\n font-weight: 500;\n margin: 0 2px;\n height: 24px;\n display: inline-flex;\n padding: 0 4px;\n border-radius: 4px;\n }\n\n .cm-tooltip {\n position: relative;\n background-color: ", ";\n border: 0;\n border-radius: 4px;\n overflow: hidden;\n box-shadow: 0px 3px 12px 0px rgba(47, 49, 51, 0.12);\n }\n\n .cm-tooltip ul {\n max-height: 17em !important;\n display: flex;\n flex-direction: column;\n }\n\n .cm-tooltip li {\n margin: 4px 8px;\n height: 32px;\n padding: 0 12px !important;\n flex: 0 0 32px;\n display: flex;\n align-items: center;\n }\n\n .cm-tooltip-autocomplete ul li[aria-selected] {\n border-radius: 6px;\n font-weight: 600;\n color: ", ";\n background-color: ", ";\n }\n\n .cm-completionInfo-right {\n display: none;\n }\n\n .cm-completionIcon {\n display: none;\n }\n "])), token.colorTextSecondary, token.colorBlue, token.colorPurple, token.colorPurpleBg, token.colorBgContainer, token.colorText, token.colorFillSecondary),
|
|
36
|
+
root: {
|
|
37
|
+
position: 'relative',
|
|
38
|
+
minHeight: 300,
|
|
39
|
+
backgroundColor: token.colorBgBase,
|
|
40
|
+
border: "1px solid ".concat(token.colorBorderSecondary),
|
|
41
|
+
borderRadius: 6,
|
|
42
|
+
overflow: 'hidden',
|
|
43
|
+
padding: '4px 12px',
|
|
44
|
+
resize: 'vertical'
|
|
45
|
+
},
|
|
46
|
+
footer: {
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
bottom: 0,
|
|
49
|
+
left: 0,
|
|
50
|
+
right: 0,
|
|
51
|
+
padding: '0 12px',
|
|
52
|
+
height: 30,
|
|
53
|
+
display: 'flex',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
justifyContent: 'space-between',
|
|
56
|
+
fontSize: 12,
|
|
57
|
+
color: token.colorTextTertiary,
|
|
58
|
+
backgroundColor: token.colorBgBase
|
|
59
|
+
},
|
|
60
|
+
tips: {
|
|
61
|
+
display: 'flex',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
gap: 4
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
export var langExtensionsMap = {
|
|
68
|
+
markdown: [markdown()]
|
|
69
|
+
};
|
|
70
|
+
var empty = [];
|
|
71
|
+
var CodeMirrorWrapper = function CodeMirrorWrapper(props) {
|
|
72
|
+
var _useStyles = useStyles(),
|
|
73
|
+
styles = _useStyles.styles;
|
|
74
|
+
var variables = props.variables || empty;
|
|
75
|
+
var _useState = useState(false),
|
|
76
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
77
|
+
ready = _useState2[0],
|
|
78
|
+
setReady = _useState2[1];
|
|
79
|
+
var onCreate = props.onCreate;
|
|
80
|
+
var context = React.useContext(ConfigProvider.ConfigContext);
|
|
81
|
+
var isDarkMode = context.theme.algorithm === theme.darkAlgorithm;
|
|
82
|
+
var createBtnText = props.createBtnText || '+ 新增变量';
|
|
83
|
+
var getTheme = useMemo(function () {
|
|
84
|
+
if (isDarkMode) {
|
|
85
|
+
return vscodeDark;
|
|
86
|
+
}
|
|
87
|
+
return vscodeLight;
|
|
88
|
+
}, [isDarkMode]);
|
|
89
|
+
var extensions = useMemo(function () {
|
|
90
|
+
return [].concat(_toConsumableArray(langExtensionsMap['markdown']), _toConsumableArray(VarRender), [VarSelectInput(_toConsumableArray(variables).map(function (item) {
|
|
91
|
+
return {
|
|
92
|
+
label: "/".concat(item.code),
|
|
93
|
+
info: item.label
|
|
94
|
+
};
|
|
95
|
+
}) || [], {
|
|
96
|
+
onCreate: onCreate,
|
|
97
|
+
createBtnText: createBtnText
|
|
98
|
+
})]);
|
|
99
|
+
}, [variables]);
|
|
100
|
+
useEffect(function () {
|
|
101
|
+
setReady(true);
|
|
102
|
+
return function () {
|
|
103
|
+
setReady(false);
|
|
104
|
+
};
|
|
105
|
+
}, []);
|
|
106
|
+
if (!ready) return null;
|
|
107
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
108
|
+
className: styles.root,
|
|
109
|
+
children: [/*#__PURE__*/_jsx(CodeMirror, {
|
|
110
|
+
className: classNames(styles.cm, _defineProperty({}, styles.onCreate, onCreate)),
|
|
111
|
+
extensions: extensions,
|
|
112
|
+
value: props.value,
|
|
113
|
+
theme: getTheme,
|
|
114
|
+
lang: "markdown",
|
|
115
|
+
onChange: props.onChange,
|
|
116
|
+
basicSetup: {
|
|
117
|
+
lineNumbers: false,
|
|
118
|
+
foldGutter: false,
|
|
119
|
+
highlightActiveLine: false
|
|
120
|
+
}
|
|
121
|
+
}, getTheme), /*#__PURE__*/_jsxs("div", {
|
|
122
|
+
className: styles.footer,
|
|
123
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
124
|
+
className: styles.tips,
|
|
125
|
+
children: ["\u8F93\u5165\"/\"\u5F15\u7528\u53D8\u91CF\uFF0C\u652F\u6301 ", /*#__PURE__*/_jsx(SparkEnterLine, {
|
|
126
|
+
size: 16
|
|
127
|
+
}), " \u56DE\u8F66\u65B0\u589E"]
|
|
128
|
+
}), props.maxLength ? /*#__PURE__*/_jsxs("div", {
|
|
129
|
+
children: [props.value.length, "/", props.maxLength]
|
|
130
|
+
}) : null]
|
|
131
|
+
})]
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
export default CodeMirrorWrapper;
|
|
@@ -7,8 +7,10 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import { getCommonConfig } from "../../../config";
|
|
8
8
|
import { Radio } from 'antd';
|
|
9
9
|
import cls from 'classnames';
|
|
10
|
-
import
|
|
10
|
+
import { useStyle } from "./index.style";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
14
|
export default (function (props) {
|
|
13
15
|
var commonConfig = getCommonConfig();
|
|
14
16
|
var sparkPrefix = commonConfig.sparkPrefix,
|
|
@@ -19,14 +21,11 @@ export default (function (props) {
|
|
|
19
21
|
bordered = _props$bordered === void 0 ? false : _props$bordered,
|
|
20
22
|
_props$ghost = props.ghost,
|
|
21
23
|
ghost = _props$ghost === void 0 ? true : _props$ghost;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
var Style = useStyle();
|
|
25
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
26
|
+
children: [/*#__PURE__*/_jsx(Style, {}), /*#__PURE__*/_jsx(Radio.Group, _objectSpread(_objectSpread({}, props), {}, {
|
|
27
|
+
className: cls(props.className, props.bordered ? "".concat(sparkPrefix, "-radio-group-bordered") : '', ghost ? "".concat(antPrefix, "-radio-group-ghost") : ''),
|
|
28
|
+
optionType: "button"
|
|
29
|
+
}))]
|
|
27
30
|
});
|
|
28
|
-
return /*#__PURE__*/_jsx(Radio.Group, _objectSpread(_objectSpread({}, props), {}, {
|
|
29
|
-
className: cls(props.className, props.bordered ? "".concat(sparkPrefix, "-radio-group-bordered") : '', ghost ? "".concat(antPrefix, "-radio-group-ghost") : ''),
|
|
30
|
-
optionType: "button"
|
|
31
|
-
}));
|
|
32
31
|
});
|