@antv/dumi-theme-antv 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const Categories: ["basic", "extension", "ecology"];
|
|
3
|
+
export interface ProductCategory {
|
|
4
|
+
type: (typeof CATEGORY_TYPE)[number];
|
|
5
|
+
name: string;
|
|
6
|
+
products: ProductType[];
|
|
7
|
+
}
|
|
3
8
|
export interface ProductItem {
|
|
4
9
|
title: string;
|
|
5
10
|
icon?: React.ReactNode;
|
|
@@ -15,10 +20,7 @@ export interface ProductItem {
|
|
|
15
20
|
}
|
|
16
21
|
export type ValuesOf<T extends any[]> = T[number];
|
|
17
22
|
declare const CATEGORY_TYPE: ["basic", "extension", "mobile", "ecology"];
|
|
18
|
-
export declare const CATEGORIES: Array<
|
|
19
|
-
type: typeof CATEGORY_TYPE[number];
|
|
20
|
-
name: string;
|
|
21
|
-
}>;
|
|
23
|
+
export declare const CATEGORIES: Array<ProductCategory>;
|
|
22
24
|
export type ProductType = {
|
|
23
25
|
links: {
|
|
24
26
|
/** 产品首页 */
|
|
@@ -17,16 +17,20 @@ var ANTV_DOMAIN = 'antv.vision';
|
|
|
17
17
|
var CATEGORY_TYPE = tuple('basic', 'extension', 'mobile', 'ecology');
|
|
18
18
|
export var CATEGORIES = [{
|
|
19
19
|
type: 'basic',
|
|
20
|
-
name: '标准版基础产品'
|
|
20
|
+
name: '标准版基础产品',
|
|
21
|
+
products: []
|
|
21
22
|
}, {
|
|
22
23
|
type: 'extension',
|
|
23
|
-
name: '标准版扩展产品'
|
|
24
|
+
name: '标准版扩展产品',
|
|
25
|
+
products: []
|
|
24
26
|
}, {
|
|
25
27
|
type: 'mobile',
|
|
26
|
-
name: '移动定制(F版)产品'
|
|
28
|
+
name: '移动定制(F版)产品',
|
|
29
|
+
products: []
|
|
27
30
|
}, {
|
|
28
31
|
type: 'ecology',
|
|
29
|
-
name: '周边生态'
|
|
32
|
+
name: '周边生态',
|
|
33
|
+
products: []
|
|
30
34
|
}];
|
|
31
35
|
export function getNewProducts(_ref) {
|
|
32
36
|
var language = _ref.language,
|
|
@@ -24,9 +24,9 @@ export var Products = function Products(_ref) {
|
|
|
24
24
|
var _useChinaMirrorHost = useChinaMirrorHost(),
|
|
25
25
|
_useChinaMirrorHost2 = _slicedToArray(_useChinaMirrorHost, 1),
|
|
26
26
|
isChinaMirrorHost = _useChinaMirrorHost2[0];
|
|
27
|
-
var _React$useState = React.useState(
|
|
27
|
+
var _React$useState = React.useState(CATEGORIES),
|
|
28
28
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
29
|
-
|
|
29
|
+
productsCategoty = _React$useState2[0],
|
|
30
30
|
setProducts = _React$useState2[1];
|
|
31
31
|
var lang = locale.id === 'zh' ? 'zh' : 'en';
|
|
32
32
|
React.useEffect(function () {
|
|
@@ -34,23 +34,33 @@ export var Products = function Products(_ref) {
|
|
|
34
34
|
language: lang,
|
|
35
35
|
isChinaMirrorHost: isChinaMirrorHost
|
|
36
36
|
}).then(function (data) {
|
|
37
|
-
|
|
37
|
+
var newProducts = CATEGORIES.map(function (_ref2) {
|
|
38
|
+
var name = _ref2.name,
|
|
39
|
+
type = _ref2.type;
|
|
40
|
+
return {
|
|
41
|
+
name: name,
|
|
42
|
+
type: type,
|
|
43
|
+
products: data.filter(function (item) {
|
|
44
|
+
return item.category === type;
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
setProducts(newProducts);
|
|
38
49
|
});
|
|
39
50
|
}, [lang, isChinaMirrorHost]);
|
|
40
51
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
41
52
|
className: cx(styles.products, className, _defineProperty(_defineProperty({}, styles.show, !!show), styles.bannerVisible, !!bannerVisible))
|
|
42
53
|
}, /*#__PURE__*/React.createElement("div", {
|
|
43
54
|
className: styles.container
|
|
44
|
-
},
|
|
45
|
-
var name =
|
|
46
|
-
type =
|
|
47
|
-
|
|
55
|
+
}, productsCategoty.map(function (_ref3, idx) {
|
|
56
|
+
var name = _ref3.name,
|
|
57
|
+
type = _ref3.type,
|
|
58
|
+
products = _ref3.products;
|
|
59
|
+
return products.length ? /*#__PURE__*/React.createElement(React.Fragment, {
|
|
48
60
|
key: idx
|
|
49
61
|
}, /*#__PURE__*/React.createElement("h3", null, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
50
62
|
id: name
|
|
51
|
-
})), /*#__PURE__*/React.createElement("ul", null, products.
|
|
52
|
-
return item.category === type;
|
|
53
|
-
}).map(function (product) {
|
|
63
|
+
})), /*#__PURE__*/React.createElement("ul", null, products.map(function (product) {
|
|
54
64
|
var _product$links;
|
|
55
65
|
return /*#__PURE__*/React.createElement(Product, {
|
|
56
66
|
key: product.title,
|
|
@@ -62,7 +72,7 @@ export var Products = function Products(_ref) {
|
|
|
62
72
|
links: product.links,
|
|
63
73
|
language: language || locale.id
|
|
64
74
|
});
|
|
65
|
-
})));
|
|
75
|
+
}))) : null;
|
|
66
76
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
67
77
|
className: styles.mask
|
|
68
78
|
}));
|