@yuntijs/ui 1.0.0-beta.9 → 1.0.0-beta.91
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/es/App/index.d.ts +7 -0
- package/es/App/index.js +19 -0
- package/es/ButtonGroup/index.d.ts +24 -0
- package/es/ButtonGroup/index.js +66 -0
- package/es/Card/index.d.ts +1 -0
- package/es/Card/index.js +1 -0
- package/es/CardList/Item/index.d.ts +4 -0
- package/es/CardList/Item/index.js +43 -0
- package/es/CardList/Item/style.d.ts +0 -0
- package/es/CardList/Item/style.js +0 -0
- package/es/CardList/index.d.ts +2 -0
- package/es/CardList/index.js +39 -0
- package/es/ChatInputArea/desktop/ChatInputArea.d.ts +19 -0
- package/es/ChatInputArea/desktop/ChatInputArea.js +72 -0
- package/es/ChatInputArea/index.d.ts +6 -0
- package/es/ChatInputArea/index.js +6 -0
- package/es/ChatItem/components/Actions.d.ts +10 -0
- package/es/ChatItem/components/Actions.js +23 -0
- package/es/ChatItem/components/MessageContent.d.ts +21 -0
- package/es/ChatItem/components/MessageContent.js +59 -0
- package/es/ChatItem/index.d.ts +4 -0
- package/es/ChatItem/index.js +120 -0
- package/es/ChatItem/style.d.ts +25 -0
- package/es/ChatItem/style.js +39 -0
- package/es/ChatItem/type.d.ts +86 -0
- package/es/ChatItem/type.js +1 -0
- package/es/CollapseGroup/index.d.ts +4 -0
- package/es/CollapseGroup/index.js +23 -0
- package/es/CollapseGroup/style.d.ts +3 -0
- package/es/CollapseGroup/style.js +11 -0
- package/es/ConfigProvider/index.d.ts +3 -0
- package/es/ConfigProvider/index.js +17 -11
- package/es/Descriptions/index.d.ts +14 -0
- package/es/Descriptions/index.js +31 -0
- package/es/Descriptions/style.d.ts +4 -0
- package/es/Descriptions/style.js +24 -0
- package/es/Divider/index.d.ts +38 -0
- package/es/Divider/index.js +66 -0
- package/es/Divider/style.d.ts +3 -0
- package/es/Divider/style.js +12 -0
- package/es/DragPanel/index.d.ts +10 -0
- package/es/DragPanel/index.js +97 -0
- package/es/DragPanel/style.d.ts +7 -0
- package/es/DragPanel/style.js +15 -0
- package/es/Drawer/index.d.ts +13 -0
- package/es/Drawer/index.js +20 -0
- package/es/Drawer/style.d.ts +4 -0
- package/es/Drawer/style.js +16 -0
- package/es/Dropdown/index.d.ts +14 -0
- package/es/Dropdown/index.js +59 -0
- package/es/Dropdown/style.d.ts +7 -0
- package/es/Dropdown/style.js +13 -0
- package/es/EditableMessage/index.d.ts +75 -0
- package/es/EditableMessage/index.js +99 -0
- package/es/Form/collapse-list/index.d.ts +40 -0
- package/es/Form/collapse-list/index.js +209 -0
- package/es/Form/collapse-list/style.d.ts +5 -0
- package/es/Form/collapse-list/style.js +13 -0
- package/es/Form/index.d.ts +8 -0
- package/es/Form/index.js +5 -0
- package/es/FormHelper/autoFocus.d.ts +10 -0
- package/es/FormHelper/autoFocus.js +38 -0
- package/es/FormHelper/index.d.ts +13 -0
- package/es/FormHelper/index.js +41 -0
- package/es/Highlighter/FullFeatured.d.ts +18 -0
- package/es/Highlighter/FullFeatured.js +102 -0
- package/es/Highlighter/SyntaxHighlighter/index.d.ts +7 -0
- package/es/Highlighter/SyntaxHighlighter/index.js +51 -0
- package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
- package/es/Highlighter/SyntaxHighlighter/style.js +16 -0
- package/es/Highlighter/index.d.ts +50 -0
- package/es/Highlighter/index.js +77 -0
- package/es/Highlighter/style.d.ts +9 -0
- package/es/Highlighter/style.js +23 -0
- package/es/Highlighter/theme.d.ts +1 -0
- package/es/Highlighter/theme.js +1661 -0
- package/es/JsonViewer/index.d.ts +21 -0
- package/es/JsonViewer/index.js +121 -0
- package/es/JsonViewer/style.d.ts +7 -0
- package/es/JsonViewer/style.js +19 -0
- package/es/LogViewer/index.d.ts +10 -0
- package/es/LogViewer/index.js +141 -0
- package/es/LogViewer/style.d.ts +6 -0
- package/es/LogViewer/style.js +16 -0
- package/es/LogViewer/types.d.ts +235 -0
- package/es/LogViewer/types.js +1 -0
- package/es/Mentions/constants.d.ts +6 -0
- package/es/Mentions/constants.js +28 -0
- package/es/Mentions/hooks.d.ts +20 -0
- package/es/Mentions/hooks.js +133 -0
- package/es/Mentions/index.d.ts +23 -0
- package/es/Mentions/index.js +157 -0
- package/es/Mentions/plugins/OnBlurBlockPlugin.d.ts +7 -0
- package/es/Mentions/plugins/OnBlurBlockPlugin.js +35 -0
- package/es/Mentions/plugins/custom-text/node.d.ts +11 -0
- package/es/Mentions/plugins/custom-text/node.js +72 -0
- package/es/Mentions/plugins/editable.d.ts +4 -0
- package/es/Mentions/plugins/editable.js +13 -0
- package/es/Mentions/plugins/mention-node/component.d.ts +6 -0
- package/es/Mentions/plugins/mention-node/component.js +64 -0
- package/es/Mentions/plugins/mention-node/index.d.ts +9 -0
- package/es/Mentions/plugins/mention-node/index.js +32 -0
- package/es/Mentions/plugins/mention-node/node.d.ts +22 -0
- package/es/Mentions/plugins/mention-node/node.js +100 -0
- package/es/Mentions/plugins/mention-node/replacement.d.ts +5 -0
- package/es/Mentions/plugins/mention-node/replacement.js +43 -0
- package/es/Mentions/plugins/mention-node/style.d.ts +8 -0
- package/es/Mentions/plugins/mention-node/style.js +47 -0
- package/es/Mentions/plugins/mention-node/utils.d.ts +4 -0
- package/es/Mentions/plugins/mention-node/utils.js +10 -0
- package/es/Mentions/plugins/mention-picker/hooks.d.ts +5 -0
- package/es/Mentions/plugins/mention-picker/hooks.js +65 -0
- package/es/Mentions/plugins/mention-picker/index.d.ts +39 -0
- package/es/Mentions/plugins/mention-picker/index.js +137 -0
- package/es/Mentions/plugins/mention-picker/menu-item.d.ts +12 -0
- package/es/Mentions/plugins/mention-picker/menu-item.js +73 -0
- package/es/Mentions/plugins/mention-picker/menu.d.ts +10 -0
- package/es/Mentions/plugins/mention-picker/menu.js +31 -0
- package/es/Mentions/plugins/mention-picker/style.d.ts +11 -0
- package/es/Mentions/plugins/mention-picker/style.js +19 -0
- package/es/Mentions/plugins/mention-picker/utils.d.ts +31 -0
- package/es/Mentions/plugins/mention-picker/utils.js +66 -0
- package/es/Mentions/provider.d.ts +12 -0
- package/es/Mentions/provider.js +15 -0
- package/es/Mentions/style.d.ts +11 -0
- package/es/Mentions/style.js +22 -0
- package/es/Mentions/types.d.ts +12 -0
- package/es/Mentions/types.js +1 -0
- package/es/Mentions/utils.d.ts +9 -0
- package/es/Mentions/utils.js +95 -0
- package/es/Modal/index.d.ts +19 -0
- package/es/Modal/index.js +36 -0
- package/es/Modal/style.d.ts +4 -0
- package/es/Modal/style.js +17 -0
- package/es/MonacoEditor/base/controller.d.ts +17 -0
- package/es/MonacoEditor/base/controller.js +49 -0
- package/es/MonacoEditor/base/helper.d.ts +65 -0
- package/es/MonacoEditor/base/helper.js +324 -0
- package/es/MonacoEditor/base/index.d.ts +39 -0
- package/es/MonacoEditor/base/index.js +238 -0
- package/es/MonacoEditor/base/monaco.d.ts +6 -0
- package/es/MonacoEditor/base/monaco.js +64 -0
- package/es/MonacoEditor/{style.d.ts → base/style.d.ts} +4 -1
- package/es/MonacoEditor/base/style.js +43 -0
- package/es/MonacoEditor/index.d.ts +5 -4
- package/es/MonacoEditor/index.js +26 -62
- package/es/Page/Breadcrumb/index.d.ts +9 -0
- package/es/Page/Breadcrumb/index.js +56 -0
- package/es/Page/Content/index.d.ts +4 -0
- package/es/Page/Content/index.js +59 -0
- package/es/Page/Content/style.d.ts +3 -0
- package/es/Page/Content/style.js +12 -0
- package/es/Page/Footer/index.d.ts +2 -0
- package/es/Page/Footer/index.js +6 -0
- package/es/Page/Header/Icon.d.ts +17 -0
- package/es/Page/Header/Icon.js +42 -0
- package/es/Page/Header/index.d.ts +43 -0
- package/es/Page/Header/index.js +202 -0
- package/es/Page/Header/style.d.ts +12 -0
- package/es/Page/Header/style.js +21 -0
- package/es/Page/Page.d.ts +9 -0
- package/es/Page/Page.js +49 -0
- package/es/Page/PageContext.d.ts +15 -0
- package/es/Page/PageContext.js +21 -0
- package/es/Page/Title/index.d.ts +5 -0
- package/es/Page/Title/index.js +18 -0
- package/es/Page/Title/style.d.ts +3 -0
- package/es/Page/Title/style.js +10 -0
- package/es/Page/index.d.ts +18 -0
- package/es/Page/index.js +15 -0
- package/es/Page/style.d.ts +3 -0
- package/es/Page/style.js +10 -0
- package/es/ProCard/Card/index.d.ts +6 -0
- package/es/ProCard/Card/index.js +25 -0
- package/es/ProCard/Card/style.d.ts +7 -0
- package/es/ProCard/Card/style.js +15 -0
- package/es/ProCard/Content/index.d.ts +4 -0
- package/es/ProCard/Content/index.js +24 -0
- package/es/ProCard/Content/style.d.ts +3 -0
- package/es/ProCard/Content/style.js +10 -0
- package/es/ProCard/Descriptions/index.d.ts +4 -0
- package/es/ProCard/Descriptions/index.js +28 -0
- package/es/ProCard/Descriptions/style.d.ts +3 -0
- package/es/ProCard/Descriptions/style.js +12 -0
- package/es/ProCard/Header/index.d.ts +15 -0
- package/es/ProCard/Header/index.js +86 -0
- package/es/ProCard/Header/style.d.ts +12 -0
- package/es/ProCard/Header/style.js +21 -0
- package/es/ProCard/index.d.ts +13 -0
- package/es/ProCard/index.js +8 -0
- package/es/SelectCard/index.d.ts +33 -0
- package/es/SelectCard/index.js +132 -0
- package/es/SelectCard/style.d.ts +10 -0
- package/es/SelectCard/style.js +42 -0
- package/es/SliderInput/index.js +2 -2
- package/es/Status/index.d.ts +7 -0
- package/es/Status/index.js +39 -0
- package/es/Status/style.d.ts +4 -0
- package/es/Status/style.js +14 -0
- package/es/Table/collapse/index.d.ts +9 -0
- package/es/Table/collapse/index.js +39 -0
- package/es/Table/collapse/style.d.ts +3 -0
- package/es/Table/collapse/style.js +11 -0
- package/es/Table/index.d.ts +20 -0
- package/es/Table/index.js +56 -0
- package/es/Typography/index.d.ts +32 -0
- package/es/Typography/index.js +77 -0
- package/es/WaveformIcon/index.d.ts +9 -0
- package/es/WaveformIcon/index.js +51 -0
- package/es/hooks/languageMap.d.ts +1 -0
- package/es/hooks/languageMap.js +1 -0
- package/es/hooks/useHighlight.d.ts +5 -0
- package/es/hooks/useHighlight.js +78 -0
- package/es/index.d.ts +38 -3
- package/es/index.js +48 -3
- package/es/notification/index.d.ts +24 -0
- package/es/notification/index.js +237 -0
- package/es/notification/style.d.ts +2 -0
- package/es/notification/style.js +28 -0
- package/es/styles/colors/colors.d.ts +39 -0
- package/es/styles/colors/colors.js +86 -0
- package/es/styles/colors/generateColorPalette.d.ts +11 -0
- package/es/styles/colors/generateColorPalette.js +31 -0
- package/es/styles/colors/neutralColors.d.ts +9 -0
- package/es/styles/colors/neutralColors.js +32 -0
- package/es/styles/index.d.ts +4 -0
- package/es/styles/index.js +4 -0
- package/es/useSpeechSynthes/const/polyfill.d.ts +3 -0
- package/es/useSpeechSynthes/const/polyfill.js +21 -0
- package/es/useSpeechSynthes/index.d.ts +13 -0
- package/es/useSpeechSynthes/index.js +69 -0
- package/es/utils/constants.d.ts +1 -0
- package/es/utils/constants.js +1 -0
- package/es/utils/tools.d.ts +1 -0
- package/es/utils/tools.js +1 -0
- package/package.json +31 -9
- package/umd/index.min.css +2 -0
- package/umd/index.min.css.map +1 -0
- package/umd/index.min.js +1 -1
- package/umd/index.min.js.map +1 -1
- package/es/MonacoEditor/style.js +0 -24
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["time", "format", "relativeTime", "tooltip"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
import { Typography as AntdTypography, Tooltip } from 'antd';
|
|
8
|
+
import dayjs from 'dayjs';
|
|
9
|
+
import dayjsRelativeTime from 'dayjs/plugin/relativeTime';
|
|
10
|
+
import { set } from 'lodash-es';
|
|
11
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
dayjs.extend(dayjsRelativeTime);
|
|
14
|
+
export var Typography = AntdTypography;
|
|
15
|
+
var getFromNow = function getFromNow(t) {
|
|
16
|
+
return dayjs(t ? new Date(t) : new Date()).fromNow();
|
|
17
|
+
};
|
|
18
|
+
var Time = function Time(props) {
|
|
19
|
+
var _tooltip$title;
|
|
20
|
+
var time = props.time,
|
|
21
|
+
format = props.format,
|
|
22
|
+
_props$relativeTime = props.relativeTime,
|
|
23
|
+
relativeTime = _props$relativeTime === void 0 ? true : _props$relativeTime,
|
|
24
|
+
tooltip = props.tooltip,
|
|
25
|
+
textProps = _objectWithoutProperties(props, _excluded);
|
|
26
|
+
var _useState = useState(getFromNow(time)),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
showTime = _useState2[0],
|
|
29
|
+
setShowTime = _useState2[1];
|
|
30
|
+
|
|
31
|
+
// The relative time within the last hour is updated automatically
|
|
32
|
+
var setTimeInterval = useCallback(function (currentTime) {
|
|
33
|
+
var now = dayjs();
|
|
34
|
+
var timeMoment = dayjs(currentTime);
|
|
35
|
+
var diff = now.diff(timeMoment);
|
|
36
|
+
if (diff > 0 && diff < 60 * 60 * 1000) {
|
|
37
|
+
return setInterval(function () {
|
|
38
|
+
setShowTime(getFromNow(currentTime));
|
|
39
|
+
}, 60 * 1000);
|
|
40
|
+
}
|
|
41
|
+
}, []);
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
var timeout;
|
|
44
|
+
if (relativeTime) {
|
|
45
|
+
timeout = setTimeInterval(new Date(time));
|
|
46
|
+
}
|
|
47
|
+
return function () {
|
|
48
|
+
if (timeout) {
|
|
49
|
+
clearInterval(timeout);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}, [relativeTime, setTimeInterval, time]);
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
if (!relativeTime) return;
|
|
55
|
+
var nextFromNow = getFromNow(time);
|
|
56
|
+
if (nextFromNow !== showTime) {
|
|
57
|
+
setShowTime(nextFromNow);
|
|
58
|
+
setTimeInterval(new Date(time));
|
|
59
|
+
}
|
|
60
|
+
}, [time, relativeTime, showTime, setTimeInterval]);
|
|
61
|
+
var fmtTime = dayjs(time).format(format || 'YYYY-MM-DD HH:mm:ss');
|
|
62
|
+
var currentTime = relativeTime ? showTime : fmtTime;
|
|
63
|
+
var tooltipTitle = (_tooltip$title = tooltip === null || tooltip === void 0 ? void 0 : tooltip.title) !== null && _tooltip$title !== void 0 ? _tooltip$title : relativeTime ? fmtTime : undefined;
|
|
64
|
+
|
|
65
|
+
// Avoid duplicate tooltips
|
|
66
|
+
if (tooltipTitle) {
|
|
67
|
+
set(textProps, 'ellipsis.tooltip.title', undefined);
|
|
68
|
+
}
|
|
69
|
+
return /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltip || {}), {}, {
|
|
70
|
+
title: tooltipTitle,
|
|
71
|
+
children: /*#__PURE__*/_jsx(Typography.Text, _objectSpread(_objectSpread({}, textProps), {}, {
|
|
72
|
+
children: currentTime
|
|
73
|
+
}))
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
Typography.Time = Time;
|
|
77
|
+
export default Typography;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
3
|
+
import { createStyles, keyframes } from 'antd-style';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
var useStyles = createStyles(function (_ref, props) {
|
|
8
|
+
var css = _ref.css;
|
|
9
|
+
var dance1 = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n transform: scaleY(0.4)\n }\n 50% {\n transform: scaleY(0.2)\n }\n 100% {\n transform: scaleY(0.5)\n }\n "])));
|
|
10
|
+
var dance2 = keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n 0% {\n transform: scaleY(0.7)\n }\n 50% {\n transform: scaleY(0.4)\n }\n 100% {\n transform: scaleY(0.7)\n }\n "])));
|
|
11
|
+
var dance3 = keyframes(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n 0% {\n transform: scaleY(0.9)\n }\n 50% {\n transform: scaleY(0.7)\n }\n 100% {\n transform: scaleY(0.9)\n }\n "])));
|
|
12
|
+
return {
|
|
13
|
+
box: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n align-items: center;\n justify-content: space-evenly;\n\n width: ", "px;\n height: ", "px;\n\n background-color: ", ";\n "])), props.width || 34, props.height || 22, props.bgColor || 'transparent'),
|
|
14
|
+
line: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: inline-block;\n\n width: 3px;\n height: 90%;\n\n background-color: ", ";\n border: none;\n border-radius: 30%;\n "])), props.lineColor || '#000'),
|
|
15
|
+
animate1: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n animation: ", " 500ms ease-in infinite alternate;\n "])), dance1),
|
|
16
|
+
animate2: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n animation: ", " 500ms ease-out infinite alternate;\n "])), dance2),
|
|
17
|
+
animate3: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n animation: ", " 500ms ease-in infinite alternate;\n "])), dance3)
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
export var WaveformIcon = function WaveformIcon(_ref2) {
|
|
21
|
+
var height = _ref2.height,
|
|
22
|
+
width = _ref2.width,
|
|
23
|
+
lineColor = _ref2.lineColor,
|
|
24
|
+
bgColor = _ref2.bgColor;
|
|
25
|
+
var _useStyles = useStyles({
|
|
26
|
+
height: height,
|
|
27
|
+
width: width,
|
|
28
|
+
lineColor: lineColor,
|
|
29
|
+
bgColor: bgColor
|
|
30
|
+
}),
|
|
31
|
+
styles = _useStyles.styles,
|
|
32
|
+
cx = _useStyles.cx;
|
|
33
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
34
|
+
className: styles.box,
|
|
35
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
36
|
+
className: cx(styles.line, styles.animate1)
|
|
37
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
38
|
+
className: cx(styles.line, styles.animate2)
|
|
39
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
40
|
+
className: cx(styles.line, styles.animate3)
|
|
41
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
42
|
+
className: cx(styles.line, styles.animate2)
|
|
43
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
44
|
+
className: cx(styles.line, styles.animate1)
|
|
45
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
46
|
+
className: cx(styles.line, styles.animate2)
|
|
47
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
48
|
+
className: cx(styles.line, styles.animate1)
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const languageMap: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var languageMap = ['abap', 'actionscript-3', 'ada', 'apache', 'apex', 'apl', 'applescript', 'ara', 'asm', 'astro', 'awk', 'ballerina', 'bat', 'beancount', 'berry', 'bibtex', 'bicep', 'blade', 'c', 'cadence', 'clarity', 'clojure', 'cmake', 'cobol', 'codeql', 'coffee', 'cpp', 'crystal', 'csharp', 'css', 'cue', 'cypher', 'd', 'dart', 'dax', 'diff', 'docker', 'dream-maker', 'elixir', 'elm', 'erb', 'erlang', 'fish', 'fsharp', 'gdresource', 'gdscript', 'gdshader', 'gherkin', 'git-commit', 'git-rebase', 'glimmer-js', 'glimmer-ts', 'glsl', 'gnuplot', 'go', 'graphql', 'groovy', 'hack', 'haml', 'handlebars', 'haskell', 'hcl', 'hjson', 'hlsl', 'html', 'http', 'imba', 'ini', 'java', 'javascript', 'jinja-html', 'jison', 'json', 'json5', 'jsonc', 'jsonl', 'jsonnet', 'jssm', 'jsx', 'julia', 'kotlin', 'kusto', 'latex', 'less', 'liquid', 'lisp', 'logo', 'lua', 'make', 'markdown', 'marko', 'matlab', 'mdc', 'mdx', 'mermaid', 'mojo', 'narrat', 'nextflow', 'nginx', 'nim', 'nix', 'objective-c', 'objective-cpp', 'ocaml', 'pascal', 'perl', 'php', 'plsql', 'postcss', 'powerquery', 'powershell', 'prisma', 'prolog', 'proto', 'pug', 'puppet', 'purescript', 'python', 'r', 'raku', 'razor', 'reg', 'rel', 'riscv', 'rst', 'ruby', 'rust', 'sas', 'sass', 'scala', 'scheme', 'scss', 'shaderlab', 'shellscript', 'shellsession', 'smalltalk', 'solidity', 'sparql', 'splunk', 'sql', 'ssh-config', 'stata', 'stylus', 'svelte', 'swift', 'system-verilog', 'tasl', 'tcl', 'tex', 'toml', 'tsx', 'turtle', 'twig', 'typescript', 'v', 'vb', 'verilog', 'vhdl', 'viml', 'vue', 'vue-html', 'vyper', 'wasm', 'wenyan', 'wgsl', 'wolfram', 'xml', 'xsl', 'yaml', 'zenscript', 'zig', 'bash', 'batch', 'be', 'c#', 'cdc', 'clj', 'cmd', 'console', 'cql', 'cs', 'dockerfile', 'erl', 'f#', 'fs', 'fsl', 'gjs', 'gts', 'hbs', 'hs', 'jade', 'js', 'kql', 'makefile', 'md', 'nar', 'nf', 'objc', 'perl6', 'properties', 'ps', 'ps1', 'py', 'ql', 'rb', 'rs', 'sh', 'shader', 'shell', 'spl', 'styl', 'ts', 'vim', 'vimscript', 'vy', 'yml', 'zsh', '文言'];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { transformerNotationDiff, transformerNotationErrorLevel, transformerNotationFocus, transformerNotationHighlight, transformerNotationWordHighlight } from '@shikijs/transformers';
|
|
4
|
+
import { createHighlighter } from 'shiki';
|
|
5
|
+
import useSWR from 'swr';
|
|
6
|
+
import { themeConfig } from "../Highlighter/theme";
|
|
7
|
+
import { languageMap } from "./languageMap";
|
|
8
|
+
export var FALLBACK_LANG = 'txt';
|
|
9
|
+
var FALLBACK_LANGS = [FALLBACK_LANG];
|
|
10
|
+
var cacheHighlighter;
|
|
11
|
+
var initHighlighter = /*#__PURE__*/function () {
|
|
12
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(lang) {
|
|
13
|
+
var highlighter, language;
|
|
14
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
15
|
+
while (1) switch (_context.prev = _context.next) {
|
|
16
|
+
case 0:
|
|
17
|
+
highlighter = cacheHighlighter;
|
|
18
|
+
language = lang.toLowerCase();
|
|
19
|
+
if (!(highlighter && FALLBACK_LANGS.includes(language))) {
|
|
20
|
+
_context.next = 4;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
return _context.abrupt("return", highlighter);
|
|
24
|
+
case 4:
|
|
25
|
+
if (languageMap.includes(language) && !FALLBACK_LANGS.includes(language)) {
|
|
26
|
+
FALLBACK_LANGS.push(language);
|
|
27
|
+
}
|
|
28
|
+
_context.next = 7;
|
|
29
|
+
return createHighlighter({
|
|
30
|
+
langs: FALLBACK_LANGS,
|
|
31
|
+
themes: [themeConfig(true), themeConfig(false)]
|
|
32
|
+
});
|
|
33
|
+
case 7:
|
|
34
|
+
highlighter = _context.sent;
|
|
35
|
+
cacheHighlighter = highlighter;
|
|
36
|
+
return _context.abrupt("return", highlighter);
|
|
37
|
+
case 10:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
40
|
+
}
|
|
41
|
+
}, _callee);
|
|
42
|
+
}));
|
|
43
|
+
return function initHighlighter(_x) {
|
|
44
|
+
return _ref.apply(this, arguments);
|
|
45
|
+
};
|
|
46
|
+
}();
|
|
47
|
+
export var useHighlight = function useHighlight(text, lang, isDarkMode) {
|
|
48
|
+
return useSWR([lang === null || lang === void 0 ? void 0 : lang.toLowerCase(), isDarkMode ? 'dark' : 'light', text].join('-'), /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
49
|
+
var language, highlighter, html;
|
|
50
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
51
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
52
|
+
case 0:
|
|
53
|
+
_context2.prev = 0;
|
|
54
|
+
language = lang.toLowerCase();
|
|
55
|
+
_context2.next = 4;
|
|
56
|
+
return initHighlighter(language);
|
|
57
|
+
case 4:
|
|
58
|
+
highlighter = _context2.sent;
|
|
59
|
+
html = highlighter === null || highlighter === void 0 ? void 0 : highlighter.codeToHtml(text, {
|
|
60
|
+
lang: languageMap.includes(language) ? language : FALLBACK_LANG,
|
|
61
|
+
theme: isDarkMode ? 'dark' : 'light',
|
|
62
|
+
transformers: [transformerNotationDiff(), transformerNotationHighlight(), transformerNotationWordHighlight(), transformerNotationFocus(), transformerNotationErrorLevel()]
|
|
63
|
+
});
|
|
64
|
+
return _context2.abrupt("return", html);
|
|
65
|
+
case 9:
|
|
66
|
+
_context2.prev = 9;
|
|
67
|
+
_context2.t0 = _context2["catch"](0);
|
|
68
|
+
return _context2.abrupt("return", '');
|
|
69
|
+
case 12:
|
|
70
|
+
case "end":
|
|
71
|
+
return _context2.stop();
|
|
72
|
+
}
|
|
73
|
+
}, _callee2, null, [[0, 9]]);
|
|
74
|
+
})), {
|
|
75
|
+
revalidateOnFocus: false
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
export { languageMap } from "./languageMap";
|
package/es/index.d.ts
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './ButtonGroup';
|
|
2
|
+
export * from './CollapseGroup';
|
|
2
3
|
export * from './ConfigProvider';
|
|
4
|
+
export * from './DragPanel';
|
|
5
|
+
export * from './JsonViewer';
|
|
3
6
|
export * from './Logo';
|
|
7
|
+
export * from './LogViewer';
|
|
8
|
+
export * from './Mentions';
|
|
4
9
|
export * from './MonacoEditor';
|
|
10
|
+
export * from './Page';
|
|
11
|
+
export * from './ProCard';
|
|
12
|
+
export * from './SelectCard';
|
|
5
13
|
export * from './SliderInput';
|
|
6
|
-
export * from './
|
|
14
|
+
export * from './Status';
|
|
7
15
|
export * from './Alert';
|
|
8
|
-
export
|
|
16
|
+
export * from './App';
|
|
17
|
+
export * from './Breadcrumb';
|
|
18
|
+
export * from './Card';
|
|
19
|
+
export * from './Descriptions';
|
|
20
|
+
export * from './Divider';
|
|
21
|
+
export * from './Drawer';
|
|
22
|
+
export * from './Dropdown';
|
|
23
|
+
export * from './Form';
|
|
24
|
+
export * from './FormHelper';
|
|
25
|
+
export * from './Modal';
|
|
26
|
+
export * from './notification';
|
|
27
|
+
export * from './Table';
|
|
28
|
+
export * from './Tree';
|
|
29
|
+
export * from './Typography';
|
|
30
|
+
export * from './ChatInputArea';
|
|
31
|
+
export * from './ChatItem';
|
|
32
|
+
export * from './EditableMessage';
|
|
33
|
+
export * from './Highlighter';
|
|
34
|
+
export * from './styles';
|
|
35
|
+
export * from './useSpeechSynthes';
|
|
36
|
+
export * from './WaveformIcon';
|
|
37
|
+
export { Affix, type AffixProps, Anchor, type AnchorProps, type MentionProps as AntdMentionProps, Mentions as AntdMentions, AutoComplete, type AutoCompleteProps, Avatar, type AvatarProps, BackTop, type BackTopProps, Badge, // @todo composed type
|
|
38
|
+
type BadgeProps, Button, // @todo dependence unifiedLink. link type, hover primary color, back button
|
|
39
|
+
type ButtonProps, Calendar, type CalendarProps, Carousel, type CarouselProps, Cascader, type CascaderProps, Checkbox, type CheckboxProps, Col, Collapse, type CollapseProps, ColorPicker, type ColorPickerProps, type ColProps, // @todo center style
|
|
40
|
+
type CountdownProps, DatePicker, type DatePickerProps, Empty, type EmptyProps, Flex, type FlexProps, FloatButton, type GlobalToken, Grid, Image, type ImageProps, Input, InputNumber, type InputNumberProps, type InputProps, type InputRef, Layout, type LayoutProps, List, type ListProps, type MappingAlgorithm, Menu, type MenuItemProps, type MenuProps, type MenuRef, type MenuTheme, message, type MessageArgsProps, Pagination, type PaginationProps, Popconfirm, type PopconfirmProps, Popover, type PopoverProps, Progress, type ProgressProps, QRCode, type QRCodeProps, type QRPropsCanvas, type QRPropsSvg, Radio, type RadioGroupProps, type RadioProps, Rate, type RateProps, type RefSelectProps, Result, type ResultProps, Row, type RowProps, Segmented, type SegmentedProps, Select, type SelectProps, Skeleton, type SkeletonProps, Slider, type SliderSingleProps, Space, type SpaceProps, Spin, type SpinProps, Statistic, type StatisticProps, type StepProps, Steps, type StepsProps, type SubMenuProps, Switch, type SwitchProps, type TabPaneProps, Tabs, type TabsProps, Tag, type TagProps, type TagType, theme, Timeline, type TimelineItemProps, type TimelineProps, TimePicker, type TimePickerProps, type TimeRangePickerProps, Tooltip, type TooltipProps, Tour, type TourProps, type TourStepProps, Transfer, type TransferProps, Tree, type TreeDataNode, type TreeNodeProps, type TreeProps, TreeSelect, type TreeSelectProps, Upload, type UploadFile, type UploadProps, version, Watermark, type WatermarkProps, } from 'antd';
|
|
41
|
+
export { CopyButton, type CopyButtonProps, Markdown, type MarkdownProps, SyntaxHighlighter, type SyntaxHighlighterProps, } from '@lobehub/ui';
|
|
42
|
+
export { SpeechSynthesisTTS } from '@lobehub/tts';
|
|
43
|
+
export { AudioPlayer, useAudioPlayer, useSpeechRecognition } from '@lobehub/tts/react';
|
|
9
44
|
export { useResponsive, useTheme, useThemeMode } from 'antd-style';
|
package/es/index.js
CHANGED
|
@@ -1,15 +1,60 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./ButtonGroup";
|
|
2
|
+
export * from "./CollapseGroup";
|
|
2
3
|
export * from "./ConfigProvider";
|
|
4
|
+
export * from "./DragPanel";
|
|
5
|
+
export * from "./JsonViewer";
|
|
3
6
|
export * from "./Logo";
|
|
7
|
+
export * from "./LogViewer";
|
|
8
|
+
export * from "./Mentions";
|
|
4
9
|
export * from "./MonacoEditor";
|
|
10
|
+
export * from "./Page";
|
|
11
|
+
export * from "./ProCard";
|
|
12
|
+
export * from "./SelectCard";
|
|
5
13
|
export * from "./SliderInput";
|
|
6
|
-
export * from "./
|
|
14
|
+
export * from "./Status";
|
|
7
15
|
|
|
8
16
|
// ~ custom antd
|
|
9
17
|
export * from "./Alert";
|
|
18
|
+
export * from "./App";
|
|
19
|
+
export * from "./Breadcrumb";
|
|
20
|
+
export * from "./Card";
|
|
21
|
+
export * from "./Descriptions";
|
|
22
|
+
export * from "./Divider";
|
|
23
|
+
export * from "./Drawer";
|
|
24
|
+
export * from "./Dropdown";
|
|
25
|
+
export * from "./Form";
|
|
26
|
+
export * from "./FormHelper";
|
|
27
|
+
export * from "./Modal";
|
|
28
|
+
export * from "./notification";
|
|
29
|
+
export * from "./Table";
|
|
30
|
+
export * from "./Tree";
|
|
31
|
+
export * from "./Typography";
|
|
32
|
+
|
|
33
|
+
// ~ custom @lobehub/ui
|
|
34
|
+
export * from "./ChatInputArea";
|
|
35
|
+
export * from "./ChatItem";
|
|
36
|
+
export * from "./EditableMessage";
|
|
37
|
+
export * from "./Highlighter";
|
|
38
|
+
export * from "./styles";
|
|
39
|
+
|
|
40
|
+
// ~ custom @lobehub/tts
|
|
41
|
+
export * from "./useSpeechSynthes";
|
|
42
|
+
export * from "./WaveformIcon";
|
|
10
43
|
|
|
11
44
|
// ~ antd
|
|
12
|
-
export { Affix, Anchor,
|
|
45
|
+
export { Affix, Anchor, Mentions as AntdMentions, AutoComplete, Avatar, BackTop, Badge // @todo composed type
|
|
46
|
+
, Button // @todo dependence unifiedLink. link type, hover primary color, back button
|
|
47
|
+
, Calendar, Carousel, Cascader, Checkbox, Col, Collapse, ColorPicker
|
|
48
|
+
|
|
49
|
+
// @todo center style
|
|
50
|
+
, DatePicker, Empty, Flex, FloatButton, Grid, Image, Input, InputNumber, Layout, List, Menu, message, Pagination, Popconfirm, Popover, Progress, QRCode, Radio, Rate, Result, Row, Segmented, Select, Skeleton, Slider, Space, Spin, Statistic, Steps, Switch, Tabs, Tag, theme, Timeline, TimePicker, Tooltip, Tour, Transfer, Tree, TreeSelect, Upload, version, Watermark } from 'antd';
|
|
51
|
+
|
|
52
|
+
// ~ @lobehub/ui
|
|
53
|
+
export { CopyButton, Markdown, SyntaxHighlighter } from '@lobehub/ui';
|
|
54
|
+
|
|
55
|
+
// @lobehub/tts
|
|
56
|
+
export { SpeechSynthesisTTS } from '@lobehub/tts';
|
|
57
|
+
export { AudioPlayer, useAudioPlayer, useSpeechRecognition } from '@lobehub/tts/react';
|
|
13
58
|
|
|
14
59
|
// ~ antd-style
|
|
15
60
|
export { useResponsive, useTheme, useThemeMode } from 'antd-style';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type NotificationArgsProps as AntdNotificationArgsProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface NotificationArgsProps extends AntdNotificationArgsProps {
|
|
4
|
+
/** 如果不为空,则会以折叠面板的形式展示描述,展开后展示报错内容,可用来展示报错详情 */
|
|
5
|
+
detail?: Record<string, any>;
|
|
6
|
+
descKey?: string;
|
|
7
|
+
errors?: Error[];
|
|
8
|
+
}
|
|
9
|
+
export declare const notification: {
|
|
10
|
+
success: (args: NotificationArgsProps) => void;
|
|
11
|
+
info: (args: NotificationArgsProps) => void;
|
|
12
|
+
warning: (args: NotificationArgsProps) => void;
|
|
13
|
+
warn: (args: NotificationArgsProps) => void;
|
|
14
|
+
error: (args: NotificationArgsProps) => void;
|
|
15
|
+
warnings: (args: NotificationArgsProps) => void;
|
|
16
|
+
warns: (args: NotificationArgsProps) => void;
|
|
17
|
+
open: (config: AntdNotificationArgsProps) => void;
|
|
18
|
+
destroy: (key?: React.Key | undefined) => void;
|
|
19
|
+
config: (config: import("antd/es/notification/interface").GlobalConfigProps) => void;
|
|
20
|
+
useNotification: typeof import("antd/es/notification/useNotification").default;
|
|
21
|
+
_InternalPanelDoNotUseOrYouWillBeFired: React.FC<import("antd/es/notification/PurePanel").PurePanelProps>;
|
|
22
|
+
};
|
|
23
|
+
export default notification;
|
|
24
|
+
export { NotificationGlobalStyle } from './style';
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
var _excluded = ["detail", "message", "description", "onClose", "className"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
import { MinusSquareOutlined, PlusSquareOutlined, WarningFilled } from '@ant-design/icons';
|
|
11
|
+
import { notification as AntdNotification, Collapse, Typography } from 'antd';
|
|
12
|
+
import React, { isValidElement, useState } from 'react';
|
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
var Panel = Collapse.Panel;
|
|
17
|
+
var Link = Typography.Link,
|
|
18
|
+
Paragraph = Typography.Paragraph,
|
|
19
|
+
Text = Typography.Text;
|
|
20
|
+
var NOTICE_MAP = {};
|
|
21
|
+
var setNoticeMap = function setNoticeMap(key, noticeProps) {
|
|
22
|
+
if (!NOTICE_MAP[key]) {
|
|
23
|
+
NOTICE_MAP[key] = [];
|
|
24
|
+
}
|
|
25
|
+
NOTICE_MAP[key].push(noticeProps);
|
|
26
|
+
};
|
|
27
|
+
var removeNoticeMap = function removeNoticeMap(key) {
|
|
28
|
+
delete NOTICE_MAP[key];
|
|
29
|
+
};
|
|
30
|
+
var reactNodeToString = function reactNodeToString(reactNode) {
|
|
31
|
+
var string = '';
|
|
32
|
+
if (typeof reactNode === 'string') {
|
|
33
|
+
string = reactNode;
|
|
34
|
+
} else if (typeof reactNode === 'number') {
|
|
35
|
+
string = reactNode.toString();
|
|
36
|
+
} else if (Array.isArray(reactNode)) {
|
|
37
|
+
var _iterator = _createForOfIteratorHelper(reactNode),
|
|
38
|
+
_step;
|
|
39
|
+
try {
|
|
40
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
41
|
+
var child = _step.value;
|
|
42
|
+
string += reactNodeToString(child);
|
|
43
|
+
}
|
|
44
|
+
} catch (err) {
|
|
45
|
+
_iterator.e(err);
|
|
46
|
+
} finally {
|
|
47
|
+
_iterator.f();
|
|
48
|
+
}
|
|
49
|
+
} else if ( /*#__PURE__*/isValidElement(reactNode)) {
|
|
50
|
+
string += reactNodeToString(reactNode.props.children);
|
|
51
|
+
}
|
|
52
|
+
return string;
|
|
53
|
+
};
|
|
54
|
+
var Message = function Message(props) {
|
|
55
|
+
var _NOTICE_MAP$key;
|
|
56
|
+
var key = props.noticeKey,
|
|
57
|
+
message = props.message;
|
|
58
|
+
var count = ((_NOTICE_MAP$key = NOTICE_MAP[key]) === null || _NOTICE_MAP$key === void 0 ? void 0 : _NOTICE_MAP$key.length) || 0;
|
|
59
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
60
|
+
children: [message, count > 1 && " (".concat(count, ")")]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var Description = function Description(props) {
|
|
64
|
+
var key = props.noticeKey;
|
|
65
|
+
var _useState = useState(),
|
|
66
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
67
|
+
activePanels = _useState2[0],
|
|
68
|
+
setActivePanels = _useState2[1];
|
|
69
|
+
var descMap = {};
|
|
70
|
+
var _iterator2 = _createForOfIteratorHelper(NOTICE_MAP[key]),
|
|
71
|
+
_step2;
|
|
72
|
+
try {
|
|
73
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
74
|
+
var noticeProps = _step2.value;
|
|
75
|
+
var descKey = reactNodeToString(noticeProps.description);
|
|
76
|
+
noticeProps.descKey = descKey;
|
|
77
|
+
descMap[descKey] = noticeProps;
|
|
78
|
+
}
|
|
79
|
+
} catch (err) {
|
|
80
|
+
_iterator2.e(err);
|
|
81
|
+
} finally {
|
|
82
|
+
_iterator2.f();
|
|
83
|
+
}
|
|
84
|
+
return /*#__PURE__*/_jsx(Collapse, {
|
|
85
|
+
accordion: true,
|
|
86
|
+
activeKey: activePanels,
|
|
87
|
+
className: "yunti-notification-collapse",
|
|
88
|
+
expandIcon: function expandIcon(_ref) {
|
|
89
|
+
var isActive = _ref.isActive;
|
|
90
|
+
return /*#__PURE__*/_jsx("span", {
|
|
91
|
+
className: "yunti-notification-collapse-expand-icon",
|
|
92
|
+
children: isActive ? /*#__PURE__*/_jsx(Link, {
|
|
93
|
+
className: "yunti-notification-link",
|
|
94
|
+
children: /*#__PURE__*/_jsx(MinusSquareOutlined, {
|
|
95
|
+
title: "\u70B9\u51FB\u5173\u95ED\u9519\u8BEF\u8BE6\u60C5"
|
|
96
|
+
})
|
|
97
|
+
}) : /*#__PURE__*/_jsx(PlusSquareOutlined, {
|
|
98
|
+
title: "\u70B9\u51FB\u67E5\u770B\u9519\u8BEF\u8BE6\u60C5"
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
ghost: true,
|
|
103
|
+
onChange: function onChange(keys) {
|
|
104
|
+
setActivePanels(keys);
|
|
105
|
+
},
|
|
106
|
+
children: Object.values(descMap).map(function (_ref2) {
|
|
107
|
+
var descKey = _ref2.descKey,
|
|
108
|
+
description = _ref2.description,
|
|
109
|
+
detail = _ref2.detail;
|
|
110
|
+
return /*#__PURE__*/_jsx(Panel, {
|
|
111
|
+
header: /*#__PURE__*/_jsx(Text, {
|
|
112
|
+
ellipsis: {
|
|
113
|
+
tooltip: false
|
|
114
|
+
},
|
|
115
|
+
style: {
|
|
116
|
+
width: 250
|
|
117
|
+
},
|
|
118
|
+
children: description
|
|
119
|
+
}),
|
|
120
|
+
children: /*#__PURE__*/_jsx(Paragraph, {
|
|
121
|
+
className: "yunti-notification-collapse-content-p",
|
|
122
|
+
copyable: {
|
|
123
|
+
text: JSON.stringify(detail, null, 2)
|
|
124
|
+
},
|
|
125
|
+
type: "secondary",
|
|
126
|
+
children: /*#__PURE__*/_jsx("pre", {
|
|
127
|
+
children: JSON.stringify(detail, null, 2)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
}, descKey);
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
var notice = function notice(args) {
|
|
135
|
+
var detail = args.detail,
|
|
136
|
+
message = args.message,
|
|
137
|
+
description = args.description,
|
|
138
|
+
onCloseFromProps = args.onClose,
|
|
139
|
+
className = args.className,
|
|
140
|
+
restArgs = _objectWithoutProperties(args, _excluded);
|
|
141
|
+
var key = reactNodeToString(message);
|
|
142
|
+
setNoticeMap(key, args);
|
|
143
|
+
var onClose = function onClose() {
|
|
144
|
+
onCloseFromProps === null || onCloseFromProps === void 0 || onCloseFromProps();
|
|
145
|
+
removeNoticeMap(key);
|
|
146
|
+
};
|
|
147
|
+
if (args.type === 'warning' && !args.icon) {
|
|
148
|
+
restArgs.icon = /*#__PURE__*/_jsx(WarningFilled, {
|
|
149
|
+
style: {
|
|
150
|
+
color: '#ff7d00'
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (!detail) {
|
|
155
|
+
return AntdNotification.open(_objectSpread({
|
|
156
|
+
key: key,
|
|
157
|
+
message: /*#__PURE__*/_jsx(Message, {
|
|
158
|
+
message: message,
|
|
159
|
+
noticeKey: key
|
|
160
|
+
}),
|
|
161
|
+
description: description,
|
|
162
|
+
onClose: onClose,
|
|
163
|
+
className: "yunti-notification ".concat(className)
|
|
164
|
+
}, restArgs));
|
|
165
|
+
}
|
|
166
|
+
return AntdNotification.open(_objectSpread({
|
|
167
|
+
key: key,
|
|
168
|
+
message: /*#__PURE__*/_jsx(Message, {
|
|
169
|
+
message: message,
|
|
170
|
+
noticeKey: key
|
|
171
|
+
}),
|
|
172
|
+
description: /*#__PURE__*/_jsx(Description, {
|
|
173
|
+
noticeKey: key
|
|
174
|
+
}),
|
|
175
|
+
onClose: onClose,
|
|
176
|
+
className: "yunti-notification ".concat(className)
|
|
177
|
+
}, restArgs));
|
|
178
|
+
};
|
|
179
|
+
var warnsFun = function warnsFun(args) {
|
|
180
|
+
var _args$errors;
|
|
181
|
+
if (((args === null || args === void 0 || (_args$errors = args.errors) === null || _args$errors === void 0 ? void 0 : _args$errors.length) || 0) > 0) {
|
|
182
|
+
if (args !== null && args !== void 0 && args.errors || []) {
|
|
183
|
+
var _iterator3 = _createForOfIteratorHelper((args === null || args === void 0 ? void 0 : args.errors) || []),
|
|
184
|
+
_step3;
|
|
185
|
+
try {
|
|
186
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
187
|
+
var item = _step3.value;
|
|
188
|
+
notice(_objectSpread(_objectSpread({
|
|
189
|
+
detail: item,
|
|
190
|
+
description: item.message
|
|
191
|
+
}, args), {}, {
|
|
192
|
+
type: 'warning'
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
} catch (err) {
|
|
196
|
+
_iterator3.e(err);
|
|
197
|
+
} finally {
|
|
198
|
+
_iterator3.f();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
notice(_objectSpread(_objectSpread({}, args), {}, {
|
|
203
|
+
type: 'warning'
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
export var notification = _objectSpread(_objectSpread({}, AntdNotification), {}, {
|
|
208
|
+
success: function success(args) {
|
|
209
|
+
return notice(_objectSpread(_objectSpread({}, args), {}, {
|
|
210
|
+
type: 'success'
|
|
211
|
+
}));
|
|
212
|
+
},
|
|
213
|
+
info: function info(args) {
|
|
214
|
+
return notice(_objectSpread(_objectSpread({}, args), {}, {
|
|
215
|
+
type: 'info'
|
|
216
|
+
}));
|
|
217
|
+
},
|
|
218
|
+
warning: function warning(args) {
|
|
219
|
+
return notice(_objectSpread(_objectSpread({}, args), {}, {
|
|
220
|
+
type: 'warning'
|
|
221
|
+
}));
|
|
222
|
+
},
|
|
223
|
+
warn: function warn(args) {
|
|
224
|
+
return notice(_objectSpread(_objectSpread({}, args), {}, {
|
|
225
|
+
type: 'warning'
|
|
226
|
+
}));
|
|
227
|
+
},
|
|
228
|
+
error: function error(args) {
|
|
229
|
+
return notice(_objectSpread(_objectSpread({}, args), {}, {
|
|
230
|
+
type: 'error'
|
|
231
|
+
}));
|
|
232
|
+
},
|
|
233
|
+
warnings: warnsFun,
|
|
234
|
+
warns: warnsFun
|
|
235
|
+
});
|
|
236
|
+
export default notification;
|
|
237
|
+
export { NotificationGlobalStyle } from "./style";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject;
|
|
3
|
+
import { notification } from 'antd';
|
|
4
|
+
import { createGlobalStyle } from 'antd-style';
|
|
5
|
+
export var NotificationGlobalStyle = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.yunti-notification {\n width: auto;\n min-width: 360px;\n max-width: 520px;\n &-link {\n color: ", ";\n }\n &-link:hover {\n color: ", ";\n }\n &-collapse {\n &-expand-icon {\n font-size: 14px !important;\n }\n &.ant-collapse > .ant-collapse-item {\n & > .ant-collapse-header {\n padding: 6px 16px 6px 24px;\n & > span {\n color: rgba(0, 0, 0, 0.7);\n }\n &:hover {\n .yunti-notification-collapse-expand-icon {\n color: ", ";\n }\n }\n .ant-collapse-expand-icon {\n position: absolute;\n top: 3.429px;\n left: 0%;\n }\n\n .ant-collapse-arrow {\n position: relative;\n top: 3.429px;\n\n display: inline-block;\n\n padding: 6px 0;\n\n line-height: 0;\n text-align: center;\n text-transform: none;\n text-rendering: optimizelegibility;\n vertical-align: -0.125em;\n }\n & > .ant-collapse-header-text {\n width: 100%;\n }\n }\n & > .ant-collapse-content > .ant-collapse-content-box {\n padding: 0;\n }\n }\n &-content-p {\n position: relative;\n & > pre {\n overflow: auto;\n height: 166px;\n margin: 0;\n padding-right: 24px;\n }\n & > .ant-typography-copy {\n position: absolute;\n right: 16px;\n bottom: 8px;\n\n font-size: 14px;\n color:", ";\n }\n\n & > .ant-typography-copy:hover {\n color:", ";\n }\n }\n }\n ", "\n}\n"])), function (_ref) {
|
|
6
|
+
var theme = _ref.theme;
|
|
7
|
+
return "".concat(theme === null || theme === void 0 ? void 0 : theme.colorPrimary, " !important");
|
|
8
|
+
}, function (_ref2) {
|
|
9
|
+
var theme = _ref2.theme;
|
|
10
|
+
return "".concat(theme === null || theme === void 0 ? void 0 : theme.colorPrimaryHover, " !important");
|
|
11
|
+
}, function (_ref3) {
|
|
12
|
+
var theme = _ref3.theme;
|
|
13
|
+
return theme === null || theme === void 0 ? void 0 : theme.colorPrimary;
|
|
14
|
+
}, function (_ref4) {
|
|
15
|
+
var theme = _ref4.theme;
|
|
16
|
+
return "".concat(theme === null || theme === void 0 ? void 0 : theme.colorPrimary, " !important");
|
|
17
|
+
}, function (_ref5) {
|
|
18
|
+
var theme = _ref5.theme;
|
|
19
|
+
return "".concat(theme === null || theme === void 0 ? void 0 : theme.colorPrimaryHover, " !important");
|
|
20
|
+
}, function (_ref6) {
|
|
21
|
+
var theme = _ref6.theme;
|
|
22
|
+
var _ref7 = theme || {},
|
|
23
|
+
prefixCls = _ref7.prefixCls;
|
|
24
|
+
notification.config({
|
|
25
|
+
prefixCls: prefixCls
|
|
26
|
+
});
|
|
27
|
+
return "\n .".concat(prefixCls, "-notice-message {\n font-weight: 500 !important;\n }\n .").concat(prefixCls, "-notice-description {\n max-height: ~'calc(100vh - 160px)';\n overflow: auto;\n }\n ");
|
|
28
|
+
});
|