@daoyi/nmtl-ui 2.0.1-beta.7 → 2.0.1-beta.71
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-e62927dc.js +334 -0
- package/lib/components/Autocomplete.js +13 -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-4fddcd2f.js +92 -0
- package/lib/components/Button.js +6 -1
- package/lib/components/Carousel.js +4654 -1
- package/lib/components/Checkbox.js +37 -1
- package/lib/components/CollapseContent.js +179 -1
- package/lib/components/ContactModal-33f4e605.js +12020 -0
- package/lib/components/ContactModal.js +22 -3
- package/lib/components/Drawer-fb5bc1ec.js +157 -0
- package/lib/components/Drawer.js +11 -1
- package/lib/components/Dropdown.js +134 -1
- package/lib/components/Empty-e50b760e.js +45 -0
- package/lib/components/Empty.js +5 -1
- package/lib/components/ExportButton.js +112 -1
- package/lib/components/ExtraTools-a49a1d2f.js +3537 -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-6a82c19d.js +106 -0
- package/lib/components/ForwardLink.js +8 -0
- package/lib/components/Header.js +187 -1
- package/lib/components/Image.js +61 -1
- package/lib/components/Input.js +82 -1
- package/lib/components/InputMethod.js +33949 -12
- package/lib/components/KeywordSearch-3af0c402.js +140 -0
- package/lib/components/KeywordSearch.js +15 -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-2c39d5b8.js +108 -0
- package/lib/components/Modal.js +9 -1
- package/lib/components/MoreButton-6b323fe4.js +110 -0
- package/lib/components/MoreButton.js +6 -1
- package/lib/components/Pagination.js +3706 -0
- package/lib/components/Radio.js +78 -1
- package/lib/components/SNA.js +1691 -22
- package/lib/components/Select-0f131640.js +115 -0
- package/lib/components/Select.js +8 -1
- package/lib/components/Spin-1741f625.js +75 -0
- package/lib/components/Spin.js +6 -1
- package/lib/components/Table.js +51 -1
- package/lib/components/Tooltip-65a21a86.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-d9801fb7.js +576 -0
- package/lib/components/dataExport-d55d6fa3.js +92 -0
- package/lib/components/debounce-127da66c.js +355 -0
- package/lib/components/defaultTheme-5839b9b3.js +1505 -0
- package/lib/components/globalConfig.js +175 -0
- package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
- package/lib/components/index-0be0afec.js +481 -0
- package/lib/components/index-ef96775f.js +61 -0
- package/lib/components/isObjectLike-e111475d.js +190 -0
- package/lib/components/style-inject.es-1f59c1d0.js +28 -1
- package/lib/components/transform-3a04288b.js +5475 -0
- package/lib/components/withTheme-4417822c.js +6 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/utils/_rollupPluginBabelHelpers-8dd26e1a.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 +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 +17 -21
- 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-0eb2d36e.js +0 -1
- package/lib/utils/_commonjsHelpers-e2cda605.js +0 -1
- package/lib/utils/_rollupPluginBabelHelpers-928a52ce.js +0 -1
|
@@ -1 +1,37 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import { c as _objectWithoutProperties, _ as _extends } from './_rollupPluginBabelHelpers-a52356f6.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,179 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
2
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { c as classNames } from './index-ef96775f.js';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { Typography } from '@material-ui/core';
|
|
6
|
+
import { M as MoreButton } from './MoreButton-6b323fe4.js';
|
|
7
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
8
|
+
import '@material-ui/icons';
|
|
9
|
+
|
|
10
|
+
const HtmlToReactParser = require('html-to-react').Parser;
|
|
11
|
+
const htmlToReactParser = new HtmlToReactParser();
|
|
12
|
+
|
|
13
|
+
// full options list (defaults)
|
|
14
|
+
const md = require('markdown-it')({
|
|
15
|
+
html: true,
|
|
16
|
+
// Enable HTML tags in source
|
|
17
|
+
xhtmlOut: true,
|
|
18
|
+
// Use '/' to close single tags (<br />).
|
|
19
|
+
// This is only for full CommonMark compatibility.
|
|
20
|
+
breaks: true,
|
|
21
|
+
// Convert '\n' in paragraphs into <br>
|
|
22
|
+
langPrefix: 'language-',
|
|
23
|
+
// CSS language prefix for fenced blocks. Can be
|
|
24
|
+
// useful for external highlighters.
|
|
25
|
+
linkify: false,
|
|
26
|
+
// Autoconvert URL-like text to links
|
|
27
|
+
|
|
28
|
+
// Enable some language-neutral replacement + quotes beautification
|
|
29
|
+
// For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js
|
|
30
|
+
typographer: false,
|
|
31
|
+
// Double + single quotes replacement pairs, when typographer enabled,
|
|
32
|
+
// and smartquotes on. Could be either a String or an Array.
|
|
33
|
+
//
|
|
34
|
+
// For example, you can use '«»„“' for Russian, '„“‚‘' for German,
|
|
35
|
+
// and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
|
|
36
|
+
quotes: '“”‘’',
|
|
37
|
+
// Highlighter function. Should return escaped HTML,
|
|
38
|
+
// or '' if the source string is not changed and should be escaped externally.
|
|
39
|
+
// If result starts with <pre... internal wrapper is skipped.
|
|
40
|
+
highlight( /* str, lang */
|
|
41
|
+
) {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
47
|
+
const convert2HtmlEntities = text => {
|
|
48
|
+
if (text === undefined) return '';
|
|
49
|
+
return htmlToReactParser.parse(md.render(text));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/* eslint-disable react/no-danger */
|
|
53
|
+
var textDivider = (text => {
|
|
54
|
+
if (!text || text.length === 0) return text;
|
|
55
|
+
return (
|
|
56
|
+
/*#__PURE__*/
|
|
57
|
+
// <div
|
|
58
|
+
// dangerouslySetInnerHTML={{
|
|
59
|
+
// __html: `<div>${convert2HtmlEntities(text.replaceAll('\n\n', '\n').split('\n').join('<div/><br/><div>'))}</div>`,
|
|
60
|
+
// }}
|
|
61
|
+
// />
|
|
62
|
+
React__default.createElement("div", null, convert2HtmlEntities(text.replaceAll('\n\n', '\n').split('\n').join('<div/><br/><div>')))
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
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";
|
|
67
|
+
styleInject(css_248z);
|
|
68
|
+
|
|
69
|
+
// const remUnit = 16;
|
|
70
|
+
|
|
71
|
+
var CollapseContent = function CollapseContent(props) {
|
|
72
|
+
var className = props.className,
|
|
73
|
+
content = props.content,
|
|
74
|
+
textColor = props.textColor,
|
|
75
|
+
lineClamp = props.lineClamp,
|
|
76
|
+
useLightHeight = props.useLightHeight,
|
|
77
|
+
useTextIndent = props.useTextIndent;
|
|
78
|
+
var formatMessage = props.formatMessage,
|
|
79
|
+
primaryColor = props.primaryColor,
|
|
80
|
+
secondaryColor = props.secondaryColor,
|
|
81
|
+
shadowColor = props.shadowColor;
|
|
82
|
+
if (!content) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null); // 元件不可以回傳undefined storybook會該該叫
|
|
83
|
+
|
|
84
|
+
var _useState = useState(),
|
|
85
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
86
|
+
expand = _useState2[0],
|
|
87
|
+
setExpand = _useState2[1];
|
|
88
|
+
var _useState3 = useState(),
|
|
89
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
90
|
+
overflow = _useState4[0],
|
|
91
|
+
setOverflow = _useState4[1];
|
|
92
|
+
var contentRef = useRef();
|
|
93
|
+
useEffect(function () {
|
|
94
|
+
if (!content) return;
|
|
95
|
+
if (contentRef && contentRef.current) {
|
|
96
|
+
// const childrenDOM = contentRef.current.children || [];
|
|
97
|
+
// const dom = childrenDOM.length === 1 ? contentRef.current.children[0] : contentRef.current;
|
|
98
|
+
var dom = contentRef.current;
|
|
99
|
+
var _ref = dom || {},
|
|
100
|
+
clientHeight = _ref.clientHeight,
|
|
101
|
+
scrollHeight = _ref.scrollHeight;
|
|
102
|
+
setOverflow(scrollHeight > clientHeight);
|
|
103
|
+
}
|
|
104
|
+
}, [contentRef, content]);
|
|
105
|
+
|
|
106
|
+
// const { fontSizeRem, textIndent } = useMemo(
|
|
107
|
+
// () => ({ fontSizeRem: `${fontSize / remUnit}rem`, textIndent: `${(fontSize / remUnit) * 2}rem` }),
|
|
108
|
+
// [fontSize]
|
|
109
|
+
// );
|
|
110
|
+
|
|
111
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
112
|
+
className: classNames('collapseContent', className)
|
|
113
|
+
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
114
|
+
ref: contentRef,
|
|
115
|
+
variant: "inherit",
|
|
116
|
+
className: classNames('collapseContent__desc', "collapseContent__desc--".concat(lineClamp <= 5 ? lineClamp : 10), {
|
|
117
|
+
'collapseContent__desc--indent': useTextIndent
|
|
118
|
+
}, {
|
|
119
|
+
'collapseContent__desc--expand': expand
|
|
120
|
+
}, {
|
|
121
|
+
'collapseContent__desc--lightHeight': useLightHeight
|
|
122
|
+
}),
|
|
123
|
+
color: "textSecondary",
|
|
124
|
+
style: {
|
|
125
|
+
color: textColor
|
|
126
|
+
}
|
|
127
|
+
}, textDivider(content)), overflow && /*#__PURE__*/React__default.createElement(MoreButton, {
|
|
128
|
+
small: true,
|
|
129
|
+
primaryColor: primaryColor,
|
|
130
|
+
secondaryColor: secondaryColor,
|
|
131
|
+
shadowColor: shadowColor,
|
|
132
|
+
formatMessage: formatMessage,
|
|
133
|
+
expand: expand,
|
|
134
|
+
setExpand: setExpand
|
|
135
|
+
}));
|
|
136
|
+
};
|
|
137
|
+
CollapseContent.defaultProps = {
|
|
138
|
+
className: undefined,
|
|
139
|
+
content: undefined,
|
|
140
|
+
textColor: undefined,
|
|
141
|
+
// fontSize: 24,
|
|
142
|
+
lineClamp: 2,
|
|
143
|
+
useLightHeight: undefined,
|
|
144
|
+
useTextIndent: true,
|
|
145
|
+
formatMessage: undefined,
|
|
146
|
+
primaryColor: '#271702',
|
|
147
|
+
// default為文學網站的主色系
|
|
148
|
+
secondaryColor: '#aa8859',
|
|
149
|
+
// default為文學網站的次色系
|
|
150
|
+
shadowColor: undefined
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
154
|
+
CollapseContent.propTypes = {
|
|
155
|
+
/** Css Name */
|
|
156
|
+
className: PropTypes.string,
|
|
157
|
+
/** 內文 */
|
|
158
|
+
content: PropTypes.string,
|
|
159
|
+
/** 內文字體顏色 */
|
|
160
|
+
textColor: PropTypes.string,
|
|
161
|
+
/** 內文字大小 */
|
|
162
|
+
// fontSize: PropTypes.number,
|
|
163
|
+
/** 多行文字縮減 */
|
|
164
|
+
lineClamp: PropTypes.number,
|
|
165
|
+
/** 是否增加lightHeight(2.25) */
|
|
166
|
+
useLightHeight: PropTypes.bool,
|
|
167
|
+
/** 文字前面是否空格 */
|
|
168
|
+
useTextIndent: PropTypes.bool,
|
|
169
|
+
/** 語系翻譯的formateMessag(useIntl) */
|
|
170
|
+
formatMessage: PropTypes.func,
|
|
171
|
+
/** 顯示更多按鈕主色系顏色 */
|
|
172
|
+
primaryColor: PropTypes.string,
|
|
173
|
+
/** 顯示更多按鈕次色系顏色 */
|
|
174
|
+
secondaryColor: PropTypes.string,
|
|
175
|
+
/** 顯示更多按鈕影子顏色 */
|
|
176
|
+
shadowColor: PropTypes.string
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export { CollapseContent as default };
|