@daoyi/nmtl-ui 2.0.1-beta.126 → 2.0.1-beta.128

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.
@@ -1,4 +1,5 @@
1
- import { a as _slicedToArray } from './_rollupPluginBabelHelpers-8dd26e1a.js';
1
+ import { a as _defineProperty, b as _slicedToArray } from './_rollupPluginBabelHelpers-9802e640.js';
2
+ import { getIntl } from '../components/globalConfig';
2
3
 
3
4
  var fileDownload = function(data, filename, mime, bom) {
4
5
  var blobData = (typeof bom !== 'undefined') ? [bom, data] : [data];
@@ -78,7 +79,13 @@ var snaToExcel = function snaToExcel(data) {
78
79
  return [];
79
80
  };
80
81
 
81
- /* 轉檔工具, 提供API轉下載tsv/xlsx */
82
+ /* 欄名走套件自帶的 getIntl():zh-tw 語系表的值與原本寫死的欄名相同,子站(僅 zh-tw)輸出不變;
83
+ 主站英文頁輸出英文欄名(nmtl-web i18n 盤點 D6) */
84
+ var header = function header(id) {
85
+ return getIntl().formatMessage({
86
+ id: id
87
+ });
88
+ };
82
89
 
83
90
  /* 大事年表 */
84
91
  var chronologyConvert = function chronologyConvert(data) {
@@ -94,8 +101,18 @@ var chronologyConvert = function chronologyConvert(data) {
94
101
  };
95
102
  };
96
103
 
104
+ /* 資料來源:主站把名稱包在 .tooltipsources 裡(「資料來源:」前綴隨語系變動,無法再靠中文字剝除);
105
+ 子站的時間軸 HTML 沒有這一層,沿用原本剝除「註」「資料來源:」的寫法 */
106
+ var getSources = function getSources() {
107
+ var after = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
108
+ var tagged = after.match(/<span class="tooltipsources">([\s\S]*?)<\/span>/);
109
+ if (tagged) return tagged[1].replaceAll(/(<([^>]+)>)/gi, '').trim();
110
+ return after.replaceAll('\n', '').replaceAll('\t', '').replace('註', '').replace('資料來源:', '').replaceAll(/(<([^>]+)>)/gi, '');
111
+ };
112
+
97
113
  /* 做資料過濾 */
98
114
  var newData = (data || []).map(function (_ref) {
115
+ var _ref2;
99
116
  var _ref$start_date = _ref.start_date,
100
117
  day = _ref$start_date.day,
101
118
  month = _ref$start_date.month,
@@ -104,96 +121,65 @@ var chronologyConvert = function chronologyConvert(data) {
104
121
  _ref$text = _ref.text,
105
122
  headline = _ref$text.headline,
106
123
  text = _ref$text.text;
107
- return {
108
- 日期: "".concat(year || '', "/").concat(month || '', "/").concat(day || ''),
109
- 名稱: (displayDate || '').replace('<span>', '').replace('</span>', ''),
110
- 描述: (headline || '').replaceAll(/(<([^>]+)>)/gi, ''),
111
- 類型: getText(text).before,
112
- '註(資料集名稱)': getText(text).after.replaceAll('\n', '').replaceAll('\t', '').replace('註', '').replace('資料來源:', '').replaceAll(/(<([^>]+)>)/gi, '')
113
- };
124
+ return _ref2 = {}, _defineProperty(_ref2, header('export.chronology.date'), "".concat(year || '', "/").concat(month || '', "/").concat(day || '')), _defineProperty(_ref2, header('export.chronology.name'), (displayDate || '').replace('<span>', '').replace('</span>', '')), _defineProperty(_ref2, header('export.chronology.description'), (headline || '').replaceAll(/(<([^>]+)>)/gi, '')), _defineProperty(_ref2, header('export.chronology.type'), getText(text).before), _defineProperty(_ref2, header('export.chronology.source'), getSources(getText(text).after)), _ref2;
114
125
  });
115
126
  return newData;
116
127
  };
117
128
 
118
129
  /* 文學數據 - 地圖 */
119
130
  var mapConvert = function mapConvert(data) {
120
- return (data || []).map(function (_ref2) {
121
- var title = _ref2.title,
122
- author = _ref2.author,
123
- publisher = _ref2.publisher,
124
- locations = _ref2.locations,
125
- posX = _ref2.posX,
126
- posY = _ref2.posY;
127
- return {
128
- '名稱(書名/文章名)': title || '',
129
- 作者: author || '',
130
- 出版者: publisher || '',
131
- '地點(作品描述區域)': locations || '',
132
- 經度: posX || '',
133
- 緯度: posY || ''
134
- };
131
+ return (data || []).map(function (_ref3) {
132
+ var _ref4;
133
+ var title = _ref3.title,
134
+ author = _ref3.author,
135
+ publisher = _ref3.publisher,
136
+ locations = _ref3.locations,
137
+ posX = _ref3.posX,
138
+ posY = _ref3.posY;
139
+ return _ref4 = {}, _defineProperty(_ref4, header('export.works.title'), title || ''), _defineProperty(_ref4, header('export.works.author'), author || ''), _defineProperty(_ref4, header('export.map.publisher'), publisher || ''), _defineProperty(_ref4, header('export.map.location'), locations || ''), _defineProperty(_ref4, header('export.map.longitude'), posX || ''), _defineProperty(_ref4, header('export.map.latitude'), posY || ''), _ref4;
135
140
  });
136
141
  };
137
142
 
138
143
  /* 文學數據 - 地圖(文學聚落) */
139
144
  var mapLgConvert = function mapLgConvert(data) {
140
- return (data || []).map(function (_ref3) {
141
- var title = _ref3.title,
142
- locationOfFormation = _ref3.locationOfFormation,
143
- workLocations = _ref3.workLocations,
144
- createPosX = _ref3.createPosX,
145
- createPosY = _ref3.createPosY,
146
- activePosX = _ref3.activePosX,
147
- activePosY = _ref3.activePosY;
148
- return {
149
- 組織名稱: title || '',
150
- 創立地點: locationOfFormation,
151
- 創立地點經度: createPosX || '',
152
- 創立地點緯度: createPosY || '',
153
- 活動地點: workLocations || '',
154
- 活動地點經度: activePosX || '',
155
- 活動地點緯度: activePosY || ''
156
- };
145
+ return (data || []).map(function (_ref5) {
146
+ var _ref6;
147
+ var title = _ref5.title,
148
+ locationOfFormation = _ref5.locationOfFormation,
149
+ workLocations = _ref5.workLocations,
150
+ createPosX = _ref5.createPosX,
151
+ createPosY = _ref5.createPosY,
152
+ activePosX = _ref5.activePosX,
153
+ activePosY = _ref5.activePosY;
154
+ return _ref6 = {}, _defineProperty(_ref6, header('export.mapLg.orgName'), title || ''), _defineProperty(_ref6, header('export.mapLg.foundingPlace'), locationOfFormation), _defineProperty(_ref6, header('export.mapLg.foundingLongitude'), createPosX || ''), _defineProperty(_ref6, header('export.mapLg.foundingLatitude'), createPosY || ''), _defineProperty(_ref6, header('export.mapLg.activityPlace'), workLocations || ''), _defineProperty(_ref6, header('export.mapLg.activityLongitude'), activePosX || ''), _defineProperty(_ref6, header('export.mapLg.activityLatitude'), activePosY || ''), _ref6;
157
155
  });
158
156
  };
159
157
 
160
158
  /* 文學數據 - 年度聲量 */
161
159
  var worksBarChart = function worksBarChart(data) {
162
- return (data || []).map(function (_ref4) {
163
- var date = _ref4.date,
164
- year = _ref4.year,
165
- title = _ref4.title,
166
- keywords = _ref4.keywords,
167
- authors = _ref4.authors,
168
- genreName = _ref4.genreName;
169
- return {
170
- '出版年/發表年': date || year || '',
171
- '名稱(書名/文章名)': title || '',
172
- 作者: (authors || []).map(function (_ref5) {
173
- var author = _ref5.author;
174
- return author;
175
- }).join(','),
176
- 關鍵字: (keywords || '').replaceAll('\n', ''),
177
- 文學分類: genreName || ''
178
- };
160
+ return (data || []).map(function (_ref7) {
161
+ var _ref9;
162
+ var date = _ref7.date,
163
+ year = _ref7.year,
164
+ title = _ref7.title,
165
+ keywords = _ref7.keywords,
166
+ authors = _ref7.authors,
167
+ genreName = _ref7.genreName;
168
+ return _ref9 = {}, _defineProperty(_ref9, header('export.works.publishYear'), date || year || ''), _defineProperty(_ref9, header('export.works.title'), title || ''), _defineProperty(_ref9, header('export.works.author'), (authors || []).map(function (_ref8) {
169
+ var author = _ref8.author;
170
+ return author;
171
+ }).join(',')), _defineProperty(_ref9, header('export.works.keywords'), (keywords || '').replaceAll('\n', '')), _defineProperty(_ref9, header('export.works.genre'), genreName || ''), _ref9;
179
172
  });
180
173
  };
181
174
 
182
175
  /* 文學數據 - 文學自由搭配 */
183
176
  var worksSlider = function worksSlider(data) {
184
- return (data || []).map(function (_ref6) {
185
- var title = _ref6.title,
186
- author = _ref6.author,
187
- date = _ref6.date;
188
- return {
189
- '名稱(書名/文章名)': title || '',
190
- 作者: author || '',
191
- '出版日期/發表日期': date || ''
192
- // 文學分類: genreName || '',
193
- // 作品描述地: workDesc || '',
194
- // 作家出生地: locations,
195
- // 獲獎獎項: awards || '',
196
- };
177
+ return (data || []).map(function (_ref10) {
178
+ var _ref11;
179
+ var title = _ref10.title,
180
+ author = _ref10.author,
181
+ date = _ref10.date;
182
+ return _ref11 = {}, _defineProperty(_ref11, header('export.works.title'), title || ''), _defineProperty(_ref11, header('export.works.author'), author || ''), _defineProperty(_ref11, header('export.works.publishDate'), date || ''), _ref11;
197
183
  });
198
184
  };
199
185
 
@@ -1,4 +1,4 @@
1
- import { b as _objectWithoutProperties, c as _objectSpread2 } from './_rollupPluginBabelHelpers-8dd26e1a.js';
1
+ import { c as _objectWithoutProperties, d as _objectSpread2 } from './_rollupPluginBabelHelpers-9802e640.js';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
4
  var queryString = {};
@@ -1,4 +1,4 @@
1
- import { _ as _toConsumableArray } from './_rollupPluginBabelHelpers-8dd26e1a.js';
1
+ import { _ as _toConsumableArray } from './_rollupPluginBabelHelpers-9802e640.js';
2
2
  import { s as snaDefine } from './snaDefine-6a2bcd94.js';
3
3
 
4
4
  var snaPreProcess = function snaPreProcess(_ref) {
package/package.json CHANGED
@@ -1,125 +1,134 @@
1
- {
2
- "name": "@daoyi/nmtl-ui",
3
- "version": "2.0.1-beta.126",
4
- "description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
5
- "author": "daoyi",
6
- "main": "lib/index.js",
7
- "typings": "lib/index.d.ts",
8
- "files": [
9
- "lib"
10
- ],
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/HsunTsai/react-storybook-jsx-starter"
14
- },
15
- "dependencies": {
16
- "@geometricpanda/storybook-addon-badges": "0.2.2",
17
- "@material-ui/core": "4.12.3",
18
- "@material-ui/icons": "4.11.2",
19
- "@material-ui/lab": "4.0.0-alpha.60",
20
- "@material-ui/styles": "4.11.4",
21
- "axios": "0.21.1",
22
- "babel-eslint": "10.1.0",
23
- "classnames": "2.3.1",
24
- "d3": "5.16.0",
25
- "d3-selection": "1.4.2",
26
- "d3-transition": "1.3.2",
27
- "dom-to-image": "2.6.0",
28
- "formik": "2.2.9",
29
- "html-to-react": "1.4.5",
30
- "jquery": "3.6.0",
31
- "js-file-download": "0.4.12",
32
- "jszip": "3.7.1",
33
- "lodash": "4.17.21",
34
- "markdown-it": "12.0.6",
35
- "moment": "^2.29.4",
36
- "notistack": "1.0.10",
37
- "prop-types": "15.7.2",
38
- "query-string": "6.12.1",
39
- "react": "16.14.0",
40
- "react-awesome-lightbox": "^1.8.1",
41
- "react-data-export": "0.6.0",
42
- "react-dom": "16.14.0",
43
- "react-dropzone": "11.3.2",
44
- "react-facebook-login": "4.1.1",
45
- "react-file-download": "0.3.5",
46
- "react-font-size-changer": "0.2.0",
47
- "react-google-login": "5.2.2",
48
- "react-intl": "5.8.0",
49
- "react-redux": "7.2.5",
50
- "react-router-dom": "5.2.0",
51
- "react-share": "4.4.0",
52
- "react-slick": "^0.28.1",
53
- "redux": "4.1.0",
54
- "sass": "1.41.1",
55
- "screenfull": "5.2.0",
56
- "slick-carousel": "^1.8.1",
57
- "styled-components": "5.3.5",
58
- "xlsx": "0.18.5"
59
- },
60
- "devDependencies": {
61
- "@babel/core": "7.14.8",
62
- "@babel/preset-env": "7.14.8",
63
- "@babel/preset-react": "7.14.5",
64
- "@rollup/plugin-babel": "5.3.1",
65
- "@rollup/plugin-commonjs": "22.0.0",
66
- "@rollup/plugin-node-resolve": "13.2.1",
67
- "@rollup/plugin-replace": "4.0.0",
68
- "@rollup/plugin-image": "2.1.1",
69
- "@rollup/plugin-json": "4.1.0",
70
- "@storybook/addon-essentials": "6.5.13",
71
- "@storybook/addon-links": "6.5.13",
72
- "@storybook/addon-notes": "6.0.0-alpha.6",
73
- "@storybook/addons": "6.5.13",
74
- "@storybook/preset-scss": "1.0.3",
75
- "@storybook/react": "6.5.13",
76
- "autoprefixer": "9.8.6",
77
- "babel-loader": "8.2.2",
78
- "babel-plugin-transform-imports": "2.0.0",
79
- "css-loader": "1.0.1",
80
- "eslint": "7.2.0",
81
- "eslint-config-airbnb": "18.2.1",
82
- "eslint-config-node": "4.1.0",
83
- "eslint-config-prettier": "8.3.0",
84
- "eslint-loader": "4.0.2",
85
- "eslint-plugin-import": "2.22.1",
86
- "eslint-plugin-jsx-a11y": "6.4.1",
87
- "eslint-plugin-node": "11.1.0",
88
- "eslint-plugin-prettier": "3.4.1",
89
- "eslint-plugin-react": "7.21.5",
90
- "eslint-plugin-react-hooks": "1.7.0",
91
- "http-proxy-middleware": "1.3.1",
92
- "prettier": "2.4.1",
93
- "rollup": "2.70.2",
94
- "rollup-plugin-cleaner": "1.0.0",
95
- "rollup-plugin-postcss": "4.0.1",
96
- "rollup-plugin-terser": "7.0.2",
97
- "sass-loader": "7.1.0",
98
- "style-loader": "0.22.1"
99
- },
100
- "browserslist": {
101
- "production": [
102
- ">0.2%",
103
- "not dead",
104
- "not op_mini all"
105
- ],
106
- "development": [
107
- "last 1 chrome version",
108
- "last 1 firefox version",
109
- "last 1 safari version"
110
- ]
111
- },
112
- "scripts": {
113
- "start": "set NODE_OPTIONS=--max_old_space_size=16384 && yarn storybook",
114
- "lint": "eslint ./src/**/*.{js,jsx}",
115
- "format": "prettier --write --tab-width 4 --use-tabs true \"{,src/**/}*.{js,jsx}\"",
116
- "storybook": "start-storybook -p 6006 --no-open",
117
- "build": "rollup -c && npm run build-index",
118
- "build-index": "node ./rollup.index.js",
119
- "build-storybook": "build-storybook -c .storybook -o public",
120
- "create": "node ./buildUtils/create.js",
121
- "pub": "npm version patch -m Publish && npm publish",
122
- "pub-alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
123
- "pub-beta": "npm version prerelease --preid=beta && npm publish --tag beta"
124
- }
125
- }
1
+ {
2
+ "name": "@daoyi/nmtl-ui",
3
+ "packageManager": "pnpm@10.34.5",
4
+ "version": "2.0.1-beta.128",
5
+ "description": "This project is to be used as a starter kit for building React component using Storybook and Rollup",
6
+ "author": "daoyi",
7
+ "main": "lib/index.js",
8
+ "typings": "lib/index.d.ts",
9
+ "files": [
10
+ "lib"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/HsunTsai/react-storybook-jsx-starter"
15
+ },
16
+ "dependencies": {
17
+ "@geometricpanda/storybook-addon-badges": "0.2.2",
18
+ "@material-ui/core": "4.12.3",
19
+ "@material-ui/icons": "4.11.2",
20
+ "@material-ui/lab": "4.0.0-alpha.60",
21
+ "@material-ui/styles": "4.11.4",
22
+ "axios": "0.21.1",
23
+ "babel-eslint": "10.1.0",
24
+ "classnames": "2.3.1",
25
+ "d3": "5.16.0",
26
+ "d3-selection": "1.4.2",
27
+ "d3-transition": "1.3.2",
28
+ "dom-to-image": "2.6.0",
29
+ "formik": "2.2.9",
30
+ "html-to-react": "1.4.5",
31
+ "jquery": "3.6.0",
32
+ "js-file-download": "0.4.12",
33
+ "jszip": "3.7.1",
34
+ "lodash": "4.17.21",
35
+ "markdown-it": "12.0.6",
36
+ "moment": "^2.29.4",
37
+ "notistack": "1.0.10",
38
+ "prop-types": "15.7.2",
39
+ "query-string": "6.12.1",
40
+ "react": "16.14.0",
41
+ "react-awesome-lightbox": "^1.8.1",
42
+ "react-data-export": "0.6.0",
43
+ "react-dom": "16.14.0",
44
+ "react-dropzone": "11.3.2",
45
+ "react-facebook-login": "4.1.1",
46
+ "react-file-download": "0.3.5",
47
+ "react-font-size-changer": "0.2.0",
48
+ "react-google-login": "5.2.2",
49
+ "react-intl": "5.8.0",
50
+ "react-redux": "7.2.5",
51
+ "react-router-dom": "5.2.0",
52
+ "react-share": "4.4.0",
53
+ "react-slick": "^0.28.1",
54
+ "redux": "4.1.0",
55
+ "sass": "1.41.1",
56
+ "screenfull": "5.2.0",
57
+ "slick-carousel": "^1.8.1",
58
+ "styled-components": "5.3.5",
59
+ "xlsx": "0.18.5"
60
+ },
61
+ "devDependencies": {
62
+ "@babel/core": "7.14.8",
63
+ "@babel/preset-env": "7.14.8",
64
+ "@babel/preset-react": "7.14.5",
65
+ "@rollup/plugin-babel": "5.3.1",
66
+ "@rollup/plugin-commonjs": "22.0.0",
67
+ "@rollup/plugin-node-resolve": "13.2.1",
68
+ "@rollup/plugin-replace": "4.0.0",
69
+ "@rollup/plugin-image": "2.1.1",
70
+ "@rollup/plugin-json": "4.1.0",
71
+ "@storybook/addon-essentials": "6.5.13",
72
+ "@storybook/addon-links": "6.5.13",
73
+ "@storybook/addon-notes": "6.0.0-alpha.6",
74
+ "@storybook/addons": "6.5.13",
75
+ "@storybook/preset-scss": "1.0.3",
76
+ "@storybook/react": "6.5.13",
77
+ "autoprefixer": "9.8.6",
78
+ "babel-loader": "8.2.2",
79
+ "babel-plugin-transform-imports": "2.0.0",
80
+ "css-loader": "1.0.1",
81
+ "eslint": "7.2.0",
82
+ "eslint-config-airbnb": "18.2.1",
83
+ "eslint-config-node": "4.1.0",
84
+ "eslint-config-prettier": "8.3.0",
85
+ "eslint-loader": "4.0.2",
86
+ "eslint-plugin-import": "2.22.1",
87
+ "eslint-plugin-jsx-a11y": "6.4.1",
88
+ "eslint-plugin-node": "11.1.0",
89
+ "eslint-plugin-prettier": "3.4.1",
90
+ "eslint-plugin-react": "7.21.5",
91
+ "eslint-plugin-react-hooks": "1.7.0",
92
+ "http-proxy-middleware": "1.3.1",
93
+ "prettier": "2.4.1",
94
+ "rollup": "2.70.2",
95
+ "rollup-plugin-cleaner": "1.0.0",
96
+ "rollup-plugin-postcss": "4.0.1",
97
+ "rollup-plugin-terser": "7.0.2",
98
+ "sass-loader": "7.1.0",
99
+ "style-loader": "0.22.1"
100
+ },
101
+ "browserslist": {
102
+ "production": [
103
+ ">0.2%",
104
+ "not dead",
105
+ "not op_mini all"
106
+ ],
107
+ "development": [
108
+ "last 1 chrome version",
109
+ "last 1 firefox version",
110
+ "last 1 safari version"
111
+ ]
112
+ },
113
+ "scripts": {
114
+ "start": "set NODE_OPTIONS=--max_old_space_size=16384 && yarn storybook",
115
+ "lint": "eslint ./src/**/*.{js,jsx}",
116
+ "format": "prettier --write --tab-width 4 --use-tabs true \"{,src/**/}*.{js,jsx}\"",
117
+ "storybook": "start-storybook -p 6006 --no-open",
118
+ "build": "rollup -c && npm run build-index",
119
+ "build-index": "node ./rollup.index.js",
120
+ "build-storybook": "build-storybook -c .storybook -o public",
121
+ "create": "node ./buildUtils/create.js",
122
+ "pub": "npm version patch -m Publish && npm publish",
123
+ "pub-alpha": "npm version prerelease --preid=alpha && npm publish --tag alpha",
124
+ "pub-beta": "npm version prerelease --preid=beta && npm publish --tag beta"
125
+ },
126
+ "pnpm": {
127
+ "onlyBuiltDependencies": [
128
+ "core-js",
129
+ "esbuild",
130
+ "protobufjs",
131
+ "styled-components"
132
+ ]
133
+ }
134
+ }