@daoyi/nmtl-ui 2.0.1-beta.117 → 2.0.1-beta.119

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.
@@ -173,13 +173,20 @@ var useAutocomplete = (_ref => {
173
173
  className: "autocomplete__icon",
174
174
  color: "inherit",
175
175
  size: 20
176
+ // WCAG 4.1.2 progressbar 需可及名稱(axe aria-progressbar-name)
177
+ ,
178
+ "aria-label": getIntl().formatMessage({
179
+ id: 'aria.loading'
180
+ })
176
181
  }), searchIcon &&
177
182
  /*#__PURE__*/
178
- // WCAG 2.1.1 / 4.1.2 搜尋圖示為可點擊元素,需可鍵盤操作並有名稱
183
+ // WCAG 2.1.1 / 4.1.2 搜尋圖示為可點擊元素,需可鍵盤操作並有名稱;
184
+ // MUI SvgIcon 預設 aria-hidden="true",可聚焦元素必須覆蓋(axe aria-hidden-focus)
179
185
  React__default.createElement(SearchOutlined, {
180
186
  className: "autocomplete__icon",
181
187
  role: "button",
182
188
  tabIndex: 0,
189
+ "aria-hidden": false,
183
190
  "aria-label": getIntl().formatMessage({
184
191
  id: 'aria.autocomplete.search'
185
192
  }),
@@ -1,4 +1,4 @@
1
- export { A as default } from './Autocomplete-864269ac.js';
1
+ export { A as default } from './Autocomplete-3b418e5f.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
@@ -11,19 +11,22 @@ var Avatar = function Avatar(_ref) {
11
11
  var className = _ref.className,
12
12
  shape = _ref.shape,
13
13
  src = _ref.src,
14
+ alt = _ref.alt,
14
15
  _onError = _ref.onError,
15
16
  _ref$defaultImg = _ref.defaultImg,
16
17
  defaultImg = _ref$defaultImg === void 0 ? '' : _ref$defaultImg;
17
18
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Avatar$1, {
18
19
  className: classNames('avatar', className),
19
20
  variant: shape,
20
- src: src
21
+ src: src,
22
+ alt: alt
21
23
  }, defaultImg), typeof _onError === 'function' && /*#__PURE__*/React__default.createElement("img", {
22
24
  src: src,
23
25
  onError: function onError() {
24
26
  return _onError();
25
27
  },
26
- alt: "test",
28
+ alt: "",
29
+ "aria-hidden": true,
27
30
  style: {
28
31
  display: 'none'
29
32
  }
@@ -33,6 +36,7 @@ Avatar.defaultProps = {
33
36
  className: undefined,
34
37
  shape: 'circular',
35
38
  src: undefined,
39
+ alt: undefined,
36
40
  onError: undefined,
37
41
  defaultImg: undefined
38
42
  };
@@ -45,6 +49,8 @@ Avatar.propTypes = {
45
49
  shape: PropTypes.oneOf(['circle', 'circular', 'rounded', 'square']),
46
50
  /** 圖片來源 */
47
51
  src: PropTypes.string,
52
+ /** 圖片文字替代(WCAG 1.1.1);裝飾或與相鄰文字重複時傳空字串 */
53
+ alt: PropTypes.string,
48
54
  /** 圖片有錯誤則callback */
49
55
  onError: PropTypes.func,
50
56
  defaultImg: PropTypes.string
@@ -3,7 +3,7 @@ import React__default, { createContext, forwardRef, createElement, useContext, u
3
3
  import PropTypes from 'prop-types';
4
4
  import { h as hoistNonReactStatics_cjs } from './hoist-non-react-statics.cjs-3f408ad2.js';
5
5
  import axios from 'axios';
6
- import { M as Modal } from './Modal-2451be75.js';
6
+ import { M as Modal } from './Modal-76fef34f.js';
7
7
  import { c as commonjsGlobal, a as getDefaultExportFromCjs } from './_commonjsHelpers-70de2c37.js';
8
8
  import { c as classNames } from './index-b76a85f4.js';
9
9
  import { Input, IconButton, Button, Box, Typography, FormControl, RadioGroup, FormControlLabel, Radio, TextField, TextareaAutosize } from '@material-ui/core';
@@ -12,7 +12,7 @@ import 'react-is';
12
12
  import '@material-ui/styles';
13
13
  import { u as useTheme } from './useTheme-d16d02d9.js';
14
14
  import './withTheme-2d778133.js';
15
- import { S as Select } from './Select-52ab5299.js';
15
+ import { S as Select } from './Select-141d7992.js';
16
16
  import { VolumeUp } from '@material-ui/icons';
17
17
  import { getIntl } from './globalConfig';
18
18
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
@@ -1,24 +1,24 @@
1
- export { C as default } from './ContactModal-7f35b424.js';
1
+ export { C as default } from './ContactModal-763fc7cb.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
5
5
  import './hoist-non-react-statics.cjs-3f408ad2.js';
6
6
  import 'react-is';
7
7
  import 'axios';
8
- import './Modal-2451be75.js';
8
+ import './Modal-76fef34f.js';
9
9
  import './index-b76a85f4.js';
10
10
  import '@material-ui/core';
11
11
  import '@material-ui/icons';
12
12
  import './Button-305b69a0.js';
13
13
  import './style-inject.es-1f59c1d0.js';
14
- import './Spin-8dc60bfe.js';
14
+ import './Spin-8f87eadc.js';
15
15
  import './globalConfig';
16
16
  import './_commonjsHelpers-70de2c37.js';
17
17
  import './defaultTheme-ed7746fe.js';
18
18
  import '@material-ui/styles';
19
19
  import './useTheme-d16d02d9.js';
20
20
  import './withTheme-2d778133.js';
21
- import './Select-52ab5299.js';
21
+ import './Select-141d7992.js';
22
22
  import './Empty-c6a44967.js';
23
23
  import './createSvgIcon-e3803ee1.js';
24
24
  import 'react-dom';
@@ -3,7 +3,7 @@ import React__default, { useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { List, ListItem, ListItemIcon, ListItemText, IconButton, Drawer as Drawer$1, Divider } from '@material-ui/core';
5
5
  import { DehazeRounded } from '@material-ui/icons';
6
- import { S as Select } from './Select-52ab5299.js';
6
+ import { S as Select } from './Select-141d7992.js';
7
7
  import { useHistory, useRouteMatch } from 'react-router-dom';
8
8
  import { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
@@ -82,7 +82,8 @@ var Drawer = function Drawer(_ref) {
82
82
  locale = _ref.locale,
83
83
  supportLanguages = _ref.supportLanguages,
84
84
  drawerList = _ref.drawerList,
85
- onLanguageChange = _ref.onLanguageChange;
85
+ onLanguageChange = _ref.onLanguageChange,
86
+ languageSelectLabel = _ref.languageSelectLabel;
86
87
  var _useState = useState(false),
87
88
  _useState2 = _slicedToArray(_useState, 2),
88
89
  open = _useState2[0],
@@ -108,8 +109,8 @@ var Drawer = function Drawer(_ref) {
108
109
  onClose: function onClose() {
109
110
  return setOpen(false);
110
111
  },
111
- onKeyDown: function onKeyDown() {
112
- return setOpen(false);
112
+ onKeyDown: function onKeyDown(event) {
113
+ if (event.key === 'Escape') setOpen(false);
113
114
  }
114
115
  }, (logo || title) && /*#__PURE__*/React__default.createElement("div", {
115
116
  className: "drawer__header"
@@ -125,6 +126,9 @@ var Drawer = function Drawer(_ref) {
125
126
  setOpen: setOpen
126
127
  }), /*#__PURE__*/React__default.createElement(Divider, null), Array.isArray(supportLanguages) && supportLanguages.length > 0 && /*#__PURE__*/React__default.createElement(Select, {
127
128
  className: "drawer__lang",
129
+ ariaLabel: languageSelectLabel || getIntl().formatMessage({
130
+ id: 'aria.header.languageSelect'
131
+ }),
128
132
  defaultValue: checkLanguageSupport({
129
133
  language: locale,
130
134
  supportLanguages: supportLanguages
@@ -149,7 +153,8 @@ Drawer.defaultProps = {
149
153
  ],
150
154
 
151
155
  drawerList: undefined,
152
- onLanguageChange: function onLanguageChange() {}
156
+ onLanguageChange: function onLanguageChange() {},
157
+ languageSelectLabel: undefined
153
158
  };
154
159
  Drawer.propTypes = {
155
160
  title: PropTypes.string,
@@ -157,7 +162,9 @@ Drawer.propTypes = {
157
162
  locale: PropTypes.string,
158
163
  supportLanguages: PropTypes.arrayOf(PropTypes.any),
159
164
  drawerList: PropTypes.arrayOf(PropTypes.any),
160
- onLanguageChange: PropTypes.func
165
+ onLanguageChange: PropTypes.func,
166
+ /** 語言下拉的無障礙名稱(WCAG 3.3.2);未提供時使用套件內 aria.header.languageSelect */
167
+ languageSelectLabel: PropTypes.string
161
168
  };
162
169
 
163
170
  export { Drawer as D, checkLanguageSupport as c, defaultSupportLanguage as d };
@@ -1,10 +1,10 @@
1
- export { D as default } from './Drawer-43937e1c.js';
1
+ export { D as default } from './Drawer-c04df870.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
5
5
  import '@material-ui/core';
6
6
  import '@material-ui/icons';
7
- import './Select-52ab5299.js';
7
+ import './Select-141d7992.js';
8
8
  import './index-b76a85f4.js';
9
9
  import './defaultTheme-ed7746fe.js';
10
10
  import 'react-is';
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
5
  import { ExitToApp } from '@material-ui/icons';
6
6
  import { Dialog, DialogContent, DialogContentText, DialogActions, Button } from '@material-ui/core';
7
- import { f as fileDownload, j as jsonTxt, a as jsonExcel } from './dataExport-d55d6fa3.js';
7
+ import { f as fileDownload, j as jsonTxt, a as jsonExcel } from './dataExport-a9e3fae1.js';
8
8
  import { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
10
 
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import { a as getDefaultExportFromCjs } from './_commonjsHelpers-70de2c37.js';
7
7
  import { Menu, MenuItem, useMediaQuery, IconButton } from '@material-ui/core';
8
8
  import { T as Tooltip } from './Tooltip-6ebfa9c1.js';
9
- import { s as snaToExcel, f as fileDownload$1, a as jsonExcel } from './dataExport-d55d6fa3.js';
9
+ import { s as snaToExcel, f as fileDownload$1, a as jsonExcel } from './dataExport-a9e3fae1.js';
10
10
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
11
11
 
12
12
  var __assign$3 = (undefined && undefined.__assign) || function () {
@@ -2872,11 +2872,19 @@ const worksSlider = data => (data || []).map(_ref6 => {
2872
2872
  };
2873
2873
  });
2874
2874
 
2875
+ /* \u532F\u51FA\u6A94\u540D\u7684\u65E5\u671F\u5F8C\u7DB4\uFF08YYYY-MM-DD\uFF09\uFF0C
2876
+ \u8207 DownloadMenu \u4E0B\u8F09\u5716\u7247\u5171\u7528 */
2877
+ const exportDateSuffix = () => {
2878
+ const now = new Date();
2879
+ const pad = n => String(n).padStart(2, '0');
2880
+ return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
2881
+ };
2875
2882
  const exportXlsx = _ref => {
2876
2883
  let {
2877
2884
  data,
2878
2885
  dataType,
2879
- extType = 'xlsx'
2886
+ extType = 'xlsx',
2887
+ fileName = 'output'
2880
2888
  } = _ref;
2881
2889
  let metadata;
2882
2890
  switch (dataType) {
@@ -2887,7 +2895,7 @@ const exportXlsx = _ref => {
2887
2895
  metadata = data;
2888
2896
  break;
2889
2897
  }
2890
- fileDownload$1(`\uFEFF${jsonExcel(metadata)}`, `output.${extType}`);
2898
+ fileDownload$1(`\uFEFF${jsonExcel(metadata, extType === 'tsv' ? '\t' : ',')}`, `${fileName}_${exportDateSuffix()}.${extType}`);
2891
2899
  };
2892
2900
 
2893
2901
  // 供外部使用dataConvert
@@ -3192,14 +3200,16 @@ const DownloadMenu = _ref2 => {
3192
3200
  data,
3193
3201
  dataType,
3194
3202
  domToImageId,
3195
- DownloadExcel
3203
+ DownloadExcel,
3204
+ exportFileName
3196
3205
  } = _ref2;
3197
3206
  const [anchorEl, setAnchorEl] = useState(null);
3198
3207
  const hideButton = type => (exclude || []).filter(key => key === type).length > 0;
3199
3208
  const btns = [{
3200
3209
  key: 'downloadImage',
3201
3210
  onClick: () => domToImage({
3202
- id: domToImageId
3211
+ id: domToImageId,
3212
+ fileName: `${exportFileName}_${exportDateSuffix()}`
3203
3213
  }),
3204
3214
  label: intl ? 'knowledge.writersAndWorksSNA.download.img' : '下載圖片'
3205
3215
  }, {
@@ -3211,7 +3221,8 @@ const DownloadMenu = _ref2 => {
3211
3221
  onClick: () => exportXlsx({
3212
3222
  data,
3213
3223
  dataType,
3214
- extType: 'tsv'
3224
+ extType: 'tsv',
3225
+ fileName: exportFileName
3215
3226
  }),
3216
3227
  label: intl ? 'knowledge.writersAndWorksSNA.download.tsv' : '下載Tsv'
3217
3228
  }, {
@@ -3279,7 +3290,8 @@ DownloadMenu.defaultProps = {
3279
3290
  dataType: undefined,
3280
3291
  iconColor: '#825c0d',
3281
3292
  domToImageId: 'network-graph',
3282
- DownloadExcel: undefined
3293
+ DownloadExcel: undefined,
3294
+ exportFileName: 'output'
3283
3295
  };
3284
3296
 
3285
3297
  /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
@@ -3299,7 +3311,9 @@ DownloadMenu.propTypes = {
3299
3311
  /** 指定dom轉換畫布的DOM ID */
3300
3312
  domToImageId: PropTypes.string,
3301
3313
  /** Download元件, 由外部傳入的原因是需要環境設定 */
3302
- DownloadExcel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
3314
+ DownloadExcel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
3315
+ /** 匯出檔名前綴(下載圖片/Tsv 檔名=前綴_YYYY-MM-DD) */
3316
+ exportFileName: PropTypes.string
3303
3317
  };
3304
3318
  const FullscreenBtn = _ref4 => {
3305
3319
  let {
@@ -3514,7 +3528,8 @@ var ExtraTools = function ExtraTools(_ref) {
3514
3528
  FontSizeOptions = _ref.FontSizeOptions,
3515
3529
  DownloadExcel = _ref.DownloadExcel,
3516
3530
  fullscreenDomId = _ref.fullscreenDomId,
3517
- renderSNA = _ref.renderSNA;
3531
+ renderSNA = _ref.renderSNA,
3532
+ exportFileName = _ref.exportFileName;
3518
3533
  var hideButton = function hideButton(keys) {
3519
3534
  return (exclude || []).filter(function (key) {
3520
3535
  return keys.some(function (item) {
@@ -3533,7 +3548,8 @@ var ExtraTools = function ExtraTools(_ref) {
3533
3548
  FontSizeOptions: FontSizeOptions,
3534
3549
  DownloadExcel: DownloadExcel,
3535
3550
  fullscreenDomId: fullscreenDomId,
3536
- renderSNA: renderSNA
3551
+ renderSNA: renderSNA,
3552
+ exportFileName: exportFileName
3537
3553
  };
3538
3554
  var isIOSMobile = /iPhone|iPad|iPod/i.test(navigator.userAgent);
3539
3555
  var tools = [{
@@ -3585,7 +3601,8 @@ ExtraTools.defaultProps = {
3585
3601
  },
3586
3602
  DownloadExcel: undefined,
3587
3603
  fullscreenDomId: undefined,
3588
- renderSNA: undefined
3604
+ renderSNA: undefined,
3605
+ exportFileName: 'output'
3589
3606
  };
3590
3607
 
3591
3608
  /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
@@ -3613,7 +3630,9 @@ ExtraTools.propTypes = {
3613
3630
  /** 全螢幕指定DOM */
3614
3631
  fullscreenDomId: PropTypes.string,
3615
3632
  /** 重設SNA */
3616
- renderSNA: PropTypes.func
3633
+ renderSNA: PropTypes.func,
3634
+ /** 匯出檔名前綴(下載圖片/Tsv 檔名=前綴_YYYY-MM-DD) */
3635
+ exportFileName: PropTypes.string
3617
3636
  };
3618
3637
 
3619
3638
  export { ExtraTools as E };
@@ -1,4 +1,4 @@
1
- export { E as default } from './ExtraTools-55f66039.js';
1
+ export { E as default } from './ExtraTools-0f9ca8be.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import './index-b76a85f4.js';
@@ -7,4 +7,4 @@ import './_commonjsHelpers-70de2c37.js';
7
7
  import '@material-ui/core';
8
8
  import './Tooltip-6ebfa9c1.js';
9
9
  import './style-inject.es-1f59c1d0.js';
10
- import './dataExport-d55d6fa3.js';
10
+ import './dataExport-a9e3fae1.js';
@@ -3,13 +3,13 @@ import React__default, { useState, useEffect } from 'react';
3
3
  import { c as classNames } from './index-b76a85f4.js';
4
4
  import PropTypes from 'prop-types';
5
5
  import axios from 'axios';
6
- import { C as ContactModal } from './ContactModal-7f35b424.js';
7
- import { S as Spin } from './Spin-8dc60bfe.js';
6
+ import { C as ContactModal } from './ContactModal-763fc7cb.js';
7
+ import { S as Spin } from './Spin-8f87eadc.js';
8
8
  import { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
10
  import './hoist-non-react-statics.cjs-3f408ad2.js';
11
11
  import 'react-is';
12
- import './Modal-2451be75.js';
12
+ import './Modal-76fef34f.js';
13
13
  import '@material-ui/core';
14
14
  import '@material-ui/icons';
15
15
  import './Button-305b69a0.js';
@@ -18,7 +18,7 @@ import './defaultTheme-ed7746fe.js';
18
18
  import '@material-ui/styles';
19
19
  import './useTheme-d16d02d9.js';
20
20
  import './withTheme-2d778133.js';
21
- import './Select-52ab5299.js';
21
+ import './Select-141d7992.js';
22
22
  import './Empty-c6a44967.js';
23
23
  import './createSvgIcon-e3803ee1.js';
24
24
  import 'react-dom';
@@ -6,15 +6,15 @@ import { d as debounce_1 } from './debounce-127da66c.js';
6
6
  import { useHistory, useRouteMatch, NavLink } from 'react-router-dom';
7
7
  import { Typography, IconButton } from '@material-ui/core';
8
8
  import { SearchOutlined } from '@material-ui/icons';
9
- import { K as KeywordSearch } from './KeywordSearch-d12e1b4f.js';
10
- import { S as Select } from './Select-52ab5299.js';
11
- import { c as checkLanguageSupport, D as Drawer, d as defaultSupportLanguage } from './Drawer-43937e1c.js';
9
+ import { K as KeywordSearch } from './KeywordSearch-fec33a2c.js';
10
+ import { S as Select } from './Select-141d7992.js';
11
+ import { c as checkLanguageSupport, D as Drawer, d as defaultSupportLanguage } from './Drawer-c04df870.js';
12
12
  import { getIntl } from './globalConfig';
13
13
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
14
14
  import './isObjectLike-e111475d.js';
15
15
  import './_commonjsHelpers-70de2c37.js';
16
16
  import 'axios';
17
- import './Autocomplete-864269ac.js';
17
+ import './Autocomplete-3b418e5f.js';
18
18
  import '@material-ui/lab';
19
19
  import './createSvgIcon-e3803ee1.js';
20
20
  import './defaultTheme-ed7746fe.js';
@@ -45,7 +45,8 @@ var Header = function Header(props) {
45
45
  var onSearch = props.onSearch;
46
46
  props.setDarkMode;
47
47
  var onLanguageChange = props.onLanguageChange,
48
- onSearchIconClick = props.onSearchIconClick;
48
+ onSearchIconClick = props.onSearchIconClick,
49
+ languageSelectLabel = props.languageSelectLabel;
49
50
  var history = useHistory();
50
51
  var search = history.location.search;
51
52
  var _useRouteMatch = useRouteMatch(),
@@ -150,6 +151,9 @@ var Header = function Header(props) {
150
151
  "aria-hidden": "true"
151
152
  })), showDarkModeSwitch , Array.isArray(supportLanguages) && supportLanguages.length > 0 && /*#__PURE__*/React__default.createElement(Select, {
152
153
  className: "header__language",
154
+ ariaLabel: languageSelectLabel || getIntl().formatMessage({
155
+ id: 'aria.header.languageSelect'
156
+ }),
153
157
  defaultValue: checkLanguageSupport({
154
158
  language: locale,
155
159
  supportLanguages: supportLanguages
@@ -163,7 +167,8 @@ var Header = function Header(props) {
163
167
  logo: logo,
164
168
  drawerList: pages,
165
169
  supportLanguages: supportLanguages,
166
- onLanguageChange: onLanguageChange
170
+ onLanguageChange: onLanguageChange,
171
+ languageSelectLabel: languageSelectLabel
167
172
  }));
168
173
  };
169
174
  Header.defaultProps = {
@@ -180,7 +185,8 @@ Header.defaultProps = {
180
185
  onSearch: function onSearch() {},
181
186
  setDarkMode: function setDarkMode() {},
182
187
  onLanguageChange: function onLanguageChange() {},
183
- onSearchIconClick: function onSearchIconClick() {}
188
+ onSearchIconClick: function onSearchIconClick() {},
189
+ languageSelectLabel: undefined
184
190
  };
185
191
  Header.propTypes = {
186
192
  /** Css Name */
@@ -212,7 +218,9 @@ Header.propTypes = {
212
218
  /** 語系變動時的callback */
213
219
  onLanguageChange: PropTypes.func,
214
220
  /** SearchIcon點擊時的callback */
215
- onSearchIconClick: PropTypes.func
221
+ onSearchIconClick: PropTypes.func,
222
+ /** 語言下拉的無障礙名稱(WCAG 3.3.2);未提供時使用套件內 aria.header.languageSelect */
223
+ languageSelectLabel: PropTypes.string
216
224
  };
217
225
 
218
226
  export { Header as default };
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
5
  import axios from 'axios';
6
6
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
- import { A as Autocomplete } from './Autocomplete-864269ac.js';
7
+ import { A as Autocomplete } from './Autocomplete-3b418e5f.js';
8
8
 
9
9
  var css_248z = ".keywordSearch {\n border-radius: 4px;\n width: 100%;\n margin-right: 14px;\n}\n.keywordSearch--animation .autocomplete {\n transition: max-width 0.3s ease-out;\n max-width: 240px;\n}\n.keywordSearch--focus {\n flex: 1;\n}\n.keywordSearch--focus .autocomplete {\n max-width: 100%;\n}\n.keywordSearch .MuiAutocomplete-hasPopupIcon.MuiAutocomplete-hasClearIcon .MuiAutocomplete-inputRoot[class*=MuiOutlinedInput-root] {\n border-radius: 10px;\n background-color: #ffffff66;\n}";
10
10
  styleInject(css_248z);
@@ -1,11 +1,11 @@
1
- export { K as default } from './KeywordSearch-d12e1b4f.js';
1
+ export { K as default } from './KeywordSearch-fec33a2c.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
5
5
  import './index-b76a85f4.js';
6
6
  import 'axios';
7
7
  import './style-inject.es-1f59c1d0.js';
8
- import './Autocomplete-864269ac.js';
8
+ import './Autocomplete-3b418e5f.js';
9
9
  import './debounce-127da66c.js';
10
10
  import './isObjectLike-e111475d.js';
11
11
  import './_commonjsHelpers-70de2c37.js';
@@ -2,14 +2,14 @@ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a52356f6.js';
2
2
  import React__default, { useState, useEffect, useRef } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { c as classNames } from './index-b76a85f4.js';
5
- import { M as Modal } from './Modal-2451be75.js';
5
+ import { M as Modal } from './Modal-76fef34f.js';
6
6
  import { Typography } from '@material-ui/core';
7
7
  import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-e3803ee1.js';
8
8
  import { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
10
  import '@material-ui/icons';
11
11
  import './Button-305b69a0.js';
12
- import './Spin-8dc60bfe.js';
12
+ import './Spin-8f87eadc.js';
13
13
  import './_commonjsHelpers-70de2c37.js';
14
14
  import './defaultTheme-ed7746fe.js';
15
15
  import 'react-is';
@@ -2,6 +2,7 @@ import React__default from 'react';
2
2
  import { c as classNames } from './index-b76a85f4.js';
3
3
  import { CircularProgress } from '@material-ui/core';
4
4
  import PropTypes from 'prop-types';
5
+ import { getIntl } from './globalConfig';
5
6
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
6
7
 
7
8
  var css_248z = ".loadingPage {\n padding: 4rem 0;\n color: #0087dc;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}";
@@ -12,7 +13,10 @@ var Loading = function Loading(_ref) {
12
13
  return /*#__PURE__*/React__default.createElement("div", {
13
14
  className: classNames('loadingPage', className)
14
15
  }, /*#__PURE__*/React__default.createElement(CircularProgress, {
15
- size: 80
16
+ size: 80,
17
+ "aria-label": getIntl().formatMessage({
18
+ id: 'aria.loading'
19
+ })
16
20
  }));
17
21
  };
18
22
  Loading.defaultProps = {
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import { Dialog, DialogTitle, IconButton, DialogContent, DialogActions, CircularProgress } from '@material-ui/core';
5
5
  import { CloseSharp } from '@material-ui/icons';
6
6
  import { B as Button } from './Button-305b69a0.js';
7
- import { S as Spin } from './Spin-8dc60bfe.js';
7
+ import { S as Spin } from './Spin-8f87eadc.js';
8
8
  import { getIntl } from './globalConfig';
9
9
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
10
10
 
@@ -1,4 +1,4 @@
1
- export { M as default } from './Modal-2451be75.js';
1
+ export { M as default } from './Modal-76fef34f.js';
2
2
  import 'react';
3
3
  import './index-b76a85f4.js';
4
4
  import 'prop-types';
@@ -6,5 +6,5 @@ import '@material-ui/core';
6
6
  import '@material-ui/icons';
7
7
  import './Button-305b69a0.js';
8
8
  import './style-inject.es-1f59c1d0.js';
9
- import './Spin-8dc60bfe.js';
9
+ import './Spin-8f87eadc.js';
10
10
  import './globalConfig';
@@ -2,13 +2,13 @@ import React__default, { useMemo, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { c as classNames } from './index-b76a85f4.js';
4
4
  import { e as event, d as d3Select, a as dispatch, c as customEvent, D as DragEvent, q as quadtree, m as map, t as timer, T as Transform, i as identity, b as interrupt, o as ordinal, f as category10 } from './transform-3a04288b.js';
5
- import { E as ExtraTools } from './ExtraTools-55f66039.js';
5
+ import { E as ExtraTools } from './ExtraTools-0f9ca8be.js';
6
6
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
7
  import './_rollupPluginBabelHelpers-a52356f6.js';
8
8
  import './_commonjsHelpers-70de2c37.js';
9
9
  import '@material-ui/core';
10
10
  import './Tooltip-6ebfa9c1.js';
11
- import './dataExport-d55d6fa3.js';
11
+ import './dataExport-a9e3fae1.js';
12
12
 
13
13
  function sourceEvent() {
14
14
  var current = event, source;
@@ -1408,7 +1408,8 @@ var SNA = function SNA(props) {
1408
1408
  SNAData = props.SNAData,
1409
1409
  handleClickNodeGoto = props.handleClickNodeGoto,
1410
1410
  DownloadExcel = props.DownloadExcel,
1411
- nodeAriaHint = props.nodeAriaHint;
1411
+ nodeAriaHint = props.nodeAriaHint,
1412
+ exportFileName = props.exportFileName;
1412
1413
  // styles
1413
1414
  var width = props.width,
1414
1415
  height = props.height,
@@ -1662,7 +1663,8 @@ var SNA = function SNA(props) {
1662
1663
  exclude: exclude,
1663
1664
  DownloadExcel: DownloadExcel,
1664
1665
  fullscreenDomId: "sna-graph",
1665
- renderSNA: renderSNA
1666
+ renderSNA: renderSNA,
1667
+ exportFileName: exportFileName
1666
1668
  }), /*#__PURE__*/React__default.createElement("div", {
1667
1669
  id: "sna-graph"
1668
1670
  }));
@@ -1680,7 +1682,8 @@ SNA.defaultProps = {
1680
1682
  iconColor: '#825c0d',
1681
1683
  exclude: ['downloadXls', 'downloadTsv'],
1682
1684
  handleClickNodeGoto: null,
1683
- DownloadExcel: undefined
1685
+ DownloadExcel: undefined,
1686
+ exportFileName: 'output'
1684
1687
  };
1685
1688
 
1686
1689
  /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
@@ -1710,7 +1713,9 @@ SNA.propTypes = {
1710
1713
  /** 按下點後要轉址的功能 */
1711
1714
  handleClickNodeGoto: PropTypes.func,
1712
1715
  /** Download元件, 由外部傳入的原因是需要環境設定 */
1713
- DownloadExcel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
1716
+ DownloadExcel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
1717
+ /** 匯出檔名前綴(下載圖片/Tsv 檔名=前綴_YYYY-MM-DD) */
1718
+ exportFileName: PropTypes.string
1714
1719
  };
1715
1720
 
1716
1721
  export { SNA as default };
@@ -63,6 +63,12 @@ var Select = function Select(props) {
63
63
  renderValue: function renderValue(id) {
64
64
  var finder = itemFind(id);
65
65
  var content = _typeof(finder) === 'object' ? finder.label : finder;
66
+ /* WCAG 3.1.2 局部語言:選項可帶 lang(如語言選單的「English」),顯示值同步標註 */
67
+ if (_typeof(finder) === 'object' && finder.lang) {
68
+ content = /*#__PURE__*/React__default.createElement("span", {
69
+ lang: finder.lang
70
+ }, content);
71
+ }
66
72
  if (!id && id !== 0 || id.length === 0) {
67
73
  content = /*#__PURE__*/React__default.createElement("span", {
68
74
  className: "select__placeholder",
@@ -85,9 +91,11 @@ var Select = function Select(props) {
85
91
  }, Array.isArray(options) && options.length > 0 ? options.map(function (option) {
86
92
  var key = _typeof(option) === 'object' ? option.value : option;
87
93
  var text = _typeof(option) === 'object' ? option.label : option;
94
+ var optionLang = _typeof(option) === 'object' ? option.lang : undefined;
88
95
  return /*#__PURE__*/React__default.createElement(MenuItem, {
89
96
  key: key,
90
97
  value: key,
98
+ lang: optionLang,
91
99
  ListItemClasses: menuItemClass
92
100
  }, text);
93
101
  }) : /*#__PURE__*/React__default.createElement(Empty, null)));
@@ -1,4 +1,4 @@
1
- export { S as default } from './Select-52ab5299.js';
1
+ export { S as default } from './Select-141d7992.js';
2
2
  import './_rollupPluginBabelHelpers-a52356f6.js';
3
3
  import 'react';
4
4
  import 'prop-types';
@@ -2,6 +2,7 @@ import React__default, { useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { c as classNames } from './index-b76a85f4.js';
4
4
  import { Fade, CircularProgress } from '@material-ui/core';
5
+ import { getIntl } from './globalConfig';
5
6
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
6
7
 
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}";
@@ -49,7 +50,10 @@ var Spin = function Spin(props) {
49
50
  }, /*#__PURE__*/React__default.createElement("div", {
50
51
  className: "customSpin__spin"
51
52
  }, /*#__PURE__*/React__default.createElement(CircularProgress, {
52
- size: matchSize
53
+ size: matchSize,
54
+ "aria-label": getIntl().formatMessage({
55
+ id: 'aria.loading'
56
+ })
53
57
  }))), children);
54
58
  };
55
59
  Spin.defaultProps = {
@@ -1,6 +1,7 @@
1
- export { S as default } from './Spin-8dc60bfe.js';
1
+ export { S as default } from './Spin-8f87eadc.js';
2
2
  import 'react';
3
3
  import 'prop-types';
4
4
  import './index-b76a85f4.js';
5
5
  import '@material-ui/core';
6
+ import './globalConfig';
6
7
  import './style-inject.es-1f59c1d0.js';
@@ -34,24 +34,23 @@ var fileDownload = function(data, filename, mime, bom) {
34
34
  }
35
35
  };
36
36
 
37
- const jsonExcel = json => {
37
+ // delimiter 預設逗號(CSV/EXCEL 沿用既有行為);.tsv 需傳 '\t'——
38
+ // tsv 以逗號分隔時,試算表軟體會整列擠進單一儲存格。
39
+ // 值內的 tab/換行以空白取代,避免斷欄斷行
40
+ const jsonExcel = function (json) {
41
+ let delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
42
+ const cleanCell = value => String(value == null ? '' : value).replace(/[\t\r\n]+/g, ' ');
38
43
  let output = '';
39
44
  if (Array.isArray(json) && json.length > 0) {
40
45
  const keys = Object.keys(json[0]);
41
- output += `${keys.toString()}\n`;
46
+ output += `${keys.map(cleanCell).join(delimiter)}\n`;
42
47
  json.forEach(item => {
43
- keys.forEach(key => {
44
- output += `${item[key]},`;
45
- });
46
- output += '\n';
48
+ output += `${keys.map(key => cleanCell(item[key])).join(delimiter)}\n`;
47
49
  });
48
50
  } else {
49
51
  const keys = Object.keys(json);
50
- output += `${keys.toString()}\n`;
51
- keys.forEach(key => {
52
- output += `${json[key]},`;
53
- });
54
- output += '\n';
52
+ output += `${keys.map(cleanCell).join(delimiter)}\n`;
53
+ output += `${keys.map(key => cleanCell(json[key])).join(delimiter)}\n`;
55
54
  }
56
55
  return output;
57
56
  };
@@ -61,7 +61,9 @@ var zhtw = {
61
61
  "aria.header.logoHome": "回首頁",
62
62
  "aria.header.logoHomeWithTitle": "{title},回首頁",
63
63
  "aria.header.navigation": "主選單",
64
+ "aria.header.languageSelect": "選擇語言",
64
65
  "aria.autocomplete.search": "執行搜尋",
66
+ "aria.loading": "載入中",
65
67
  "aria.modal.close": "關閉視窗",
66
68
  "aria.newWindow": "(另開新視窗)",
67
69
  "aria.vcode.image": "驗證碼圖片,如無法辨識可刷新驗證碼",
@@ -142,7 +144,9 @@ var zhcn = {
142
144
  "aria.header.logoHome": "回首页",
143
145
  "aria.header.logoHomeWithTitle": "{title},回首页",
144
146
  "aria.header.navigation": "主选单",
147
+ "aria.header.languageSelect": "选择语言",
145
148
  "aria.autocomplete.search": "执行搜寻",
149
+ "aria.loading": "载入中",
146
150
  "aria.modal.close": "关闭视窗",
147
151
  "aria.newWindow": "(另开新视窗)",
148
152
  "aria.vcode.image": "验证码图片,如无法辨识可刷新验证码",
@@ -223,7 +227,9 @@ var enus = {
223
227
  "aria.header.logoHome": "Back to home",
224
228
  "aria.header.logoHomeWithTitle": "{title}, back to home",
225
229
  "aria.header.navigation": "Main menu",
230
+ "aria.header.languageSelect": "Select language",
226
231
  "aria.autocomplete.search": "Search",
232
+ "aria.loading": "Loading",
227
233
  "aria.modal.close": "Close dialog",
228
234
  "aria.newWindow": " (opens in new window)",
229
235
  "aria.vcode.image": "CAPTCHA image, refresh if unreadable",
@@ -36,24 +36,29 @@ var fileDownload = function(data, filename, mime, bom) {
36
36
  }
37
37
  };
38
38
 
39
+ // delimiter 預設逗號(CSV/EXCEL 沿用既有行為);.tsv 需傳 '\t'——
40
+ // tsv 以逗號分隔時,試算表軟體會整列擠進單一儲存格。
41
+ // 值內的 tab/換行以空白取代,避免斷欄斷行
39
42
  var jsonExcel = function jsonExcel(json) {
43
+ var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
44
+ var cleanCell = function cleanCell(value) {
45
+ return String(value == null ? '' : value).replace(/[\t\r\n]+/g, ' ');
46
+ };
40
47
  var output = '';
41
48
  if (Array.isArray(json) && json.length > 0) {
42
49
  var keys = Object.keys(json[0]);
43
- output += "".concat(keys.toString(), "\n");
50
+ output += "".concat(keys.map(cleanCell).join(delimiter), "\n");
44
51
  json.forEach(function (item) {
45
- keys.forEach(function (key) {
46
- output += "".concat(item[key], ",");
47
- });
48
- output += '\n';
52
+ output += "".concat(keys.map(function (key) {
53
+ return cleanCell(item[key]);
54
+ }).join(delimiter), "\n");
49
55
  });
50
56
  } else {
51
57
  var _keys = Object.keys(json);
52
- output += "".concat(_keys.toString(), "\n");
53
- _keys.forEach(function (key) {
54
- output += "".concat(json[key], ",");
55
- });
56
- output += '\n';
58
+ output += "".concat(_keys.map(cleanCell).join(delimiter), "\n");
59
+ output += "".concat(_keys.map(function (key) {
60
+ return cleanCell(json[key]);
61
+ }).join(delimiter), "\n");
57
62
  }
58
63
  return output;
59
64
  };
@@ -192,11 +197,22 @@ var worksSlider = function worksSlider(data) {
192
197
  });
193
198
  };
194
199
 
200
+ /* \u532F\u51FA\u6A94\u540D\u7684\u65E5\u671F\u5F8C\u7DB4\uFF08YYYY-MM-DD\uFF09\uFF0C
201
+ \u8207 DownloadMenu \u4E0B\u8F09\u5716\u7247\u5171\u7528 */
202
+ var exportDateSuffix = function exportDateSuffix() {
203
+ var now = new Date();
204
+ var pad = function pad(n) {
205
+ return String(n).padStart(2, '0');
206
+ };
207
+ return "".concat(now.getFullYear(), "-").concat(pad(now.getMonth() + 1), "-").concat(pad(now.getDate()));
208
+ };
195
209
  var exportXlsx = function exportXlsx(_ref) {
196
210
  var data = _ref.data,
197
211
  dataType = _ref.dataType,
198
212
  _ref$extType = _ref.extType,
199
- extType = _ref$extType === void 0 ? 'xlsx' : _ref$extType;
213
+ extType = _ref$extType === void 0 ? 'xlsx' : _ref$extType,
214
+ _ref$fileName = _ref.fileName,
215
+ fileName = _ref$fileName === void 0 ? 'output' : _ref$fileName;
200
216
  var metadata;
201
217
  switch (dataType) {
202
218
  case 'sna':
@@ -206,7 +222,7 @@ var exportXlsx = function exportXlsx(_ref) {
206
222
  metadata = data;
207
223
  break;
208
224
  }
209
- fileDownload("\uFEFF".concat(jsonExcel(metadata)), "output.".concat(extType));
225
+ fileDownload("\uFEFF".concat(jsonExcel(metadata, extType === 'tsv' ? '\t' : ',')), "".concat(fileName, "_").concat(exportDateSuffix(), ".").concat(extType));
210
226
  };
211
227
 
212
228
  // 供外部使用dataConvert
@@ -216,4 +232,4 @@ exportXlsx.mapLgConvert = mapLgConvert;
216
232
  exportXlsx.worksBarChart = worksBarChart;
217
233
  exportXlsx.worksSlider = worksSlider;
218
234
 
219
- export { exportXlsx as default };
235
+ export { exportXlsx as default, exportDateSuffix };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daoyi/nmtl-ui",
3
- "version": "2.0.1-beta.117",
3
+ "version": "2.0.1-beta.119",
4
4
  "description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
5
5
  "author": "daoyi",
6
6
  "main": "lib/index.js",