@daoyi/nmtl-ui 2.0.1-beta.45 → 2.0.1-beta.47

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 (72) hide show
  1. package/lib/components/Autocomplete-5439ff22.js +333 -1
  2. package/lib/components/Autocomplete.js +12 -1
  3. package/lib/components/Avatar.js +51 -1
  4. package/lib/components/BackTop.js +82 -1
  5. package/lib/components/BarChart.js +132 -1
  6. package/lib/components/Breadcrumbs.js +124 -1
  7. package/lib/components/Button-63c7e9f3.js +91 -1
  8. package/lib/components/Button.js +8 -1
  9. package/lib/components/Carousel.js +61 -1
  10. package/lib/components/Checkbox.js +37 -1
  11. package/lib/components/CollapseContent.js +181 -1
  12. package/lib/components/ContactModal-a59bc808.js +924 -0
  13. package/lib/components/ContactModal.js +17 -1
  14. package/lib/components/Drawer-af3ed21a.js +157 -1
  15. package/lib/components/Drawer.js +13 -1
  16. package/lib/components/Dropdown.js +135 -1
  17. package/lib/components/Empty-70f040a9.js +44 -1
  18. package/lib/components/Empty.js +7 -1
  19. package/lib/components/ExportButton.js +114 -1
  20. package/lib/components/ExtraTools-f10a66a8.js +818 -1
  21. package/lib/components/ExtraTools.js +11 -1
  22. package/lib/components/Filter.js +90 -1
  23. package/lib/components/Footer.js +266 -1
  24. package/lib/components/ForwardLink.js +106 -1
  25. package/lib/components/Header.js +186 -1
  26. package/lib/components/Image.js +58 -1
  27. package/lib/components/Input.js +79 -1
  28. package/lib/components/InputMethod.js +23106 -1
  29. package/lib/components/KeywordSearch-224f84c1.js +138 -1
  30. package/lib/components/KeywordSearch.js +14 -1
  31. package/lib/components/KeywordTicker.js +182 -1
  32. package/lib/components/Keywords.js +292 -1
  33. package/lib/components/Loading.js +30 -1
  34. package/lib/components/MUITheme.js +255 -1
  35. package/lib/components/Modal-a7591b98.js +107 -1
  36. package/lib/components/Modal.js +11 -1
  37. package/lib/components/MoreButton-f15ca38e.js +109 -1
  38. package/lib/components/MoreButton.js +8 -1
  39. package/lib/components/Radio.js +81 -1
  40. package/lib/components/SNA.js +324 -1
  41. package/lib/components/Select-98a8e973.js +114 -1
  42. package/lib/components/Select.js +10 -1
  43. package/lib/components/Spin-690a3597.js +74 -1
  44. package/lib/components/Spin.js +8 -1
  45. package/lib/components/Table.js +51 -1
  46. package/lib/components/Tooltip-b7eb966d.js +69 -1
  47. package/lib/components/Tooltip.js +9 -1
  48. package/lib/components/_rollupPluginBabelHelpers-fde6d1c6.js +491 -1
  49. package/lib/components/dataExport-f418e6fe.js +56 -1
  50. package/lib/components/globalConfig.js +186 -1
  51. package/lib/components/vendor-851c6356.js +41893 -16
  52. package/lib/index.d.ts +1 -3
  53. package/lib/index.js +1 -3
  54. package/lib/utils/_rollupPluginBabelHelpers-a6e0e6e3.js +139 -1
  55. package/lib/utils/arrayMerge.js +100 -1
  56. package/lib/utils/chunkArray.js +15 -1
  57. package/lib/utils/convert2HtmlEntities.js +42 -1
  58. package/lib/utils/domToImage.js +32 -1
  59. package/lib/utils/downloadGephi.js +106 -1
  60. package/lib/utils/exportXlsx.js +184 -1
  61. package/lib/utils/historyAppendSearch.js +23 -1
  62. package/lib/utils/isDevelopMode.js +5 -1
  63. package/lib/utils/parseYMD.js +36 -1
  64. package/lib/utils/removeDuplicateItem.js +11 -1
  65. package/lib/utils/sendEmail.js +39 -1
  66. package/lib/utils/snaDefine-6a2bcd94.js +5 -1
  67. package/lib/utils/snaDefine.js +1 -1
  68. package/lib/utils/snaPreProcess.js +84 -1
  69. package/lib/utils/vendor-3ec75cc9.js +1289 -1
  70. package/package.json +1 -1
  71. package/lib/components/ContactModal-d7e2f8bb.js +0 -1
  72. package/lib/components/globalConfig-40069b54.js +0 -1
