@daoyi/nmtl-ui 2.0.1-beta.9 → 2.0.1-beta.90
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/README.md +45 -45
- package/lib/components/Autocomplete-24e9686d.js +423 -0
- package/lib/components/Autocomplete.js +19 -1
- package/lib/components/Avatar.js +53 -1
- package/lib/components/BackTop.js +109 -1
- package/lib/components/BarChart.js +762 -1
- package/lib/components/Breadcrumbs.js +122 -1
- package/lib/components/Button-430d39e6.js +92 -0
- package/lib/components/Button.js +6 -1
- package/lib/components/Carousel.js +4713 -1
- package/lib/components/Checkbox.js +37 -1
- package/lib/components/CollapseContent.js +179 -1
- package/lib/components/ContactModal-523ae294.js +12030 -0
- package/lib/components/ContactModal.js +22 -3
- package/lib/components/Drawer-ec47e780.js +156 -0
- package/lib/components/Drawer.js +11 -1
- package/lib/components/Dropdown.js +134 -1
- package/lib/components/Empty-dc5fc2fc.js +45 -0
- package/lib/components/Empty.js +5 -1
- package/lib/components/ExportButton.js +112 -1
- package/lib/components/ExtraTools-0ffc772b.js +3598 -0
- package/lib/components/ExtraTools.js +10 -22
- package/lib/components/Filter.js +782 -12
- package/lib/components/Footer.js +271 -1
- package/lib/components/ForwardLink-15222b22.js +106 -0
- package/lib/components/ForwardLink.js +8 -0
- package/lib/components/Header.js +194 -1
- package/lib/components/Image.js +61 -1
- package/lib/components/Input.js +82 -1
- package/lib/components/InputMethod.js +33937 -10
- package/lib/components/KeywordSearch-91167d24.js +144 -0
- package/lib/components/KeywordSearch.js +21 -1
- package/lib/components/KeywordTicker.js +190 -1
- package/lib/components/Keywords.js +317 -1
- package/lib/components/Loading.js +28 -1
- package/lib/components/MUITheme.js +2624 -1
- package/lib/components/Modal-6b8c72d7.js +108 -0
- package/lib/components/Modal.js +9 -1
- package/lib/components/MoreButton-4d5d94da.js +110 -0
- package/lib/components/MoreButton.js +6 -1
- package/lib/components/Pagination.js +3637 -0
- package/lib/components/Radio.js +78 -1
- package/lib/components/SNA.js +1691 -22
- package/lib/components/Select-7da870e0.js +115 -0
- package/lib/components/Select.js +8 -1
- package/lib/components/Spin-9a07b106.js +75 -0
- package/lib/components/Spin.js +6 -1
- package/lib/components/Table.js +51 -1
- package/lib/components/Tooltip-6d53cb6e.js +70 -0
- package/lib/components/Tooltip.js +7 -1
- package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
- package/lib/components/_rollupPluginBabelHelpers-ed61ffc0.js +160 -0
- package/lib/components/createSvgIcon-ff0e3b99.js +576 -0
- package/lib/components/dataExport-d55d6fa3.js +92 -0
- package/lib/components/debounce-127da66c.js +355 -0
- package/lib/components/defaultTheme-ed7746fe.js +1661 -0
- package/lib/components/globalConfig.js +191 -0
- package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
- package/lib/components/index-a6f22b92.js +481 -0
- package/lib/components/index-f491ebce.js +61 -0
- package/lib/components/isObjectLike-e111475d.js +190 -0
- package/lib/components/style-inject.es-1f59c1d0.js +28 -1
- package/lib/components/toConsumableArray-dbe8af76.js +19 -0
- package/lib/components/transform-3a04288b.js +5475 -0
- package/lib/components/withTheme-2d778133.js +6 -0
- package/lib/configs/config.selector.js +151 -0
- package/lib/configs/index.d.ts +1 -0
- package/lib/configs/index.js +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/utils/_rollupPluginBabelHelpers-a6e0e6e3.js +139 -0
- package/lib/utils/arrayMerge.js +4953 -1
- package/lib/utils/chunkArray.js +15 -1
- package/lib/utils/convert2HtmlEntities.js +42 -1
- package/lib/utils/domToImage.js +802 -1
- package/lib/utils/downloadGephi.js +106 -1
- package/lib/utils/exportXlsx.js +219 -1
- package/lib/utils/historyAppendSearch.js +502 -1
- package/lib/utils/isDevelopMode.js +5 -1
- package/lib/utils/parseYMD.js +36 -1
- package/lib/utils/removeDuplicateItem.js +11 -1
- package/lib/utils/sendEmail.js +39 -1
- package/lib/utils/snaDefine-6a2bcd94.js +5 -0
- package/lib/utils/snaDefine.js +1 -1
- package/lib/utils/snaPreProcess.js +84 -1
- package/package.json +125 -127
- package/lib/components/Empty-54b79907.js +0 -1
- package/lib/components/KeywordSearch-5a393f12.js +0 -1
- package/lib/components/Select-f2441b83.js +0 -1
- package/lib/components/_rollupPluginBabelHelpers-1b8c042f.js +0 -1
- package/lib/components/_rollupPluginBabelHelpers-ec4e2a53.js +0 -1
- package/lib/components/createSvgIcon-62b64929.js +0 -1
- package/lib/components/createSvgIcon-e24792d4.js +0 -1
- package/lib/components/createTheme-7fffa109.js +0 -1
- package/lib/components/dataExport-9fccd4f0.js +0 -1
- package/lib/components/debounce-c993109b.js +0 -1
- package/lib/components/hoist-non-react-statics.cjs-d6a9befd.js +0 -1
- package/lib/components/index-11391ca3.js +0 -7
- package/lib/components/index-b2745105.js +0 -7
- package/lib/components/isObjectLike-2f1983fe.js +0 -1
- package/lib/components/style-inject.es-c875d022.js +0 -1
- package/lib/components/transform-95ae0119.js +0 -1
- package/lib/utils/_commonjsHelpers-e2cda605.js +0 -1
- package/lib/utils/_rollupPluginBabelHelpers-928a52ce.js +0 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { a as _slicedToArray } from './_rollupPluginBabelHelpers-ed61ffc0.js';
|
|
2
|
+
import React__default, { useState, useEffect } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { c as classNames } from './index-f491ebce.js';
|
|
5
|
+
import axios from 'axios';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
7
|
+
import { A as Autocomplete } from './Autocomplete-24e9686d.js';
|
|
8
|
+
|
|
9
|
+
var css_248z = ".keywordSearch {\n border-radius: 4px;\n width: 100%;\n margin-right: 14px;\n}\n.keywordSearch--animation .autocomplete {\n transition: max-width 0.3s ease-out;\n max-width: 240px;\n}\n.keywordSearch--focus {\n flex: 1;\n}\n.keywordSearch--focus .autocomplete {\n max-width: 100%;\n}\n.keywordSearch .MuiAutocomplete-hasPopupIcon.MuiAutocomplete-hasClearIcon .MuiAutocomplete-inputRoot[class*=MuiOutlinedInput-root] {\n border-radius: 10px;\n background-color: #ffffff66;\n}";
|
|
10
|
+
styleInject(css_248z);
|
|
11
|
+
|
|
12
|
+
const removeDuplicateItem = function (array) {
|
|
13
|
+
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
|
|
14
|
+
if (Array.isArray(array)) return array.filter((v, i, a) => a.findIndex(t => t[key] === v[key]) === i);
|
|
15
|
+
return [];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// 必須要有的參數:name
|
|
19
|
+
var FILTER_ID = 'id';
|
|
20
|
+
var FILTER_KEY = 'name';
|
|
21
|
+
var KeywordSearch = function KeywordSearch(_ref) {
|
|
22
|
+
var className = _ref.className,
|
|
23
|
+
animation = _ref.animation,
|
|
24
|
+
filterSameName = _ref.filterSameName,
|
|
25
|
+
keyword = _ref.keyword,
|
|
26
|
+
searchAPI = _ref.searchAPI,
|
|
27
|
+
placeholder = _ref.placeholder,
|
|
28
|
+
setMenuOpen = _ref.setMenuOpen,
|
|
29
|
+
menuOpen = _ref.menuOpen,
|
|
30
|
+
onSearch = _ref.onSearch;
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
loading = _useState2[0],
|
|
34
|
+
setLoading = _useState2[1];
|
|
35
|
+
var _useState3 = useState([]),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
options = _useState4[0],
|
|
38
|
+
setOptions = _useState4[1];
|
|
39
|
+
var _useState5 = useState(keyword),
|
|
40
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
|
+
currentKeyword = _useState6[0],
|
|
42
|
+
setCurrentKeyword = _useState6[1];
|
|
43
|
+
|
|
44
|
+
// 過濾特定符號
|
|
45
|
+
var escapeRegExpKeyword = function escapeRegExpKeyword(string) {
|
|
46
|
+
return string.replace(/[-"':.*+?^${}()|[\]\\ ]/g, '\\\\$&');
|
|
47
|
+
}; // $& means the whole matched string
|
|
48
|
+
var fetchSearchList = function fetchSearchList(text) {
|
|
49
|
+
if (!text || text.length === 0) return;
|
|
50
|
+
setLoading(true);
|
|
51
|
+
axios.get(searchAPI, {
|
|
52
|
+
params: {
|
|
53
|
+
keyword: escapeRegExpKeyword(text)
|
|
54
|
+
}
|
|
55
|
+
}).then(function (response) {
|
|
56
|
+
if (response.data && response.data.data) {
|
|
57
|
+
setOptions(removeDuplicateItem(response.data.data, FILTER_ID));
|
|
58
|
+
}
|
|
59
|
+
}).finally(function () {
|
|
60
|
+
return setLoading(false);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/* 偵測keyword變動時開始搜尋 */
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
return fetchSearchList(currentKeyword);
|
|
67
|
+
}, [currentKeyword]);
|
|
68
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
69
|
+
className: classNames('keywordSearch', {
|
|
70
|
+
'keywordSearch--animation': animation
|
|
71
|
+
}, {
|
|
72
|
+
'keywordSearch--focus': menuOpen
|
|
73
|
+
}, className)
|
|
74
|
+
}, /*#__PURE__*/React__default.createElement(Autocomplete, {
|
|
75
|
+
freeTyping: true,
|
|
76
|
+
renderAfterDefaultValueChange: true,
|
|
77
|
+
defaultValue: {
|
|
78
|
+
label: keyword,
|
|
79
|
+
value: keyword
|
|
80
|
+
},
|
|
81
|
+
loading: loading,
|
|
82
|
+
options: (filterSameName ? removeDuplicateItem(options, FILTER_KEY) : options).map(function (_ref2) {
|
|
83
|
+
var name = _ref2.name,
|
|
84
|
+
id = _ref2.id,
|
|
85
|
+
value = _ref2.value,
|
|
86
|
+
label = _ref2.label;
|
|
87
|
+
return {
|
|
88
|
+
value: id || value || name,
|
|
89
|
+
label: name || label
|
|
90
|
+
};
|
|
91
|
+
}),
|
|
92
|
+
placeholder: placeholder,
|
|
93
|
+
onSearch: setCurrentKeyword,
|
|
94
|
+
onChange: function onChange(result) {
|
|
95
|
+
if (result) onSearch(options.find(function (_ref3) {
|
|
96
|
+
var id = _ref3.id,
|
|
97
|
+
value = _ref3.value;
|
|
98
|
+
return id === result.value || value === result.value;
|
|
99
|
+
}) || result);
|
|
100
|
+
},
|
|
101
|
+
onEnter: function onEnter(event, result) {
|
|
102
|
+
return onSearch(result);
|
|
103
|
+
},
|
|
104
|
+
onFocus: function onFocus() {
|
|
105
|
+
return setMenuOpen(true);
|
|
106
|
+
},
|
|
107
|
+
onBlur: function onBlur() {
|
|
108
|
+
return setMenuOpen(false);
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
KeywordSearch.defaultProps = {
|
|
113
|
+
className: undefined,
|
|
114
|
+
animation: false,
|
|
115
|
+
filterSameName: true,
|
|
116
|
+
keyword: undefined,
|
|
117
|
+
searchAPI: undefined,
|
|
118
|
+
placeholder: undefined,
|
|
119
|
+
menuOpen: false,
|
|
120
|
+
setMenuOpen: function setMenuOpen() {},
|
|
121
|
+
onSearch: function onSearch() {}
|
|
122
|
+
};
|
|
123
|
+
KeywordSearch.propTypes = {
|
|
124
|
+
/** Css Name */
|
|
125
|
+
className: PropTypes.string,
|
|
126
|
+
/** 點擊後自動展開(動畫) */
|
|
127
|
+
animation: PropTypes.bool,
|
|
128
|
+
/** 是否過濾相同名字的項目 */
|
|
129
|
+
filterSameName: PropTypes.bool,
|
|
130
|
+
/** 預設的關鍵字 */
|
|
131
|
+
keyword: PropTypes.string,
|
|
132
|
+
/** SearchBar的API */
|
|
133
|
+
searchAPI: PropTypes.string,
|
|
134
|
+
/** 提示字 */
|
|
135
|
+
placeholder: PropTypes.string,
|
|
136
|
+
/** Dropdown是否開啟 */
|
|
137
|
+
menuOpen: PropTypes.bool,
|
|
138
|
+
/** 設定Dropdown開啟 */
|
|
139
|
+
setMenuOpen: PropTypes.func,
|
|
140
|
+
/** 搜尋後點擊的callback */
|
|
141
|
+
onSearch: PropTypes.func
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export { KeywordSearch as K };
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
export { K as default } from './KeywordSearch-91167d24.js';
|
|
2
|
+
import './_rollupPluginBabelHelpers-ed61ffc0.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'prop-types';
|
|
5
|
+
import './index-f491ebce.js';
|
|
6
|
+
import 'axios';
|
|
7
|
+
import './style-inject.es-1f59c1d0.js';
|
|
8
|
+
import './Autocomplete-24e9686d.js';
|
|
9
|
+
import './debounce-127da66c.js';
|
|
10
|
+
import './isObjectLike-e111475d.js';
|
|
11
|
+
import './_commonjsHelpers-70de2c37.js';
|
|
12
|
+
import '@material-ui/lab';
|
|
13
|
+
import '@material-ui/core';
|
|
14
|
+
import '@material-ui/icons';
|
|
15
|
+
import './createSvgIcon-ff0e3b99.js';
|
|
16
|
+
import './defaultTheme-ed7746fe.js';
|
|
17
|
+
import 'react-is';
|
|
18
|
+
import '@material-ui/styles';
|
|
19
|
+
import 'react-dom';
|
|
20
|
+
import './toConsumableArray-dbe8af76.js';
|
|
21
|
+
import './Empty-dc5fc2fc.js';
|
|
@@ -1 +1,190 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { a as _slicedToArray } from './_rollupPluginBabelHelpers-ed61ffc0.js';
|
|
2
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { c as classNames } from './index-f491ebce.js';
|
|
5
|
+
import { F as ForwardLink } from './ForwardLink-15222b22.js';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
7
|
+
import './index-a6f22b92.js';
|
|
8
|
+
import 'react-router-dom';
|
|
9
|
+
import '@material-ui/core';
|
|
10
|
+
|
|
11
|
+
var css_248z = ".keywordTicker {\n width: 100%;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n}\n.keywordTicker__track {\n display: flex;\n width: 100%;\n padding: 20px 0px;\n background-color: #ece8c0;\n overflow: hidden;\n margin-left: -80px;\n padding-left: 100px;\n z-index: 1;\n position: relative;\n}\n.keywordTicker__items {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n flex-wrap: nowrap;\n position: relative;\n}\n.keywordTicker-item {\n width: auto;\n display: flex;\n justify-content: center;\n align-items: center;\n white-space: nowrap;\n cursor: pointer;\n}\n.keywordTicker-text {\n font-size: 1.5rem;\n z-index: 2;\n font-weight: bold;\n color: #825c0d;\n border-left: 2px solid #fff;\n padding: 0px 40px;\n}\n.keywordTicker__img {\n z-index: 2;\n position: relative;\n display: flex;\n}\n.keywordTicker__img img {\n height: 100%;\n max-height: 195px;\n image-rendering: -webkit-optimize-contrast;\n position: relative;\n}\n.keywordTicker--fake {\n position: absolute;\n opacity: 0;\n width: 100%;\n}\n\n@media only screen and (max-width: 768px) {\n .keywordTicker-text {\n font-size: 1.5rem;\n padding: 0px 15px;\n }\n .keywordTicker__img img {\n max-height: 104px;\n left: -60px;\n }\n .keywordTicker__track {\n padding: 10px 0px;\n margin-left: -100px;\n }\n}\n@media only screen and (max-width: 484px) {\n .keywordTicker-text {\n font-size: 14px;\n }\n}";
|
|
12
|
+
styleInject(css_248z);
|
|
13
|
+
|
|
14
|
+
var KeywordTicker = function KeywordTicker(_ref) {
|
|
15
|
+
var className = _ref.className,
|
|
16
|
+
tickerStyles = _ref.tickerStyles,
|
|
17
|
+
leftImg = _ref.leftImg,
|
|
18
|
+
tickerAttribute = _ref.tickerAttribute,
|
|
19
|
+
setTickerAttribute = _ref.setTickerAttribute,
|
|
20
|
+
_onClick = _ref.onClick;
|
|
21
|
+
var _useState = useState(null),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
tracking = _useState2[0],
|
|
24
|
+
setTracking = _useState2[1];
|
|
25
|
+
var _ref2 = tickerAttribute || {
|
|
26
|
+
result: [],
|
|
27
|
+
mounted: false,
|
|
28
|
+
strp: 0
|
|
29
|
+
},
|
|
30
|
+
result = _ref2.result,
|
|
31
|
+
mounted = _ref2.mounted,
|
|
32
|
+
step = _ref2.step;
|
|
33
|
+
var _ref3 = tickerStyles || {},
|
|
34
|
+
_ref3$fontColor = _ref3.fontColor,
|
|
35
|
+
fontColor = _ref3$fontColor === void 0 ? '#825c0d' : _ref3$fontColor,
|
|
36
|
+
_ref3$backgroundColor = _ref3.backgroundColor,
|
|
37
|
+
backgroundColor = _ref3$backgroundColor === void 0 ? '#ece8c0' : _ref3$backgroundColor,
|
|
38
|
+
_ref3$borderColor = _ref3.borderColor,
|
|
39
|
+
borderColor = _ref3$borderColor === void 0 ? '#fff' : _ref3$borderColor;
|
|
40
|
+
var track = useRef(null);
|
|
41
|
+
var words = useRef(null);
|
|
42
|
+
|
|
43
|
+
// 1.算出api長出UI的長度, 並計算需溢出次數
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
// 第一次mount且參考的dom皆就緒
|
|
46
|
+
if (result && !mounted && track.current && words.current) {
|
|
47
|
+
// dom初始值
|
|
48
|
+
var _trackWidth$wordsWidt = {
|
|
49
|
+
trackWidth: track.current.offsetWidth || 0,
|
|
50
|
+
wordsWidth: words.current.offsetWidth || 0
|
|
51
|
+
},
|
|
52
|
+
trackWidth = _trackWidth$wordsWidt.trackWidth,
|
|
53
|
+
wordsWidth = _trackWidth$wordsWidt.wordsWidth;
|
|
54
|
+
var wordsNum = Math.ceil(trackWidth / wordsWidth) > 0 ? Math.ceil(trackWidth / wordsWidth) : 0;
|
|
55
|
+
var newResults = Array(wordsNum * 2).fill(null).map(function () {
|
|
56
|
+
return result;
|
|
57
|
+
}).flat();
|
|
58
|
+
setTickerAttribute({
|
|
59
|
+
result: newResults,
|
|
60
|
+
loading: false,
|
|
61
|
+
mounted: true,
|
|
62
|
+
step: wordsNum * wordsWidth
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, [result]);
|
|
66
|
+
|
|
67
|
+
// 2.取得溢出後的文字長度製作無限跑馬燈動畫 (跑馬燈動畫核心)
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
if (mounted && window) {
|
|
70
|
+
// dom初始值
|
|
71
|
+
var _wordsWidth = {
|
|
72
|
+
wordsWidth: words.current.offsetWidth || 0
|
|
73
|
+
},
|
|
74
|
+
wordsWidth = _wordsWidth.wordsWidth;
|
|
75
|
+
|
|
76
|
+
// 不同螢幕寬度時取得不同播放速度
|
|
77
|
+
var responsiveSpeed = function responsiveSpeed(width) {
|
|
78
|
+
if (width) {
|
|
79
|
+
if (width < 767) return 0.06 * 0.6;
|
|
80
|
+
if (width < 480) return 0.06 * 0.55;
|
|
81
|
+
return 0.06;
|
|
82
|
+
}
|
|
83
|
+
return 0.06;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// 起始點為0
|
|
87
|
+
var startLine = 0;
|
|
88
|
+
|
|
89
|
+
// animation config
|
|
90
|
+
var _buffer$speed = {
|
|
91
|
+
buffer: startLine,
|
|
92
|
+
// 左側跑馬燈進入buffer
|
|
93
|
+
speed: responsiveSpeed(window.innerWidth) || 0.06 // 速度
|
|
94
|
+
},
|
|
95
|
+
speed = _buffer$speed.speed;
|
|
96
|
+
var _start$end = {
|
|
97
|
+
start: startLine,
|
|
98
|
+
end: wordsWidth - step
|
|
99
|
+
},
|
|
100
|
+
start = _start$end.start,
|
|
101
|
+
end = _start$end.end;
|
|
102
|
+
|
|
103
|
+
// 固定移動速度並計算動畫時間
|
|
104
|
+
var distance = startLine + wordsWidth - step; // 減掉單次畫面溢出的長度
|
|
105
|
+
var duration = distance / speed;
|
|
106
|
+
var initTracking = words.current.animate(
|
|
107
|
+
// keyframes
|
|
108
|
+
[{
|
|
109
|
+
left: "".concat(start, "px")
|
|
110
|
+
}, {
|
|
111
|
+
left: "-".concat(end, "px")
|
|
112
|
+
}],
|
|
113
|
+
// timing options
|
|
114
|
+
{
|
|
115
|
+
duration: duration,
|
|
116
|
+
iterations: Infinity
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// 初始化並將狀態傳出
|
|
120
|
+
setTracking(initTracking);
|
|
121
|
+
}
|
|
122
|
+
}, [mounted, step]);
|
|
123
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
124
|
+
className: classNames('keywordTicker', className)
|
|
125
|
+
}, leftImg && /*#__PURE__*/React__default.createElement("div", {
|
|
126
|
+
className: "keywordTicker__img"
|
|
127
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
128
|
+
src: leftImg,
|
|
129
|
+
alt: "hotKeyword"
|
|
130
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
131
|
+
className: "keywordTicker__track",
|
|
132
|
+
ref: track,
|
|
133
|
+
style: {
|
|
134
|
+
backgroundColor: backgroundColor
|
|
135
|
+
},
|
|
136
|
+
onMouseEnter: function onMouseEnter() {
|
|
137
|
+
return tracking === null || tracking === void 0 ? void 0 : tracking.pause();
|
|
138
|
+
},
|
|
139
|
+
onMouseLeave: function onMouseLeave() {
|
|
140
|
+
return tracking === null || tracking === void 0 ? void 0 : tracking.play();
|
|
141
|
+
}
|
|
142
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
143
|
+
className: "keywordTicker__items",
|
|
144
|
+
ref: words
|
|
145
|
+
}, (result || []).map(function (_ref4, index) {
|
|
146
|
+
var keyword = _ref4.keyword;
|
|
147
|
+
return /*#__PURE__*/React__default.createElement(ForwardLink, {
|
|
148
|
+
key: index.toString(),
|
|
149
|
+
className: "keywordTicker-item",
|
|
150
|
+
pathname: "/knowledge/keyword",
|
|
151
|
+
search: {
|
|
152
|
+
keyword: keyword
|
|
153
|
+
},
|
|
154
|
+
disabled: _onClick
|
|
155
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
156
|
+
className: "keywordTicker-text",
|
|
157
|
+
style: {
|
|
158
|
+
color: fontColor,
|
|
159
|
+
borderColor: borderColor
|
|
160
|
+
},
|
|
161
|
+
onClick: function onClick() {
|
|
162
|
+
return _onClick === null || _onClick === void 0 ? void 0 : _onClick(keyword);
|
|
163
|
+
}
|
|
164
|
+
}, keyword));
|
|
165
|
+
}))));
|
|
166
|
+
};
|
|
167
|
+
KeywordTicker.defaultProps = {
|
|
168
|
+
className: undefined,
|
|
169
|
+
leftImg: undefined,
|
|
170
|
+
tickerStyles: undefined,
|
|
171
|
+
tickerAttribute: undefined,
|
|
172
|
+
setTickerAttribute: function setTickerAttribute() {},
|
|
173
|
+
onClick: undefined
|
|
174
|
+
};
|
|
175
|
+
KeywordTicker.propTypes = {
|
|
176
|
+
/** Css Name */
|
|
177
|
+
className: PropTypes.string,
|
|
178
|
+
/** Custom image by each project */
|
|
179
|
+
leftImg: PropTypes.string,
|
|
180
|
+
/** Items Color */
|
|
181
|
+
tickerStyles: PropTypes.objectOf(PropTypes.any),
|
|
182
|
+
/** Attribute of result, loading, mounted, step */
|
|
183
|
+
tickerAttribute: PropTypes.objectOf(PropTypes.any),
|
|
184
|
+
/** Set Attribute */
|
|
185
|
+
setTickerAttribute: PropTypes.func,
|
|
186
|
+
/** Click callback */
|
|
187
|
+
onClick: PropTypes.func
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export { KeywordTicker as default };
|