@daoyi/nmtl-ui 2.0.1-beta.45 → 2.0.1-beta.46
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-aa4a8d6c.js +335 -0
- package/lib/components/Autocomplete.js +13 -1
- package/lib/components/Avatar.js +49 -1
- package/lib/components/BackTop.js +109 -1
- package/lib/components/BarChart.js +762 -1
- package/lib/components/Breadcrumbs.js +122 -1
- package/lib/components/Button-2f8f0493.js +92 -0
- package/lib/components/Button.js +6 -1
- package/lib/components/Carousel.js +4713 -1
- package/lib/components/Checkbox.js +37 -1
- package/lib/components/CollapseContent.js +179 -1
- package/lib/components/ContactModal-c8240b19.js +10759 -0
- package/lib/components/ContactModal.js +22 -1
- package/lib/components/Drawer-dd8942f1.js +157 -0
- package/lib/components/Drawer.js +11 -1
- package/lib/components/Dropdown.js +134 -1
- package/lib/components/Empty-3637b766.js +45 -0
- package/lib/components/Empty.js +5 -1
- package/lib/components/ExportButton.js +112 -1
- package/lib/components/ExtraTools-55dad795.js +3479 -0
- package/lib/components/ExtraTools.js +10 -1
- package/lib/components/Filter.js +776 -1
- package/lib/components/Footer.js +271 -1
- package/lib/components/ForwardLink.js +105 -1
- package/lib/components/Header.js +187 -1
- package/lib/components/Image.js +61 -1
- package/lib/components/Input.js +77 -1
- package/lib/components/InputMethod.js +33963 -1
- package/lib/components/KeywordSearch-2d01266e.js +139 -0
- package/lib/components/KeywordSearch.js +15 -1
- package/lib/components/KeywordTicker.js +180 -1
- package/lib/components/Keywords.js +317 -1
- package/lib/components/Loading.js +28 -1
- package/lib/components/MUITheme.js +2627 -1
- package/lib/components/Modal-572e17ea.js +108 -0
- package/lib/components/Modal.js +9 -1
- package/lib/components/MoreButton-80996b5f.js +110 -0
- package/lib/components/MoreButton.js +6 -1
- package/lib/components/Radio.js +78 -1
- package/lib/components/SNA.js +1735 -1
- package/lib/components/Select-5533b506.js +115 -0
- package/lib/components/Select.js +8 -1
- package/lib/components/Spin-ebf79c17.js +75 -0
- package/lib/components/Spin.js +6 -1
- package/lib/components/Table.js +51 -1
- package/lib/components/Tooltip-907eaa2e.js +70 -0
- package/lib/components/Tooltip.js +7 -1
- package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
- package/lib/components/_rollupPluginBabelHelpers-fde6d1c6.js +491 -1
- package/lib/components/createSvgIcon-48da8b6e.js +576 -0
- package/lib/components/dataExport-d55d6fa3.js +92 -0
- package/lib/components/debounce-127da66c.js +355 -0
- package/lib/components/defaultTheme-19a14721.js +1485 -0
- package/lib/components/globalConfig-40069b54.js +158 -1
- package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
- package/lib/components/index-7b60a97d.js +481 -0
- package/lib/components/index-f491ebce.js +61 -0
- package/lib/components/isObjectLike-e111475d.js +190 -0
- package/lib/components/style-inject.es-1f59c1d0.js +28 -0
- package/lib/components/transform-3a04288b.js +5475 -0
- package/lib/globalConfig.js +186 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/_rollupPluginBabelHelpers-a6e0e6e3.js +139 -1
- package/lib/utils/arrayMerge.js +100 -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 +219 -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 -1
- package/lib/utils/snaDefine.js +1 -1
- package/lib/utils/snaPreProcess.js +84 -1
- package/package.json +1 -1
- package/lib/components/Autocomplete-5439ff22.js +0 -1
- package/lib/components/Button-63c7e9f3.js +0 -1
- package/lib/components/ContactModal-d7e2f8bb.js +0 -1
- package/lib/components/Drawer-af3ed21a.js +0 -1
- package/lib/components/Empty-70f040a9.js +0 -1
- package/lib/components/ExtraTools-f10a66a8.js +0 -1
- package/lib/components/KeywordSearch-224f84c1.js +0 -1
- package/lib/components/Modal-a7591b98.js +0 -1
- package/lib/components/MoreButton-f15ca38e.js +0 -1
- package/lib/components/Select-98a8e973.js +0 -1
- package/lib/components/Spin-690a3597.js +0 -1
- package/lib/components/Tooltip-b7eb966d.js +0 -1
- package/lib/components/dataExport-f418e6fe.js +0 -1
- package/lib/components/globalConfig.js +0 -1
- package/lib/components/vendor-851c6356.js +0 -63
- package/lib/utils/vendor-3ec75cc9.js +0 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) {
|
|
2
|
+
key = _toPropertyKey(key);
|
|
3
|
+
if (key in obj) {
|
|
4
|
+
Object.defineProperty(obj, key, {
|
|
5
|
+
value: value,
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
obj[key] = value;
|
|
12
|
+
}
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
function _toPrimitive(input, hint) {
|
|
16
|
+
if (typeof input !== "object" || input === null) return input;
|
|
17
|
+
var prim = input[Symbol.toPrimitive];
|
|
18
|
+
if (prim !== undefined) {
|
|
19
|
+
var res = prim.call(input, hint || "default");
|
|
20
|
+
if (typeof res !== "object") return res;
|
|
21
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
22
|
+
}
|
|
23
|
+
return (hint === "string" ? String : Number)(input);
|
|
24
|
+
}
|
|
25
|
+
function _toPropertyKey(arg) {
|
|
26
|
+
var key = _toPrimitive(arg, "string");
|
|
27
|
+
return typeof key === "symbol" ? key : String(key);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var zhtw = {
|
|
31
|
+
"common.action.failed": "操作失敗",
|
|
32
|
+
"common.action.error": "操作錯誤",
|
|
33
|
+
"common.action.success": "操作成功",
|
|
34
|
+
"common.confirm": "確認",
|
|
35
|
+
"common.enter": "請輸入",
|
|
36
|
+
"common.submit": "送出",
|
|
37
|
+
"common.cancel": "取消",
|
|
38
|
+
"common.export": "匯出",
|
|
39
|
+
"common.export.type": "匯出类型",
|
|
40
|
+
"common.has.problem": "我要糾錯",
|
|
41
|
+
"common.has.problem.hint": "若您有發現平台內任何地方的錯誤,請不吝來信告知我們,我們將儘快修正,謝謝。",
|
|
42
|
+
"common.sex": "性別",
|
|
43
|
+
"common.other": "其他",
|
|
44
|
+
"common.content": "內容",
|
|
45
|
+
"common.click.refresh": "點擊刷新",
|
|
46
|
+
"common.provide.information": "我要補充資料",
|
|
47
|
+
"common.form.name": "姓名",
|
|
48
|
+
"common.form.phone": "電話",
|
|
49
|
+
"common.form.age": "年齡",
|
|
50
|
+
"common.form.job": "職業",
|
|
51
|
+
"common.form.author": "作者",
|
|
52
|
+
"common.form.dataname": "資料名稱",
|
|
53
|
+
"common.form.datadate": "資料日期",
|
|
54
|
+
"common.form.providername": "提供者名稱",
|
|
55
|
+
"common.form.subject": "主旨",
|
|
56
|
+
"common.form.selectQuetionType": "請選擇一個問題類型",
|
|
57
|
+
"common.form.dataProvide": "我要補充資料",
|
|
58
|
+
"common.form.dataProvide.hint": "我們需要更多資料來完善平台,歡迎提供。",
|
|
59
|
+
"common.form.valid.error.email": "您輸入無效的 e-mail!",
|
|
60
|
+
"common.form.male": "男",
|
|
61
|
+
"common.form.female": "女",
|
|
62
|
+
"common.form.dataname.placeholder": "可填書名、期刊名等",
|
|
63
|
+
"common.form.provider.notice": "(此名稱將會顯示於此網站上)",
|
|
64
|
+
"common.form.code": "驗證碼",
|
|
65
|
+
"common.form.code.error": "驗證碼錯誤",
|
|
66
|
+
"common.form.attachment": "附件上傳",
|
|
67
|
+
"common.form.attachment.valid.error": "附件上傳上限為2MB",
|
|
68
|
+
"common.form.attachment.hint": "上傳附件大小限制:2MB",
|
|
69
|
+
"common.form.contactUs": "聯繫我們",
|
|
70
|
+
"common.form.error": "表單尚未完成 請檢察必填項目"
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var zhcn = {
|
|
74
|
+
"common.action.failed": "操作失败",
|
|
75
|
+
"common.action.error": "操作错误",
|
|
76
|
+
"common.action.success": "操作成功",
|
|
77
|
+
"common.confirm": "确认",
|
|
78
|
+
"common.enter": "请输入",
|
|
79
|
+
"common.submit": "送出",
|
|
80
|
+
"common.cancel": "取消",
|
|
81
|
+
"common.export": "汇出",
|
|
82
|
+
"common.export.type": "汇出类型",
|
|
83
|
+
"common.has.problem": "我要纠错",
|
|
84
|
+
"common.has.problem.hint": "若您有发现平台内任何地方的错误,请不吝来信告知我们,我们将尽快修正,谢谢。",
|
|
85
|
+
"common.sex": "性别",
|
|
86
|
+
"common.other": "其他",
|
|
87
|
+
"common.content": "内容",
|
|
88
|
+
"common.click.refresh": "点击刷新",
|
|
89
|
+
"common.provide.information": "我要补充资料",
|
|
90
|
+
"common.form.name": "姓名",
|
|
91
|
+
"common.form.phone": "电话",
|
|
92
|
+
"common.form.age": "年龄",
|
|
93
|
+
"common.form.job": "职业",
|
|
94
|
+
"common.form.author": "作者",
|
|
95
|
+
"common.form.dataname": "资料名称",
|
|
96
|
+
"common.form.datadate": "资料日期",
|
|
97
|
+
"common.form.providername": "提供者名称",
|
|
98
|
+
"common.form.subject": "主旨",
|
|
99
|
+
"common.form.selectQuetionType": "请选择一个问题类型",
|
|
100
|
+
"common.form.dataProvide": "我要补充资料",
|
|
101
|
+
"common.form.dataProvide.hint": "我们需要更多资料来完善平台,欢迎提供。",
|
|
102
|
+
"common.form.valid.error.email": "您输入无效的 e-mail!",
|
|
103
|
+
"common.form.male": "男",
|
|
104
|
+
"common.form.female": "女",
|
|
105
|
+
"common.form.dataname.placeholder": "可填书名、期刊名等",
|
|
106
|
+
"common.form.provider.notice": "(此名称将会显示于此网站上)",
|
|
107
|
+
"common.form.code": "验证码",
|
|
108
|
+
"common.form.code.error": "验证码错误",
|
|
109
|
+
"common.form.attachment": "附件上传",
|
|
110
|
+
"common.form.attachment.valid.error": "附件上传上限为2MB",
|
|
111
|
+
"common.form.attachment.hint": "上传附件大小限制:2MB",
|
|
112
|
+
"common.form.contactUs": "联系我们",
|
|
113
|
+
"common.form.error": "表单尚未完成 请检察必填项目"
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var enus = {
|
|
117
|
+
"common.action.failed": "Action failed",
|
|
118
|
+
"common.action.error": "Operation error",
|
|
119
|
+
"common.action.success": "Action succeeded",
|
|
120
|
+
"common.confirm": "Confirm",
|
|
121
|
+
"common.enter": "Please enter",
|
|
122
|
+
"common.submit": "Send",
|
|
123
|
+
"common.cancel": "Cancel",
|
|
124
|
+
"common.export": "Export",
|
|
125
|
+
"common.export.type": "Export Type",
|
|
126
|
+
"common.has.problem": "I want to correct an error",
|
|
127
|
+
"common.has.problem.hint": "If you find any errors in the platform, please feel free to write to us and we will fix them as soon as possible, thank you.",
|
|
128
|
+
"common.sex": "Sex",
|
|
129
|
+
"common.other": "Other",
|
|
130
|
+
"common.content": "Content",
|
|
131
|
+
"common.click.refresh": "Click to refresh",
|
|
132
|
+
"common.provide.information": "I want to add information",
|
|
133
|
+
"common.form.name": "Name",
|
|
134
|
+
"common.form.phone": "Phone",
|
|
135
|
+
"common.form.age": "Age",
|
|
136
|
+
"common.form.job": "Job",
|
|
137
|
+
"common.form.author": "Author",
|
|
138
|
+
"common.form.dataname": "Data Name",
|
|
139
|
+
"common.form.datadate": "Data Date",
|
|
140
|
+
"common.form.providername": "Provider Name",
|
|
141
|
+
"common.form.subject": "Subject",
|
|
142
|
+
"common.form.selectQuetionType": "Please select a question type",
|
|
143
|
+
"common.form.dataProvide": "I want to add information",
|
|
144
|
+
"common.form.dataProvide.hint": "We need more data to improve the platform, welcome to provide.",
|
|
145
|
+
"common.form.valid.error.email": "You entered an invalid e-mail!",
|
|
146
|
+
"common.form.male": "Male",
|
|
147
|
+
"common.form.female": "Female",
|
|
148
|
+
"common.form.dataname.placeholder": "You can fill in the title of the book, the name of the journal, etc.",
|
|
149
|
+
"common.form.provider.notice": "(This name will be displayed on this website)",
|
|
150
|
+
"common.form.code": "Verification Code",
|
|
151
|
+
"common.form.code.error": "Verification code error",
|
|
152
|
+
"common.form.attachment": "Attachment Upload",
|
|
153
|
+
"common.form.attachment.valid.error": "Attachment upload limit is 2MB",
|
|
154
|
+
"common.form.attachment.hint": "Upload attachment size limit: 2MB",
|
|
155
|
+
"common.form.contactUs": "Contact Us",
|
|
156
|
+
"common.form.error": "The form has not been completed, please check the required items"
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var _languages;
|
|
160
|
+
var ZH_TW = 'zh-tw';
|
|
161
|
+
var ZH_CN = 'zh-cn';
|
|
162
|
+
var EN_US = 'en-us';
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 全域i18n
|
|
166
|
+
* 讓元件擁有自己的i18n
|
|
167
|
+
*/
|
|
168
|
+
var lang;
|
|
169
|
+
var languages = (_languages = {}, _defineProperty(_languages, ZH_TW, zhtw), _defineProperty(_languages, ZH_CN, zhcn), _defineProperty(_languages, EN_US, enus), _languages);
|
|
170
|
+
var getIntl = function getIntl() {
|
|
171
|
+
return {
|
|
172
|
+
setLocale: function setLocale(value) {
|
|
173
|
+
lang = value;
|
|
174
|
+
},
|
|
175
|
+
getLocale: function getLocale() {
|
|
176
|
+
return lang;
|
|
177
|
+
},
|
|
178
|
+
formatMessage: function formatMessage(_ref) {
|
|
179
|
+
var id = _ref.id;
|
|
180
|
+
return (languages[lang] || zhtw)[id] || id;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
var other = function other() {};
|
|
185
|
+
|
|
186
|
+
export { getIntl, other };
|
package/lib/index.d.ts
CHANGED
|
@@ -35,4 +35,4 @@ export { default as KeywordTicker } from './components/KeywordTicker';
|
|
|
35
35
|
export { default as ExtraTools } from './components/ExtraTools';
|
|
36
36
|
export { default as Filter } from './components/Filter';
|
|
37
37
|
|
|
38
|
-
export { getIntl } from './
|
|
38
|
+
export { getIntl } from './globalConfig';
|
package/lib/index.js
CHANGED
|
@@ -35,4 +35,4 @@ export { default as KeywordTicker } from './components/KeywordTicker';
|
|
|
35
35
|
export { default as ExtraTools } from './components/ExtraTools';
|
|
36
36
|
export { default as Filter } from './components/Filter';
|
|
37
37
|
|
|
38
|
-
export { getIntl } from './
|
|
38
|
+
export { getIntl } from './globalConfig';
|
|
@@ -1 +1,139 @@
|
|
|
1
|
-
function
|
|
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 };
|
package/lib/utils/arrayMerge.js
CHANGED
|
@@ -1 +1,100 @@
|
|
|
1
|
-
var
|
|
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 };
|
package/lib/utils/chunkArray.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
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
|
|
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 };
|