@daoyi/nmtl-ui 2.0.1-beta.13 → 2.0.1-beta.130
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/lib/components/Autocomplete-3b418e5f.js +494 -0
- package/lib/components/Autocomplete.js +20 -1
- package/lib/components/Avatar.js +59 -1
- package/lib/components/BackTop.js +124 -1
- package/lib/components/BarChart.js +764 -1
- package/lib/components/Breadcrumbs.js +122 -1
- package/lib/components/Button-7bd5aa09.js +114 -0
- package/lib/components/Button.js +7 -1
- package/lib/components/Carousel.js +4654 -1
- package/lib/components/Checkbox.js +37 -1
- package/lib/components/CollapseContent.js +180 -1
- package/lib/components/ContactModal-7e5b14e8.js +12188 -0
- package/lib/components/ContactModal.js +24 -3
- package/lib/components/Drawer-629e59c7.js +176 -0
- package/lib/components/Drawer.js +17 -1
- package/lib/components/Dropdown.js +134 -1
- package/lib/components/Empty-c6a44967.js +46 -0
- package/lib/components/Empty.js +5 -1
- package/lib/components/ExportButton.js +128 -1
- package/lib/components/ExtraTools-2691c13e.js +3676 -0
- package/lib/components/ExtraTools.js +11 -22
- package/lib/components/Filter.js +821 -12
- package/lib/components/Footer.js +317 -1
- package/lib/components/ForwardLink-5fbd2705.js +184 -0
- package/lib/components/ForwardLink.js +10 -0
- package/lib/components/Header.js +233 -1
- package/lib/components/Image.js +61 -1
- package/lib/components/Input.js +89 -1
- package/lib/components/InputMethod.js +33949 -12
- package/lib/components/KeywordSearch-fec33a2c.js +156 -0
- package/lib/components/KeywordSearch.js +22 -1
- package/lib/components/KeywordTicker.js +224 -1
- package/lib/components/Keywords.js +383 -1
- package/lib/components/Loading.js +32 -1
- package/lib/components/MUITheme.js +2657 -1
- package/lib/components/Modal-e04532fa.js +127 -0
- package/lib/components/Modal.js +11 -1
- package/lib/components/MoreButton-19055e07.js +148 -0
- package/lib/components/MoreButton.js +8 -1
- package/lib/components/Pagination.js +3702 -0
- package/lib/components/Radio.js +83 -1
- package/lib/components/SNA.js +1755 -22
- package/lib/components/Select-cb3e1ba1.js +189 -0
- package/lib/components/Select.js +14 -1
- package/lib/components/Spin-8f87eadc.js +79 -0
- package/lib/components/Spin.js +7 -1
- package/lib/components/Table.js +51 -1
- package/lib/components/Tooltip-6ebfa9c1.js +70 -0
- package/lib/components/Tooltip.js +7 -1
- package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
- package/lib/components/_rollupPluginBabelHelpers-a52356f6.js +142 -0
- package/lib/components/createSvgIcon-e3803ee1.js +576 -0
- package/lib/components/dataExport-a9e3fae1.js +91 -0
- package/lib/components/debounce-127da66c.js +355 -0
- package/lib/components/defaultTheme-ed7746fe.js +1661 -0
- package/lib/components/globalConfig.js +423 -0
- package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
- package/lib/components/index-b47819f3.js +481 -0
- package/lib/components/index-b76a85f4.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-849a452c.js +5475 -0
- package/lib/components/useTheme-d16d02d9.js +11 -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 +5 -1
- package/lib/index.js +5 -1
- package/lib/utils/_rollupPluginBabelHelpers-9802e640.js +121 -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 +221 -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 +134 -128
- 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
|
@@ -1 +1,383 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
2
|
+
import React__default, { useState, useEffect, useRef } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { c as classNames } from './index-b76a85f4.js';
|
|
5
|
+
import { M as Modal } from './Modal-e04532fa.js';
|
|
6
|
+
import { Typography } from '@material-ui/core';
|
|
7
|
+
import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-e3803ee1.js';
|
|
8
|
+
import { getIntl } from './globalConfig';
|
|
9
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
10
|
+
import '@material-ui/icons';
|
|
11
|
+
import './Button-7bd5aa09.js';
|
|
12
|
+
import './Spin-8f87eadc.js';
|
|
13
|
+
import './_commonjsHelpers-70de2c37.js';
|
|
14
|
+
import './defaultTheme-ed7746fe.js';
|
|
15
|
+
import 'react-is';
|
|
16
|
+
import '@material-ui/styles';
|
|
17
|
+
import 'react-dom';
|
|
18
|
+
|
|
19
|
+
const useRWD = () => {
|
|
20
|
+
const [device, setDevice] = useState('PC');
|
|
21
|
+
const handleRWD = () => {
|
|
22
|
+
if (window.innerWidth > 768) setDevice('PC');else if (window.innerWidth > 576) setDevice('tablet');else setDevice('mobile');
|
|
23
|
+
};
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
handleRWD();
|
|
26
|
+
window.addEventListener('resize', handleRWD);
|
|
27
|
+
return () => {
|
|
28
|
+
window.removeEventListener('resize', handleRWD);
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
return device;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var MoreHoriz = {};
|
|
35
|
+
|
|
36
|
+
var _interopRequireDefault = interopRequireDefault.exports;
|
|
37
|
+
|
|
38
|
+
var _interopRequireWildcard = interopRequireWildcard.exports;
|
|
39
|
+
|
|
40
|
+
Object.defineProperty(MoreHoriz, "__esModule", {
|
|
41
|
+
value: true
|
|
42
|
+
});
|
|
43
|
+
var default_1 = MoreHoriz.default = void 0;
|
|
44
|
+
|
|
45
|
+
var React = _interopRequireWildcard(React__default);
|
|
46
|
+
|
|
47
|
+
var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
|
|
48
|
+
|
|
49
|
+
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/React.createElement("path", {
|
|
50
|
+
d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
|
|
51
|
+
}), 'MoreHoriz');
|
|
52
|
+
|
|
53
|
+
default_1 = MoreHoriz.default = _default;
|
|
54
|
+
|
|
55
|
+
var css_248z$2 = ".keywordList {\n display: flex;\n flex-wrap: wrap;\n margin-top: 0.8rem;\n}\n.keywordList__item {\n font-size: 1.125rem !important;\n border-radius: 5px;\n margin-right: 0.5rem !important;\n margin-bottom: 0.5rem !important;\n cursor: pointer;\n}\n.keywordList__item__hover {\n border-radius: 5px;\n line-height: normal;\n padding: 0.125rem 0.625rem;\n background: transparent;\n transition: 0.3s background ease-in-out;\n}\n.keywordList__item__hover:hover {\n background: rgba(0, 0, 0, 0.1);\n}\n.keywordList__icon svg {\n font-size: 1rem;\n line-height: 1rem;\n}\n.keywordList__icon .keywordList__item__hover {\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0.125rem 0.875rem;\n}\n\n@media screen and (max-width: 484px) {\n .keywordList__item {\n font-size: 0.75rem !important;\n }\n}";
|
|
56
|
+
styleInject(css_248z$2);
|
|
57
|
+
|
|
58
|
+
const KeywordList = _ref => {
|
|
59
|
+
let {
|
|
60
|
+
className,
|
|
61
|
+
keywords,
|
|
62
|
+
backgroundColor,
|
|
63
|
+
textColor,
|
|
64
|
+
limit,
|
|
65
|
+
onMoreClick,
|
|
66
|
+
onKeywordClick
|
|
67
|
+
} = _ref;
|
|
68
|
+
/* WCAG 2.4.3 roving tabindex(實測回饋 R32):關鍵字 chip 原本各自 tabIndex=0,
|
|
69
|
+
一張卡片 N 個關鍵字=N 個 Tab 站點,鍵盤使用者要逐一跳過才能離開卡片。
|
|
70
|
+
改為整組僅一個 Tab 站點(role=group),組內以方向鍵/Home/End 瀏覽,
|
|
71
|
+
Tab 直接離開整組。瀏覽模式(NVDA 上下鍵)不受影響。 */
|
|
72
|
+
const [current, setCurrent] = useState(0);
|
|
73
|
+
const itemRefs = useRef([]);
|
|
74
|
+
if (!Array.isArray(keywords)) return null;
|
|
75
|
+
const items = limit ? keywords.slice(0, limit) : keywords;
|
|
76
|
+
const hasMore = !!(limit && keywords.length > limit);
|
|
77
|
+
const count = items.length + (hasMore ? 1 : 0);
|
|
78
|
+
// 關鍵字資料變動使 current 超界時退回第一個
|
|
79
|
+
const activeIndex = current < count ? current : 0;
|
|
80
|
+
const moveTo = (event, next) => {
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
const target = (next + count) % count;
|
|
83
|
+
setCurrent(target);
|
|
84
|
+
const el = itemRefs.current[target];
|
|
85
|
+
if (el) el.focus();
|
|
86
|
+
};
|
|
87
|
+
const handleRovingKeyDown = (event, index) => {
|
|
88
|
+
if (event.key === 'ArrowRight' || event.key === 'ArrowDown') moveTo(event, index + 1);else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') moveTo(event, index - 1);else if (event.key === 'Home') moveTo(event, 0);else if (event.key === 'End') moveTo(event, count - 1);
|
|
89
|
+
};
|
|
90
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
91
|
+
className: classNames('keywordList', className),
|
|
92
|
+
role: "group",
|
|
93
|
+
"aria-label": getIntl().formatMessage({
|
|
94
|
+
id: 'aria.keyword.groupLabel'
|
|
95
|
+
}, {
|
|
96
|
+
count: keywords.length
|
|
97
|
+
})
|
|
98
|
+
}, items.map((keyword, i) => /*#__PURE__*/React__default.createElement(Typography, {
|
|
99
|
+
color: "textSecondary",
|
|
100
|
+
className: "keywordList__item",
|
|
101
|
+
key: i.toString(),
|
|
102
|
+
role: "button",
|
|
103
|
+
tabIndex: activeIndex === i ? 0 : -1,
|
|
104
|
+
ref: el => {
|
|
105
|
+
itemRefs.current[i] = el;
|
|
106
|
+
},
|
|
107
|
+
"aria-label": `${keyword}${getIntl().formatMessage({
|
|
108
|
+
id: 'aria.keyword.searchHint'
|
|
109
|
+
})}`,
|
|
110
|
+
onClick: () => onKeywordClick(keyword),
|
|
111
|
+
onFocus: () => setCurrent(i),
|
|
112
|
+
onKeyDown: event => {
|
|
113
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
onKeywordClick(keyword);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
handleRovingKeyDown(event, i);
|
|
119
|
+
}
|
|
120
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
121
|
+
style: {
|
|
122
|
+
color: textColor,
|
|
123
|
+
backgroundColor
|
|
124
|
+
},
|
|
125
|
+
className: "keywordList__item__hover"
|
|
126
|
+
}, keyword))), hasMore && /*#__PURE__*/React__default.createElement("div", {
|
|
127
|
+
className: classNames('keywordList__item', 'keywordList__icon'),
|
|
128
|
+
style: {
|
|
129
|
+
backgroundColor
|
|
130
|
+
},
|
|
131
|
+
role: "button",
|
|
132
|
+
tabIndex: activeIndex === items.length ? 0 : -1,
|
|
133
|
+
ref: el => {
|
|
134
|
+
itemRefs.current[items.length] = el;
|
|
135
|
+
},
|
|
136
|
+
"aria-haspopup": "dialog",
|
|
137
|
+
"aria-label": getIntl().formatMessage({
|
|
138
|
+
id: 'aria.keyword.more'
|
|
139
|
+
}),
|
|
140
|
+
onClick: onMoreClick,
|
|
141
|
+
onFocus: () => setCurrent(items.length),
|
|
142
|
+
onKeyDown: event => {
|
|
143
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
onMoreClick();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
handleRovingKeyDown(event, items.length);
|
|
149
|
+
}
|
|
150
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
151
|
+
className: "keywordList__item__hover",
|
|
152
|
+
style: {
|
|
153
|
+
color: textColor
|
|
154
|
+
}
|
|
155
|
+
}, /*#__PURE__*/React__default.createElement(default_1, {
|
|
156
|
+
"aria-hidden": "true"
|
|
157
|
+
}))));
|
|
158
|
+
};
|
|
159
|
+
KeywordList.defaultProps = {
|
|
160
|
+
className: undefined,
|
|
161
|
+
keywords: undefined,
|
|
162
|
+
backgroundColor: undefined,
|
|
163
|
+
textColor: undefined,
|
|
164
|
+
limit: undefined,
|
|
165
|
+
onMoreClick: () => {},
|
|
166
|
+
onKeywordClick: () => {}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
170
|
+
KeywordList.propTypes = {
|
|
171
|
+
/** Css Name */
|
|
172
|
+
className: PropTypes.string,
|
|
173
|
+
/** 背景顏色 */
|
|
174
|
+
backgroundColor: PropTypes.string,
|
|
175
|
+
/** 文字顏色 */
|
|
176
|
+
textColor: PropTypes.string,
|
|
177
|
+
/** 關鍵字 */
|
|
178
|
+
keywords: PropTypes.arrayOf(PropTypes.any),
|
|
179
|
+
/** 關鍵字限制(用來評估是否要啟用顯示更多) */
|
|
180
|
+
limit: PropTypes.number,
|
|
181
|
+
/** 顯示更多被按時 */
|
|
182
|
+
onMoreClick: PropTypes.func,
|
|
183
|
+
/** 關鍵字被按時 */
|
|
184
|
+
onKeywordClick: PropTypes.func
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
var css_248z$1 = ".keywordModal__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: 5px;\n}\n.keywordModal__content__image {\n display: flex;\n justify-content: center;\n width: 100%;\n}\n.keywordModal__content__image__img {\n height: 7.75rem;\n object-fit: scale-down;\n}\n.keywordModal__content__detail {\n width: 100%;\n padding: 1rem 1.25rem;\n border-radius: 5px;\n}\n.keywordModal__content__detail__title {\n font-weight: bold;\n font-size: 1.5rem;\n text-decoration: underline;\n cursor: pointer;\n}\n.keywordModal__content__detail__desc {\n margin-top: 0.8rem;\n font-size: 1rem;\n display: -webkit-box;\n overflow: hidden;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n.keywordModal__content__detail__author {\n margin-top: 0.8rem;\n font-size: 1.25rem;\n cursor: pointer;\n}\n.keywordModal__content__detail__author:hover {\n text-decoration: underline;\n}\n.keywordModal p {\n font-family: \"Noto Sans TC\", \"Arial\", sans-serif !important;\n}\n.keywordModal .MuiPaper-root {\n min-width: initial !important;\n}";
|
|
188
|
+
styleInject(css_248z$1);
|
|
189
|
+
|
|
190
|
+
const KeywordModal = props => {
|
|
191
|
+
const {
|
|
192
|
+
visible,
|
|
193
|
+
setVisible,
|
|
194
|
+
cardData
|
|
195
|
+
} = props;
|
|
196
|
+
const {
|
|
197
|
+
modalTextColor,
|
|
198
|
+
modalImageColor,
|
|
199
|
+
backgroundColor,
|
|
200
|
+
modalBackgroundColor,
|
|
201
|
+
textColor
|
|
202
|
+
} = props;
|
|
203
|
+
const {
|
|
204
|
+
onKeywordClick,
|
|
205
|
+
onTitleClick,
|
|
206
|
+
onAuthorClick
|
|
207
|
+
} = props;
|
|
208
|
+
const {
|
|
209
|
+
author,
|
|
210
|
+
imgUrl,
|
|
211
|
+
title
|
|
212
|
+
} = cardData || {};
|
|
213
|
+
const keywords = cardData && cardData.keywords && cardData.keywords.split('\n') || [];
|
|
214
|
+
const contentColor = modalTextColor || textColor;
|
|
215
|
+
// const desc = introduction || description;
|
|
216
|
+
|
|
217
|
+
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
218
|
+
transparent: true,
|
|
219
|
+
size: "small",
|
|
220
|
+
className: "keywordModal",
|
|
221
|
+
visible: visible,
|
|
222
|
+
footer: null,
|
|
223
|
+
onCancel: () => setVisible(false)
|
|
224
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
225
|
+
className: "keywordModal__content",
|
|
226
|
+
style: {
|
|
227
|
+
backgroundColor: modalBackgroundColor
|
|
228
|
+
}
|
|
229
|
+
}, imgUrl && /*#__PURE__*/React__default.createElement("div", {
|
|
230
|
+
className: "keywordModal__content__image",
|
|
231
|
+
style: {
|
|
232
|
+
backgroundColor: modalImageColor
|
|
233
|
+
}
|
|
234
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
235
|
+
className: "keywordModal__content__image__img",
|
|
236
|
+
src: imgUrl,
|
|
237
|
+
alt: ""
|
|
238
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
239
|
+
className: "keywordModal__content__detail"
|
|
240
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
241
|
+
title: title,
|
|
242
|
+
className: "keywordModal__content__detail__title",
|
|
243
|
+
style: {
|
|
244
|
+
color: contentColor
|
|
245
|
+
},
|
|
246
|
+
onClick: onTitleClick
|
|
247
|
+
}, title), author && /*#__PURE__*/React__default.createElement("div", {
|
|
248
|
+
className: "keywordModal__content__detail__author",
|
|
249
|
+
title: author,
|
|
250
|
+
onClick: onAuthorClick,
|
|
251
|
+
style: {
|
|
252
|
+
color: contentColor
|
|
253
|
+
}
|
|
254
|
+
}, author), /*#__PURE__*/React__default.createElement(KeywordList, {
|
|
255
|
+
keywords,
|
|
256
|
+
textColor,
|
|
257
|
+
backgroundColor,
|
|
258
|
+
onKeywordClick
|
|
259
|
+
}))));
|
|
260
|
+
};
|
|
261
|
+
KeywordModal.defaultProps = {
|
|
262
|
+
visible: undefined,
|
|
263
|
+
setVisible: () => {},
|
|
264
|
+
modalTextColor: undefined,
|
|
265
|
+
modalImageColor: undefined,
|
|
266
|
+
modalBackgroundColor: undefined,
|
|
267
|
+
backgroundColor: undefined,
|
|
268
|
+
textColor: undefined,
|
|
269
|
+
cardData: undefined,
|
|
270
|
+
onKeywordClick: () => {},
|
|
271
|
+
onTitleClick: () => {},
|
|
272
|
+
onAuthorClick: () => {}
|
|
273
|
+
};
|
|
274
|
+
KeywordModal.propTypes = {
|
|
275
|
+
visible: PropTypes.bool,
|
|
276
|
+
setVisible: PropTypes.func,
|
|
277
|
+
cardData: PropTypes.objectOf(PropTypes.any),
|
|
278
|
+
modalTextColor: PropTypes.string,
|
|
279
|
+
modalImageColor: PropTypes.string,
|
|
280
|
+
modalBackgroundColor: PropTypes.string,
|
|
281
|
+
backgroundColor: PropTypes.string,
|
|
282
|
+
textColor: PropTypes.string,
|
|
283
|
+
onKeywordClick: PropTypes.func,
|
|
284
|
+
onTitleClick: PropTypes.func,
|
|
285
|
+
onAuthorClick: PropTypes.func
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
var css_248z = ".keywords p {\n font-family: \"Noto Sans TC\", \"Arial\", sans-serif !important;\n}";
|
|
289
|
+
styleInject(css_248z);
|
|
290
|
+
|
|
291
|
+
var Keywords = function Keywords(props) {
|
|
292
|
+
var className = props.className,
|
|
293
|
+
keywords = props.keywords,
|
|
294
|
+
cardData = props.cardData,
|
|
295
|
+
limit = props.limit,
|
|
296
|
+
theme = props.theme;
|
|
297
|
+
var _ref = theme || {},
|
|
298
|
+
backgroundColor = _ref.backgroundColor,
|
|
299
|
+
textColor = _ref.textColor,
|
|
300
|
+
modalTextColor = _ref.modalTextColor,
|
|
301
|
+
modalImageColor = _ref.modalImageColor,
|
|
302
|
+
modalBackgroundColor = _ref.modalBackgroundColor;
|
|
303
|
+
var onKeywordClick = props.onKeywordClick,
|
|
304
|
+
_onMoreClick = props.onMoreClick,
|
|
305
|
+
onTitleClick = props.onTitleClick,
|
|
306
|
+
onAuthorClick = props.onAuthorClick;
|
|
307
|
+
var currentKeywords = cardData && cardData.keywords && cardData.keywords.split('\n') || keywords || [];
|
|
308
|
+
if (currentKeywords.filter(function (keyword) {
|
|
309
|
+
return keyword && keyword.length > 0;
|
|
310
|
+
}).length === 0) return null;
|
|
311
|
+
var _useState = useState(),
|
|
312
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
313
|
+
modalVisible = _useState2[0],
|
|
314
|
+
setModalVisible = _useState2[1];
|
|
315
|
+
var device = useRWD();
|
|
316
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
317
|
+
className: classNames('keywords', className)
|
|
318
|
+
}, /*#__PURE__*/React__default.createElement(KeywordList, {
|
|
319
|
+
limit: limit || (device === 'mobile' ? 1 : undefined),
|
|
320
|
+
keywords: currentKeywords,
|
|
321
|
+
backgroundColor: backgroundColor,
|
|
322
|
+
textColor: textColor,
|
|
323
|
+
onMoreClick: function onMoreClick() {
|
|
324
|
+
return cardData ? setModalVisible(true) : _onMoreClick();
|
|
325
|
+
},
|
|
326
|
+
onKeywordClick: onKeywordClick
|
|
327
|
+
}), /*#__PURE__*/React__default.createElement(KeywordModal, {
|
|
328
|
+
visible: modalVisible,
|
|
329
|
+
setVisible: setModalVisible,
|
|
330
|
+
modalTextColor: modalTextColor,
|
|
331
|
+
modalImageColor: modalImageColor,
|
|
332
|
+
modalBackgroundColor: modalBackgroundColor,
|
|
333
|
+
cardData: cardData,
|
|
334
|
+
backgroundColor: backgroundColor,
|
|
335
|
+
textColor: textColor,
|
|
336
|
+
onKeywordClick: onKeywordClick,
|
|
337
|
+
onTitleClick: onTitleClick,
|
|
338
|
+
onAuthorClick: onAuthorClick
|
|
339
|
+
}));
|
|
340
|
+
};
|
|
341
|
+
Keywords.defaultProps = {
|
|
342
|
+
className: undefined,
|
|
343
|
+
keywords: undefined,
|
|
344
|
+
cardData: undefined,
|
|
345
|
+
limit: undefined,
|
|
346
|
+
theme: undefined,
|
|
347
|
+
onKeywordClick: function onKeywordClick() {},
|
|
348
|
+
onMoreClick: function onMoreClick() {},
|
|
349
|
+
onTitleClick: function onTitleClick() {},
|
|
350
|
+
onAuthorClick: function onAuthorClick() {}
|
|
351
|
+
};
|
|
352
|
+
Keywords.propTypes = {
|
|
353
|
+
/** Css Name */
|
|
354
|
+
className: PropTypes.string,
|
|
355
|
+
/** 關鍵字 */
|
|
356
|
+
keywords: PropTypes.arrayOf(PropTypes.any),
|
|
357
|
+
/** 卡片資訊 */
|
|
358
|
+
cardData: PropTypes.objectOf(PropTypes.any),
|
|
359
|
+
/** 關鍵字限制(用來評估是否要啟用顯示更多) */
|
|
360
|
+
limit: PropTypes.number,
|
|
361
|
+
theme: PropTypes.shape({
|
|
362
|
+
/** 背景顏色 */
|
|
363
|
+
backgroundColor: PropTypes.string,
|
|
364
|
+
/** 文字顏色 */
|
|
365
|
+
textColor: PropTypes.string,
|
|
366
|
+
/** Modal標題顏色 */
|
|
367
|
+
modalTextColor: PropTypes.string,
|
|
368
|
+
/** Modal圖片背景顏色 */
|
|
369
|
+
modalImageColor: PropTypes.string,
|
|
370
|
+
/** Modal背景顏色 */
|
|
371
|
+
modalBackgroundColor: PropTypes.string
|
|
372
|
+
}),
|
|
373
|
+
/** 當關鍵字被點擊時 */
|
|
374
|
+
onKeywordClick: PropTypes.func,
|
|
375
|
+
/** 顯示更多被按時 */
|
|
376
|
+
onMoreClick: PropTypes.func,
|
|
377
|
+
/** 標題被按時 */
|
|
378
|
+
onTitleClick: PropTypes.func,
|
|
379
|
+
/** 作者被按時 */
|
|
380
|
+
onAuthorClick: PropTypes.func
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
export { Keywords as default };
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { c as classNames } from './index-b76a85f4.js';
|
|
3
|
+
import { CircularProgress } from '@material-ui/core';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { getIntl } from './globalConfig';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
7
|
+
|
|
8
|
+
var css_248z = ".loadingPage {\n padding: 4rem 0;\n color: #0087dc;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}";
|
|
9
|
+
styleInject(css_248z);
|
|
10
|
+
|
|
11
|
+
var Loading = function Loading(_ref) {
|
|
12
|
+
var className = _ref.className;
|
|
13
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
14
|
+
className: classNames('loadingPage', className)
|
|
15
|
+
}, /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
16
|
+
size: 80,
|
|
17
|
+
"aria-label": getIntl().formatMessage({
|
|
18
|
+
id: 'aria.loading'
|
|
19
|
+
})
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
Loading.defaultProps = {
|
|
23
|
+
className: undefined
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
27
|
+
Loading.propTypes = {
|
|
28
|
+
/** Css Name */
|
|
29
|
+
className: PropTypes.string
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { Loading as default };
|