@daoyi/nmtl-ui 2.0.1-beta.13 → 2.0.1-beta.131

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.
Files changed (104) hide show
  1. package/lib/components/Autocomplete-3b418e5f.js +494 -0
  2. package/lib/components/Autocomplete.js +20 -1
  3. package/lib/components/Avatar.js +59 -1
  4. package/lib/components/BackTop.js +124 -1
  5. package/lib/components/BarChart.js +764 -1
  6. package/lib/components/Breadcrumbs.js +122 -1
  7. package/lib/components/Button-7bd5aa09.js +114 -0
  8. package/lib/components/Button.js +7 -1
  9. package/lib/components/Carousel.js +4654 -1
  10. package/lib/components/Checkbox.js +37 -1
  11. package/lib/components/CollapseContent.js +180 -1
  12. package/lib/components/ContactModal-eaed02b8.js +12282 -0
  13. package/lib/components/ContactModal.js +24 -3
  14. package/lib/components/Drawer-629e59c7.js +176 -0
  15. package/lib/components/Drawer.js +17 -1
  16. package/lib/components/Dropdown.js +134 -1
  17. package/lib/components/Empty-c6a44967.js +46 -0
  18. package/lib/components/Empty.js +5 -1
  19. package/lib/components/ExportButton.js +128 -1
  20. package/lib/components/ExtraTools-2691c13e.js +3676 -0
  21. package/lib/components/ExtraTools.js +11 -22
  22. package/lib/components/Filter.js +821 -12
  23. package/lib/components/Footer.js +317 -1
  24. package/lib/components/ForwardLink-5fbd2705.js +184 -0
  25. package/lib/components/ForwardLink.js +10 -0
  26. package/lib/components/Header.js +233 -1
  27. package/lib/components/Image.js +61 -1
  28. package/lib/components/Input.js +89 -1
  29. package/lib/components/InputMethod.js +33949 -12
  30. package/lib/components/KeywordSearch-fec33a2c.js +156 -0
  31. package/lib/components/KeywordSearch.js +22 -1
  32. package/lib/components/KeywordTicker.js +224 -1
  33. package/lib/components/Keywords.js +383 -1
  34. package/lib/components/Loading.js +32 -1
  35. package/lib/components/MUITheme.js +2657 -1
  36. package/lib/components/Modal-e04532fa.js +127 -0
  37. package/lib/components/Modal.js +11 -1
  38. package/lib/components/MoreButton-19055e07.js +148 -0
  39. package/lib/components/MoreButton.js +8 -1
  40. package/lib/components/Pagination.js +3702 -0
  41. package/lib/components/Radio.js +83 -1
  42. package/lib/components/SNA.js +1755 -22
  43. package/lib/components/Select-cb3e1ba1.js +189 -0
  44. package/lib/components/Select.js +14 -1
  45. package/lib/components/Spin-8f87eadc.js +79 -0
  46. package/lib/components/Spin.js +7 -1
  47. package/lib/components/Table.js +51 -1
  48. package/lib/components/Tooltip-6ebfa9c1.js +70 -0
  49. package/lib/components/Tooltip.js +7 -1
  50. package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
  51. package/lib/components/_rollupPluginBabelHelpers-a52356f6.js +142 -0
  52. package/lib/components/createSvgIcon-e3803ee1.js +576 -0
  53. package/lib/components/dataExport-a9e3fae1.js +91 -0
  54. package/lib/components/debounce-127da66c.js +355 -0
  55. package/lib/components/defaultTheme-ed7746fe.js +1661 -0
  56. package/lib/components/globalConfig.js +429 -0
  57. package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
  58. package/lib/components/index-b47819f3.js +481 -0
  59. package/lib/components/index-b76a85f4.js +61 -0
  60. package/lib/components/isObjectLike-e111475d.js +190 -0
  61. package/lib/components/style-inject.es-1f59c1d0.js +28 -1
  62. package/lib/components/toConsumableArray-dbe8af76.js +19 -0
  63. package/lib/components/transform-849a452c.js +5475 -0
  64. package/lib/components/useTheme-d16d02d9.js +11 -0
  65. package/lib/components/withTheme-2d778133.js +6 -0
  66. package/lib/configs/config.selector.js +151 -0
  67. package/lib/configs/index.d.ts +1 -0
  68. package/lib/configs/index.js +1 -0
  69. package/lib/index.d.ts +5 -1
  70. package/lib/index.js +5 -1
  71. package/lib/utils/_rollupPluginBabelHelpers-9802e640.js +121 -0
  72. package/lib/utils/arrayMerge.js +4953 -1
  73. package/lib/utils/chunkArray.js +15 -1
  74. package/lib/utils/convert2HtmlEntities.js +42 -1
  75. package/lib/utils/domToImage.js +802 -1
  76. package/lib/utils/downloadGephi.js +106 -1
  77. package/lib/utils/exportXlsx.js +221 -1
  78. package/lib/utils/historyAppendSearch.js +502 -1
  79. package/lib/utils/isDevelopMode.js +5 -1
  80. package/lib/utils/parseYMD.js +36 -1
  81. package/lib/utils/removeDuplicateItem.js +11 -1
  82. package/lib/utils/sendEmail.js +39 -1
  83. package/lib/utils/snaDefine-6a2bcd94.js +5 -0
  84. package/lib/utils/snaDefine.js +1 -1
  85. package/lib/utils/snaPreProcess.js +84 -1
  86. package/package.json +134 -128
  87. package/lib/components/Empty-54b79907.js +0 -1
  88. package/lib/components/KeywordSearch-5a393f12.js +0 -1
  89. package/lib/components/Select-f2441b83.js +0 -1
  90. package/lib/components/_rollupPluginBabelHelpers-1b8c042f.js +0 -1
  91. package/lib/components/_rollupPluginBabelHelpers-ec4e2a53.js +0 -1
  92. package/lib/components/createSvgIcon-62b64929.js +0 -1
  93. package/lib/components/createSvgIcon-e24792d4.js +0 -1
  94. package/lib/components/createTheme-7fffa109.js +0 -1
  95. package/lib/components/dataExport-9fccd4f0.js +0 -1
  96. package/lib/components/debounce-c993109b.js +0 -1
  97. package/lib/components/hoist-non-react-statics.cjs-d6a9befd.js +0 -1
  98. package/lib/components/index-11391ca3.js +0 -7
  99. package/lib/components/index-b2745105.js +0 -7
  100. package/lib/components/isObjectLike-2f1983fe.js +0 -1
  101. package/lib/components/style-inject.es-c875d022.js +0 -1
  102. package/lib/components/transform-95ae0119.js +0 -1
  103. package/lib/utils/_commonjsHelpers-e2cda605.js +0 -1
  104. package/lib/utils/_rollupPluginBabelHelpers-928a52ce.js +0 -1
