@antv/dumi-theme-antv 0.2.1 → 0.3.0-beta.1
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/LICENSE +21 -0
- package/README.md +32 -33
- package/dist/builtins/Playground/index.d.ts +24 -0
- package/{es/builtins/Example.js → dist/builtins/Playground/index.js} +40 -33
- package/dist/builtins/Playground/index.module.less +15 -0
- package/dist/context.d.ts +5 -0
- package/dist/context.js +2 -0
- package/dist/layouts/DocLayout.d.ts +7 -0
- package/dist/layouts/DocLayout.js +38 -0
- package/dist/layouts/entry/API.d.ts +10 -0
- package/dist/layouts/entry/API.js +12 -0
- package/dist/layouts/entry/Index.d.ts +7 -0
- package/dist/layouts/entry/Index.js +71 -0
- package/dist/layouts/entry/Manual.d.ts +8 -0
- package/dist/layouts/entry/Manual.js +14 -0
- package/dist/locales/en.json +98 -0
- package/dist/locales/zh.json +98 -0
- package/dist/pages/404.d.ts +6 -0
- package/dist/pages/404.js +14 -0
- package/dist/pages/Example/index.d.ts +6 -0
- package/dist/pages/Example/index.js +139 -0
- package/dist/pages/Example/index.module.less +40 -0
- package/dist/pages/Examples/components/Accouncement/index.d.ts +6 -0
- package/dist/pages/Examples/components/Accouncement/index.js +60 -0
- package/dist/pages/Examples/components/Accouncement/index.module.less +9 -0
- package/dist/pages/Examples/components/Article/index.d.ts +2 -0
- package/dist/pages/Examples/components/Article/index.js +8 -0
- package/dist/pages/Examples/components/Article/index.module.less +2 -0
- package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.d.ts +10 -0
- package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +74 -0
- package/dist/pages/Examples/components/ExampleTopicMenu/index.d.ts +9 -0
- package/{es/builtins/Table.js → dist/pages/Examples/components/ExampleTopicMenu/index.js} +47 -41
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.d.ts +10 -0
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +33 -0
- package/dist/pages/Examples/components/GalleryPageContent/index.d.ts +10 -0
- package/dist/pages/Examples/components/GalleryPageContent/index.js +81 -0
- package/dist/pages/Examples/index.d.ts +8 -0
- package/dist/pages/Examples/index.js +75 -0
- package/dist/pages/Examples/index.module.less +605 -0
- package/dist/pages/Examples/types.d.ts +33 -0
- package/dist/pages/Examples/types.js +1 -0
- package/dist/plugin/examples.d.ts +7 -0
- package/dist/plugin/examples.js +83 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.js +103 -0
- package/dist/slots/404.d.ts +2 -0
- package/{es/antv/404/index.js → dist/slots/404.js} +4 -9
- package/{es/antv/Cases/Cases.d.ts → dist/slots/Cases/index.d.ts} +4 -4
- package/{es/antv/Cases/Cases.js → dist/slots/Cases/index.js} +25 -25
- package/{src/antv/Cases/Cases.module.less → dist/slots/Cases/index.module.less} +36 -5
- package/dist/slots/CodeEditor/Toolbar.d.ts +67 -0
- package/dist/slots/CodeEditor/Toolbar.js +152 -0
- package/dist/slots/CodeEditor/Toolbar.module.less +81 -0
- package/dist/slots/CodeEditor/index.d.ts +58 -0
- package/dist/slots/CodeEditor/index.js +200 -0
- package/dist/slots/CodeEditor/index.module.less +11 -0
- package/dist/slots/CodeEditor/utils.d.ts +42 -0
- package/dist/slots/CodeEditor/utils.js +157 -0
- package/dist/slots/CodePreview/CodeHeader.d.ts +19 -0
- package/dist/slots/CodePreview/CodeHeader.js +32 -0
- package/dist/slots/CodePreview/CodeHeader.module.less +0 -0
- package/dist/slots/CodePreview/index.d.ts +17 -0
- package/dist/slots/CodePreview/index.js +29 -0
- package/dist/slots/CodePreview/index.module.less +42 -0
- package/dist/slots/CodeRunner/index.d.ts +14 -0
- package/dist/slots/CodeRunner/index.js +76 -0
- package/dist/slots/CodeRunner/index.module.less +0 -0
- package/dist/slots/CodeRunner/utils.d.ts +10 -0
- package/dist/slots/CodeRunner/utils.js +36 -0
- package/dist/slots/Companies/index.d.ts +13 -0
- package/dist/slots/Companies/index.js +49 -0
- package/dist/slots/Companies/index.module.less +82 -0
- package/dist/slots/Detail/News.d.ts +9 -0
- package/{es/antv/Banner/Notification.js → dist/slots/Detail/News.js} +8 -11
- package/{src/antv/Banner/Notification.module.less → dist/slots/Detail/News.module.less} +15 -3
- package/dist/slots/Detail/index.d.ts +26 -0
- package/dist/slots/Detail/index.js +124 -0
- package/{src/antv/Banner/Banner.module.less → dist/slots/Detail/index.module.less} +42 -74
- package/dist/slots/ExampleSider/index.d.ts +55 -0
- package/dist/slots/ExampleSider/index.js +218 -0
- package/dist/slots/ExampleSider/index.module.less +141 -0
- package/{es/antv → dist/slots}/Features/FeatureCard.d.ts +1 -1
- package/{es/antv → dist/slots}/Features/FeatureCard.js +6 -6
- package/{src/antv → dist/slots}/Features/FeatureCard.module.less +8 -1
- package/{es/antv → dist/slots}/Features/index.d.ts +2 -2
- package/{es/antv → dist/slots}/Features/index.js +17 -25
- package/{src/antv/Features/Features.module.less → dist/slots/Features/index.module.less} +34 -3
- package/dist/slots/Footer/index.d.ts +18 -0
- package/dist/slots/Footer/index.js +187 -0
- package/dist/slots/Footer/index.module.less +85 -0
- package/dist/slots/Header/Logo.d.ts +7 -0
- package/{es/antv → dist/slots}/Header/Logo.js +6 -2
- package/dist/slots/Header/LogoWhite.d.ts +7 -0
- package/dist/slots/Header/LogoWhite.js +19 -0
- package/dist/slots/Header/Navs.d.ts +17 -0
- package/dist/slots/Header/Navs.js +46 -0
- package/dist/slots/Header/Products/NavigatorBanner.d.ts +10 -0
- package/dist/slots/Header/Products/NavigatorBanner.js +34 -0
- package/dist/slots/Header/Products/NavigatorBanner.module.less +39 -0
- package/{es/antv → dist/slots/Header}/Products/Product.d.ts +3 -3
- package/{es/antv → dist/slots/Header}/Products/Product.js +11 -16
- package/{src/antv → dist/slots/Header}/Products/Product.module.less +10 -8
- package/{es/antv → dist/slots/Header}/Products/getProducts.d.ts +2 -7
- package/dist/slots/Header/Products/getProducts.js +67 -0
- package/dist/slots/Header/Products/index.d.ts +9 -0
- package/{es/antv → dist/slots/Header}/Products/index.js +15 -22
- package/dist/slots/Header/Search.d.ts +12 -0
- package/dist/slots/Header/Search.js +90 -0
- package/dist/slots/Header/Search.module.less +39 -0
- package/dist/slots/Header/index.d.ts +66 -0
- package/dist/slots/Header/index.js +379 -0
- package/dist/slots/Header/index.module.less +382 -0
- package/dist/slots/Header/utils.d.ts +1 -0
- package/dist/slots/Header/utils.js +26 -0
- package/dist/slots/Loading/index.d.ts +2 -0
- package/dist/slots/Loading/index.js +65 -0
- package/dist/slots/Loading/index.module.less +12 -0
- package/dist/slots/Loading.d.ts +5 -0
- package/dist/slots/Loading.js +8 -0
- package/dist/slots/ManualContent/NavigatorBanner.d.ts +9 -0
- package/dist/slots/ManualContent/NavigatorBanner.js +36 -0
- package/dist/slots/ManualContent/NavigatorBanner.module.less +39 -0
- package/dist/slots/ManualContent/ReadingTime.d.ts +3 -0
- package/dist/slots/ManualContent/ReadingTime.js +10 -0
- package/dist/slots/ManualContent/index.d.ts +9 -0
- package/dist/slots/ManualContent/index.js +321 -0
- package/dist/slots/ManualContent/index.module.less +656 -0
- package/dist/slots/TOC.d.ts +5 -0
- package/dist/slots/TOC.js +6 -0
- package/dist/slots/_.less +83 -0
- package/dist/slots/global.d.ts +1 -0
- package/dist/slots/global.js +7 -0
- package/dist/slots/hooks.d.ts +16 -0
- package/{es/antv → dist/slots}/hooks.js +60 -37
- package/dist/slots/utils.d.ts +20 -0
- package/dist/slots/utils.js +154 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +1 -0
- package/dist/typings.d.ts +137 -0
- package/package.json +108 -47
- package/es/antv/404/index.d.ts +0 -2
- package/es/antv/Banner/Banner.module.less +0 -412
- package/es/antv/Banner/Notification.d.ts +0 -10
- package/es/antv/Banner/Notification.module.less +0 -108
- package/es/antv/Banner/index.d.ts +0 -25
- package/es/antv/Banner/index.js +0 -104
- package/es/antv/Cases/Cases.module.less +0 -203
- package/es/antv/Features/FeatureCard.module.less +0 -51
- package/es/antv/Features/Features.module.less +0 -169
- package/es/antv/Footer/Footer.module.less +0 -36
- package/es/antv/Footer/index.d.ts +0 -12
- package/es/antv/Footer/index.js +0 -237
- package/es/antv/Header/Logo.d.ts +0 -4
- package/es/antv/Products/Product.module.less +0 -146
- package/es/antv/Products/getNewProducts.d.ts +0 -24
- package/es/antv/Products/getNewProducts.js +0 -35
- package/es/antv/Products/getProducts.js +0 -460
- package/es/antv/Products/index.d.ts +0 -9
- package/es/antv/hooks.d.ts +0 -14
- package/es/antv/mixins.less +0 -21
- package/es/antv/utils.d.ts +0 -5
- package/es/antv/utils.js +0 -49
- package/es/builtins/API.d.ts +0 -3
- package/es/builtins/API.js +0 -37
- package/es/builtins/Alert.d.ts +0 -3
- package/es/builtins/Alert.js +0 -7
- package/es/builtins/Alert.less +0 -62
- package/es/builtins/Badge.d.ts +0 -3
- package/es/builtins/Badge.js +0 -7
- package/es/builtins/Badge.less +0 -31
- package/es/builtins/Example.d.ts +0 -5
- package/es/builtins/Example.less +0 -47
- package/es/builtins/Previewer.d.ts +0 -39
- package/es/builtins/Previewer.js +0 -225
- package/es/builtins/Previewer.less +0 -406
- package/es/builtins/SourceCode.d.ts +0 -10
- package/es/builtins/SourceCode.js +0 -70
- package/es/builtins/SourceCode.less +0 -103
- package/es/builtins/Table.d.ts +0 -4
- package/es/builtins/Table.less +0 -43
- package/es/builtins/Tree.d.ts +0 -4
- package/es/builtins/Tree.js +0 -213
- package/es/builtins/Tree.less +0 -159
- package/es/components/Dark.d.ts +0 -9
- package/es/components/Dark.js +0 -125
- package/es/components/Dark.less +0 -121
- package/es/components/LocaleSelect.d.ts +0 -6
- package/es/components/LocaleSelect.js +0 -53
- package/es/components/LocaleSelect.less +0 -59
- package/es/components/Navbar.d.ts +0 -10
- package/es/components/Navbar.js +0 -155
- package/es/components/Navbar.less +0 -180
- package/es/components/SearchBar.d.ts +0 -4
- package/es/components/SearchBar.js +0 -81
- package/es/components/SearchBar.less +0 -165
- package/es/components/SideMenu.d.ts +0 -10
- package/es/components/SideMenu.js +0 -99
- package/es/components/SideMenu.less +0 -379
- package/es/components/SlugList.d.ts +0 -7
- package/es/components/SlugList.js +0 -38
- package/es/components/SlugList.less +0 -18
- package/es/declaration.d.ts +0 -1
- package/es/layout.d.ts +0 -5
- package/es/layout.js +0 -277
- package/es/style/layout.less +0 -402
- package/es/style/markdown.less +0 -240
- package/es/style/variables.less +0 -37
- package/src/antv/404/index.tsx +0 -25
- package/src/antv/Banner/Notification.tsx +0 -45
- package/src/antv/Banner/index.tsx +0 -139
- package/src/antv/Cases/Cases.tsx +0 -116
- package/src/antv/Features/FeatureCard.tsx +0 -24
- package/src/antv/Features/index.tsx +0 -86
- package/src/antv/Footer/Footer.module.less +0 -36
- package/src/antv/Footer/index.tsx +0 -272
- package/src/antv/Header/Logo.tsx +0 -85
- package/src/antv/Products/Product.tsx +0 -80
- package/src/antv/Products/getNewProducts.tsx +0 -53
- package/src/antv/Products/getProducts.tsx +0 -626
- package/src/antv/Products/index.tsx +0 -70
- package/src/antv/hooks.ts +0 -87
- package/src/antv/mixins.less +0 -21
- package/src/antv/utils.ts +0 -44
- package/src/builtins/API.tsx +0 -57
- package/src/builtins/Alert.less +0 -62
- package/src/builtins/Alert.tsx +0 -4
- package/src/builtins/Badge.less +0 -31
- package/src/builtins/Badge.tsx +0 -4
- package/src/builtins/Example.less +0 -47
- package/src/builtins/Example.tsx +0 -34
- package/src/builtins/Previewer.less +0 -406
- package/src/builtins/Previewer.tsx +0 -264
- package/src/builtins/SourceCode.less +0 -103
- package/src/builtins/SourceCode.tsx +0 -55
- package/src/builtins/Table.less +0 -43
- package/src/builtins/Table.tsx +0 -42
- package/src/builtins/Tree.less +0 -159
- package/src/builtins/Tree.tsx +0 -130
- package/src/components/Dark.less +0 -121
- package/src/components/Dark.tsx +0 -78
- package/src/components/LocaleSelect.less +0 -59
- package/src/components/LocaleSelect.tsx +0 -53
- package/src/components/Navbar.less +0 -180
- package/src/components/Navbar.tsx +0 -152
- package/src/components/SearchBar.less +0 -165
- package/src/components/SearchBar.tsx +0 -68
- package/src/components/SideMenu.less +0 -379
- package/src/components/SideMenu.tsx +0 -148
- package/src/components/SlugList.less +0 -18
- package/src/components/SlugList.tsx +0 -20
- package/src/declaration.d.ts +0 -1
- package/src/layout.tsx +0 -226
- package/src/style/layout.less +0 -402
- package/src/style/markdown.less +0 -240
- package/src/style/variables.less +0 -37
- package/src/test/SearchBar.test.ts +0 -32
- package/src/test/Table.test.tsx +0 -41
- package/src/test/index.test.tsx +0 -377
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
|
|
9
|
+
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."); }
|
|
10
|
+
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
|
|
13
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
+
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
|
|
17
|
+
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."); }
|
|
18
|
+
|
|
19
|
+
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); }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
24
|
+
|
|
25
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
+
|
|
27
|
+
import { Input, Menu, Tooltip } from 'antd';
|
|
28
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
29
|
+
import { useLocale } from 'dumi';
|
|
30
|
+
import { createFromIconfontCN, SearchOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
31
|
+
import classNames from 'classnames';
|
|
32
|
+
import { reduce, size } from 'lodash-es';
|
|
33
|
+
import { useT } from "../hooks";
|
|
34
|
+
import styles from "./index.module.less";
|
|
35
|
+
// menu icon
|
|
36
|
+
var MenuIcon = createFromIconfontCN({
|
|
37
|
+
scriptUrl: '//at.alicdn.com/t/font_470089_1lnym745udm.js' // generated by iconfont.cn
|
|
38
|
+
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* DEMO 预览页面的菜单
|
|
43
|
+
*/
|
|
44
|
+
export var ExampleSider = function ExampleSider(props) {
|
|
45
|
+
var currentDemo = props.currentDemo,
|
|
46
|
+
onDemoClicked = props.onDemoClicked,
|
|
47
|
+
exampleTopics = props.exampleTopics; // 菜单栏展开keys
|
|
48
|
+
|
|
49
|
+
var _useState = useState([]),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
openKeys = _useState2[0],
|
|
52
|
+
setOpenKeys = _useState2[1];
|
|
53
|
+
|
|
54
|
+
var menuRef = useRef(null); // 初始化点击进来的示例按钮a的dom
|
|
55
|
+
|
|
56
|
+
var _useState3 = useState(),
|
|
57
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
+
aRef = _useState4[0],
|
|
59
|
+
setARef = _useState4[1]; // input 搜索框的value
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
var _useState5 = useState(''),
|
|
63
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
64
|
+
searchValue = _useState6[0],
|
|
65
|
+
setSearchValue = _useState6[1];
|
|
66
|
+
|
|
67
|
+
var locale = useLocale(); // 查找符合条件的数据 从title和 searchValue 可以匹配 就返回 否自返回[]
|
|
68
|
+
|
|
69
|
+
var findSearchTreeData = function findSearchTreeData(data) {
|
|
70
|
+
return reduce(data, function (value, item) {
|
|
71
|
+
var _item$title;
|
|
72
|
+
|
|
73
|
+
if ((_item$title = item.title) !== null && _item$title !== void 0 && _item$title.match(searchValue)) {
|
|
74
|
+
return [].concat(_toConsumableArray(value), [item]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (item.children) {
|
|
78
|
+
var searchData = findSearchTreeData(item.children);
|
|
79
|
+
return size(searchData) ? [].concat(_toConsumableArray(value), [_objectSpread(_objectSpread({}, item), {}, {
|
|
80
|
+
children: searchData
|
|
81
|
+
})]) : value;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return value;
|
|
85
|
+
}, []);
|
|
86
|
+
}; // 获取默认展开的keys数组 传入treeData 和 底层的 key 返回符合条件的 keys
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
var getDefaultOpenKeys = function getDefaultOpenKeys(data, key) {
|
|
90
|
+
return reduce(data, function (value, item) {
|
|
91
|
+
if (item.children) {
|
|
92
|
+
var keys = getDefaultOpenKeys(item.children, key);
|
|
93
|
+
return keys.length ? [].concat(_toConsumableArray(value), [item.value], _toConsumableArray(keys)) : value;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return key === item.value ? [item.value] : value;
|
|
97
|
+
}, []);
|
|
98
|
+
}; // 初始化菜单栏展开keys
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
useEffect(function () {
|
|
102
|
+
var targetExample = currentDemo.targetExample,
|
|
103
|
+
targetTopic = currentDemo.targetTopic;
|
|
104
|
+
setOpenKeys(["TOPIC-".concat(targetTopic === null || targetTopic === void 0 ? void 0 : targetTopic.id), "EXAMPLE-".concat(targetExample === null || targetExample === void 0 ? void 0 : targetExample.id)]);
|
|
105
|
+
}, [currentDemo]); // 初始化滚动到中间
|
|
106
|
+
|
|
107
|
+
useEffect(function () {
|
|
108
|
+
if (aRef) {
|
|
109
|
+
aRef.scrollIntoView({
|
|
110
|
+
block: 'center',
|
|
111
|
+
behavior: 'smooth'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, [aRef]); // 获取搜索后的文本结构 左文本 + 搜索文本 + 右文本
|
|
115
|
+
|
|
116
|
+
var getSearchValueTitle = function getSearchValueTitle(title) {
|
|
117
|
+
return searchValue && title.match(searchValue) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, title.replace(new RegExp("".concat(searchValue, ".*")), '')), /*#__PURE__*/React.createElement("span", {
|
|
118
|
+
className: styles.searchValue
|
|
119
|
+
}, searchValue), /*#__PURE__*/React.createElement("span", null, title.replace(new RegExp(".*?".concat(searchValue)), ''))) : title;
|
|
120
|
+
}; // 图例按钮 + img + tooltip文本
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
var renderExampleDemoCard = function renderExampleDemoCard(demo) {
|
|
124
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
125
|
+
placement: "right",
|
|
126
|
+
title: getSearchValueTitle(demo.title[locale.id] || ''),
|
|
127
|
+
key: demo.id
|
|
128
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
129
|
+
ref: function ref(dom) {// TODO: DEAL WITH ME
|
|
130
|
+
// if (dom && !aRef && item.value === getPath(currentExample)) {
|
|
131
|
+
// setARef(dom);
|
|
132
|
+
// }
|
|
133
|
+
},
|
|
134
|
+
className: classNames(styles.card, _defineProperty({}, styles.current, currentDemo.id === demo.id))
|
|
135
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
className: classNames(styles.screenshot),
|
|
137
|
+
style: {
|
|
138
|
+
backgroundImage: "url(".concat(demo.screenshot || 'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/screenshot-placeholder-b8e70.png', ")")
|
|
139
|
+
},
|
|
140
|
+
title: demo.title[locale.id]
|
|
141
|
+
})));
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
var renderSubMenu = function renderSubMenu() {
|
|
145
|
+
return exampleTopics.map(function (topic) {
|
|
146
|
+
return /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
|
147
|
+
key: "TOPIC-".concat(topic.id),
|
|
148
|
+
title: /*#__PURE__*/React.createElement("div", null, topic.icon && /*#__PURE__*/React.createElement(MenuIcon, {
|
|
149
|
+
className: styles.menuIcon,
|
|
150
|
+
type: "icon-".concat(topic.icon)
|
|
151
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
152
|
+
className: classNames(styles.menuTitleContent, styles.subMenuTitleContent)
|
|
153
|
+
}, topic.title && getSearchValueTitle(topic.title[locale.id])))
|
|
154
|
+
}, topic.examples.map(function (example) {
|
|
155
|
+
return /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
|
156
|
+
key: "EXAMPLE-".concat(example.id),
|
|
157
|
+
title: example.title[locale.id]
|
|
158
|
+
}, example.demos.map(function (demo) {
|
|
159
|
+
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
160
|
+
key: "DEMO-".concat(demo.id),
|
|
161
|
+
style: {
|
|
162
|
+
height: 70,
|
|
163
|
+
padding: 0,
|
|
164
|
+
cursor: 'pointer'
|
|
165
|
+
},
|
|
166
|
+
onClick: function onClick() {
|
|
167
|
+
onDemoClicked(_objectSpread(_objectSpread({}, demo), {}, {
|
|
168
|
+
targetExample: example,
|
|
169
|
+
targetTopic: topic
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
173
|
+
className: styles.menuTitleContent
|
|
174
|
+
}, renderExampleDemoCard(demo)));
|
|
175
|
+
}));
|
|
176
|
+
}));
|
|
177
|
+
});
|
|
178
|
+
}; // 搜索栏
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
var renderSearchBar = function renderSearchBar() {
|
|
182
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
183
|
+
className: styles.searchSider
|
|
184
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
185
|
+
size: "small",
|
|
186
|
+
placeholder: useT('搜索…'),
|
|
187
|
+
prefix: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
188
|
+
value: searchValue,
|
|
189
|
+
onChange: function onChange(e) {
|
|
190
|
+
return setSearchValue(e.target.value);
|
|
191
|
+
}
|
|
192
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
193
|
+
placement: "right",
|
|
194
|
+
title: useT('收起所有')
|
|
195
|
+
}, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, {
|
|
196
|
+
className: styles.searchSiderIcon,
|
|
197
|
+
onClick: function onClick() {
|
|
198
|
+
return setOpenKeys([]);
|
|
199
|
+
}
|
|
200
|
+
})));
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
204
|
+
className: classNames(styles.shadowWrapper)
|
|
205
|
+
}, renderSearchBar(), /*#__PURE__*/React.createElement(Menu, {
|
|
206
|
+
ref: menuRef,
|
|
207
|
+
mode: "inline",
|
|
208
|
+
style: {
|
|
209
|
+
width: '100%'
|
|
210
|
+
},
|
|
211
|
+
className: styles.siderbarMenu,
|
|
212
|
+
openKeys: openKeys,
|
|
213
|
+
selectedKeys: ["DEMO-".concat(currentDemo.id)],
|
|
214
|
+
onOpenChange: function onOpenChange(keys) {
|
|
215
|
+
setOpenKeys(keys);
|
|
216
|
+
}
|
|
217
|
+
}, renderSubMenu()));
|
|
218
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
@import '~antd/es/style/themes/default.less';
|
|
2
|
+
|
|
3
|
+
.shadowWrapper {
|
|
4
|
+
position: relative;
|
|
5
|
+
margin-bottom: 12px;
|
|
6
|
+
overflow: auto;
|
|
7
|
+
height: 100%;
|
|
8
|
+
|
|
9
|
+
&::before,
|
|
10
|
+
&::after {
|
|
11
|
+
content: '';
|
|
12
|
+
position: absolute;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
top: 0;
|
|
15
|
+
height: 100%;
|
|
16
|
+
box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0);
|
|
17
|
+
width: 1px;
|
|
18
|
+
transition: all 0.3s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&::before {
|
|
22
|
+
left: -1px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&::after {
|
|
26
|
+
right: -1px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.cards {
|
|
31
|
+
max-width: 100%;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
font-size: 0;
|
|
35
|
+
padding: 1px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.card {
|
|
39
|
+
display: flex;
|
|
40
|
+
width: 100px;
|
|
41
|
+
height: 70px;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
margin-left: 48px;
|
|
44
|
+
position: relative;
|
|
45
|
+
border: 1px solid #ebedf0;
|
|
46
|
+
transition: all 0.3s;
|
|
47
|
+
user-select: none;
|
|
48
|
+
background-color: #fff;
|
|
49
|
+
|
|
50
|
+
&:after {
|
|
51
|
+
transition: all 0.3s;
|
|
52
|
+
background-color: transparent;
|
|
53
|
+
border: 1px solid transparent;
|
|
54
|
+
content: '';
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: -1px;
|
|
57
|
+
bottom: -1px;
|
|
58
|
+
right: -1px;
|
|
59
|
+
left: -1px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
border-color: @primary-color;
|
|
64
|
+
|
|
65
|
+
&:before {
|
|
66
|
+
transition: all 0.3s;
|
|
67
|
+
content: '';
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: -1px;
|
|
70
|
+
bottom: -1px;
|
|
71
|
+
right: -1px;
|
|
72
|
+
left: -1px;
|
|
73
|
+
background-color: fade(@primary-color, 10%);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.screenshot {
|
|
78
|
+
background-size: contain;
|
|
79
|
+
background-repeat: no-repeat;
|
|
80
|
+
background-position: center;
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
|
|
87
|
+
.exampleDemoTitle {
|
|
88
|
+
white-space: pre-wrap;
|
|
89
|
+
line-height: 12px;
|
|
90
|
+
font-size: 10px;
|
|
91
|
+
text-align: center;
|
|
92
|
+
padding: 4px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:last-child {
|
|
97
|
+
margin-right: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.current::after {
|
|
101
|
+
background-color: fade(@primary-color, 10%);
|
|
102
|
+
border-color: @primary-color;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.searchSider {
|
|
107
|
+
height: 50px;
|
|
108
|
+
display: flex;
|
|
109
|
+
padding-left: 24px;
|
|
110
|
+
align-items: center;
|
|
111
|
+
background-color: #fff;
|
|
112
|
+
justify-content: space-between;
|
|
113
|
+
|
|
114
|
+
.searchSiderIcon {
|
|
115
|
+
margin: 0 15px;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.searchValue {
|
|
121
|
+
color: #873bf4;
|
|
122
|
+
font-weight: 500;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.siderbarMenu {
|
|
126
|
+
border: none;
|
|
127
|
+
|
|
128
|
+
.menuTitleContent {
|
|
129
|
+
display: inline-block;
|
|
130
|
+
width: 100%;
|
|
131
|
+
vertical-align: bottom;
|
|
132
|
+
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
text-overflow: ellipsis;
|
|
135
|
+
white-space: nowrap;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.subMenuTitleContent {
|
|
139
|
+
width: calc(100% - 16px);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import styles from
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { ic } from "../hooks";
|
|
4
|
+
import styles from "./FeatureCard.module.less";
|
|
5
5
|
|
|
6
6
|
var FeatureCard = function FeatureCard(_ref) {
|
|
7
7
|
var icon = _ref.icon,
|
|
@@ -12,14 +12,14 @@ var FeatureCard = function FeatureCard(_ref) {
|
|
|
12
12
|
}, /*#__PURE__*/React.createElement("div", {
|
|
13
13
|
className: styles.content
|
|
14
14
|
}, /*#__PURE__*/React.createElement("img", {
|
|
15
|
-
className:
|
|
15
|
+
className: cx(styles.icon, 'feature-logo'),
|
|
16
16
|
src: icon,
|
|
17
17
|
alt: "advantage"
|
|
18
18
|
}), /*#__PURE__*/React.createElement("p", {
|
|
19
19
|
className: styles.title
|
|
20
|
-
}, title), /*#__PURE__*/React.createElement("p", {
|
|
20
|
+
}, ic(title)), /*#__PURE__*/React.createElement("p", {
|
|
21
21
|
className: styles.description
|
|
22
|
-
}, description)));
|
|
22
|
+
}, ic(description))));
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export default FeatureCard;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
.card {
|
|
2
2
|
background-color: #fff;
|
|
3
3
|
height: auto;
|
|
4
|
+
|
|
4
5
|
.content {
|
|
5
6
|
padding-left: 15.9%;
|
|
6
7
|
padding-right: 15.9%;
|
|
8
|
+
|
|
7
9
|
.icon {
|
|
8
10
|
height: 60px;
|
|
9
11
|
}
|
|
12
|
+
|
|
10
13
|
.title {
|
|
11
14
|
font-size: 1.714em;
|
|
12
15
|
color: #000;
|
|
13
16
|
margin-top: 40px;
|
|
14
17
|
margin-bottom: 0;
|
|
15
18
|
}
|
|
19
|
+
|
|
16
20
|
.description {
|
|
17
21
|
opacity: 0.6;
|
|
18
22
|
width: 100%;
|
|
@@ -30,14 +34,17 @@
|
|
|
30
34
|
.cardWrapper {
|
|
31
35
|
.card {
|
|
32
36
|
margin: 84px 19px 80px 19px;
|
|
37
|
+
|
|
33
38
|
.content {
|
|
34
39
|
.icon {
|
|
35
40
|
width: 25.6%;
|
|
36
41
|
}
|
|
42
|
+
|
|
37
43
|
.title {
|
|
38
44
|
font-size: 1.4em;
|
|
39
45
|
margin-top: 28px;
|
|
40
46
|
}
|
|
47
|
+
|
|
41
48
|
.description {
|
|
42
49
|
font-size: 1em;
|
|
43
50
|
padding-bottom: 0px;
|
|
@@ -48,4 +55,4 @@
|
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
}
|
|
51
|
-
}
|
|
58
|
+
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { Row, Col } from 'antd';
|
|
4
|
-
import
|
|
5
|
-
import FeatureCard from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var Features = function Features(_ref) {
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import FeatureCard from "./FeatureCard";
|
|
5
|
+
import styles from "./index.module.less";
|
|
6
|
+
export var Features = function Features(_ref) {
|
|
10
7
|
var title = _ref.title,
|
|
11
8
|
_ref$features = _ref.features,
|
|
12
9
|
features = _ref$features === void 0 ? [] : _ref$features,
|
|
@@ -21,7 +18,7 @@ var Features = function Features(_ref) {
|
|
|
21
18
|
key: card.title,
|
|
22
19
|
md: 8,
|
|
23
20
|
xs: 24
|
|
24
|
-
}, /*#__PURE__*/React.createElement(FeatureCard,
|
|
21
|
+
}, /*#__PURE__*/React.createElement(FeatureCard, card));
|
|
25
22
|
});
|
|
26
23
|
return children;
|
|
27
24
|
}; // for small screen
|
|
@@ -63,40 +60,35 @@ var Features = function Features(_ref) {
|
|
|
63
60
|
|
|
64
61
|
return /*#__PURE__*/React.createElement("div", {
|
|
65
62
|
id: id,
|
|
66
|
-
className:
|
|
63
|
+
className: cx(styles.wrapper, className),
|
|
67
64
|
style: style
|
|
68
65
|
}, title ? /*#__PURE__*/React.createElement("div", {
|
|
69
|
-
className:
|
|
66
|
+
className: cx(styles.lefttopWithTitle, styles.lefttop)
|
|
70
67
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
71
|
-
className:
|
|
68
|
+
className: cx(styles.lefttopWithoutTitle, styles.lefttop)
|
|
72
69
|
}), /*#__PURE__*/React.createElement("div", {
|
|
73
|
-
className:
|
|
70
|
+
className: cx(styles.rightbottomWithoutTitle, styles.rightbottom)
|
|
74
71
|
}, /*#__PURE__*/React.createElement("div", {
|
|
75
|
-
className:
|
|
72
|
+
className: cx(styles.slicerbar, styles.slicerbarv, styles.slicerbarv1)
|
|
76
73
|
}), /*#__PURE__*/React.createElement("div", {
|
|
77
|
-
className:
|
|
74
|
+
className: cx(styles.slicerbar, styles.slicerbarv, styles.slicerbarv2)
|
|
78
75
|
}), /*#__PURE__*/React.createElement("div", {
|
|
79
|
-
className:
|
|
76
|
+
className: cx(styles.slicerbar, styles.slicerbarh, styles.slicerbarh1)
|
|
80
77
|
}), /*#__PURE__*/React.createElement("div", {
|
|
81
|
-
className:
|
|
78
|
+
className: cx(styles.slicerbar, styles.slicerbarh, styles.slicerbarh2)
|
|
82
79
|
}), /*#__PURE__*/React.createElement("div", {
|
|
83
|
-
className:
|
|
80
|
+
className: cx(styles.slicerbar, styles.slicerbarh, styles.slicerbarh3)
|
|
84
81
|
}), /*#__PURE__*/React.createElement("div", {
|
|
85
|
-
className:
|
|
82
|
+
className: cx(styles.slicerbar, styles.slicerbarh, styles.slicerbarh4)
|
|
86
83
|
}), getDots()), /*#__PURE__*/React.createElement("div", {
|
|
87
84
|
className: styles.content
|
|
88
85
|
}, /*#__PURE__*/React.createElement("div", {
|
|
89
86
|
key: "content"
|
|
90
|
-
}, /*#__PURE__*/React.createElement("
|
|
91
|
-
key: "title",
|
|
92
|
-
className: styles.title
|
|
93
|
-
}, title), /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
94
88
|
key: "block",
|
|
95
89
|
className: styles.cardsContainer
|
|
96
90
|
}, /*#__PURE__*/React.createElement(Row, {
|
|
97
91
|
key: "cards",
|
|
98
92
|
className: styles.cards
|
|
99
93
|
}, getCards())))));
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export default Features;
|
|
94
|
+
};
|