@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,124 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { s as styleInject, c as classNames } from './vendor-851c6356.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { NavLink } from 'react-router-dom';
|
|
5
|
+
import { Typography, Breadcrumbs as Breadcrumbs$1 } from '@material-ui/core';
|
|
6
|
+
import 'react-is';
|
|
7
|
+
import '@material-ui/styles';
|
|
8
|
+
import 'react-dom';
|
|
9
|
+
|
|
10
|
+
var css_248z$1 = ".breadcrumbItem {\n display: flex;\n opacity: 0.8;\n transition: opacity 0.1s ease-in-out; }\n .breadcrumbItem:hover {\n opacity: 1; }\n .breadcrumbItem--last {\n opacity: 1;\n font-weight: 500 !important; }\n .breadcrumbItem__icon {\n display: flex;\n align-items: center;\n margin-right: 4px; }\n .breadcrumbItem__icon svg {\n font-size: 18px; }\n";
|
|
11
|
+
styleInject(css_248z$1);
|
|
12
|
+
|
|
13
|
+
const BreadcrumbItem = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
className,
|
|
16
|
+
icon,
|
|
17
|
+
text,
|
|
18
|
+
lastItem,
|
|
19
|
+
onClick
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
22
|
+
color: "textPrimary",
|
|
23
|
+
className: className,
|
|
24
|
+
onClick: onClick
|
|
25
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
26
|
+
className: classNames('breadcrumbItem', {
|
|
27
|
+
'breadcrumbItem--last': lastItem
|
|
28
|
+
})
|
|
29
|
+
}, icon && /*#__PURE__*/React__default.createElement("span", {
|
|
30
|
+
className: "breadcrumbItem__icon"
|
|
31
|
+
}, icon), /*#__PURE__*/React__default.createElement("span", {
|
|
32
|
+
className: "breadcrumbItem__text"
|
|
33
|
+
}, text)));
|
|
34
|
+
};
|
|
35
|
+
BreadcrumbItem.defaultProps = {
|
|
36
|
+
className: undefined,
|
|
37
|
+
icon: undefined,
|
|
38
|
+
text: undefined,
|
|
39
|
+
lastItem: undefined,
|
|
40
|
+
onClick: () => {}
|
|
41
|
+
};
|
|
42
|
+
BreadcrumbItem.propTypes = {
|
|
43
|
+
className: PropTypes.string,
|
|
44
|
+
icon: PropTypes.node,
|
|
45
|
+
text: PropTypes.string,
|
|
46
|
+
lastItem: PropTypes.bool,
|
|
47
|
+
onClick: PropTypes.func
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var css_248z = ".breadcrumbs__link {\n cursor: pointer;\n text-decoration: none !important; }\n";
|
|
51
|
+
styleInject(css_248z);
|
|
52
|
+
|
|
53
|
+
var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
54
|
+
var className = _ref.className,
|
|
55
|
+
links = _ref.links,
|
|
56
|
+
separator = _ref.separator;
|
|
57
|
+
return /*#__PURE__*/React__default.createElement(Breadcrumbs$1, {
|
|
58
|
+
className: classNames('breadcrumbs', className),
|
|
59
|
+
"aria-label": "breadcrumb",
|
|
60
|
+
separator: separator && separator.length > 0 ? separator : undefined
|
|
61
|
+
}, Array.isArray(links) && links.length > 0 && links.map(function (_ref2, i) {
|
|
62
|
+
var icon = _ref2.icon,
|
|
63
|
+
text = _ref2.text,
|
|
64
|
+
href = _ref2.href,
|
|
65
|
+
onClick = _ref2.onClick;
|
|
66
|
+
var lastLink = i === links.length - 1;
|
|
67
|
+
|
|
68
|
+
/* 尾巴 */
|
|
69
|
+
if (lastLink) return /*#__PURE__*/React__default.createElement(BreadcrumbItem, {
|
|
70
|
+
key: i.toString(),
|
|
71
|
+
lastItem: true,
|
|
72
|
+
icon: icon,
|
|
73
|
+
text: text,
|
|
74
|
+
onClick: onClick
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
/* 頭 */
|
|
78
|
+
if (i === 0) {
|
|
79
|
+
return /*#__PURE__*/React__default.createElement(NavLink, {
|
|
80
|
+
className: "breadcrumbs__link",
|
|
81
|
+
key: i.toString(),
|
|
82
|
+
to: href || '/',
|
|
83
|
+
onClick: onClick
|
|
84
|
+
}, /*#__PURE__*/React__default.createElement(BreadcrumbItem, {
|
|
85
|
+
icon: icon,
|
|
86
|
+
text: text
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* 中間 */
|
|
91
|
+
return href ? /*#__PURE__*/React__default.createElement(NavLink, {
|
|
92
|
+
className: "breadcrumbs__link",
|
|
93
|
+
key: i.toString(),
|
|
94
|
+
to: href,
|
|
95
|
+
onClick: onClick
|
|
96
|
+
}, /*#__PURE__*/React__default.createElement(BreadcrumbItem, {
|
|
97
|
+
icon: icon,
|
|
98
|
+
text: text
|
|
99
|
+
})) : /*#__PURE__*/React__default.createElement(BreadcrumbItem, {
|
|
100
|
+
key: i.toString(),
|
|
101
|
+
lastItem: true,
|
|
102
|
+
icon: icon,
|
|
103
|
+
text: text,
|
|
104
|
+
onClick: onClick
|
|
105
|
+
});
|
|
106
|
+
}));
|
|
107
|
+
};
|
|
108
|
+
Breadcrumbs.defaultProps = {
|
|
109
|
+
className: undefined,
|
|
110
|
+
links: undefined,
|
|
111
|
+
separator: undefined
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
115
|
+
Breadcrumbs.propTypes = {
|
|
116
|
+
/** Css Name */
|
|
117
|
+
className: PropTypes.string,
|
|
118
|
+
/** 麵包穴的連結們 */
|
|
119
|
+
links: PropTypes.arrayOf(PropTypes.any),
|
|
120
|
+
/** 分割者的符號 */
|
|
121
|
+
separator: PropTypes.string
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export { Breadcrumbs as default };
|
|
@@ -1 +1,91 @@
|
|
|
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 { Button as Button$1, CircularProgress } from '@material-ui/core';
|
|
5
|
+
|
|
6
|
+
var css_248z = ".button {\n border: 1px solid #ffffff99;\n border-radius: 45px;\n padding: 8px 16px;\n background: #007bff;\n color: white;\n cursor: pointer; }\n .button:hover {\n opacity: 0.9; }\n";
|
|
7
|
+
styleInject(css_248z);
|
|
8
|
+
|
|
9
|
+
var Button = function Button(props) {
|
|
10
|
+
var style = props.style,
|
|
11
|
+
className = props.className,
|
|
12
|
+
tabIndex = props.tabIndex,
|
|
13
|
+
alt = props.alt,
|
|
14
|
+
text = props.text,
|
|
15
|
+
size = props.size,
|
|
16
|
+
variant = props.variant;
|
|
17
|
+
var type = props.type,
|
|
18
|
+
color = props.color,
|
|
19
|
+
loading = props.loading,
|
|
20
|
+
disabled = props.disabled,
|
|
21
|
+
icon = props.icon,
|
|
22
|
+
endIcon = props.endIcon,
|
|
23
|
+
children = props.children,
|
|
24
|
+
onClick = props.onClick;
|
|
25
|
+
return /*#__PURE__*/React__default.createElement(Button$1, {
|
|
26
|
+
style: style,
|
|
27
|
+
className: classNames('button', className),
|
|
28
|
+
tabIndex: tabIndex,
|
|
29
|
+
alt: alt,
|
|
30
|
+
size: size,
|
|
31
|
+
variant: variant,
|
|
32
|
+
color: type || color,
|
|
33
|
+
disabled: loading || disabled,
|
|
34
|
+
onClick: onClick,
|
|
35
|
+
startIcon: icon,
|
|
36
|
+
endIcon: loading ? /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
37
|
+
size: 16
|
|
38
|
+
}) : endIcon
|
|
39
|
+
}, text, children);
|
|
40
|
+
};
|
|
41
|
+
Button.defaultProps = {
|
|
42
|
+
style: undefined,
|
|
43
|
+
className: undefined,
|
|
44
|
+
tabIndex: undefined,
|
|
45
|
+
alt: undefined,
|
|
46
|
+
text: undefined,
|
|
47
|
+
loading: false,
|
|
48
|
+
disabled: false,
|
|
49
|
+
variant: undefined,
|
|
50
|
+
size: 'small',
|
|
51
|
+
color: 'primary',
|
|
52
|
+
type: undefined,
|
|
53
|
+
children: undefined,
|
|
54
|
+
icon: undefined,
|
|
55
|
+
endIcon: undefined,
|
|
56
|
+
onClick: function onClick() {}
|
|
57
|
+
};
|
|
58
|
+
Button.propTypes = {
|
|
59
|
+
/** 樣式 */
|
|
60
|
+
style: PropTypes.objectOf(PropTypes.any),
|
|
61
|
+
/** Css Name */
|
|
62
|
+
className: PropTypes.string,
|
|
63
|
+
/** Tab 鍵位置 */
|
|
64
|
+
tabIndex: PropTypes.number,
|
|
65
|
+
/** 註解 */
|
|
66
|
+
alt: PropTypes.string,
|
|
67
|
+
/** 輸入的文字 */
|
|
68
|
+
text: PropTypes.string,
|
|
69
|
+
/** 是否載入中 */
|
|
70
|
+
loading: PropTypes.bool,
|
|
71
|
+
/** 是否禁用 */
|
|
72
|
+
disabled: PropTypes.bool,
|
|
73
|
+
/** 按鈕種類 */
|
|
74
|
+
variant: PropTypes.oneOf(['contained', 'outlined', 'text']),
|
|
75
|
+
/** 按鈕的大小 */
|
|
76
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
77
|
+
/** 按鈕顏色 */
|
|
78
|
+
color: PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary']),
|
|
79
|
+
/** 按鈕樣式(同按鈕顏色) */
|
|
80
|
+
type: PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary']),
|
|
81
|
+
/** 按鈕內容 */
|
|
82
|
+
children: PropTypes.node,
|
|
83
|
+
/** 按鈕圖案(前面) */
|
|
84
|
+
icon: PropTypes.node,
|
|
85
|
+
/** 按鈕圖案(後面) */
|
|
86
|
+
endIcon: PropTypes.node,
|
|
87
|
+
/** 點擊後的返回 */
|
|
88
|
+
onClick: PropTypes.func
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export { Button as B };
|
package/lib/components/Button.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export{B as default}from
|
|
1
|
+
export { B as default } from './Button-63c7e9f3.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'prop-types';
|
|
4
|
+
import './vendor-851c6356.js';
|
|
5
|
+
import 'react-is';
|
|
6
|
+
import '@material-ui/styles';
|
|
7
|
+
import 'react-dom';
|
|
8
|
+
import '@material-ui/core';
|
|
@@ -1 +1,61 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import { c as _objectWithoutProperties, b as _objectSpread2, _ as _extends } from './_rollupPluginBabelHelpers-fde6d1c6.js';
|
|
2
|
+
import React__default, { forwardRef, useRef, useImperativeHandle } from 'react';
|
|
3
|
+
import { s as styleInject, S as Slider, c as classNames } 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 = ".carousel .slick-arrow {\n display: none !important; }\n";
|
|
10
|
+
styleInject(css_248z);
|
|
11
|
+
|
|
12
|
+
var _excluded = ["className", "autoplay", "children"];
|
|
13
|
+
var Carousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
14
|
+
var className = _ref.className,
|
|
15
|
+
autoplay = _ref.autoplay,
|
|
16
|
+
children = _ref.children,
|
|
17
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
+
var sliderRef = useRef(null);
|
|
19
|
+
var settings = _objectSpread2({
|
|
20
|
+
dots: true,
|
|
21
|
+
fade: true,
|
|
22
|
+
infinite: true,
|
|
23
|
+
slidesToShow: 1,
|
|
24
|
+
slidesToScroll: 1,
|
|
25
|
+
autoplay: autoplay,
|
|
26
|
+
speed: 500,
|
|
27
|
+
autoplaySpeed: 2000,
|
|
28
|
+
cssEase: 'linear'
|
|
29
|
+
}, props);
|
|
30
|
+
useImperativeHandle(ref, function () {
|
|
31
|
+
return {
|
|
32
|
+
prev: function prev() {
|
|
33
|
+
sliderRef.current.slickPrev();
|
|
34
|
+
},
|
|
35
|
+
next: function next() {
|
|
36
|
+
sliderRef.current.slickNext();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
return /*#__PURE__*/React__default.createElement(Slider, _extends({
|
|
41
|
+
className: classNames('carousel', className),
|
|
42
|
+
ref: sliderRef
|
|
43
|
+
}, settings), children);
|
|
44
|
+
});
|
|
45
|
+
Carousel.defaultProps = {
|
|
46
|
+
className: undefined,
|
|
47
|
+
autoplay: false,
|
|
48
|
+
children: undefined
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
52
|
+
Carousel.propTypes = {
|
|
53
|
+
/** Css Name */
|
|
54
|
+
className: PropTypes.string,
|
|
55
|
+
/** 自動撥放 */
|
|
56
|
+
autoplay: PropTypes.bool,
|
|
57
|
+
/** 子元件 */
|
|
58
|
+
children: PropTypes.arrayOf(PropTypes.any)
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { Carousel as default };
|
|
@@ -1 +1,37 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import { c as _objectWithoutProperties, _ as _extends } from './_rollupPluginBabelHelpers-fde6d1c6.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { FormControlLabel, Checkbox as Checkbox$1 } from '@material-ui/core';
|
|
5
|
+
|
|
6
|
+
var _excluded = ["onCheck", "disabled", "children"];
|
|
7
|
+
var Checkbox = function Checkbox(_ref) {
|
|
8
|
+
var onCheck = _ref.onCheck,
|
|
9
|
+
disabled = _ref.disabled,
|
|
10
|
+
children = _ref.children,
|
|
11
|
+
prop = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
return /*#__PURE__*/React__default.createElement(FormControlLabel, {
|
|
13
|
+
control: /*#__PURE__*/React__default.createElement(Checkbox$1, _extends({}, prop, {
|
|
14
|
+
disabled: disabled,
|
|
15
|
+
onChange: function onChange(event) {
|
|
16
|
+
onCheck(event && event.target && event.target.checked);
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
}
|
|
19
|
+
})),
|
|
20
|
+
label: children
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
Checkbox.defaultProps = {
|
|
24
|
+
disabled: undefined,
|
|
25
|
+
children: undefined,
|
|
26
|
+
onCheck: function onCheck() {}
|
|
27
|
+
};
|
|
28
|
+
Checkbox.propTypes = {
|
|
29
|
+
/** 是否禁止使用 */
|
|
30
|
+
disabled: PropTypes.bool,
|
|
31
|
+
/** 顯示的內容值 */
|
|
32
|
+
children: PropTypes.node,
|
|
33
|
+
/** 勾選時的callback */
|
|
34
|
+
onCheck: PropTypes.func
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { Checkbox as default };
|
|
@@ -1 +1,181 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { a as _slicedToArray } from './_rollupPluginBabelHelpers-fde6d1c6.js';
|
|
2
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { s as styleInject, c as classNames } from './vendor-851c6356.js';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { Typography } from '@material-ui/core';
|
|
6
|
+
import { M as MoreButton } from './MoreButton-f15ca38e.js';
|
|
7
|
+
import 'react-is';
|
|
8
|
+
import '@material-ui/styles';
|
|
9
|
+
import 'react-dom';
|
|
10
|
+
import '@material-ui/icons';
|
|
11
|
+
|
|
12
|
+
const HtmlToReactParser = require('html-to-react').Parser;
|
|
13
|
+
const htmlToReactParser = new HtmlToReactParser();
|
|
14
|
+
|
|
15
|
+
// full options list (defaults)
|
|
16
|
+
const md = require('markdown-it')({
|
|
17
|
+
html: true,
|
|
18
|
+
// Enable HTML tags in source
|
|
19
|
+
xhtmlOut: true,
|
|
20
|
+
// Use '/' to close single tags (<br />).
|
|
21
|
+
// This is only for full CommonMark compatibility.
|
|
22
|
+
breaks: true,
|
|
23
|
+
// Convert '\n' in paragraphs into <br>
|
|
24
|
+
langPrefix: 'language-',
|
|
25
|
+
// CSS language prefix for fenced blocks. Can be
|
|
26
|
+
// useful for external highlighters.
|
|
27
|
+
linkify: false,
|
|
28
|
+
// Autoconvert URL-like text to links
|
|
29
|
+
|
|
30
|
+
// Enable some language-neutral replacement + quotes beautification
|
|
31
|
+
// For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js
|
|
32
|
+
typographer: false,
|
|
33
|
+
// Double + single quotes replacement pairs, when typographer enabled,
|
|
34
|
+
// and smartquotes on. Could be either a String or an Array.
|
|
35
|
+
//
|
|
36
|
+
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
|
|
37
|
+
// and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
|
|
38
|
+
quotes: '“”‘’',
|
|
39
|
+
// Highlighter function. Should return escaped HTML,
|
|
40
|
+
// or '' if the source string is not changed and should be escaped externally.
|
|
41
|
+
// If result starts with <pre... internal wrapper is skipped.
|
|
42
|
+
highlight( /* str, lang */
|
|
43
|
+
) {
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
49
|
+
const convert2HtmlEntities = text => {
|
|
50
|
+
if (text === undefined) return '';
|
|
51
|
+
return htmlToReactParser.parse(md.render(text));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/* eslint-disable react/no-danger */
|
|
55
|
+
var textDivider = (text => {
|
|
56
|
+
if (!text || text.length === 0) return text;
|
|
57
|
+
return (
|
|
58
|
+
/*#__PURE__*/
|
|
59
|
+
// <div
|
|
60
|
+
// dangerouslySetInnerHTML={{
|
|
61
|
+
// __html: `<div>${convert2HtmlEntities(text.replaceAll('\n\n', '\n').split('\n').join('<div/><br/><div>'))}</div>`,
|
|
62
|
+
// }}
|
|
63
|
+
// />
|
|
64
|
+
React__default.createElement("div", null, convert2HtmlEntities(text.replaceAll('\n\n', '\n').split('\n').join('<div/><br/><div>')))
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var css_248z = ".collapseContent__desc {\n font-size: 1.5rem !important;\n text-indent: 3rem;\n font-family: 'Noto Sans TC', 'Arial', sans-serif !important;\n display: -webkit-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n white-space: pre-wrap;\n word-break: break-all; }\n .collapseContent__desc p,\n .collapseContent__desc pre {\n margin: 0; }\n .collapseContent__desc--1 {\n -webkit-line-clamp: 1; }\n .collapseContent__desc--2 {\n -webkit-line-clamp: 2; }\n .collapseContent__desc--3 {\n -webkit-line-clamp: 3; }\n .collapseContent__desc--4 {\n -webkit-line-clamp: 4; }\n .collapseContent__desc--5 {\n -webkit-line-clamp: 5; }\n .collapseContent__desc--10 {\n -webkit-line-clamp: 10; }\n .collapseContent__desc--lightHeight {\n line-height: 2.25; }\n .collapseContent__desc--expand {\n -webkit-line-clamp: initial; }\n .collapseContent__desc--indent {\n text-indent: 3rem; }\n";
|
|
69
|
+
styleInject(css_248z);
|
|
70
|
+
|
|
71
|
+
// const remUnit = 16;
|
|
72
|
+
|
|
73
|
+
var CollapseContent = function CollapseContent(props) {
|
|
74
|
+
var className = props.className,
|
|
75
|
+
content = props.content,
|
|
76
|
+
textColor = props.textColor,
|
|
77
|
+
lineClamp = props.lineClamp,
|
|
78
|
+
useLightHeight = props.useLightHeight,
|
|
79
|
+
useTextIndent = props.useTextIndent;
|
|
80
|
+
var formatMessage = props.formatMessage,
|
|
81
|
+
primaryColor = props.primaryColor,
|
|
82
|
+
secondaryColor = props.secondaryColor,
|
|
83
|
+
shadowColor = props.shadowColor;
|
|
84
|
+
if (!content) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null); // 元件不可以回傳undefined storybook會該該叫
|
|
85
|
+
|
|
86
|
+
var _useState = useState(),
|
|
87
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
88
|
+
expand = _useState2[0],
|
|
89
|
+
setExpand = _useState2[1];
|
|
90
|
+
var _useState3 = useState(),
|
|
91
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
92
|
+
overflow = _useState4[0],
|
|
93
|
+
setOverflow = _useState4[1];
|
|
94
|
+
var contentRef = useRef();
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
if (!content) return;
|
|
97
|
+
if (contentRef && contentRef.current) {
|
|
98
|
+
// const childrenDOM = contentRef.current.children || [];
|
|
99
|
+
// const dom = childrenDOM.length === 1 ? contentRef.current.children[0] : contentRef.current;
|
|
100
|
+
var dom = contentRef.current;
|
|
101
|
+
var _ref = dom || {},
|
|
102
|
+
clientHeight = _ref.clientHeight,
|
|
103
|
+
scrollHeight = _ref.scrollHeight;
|
|
104
|
+
setOverflow(scrollHeight > clientHeight);
|
|
105
|
+
}
|
|
106
|
+
}, [contentRef, content]);
|
|
107
|
+
|
|
108
|
+
// const { fontSizeRem, textIndent } = useMemo(
|
|
109
|
+
// () => ({ fontSizeRem: `${fontSize / remUnit}rem`, textIndent: `${(fontSize / remUnit) * 2}rem` }),
|
|
110
|
+
// [fontSize]
|
|
111
|
+
// );
|
|
112
|
+
|
|
113
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
114
|
+
className: classNames('collapseContent', className)
|
|
115
|
+
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
116
|
+
ref: contentRef,
|
|
117
|
+
variant: "inherit",
|
|
118
|
+
className: classNames('collapseContent__desc', "collapseContent__desc--".concat(lineClamp <= 5 ? lineClamp : 10), {
|
|
119
|
+
'collapseContent__desc--indent': useTextIndent
|
|
120
|
+
}, {
|
|
121
|
+
'collapseContent__desc--expand': expand
|
|
122
|
+
}, {
|
|
123
|
+
'collapseContent__desc--lightHeight': useLightHeight
|
|
124
|
+
}),
|
|
125
|
+
color: "textSecondary",
|
|
126
|
+
style: {
|
|
127
|
+
color: textColor
|
|
128
|
+
}
|
|
129
|
+
}, textDivider(content)), overflow && /*#__PURE__*/React__default.createElement(MoreButton, {
|
|
130
|
+
small: true,
|
|
131
|
+
primaryColor: primaryColor,
|
|
132
|
+
secondaryColor: secondaryColor,
|
|
133
|
+
shadowColor: shadowColor,
|
|
134
|
+
formatMessage: formatMessage,
|
|
135
|
+
expand: expand,
|
|
136
|
+
setExpand: setExpand
|
|
137
|
+
}));
|
|
138
|
+
};
|
|
139
|
+
CollapseContent.defaultProps = {
|
|
140
|
+
className: undefined,
|
|
141
|
+
content: undefined,
|
|
142
|
+
textColor: undefined,
|
|
143
|
+
// fontSize: 24,
|
|
144
|
+
lineClamp: 2,
|
|
145
|
+
useLightHeight: undefined,
|
|
146
|
+
useTextIndent: true,
|
|
147
|
+
formatMessage: undefined,
|
|
148
|
+
primaryColor: '#271702',
|
|
149
|
+
// default為文學網站的主色系
|
|
150
|
+
secondaryColor: '#aa8859',
|
|
151
|
+
// default為文學網站的次色系
|
|
152
|
+
shadowColor: undefined
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
156
|
+
CollapseContent.propTypes = {
|
|
157
|
+
/** Css Name */
|
|
158
|
+
className: PropTypes.string,
|
|
159
|
+
/** 內文 */
|
|
160
|
+
content: PropTypes.string,
|
|
161
|
+
/** 內文字體顏色 */
|
|
162
|
+
textColor: PropTypes.string,
|
|
163
|
+
/** 內文字大小 */
|
|
164
|
+
// fontSize: PropTypes.number,
|
|
165
|
+
/** 多行文字縮減 */
|
|
166
|
+
lineClamp: PropTypes.number,
|
|
167
|
+
/** 是否增加lightHeight(2.25) */
|
|
168
|
+
useLightHeight: PropTypes.bool,
|
|
169
|
+
/** 文字前面是否空格 */
|
|
170
|
+
useTextIndent: PropTypes.bool,
|
|
171
|
+
/** 語系翻譯的formateMessag(useIntl) */
|
|
172
|
+
formatMessage: PropTypes.func,
|
|
173
|
+
/** 顯示更多按鈕主色系顏色 */
|
|
174
|
+
primaryColor: PropTypes.string,
|
|
175
|
+
/** 顯示更多按鈕次色系顏色 */
|
|
176
|
+
secondaryColor: PropTypes.string,
|
|
177
|
+
/** 顯示更多按鈕影子顏色 */
|
|
178
|
+
shadowColor: PropTypes.string
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export { CollapseContent as default };
|