@antv/dumi-theme-antv 0.7.9 → 0.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/builtins/Playground/index.js +1 -1
  2. package/dist/common/styles/Common.js +1 -1
  3. package/dist/common/styles/theme.js +1 -1
  4. package/dist/components/AI/HomeDialog/AntVBanner/index.js +4 -0
  5. package/dist/components/AI/HomeDialog/AntVBanner/index.module.less +35 -0
  6. package/dist/components/AI/HomeDialog/ModeSelector/index.js +29 -0
  7. package/dist/components/AI/HomeDialog/ModeSelector/index.module.less +272 -0
  8. package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.js +51 -0
  9. package/dist/components/AI/HomeDialog/PromptTextarea/ChooseLib/index.module.less +5 -0
  10. package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.js +25 -0
  11. package/dist/components/AI/HomeDialog/PromptTextarea/DatasourceCard/index.module.less +42 -0
  12. package/dist/components/AI/HomeDialog/PromptTextarea/SendButton.js +23 -0
  13. package/dist/components/AI/HomeDialog/PromptTextarea/SendButton.module.less +9 -0
  14. package/dist/components/AI/HomeDialog/PromptTextarea/index.js +132 -0
  15. package/dist/components/AI/HomeDialog/PromptTextarea/index.module.less +127 -0
  16. package/dist/components/AI/HomeDialog/RecommendCase/Card.js +70 -0
  17. package/dist/components/AI/HomeDialog/RecommendCase/card.module.less +131 -0
  18. package/dist/components/AI/HomeDialog/RecommendCase/index.js +76 -0
  19. package/dist/components/AI/HomeDialog/RecommendCase/index.module.less +43 -0
  20. package/dist/components/AI/HomeDialog/RecommendCase/recommend.json +42 -0
  21. package/dist/components/AI/HomeDialog/index.js +65 -0
  22. package/dist/components/AI/HomeDialog/index.module.less +3 -0
  23. package/dist/components/AI/constant.js +35 -0
  24. package/dist/components/AI/index.js +1 -0
  25. package/dist/components/AI/types.js +1 -0
  26. package/dist/components/AI/utils.js +38 -0
  27. package/dist/hooks/useProducts.js +18 -0
  28. package/dist/hooks/useStreamingText.js +119 -0
  29. package/dist/hooks/useVisionsnapSdk.js +159 -0
  30. package/dist/layouts/DocLayout.js +0 -1
  31. package/dist/layouts/GlobalLayout/index.js +15 -0
  32. package/dist/model/AIChat.js +214 -0
  33. package/dist/pages/AIPlayground/components/ConversationsMenu/index.js +146 -0
  34. package/dist/pages/AIPlayground/components/ConversationsMenu/index.module.less +44 -0
  35. package/dist/pages/AIPlayground/components/MarkdownComponent/MarkdownCodeBlock.js +65 -0
  36. package/dist/pages/AIPlayground/components/MarkdownComponent/index.js +47 -0
  37. package/dist/pages/AIPlayground/components/MsgBox/index.js +187 -0
  38. package/dist/pages/AIPlayground/components/MsgBox/index.module.less +42 -0
  39. package/dist/pages/AIPlayground/components/SessionLayout/index.js +25 -0
  40. package/dist/pages/AIPlayground/components/SessionLayout/index.module.less +34 -0
  41. package/dist/pages/AIPlayground/components/TaskBox/generateCode.js +110 -0
  42. package/dist/pages/AIPlayground/components/TaskBox/index.js +60 -0
  43. package/dist/pages/AIPlayground/components/TaskBox/index.module.less +8 -0
  44. package/dist/pages/AIPlayground/demo.js +34 -0
  45. package/dist/pages/AIPlayground/index.js +9 -0
  46. package/dist/pages/AIPlayground/index.module.less +0 -0
  47. package/dist/pages/Examples/index.module.less +2 -2
  48. package/dist/pages/Index/components/Cases/index.module.less +1 -1
  49. package/dist/pages/Index/components/Companies/index.module.less +1 -1
  50. package/dist/pages/Index/components/Features/index.module.less +1 -1
  51. package/dist/pages/Index/index.js +1 -1
  52. package/dist/plugin/index.js +14 -6
  53. package/dist/slots/Banner/index.module.less +1 -1
  54. package/dist/slots/CodeEditor/Toolbar.js +6 -2
  55. package/dist/slots/CodeEditor/Toolbar.module.less +6 -0
  56. package/dist/slots/CodeEditor/index.js +28 -2
  57. package/dist/slots/CodeEditor/index.module.less +22 -0
  58. package/dist/{pages/Index/components → slots}/Detail/News.js +1 -1
  59. package/dist/{pages/Index/components → slots}/Detail/index.js +11 -28
  60. package/dist/{pages/Index/components → slots}/Detail/index.module.less +13 -7
  61. package/dist/slots/Footer/index.module.less +1 -1
  62. package/dist/slots/Header/Products/Product.module.less +1 -1
  63. package/dist/slots/Header/Products/getProducts.js +20 -26
  64. package/dist/slots/Header/Products/index.js +20 -16
  65. package/dist/slots/Header/Search/SearchResult.js +35 -14
  66. package/dist/slots/Header/Search/index.js +2 -1
  67. package/dist/slots/Header/index.module.less +2 -2
  68. package/dist/typings.d.ts +5 -0
  69. package/package.json +21 -2
  70. /package/dist/{pages/Index/components → slots}/Detail/News.module.less +0 -0