package/lib/index.d.ts CHANGED
@@ -33,6 +33,4 @@ export { default as CollapseContent } from './components/CollapseContent';
33
33
  export { default as MoreButton } from './components/MoreButton';
34
34
  export { default as KeywordTicker } from './components/KeywordTicker';
35
35
  export { default as ExtraTools } from './components/ExtraTools';
36
- export { default as Filter } from './components/Filter';
37
-
38
- export { getIntl } from './components/globalConfig';
36
+ export { default as Filter } from './components/Filter';
package/lib/index.js CHANGED
@@ -33,6 +33,4 @@ export { default as CollapseContent } from './components/CollapseContent';
33
33
  export { default as MoreButton } from './components/MoreButton';
34
34
  export { default as KeywordTicker } from './components/KeywordTicker';
35
35
  export { default as ExtraTools } from './components/ExtraTools';
36
- export { default as Filter } from './components/Filter';
37
-
38
- export { getIntl } from './components/globalConfig';
36
+ export { default as Filter } from './components/Filter';
@@ -1 +1,139 @@
1
- function r(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function t(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(o,r))}))}return t}function e(r,t,e){return(t=function(r){var t=function(r,t){if("object"!=typeof r||null===r)return r;var e=r[Symbol.toPrimitive];if(void 0!==e){var n=e.call(r,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(r)}(r,"string");return"symbol"==typeof t?t:String(t)}(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function n(r,t){if(null==r)return{};var e,n,o=function(r,t){if(null==r)return{};var e,n,o={},i=Object.keys(r);for(n=0;n<i.length;n++)e=i[n],t.indexOf(e)>=0||(o[e]=r[e]);return o}(r,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)e=i[n],t.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(r,e)&&(o[e]=r[e])}return o}function o(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=e){var n,o,i,u,a=[],l=!0,c=!1;try{if(i=(e=e.call(r)).next,0===t){if(Object(e)!==e)return;l=!1}else for(;!(l=(n=i.call(e)).done)&&(a.push(n.value),a.length!==t);l=!0);}catch(r){c=!0,o=r}finally{try{if(!l&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(c)throw o}}return a}}(r,t)||u(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(r){return function(r){if(Array.isArray(r))return a(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||u(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(r,t){if(r){if("string"==typeof r)return a(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(r,t):void 0}}function a(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}export{i as _,o as a,n as b,t as c};
1
+ function _iterableToArrayLimit(arr, i) {
2
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
3
+ if (null != _i) {
4
+ var _s,
5
+ _e,
6
+ _x,
7
+ _r,
8
+ _arr = [],
9
+ _n = !0,
10
+ _d = !1;
11
+ try {
12
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
13
+ if (Object(_i) !== _i) return;
14
+ _n = !1;
15
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
16
+ } catch (err) {
17
+ _d = !0, _e = err;
18
+ } finally {
19
+ try {
20
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
21
+ } finally {
22
+ if (_d) throw _e;
23
+ }
24
+ }
25
+ return _arr;
26
+ }
27
+ }
28
+ function ownKeys(object, enumerableOnly) {
29
+ var keys = Object.keys(object);
30
+ if (Object.getOwnPropertySymbols) {
31
+ var symbols = Object.getOwnPropertySymbols(object);
32
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
33
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
34
+ })), keys.push.apply(keys, symbols);
35
+ }
36
+ return keys;
37
+ }
38
+ function _objectSpread2(target) {
39
+ for (var i = 1; i < arguments.length; i++) {
40
+ var source = null != arguments[i] ? arguments[i] : {};
41
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
42
+ _defineProperty(target, key, source[key]);
43
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
44
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
45
+ });
46
+ }
47
+ return target;
48
+ }
49
+ function _defineProperty(obj, key, value) {
50
+ key = _toPropertyKey(key);
51
+ if (key in obj) {
52
+ Object.defineProperty(obj, key, {
53
+ value: value,
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true
57
+ });
58
+ } else {
59
+ obj[key] = value;
60
+ }
61
+ return obj;
62
+ }
63
+ function _objectWithoutPropertiesLoose(source, excluded) {
64
+ if (source == null) return {};
65
+ var target = {};
66
+ var sourceKeys = Object.keys(source);
67
+ var key, i;
68
+ for (i = 0; i < sourceKeys.length; i++) {
69
+ key = sourceKeys[i];
70
+ if (excluded.indexOf(key) >= 0) continue;
71
+ target[key] = source[key];
72
+ }
73
+ return target;
74
+ }
75
+ function _objectWithoutProperties(source, excluded) {
76
+ if (source == null) return {};
77
+ var target = _objectWithoutPropertiesLoose(source, excluded);
78
+ var key, i;
79
+ if (Object.getOwnPropertySymbols) {
80
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
81
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
82
+ key = sourceSymbolKeys[i];
83
+ if (excluded.indexOf(key) >= 0) continue;
84
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
85
+ target[key] = source[key];
86
+ }
87
+ }
88
+ return target;
89
+ }
90
+ function _slicedToArray(arr, i) {
91
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
92
+ }
93
+ function _toConsumableArray(arr) {
94
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
95
+ }
96
+ function _arrayWithoutHoles(arr) {
97
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
98
+ }
99
+ function _arrayWithHoles(arr) {
100
+ if (Array.isArray(arr)) return arr;
101
+ }
102
+ function _iterableToArray(iter) {
103
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
104
+ }
105
+ function _unsupportedIterableToArray(o, minLen) {
106
+ if (!o) return;
107
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
108
+ var n = Object.prototype.toString.call(o).slice(8, -1);
109
+ if (n === "Object" && o.constructor) n = o.constructor.name;
110
+ if (n === "Map" || n === "Set") return Array.from(o);
111
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
112
+ }
113
+ function _arrayLikeToArray(arr, len) {
114
+ if (len == null || len > arr.length) len = arr.length;
115
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
116
+ return arr2;
117
+ }
118
+ function _nonIterableSpread() {
119
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
120
+ }
121
+ function _nonIterableRest() {
122
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
123
+ }
124
+ function _toPrimitive(input, hint) {
125
+ if (typeof input !== "object" || input === null) return input;
126
+ var prim = input[Symbol.toPrimitive];
127
+ if (prim !== undefined) {
128
+ var res = prim.call(input, hint || "default");
129
+ if (typeof res !== "object") return res;
130
+ throw new TypeError("@@toPrimitive must return a primitive value.");
131
+ }
132
+ return (hint === "string" ? String : Number)(input);
133
+ }
134
+ function _toPropertyKey(arg) {
135
+ var key = _toPrimitive(arg, "string");
136
+ return typeof key === "symbol" ? key : String(key);
137
+ }
138
+
139
+ export { _toConsumableArray as _, _slicedToArray as a, _objectWithoutProperties as b, _objectSpread2 as c };
@@ -1 +1,100 @@
1
- var t={};t.author=function(t,r){return t.reduce((function(t,u){if(Object.keys(u).indexOf(r)<0)return t.push(u),t;var o=t.find((function(t){return t[r]===u[r]}));return o?(o.authors=u.authorId&&!o.authors.find((function(t){return t.authorId===u.authorId}))?o.authors.concat({author:u.author,authorId:u.authorId}):o.authors,o.authorId=u.authorId&&!o.authorId.find((function(t){return t===u.authorId}))?o.authorId.concat(u.authorId):o.authorId,o.author=u.author&&!o.author.find((function(t){return t===u.author}))?o.author.concat(u.author):o.author):(u.authors=[{author:u.author,authorId:u.authorId}],u.authorId=u.authorId?[u.authorId]:[],u.author=u.author?[u.author]:[],t.push(u)),t}),[])},t.timeline=function(t,r,u){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"mergedList";return t.reduce((function(t,a){var n=t.find((function(t){var u=!0;return r.forEach((function(r){Object.keys(a).indexOf(r)<0&&(u=!1),Object.keys(t).indexOf(r)<0&&(u=!1),t[r]!==a[r]&&(u=!1)})),u?t:null})),h=function(t,r){var u={};return r.forEach((function(r){u[r]=t[r]})),u};return n?n[o]=n[o].concat(h(a,u)):(a[o]=[h(a,u)],t.push(a)),t}),[])};export{t as default};
1
+ var arrayMerge = {};
2
+
3
+ // 根據 id 合併其它所有鍵值為 array
4
+ // input:
5
+ // [{author: "AAA", authorId: "PER1", id: "PUB001"}, {author: "BBB", authorId: "PER2", id: "PUB001"}]
6
+ // return:
7
+ // [{author: ["AAA", "BBB"], authorId: ["PER1", "PER2"],
8
+ // authors:[{author:"AAA", authorId:"PER1"}, {author:"BBB", authorId:"PER2"}], id: "PUB001"}]
9
+ var arrayMergeAuthors = function arrayMergeAuthors(input, key) {
10
+ return input.reduce(function (re, obj) {
11
+ // 如果 key 不存在,就不處理
12
+ if (Object.keys(obj).indexOf(key) < 0) {
13
+ re.push(obj);
14
+ return re;
15
+ }
16
+ var item = re.find(function (o) {
17
+ return o[key] === obj[key];
18
+ });
19
+ if (item) {
20
+ // 過濾重覆的作者名
21
+ item.authors = obj.authorId && !item.authors.find(function (a) {
22
+ return a.authorId === obj.authorId;
23
+ }) ? item.authors.concat({
24
+ author: obj.author,
25
+ authorId: obj.authorId
26
+ }) : item.authors;
27
+ item.authorId = obj.authorId && !item.authorId.find(function (arId) {
28
+ return arId === obj.authorId;
29
+ }) ? item.authorId.concat(obj.authorId) : item.authorId;
30
+ item.author = obj.author && !item.author.find(function (arId) {
31
+ return arId === obj.author;
32
+ }) ? item.author.concat(obj.author) : item.author;
33
+ } else {
34
+ // eslint-disable-next-line no-param-reassign
35
+ obj.authors = [{
36
+ author: obj.author,
37
+ authorId: obj.authorId
38
+ }];
39
+
40
+ // eslint-disable-next-line no-param-reassign
41
+ obj.authorId = obj.authorId ? [obj.authorId] : [];
42
+ // eslint-disable-next-line no-param-reassign
43
+ obj.author = obj.author ? [obj.author] : [];
44
+ re.push(obj);
45
+ }
46
+ return re;
47
+ }, []);
48
+ };
49
+
50
+ // 根據 id 合併其它所有鍵值為 array
51
+ // input: 'graph', 'startDate', 'authorName', 'type'
52
+ // [{graph: "全臺詩", startDate: "PER1", authorName: "作者名", type: '詩文作品', source: '作品名1', typeId: 'ART111'},
53
+ // {graph: "全臺詩", startDate: "PER1", authorName: "作者名", type: '詩文作品', source: '作品名2', typeId: 'ART222'},]
54
+ // return:
55
+ // [{graph: "全臺詩", startDate: "PER1", authorName: "作者名", type: '詩文作品', source: '作品名1', typeId: 'ART111',
56
+ // mergedList: {source: ['作品名1', '作品名2'], typeId: ['ART111', 'ART222']}}]
57
+ var arrayMergeTimeline = function arrayMergeTimeline(input, keys, mergeKeys) {
58
+ var mergedName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'mergedList';
59
+ return input.reduce(function (re, obj) {
60
+ var item = re.find(function (o) {
61
+ var match = true;
62
+
63
+ // 不存在此 property
64
+ keys.forEach(function (key) {
65
+ // not found
66
+ if (Object.keys(obj).indexOf(key) < 0) {
67
+ match = false;
68
+ }
69
+ if (Object.keys(o).indexOf(key) < 0) {
70
+ match = false;
71
+ }
72
+
73
+ // not the same
74
+ if (o[key] !== obj[key]) {
75
+ match = false;
76
+ }
77
+ });
78
+ return match ? o : null;
79
+ });
80
+ var mergedObj = function mergedObj(inObj, inKeys) {
81
+ var mObj = {};
82
+ inKeys.forEach(function (k) {
83
+ mObj[k] = inObj[k];
84
+ });
85
+ return mObj;
86
+ };
87
+ if (item) {
88
+ item[mergedName] = item[mergedName].concat(mergedObj(obj, mergeKeys));
89
+ } else {
90
+ // eslint-disable-next-line no-param-reassign
91
+ obj[mergedName] = [mergedObj(obj, mergeKeys)];
92
+ re.push(obj);
93
+ }
94
+ return re;
95
+ }, []);
96
+ };
97
+ arrayMerge.author = arrayMergeAuthors;
98
+ arrayMerge.timeline = arrayMergeTimeline;
99
+
100
+ export { arrayMerge as default };
@@ -1 +1,15 @@
1
- var u=function(u,e){return u.reduce((function(u,n,r){return r%e?u[u.length-1].push(n):u.push([n]),u}),[])};export{u as default};
1
+ // Examples
2
+ // chunkArray([1, 2, 3, 4, 5, 6, 7, 8], 3); // [[1, 2, 3], [4, 5, 6], [7, 8]]
3
+ // chunkArray([1, 2, 3, 4, 5, 6, 7, 8], 4); // [[1, 2, 3, 4], [5, 6, 7, 8]]
4
+ var chunkArray = function chunkArray(arr, size) {
5
+ return arr.reduce(function (acc, e, i) {
6
+ if (i % size) {
7
+ acc[acc.length - 1].push(e);
8
+ } else {
9
+ acc.push([e]);
10
+ }
11
+ return acc;
12
+ }, []);
13
+ };
14
+
15
+ export { chunkArray as default };
@@ -1 +1,42 @@
1
- var r=new(0,require("html-to-react").Parser),e=require("markdown-it")({html:!0,xhtmlOut:!0,breaks:!0,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:function(){return""}}),t=function(t){return void 0===t?"":r.parse(e.render(t))};export{t as default};
1
+ var HtmlToReactParser = require('html-to-react').Parser;
2
+ var htmlToReactParser = new HtmlToReactParser();
3
+
4
+ // full options list (defaults)
5
+ var md = require('markdown-it')({
6
+ html: true,
7
+ // Enable HTML tags in source
8
+ xhtmlOut: true,
9
+ // Use '/' to close single tags (<br />).
10
+ // This is only for full CommonMark compatibility.
11
+ breaks: true,
12
+ // Convert '\n' in paragraphs into <br>
13
+ langPrefix: 'language-',
14
+ // CSS language prefix for fenced blocks. Can be
15
+ // useful for external highlighters.
16
+ linkify: false,
17
+ // Autoconvert URL-like text to links
18
+
19
+ // Enable some language-neutral replacement + quotes beautification
20
+ // For the full list of replacements, see https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js
21
+ typographer: false,
22
+ // Double + single quotes replacement pairs, when typographer enabled,
23
+ // and smartquotes on. Could be either a String or an Array.
24
+ //
25
+ // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
26
+ // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
27
+ quotes: '“”‘’',
28
+ // Highlighter function. Should return escaped HTML,
29
+ // or '' if the source string is not changed and should be escaped externally.
30
+ // If result starts with <pre... internal wrapper is skipped.
31
+ highlight: function highlight() {
32
+ return '';
33
+ } /* str, lang */
34
+ });
35
+
36
+ // eslint-disable-next-line import/prefer-default-export
37
+ var convert2HtmlEntities = function convert2HtmlEntities(text) {
38
+ if (text === undefined) return '';
39
+ return htmlToReactParser.parse(md.render(text));
40
+ };
41
+
42
+ export { convert2HtmlEntities as default };
@@ -1 +1,32 @@
1
- import{d as t}from"./vendor-3ec75cc9.js";var e=function(e){var n=e.id,o=e.fileName,a=void 0===o?"image":o,r=e.quality,c=void 0===r?.95:r,i=document.getElementById(n),l=document.getElementById("yaxis"),s=document.getElementById("barChart__block");l&&l.setAttribute("transform","translate(0, 0 )"),t.toPng(i,{quality:c}).then((function(t){var e=document.createElement("a");e.download="".concat(a,".png"),e.href=t,e.click(),l&&s&&(l.setAttribute("transform","translate(0, 0 )"),l.setAttribute("transform","translate(".concat(s.scrollLeft,", 0)")))})).catch((function(t){console.error("oops, something went wrong!",t)}))};export{e as default};
1
+ import { d as domtoimage } from './vendor-3ec75cc9.js';
2
+
3
+ var domToImage = function domToImage(_ref) {
4
+ var id = _ref.id,
5
+ _ref$fileName = _ref.fileName,
6
+ fileName = _ref$fileName === void 0 ? 'image' : _ref$fileName,
7
+ _ref$quality = _ref.quality,
8
+ quality = _ref$quality === void 0 ? 0.95 : _ref$quality;
9
+ var node = document.getElementById(id);
10
+ // 防止barchart的Y軸擋住圖,就先將他移到最左邊,拍完照再移回來
11
+ var yaxis = document.getElementById('yaxis');
12
+ var barChartElement = document.getElementById('barChart__block');
13
+ if (yaxis) {
14
+ yaxis.setAttribute('transform', 'translate(0, 0 )');
15
+ }
16
+ domtoimage.toPng(node, {
17
+ quality: quality
18
+ }).then(function (dataUrl) {
19
+ var link = document.createElement('a');
20
+ link.download = "".concat(fileName, ".png");
21
+ link.href = dataUrl;
22
+ link.click();
23
+ if (yaxis && barChartElement) {
24
+ yaxis.setAttribute('transform', 'translate(0, 0 )');
25
+ yaxis.setAttribute('transform', "translate(".concat(barChartElement.scrollLeft, ", 0)"));
26
+ }
27
+ }).catch(function (error) {
28
+ console.error('oops, something went wrong!', error);
29
+ });
30
+ };
31
+
32
+ export { domToImage as default };
@@ -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,184 @@
1
- import{f as t}from"./vendor-3ec75cc9.js";import{a as e}from"./_rollupPluginBabelHelpers-a6e0e6e3.js";var r=function(e){var r,n=e.data,a=e.dataType,o=e.extType,c=void 0===o?"xlsx":o;if("sna"===a)r=function(t){var e=t||{},r=e.links,n=e.nodes;return r&&r.length>0?r.map((function(t){return{From:n[t.source].name,To:n[t.target].name}})):[]}(n);else r=n;t("\ufeff".concat(function(t){var e="";if(Array.isArray(t)&&t.length>0){var r=Object.keys(t[0]);e+="".concat(r.toString(),"\n"),t.forEach((function(t){r.forEach((function(r){e+="".concat(t[r],",")})),e+="\n"}))}else{var n=Object.keys(t);e+="".concat(n.toString(),"\n"),n.forEach((function(r){e+="".concat(t[r],",")})),e+="\n"}return e}(r)),"output.".concat(c))};r.chronologyConvert=function(t){var r=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=t.split('<span class="tooltip">'),n=e(r,2),a=n[0],o=n[1];return{before:a,after:o}};return(t||[]).map((function(t){var e=t.start_date,n=e.day,a=e.month,o=e.year,c=t.display_date,i=t.text,l=i.headline,u=i.text;return{"日期":"".concat(o||"","/").concat(a||"","/").concat(n||""),"名稱":(c||"").replace("<span>","").replace("</span>",""),"描述":(l||"").replaceAll(/(<([^>]+)>)/gi,""),"類型":r(u).before,"註(資料集名稱)":r(u).after.replaceAll("\n","").replaceAll("\t","").replace("註","").replace("資料來源:","").replaceAll(/(<([^>]+)>)/gi,"")}}))},r.mapConvert=function(t){return(t||[]).map((function(t){return{"名稱(書名/文章名)":t.title||"","作者":t.author||"","出版者":t.publisher||"","地點(作品描述區域)":t.locations||"","經度":t.posX||"","緯度":t.posY||""}}))},r.mapLgConvert=function(t){return(t||[]).map((function(t){var e=t.title,r=t.locationOfFormation,n=t.workLocations;return{"組織名稱":e||"","創立地點":r,"創立地點經度":t.createPosX||"","創立地點緯度":t.createPosY||"","活動地點":n||"","活動地點經度":t.activePosX||"","活動地點緯度":t.activePosY||""}}))},r.worksBarChart=function(t){return(t||[]).map((function(t){var e=t.date,r=t.year,n=t.title,a=t.keywords,o=t.authors,c=t.genreName;return{"出版年/發表年":e||r||"","名稱(書名/文章名)":n||"","作者":(o||[]).map((function(t){return t.author})).join(","),"關鍵字":(a||"").replaceAll("\n",""),"文學分類":c||""}}))},r.worksSlider=function(t){return(t||[]).map((function(t){return{"名稱(書名/文章名)":t.title||"","作者":t.author||"","出版日期/發表日期":t.date||""}}))};export{r as default};
1
+ import { f as fileDownload } from './vendor-3ec75cc9.js';
2
+ import { a as _slicedToArray } from './_rollupPluginBabelHelpers-a6e0e6e3.js';
3
+
4
+ var jsonExcel = function jsonExcel(json) {
5
+ var output = '';
6
+ if (Array.isArray(json) && json.length > 0) {
7
+ var keys = Object.keys(json[0]);
8
+ output += "".concat(keys.toString(), "\n");
9
+ json.forEach(function (item) {
10
+ keys.forEach(function (key) {
11
+ output += "".concat(item[key], ",");
12
+ });
13
+ output += '\n';
14
+ });
15
+ } else {
16
+ var _keys = Object.keys(json);
17
+ output += "".concat(_keys.toString(), "\n");
18
+ _keys.forEach(function (key) {
19
+ output += "".concat(json[key], ",");
20
+ });
21
+ output += '\n';
22
+ }
23
+ return output;
24
+ };
25
+ var snaToExcel = function snaToExcel(data) {
26
+ var _ref = data || {},
27
+ links = _ref.links,
28
+ nodes = _ref.nodes;
29
+ if (links && links.length > 0) {
30
+ var result = links.map(function (link) {
31
+ return {
32
+ From: nodes[link.source].name,
33
+ To: nodes[link.target].name
34
+ };
35
+ });
36
+ return result;
37
+ }
38
+ return [];
39
+ };
40
+
41
+ /* 轉檔工具, 提供API轉下載tsv/xlsx */
42
+
43
+ /* 大事年表 */
44
+ var chronologyConvert = function chronologyConvert(data) {
45
+ var getText = function getText() {
46
+ var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
47
+ var _text$split = text.split('<span class="tooltip">'),
48
+ _text$split2 = _slicedToArray(_text$split, 2),
49
+ before = _text$split2[0],
50
+ after = _text$split2[1];
51
+ return {
52
+ before: before,
53
+ after: after
54
+ };
55
+ };
56
+
57
+ /* 做資料過濾 */
58
+ var newData = (data || []).map(function (_ref) {
59
+ var _ref$start_date = _ref.start_date,
60
+ day = _ref$start_date.day,
61
+ month = _ref$start_date.month,
62
+ year = _ref$start_date.year,
63
+ displayDate = _ref.display_date,
64
+ _ref$text = _ref.text,
65
+ headline = _ref$text.headline,
66
+ text = _ref$text.text;
67
+ return {
68
+ 日期: "".concat(year || '', "/").concat(month || '', "/").concat(day || ''),
69
+ 名稱: (displayDate || '').replace('<span>', '').replace('</span>', ''),
70
+ 描述: (headline || '').replaceAll(/(<([^>]+)>)/gi, ''),
71
+ 類型: getText(text).before,
72
+ '註(資料集名稱)': getText(text).after.replaceAll('\n', '').replaceAll('\t', '').replace('註', '').replace('資料來源:', '').replaceAll(/(<([^>]+)>)/gi, '')
73
+ };
74
+ });
75
+ return newData;
76
+ };
77
+
78
+ /* 文學數據 - 地圖 */
79
+ var mapConvert = function mapConvert(data) {
80
+ return (data || []).map(function (_ref2) {
81
+ var title = _ref2.title,
82
+ author = _ref2.author,
83
+ publisher = _ref2.publisher,
84
+ locations = _ref2.locations,
85
+ posX = _ref2.posX,
86
+ posY = _ref2.posY;
87
+ return {
88
+ '名稱(書名/文章名)': title || '',
89
+ 作者: author || '',
90
+ 出版者: publisher || '',
91
+ '地點(作品描述區域)': locations || '',
92
+ 經度: posX || '',
93
+ 緯度: posY || ''
94
+ };
95
+ });
96
+ };
97
+
98
+ /* 文學數據 - 地圖(文學聚落) */
99
+ var mapLgConvert = function mapLgConvert(data) {
100
+ return (data || []).map(function (_ref3) {
101
+ var title = _ref3.title,
102
+ locationOfFormation = _ref3.locationOfFormation,
103
+ workLocations = _ref3.workLocations,
104
+ createPosX = _ref3.createPosX,
105
+ createPosY = _ref3.createPosY,
106
+ activePosX = _ref3.activePosX,
107
+ activePosY = _ref3.activePosY;
108
+ return {
109
+ 組織名稱: title || '',
110
+ 創立地點: locationOfFormation,
111
+ 創立地點經度: createPosX || '',
112
+ 創立地點緯度: createPosY || '',
113
+ 活動地點: workLocations || '',
114
+ 活動地點經度: activePosX || '',
115
+ 活動地點緯度: activePosY || ''
116
+ };
117
+ });
118
+ };
119
+
120
+ /* 文學數據 - 年度聲量 */
121
+ var worksBarChart = function worksBarChart(data) {
122
+ return (data || []).map(function (_ref4) {
123
+ var date = _ref4.date,
124
+ year = _ref4.year,
125
+ title = _ref4.title,
126
+ keywords = _ref4.keywords,
127
+ authors = _ref4.authors,
128
+ genreName = _ref4.genreName;
129
+ return {
130
+ '出版年/發表年': date || year || '',
131
+ '名稱(書名/文章名)': title || '',
132
+ 作者: (authors || []).map(function (_ref5) {
133
+ var author = _ref5.author;
134
+ return author;
135
+ }).join(','),
136
+ 關鍵字: (keywords || '').replaceAll('\n', ''),
137
+ 文學分類: genreName || ''
138
+ };
139
+ });
140
+ };
141
+
142
+ /* 文學數據 - 文學自由搭配 */
143
+ var worksSlider = function worksSlider(data) {
144
+ return (data || []).map(function (_ref6) {
145
+ var title = _ref6.title,
146
+ author = _ref6.author,
147
+ date = _ref6.date;
148
+ return {
149
+ '名稱(書名/文章名)': title || '',
150
+ 作者: author || '',
151
+ '出版日期/發表日期': date || ''
152
+ // 文學分類: genreName || '',
153
+ // 作品描述地: workDesc || '',
154
+ // 作家出生地: locations,
155
+ // 獲獎獎項: awards || '',
156
+ };
157
+ });
158
+ };
159
+
160
+ var exportXlsx = function exportXlsx(_ref) {
161
+ var data = _ref.data,
162
+ dataType = _ref.dataType,
163
+ _ref$extType = _ref.extType,
164
+ extType = _ref$extType === void 0 ? 'xlsx' : _ref$extType;
165
+ var metadata;
166
+ switch (dataType) {
167
+ case 'sna':
168
+ metadata = snaToExcel(data);
169
+ break;
170
+ default:
171
+ metadata = data;
172
+ break;
173
+ }
174
+ fileDownload("\uFEFF".concat(jsonExcel(metadata)), "output.".concat(extType));
175
+ };
176
+
177
+ // 供外部使用dataConvert
178
+ exportXlsx.chronologyConvert = chronologyConvert;
179
+ exportXlsx.mapConvert = mapConvert;
180
+ exportXlsx.mapLgConvert = mapLgConvert;
181
+ exportXlsx.worksBarChart = worksBarChart;
182
+ exportXlsx.worksSlider = worksSlider;
183
+
184
+ export { exportXlsx as default };