@@ -1 +1,106 @@
1
- var e=require("jszip"),t=require("react-file-download"),n=function(n){var r=n.nodes,a=(n.links||[]).map((function(e){var t=e.source,n=e.target;return{source:r[t].name,target:r[n].name,sourceType:r[t].type,targetType:r[n].type}})),c=function(e){var t=1e7,n={},r=!1;e.forEach((function(e){var a=e.source,c=e.target,o=e.sourceType,E=e.targetType;""!==c&&""!==a&&(Object.keys(n).indexOf(a)<0?(""!==o?(r=!0,n[a]={ID:t,WEIGHT:1,NODE_TYPE:o}):n[a]={ID:t,WEIGHT:1},t+=1):n[a].WEIGHT+=1,Object.keys(n).indexOf(c)<0?(""!==E?(r=!0,n[c]={ID:t,WEIGHT:1,NODE_TYPE:E}):n[c]={ID:t,WEIGHT:1},t+=1):n[c].WEIGHT+=1)}));var a=r?"ID\tLABEL\tWEIGHT\tNODE_TYPE\r\n":"ID\tLABEL\tWEIGHT\r\n";return Object.keys(n).forEach((function(e){var t=n[e].ID,c=n[e].WEIGHT,o=r?n[e].NODE_TYPE:"";a+=r?"".concat(t,"\t").concat(e,"\t").concat(c,"\t").concat(o,"\r\n"):"".concat(t,"\t").concat(e,"\t").concat(c,"\r\n")})),{nodeMap:n,nodesTsv:a}}(a),o=c.nodeMap,E=c.nodesTsv,T=function(e,t){var n="SOURCE\tTARGET\tWEIGHT\tTYPE\r\n";return e.forEach((function(e){var r=e.source,a=e.target;if(""!==a&&""!==r){var c=t[r].ID,o=t[a].ID;n+="".concat(c,"\t").concat(o,"\t1\tUndirected\r\n")}})),n}(a,o),i=new e;i.file("Node_Table.tsv",E),i.file("Edge_Table.tsv",T),i.generateAsync({type:"blob"}).then((function(e){t(e,"Gephi_generated_by_NMTL.zip")}))};export{n as default};
1
+ var JSZip = require('jszip');
2
+ var fileDownload = require('react-file-download');
3
+ var DownloadGephiFileName = 'Gephi_generated_by_NMTL.zip';
4
+ var generateNode = function generateNode(result) {
5
+ var IdCount = 10000000;
6
+ var nodeMap = {};
7
+ var foundType = false;
8
+ result.forEach(function (_ref) {
9
+ var source = _ref.source,
10
+ target = _ref.target,
11
+ sourceType = _ref.sourceType,
12
+ targetType = _ref.targetType;
13
+ if (target === '' || source === '') {
14
+ return;
15
+ }
16
+ if (Object.keys(nodeMap).indexOf(source) < 0) {
17
+ if (sourceType !== '') {
18
+ foundType = true;
19
+ nodeMap[source] = {
20
+ ID: IdCount,
21
+ WEIGHT: 1,
22
+ NODE_TYPE: sourceType
23
+ };
24
+ } else {
25
+ nodeMap[source] = {
26
+ ID: IdCount,
27
+ WEIGHT: 1
28
+ };
29
+ }
30
+ IdCount += 1;
31
+ } else {
32
+ nodeMap[source].WEIGHT += 1;
33
+ }
34
+ if (Object.keys(nodeMap).indexOf(target) < 0) {
35
+ if (targetType !== '') {
36
+ foundType = true;
37
+ nodeMap[target] = {
38
+ ID: IdCount,
39
+ WEIGHT: 1,
40
+ NODE_TYPE: targetType
41
+ };
42
+ } else {
43
+ nodeMap[target] = {
44
+ ID: IdCount,
45
+ WEIGHT: 1
46
+ };
47
+ }
48
+ IdCount += 1;
49
+ } else {
50
+ nodeMap[target].WEIGHT += 1;
51
+ }
52
+ });
53
+ var tsvStr = foundType ? 'ID\tLABEL\tWEIGHT\tNODE_TYPE\r\n' : 'ID\tLABEL\tWEIGHT\r\n';
54
+ Object.keys(nodeMap).forEach(function (key) {
55
+ var idval = nodeMap[key].ID;
56
+ var wval = nodeMap[key].WEIGHT;
57
+ var type = foundType ? nodeMap[key].NODE_TYPE : '';
58
+ tsvStr += foundType ? "".concat(idval, "\t").concat(key, "\t").concat(wval, "\t").concat(type, "\r\n") : "".concat(idval, "\t").concat(key, "\t").concat(wval, "\r\n");
59
+ });
60
+ return {
61
+ nodeMap: nodeMap,
62
+ nodesTsv: tsvStr
63
+ };
64
+ };
65
+ var generateEdge = function generateEdge(result, nodeMap) {
66
+ var edgeStr = 'SOURCE\tTARGET\tWEIGHT\tTYPE\r\n';
67
+ result.forEach(function (_ref2) {
68
+ var source = _ref2.source,
69
+ target = _ref2.target;
70
+ if (target === '' || source === '') {
71
+ return;
72
+ }
73
+ var sourceId = nodeMap[source].ID;
74
+ var targetId = nodeMap[target].ID;
75
+ edgeStr += "".concat(sourceId, "\t").concat(targetId, "\t1\tUndirected\r\n");
76
+ });
77
+ return edgeStr;
78
+ };
79
+ var downloadGephi = function downloadGephi(snaData) {
80
+ var nodes = snaData.nodes,
81
+ links = snaData.links;
82
+ var result = (links || []).map(function (_ref3) {
83
+ var source = _ref3.source,
84
+ target = _ref3.target;
85
+ return {
86
+ source: nodes[source].name,
87
+ target: nodes[target].name,
88
+ sourceType: nodes[source].type,
89
+ targetType: nodes[target].type
90
+ };
91
+ });
92
+ var _generateNode = generateNode(result),
93
+ nodeMap = _generateNode.nodeMap,
94
+ nodesTsv = _generateNode.nodesTsv;
95
+ var edgesTsv = generateEdge(result, nodeMap);
96
+ var zip = new JSZip();
97
+ zip.file('Node_Table.tsv', nodesTsv);
98
+ zip.file('Edge_Table.tsv', edgesTsv);
99
+ zip.generateAsync({
100
+ type: 'blob'
101
+ }).then(function (content) {
102
+ fileDownload(content, DownloadGephiFileName);
103
+ });
104
+ };
105
+
106
+ export { downloadGephi as default };
@@ -1 +1,221 @@
1
- import{a as t}from"./_rollupPluginBabelHelpers-928a52ce.js";var e=function(t){var e,n=t.data,a=t.dataType,o=t.extType,r=void 0===o?"xlsx":o;if("sna"===a)e=function(t){var e=t||{},n=e.links,a=e.nodes;return n&&n.length>0?n.map((function(t){return{From:a[t.source].name,To:a[t.target].name}})):[]}(n);else e=n;!function(t,e,n,a){var o=new Blob(void 0!==a?[a,t]:[t],{type:n||"application/octet-stream"});if(void 0!==window.navigator.msSaveBlob)window.navigator.msSaveBlob(o,e);else{var r=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(o):window.webkitURL.createObjectURL(o),c=document.createElement("a");c.style.display="none",c.href=r,c.setAttribute("download",e),void 0===c.download&&c.setAttribute("target","_blank"),document.body.appendChild(c),c.click(),setTimeout((function(){document.body.removeChild(c),window.URL.revokeObjectURL(r)}),200)}}("\ufeff".concat(function(t){var e="";if(Array.isArray(t)&&t.length>0){var n=Object.keys(t[0]);e+="".concat(n.toString(),"\n"),t.forEach((function(t){n.forEach((function(n){e+="".concat(t[n],",")})),e+="\n"}))}else{var a=Object.keys(t);e+="".concat(a.toString(),"\n"),a.forEach((function(n){e+="".concat(t[n],",")})),e+="\n"}return e}(e)),"output.".concat(r))};e.chronologyConvert=function(e){var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=e.split('<span class="tooltip">'),a=t(n,2),o=a[0],r=a[1];return{before:o,after:r}};return(e||[]).map((function(t){var e=t.start_date,a=e.day,o=e.month,r=e.year,c=t.display_date,i=t.text,l=i.headline,u=i.text;return{"日期":"".concat(r||"","/").concat(o||"","/").concat(a||""),"名稱":(c||"").replace("<span>","").replace("</span>",""),"描述":(l||"").replaceAll(/(<([^>]+)>)/gi,""),"類型":n(u).before,"註(資料集名稱)":n(u).after.replaceAll("\n","").replaceAll("\t","").replace("註","").replace("資料來源:","").replaceAll(/(<([^>]+)>)/gi,"")}}))},e.mapConvert=function(t){return(t||[]).map((function(t){return{"名稱(書名/文章名)":t.title||"","作者":t.author||"","出版者":t.publisher||"","地點(作品描述區域)":t.locations||"","經度":t.posX||"","緯度":t.posY||""}}))},e.mapLgConvert=function(t){return(t||[]).map((function(t){var e=t.title,n=t.locationOfFormation,a=t.workLocations;return{"組織名稱":e||"","創立地點":n,"創立地點經度":t.createPosX||"","創立地點緯度":t.createPosY||"","活動地點":a||"","活動地點經度":t.activePosX||"","活動地點緯度":t.activePosY||""}}))},e.worksBarChart=function(t){return(t||[]).map((function(t){var e=t.date,n=t.year,a=t.title,o=t.keywords,r=t.authors,c=t.genreName;return{"出版年/發表年":e||n||"","名稱(書名/文章名)":a||"","作者":(r||[]).map((function(t){return t.author})).join(","),"關鍵字":(o||"").replaceAll("\n",""),"文學分類":c||""}}))},e.worksSlider=function(t){return(t||[]).map((function(t){return{"名稱(書名/文章名)":t.title||"","作者":t.author||"","出版日期/發表日期":t.date||""}}))};export{e as default};
1
+ import { a as _defineProperty, b as _slicedToArray } from './_rollupPluginBabelHelpers-9802e640.js';
2
+ import { getIntl } from '../components/globalConfig';
3
+
4
+ var fileDownload = function(data, filename, mime, bom) {
5
+ var blobData = (typeof bom !== 'undefined') ? [bom, data] : [data];
6
+ var blob = new Blob(blobData, {type: mime || 'application/octet-stream'});
7
+ if (typeof window.navigator.msSaveBlob !== 'undefined') {
8
+ // IE workaround for "HTML7007: One or more blob URLs were
9
+ // revoked by closing the blob for which they were created.
10
+ // These URLs will no longer resolve as the data backing
11
+ // the URL has been freed."
12
+ window.navigator.msSaveBlob(blob, filename);
13
+ }
14
+ else {
15
+ var blobURL = (window.URL && window.URL.createObjectURL) ? window.URL.createObjectURL(blob) : window.webkitURL.createObjectURL(blob);
16
+ var tempLink = document.createElement('a');
17
+ tempLink.style.display = 'none';
18
+ tempLink.href = blobURL;
19
+ tempLink.setAttribute('download', filename);
20
+
21
+ // Safari thinks _blank anchor are pop ups. We only want to set _blank
22
+ // target if the browser does not support the HTML5 download attribute.
23
+ // This allows you to download files in desktop safari if pop up blocking
24
+ // is enabled.
25
+ if (typeof tempLink.download === 'undefined') {
26
+ tempLink.setAttribute('target', '_blank');
27
+ }
28
+
29
+ document.body.appendChild(tempLink);
30
+ tempLink.click();
31
+
32
+ // Fixes "webkit blob resource error 1"
33
+ setTimeout(function() {
34
+ document.body.removeChild(tempLink);
35
+ window.URL.revokeObjectURL(blobURL);
36
+ }, 200);
37
+ }
38
+ };
39
+
40
+ // delimiter 預設逗號(CSV/EXCEL 沿用既有行為);.tsv 需傳 '\t'——
41
+ // tsv 以逗號分隔時,試算表軟體會整列擠進單一儲存格。
42
+ // 值內的 tab/換行以空白取代,避免斷欄斷行
43
+ var jsonExcel = function jsonExcel(json) {
44
+ var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
45
+ var cleanCell = function cleanCell(value) {
46
+ return String(value == null ? '' : value).replace(/[\t\r\n]+/g, ' ');
47
+ };
48
+ var output = '';
49
+ if (Array.isArray(json) && json.length > 0) {
50
+ var keys = Object.keys(json[0]);
51
+ output += "".concat(keys.map(cleanCell).join(delimiter), "\n");
52
+ json.forEach(function (item) {
53
+ output += "".concat(keys.map(function (key) {
54
+ return cleanCell(item[key]);
55
+ }).join(delimiter), "\n");
56
+ });
57
+ } else {
58
+ var _keys = Object.keys(json);
59
+ output += "".concat(_keys.map(cleanCell).join(delimiter), "\n");
60
+ output += "".concat(_keys.map(function (key) {
61
+ return cleanCell(json[key]);
62
+ }).join(delimiter), "\n");
63
+ }
64
+ return output;
65
+ };
66
+ var snaToExcel = function snaToExcel(data) {
67
+ var _ref = data || {},
68
+ links = _ref.links,
69
+ nodes = _ref.nodes;
70
+ if (links && links.length > 0) {
71
+ var result = links.map(function (link) {
72
+ return {
73
+ From: nodes[link.source].name,
74
+ To: nodes[link.target].name
75
+ };
76
+ });
77
+ return result;
78
+ }
79
+ return [];
80
+ };
81
+
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
+ };
89
+
90
+ /* 大事年表 */
91
+ var chronologyConvert = function chronologyConvert(data) {
92
+ var getText = function getText() {
93
+ var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
94
+ var _text$split = text.split('<span class="tooltip">'),
95
+ _text$split2 = _slicedToArray(_text$split, 2),
96
+ before = _text$split2[0],
97
+ after = _text$split2[1];
98
+ return {
99
+ before: before,
100
+ after: after
101
+ };
102
+ };
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
+
113
+ /* 做資料過濾 */
114
+ var newData = (data || []).map(function (_ref) {
115
+ var _ref2;
116
+ var _ref$start_date = _ref.start_date,
117
+ day = _ref$start_date.day,
118
+ month = _ref$start_date.month,
119
+ year = _ref$start_date.year,
120
+ displayDate = _ref.display_date,
121
+ _ref$text = _ref.text,
122
+ headline = _ref$text.headline,
123
+ text = _ref$text.text;
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;
125
+ });
126
+ return newData;
127
+ };
128
+
129
+ /* 文學數據 - 地圖 */
130
+ var mapConvert = function mapConvert(data) {
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;
140
+ });
141
+ };
142
+
143
+ /* 文學數據 - 地圖(文學聚落) */
144
+ var mapLgConvert = function mapLgConvert(data) {
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;
155
+ });
156
+ };
157
+
158
+ /* 文學數據 - 年度聲量 */
159
+ var worksBarChart = function worksBarChart(data) {
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;
172
+ });
173
+ };
174
+
175
+ /* 文學數據 - 文學自由搭配 */
176
+ var worksSlider = function worksSlider(data) {
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;
183
+ });
184
+ };
185
+
186
+ /* \u532F\u51FA\u6A94\u540D\u7684\u65E5\u671F\u5F8C\u7DB4\uFF08YYYY-MM-DD\uFF09\uFF0C
187
+ \u8207 DownloadMenu \u4E0B\u8F09\u5716\u7247\u5171\u7528 */
188
+ var exportDateSuffix = function exportDateSuffix() {
189
+ var now = new Date();
190
+ var pad = function pad(n) {
191
+ return String(n).padStart(2, '0');
192
+ };
193
+ return "".concat(now.getFullYear(), "-").concat(pad(now.getMonth() + 1), "-").concat(pad(now.getDate()));
194
+ };
195
+ var exportXlsx = function exportXlsx(_ref) {
196
+ var data = _ref.data,
197
+ dataType = _ref.dataType,
198
+ _ref$extType = _ref.extType,
199
+ extType = _ref$extType === void 0 ? 'xlsx' : _ref$extType,
200
+ _ref$fileName = _ref.fileName,
201
+ fileName = _ref$fileName === void 0 ? 'output' : _ref$fileName;
202
+ var metadata;
203
+ switch (dataType) {
204
+ case 'sna':
205
+ metadata = snaToExcel(data);
206
+ break;
207
+ default:
208
+ metadata = data;
209
+ break;
210
+ }
211
+ fileDownload("\uFEFF".concat(jsonExcel(metadata, extType === 'tsv' ? '\t' : ',')), "".concat(fileName, "_").concat(exportDateSuffix(), ".").concat(extType));
212
+ };
213
+
214
+ // 供外部使用dataConvert
215
+ exportXlsx.chronologyConvert = chronologyConvert;
216
+ exportXlsx.mapConvert = mapConvert;
217
+ exportXlsx.mapLgConvert = mapLgConvert;
218
+ exportXlsx.worksBarChart = worksBarChart;
219
+ exportXlsx.worksSlider = worksSlider;
220
+
221
+ export { exportXlsx as default, exportDateSuffix };