@@ -0,0 +1,132 @@
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 _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ 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); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ 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."); }
7
+ 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); }
8
+ 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; }
9
+ 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; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { DatasourceCard } from "./DatasourceCard";
12
+ import { useEventListener } from 'ahooks';
13
+ import { message, Tooltip, Upload } from 'antd';
14
+ import classnames from 'classnames';
15
+ import _ from 'lodash';
16
+ import React, { useState } from 'react';
17
+ import styles from "./index.module.less";
18
+ import { SendButton } from "./SendButton";
19
+ import { AIMode, FileIcons } from "../../constant";
20
+ import { ChooseLib } from "./ChooseLib";
21
+ import { useSiteData } from 'dumi';
22
+ import { ic } from "../../../../slots/hooks";
23
+ var PLACEHOLDER = {
24
+ implement: '今天,你想可视化什么?',
25
+ solve: '今天,你想解决什么可视化问题?'
26
+ };
27
+ function PromptTextarea(props) {
28
+ var value = props.value,
29
+ size = props.size,
30
+ _onChange = props.onChange,
31
+ onConfirm = props.onConfirm,
32
+ onCancel = props.onCancel,
33
+ loading = props.loading,
34
+ fileMeta = props.fileMeta,
35
+ mode = props.mode,
36
+ lib = props.lib,
37
+ onLibChange = props.onLibChange,
38
+ _props$showAction = props.showAction,
39
+ showAction = _props$showAction === void 0 ? true : _props$showAction;
40
+ var _useState = useState(false),
41
+ _useState2 = _slicedToArray(_useState, 2),
42
+ showError = _useState2[0],
43
+ setShowError = _useState2[1];
44
+ var _useState3 = useState(false),
45
+ _useState4 = _slicedToArray(_useState3, 2),
46
+ focus = _useState4[0],
47
+ setFocus = _useState4[1];
48
+ var isCompact = size === 'compact';
49
+ var _useSiteData = useSiteData(),
50
+ themeConfig = _useSiteData.themeConfig;
51
+ function renderDatasourceCard() {
52
+ if (((fileMeta === null || fileMeta === void 0 ? void 0 : fileMeta.type) === 'FILE' || (fileMeta === null || fileMeta === void 0 ? void 0 : fileMeta.type) === 'IMAGE') && fileMeta !== null && fileMeta !== void 0 && fileMeta.fileName) {
53
+ return /*#__PURE__*/React.createElement(DatasourceCard, {
54
+ type: fileMeta.type,
55
+ title: fileMeta.fileName,
56
+ desc: fileMeta.fileSize
57
+ });
58
+ } else {
59
+ return null;
60
+ }
61
+ }
62
+ var datasourceNode = renderDatasourceCard();
63
+ var promptTextValid = Boolean(value);
64
+ var send = function send() {
65
+ if (!promptTextValid) {
66
+ message.warning('请输入指令');
67
+ } else {
68
+ setShowError(false);
69
+ onConfirm === null || onConfirm === void 0 || onConfirm();
70
+ }
71
+ };
72
+ useEventListener('keydown', function (event) {
73
+ if (event.key === 'Enter') {
74
+ // 不区分 textarea 是否聚焦
75
+ if (!event.shiftKey && !event.isComposing && !loading) {
76
+ event.preventDefault();
77
+ send(); // 触发自定义事件
78
+ }
79
+ }
80
+ });
81
+ return /*#__PURE__*/React.createElement("div", {
82
+ className: classnames(styles.container, _defineProperty(_defineProperty(_defineProperty({}, styles.active, focus), styles.compact, isCompact), styles.withDatasource, Boolean(datasourceNode))),
83
+ style: props.style
84
+ }, datasourceNode && /*#__PURE__*/React.createElement("div", {
85
+ className: styles.header
86
+ }, datasourceNode), /*#__PURE__*/React.createElement("textarea", {
87
+ onFocus: function onFocus() {
88
+ return setFocus(true);
89
+ },
90
+ onBlur: function onBlur() {
91
+ return setFocus(false);
92
+ },
93
+ id: "prompt-textarea",
94
+ className: classnames(styles.promptTextarea),
95
+ placeholder: !isCompact && !themeConfig.isAntVSite && ic(themeConfig.metas.description) || _.get(PLACEHOLDER, mode, '今天,你想可视化什么?'),
96
+ value: value,
97
+ onChange: function onChange(evt) {
98
+ _onChange(evt.target.value);
99
+ }
100
+ }), /*#__PURE__*/React.createElement("div", {
101
+ className: styles.footer
102
+ }, /*#__PURE__*/React.createElement("div", {
103
+ className: styles.dataActions
104
+ }, showAction && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ChooseLib, {
105
+ value: lib,
106
+ onChange: onLibChange,
107
+ size: size
108
+ }), mode === AIMode.implement && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
109
+ title: isCompact && '上传数据'
110
+ }, /*#__PURE__*/React.createElement(Upload, null, /*#__PURE__*/React.createElement("button", {
111
+ type: "button"
112
+ }, /*#__PURE__*/React.createElement("img", {
113
+ src: FileIcons.FILE
114
+ }), " ", !isCompact && '上传数据'))), /*#__PURE__*/React.createElement(Tooltip, {
115
+ title: isCompact && '上传图片'
116
+ }, /*#__PURE__*/React.createElement(Upload, null, /*#__PURE__*/React.createElement("button", {
117
+ type: "button"
118
+ }, /*#__PURE__*/React.createElement("img", {
119
+ src: FileIcons.IMAGE
120
+ }), " ", !isCompact && '上传图片')))))), /*#__PURE__*/React.createElement("div", {
121
+ className: styles.actions
122
+ }, loading ? /*#__PURE__*/React.createElement("img", {
123
+ className: styles.actionBtn,
124
+ onClick: onCancel,
125
+ src: "https://mdn.alipayobjects.com/huamei_2yzvel/afts/img/A*Yin-QLza5hMAAAAAQBAAAAgAeriAAQ/original"
126
+ }) : /*#__PURE__*/React.createElement(SendButton, {
127
+ onClick: send,
128
+ disabled: !promptTextValid,
129
+ tip: !promptTextValid ? "\u8BF7\u8F93\u5165\u5185\u5BB9\u540E\u53D1\u9001\u6307\u4EE4" : undefined
130
+ }))));
131
+ }
132
+ export { PromptTextarea };
@@ -0,0 +1,127 @@
1
+ .container {
2
+ position: relative;
3
+ margin: 0 auto;
4
+ width: 760px;
5
+ height: 144px;
6
+ font-size: 0;
7
+ padding: 16px;
8
+ gap: 16px;
9
+ transition: all 0.2s;
10
+ border: 1px solid rgba(134, 144, 156, 0.2);
11
+ border-radius: 16px;
12
+ background: #ffffff99;
13
+ box-shadow: 8px 8px 20px 0px #0000000a, inset 1px -1px 0 0px #ffffffe3;
14
+ z-index: 10;
15
+ display: flex;
16
+ flex-direction: column;
17
+
18
+ &.withDatasource {
19
+ height: 184px;
20
+ }
21
+
22
+ .header {
23
+ > div {
24
+ max-width: 300px;
25
+ }
26
+ }
27
+
28
+ .footer {
29
+ display: flex;
30
+ flex-direction: row;
31
+ justify-content: space-between;
32
+ height: 32px;
33
+
34
+ .dataActions {
35
+ display: flex;
36
+ gap: 8px;
37
+
38
+ :global {
39
+ button {
40
+ display: inline-flex;
41
+ align-items: center;
42
+ height: 32px;
43
+ padding: 0 12px;
44
+ border-radius: 8px;
45
+ outline: none;
46
+ max-width: 240px;
47
+ background: #3f4b660a;
48
+ font-size: 14px;
49
+ color: #1d2129;
50
+ border-color: transparent;
51
+
52
+ &.btn-error {
53
+ color: #ff4d4f;
54
+ box-shadow: inset 1px -1px 0 0 rgba(255, 255, 255, 0.89),
55
+ 0 0 12px 0 rgba(250, 16, 16, 0.23);
56
+ }
57
+
58
+ .btn-icon,
59
+ img {
60
+ display: block;
61
+ width: 20px;
62
+ height: 20px;
63
+ margin-right: 4px;
64
+ }
65
+
66
+ span {
67
+ white-space: nowrap;
68
+ overflow: hidden;
69
+ text-overflow: ellipsis;
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ &.active {
77
+ background: #ffffff99;
78
+ border: 1px solid #1677ff;
79
+ box-shadow: 0px 8px 20px 0px #1677ff29, inset 1px -1px 0 0px #ffffffe3;
80
+
81
+ .promptTextarea::placeholder {
82
+ color: transparent;
83
+ }
84
+ }
85
+
86
+ &.compact {
87
+ margin-bottom: 0;
88
+ padding: 8px 12px;
89
+ gap: 6px;
90
+ width: 100%;
91
+ height: 124px;
92
+
93
+ &.withDatasource {
94
+ height: 160px;
95
+ }
96
+
97
+ .promptTextarea {
98
+ font-size: 14px;
99
+ }
100
+ }
101
+ }
102
+
103
+ .datasourceBtn {
104
+ position: absolute;
105
+ left: 20px;
106
+ bottom: 20px;
107
+ width: 10px;
108
+ height: 10px;
109
+ background-color: red;
110
+ }
111
+
112
+ .promptTextarea {
113
+ flex: 1 1;
114
+ display: block;
115
+ font-size: 16px;
116
+ color: #1d2129;
117
+ width: 100%;
118
+ resize: none;
119
+ border: none;
120
+ outline: none;
121
+ padding: 0;
122
+ background: transparent;
123
+
124
+ &::placeholder {
125
+ color: rgba(122, 132, 153, 0.85);
126
+ }
127
+ }
@@ -0,0 +1,70 @@
1
+ import { Popover } from 'antd';
2
+ import React from 'react';
3
+ import styles from "./card.module.less";
4
+ import { BarChartOutlined, QuestionCircleOutlined } from "@ant-design/icons";
5
+ import { AIMode, AIModeMeta, COLORS } from "../../constant";
6
+ export var Card = function Card(_ref) {
7
+ var _AIModeMeta$tag;
8
+ var item = _ref.item,
9
+ index = _ref.index;
10
+ var query = item.query,
11
+ description = item.description,
12
+ _item$imageUrls = item.imageUrls,
13
+ imageUrls = _item$imageUrls === void 0 ? [] : _item$imageUrls,
14
+ link = item.link,
15
+ tag = item.tag;
16
+ var style = COLORS[index];
17
+ var handleClick = function handleClick(e) {
18
+ e.stopPropagation();
19
+ var urlObj = new URL(location.href);
20
+ urlObj.hash = "";
21
+ window.open(urlObj.toString(), '_blank');
22
+ };
23
+ var popoverContent = /*#__PURE__*/React.createElement("div", {
24
+ className: styles.popoverContent
25
+ }, /*#__PURE__*/React.createElement("div", {
26
+ className: styles.popoverItem
27
+ }, /*#__PURE__*/React.createElement("div", {
28
+ className: styles.popoverLabel
29
+ }, "\u6848\u4F8B\u540D"), /*#__PURE__*/React.createElement("div", {
30
+ className: styles.popoverValue
31
+ }, query)), /*#__PURE__*/React.createElement("div", {
32
+ className: styles.popoverItem
33
+ }, /*#__PURE__*/React.createElement("div", {
34
+ className: styles.popoverLabel
35
+ }, "\u63CF\u8FF0\u4FE1\u606F"), /*#__PURE__*/React.createElement("div", {
36
+ className: styles.popoverValue
37
+ }, description)));
38
+ return /*#__PURE__*/React.createElement(Popover, {
39
+ content: popoverContent,
40
+ placement: "top",
41
+ overlayClassName: styles.popoverOverlay
42
+ }, /*#__PURE__*/React.createElement("div", {
43
+ className: styles.card,
44
+ style: {
45
+ background: style === null || style === void 0 ? void 0 : style.backgroundColor
46
+ },
47
+ onClick: handleClick
48
+ }, /*#__PURE__*/React.createElement("div", {
49
+ className: styles.typeTag,
50
+ style: style
51
+ }, tag === AIMode.implement ? /*#__PURE__*/React.createElement(BarChartOutlined, {
52
+ className: styles.typeIcon
53
+ }) : /*#__PURE__*/React.createElement(QuestionCircleOutlined, {
54
+ className: styles.typeIcon
55
+ }), /*#__PURE__*/React.createElement("span", {
56
+ className: styles.typeText
57
+ }, ((_AIModeMeta$tag = AIModeMeta[tag]) === null || _AIModeMeta$tag === void 0 ? void 0 : _AIModeMeta$tag.name) || tag)), /*#__PURE__*/React.createElement("div", {
58
+ className: styles.title
59
+ }, query), /*#__PURE__*/React.createElement("div", {
60
+ className: styles.imageContainer
61
+ }, imageUrls.slice(0, 2).map(function (item, idx) {
62
+ return /*#__PURE__*/React.createElement("img", {
63
+ src: item,
64
+ key: idx,
65
+ className: styles["image".concat(idx)]
66
+ });
67
+ })), /*#__PURE__*/React.createElement("div", {
68
+ className: styles.hoverMask
69
+ })));
70
+ };
@@ -0,0 +1,131 @@
1
+ .card {
2
+ padding: 16px;
3
+ min-width: 0;
4
+ border-radius: 16px;
5
+ display: flex;
6
+ flex-direction: column;
7
+ cursor: pointer;
8
+ overflow: hidden;
9
+ position: relative;
10
+ aspect-ratio: 292 / 208;
11
+ background: rgba(22, 119, 255, 0.06);
12
+
13
+ .typeTag {
14
+ display: flex;
15
+ align-items: center;
16
+ gap: 8px;
17
+ width: fit-content;
18
+ padding: 2px 8px;
19
+ border-radius: 6px;
20
+ box-shadow: inset 1px 1px 4px 0 rgba(0, 0, 0, 4%),
21
+ 1px 1px 1px rgba(255, 255, 255, 40%);
22
+ font-size: 12px;
23
+ line-height: 20px;
24
+ margin-bottom: 12px;
25
+
26
+ .typeIcon {
27
+ display: flex;
28
+
29
+ svg {
30
+ width: 14px;
31
+ height: 14px;
32
+ }
33
+ }
34
+
35
+ .typeText {
36
+ white-space: nowrap;
37
+ }
38
+ }
39
+
40
+ .title {
41
+ font-size: 14px;
42
+ color: #1d2129e3;
43
+ line-height: 20px;
44
+ font-weight: 500;
45
+ .textEllipsis();
46
+ }
47
+
48
+ .imageContainer {
49
+ position: relative;
50
+ margin-top: 16px;
51
+
52
+ .image0,
53
+ .image1 {
54
+ width: 80%;
55
+ position: absolute;
56
+ object-fit: cover;
57
+ border-radius: 12px;
58
+ }
59
+
60
+ .image0 {
61
+ transform: translate(24%, 24px);
62
+ }
63
+
64
+ .image1 {
65
+ transform: translate(4%, 0) rotate(-4deg);
66
+ }
67
+ }
68
+ }
69
+
70
+ .hoverMask {
71
+ position: absolute;
72
+ left: 0;
73
+ right: 0;
74
+ bottom: 0;
75
+ height: 40px;
76
+ background: linear-gradient(
77
+ to top,
78
+ rgba(255, 255, 255, 40%) 0%,
79
+ rgba(255, 255, 255, 20%) 36%,
80
+ transparent 100%
81
+ );
82
+ }
83
+
84
+ .popoverOverlay {
85
+ :global {
86
+ .ant-popover-inner {
87
+ border: 1px solid rgba(31, 59, 99, 10%);
88
+ background: #fff;
89
+ border-radius: 16px;
90
+ box-shadow: 0 9px 20px 8px #000a1a0d;
91
+ }
92
+
93
+ .ant-popover-inner-content {
94
+ padding: 16px;
95
+ }
96
+
97
+ .ant-popover-arrow {
98
+ display: none;
99
+ }
100
+ }
101
+
102
+ .popoverContent {
103
+ max-width: 372px;
104
+
105
+ .popoverItem {
106
+ display: flex;
107
+ gap: 4px;
108
+ align-items: baseline;
109
+
110
+ .popoverLabel {
111
+ font-size: 12px;
112
+ color: #1d2129e6;
113
+ line-height: 22px;
114
+ font-weight: 500;
115
+ min-width: 56px;
116
+ }
117
+
118
+ .popoverValue {
119
+ font-size: 12px;
120
+ color: #1d2129cc;
121
+ line-height: 20px;
122
+ }
123
+ }
124
+ }
125
+ }
126
+
127
+ .textEllipsis {
128
+ overflow: hidden;
129
+ text-overflow: ellipsis;
130
+ white-space: nowrap;
131
+ }
@@ -0,0 +1,76 @@
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ 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."); }
7
+ 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); }
8
+ 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; }
9
+ 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; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { Spin } from 'antd';
12
+ import React, { useCallback, useEffect, useState } from 'react';
13
+ import { Card } from "./Card";
14
+ import styles from "./index.module.less";
15
+ import { RedoOutlined } from "@ant-design/icons";
16
+ import RecommendJson from "./recommend.json";
17
+ import classnames from "classnames";
18
+ export var RecommendCase = function RecommendCase(props) {
19
+ var _useState = useState(false),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ loading = _useState2[0],
22
+ setLoading = _useState2[1];
23
+ var _useState3 = useState([]),
24
+ _useState4 = _slicedToArray(_useState3, 2),
25
+ list = _useState4[0],
26
+ setList = _useState4[1];
27
+ var fetchList = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
28
+ var data;
29
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
30
+ while (1) switch (_context.prev = _context.next) {
31
+ case 0:
32
+ try {
33
+ setLoading(true);
34
+ data = RecommendJson;
35
+ setList(data.slice(0, 4));
36
+ } catch (err) {
37
+ console.log(err);
38
+ } finally {
39
+ setLoading(false);
40
+ }
41
+ case 1:
42
+ case "end":
43
+ return _context.stop();
44
+ }
45
+ }, _callee);
46
+ })), [list]);
47
+ useEffect(function () {
48
+ fetchList();
49
+ }, []);
50
+ if (!list.length) {
51
+ return null;
52
+ }
53
+ return /*#__PURE__*/React.createElement("div", {
54
+ className: styles.container
55
+ }, /*#__PURE__*/React.createElement("div", {
56
+ className: styles.title
57
+ }, /*#__PURE__*/React.createElement("span", {
58
+ className: styles.quickStart
59
+ }, "\u7CBE\u9009\u6848\u4F8B"), /*#__PURE__*/React.createElement("span", {
60
+ className: styles.refresh,
61
+ onClick: function onClick() {
62
+ return fetchList();
63
+ }
64
+ }, /*#__PURE__*/React.createElement(RedoOutlined, null), "\u6362\u4E00\u6279")), /*#__PURE__*/React.createElement(Spin, {
65
+ spinning: loading,
66
+ wrapperClassName: classnames(styles.listContainer, props.className)
67
+ }, /*#__PURE__*/React.createElement("div", {
68
+ className: styles.list
69
+ }, list.map(function (item, index) {
70
+ return /*#__PURE__*/React.createElement(Card, {
71
+ key: item.caseId,
72
+ item: item,
73
+ index: index
74
+ });
75
+ }))));
76
+ };
@@ -0,0 +1,43 @@
1
+ .container {
2
+ margin-top: 32px;
3
+ margin-left: auto;
4
+ margin-right: auto;
5
+ }
6
+
7
+ .title {
8
+ display: flex;
9
+ align-items: end;
10
+ margin-bottom: 24px;
11
+ width: 760px;
12
+ margin-left: auto;
13
+ margin-right: auto;
14
+
15
+ .quickStart {
16
+ font-size: 20px;
17
+ color: #1d2129e3;
18
+ line-height: 30px;
19
+ font-weight: 600;
20
+ flex: 1;
21
+ text-align: center;
22
+ }
23
+
24
+ .refresh {
25
+ cursor: pointer;
26
+ line-height: 20px;
27
+ display: flex;
28
+ gap: 2px;
29
+ align-items: center;
30
+
31
+ font-size: 12px;
32
+ color: rgba(78, 89, 105, 0.6);
33
+ }
34
+ }
35
+
36
+ .listContainer {
37
+ width: 100%;
38
+ }
39
+ .list {
40
+ display: grid;
41
+ grid-template-columns: repeat(4, 1fr);
42
+ gap: 16px;
43
+ }
@@ -0,0 +1,42 @@
1
+ [
2
+ {
3
+ "caseId": "1",
4
+ "tag": "implement",
5
+ "query": "一个城市过去五年来的年度降雨量分别是:2016年800毫米,2017年900毫米,2018年700毫米,2019年1000毫米,2020年1100毫米。使用折线图描绘这些数据。",
6
+ "description": "自然语言描述需求,生成可视化代码",
7
+ "imageUrls": [
8
+ "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K5iUTrYme5QAAAAAQpAAAAgAemJ7AQ/original",
9
+ "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K5iUTrYme5QAAAAAQpAAAAgAemJ7AQ/original"
10
+ ]
11
+ },
12
+ {
13
+ "caseId": "2",
14
+ "tag": "implement",
15
+ "query": "使用文件中的数据,生成柱状图",
16
+ "description": "多种数据源引入,专业图表生成,有数据就能生成图表。",
17
+ "imageUrls": [
18
+ "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K5iUTrYme5QAAAAAQpAAAAgAemJ7AQ/original",
19
+ "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K5iUTrYme5QAAAAAQpAAAAgAemJ7AQ/original"
20
+ ]
21
+ },
22
+ {
23
+ "caseId": "3",
24
+ "tag": "implement",
25
+ "query": "基于设计稿生成图表代码,还原视觉细节",
26
+ "description": "基于设计稿生成图表代码,还原视觉细节",
27
+ "imageUrls": [
28
+ "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K5iUTrYme5QAAAAAQpAAAAgAemJ7AQ/original",
29
+ "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K5iUTrYme5QAAAAAQpAAAAgAemJ7AQ/original"
30
+ ]
31
+ },
32
+ {
33
+ "caseId": "4",
34
+ "tag": "solve",
35
+ "query": "怎么配置堆叠面积图的描边为不同的颜色",
36
+ "description": "精准定位并提供针对渲染异常、性能瓶颈及数据不匹配等问题的解决方案。",
37
+ "imageUrls": [
38
+ "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K5iUTrYme5QAAAAAQpAAAAgAemJ7AQ/original",
39
+ "https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K5iUTrYme5QAAAAAQpAAAAgAemJ7AQ/original"
40
+ ]
41
+ }
42
+ ]