@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
|
@@ -1 +1,106 @@
|
|
|
1
|
-
var
|
|
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 };
|
package/lib/utils/exportXlsx.js
CHANGED
|
@@ -1 +1,221 @@
|
|
|
1
|
-
import
|
|
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 };
|