@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
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { b as _objectSpread2, d as _typeof } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
2
|
+
import React__default, { useRef } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { c as classNames } from './index-b76a85f4.js';
|
|
5
|
+
import { FormControl, Select as Select$1, CircularProgress, MenuItem } from '@material-ui/core';
|
|
6
|
+
import './defaultTheme-ed7746fe.js';
|
|
7
|
+
import 'react-is';
|
|
8
|
+
import '@material-ui/styles';
|
|
9
|
+
import { u as useTheme } from './useTheme-d16d02d9.js';
|
|
10
|
+
import './withTheme-2d778133.js';
|
|
11
|
+
import { E as Empty } from './Empty-c6a44967.js';
|
|
12
|
+
import { getIntl } from './globalConfig';
|
|
13
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
14
|
+
|
|
15
|
+
var css_248z = ".select .MuiSelect-nativeInput {\n visibility: hidden;\n}\n.select__placeholder {\n color: #6b6130;\n}\n.select--small {\n width: 100%;\n}\n.select--small .MuiSelect-root {\n padding: 0.5rem 1.5rem 0.25rem;\n color: white;\n}\n.select--small .MuiSelect-root .select__placeholder {\n color: white;\n}\n.select--small .MuiSelect-root:hover, .select--small .MuiSelect-root:focus {\n background: transparent;\n}\n.select--small .MuiSvgIcon-root {\n color: white;\n}\n.select--small .MuiOutlinedInput-root {\n border-radius: 45px;\n}";
|
|
16
|
+
styleInject(css_248z);
|
|
17
|
+
|
|
18
|
+
/* 視覺隱藏的可及名稱容器(不依賴各站的 .visually-hidden) */
|
|
19
|
+
var hiddenLabelStyle = {
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
width: 1,
|
|
22
|
+
height: 1,
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
25
|
+
whiteSpace: 'nowrap'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/* 每個 Select 實例需要唯一 id 才能做 aria-labelledby 串接 */
|
|
29
|
+
var selectSeq = 0;
|
|
30
|
+
var Select = function Select(props) {
|
|
31
|
+
var style = props.style,
|
|
32
|
+
className = props.className,
|
|
33
|
+
labelInValue = props.labelInValue,
|
|
34
|
+
disabled = props.disabled,
|
|
35
|
+
loading = props.loading,
|
|
36
|
+
placeholder = props.placeholder,
|
|
37
|
+
variantSmall = props.variantSmall,
|
|
38
|
+
background = props.background,
|
|
39
|
+
menuItemClass = props.menuItemClass;
|
|
40
|
+
/* 未指定 placeholder 時走套件 i18n(原本寫死英文 'Please select...',
|
|
41
|
+
中文語系也照唸英文,走查回饋 5a) */
|
|
42
|
+
var placeholderText = placeholder === undefined ? getIntl().formatMessage({
|
|
43
|
+
id: 'common.select.placeholder'
|
|
44
|
+
}) : placeholder;
|
|
45
|
+
var options = props.options,
|
|
46
|
+
value = props.value,
|
|
47
|
+
defaultValue = props.defaultValue,
|
|
48
|
+
_onChange = props.onChange,
|
|
49
|
+
ariaLabel = props.ariaLabel,
|
|
50
|
+
ariaLabelledby = props.ariaLabelledby;
|
|
51
|
+
/* WCAG 1.4.3 提示字顏色依主題深淺自動選色:select.scss 的 #6b6130 只適用淺底,
|
|
52
|
+
深色主題(palette.type=dark,如 ocean 深色 Modal)需改亮灰(WAVE 實測「請輸入 年齡」被抓) */
|
|
53
|
+
var theme = useTheme();
|
|
54
|
+
var placeholderStyle = theme && theme.palette && theme.palette.type === 'dark' ? {
|
|
55
|
+
color: '#bdbdbd'
|
|
56
|
+
} : undefined;
|
|
57
|
+
var itemFind = function itemFind(key) {
|
|
58
|
+
return (options || []).find(function (option) {
|
|
59
|
+
return _typeof(option) === 'object' ? key === option.value : key === option;
|
|
60
|
+
}) || key;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/* WCAG 4.1.2/3.3.2 可及名稱=「這個選單是做什麼的」+「目前選了什麼」。
|
|
64
|
+
直接掛 aria-label 會整個蓋掉顯示層的選中值文字(讀屏只唸得出用途、唸不出選了誰),
|
|
65
|
+
故改採 MUI 原生作法:把用途文字放進視覺隱藏的 label 元素,
|
|
66
|
+
再以 aria-labelledby="<label id> <顯示層 id>" 串起來(走查回饋 5a)。 */
|
|
67
|
+
var uidRef = useRef(null);
|
|
68
|
+
if (!uidRef.current) {
|
|
69
|
+
selectSeq += 1;
|
|
70
|
+
uidRef.current = "nmtl-select-".concat(selectSeq);
|
|
71
|
+
}
|
|
72
|
+
var uid = uidRef.current;
|
|
73
|
+
var buttonId = "".concat(uid, "-value");
|
|
74
|
+
var useHiddenLabel = Boolean(ariaLabel) && !ariaLabelledby;
|
|
75
|
+
// eslint-disable-next-line no-nested-ternary
|
|
76
|
+
var labelledby = ariaLabelledby ? "".concat(ariaLabelledby, " ").concat(buttonId) : useHiddenLabel ? "".concat(uid, "-label ").concat(buttonId) : undefined;
|
|
77
|
+
return /*#__PURE__*/React__default.createElement(FormControl, {
|
|
78
|
+
className: classNames('select', {
|
|
79
|
+
'select--small': variantSmall
|
|
80
|
+
}, className),
|
|
81
|
+
variant: "outlined"
|
|
82
|
+
}, useHiddenLabel && /*#__PURE__*/React__default.createElement("span", {
|
|
83
|
+
id: "".concat(uid, "-label"),
|
|
84
|
+
style: hiddenLabelStyle
|
|
85
|
+
}, ariaLabel), /*#__PURE__*/React__default.createElement(Select$1, {
|
|
86
|
+
style: _objectSpread2(_objectSpread2({}, style || {}), {}, {
|
|
87
|
+
background: background
|
|
88
|
+
}),
|
|
89
|
+
displayEmpty: true,
|
|
90
|
+
disabled: disabled || loading
|
|
91
|
+
// WCAG 3.3.2 可及名稱:未提供 ariaLabel/ariaLabelledby 時,顯示層(role=button)
|
|
92
|
+
// 以其文字內容(選中值/placeholder)為名稱;有提供時改為「用途 + 選中值」(見上方 labelledby)。
|
|
93
|
+
// 隱藏原生 input 由 select.scss 的 visibility:hidden 讓檢測工具略過,無需再標 label。
|
|
94
|
+
,
|
|
95
|
+
SelectDisplayProps: {
|
|
96
|
+
id: buttonId,
|
|
97
|
+
'aria-labelledby': labelledby
|
|
98
|
+
},
|
|
99
|
+
renderValue: function renderValue(id) {
|
|
100
|
+
var finder = itemFind(id);
|
|
101
|
+
var content = _typeof(finder) === 'object' ? finder.label : finder;
|
|
102
|
+
/* WCAG 3.1.2 局部語言:選項可帶 lang(如語言選單的「English」),顯示值同步標註 */
|
|
103
|
+
if (_typeof(finder) === 'object' && finder.lang) {
|
|
104
|
+
content = /*#__PURE__*/React__default.createElement("span", {
|
|
105
|
+
lang: finder.lang
|
|
106
|
+
}, content);
|
|
107
|
+
}
|
|
108
|
+
if (!id && id !== 0 || id.length === 0) {
|
|
109
|
+
content = /*#__PURE__*/React__default.createElement("span", {
|
|
110
|
+
className: "select__placeholder",
|
|
111
|
+
style: placeholderStyle
|
|
112
|
+
}, placeholderText);
|
|
113
|
+
}
|
|
114
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, content, loading && /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
115
|
+
size: 16,
|
|
116
|
+
style: {
|
|
117
|
+
marginLeft: 8,
|
|
118
|
+
marginRight: 4
|
|
119
|
+
}
|
|
120
|
+
}));
|
|
121
|
+
},
|
|
122
|
+
value: value,
|
|
123
|
+
defaultValue: defaultValue,
|
|
124
|
+
onChange: function onChange(event) {
|
|
125
|
+
return _onChange(labelInValue ? itemFind(event.target.value) : event.target.value);
|
|
126
|
+
}
|
|
127
|
+
}, Array.isArray(options) && options.length > 0 ? options.map(function (option) {
|
|
128
|
+
var key = _typeof(option) === 'object' ? option.value : option;
|
|
129
|
+
var text = _typeof(option) === 'object' ? option.label : option;
|
|
130
|
+
var optionLang = _typeof(option) === 'object' ? option.lang : undefined;
|
|
131
|
+
return /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
132
|
+
key: key,
|
|
133
|
+
value: key,
|
|
134
|
+
lang: optionLang,
|
|
135
|
+
ListItemClasses: menuItemClass
|
|
136
|
+
}, text);
|
|
137
|
+
}) : /*#__PURE__*/React__default.createElement(Empty, null)));
|
|
138
|
+
};
|
|
139
|
+
Select.defaultProps = {
|
|
140
|
+
style: undefined,
|
|
141
|
+
className: undefined,
|
|
142
|
+
value: undefined,
|
|
143
|
+
defaultValue: undefined,
|
|
144
|
+
options: undefined,
|
|
145
|
+
labelInValue: undefined,
|
|
146
|
+
disabled: undefined,
|
|
147
|
+
loading: undefined,
|
|
148
|
+
placeholder: undefined,
|
|
149
|
+
variantSmall: undefined,
|
|
150
|
+
background: undefined,
|
|
151
|
+
menuItemClass: undefined,
|
|
152
|
+
onChange: function onChange() {},
|
|
153
|
+
ariaLabel: undefined,
|
|
154
|
+
ariaLabelledby: undefined
|
|
155
|
+
};
|
|
156
|
+
Select.propTypes = {
|
|
157
|
+
/** 樣式 */
|
|
158
|
+
style: PropTypes.objectOf(PropTypes.any),
|
|
159
|
+
/** Css Name */
|
|
160
|
+
className: PropTypes.string,
|
|
161
|
+
/** 選擇的id */
|
|
162
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
163
|
+
/** 預設選擇的id */
|
|
164
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
165
|
+
/** 下拉選單清單 */
|
|
166
|
+
options: PropTypes.arrayOf(PropTypes.any),
|
|
167
|
+
/** onChange時 label value 一起回傳 */
|
|
168
|
+
labelInValue: PropTypes.bool,
|
|
169
|
+
/** 是否禁止使用 */
|
|
170
|
+
disabled: PropTypes.bool,
|
|
171
|
+
/** 是否載入中 */
|
|
172
|
+
loading: PropTypes.bool,
|
|
173
|
+
/** 下拉選單提示字(不給則使用套件 i18n 的「請選擇…」) */
|
|
174
|
+
placeholder: PropTypes.string,
|
|
175
|
+
/** 是否使用小size */
|
|
176
|
+
variantSmall: PropTypes.bool,
|
|
177
|
+
/** 使用變體後的顏色 */
|
|
178
|
+
background: PropTypes.string,
|
|
179
|
+
/** override menuItem class */
|
|
180
|
+
menuItemClass: PropTypes.objectOf(PropTypes.any),
|
|
181
|
+
/** 點選後的返回 */
|
|
182
|
+
onChange: PropTypes.func,
|
|
183
|
+
/** 無障礙名稱(WCAG 3.3.2):說明「這個選單是做什麼的」,會與選中值一起被讀出 */
|
|
184
|
+
ariaLabel: PropTypes.string,
|
|
185
|
+
/** 以外部元素id作為無障礙名稱 */
|
|
186
|
+
ariaLabelledby: PropTypes.string
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export { Select as S };
|
package/lib/components/Select.js
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
export { S as default } from './Select-cb3e1ba1.js';
|
|
2
|
+
import './_rollupPluginBabelHelpers-a52356f6.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'prop-types';
|
|
5
|
+
import './index-b76a85f4.js';
|
|
6
|
+
import '@material-ui/core';
|
|
7
|
+
import './defaultTheme-ed7746fe.js';
|
|
8
|
+
import 'react-is';
|
|
9
|
+
import '@material-ui/styles';
|
|
10
|
+
import './useTheme-d16d02d9.js';
|
|
11
|
+
import './withTheme-2d778133.js';
|
|
12
|
+
import './Empty-c6a44967.js';
|
|
13
|
+
import './style-inject.es-1f59c1d0.js';
|
|
14
|
+
import './globalConfig';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React__default, { useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { c as classNames } from './index-b76a85f4.js';
|
|
4
|
+
import { Fade, CircularProgress } from '@material-ui/core';
|
|
5
|
+
import { getIntl } from './globalConfig';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
7
|
+
|
|
8
|
+
var css_248z = ".customSpin {\n width: 100%;\n min-height: 100px;\n position: relative;\n}\n.customSpin__spin {\n width: 100%;\n height: 100%;\n position: absolute;\n z-index: 2;\n display: flex;\n justify-content: center;\n align-items: center;\n}";
|
|
9
|
+
styleInject(css_248z);
|
|
10
|
+
|
|
11
|
+
var stringSize = {
|
|
12
|
+
small: 16,
|
|
13
|
+
middle: 24,
|
|
14
|
+
large: 40
|
|
15
|
+
};
|
|
16
|
+
var Spin = function Spin(props) {
|
|
17
|
+
var className = props.className,
|
|
18
|
+
spinning = props.spinning,
|
|
19
|
+
children = props.children,
|
|
20
|
+
size = props.size,
|
|
21
|
+
style = props.style;
|
|
22
|
+
var maxValue = function maxValue(val) {
|
|
23
|
+
// 極大極小值限制 300/16
|
|
24
|
+
var min = val < 16 ? 16 : val;
|
|
25
|
+
var max = min > 300 ? 300 : min;
|
|
26
|
+
return max;
|
|
27
|
+
};
|
|
28
|
+
var matchSize = useMemo(function () {
|
|
29
|
+
if (typeof size === 'string') {
|
|
30
|
+
if (Number(size) && typeof Number(size) === 'number') {
|
|
31
|
+
return maxValue(Number(size));
|
|
32
|
+
}
|
|
33
|
+
return stringSize[size] || 40;
|
|
34
|
+
}
|
|
35
|
+
if (typeof size === 'number') {
|
|
36
|
+
return maxValue(size);
|
|
37
|
+
}
|
|
38
|
+
// default size is large
|
|
39
|
+
return 40;
|
|
40
|
+
}, [size]);
|
|
41
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
42
|
+
className: classNames('customSpin', className),
|
|
43
|
+
style: style || {}
|
|
44
|
+
}, /*#__PURE__*/React__default.createElement(Fade, {
|
|
45
|
+
in: spinning,
|
|
46
|
+
style: {
|
|
47
|
+
transitionDelay: '300ms'
|
|
48
|
+
},
|
|
49
|
+
unmountOnExit: true
|
|
50
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
51
|
+
className: "customSpin__spin"
|
|
52
|
+
}, /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
53
|
+
size: matchSize,
|
|
54
|
+
"aria-label": getIntl().formatMessage({
|
|
55
|
+
id: 'aria.loading'
|
|
56
|
+
})
|
|
57
|
+
}))), children);
|
|
58
|
+
};
|
|
59
|
+
Spin.defaultProps = {
|
|
60
|
+
className: undefined,
|
|
61
|
+
spinning: false,
|
|
62
|
+
children: null,
|
|
63
|
+
size: undefined,
|
|
64
|
+
style: undefined
|
|
65
|
+
};
|
|
66
|
+
Spin.propTypes = {
|
|
67
|
+
/** Css Name */
|
|
68
|
+
className: PropTypes.string,
|
|
69
|
+
/** 是否載入中 */
|
|
70
|
+
spinning: PropTypes.bool,
|
|
71
|
+
/** 內容 */
|
|
72
|
+
children: PropTypes.node,
|
|
73
|
+
/** 自訂尺寸 */
|
|
74
|
+
size: PropTypes.oneOfType([PropTypes.oneOf(Object.keys(stringSize)), PropTypes.number]),
|
|
75
|
+
/** 自訂Style設置 */
|
|
76
|
+
style: PropTypes.objectOf(PropTypes.any)
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export { Spin as S };
|
package/lib/components/Spin.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export { S as default } from './Spin-8f87eadc.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'prop-types';
|
|
4
|
+
import './index-b76a85f4.js';
|
|
5
|
+
import '@material-ui/core';
|
|
6
|
+
import './globalConfig';
|
|
7
|
+
import './style-inject.es-1f59c1d0.js';
|
package/lib/components/Table.js
CHANGED
|
@@ -1 +1,51 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import { c as _objectWithoutProperties } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { TableContainer, Paper, Table as Table$1, TableHead, TableRow, TableCell, TableBody } from '@material-ui/core';
|
|
5
|
+
|
|
6
|
+
var _excluded = ["render"];
|
|
7
|
+
var Table = function Table(_ref) {
|
|
8
|
+
var className = _ref.className,
|
|
9
|
+
columns = _ref.columns,
|
|
10
|
+
data = _ref.data;
|
|
11
|
+
return /*#__PURE__*/React__default.createElement(TableContainer, {
|
|
12
|
+
className: className,
|
|
13
|
+
component: Paper
|
|
14
|
+
}, /*#__PURE__*/React__default.createElement(Table$1, {
|
|
15
|
+
className: "customTable"
|
|
16
|
+
}, /*#__PURE__*/React__default.createElement(TableHead, null, /*#__PURE__*/React__default.createElement(TableRow, null, Array.isArray(columns) && columns.map(function (_ref2) {
|
|
17
|
+
var field = _ref2.field,
|
|
18
|
+
headerName = _ref2.headerName;
|
|
19
|
+
return /*#__PURE__*/React__default.createElement(TableCell, {
|
|
20
|
+
key: field
|
|
21
|
+
}, headerName);
|
|
22
|
+
}))), /*#__PURE__*/React__default.createElement(TableBody, null, Array.isArray(data) && data.map(function (item, index) {
|
|
23
|
+
return /*#__PURE__*/React__default.createElement(TableRow, {
|
|
24
|
+
key: index.toString()
|
|
25
|
+
}, Array.isArray(columns) && columns.map(function (_ref3) {
|
|
26
|
+
var render = _ref3.render,
|
|
27
|
+
columnProps = _objectWithoutProperties(_ref3, _excluded);
|
|
28
|
+
var field = columnProps.field;
|
|
29
|
+
return /*#__PURE__*/React__default.createElement(TableCell, {
|
|
30
|
+
key: field,
|
|
31
|
+
component: "th",
|
|
32
|
+
scope: "row"
|
|
33
|
+
}, render && render(item) || item[field]);
|
|
34
|
+
}));
|
|
35
|
+
}))));
|
|
36
|
+
};
|
|
37
|
+
Table.defaultProps = {
|
|
38
|
+
className: undefined,
|
|
39
|
+
columns: [],
|
|
40
|
+
data: []
|
|
41
|
+
};
|
|
42
|
+
Table.propTypes = {
|
|
43
|
+
/** Css Name */
|
|
44
|
+
className: PropTypes.string,
|
|
45
|
+
/** 欄位列表 */
|
|
46
|
+
columns: PropTypes.arrayOf(PropTypes.any),
|
|
47
|
+
/** 表格內容 */
|
|
48
|
+
data: PropTypes.arrayOf(PropTypes.any)
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { Table as default };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Tooltip as Tooltip$1 } from '@material-ui/core';
|
|
4
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-a52356f6.js';
|
|
5
|
+
import { c as classNames } from './index-b76a85f4.js';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
7
|
+
|
|
8
|
+
const TooltipContent = /*#__PURE__*/React__default.forwardRef((props, ref) => /*#__PURE__*/React__default.createElement("div", _extends({}, props, {
|
|
9
|
+
className: classNames('tooltip', props.className),
|
|
10
|
+
ref: ref
|
|
11
|
+
}), props.children));
|
|
12
|
+
TooltipContent.defaultProps = {
|
|
13
|
+
children: undefined,
|
|
14
|
+
className: undefined
|
|
15
|
+
};
|
|
16
|
+
TooltipContent.propTypes = {
|
|
17
|
+
children: PropTypes.node,
|
|
18
|
+
className: PropTypes.string
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var css_248z = ".tooltip {\n width: -moz-fit-content;\n width: fit-content;\n}";
|
|
22
|
+
styleInject(css_248z);
|
|
23
|
+
|
|
24
|
+
var placements = {
|
|
25
|
+
top: 'top',
|
|
26
|
+
left: 'left',
|
|
27
|
+
right: 'right',
|
|
28
|
+
bottom: 'bottom',
|
|
29
|
+
topLeft: 'top-start',
|
|
30
|
+
topRight: 'top-end',
|
|
31
|
+
bottomLeft: 'bottom-start',
|
|
32
|
+
bottomRight: 'bottom-end',
|
|
33
|
+
leftTop: 'left-start',
|
|
34
|
+
leftBottom: 'left-end',
|
|
35
|
+
rightTop: 'right-start',
|
|
36
|
+
rightBottom: 'right-end'
|
|
37
|
+
};
|
|
38
|
+
var Tooltip = function Tooltip(_ref) {
|
|
39
|
+
var title = _ref.title,
|
|
40
|
+
className = _ref.className,
|
|
41
|
+
placement = _ref.placement,
|
|
42
|
+
children = _ref.children;
|
|
43
|
+
return /*#__PURE__*/React__default.createElement(Tooltip$1, {
|
|
44
|
+
arrow: true,
|
|
45
|
+
title: title || '',
|
|
46
|
+
placement: placements[placement] || 'top'
|
|
47
|
+
}, /*#__PURE__*/React__default.createElement(TooltipContent, {
|
|
48
|
+
className: className
|
|
49
|
+
}, children));
|
|
50
|
+
};
|
|
51
|
+
Tooltip.defaultProps = {
|
|
52
|
+
className: undefined,
|
|
53
|
+
title: undefined,
|
|
54
|
+
children: 'Tooltip',
|
|
55
|
+
placement: undefined
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
|
|
59
|
+
Tooltip.propTypes = {
|
|
60
|
+
/** Css Name */
|
|
61
|
+
className: PropTypes.node,
|
|
62
|
+
/** 跳出的內容 */
|
|
63
|
+
title: PropTypes.node,
|
|
64
|
+
/** 子層 */
|
|
65
|
+
children: PropTypes.node,
|
|
66
|
+
/** 位置 */
|
|
67
|
+
placement: PropTypes.oneOf(Object.keys(placements))
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export { Tooltip as T, placements as p };
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export { T as default, p as placements } from './Tooltip-6ebfa9c1.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'prop-types';
|
|
4
|
+
import '@material-ui/core';
|
|
5
|
+
import './_rollupPluginBabelHelpers-a52356f6.js';
|
|
6
|
+
import './index-b76a85f4.js';
|
|
7
|
+
import './style-inject.es-1f59c1d0.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
|
+
|
|
3
|
+
function getDefaultExportFromCjs (x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function getAugmentedNamespace(n) {
|
|
8
|
+
var f = n.default;
|
|
9
|
+
if (typeof f == "function") {
|
|
10
|
+
var a = function () {
|
|
11
|
+
return f.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
a.prototype = f.prototype;
|
|
14
|
+
} else a = {};
|
|
15
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
16
|
+
Object.keys(n).forEach(function (k) {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
18
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return n[k];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return a;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { getDefaultExportFromCjs as a, commonjsGlobal as c, getAugmentedNamespace as g };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) {
|
|
2
|
+
var keys = Object.keys(object);
|
|
3
|
+
if (Object.getOwnPropertySymbols) {
|
|
4
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
5
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
6
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
7
|
+
})), keys.push.apply(keys, symbols);
|
|
8
|
+
}
|
|
9
|
+
return keys;
|
|
10
|
+
}
|
|
11
|
+
function _objectSpread2(target) {
|
|
12
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
13
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
14
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
15
|
+
_defineProperty(target, key, source[key]);
|
|
16
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
17
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return target;
|
|
21
|
+
}
|
|
22
|
+
function _typeof(obj) {
|
|
23
|
+
"@babel/helpers - typeof";
|
|
24
|
+
|
|
25
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
26
|
+
return typeof obj;
|
|
27
|
+
} : function (obj) {
|
|
28
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
29
|
+
}, _typeof(obj);
|
|
30
|
+
}
|
|
31
|
+
function _defineProperty(obj, key, value) {
|
|
32
|
+
if (key in obj) {
|
|
33
|
+
Object.defineProperty(obj, key, {
|
|
34
|
+
value: value,
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
obj[key] = value;
|
|
41
|
+
}
|
|
42
|
+
return obj;
|
|
43
|
+
}
|
|
44
|
+
function _extends() {
|
|
45
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
46
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
47
|
+
var source = arguments[i];
|
|
48
|
+
for (var key in source) {
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
50
|
+
target[key] = source[key];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return target;
|
|
55
|
+
};
|
|
56
|
+
return _extends.apply(this, arguments);
|
|
57
|
+
}
|
|
58
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
59
|
+
if (source == null) return {};
|
|
60
|
+
var target = {};
|
|
61
|
+
var sourceKeys = Object.keys(source);
|
|
62
|
+
var key, i;
|
|
63
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
64
|
+
key = sourceKeys[i];
|
|
65
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
66
|
+
target[key] = source[key];
|
|
67
|
+
}
|
|
68
|
+
return target;
|
|
69
|
+
}
|
|
70
|
+
function _objectWithoutProperties(source, excluded) {
|
|
71
|
+
if (source == null) return {};
|
|
72
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
73
|
+
var key, i;
|
|
74
|
+
if (Object.getOwnPropertySymbols) {
|
|
75
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
76
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
77
|
+
key = sourceSymbolKeys[i];
|
|
78
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
79
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
80
|
+
target[key] = source[key];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return target;
|
|
84
|
+
}
|
|
85
|
+
function _taggedTemplateLiteral(strings, raw) {
|
|
86
|
+
if (!raw) {
|
|
87
|
+
raw = strings.slice(0);
|
|
88
|
+
}
|
|
89
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
90
|
+
raw: {
|
|
91
|
+
value: Object.freeze(raw)
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
function _slicedToArray(arr, i) {
|
|
96
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
97
|
+
}
|
|
98
|
+
function _arrayWithHoles(arr) {
|
|
99
|
+
if (Array.isArray(arr)) return arr;
|
|
100
|
+
}
|
|
101
|
+
function _iterableToArrayLimit(arr, i) {
|
|
102
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
103
|
+
if (_i == null) return;
|
|
104
|
+
var _arr = [];
|
|
105
|
+
var _n = true;
|
|
106
|
+
var _d = false;
|
|
107
|
+
var _s, _e;
|
|
108
|
+
try {
|
|
109
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
110
|
+
_arr.push(_s.value);
|
|
111
|
+
if (i && _arr.length === i) break;
|
|
112
|
+
}
|
|
113
|
+
} catch (err) {
|
|
114
|
+
_d = true;
|
|
115
|
+
_e = err;
|
|
116
|
+
} finally {
|
|
117
|
+
try {
|
|
118
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
119
|
+
} finally {
|
|
120
|
+
if (_d) throw _e;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return _arr;
|
|
124
|
+
}
|
|
125
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
126
|
+
if (!o) return;
|
|
127
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
128
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
129
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
130
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
131
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
132
|
+
}
|
|
133
|
+
function _arrayLikeToArray(arr, len) {
|
|
134
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
135
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
136
|
+
return arr2;
|
|
137
|
+
}
|
|
138
|
+
function _nonIterableRest() {
|
|
139
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { _extends as _, _slicedToArray as a, _objectSpread2 as b, _objectWithoutProperties as c, _typeof as d, _defineProperty as e, _taggedTemplateLiteral as f };
|