@daoyi/nmtl-ui 2.0.1-beta.45 → 2.0.1-beta.47
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-5439ff22.js +333 -1
- package/lib/components/Autocomplete.js +12 -1
- package/lib/components/Avatar.js +51 -1
- package/lib/components/BackTop.js +82 -1
- package/lib/components/BarChart.js +132 -1
- package/lib/components/Breadcrumbs.js +124 -1
- package/lib/components/Button-63c7e9f3.js +91 -1
- package/lib/components/Button.js +8 -1
- package/lib/components/Carousel.js +61 -1
- package/lib/components/Checkbox.js +37 -1
- package/lib/components/CollapseContent.js +181 -1
- package/lib/components/ContactModal-a59bc808.js +924 -0
- package/lib/components/ContactModal.js +17 -1
- package/lib/components/Drawer-af3ed21a.js +157 -1
- package/lib/components/Drawer.js +13 -1
- package/lib/components/Dropdown.js +135 -1
- package/lib/components/Empty-70f040a9.js +44 -1
- package/lib/components/Empty.js +7 -1
- package/lib/components/ExportButton.js +114 -1
- package/lib/components/ExtraTools-f10a66a8.js +818 -1
- package/lib/components/ExtraTools.js +11 -1
- package/lib/components/Filter.js +90 -1
- package/lib/components/Footer.js +266 -1
- package/lib/components/ForwardLink.js +106 -1
- package/lib/components/Header.js +186 -1
- package/lib/components/Image.js +58 -1
- package/lib/components/Input.js +79 -1
- package/lib/components/InputMethod.js +23106 -1
- package/lib/components/KeywordSearch-224f84c1.js +138 -1
- package/lib/components/KeywordSearch.js +14 -1
- package/lib/components/KeywordTicker.js +182 -1
- package/lib/components/Keywords.js +292 -1
- package/lib/components/Loading.js +30 -1
- package/lib/components/MUITheme.js +255 -1
- package/lib/components/Modal-a7591b98.js +107 -1
- package/lib/components/Modal.js +11 -1
- package/lib/components/MoreButton-f15ca38e.js +109 -1
- package/lib/components/MoreButton.js +8 -1
- package/lib/components/Radio.js +81 -1
- package/lib/components/SNA.js +324 -1
- package/lib/components/Select-98a8e973.js +114 -1
- package/lib/components/Select.js +10 -1
- package/lib/components/Spin-690a3597.js +74 -1
- package/lib/components/Spin.js +8 -1
- package/lib/components/Table.js +51 -1
- package/lib/components/Tooltip-b7eb966d.js +69 -1
- package/lib/components/Tooltip.js +9 -1
- package/lib/components/_rollupPluginBabelHelpers-fde6d1c6.js +491 -1
- package/lib/components/dataExport-f418e6fe.js +56 -1
- package/lib/components/globalConfig.js +186 -1
- package/lib/components/vendor-851c6356.js +41893 -16
- package/lib/index.d.ts +1 -3
- package/lib/index.js +1 -3
- package/lib/utils/_rollupPluginBabelHelpers-a6e0e6e3.js +139 -1
- package/lib/utils/arrayMerge.js +100 -1
- package/lib/utils/chunkArray.js +15 -1
- package/lib/utils/convert2HtmlEntities.js +42 -1
- package/lib/utils/domToImage.js +32 -1
- package/lib/utils/downloadGephi.js +106 -1
- package/lib/utils/exportXlsx.js +184 -1
- package/lib/utils/historyAppendSearch.js +23 -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 -1
- package/lib/utils/snaDefine.js +1 -1
- package/lib/utils/snaPreProcess.js +84 -1
- package/lib/utils/vendor-3ec75cc9.js +1289 -1
- package/package.json +1 -1
- package/lib/components/ContactModal-d7e2f8bb.js +0 -1
- package/lib/components/globalConfig-40069b54.js +0 -1
|
@@ -1 +1,106 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { c as _objectWithoutProperties } from './_rollupPluginBabelHelpers-fde6d1c6.js';
|
|
2
|
+
import React__default, { useMemo } from 'react';
|
|
3
|
+
import { s as styleInject, E as queryString, c as classNames } from './vendor-851c6356.js';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useHistory, Link } from 'react-router-dom';
|
|
6
|
+
import { Tooltip } from '@material-ui/core';
|
|
7
|
+
import 'react-is';
|
|
8
|
+
import '@material-ui/styles';
|
|
9
|
+
import 'react-dom';
|
|
10
|
+
|
|
11
|
+
var css_248z = ".forwardLink {\n width: -moz-fit-content;\n width: fit-content; }\n .forwardLink__link {\n color: unset;\n text-decoration: none;\n cursor: pointer; }\n .forwardLink__link--disabled {\n cursor: not-allowed; }\n";
|
|
12
|
+
styleInject(css_248z);
|
|
13
|
+
|
|
14
|
+
var _excluded = ["className", "title", "target", "disabled", "children", "tip", "onClick"];
|
|
15
|
+
var locale = '/zh-tw'; // 20230318 暫時寫死,若套件納入語系控制,可將其置換
|
|
16
|
+
|
|
17
|
+
var ForwardLink = function ForwardLink(_ref) {
|
|
18
|
+
var className = _ref.className,
|
|
19
|
+
title = _ref.title,
|
|
20
|
+
target = _ref.target,
|
|
21
|
+
disabled = _ref.disabled,
|
|
22
|
+
children = _ref.children,
|
|
23
|
+
tip = _ref.tip;
|
|
24
|
+
_ref.onClick;
|
|
25
|
+
var rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
var history = useHistory();
|
|
27
|
+
var _useMemo = useMemo(function () {
|
|
28
|
+
var _rest$pathname;
|
|
29
|
+
if (disabled) return {};
|
|
30
|
+
/*
|
|
31
|
+
* 若將 search 寫在 pathname 中,意即 pathname=/asd?zxc=qwe
|
|
32
|
+
* 會導致換頁時 React route dom 無法匹配 => 空白畫面
|
|
33
|
+
* 若真有此情況發生 需把 search 提領出來
|
|
34
|
+
*/
|
|
35
|
+
var foundIndex = (_rest$pathname = rest.pathname) === null || _rest$pathname === void 0 ? void 0 : _rest$pathname.indexOf('?');
|
|
36
|
+
if (foundIndex > -1) return {
|
|
37
|
+
pathname: rest.pathname.substring(0, foundIndex),
|
|
38
|
+
search: rest.pathname.substring(foundIndex)
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
pathname: rest.pathname || '/',
|
|
42
|
+
search: typeof rest.search === 'string' ? rest.search : queryString.stringify(rest.search)
|
|
43
|
+
};
|
|
44
|
+
}, [history, disabled, rest.pathname, rest.search]),
|
|
45
|
+
_useMemo$pathname = _useMemo.pathname,
|
|
46
|
+
pathname = _useMemo$pathname === void 0 ? '' : _useMemo$pathname,
|
|
47
|
+
_useMemo$search = _useMemo.search,
|
|
48
|
+
search = _useMemo$search === void 0 ? '' : _useMemo$search;
|
|
49
|
+
var linkComponent = /*#__PURE__*/React__default.createElement("div", {
|
|
50
|
+
className: classNames('forwardLink', className)
|
|
51
|
+
}, disabled ? /*#__PURE__*/React__default.createElement("div", {
|
|
52
|
+
title: tip ? undefined : title,
|
|
53
|
+
className: "forwardLink__link--disabled"
|
|
54
|
+
}, children) : /*#__PURE__*/React__default.createElement(Link, {
|
|
55
|
+
className: "forwardLink__link",
|
|
56
|
+
target: target,
|
|
57
|
+
title: tip ? undefined : title,
|
|
58
|
+
to: {
|
|
59
|
+
pathname: "".concat(locale).concat(pathname),
|
|
60
|
+
search: search
|
|
61
|
+
}
|
|
62
|
+
}, children));
|
|
63
|
+
if (tip) {
|
|
64
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
65
|
+
title: tip,
|
|
66
|
+
placement: "top"
|
|
67
|
+
}, linkComponent);
|
|
68
|
+
}
|
|
69
|
+
return linkComponent;
|
|
70
|
+
};
|
|
71
|
+
ForwardLink.defaultProps = {
|
|
72
|
+
className: undefined,
|
|
73
|
+
title: undefined,
|
|
74
|
+
target: '_blank',
|
|
75
|
+
disabled: undefined,
|
|
76
|
+
children: undefined,
|
|
77
|
+
search: undefined,
|
|
78
|
+
tip: undefined,
|
|
79
|
+
onClick: function onClick() {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
85
|
+
ForwardLink.propTypes = {
|
|
86
|
+
/** Css Name */
|
|
87
|
+
className: PropTypes.string,
|
|
88
|
+
/** DOM title */
|
|
89
|
+
title: PropTypes.string,
|
|
90
|
+
/** DOM title */
|
|
91
|
+
target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
|
|
92
|
+
/** 是否取消點擊 */
|
|
93
|
+
disabled: PropTypes.bool,
|
|
94
|
+
/** 子項目 */
|
|
95
|
+
children: PropTypes.node,
|
|
96
|
+
/** 欲前往的連結 */
|
|
97
|
+
pathname: PropTypes.string.isRequired,
|
|
98
|
+
/** 欲前往連結的參數 */
|
|
99
|
+
search: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
100
|
+
/** 彈跳提示文字 */
|
|
101
|
+
tip: PropTypes.string,
|
|
102
|
+
/** 元件被點即時的callback,返回false會停止元件導向 */
|
|
103
|
+
onClick: PropTypes.func
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { ForwardLink as default };
|
package/lib/components/Header.js
CHANGED
|
@@ -1 +1,186 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { a as _slicedToArray } from './_rollupPluginBabelHelpers-fde6d1c6.js';
|
|
2
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { s as styleInject, d as debounce_1, c as classNames } from './vendor-851c6356.js';
|
|
5
|
+
import { useHistory, useRouteMatch, NavLink } from 'react-router-dom';
|
|
6
|
+
import { Typography, IconButton } from '@material-ui/core';
|
|
7
|
+
import { SearchOutlined } from '@material-ui/icons';
|
|
8
|
+
import { K as KeywordSearch } from './KeywordSearch-224f84c1.js';
|
|
9
|
+
import { S as Select } from './Select-98a8e973.js';
|
|
10
|
+
import { c as checkLanguageSupport, D as Drawer, d as defaultSupportLanguage } from './Drawer-af3ed21a.js';
|
|
11
|
+
import 'react-is';
|
|
12
|
+
import '@material-ui/styles';
|
|
13
|
+
import 'react-dom';
|
|
14
|
+
import 'axios';
|
|
15
|
+
import './Autocomplete-5439ff22.js';
|
|
16
|
+
import '@material-ui/lab';
|
|
17
|
+
import './Empty-70f040a9.js';
|
|
18
|
+
|
|
19
|
+
var css_248z = "@charset \"UTF-8\";\n.header {\n display: flex;\n align-items: center;\n background: rgba(255, 255, 255, 0.6);\n background-color: rgba(255, 255, 255, 0.6);\n padding: 12px 36px !important;\n position: fixed;\n top: 0;\n z-index: 10;\n width: 100% !important;\n transition: top 0.3s ease-in-out;\n box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);\n -webkit-backdrop-filter: blur(4px);\n backdrop-filter: blur(4px); }\n .header__logo {\n display: flex;\n width: -moz-fit-content !important;\n width: fit-content !important;\n margin-right: 30px !important;\n cursor: pointer; }\n .header__logo__img {\n display: flex;\n align-items: center; }\n .header__logo__title {\n white-space: nowrap;\n margin-left: 1rem !important;\n font-size: 1.5rem !important;\n font-weight: 700 !important;\n font-family: 'Noto Sans TC' !important; }\n .header__links {\n display: flex;\n justify-content: flex-end;\n padding-right: 14px; }\n .header__links a {\n text-decoration: none; }\n .header__links--full {\n flex: 1; }\n .header__links__item {\n color: rgba(0, 0, 0, 0.85);\n font-size: 1.125rem !important;\n font-weight: 500 !important;\n white-space: nowrap;\n padding: 6px 14px;\n font-family: 'Noto Sans TC' !important; }\n .header__links__item--active .header__links__item {\n font-weight: 800 !important;\n background: transparent;\n border-radius: 45px; }\n .header__links__item:hover {\n font-weight: 800 !important; }\n .header__language {\n min-width: 100px !important; }\n .header__searchIcon {\n display: none !important; }\n @media screen and (max-width: 768px) {\n .header--smallUseSearchIcon .header__searchIcon {\n display: flex !important;\n margin-right: 10px !important; }\n .header--smallUseSearchIcon .keywordSearch {\n visibility: hidden;\n flex: 1;\n width: 0; } }\n .header--hide {\n top: -100px; }\n .header--focus .header__links {\n display: none; }\n .header .MuiTypography-root {\n width: 100%;\n display: flex;\n align-items: center; }\n .header .autocomplete {\n float: right; }\n .header .autocomplete .MuiAutocomplete-inputRoot[class*='MuiOutlinedInput-root'] {\n padding: 1px 8px !important; }\n .header .keywordSearch {\n margin-right: 8px; }\n .header .keywordSearch--focus .autocomplete {\n width: 100% !important; }\n .header .keywordSearch--animation .autocomplete {\n width: 240px;\n transition: width 0.3s ease-in-out; }\n\n/* 避免寬度460以下炸版 */\n@media screen and (max-width: 460px) {\n .header .keywordSearch--animation .autocomplete {\n width: 100%; } }\n\n@media screen and (max-width: 768px) {\n .header {\n padding: 12px 15px !important; }\n .header__logo {\n margin-right: 16px !important; }\n .header__logo__title {\n display: none !important; }\n .header__links {\n display: none; }\n .header__links__item {\n font-size: 1rem !important; }\n .header__language {\n display: none !important; }\n .header--focus .header__logo {\n display: none !important; }\n .autocomplete__icon {\n display: none !important; } }\n";
|
|
20
|
+
styleInject(css_248z);
|
|
21
|
+
|
|
22
|
+
var showDarkModeSwitch = false;
|
|
23
|
+
var Header = function Header(props) {
|
|
24
|
+
var title = props.title,
|
|
25
|
+
logo = props.logo,
|
|
26
|
+
locale = props.locale,
|
|
27
|
+
supportLanguages = props.supportLanguages,
|
|
28
|
+
pages = props.pages;
|
|
29
|
+
props.darkMode;
|
|
30
|
+
var typographyColor = props.typographyColor,
|
|
31
|
+
className = props.className;
|
|
32
|
+
var searchAPI = props.searchAPI,
|
|
33
|
+
searchPlaceholder = props.searchPlaceholder,
|
|
34
|
+
smallUseSearchIcon = props.smallUseSearchIcon;
|
|
35
|
+
var onSearch = props.onSearch;
|
|
36
|
+
props.setDarkMode;
|
|
37
|
+
var onLanguageChange = props.onLanguageChange,
|
|
38
|
+
onSearchIconClick = props.onSearchIconClick;
|
|
39
|
+
var history = useHistory();
|
|
40
|
+
var search = history.location.search;
|
|
41
|
+
var _useRouteMatch = useRouteMatch(),
|
|
42
|
+
url = _useRouteMatch.url;
|
|
43
|
+
// const { keyword } = queryString.parse(search);
|
|
44
|
+
var _useState = useState(false),
|
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
46
|
+
hideHeader = _useState2[0],
|
|
47
|
+
setHideHeader = _useState2[1];
|
|
48
|
+
var _useState3 = useState(false),
|
|
49
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
50
|
+
menuOpen = _useState4[0],
|
|
51
|
+
setMenuOpen = _useState4[1];
|
|
52
|
+
var handleScroll = useRef(debounce_1(function () {
|
|
53
|
+
return setHideHeader(window.scrollY > 100);
|
|
54
|
+
}, 10)).current;
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
window.addEventListener('scroll', handleScroll);
|
|
57
|
+
return function () {
|
|
58
|
+
window.removeEventListener('scroll', handleScroll);
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
useEffect(function () {
|
|
62
|
+
setMenuOpen(false);
|
|
63
|
+
}, [search]);
|
|
64
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
65
|
+
className: classNames('MuiPaper-root', 'header', {
|
|
66
|
+
'header--smallUseSearchIcon': smallUseSearchIcon
|
|
67
|
+
}, {
|
|
68
|
+
'header--hide': hideHeader
|
|
69
|
+
}, {
|
|
70
|
+
'header--focus': menuOpen
|
|
71
|
+
}, className)
|
|
72
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
73
|
+
className: "header__logo",
|
|
74
|
+
onClick: function onClick() {
|
|
75
|
+
return history.push("/".concat(locale));
|
|
76
|
+
}
|
|
77
|
+
}, logo && /*#__PURE__*/React__default.createElement("div", {
|
|
78
|
+
className: "header__logo__img"
|
|
79
|
+
}, logo), !menuOpen && title && /*#__PURE__*/React__default.createElement(Typography, {
|
|
80
|
+
color: typographyColor,
|
|
81
|
+
className: "header__logo__title"
|
|
82
|
+
}, title)), searchAPI && /*#__PURE__*/React__default.createElement(KeywordSearch, {
|
|
83
|
+
animation: true
|
|
84
|
+
// keyword={keyword}
|
|
85
|
+
,
|
|
86
|
+
searchAPI: searchAPI,
|
|
87
|
+
placeholder: searchPlaceholder,
|
|
88
|
+
menuOpen: menuOpen,
|
|
89
|
+
setMenuOpen: setMenuOpen,
|
|
90
|
+
onSearch: onSearch
|
|
91
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
92
|
+
className: classNames('header__links', {
|
|
93
|
+
'header__links--full': !searchAPI
|
|
94
|
+
})
|
|
95
|
+
}, (Array.isArray(pages) ? pages : []).filter(function (_ref) {
|
|
96
|
+
var showInHeader = _ref.showInHeader;
|
|
97
|
+
return showInHeader;
|
|
98
|
+
}).map(function (_ref2, i) {
|
|
99
|
+
var _ref2$path = _ref2.path,
|
|
100
|
+
path = _ref2$path === void 0 ? '' : _ref2$path,
|
|
101
|
+
name = _ref2.name;
|
|
102
|
+
var label = /*#__PURE__*/React__default.createElement(Typography, {
|
|
103
|
+
className: "header__links__item",
|
|
104
|
+
color: typographyColor
|
|
105
|
+
}, name);
|
|
106
|
+
return path.indexOf('http') > -1 ? /*#__PURE__*/React__default.createElement("a", {
|
|
107
|
+
key: i.toString(),
|
|
108
|
+
href: path,
|
|
109
|
+
className: "header__links__item--active"
|
|
110
|
+
}, label) : /*#__PURE__*/React__default.createElement(NavLink, {
|
|
111
|
+
key: i.toString(),
|
|
112
|
+
to: "".concat(url).concat(path),
|
|
113
|
+
activeClassName: "header__links__item--active"
|
|
114
|
+
}, label);
|
|
115
|
+
})), /*#__PURE__*/React__default.createElement(IconButton, {
|
|
116
|
+
className: "header__searchIcon",
|
|
117
|
+
onClick: onSearchIconClick
|
|
118
|
+
}, /*#__PURE__*/React__default.createElement(SearchOutlined, {
|
|
119
|
+
fontSize: "large"
|
|
120
|
+
})), showDarkModeSwitch , Array.isArray(supportLanguages) && supportLanguages.length > 0 && /*#__PURE__*/React__default.createElement(Select, {
|
|
121
|
+
className: "header__language",
|
|
122
|
+
defaultValue: checkLanguageSupport({
|
|
123
|
+
language: locale,
|
|
124
|
+
supportLanguages: supportLanguages
|
|
125
|
+
}),
|
|
126
|
+
onChange: function onChange(value) {
|
|
127
|
+
return onLanguageChange(value);
|
|
128
|
+
},
|
|
129
|
+
options: supportLanguages
|
|
130
|
+
}), /*#__PURE__*/React__default.createElement(Drawer, {
|
|
131
|
+
title: title,
|
|
132
|
+
logo: logo,
|
|
133
|
+
drawerList: pages,
|
|
134
|
+
supportLanguages: supportLanguages
|
|
135
|
+
}));
|
|
136
|
+
};
|
|
137
|
+
Header.defaultProps = {
|
|
138
|
+
className: undefined,
|
|
139
|
+
title: undefined,
|
|
140
|
+
logo: undefined,
|
|
141
|
+
locale: undefined,
|
|
142
|
+
supportLanguages: defaultSupportLanguage,
|
|
143
|
+
darkMode: false,
|
|
144
|
+
typographyColor: 'primary',
|
|
145
|
+
searchAPI: undefined,
|
|
146
|
+
searchPlaceholder: undefined,
|
|
147
|
+
smallUseSearchIcon: undefined,
|
|
148
|
+
onSearch: function onSearch() {},
|
|
149
|
+
setDarkMode: function setDarkMode() {},
|
|
150
|
+
onLanguageChange: function onLanguageChange() {},
|
|
151
|
+
onSearchIconClick: function onSearchIconClick() {}
|
|
152
|
+
};
|
|
153
|
+
Header.propTypes = {
|
|
154
|
+
/** Css Name */
|
|
155
|
+
className: PropTypes.string,
|
|
156
|
+
/** 標題(通常為網站名稱) */
|
|
157
|
+
title: PropTypes.string,
|
|
158
|
+
/** 網站Logo */
|
|
159
|
+
logo: PropTypes.node,
|
|
160
|
+
/** 語系 */
|
|
161
|
+
locale: PropTypes.string,
|
|
162
|
+
/** 支援的語系 */
|
|
163
|
+
supportLanguages: PropTypes.arrayOf(PropTypes.any),
|
|
164
|
+
/** 頁面列表 */
|
|
165
|
+
pages: PropTypes.arrayOf(PropTypes.any).isRequired,
|
|
166
|
+
/** 是否為黑暗模式 */
|
|
167
|
+
darkMode: PropTypes.bool,
|
|
168
|
+
/** 文字色系() */
|
|
169
|
+
typographyColor: PropTypes.oneOf(['initial', 'inherit', 'primary', 'secondary', 'textPrimary', 'textSecondary', 'error']),
|
|
170
|
+
/** SearchBar的API */
|
|
171
|
+
searchAPI: PropTypes.string,
|
|
172
|
+
/** SearchBar的提示字 */
|
|
173
|
+
searchPlaceholder: PropTypes.string,
|
|
174
|
+
/** 是否在小畫面的時候使用SearchIcon取代KeywordSearch */
|
|
175
|
+
smallUseSearchIcon: PropTypes.bool,
|
|
176
|
+
/** SearchBar啟動搜尋的callback */
|
|
177
|
+
onSearch: PropTypes.func,
|
|
178
|
+
/** 設定黑暗模式的callback */
|
|
179
|
+
setDarkMode: PropTypes.func,
|
|
180
|
+
/** 語系變動時的callback */
|
|
181
|
+
onLanguageChange: PropTypes.func,
|
|
182
|
+
/** SearchIcon點擊時的callback */
|
|
183
|
+
onSearchIconClick: PropTypes.func
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export { Header as default };
|
package/lib/components/Image.js
CHANGED
|
@@ -1 +1,58 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import { a as _slicedToArray } from './_rollupPluginBabelHelpers-fde6d1c6.js';
|
|
2
|
+
import React__default, { useState } from 'react';
|
|
3
|
+
import { s as styleInject, c as classNames, b as build } from './vendor-851c6356.js';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import 'react-is';
|
|
6
|
+
import '@material-ui/styles';
|
|
7
|
+
import 'react-dom';
|
|
8
|
+
|
|
9
|
+
var css_248z = ".image {\n cursor: pointer; }\n";
|
|
10
|
+
styleInject(css_248z);
|
|
11
|
+
|
|
12
|
+
var Image = function Image(_ref) {
|
|
13
|
+
var className = _ref.className,
|
|
14
|
+
src = _ref.src,
|
|
15
|
+
width = _ref.width,
|
|
16
|
+
thumbnailSrc = _ref.thumbnailSrc;
|
|
17
|
+
var _useState = useState(false),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
isOpen = _useState2[0],
|
|
20
|
+
setIsOpen = _useState2[1];
|
|
21
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("img", {
|
|
22
|
+
src: thumbnailSrc || src,
|
|
23
|
+
className: classNames('image', className),
|
|
24
|
+
style: {
|
|
25
|
+
width: "".concat(width, "px")
|
|
26
|
+
},
|
|
27
|
+
alt: "preview",
|
|
28
|
+
onClick: function onClick() {
|
|
29
|
+
return setIsOpen(true);
|
|
30
|
+
}
|
|
31
|
+
}), isOpen ? /*#__PURE__*/React__default.createElement(build, {
|
|
32
|
+
image: src,
|
|
33
|
+
showTitle: false,
|
|
34
|
+
onClose: function onClose() {
|
|
35
|
+
return setIsOpen(false);
|
|
36
|
+
}
|
|
37
|
+
}) : null);
|
|
38
|
+
};
|
|
39
|
+
Image.defaultProps = {
|
|
40
|
+
className: undefined,
|
|
41
|
+
src: undefined,
|
|
42
|
+
width: 200,
|
|
43
|
+
thumbnailSrc: undefined
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
47
|
+
Image.propTypes = {
|
|
48
|
+
/** Css Name */
|
|
49
|
+
className: PropTypes.string,
|
|
50
|
+
/** 圖片來源 */
|
|
51
|
+
src: PropTypes.string,
|
|
52
|
+
/** 預覽圖片寬度 */
|
|
53
|
+
width: PropTypes.number,
|
|
54
|
+
/** 縮圖來源 */
|
|
55
|
+
thumbnailSrc: PropTypes.string
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { Image as default };
|
package/lib/components/Input.js
CHANGED
|
@@ -1 +1,79 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { s as styleInject, c as classNames } from './vendor-851c6356.js';
|
|
4
|
+
import { OutlinedInput } from '@material-ui/core';
|
|
5
|
+
import 'react-is';
|
|
6
|
+
import '@material-ui/styles';
|
|
7
|
+
import 'react-dom';
|
|
8
|
+
|
|
9
|
+
var css_248z = ".input {\n padding: 12px; }\n";
|
|
10
|
+
styleInject(css_248z);
|
|
11
|
+
|
|
12
|
+
var Input = function Input(props) {
|
|
13
|
+
var className = props.className,
|
|
14
|
+
placeholder = props.placeholder,
|
|
15
|
+
defaultValue = props.defaultValue,
|
|
16
|
+
value = props.value,
|
|
17
|
+
type = props.type; // Attributes
|
|
18
|
+
|
|
19
|
+
var _onChange = props.onChange,
|
|
20
|
+
_onKeyPress = props.onKeyPress,
|
|
21
|
+
onPressEnter = props.onPressEnter; // Call Back Functions
|
|
22
|
+
|
|
23
|
+
var suffix = props.suffix; // Dom Status
|
|
24
|
+
|
|
25
|
+
var OutlinedInputProps = {
|
|
26
|
+
inputProps: {
|
|
27
|
+
className: classNames('input', className)
|
|
28
|
+
},
|
|
29
|
+
placeholder: placeholder,
|
|
30
|
+
defaultValue: defaultValue,
|
|
31
|
+
onChange: function onChange(_ref) {
|
|
32
|
+
var target = _ref.target;
|
|
33
|
+
if (_onChange) _onChange(target.value);
|
|
34
|
+
},
|
|
35
|
+
onKeyPress: function onKeyPress(e) {
|
|
36
|
+
if (e.key === 'Enter' && onPressEnter) onPressEnter(e.key, e.target.value);
|
|
37
|
+
if (_onKeyPress) _onKeyPress(e);
|
|
38
|
+
},
|
|
39
|
+
value: value,
|
|
40
|
+
endAdornment: suffix && /*#__PURE__*/React__default.isValidElement(suffix) ? suffix : null,
|
|
41
|
+
type: type
|
|
42
|
+
};
|
|
43
|
+
return /*#__PURE__*/React__default.createElement(OutlinedInput, OutlinedInputProps);
|
|
44
|
+
};
|
|
45
|
+
Input.defaultProps = {
|
|
46
|
+
className: undefined,
|
|
47
|
+
placeholder: 'Please enter text',
|
|
48
|
+
defaultValue: undefined,
|
|
49
|
+
value: undefined,
|
|
50
|
+
onChange: undefined,
|
|
51
|
+
onKeyPress: undefined,
|
|
52
|
+
onPressEnter: undefined,
|
|
53
|
+
suffix: null,
|
|
54
|
+
type: 'text'
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
58
|
+
Input.propTypes = {
|
|
59
|
+
/** Css Name */
|
|
60
|
+
className: PropTypes.string,
|
|
61
|
+
/** Placeholder */
|
|
62
|
+
placeholder: PropTypes.string,
|
|
63
|
+
/** Default Value */
|
|
64
|
+
defaultValue: PropTypes.string,
|
|
65
|
+
/** Value */
|
|
66
|
+
value: PropTypes.string,
|
|
67
|
+
/** onChange Call Back */
|
|
68
|
+
onChange: PropTypes.func,
|
|
69
|
+
/** onKeyPress Call Back */
|
|
70
|
+
onKeyPress: PropTypes.func,
|
|
71
|
+
/** onPressEnter Call Back */
|
|
72
|
+
onPressEnter: PropTypes.func,
|
|
73
|
+
/** Custom Icon Area */
|
|
74
|
+
suffix: PropTypes.node,
|
|
75
|
+
/** HTML5 Input type */
|
|
76
|
+
type: PropTypes.string
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export { Input as default };
|