@daoyi/nmtl-ui 2.0.1-beta.44 → 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.
Files changed (93) hide show
  1. package/lib/components/Autocomplete-aa4a8d6c.js +335 -0
  2. package/lib/components/Autocomplete.js +13 -1
  3. package/lib/components/Avatar.js +49 -1
  4. package/lib/components/BackTop.js +109 -1
  5. package/lib/components/BarChart.js +762 -1
  6. package/lib/components/Breadcrumbs.js +122 -1
  7. package/lib/components/Button-2f8f0493.js +92 -0
  8. package/lib/components/Button.js +6 -1
  9. package/lib/components/Carousel.js +4713 -1
  10. package/lib/components/Checkbox.js +37 -1
  11. package/lib/components/CollapseContent.js +179 -1
  12. package/lib/components/ContactModal-c8240b19.js +10759 -0
  13. package/lib/components/ContactModal.js +22 -1
  14. package/lib/components/Drawer-dd8942f1.js +157 -0
  15. package/lib/components/Drawer.js +11 -1
  16. package/lib/components/Dropdown.js +134 -1
  17. package/lib/components/Empty-3637b766.js +45 -0
  18. package/lib/components/Empty.js +5 -1
  19. package/lib/components/ExportButton.js +112 -1
  20. package/lib/components/ExtraTools-55dad795.js +3479 -0
  21. package/lib/components/ExtraTools.js +10 -1
  22. package/lib/components/Filter.js +776 -1
  23. package/lib/components/Footer.js +271 -1
  24. package/lib/components/ForwardLink.js +105 -1
  25. package/lib/components/Header.js +187 -1
  26. package/lib/components/Image.js +61 -1
  27. package/lib/components/Input.js +77 -1
  28. package/lib/components/InputMethod.js +33963 -1
  29. package/lib/components/KeywordSearch-2d01266e.js +139 -0
  30. package/lib/components/KeywordSearch.js +15 -1
  31. package/lib/components/KeywordTicker.js +180 -1
  32. package/lib/components/Keywords.js +317 -1
  33. package/lib/components/Loading.js +28 -1
  34. package/lib/components/MUITheme.js +2627 -1
  35. package/lib/components/Modal-572e17ea.js +108 -0
  36. package/lib/components/Modal.js +9 -1
  37. package/lib/components/MoreButton-80996b5f.js +110 -0
  38. package/lib/components/MoreButton.js +6 -1
  39. package/lib/components/Radio.js +78 -1
  40. package/lib/components/SNA.js +1735 -1
  41. package/lib/components/Select-5533b506.js +115 -0
  42. package/lib/components/Select.js +8 -1
  43. package/lib/components/Spin-ebf79c17.js +75 -0
  44. package/lib/components/Spin.js +6 -1
  45. package/lib/components/Table.js +51 -1
  46. package/lib/components/Tooltip-907eaa2e.js +70 -0
  47. package/lib/components/Tooltip.js +7 -1
  48. package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
  49. package/lib/components/_rollupPluginBabelHelpers-fde6d1c6.js +491 -1
  50. package/lib/components/createSvgIcon-48da8b6e.js +576 -0
  51. package/lib/components/dataExport-d55d6fa3.js +92 -0
  52. package/lib/components/debounce-127da66c.js +355 -0
  53. package/lib/components/defaultTheme-19a14721.js +1485 -0
  54. package/lib/components/globalConfig-40069b54.js +158 -0
  55. package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
  56. package/lib/components/index-7b60a97d.js +481 -0
  57. package/lib/components/index-f491ebce.js +61 -0
  58. package/lib/components/isObjectLike-e111475d.js +190 -0
  59. package/lib/components/style-inject.es-1f59c1d0.js +28 -0
  60. package/lib/components/transform-3a04288b.js +5475 -0
  61. package/lib/globalConfig.js +186 -1
  62. package/lib/utils/_rollupPluginBabelHelpers-a6e0e6e3.js +139 -1
  63. package/lib/utils/arrayMerge.js +100 -1
  64. package/lib/utils/chunkArray.js +15 -1
  65. package/lib/utils/convert2HtmlEntities.js +42 -1
  66. package/lib/utils/domToImage.js +802 -1
  67. package/lib/utils/downloadGephi.js +106 -1
  68. package/lib/utils/exportXlsx.js +219 -1
  69. package/lib/utils/historyAppendSearch.js +502 -1
  70. package/lib/utils/isDevelopMode.js +5 -1
  71. package/lib/utils/parseYMD.js +36 -1
  72. package/lib/utils/removeDuplicateItem.js +11 -1
  73. package/lib/utils/sendEmail.js +39 -1
  74. package/lib/utils/snaDefine-6a2bcd94.js +5 -1
  75. package/lib/utils/snaDefine.js +1 -1
  76. package/lib/utils/snaPreProcess.js +84 -1
  77. package/package.json +1 -1
  78. package/lib/components/Autocomplete-5439ff22.js +0 -1
  79. package/lib/components/Button-63c7e9f3.js +0 -1
  80. package/lib/components/ContactModal-d852ae32.js +0 -1
  81. package/lib/components/Drawer-af3ed21a.js +0 -1
  82. package/lib/components/Empty-70f040a9.js +0 -1
  83. package/lib/components/ExtraTools-f10a66a8.js +0 -1
  84. package/lib/components/KeywordSearch-224f84c1.js +0 -1
  85. package/lib/components/Modal-a7591b98.js +0 -1
  86. package/lib/components/MoreButton-f15ca38e.js +0 -1
  87. package/lib/components/Select-98a8e973.js +0 -1
  88. package/lib/components/Spin-690a3597.js +0 -1
  89. package/lib/components/Tooltip-b7eb966d.js +0 -1
  90. package/lib/components/dataExport-f418e6fe.js +0 -1
  91. package/lib/components/globalConfig-63dfbe94.js +0 -1
  92. package/lib/components/vendor-851c6356.js +0 -63
  93. package/lib/utils/vendor-3ec75cc9.js +0 -1
@@ -1 +1,502 @@
1
- import{b as r,c as e}from"./_rollupPluginBabelHelpers-a6e0e6e3.js";import o from"prop-types";import{q as s}from"./vendor-3ec75cc9.js";var a=["history"],i=function(o){var i=o.history,p=r(o,a);if(i){var t=i.location.search;i.replace({search:s.stringify(e(e({},s.parse(t)),p))})}else console.error("error","historyAppendSearch needs history")};i.propTypes={history:o.objectOf(o.any).isRequired};export{i as default};
1
+ import { b as _objectWithoutProperties, c as _objectSpread2 } from './_rollupPluginBabelHelpers-a6e0e6e3.js';
2
+ import PropTypes from 'prop-types';
3
+
4
+ var queryString = {};
5
+
6
+ var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
7
+
8
+ var token = '%[a-f0-9]{2}';
9
+ var singleMatcher = new RegExp(token, 'gi');
10
+ var multiMatcher = new RegExp('(' + token + ')+', 'gi');
11
+
12
+ function decodeComponents(components, split) {
13
+ try {
14
+ // Try to decode the entire string first
15
+ return decodeURIComponent(components.join(''));
16
+ } catch (err) {
17
+ // Do nothing
18
+ }
19
+
20
+ if (components.length === 1) {
21
+ return components;
22
+ }
23
+
24
+ split = split || 1;
25
+
26
+ // Split the array in 2 parts
27
+ var left = components.slice(0, split);
28
+ var right = components.slice(split);
29
+
30
+ return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
31
+ }
32
+
33
+ function decode(input) {
34
+ try {
35
+ return decodeURIComponent(input);
36
+ } catch (err) {
37
+ var tokens = input.match(singleMatcher);
38
+
39
+ for (var i = 1; i < tokens.length; i++) {
40
+ input = decodeComponents(tokens, i).join('');
41
+
42
+ tokens = input.match(singleMatcher);
43
+ }
44
+
45
+ return input;
46
+ }
47
+ }
48
+
49
+ function customDecodeURIComponent(input) {
50
+ // Keep track of all the replacements and prefill the map with the `BOM`
51
+ var replaceMap = {
52
+ '%FE%FF': '\uFFFD\uFFFD',
53
+ '%FF%FE': '\uFFFD\uFFFD'
54
+ };
55
+
56
+ var match = multiMatcher.exec(input);
57
+ while (match) {
58
+ try {
59
+ // Decode as big chunks as possible
60
+ replaceMap[match[0]] = decodeURIComponent(match[0]);
61
+ } catch (err) {
62
+ var result = decode(match[0]);
63
+
64
+ if (result !== match[0]) {
65
+ replaceMap[match[0]] = result;
66
+ }
67
+ }
68
+
69
+ match = multiMatcher.exec(input);
70
+ }
71
+
72
+ // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
73
+ replaceMap['%C2'] = '\uFFFD';
74
+
75
+ var entries = Object.keys(replaceMap);
76
+
77
+ for (var i = 0; i < entries.length; i++) {
78
+ // Replace all decoded components
79
+ var key = entries[i];
80
+ input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
81
+ }
82
+
83
+ return input;
84
+ }
85
+
86
+ var decodeUriComponent = function (encodedURI) {
87
+ if (typeof encodedURI !== 'string') {
88
+ throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
89
+ }
90
+
91
+ try {
92
+ encodedURI = encodedURI.replace(/\+/g, ' ');
93
+
94
+ // Try the built in decoder first
95
+ return decodeURIComponent(encodedURI);
96
+ } catch (err) {
97
+ // Fallback to a more advanced decoder
98
+ return customDecodeURIComponent(encodedURI);
99
+ }
100
+ };
101
+
102
+ var splitOnFirst = (string, separator) => {
103
+ if (!(typeof string === 'string' && typeof separator === 'string')) {
104
+ throw new TypeError('Expected the arguments to be of type `string`');
105
+ }
106
+
107
+ if (separator === '') {
108
+ return [string];
109
+ }
110
+
111
+ const separatorIndex = string.indexOf(separator);
112
+
113
+ if (separatorIndex === -1) {
114
+ return [string];
115
+ }
116
+
117
+ return [
118
+ string.slice(0, separatorIndex),
119
+ string.slice(separatorIndex + separator.length)
120
+ ];
121
+ };
122
+
123
+ (function (exports) {
124
+ const strictUriEncode$1 = strictUriEncode;
125
+ const decodeComponent = decodeUriComponent;
126
+ const splitOnFirst$1 = splitOnFirst;
127
+
128
+ const isNullOrUndefined = value => value === null || value === undefined;
129
+
130
+ function encoderForArrayFormat(options) {
131
+ switch (options.arrayFormat) {
132
+ case 'index':
133
+ return key => (result, value) => {
134
+ const index = result.length;
135
+
136
+ if (
137
+ value === undefined ||
138
+ (options.skipNull && value === null) ||
139
+ (options.skipEmptyString && value === '')
140
+ ) {
141
+ return result;
142
+ }
143
+
144
+ if (value === null) {
145
+ return [...result, [encode(key, options), '[', index, ']'].join('')];
146
+ }
147
+
148
+ return [
149
+ ...result,
150
+ [encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
151
+ ];
152
+ };
153
+
154
+ case 'bracket':
155
+ return key => (result, value) => {
156
+ if (
157
+ value === undefined ||
158
+ (options.skipNull && value === null) ||
159
+ (options.skipEmptyString && value === '')
160
+ ) {
161
+ return result;
162
+ }
163
+
164
+ if (value === null) {
165
+ return [...result, [encode(key, options), '[]'].join('')];
166
+ }
167
+
168
+ return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
169
+ };
170
+
171
+ case 'comma':
172
+ case 'separator':
173
+ return key => (result, value) => {
174
+ if (value === null || value === undefined || value.length === 0) {
175
+ return result;
176
+ }
177
+
178
+ if (result.length === 0) {
179
+ return [[encode(key, options), '=', encode(value, options)].join('')];
180
+ }
181
+
182
+ return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
183
+ };
184
+
185
+ default:
186
+ return key => (result, value) => {
187
+ if (
188
+ value === undefined ||
189
+ (options.skipNull && value === null) ||
190
+ (options.skipEmptyString && value === '')
191
+ ) {
192
+ return result;
193
+ }
194
+
195
+ if (value === null) {
196
+ return [...result, encode(key, options)];
197
+ }
198
+
199
+ return [...result, [encode(key, options), '=', encode(value, options)].join('')];
200
+ };
201
+ }
202
+ }
203
+
204
+ function parserForArrayFormat(options) {
205
+ let result;
206
+
207
+ switch (options.arrayFormat) {
208
+ case 'index':
209
+ return (key, value, accumulator) => {
210
+ result = /\[(\d*)\]$/.exec(key);
211
+
212
+ key = key.replace(/\[\d*\]$/, '');
213
+
214
+ if (!result) {
215
+ accumulator[key] = value;
216
+ return;
217
+ }
218
+
219
+ if (accumulator[key] === undefined) {
220
+ accumulator[key] = {};
221
+ }
222
+
223
+ accumulator[key][result[1]] = value;
224
+ };
225
+
226
+ case 'bracket':
227
+ return (key, value, accumulator) => {
228
+ result = /(\[\])$/.exec(key);
229
+ key = key.replace(/\[\]$/, '');
230
+
231
+ if (!result) {
232
+ accumulator[key] = value;
233
+ return;
234
+ }
235
+
236
+ if (accumulator[key] === undefined) {
237
+ accumulator[key] = [value];
238
+ return;
239
+ }
240
+
241
+ accumulator[key] = [].concat(accumulator[key], value);
242
+ };
243
+
244
+ case 'comma':
245
+ case 'separator':
246
+ return (key, value, accumulator) => {
247
+ const isArray = typeof value === 'string' && value.split('').indexOf(options.arrayFormatSeparator) > -1;
248
+ const newValue = isArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
249
+ accumulator[key] = newValue;
250
+ };
251
+
252
+ default:
253
+ return (key, value, accumulator) => {
254
+ if (accumulator[key] === undefined) {
255
+ accumulator[key] = value;
256
+ return;
257
+ }
258
+
259
+ accumulator[key] = [].concat(accumulator[key], value);
260
+ };
261
+ }
262
+ }
263
+
264
+ function validateArrayFormatSeparator(value) {
265
+ if (typeof value !== 'string' || value.length !== 1) {
266
+ throw new TypeError('arrayFormatSeparator must be single character string');
267
+ }
268
+ }
269
+
270
+ function encode(value, options) {
271
+ if (options.encode) {
272
+ return options.strict ? strictUriEncode$1(value) : encodeURIComponent(value);
273
+ }
274
+
275
+ return value;
276
+ }
277
+
278
+ function decode(value, options) {
279
+ if (options.decode) {
280
+ return decodeComponent(value);
281
+ }
282
+
283
+ return value;
284
+ }
285
+
286
+ function keysSorter(input) {
287
+ if (Array.isArray(input)) {
288
+ return input.sort();
289
+ }
290
+
291
+ if (typeof input === 'object') {
292
+ return keysSorter(Object.keys(input))
293
+ .sort((a, b) => Number(a) - Number(b))
294
+ .map(key => input[key]);
295
+ }
296
+
297
+ return input;
298
+ }
299
+
300
+ function removeHash(input) {
301
+ const hashStart = input.indexOf('#');
302
+ if (hashStart !== -1) {
303
+ input = input.slice(0, hashStart);
304
+ }
305
+
306
+ return input;
307
+ }
308
+
309
+ function getHash(url) {
310
+ let hash = '';
311
+ const hashStart = url.indexOf('#');
312
+ if (hashStart !== -1) {
313
+ hash = url.slice(hashStart);
314
+ }
315
+
316
+ return hash;
317
+ }
318
+
319
+ function extract(input) {
320
+ input = removeHash(input);
321
+ const queryStart = input.indexOf('?');
322
+ if (queryStart === -1) {
323
+ return '';
324
+ }
325
+
326
+ return input.slice(queryStart + 1);
327
+ }
328
+
329
+ function parseValue(value, options) {
330
+ if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
331
+ value = Number(value);
332
+ } else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
333
+ value = value.toLowerCase() === 'true';
334
+ }
335
+
336
+ return value;
337
+ }
338
+
339
+ function parse(input, options) {
340
+ options = Object.assign({
341
+ decode: true,
342
+ sort: true,
343
+ arrayFormat: 'none',
344
+ arrayFormatSeparator: ',',
345
+ parseNumbers: false,
346
+ parseBooleans: false
347
+ }, options);
348
+
349
+ validateArrayFormatSeparator(options.arrayFormatSeparator);
350
+
351
+ const formatter = parserForArrayFormat(options);
352
+
353
+ // Create an object with no prototype
354
+ const ret = Object.create(null);
355
+
356
+ if (typeof input !== 'string') {
357
+ return ret;
358
+ }
359
+
360
+ input = input.trim().replace(/^[?#&]/, '');
361
+
362
+ if (!input) {
363
+ return ret;
364
+ }
365
+
366
+ for (const param of input.split('&')) {
367
+ let [key, value] = splitOnFirst$1(options.decode ? param.replace(/\+/g, ' ') : param, '=');
368
+
369
+ // Missing `=` should be `null`:
370
+ // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
371
+ value = value === undefined ? null : ['comma', 'separator'].includes(options.arrayFormat) ? value : decode(value, options);
372
+ formatter(decode(key, options), value, ret);
373
+ }
374
+
375
+ for (const key of Object.keys(ret)) {
376
+ const value = ret[key];
377
+ if (typeof value === 'object' && value !== null) {
378
+ for (const k of Object.keys(value)) {
379
+ value[k] = parseValue(value[k], options);
380
+ }
381
+ } else {
382
+ ret[key] = parseValue(value, options);
383
+ }
384
+ }
385
+
386
+ if (options.sort === false) {
387
+ return ret;
388
+ }
389
+
390
+ return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
391
+ const value = ret[key];
392
+ if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
393
+ // Sort object keys, not values
394
+ result[key] = keysSorter(value);
395
+ } else {
396
+ result[key] = value;
397
+ }
398
+
399
+ return result;
400
+ }, Object.create(null));
401
+ }
402
+
403
+ exports.extract = extract;
404
+ exports.parse = parse;
405
+
406
+ exports.stringify = (object, options) => {
407
+ if (!object) {
408
+ return '';
409
+ }
410
+
411
+ options = Object.assign({
412
+ encode: true,
413
+ strict: true,
414
+ arrayFormat: 'none',
415
+ arrayFormatSeparator: ','
416
+ }, options);
417
+
418
+ validateArrayFormatSeparator(options.arrayFormatSeparator);
419
+
420
+ const shouldFilter = key => (
421
+ (options.skipNull && isNullOrUndefined(object[key])) ||
422
+ (options.skipEmptyString && object[key] === '')
423
+ );
424
+
425
+ const formatter = encoderForArrayFormat(options);
426
+
427
+ const objectCopy = {};
428
+
429
+ for (const key of Object.keys(object)) {
430
+ if (!shouldFilter(key)) {
431
+ objectCopy[key] = object[key];
432
+ }
433
+ }
434
+
435
+ const keys = Object.keys(objectCopy);
436
+
437
+ if (options.sort !== false) {
438
+ keys.sort(options.sort);
439
+ }
440
+
441
+ return keys.map(key => {
442
+ const value = object[key];
443
+
444
+ if (value === undefined) {
445
+ return '';
446
+ }
447
+
448
+ if (value === null) {
449
+ return encode(key, options);
450
+ }
451
+
452
+ if (Array.isArray(value)) {
453
+ return value
454
+ .reduce(formatter(key), [])
455
+ .join('&');
456
+ }
457
+
458
+ return encode(key, options) + '=' + encode(value, options);
459
+ }).filter(x => x.length > 0).join('&');
460
+ };
461
+
462
+ exports.parseUrl = (input, options) => {
463
+ return {
464
+ url: removeHash(input).split('?')[0] || '',
465
+ query: parse(extract(input), options)
466
+ };
467
+ };
468
+
469
+ exports.stringifyUrl = (input, options) => {
470
+ const url = removeHash(input.url).split('?')[0] || '';
471
+ const queryFromUrl = exports.extract(input.url);
472
+ const parsedQueryFromUrl = exports.parse(queryFromUrl);
473
+ const hash = getHash(input.url);
474
+ const query = Object.assign(parsedQueryFromUrl, input.query);
475
+ let queryString = exports.stringify(query, options);
476
+ if (queryString) {
477
+ queryString = `?${queryString}`;
478
+ }
479
+
480
+ return `${url}${queryString}${hash}`;
481
+ };
482
+ } (queryString));
483
+
484
+ var _excluded = ["history"];
485
+ var historyAppendSearch = function historyAppendSearch(_ref) {
486
+ var history = _ref.history,
487
+ rest = _objectWithoutProperties(_ref, _excluded);
488
+ if (history) {
489
+ var search = history.location.search;
490
+ history.replace({
491
+ search: queryString.stringify(_objectSpread2(_objectSpread2({}, queryString.parse(search)), rest))
492
+ });
493
+ } else {
494
+ console.error('error', 'historyAppendSearch needs history');
495
+ }
496
+ };
497
+ historyAppendSearch.propTypes = {
498
+ /** react-router-dom 的 history */
499
+ history: PropTypes.objectOf(PropTypes.any).isRequired
500
+ };
501
+
502
+ export { historyAppendSearch as default };
@@ -1 +1,5 @@
1
- var o=function(){return"localhost"===window.location||!1};export{o as default};
1
+ var isDevelopMode = function isDevelopMode() {
2
+ return window.location === 'localhost' || "production" === 'development';
3
+ };
4
+
5
+ export { isDevelopMode as default };
@@ -1 +1,36 @@
1
- var t=function(t){var a="",n=t.split("-"),r=parseInt(n[0],10);r<=0?r=1911:a=r.toString();var o=parseInt(n[1],10);o<=0||o>12?o=1:a="".concat(a,"-").concat(o.toString());var c=parseInt(n[2],10);return c<=0||c>31?c=1:a="".concat(a,"-").concat(c.toString()),{year:r,month:o,day:c,displayDate:a}};export{t as default};
1
+ var parseYMD = function parseYMD(date) {
2
+ var displayDate = '';
3
+ var ymd = date.split('-');
4
+
5
+ // year
6
+ var year = parseInt(ymd[0], 10);
7
+ if (year <= 0) {
8
+ year = 1911;
9
+ } else {
10
+ displayDate = year.toString();
11
+ }
12
+
13
+ // month
14
+ var month = parseInt(ymd[1], 10);
15
+ if (month <= 0 || month > 12) {
16
+ month = 1;
17
+ } else {
18
+ displayDate = "".concat(displayDate, "-").concat(month.toString());
19
+ }
20
+
21
+ // day
22
+ var day = parseInt(ymd[2], 10);
23
+ if (day <= 0 || day > 31) {
24
+ day = 1;
25
+ } else {
26
+ displayDate = "".concat(displayDate, "-").concat(day.toString());
27
+ }
28
+ return {
29
+ year: year,
30
+ month: month,
31
+ day: day,
32
+ displayDate: displayDate
33
+ };
34
+ };
35
+
36
+ export { parseYMD as default };
@@ -1 +1,11 @@
1
- var r=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return Array.isArray(r)?r.filter((function(r,t,e){return e.findIndex((function(t){return t[n]===r[n]}))===t})):[]};export{r as default};
1
+ var removeDuplicateItem = function removeDuplicateItem(array) {
2
+ var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
3
+ if (Array.isArray(array)) return array.filter(function (v, i, a) {
4
+ return a.findIndex(function (t) {
5
+ return t[key] === v[key];
6
+ }) === i;
7
+ });
8
+ return [];
9
+ };
10
+
11
+ export { removeDuplicateItem as default };
@@ -1 +1,39 @@
1
- import r from"axios";var e=function(e,t,a){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;r.defaults.timeout=o;try{return r.post(t,{sendMail:e}).then((function(r){return a({state:r&&200===r.status})})).catch((function(r){return console.error("api:axios:catch:error: ",r.message),{state:!1,error:r.message}}))}catch(r){return console.error("api:axios:try:catch:error: ",r.message),{state:!1,error:r.message}}};export{e as default};
1
+ import axios from 'axios';
2
+
3
+ // const sendMail = {
4
+ // from: "orient.cc.noreply@gmail.com",
5
+ // to: email,
6
+ // subject: `ATC_${card_id}`+" card status has been changed (Orient-CC)",
7
+ // text: context,
8
+ // };
9
+ //
10
+ // apiUrl: "https://api.daoyidh.com/mail"
11
+ var sendEmail = function sendEmail(sendMail, apiUrl, onSuccess) {
12
+ var timeout = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5000;
13
+ // timeout
14
+ axios.defaults.timeout = timeout;
15
+ try {
16
+ // axios api
17
+ return axios.post(apiUrl, {
18
+ sendMail: sendMail
19
+ }).then(function (res) {
20
+ return onSuccess({
21
+ state: res && res.status === 200
22
+ });
23
+ }).catch(function (err) {
24
+ console.error('api:axios:catch:error: ', err.message);
25
+ return {
26
+ state: false,
27
+ error: err.message
28
+ };
29
+ });
30
+ } catch (err) {
31
+ console.error('api:axios:try:catch:error: ', err.message);
32
+ return {
33
+ state: false,
34
+ error: err.message
35
+ };
36
+ }
37
+ };
38
+
39
+ export { sendEmail as default };
@@ -1 +1,5 @@
1
- var a={mainNode:"mainNode"};export{a as s};
1
+ var snaDefine = {
2
+ mainNode: 'mainNode'
3
+ };
4
+
5
+ export { snaDefine as s };
@@ -1 +1 @@
1
- export{s as default}from"./snaDefine-6a2bcd94.js";
1
+ export { s as default } from './snaDefine-6a2bcd94.js';
@@ -1 +1,84 @@
1
- import{_ as e}from"./_rollupPluginBabelHelpers-a6e0e6e3.js";import{s as r}from"./snaDefine-6a2bcd94.js";var n=function(n){var i=n.mainNodes,a=n.snaData;if(!(i&&Array.isArray(i)&&a&&Array.isArray(a)))return console.log("ERROR: wrong input data.",i,a),{nodes:[],links:[]};var t=[];a.forEach((function(e){var n=e.sourceId,a=e.sourceType,d=e.source,o=e.sourceHide,s=e.targetId,u=e.targetType,f=e.target,c=e.targetHide;t.find((function(r){return r.id===e.sourceId}))||t.push({name:d,id:n,type:-1!==i.indexOf(n)?r.mainNode:a,hasClick:-1===i.indexOf(n),hide:o||"0"}),t.find((function(r){return r.id===e.targetId}))||t.push({name:f,id:s,type:-1!==i.indexOf(s)?r.mainNode:u,hasClick:-1===i.indexOf(s),hide:c||"0"})}));var d=e(new Set(t.map((function(e){return JSON.stringify(e)})))).map((function(e){return JSON.parse(e)})),o=[];return a.forEach((function(e){var r=e.sourceId,n=e.targetId;o.push({target:d.findIndex((function(e){return n===e.id})),source:d.findIndex((function(e){return r===e.id}))})})),{nodes:d,links:o}};export{n as default};
1
+ import { _ as _toConsumableArray } from './_rollupPluginBabelHelpers-a6e0e6e3.js';
2
+ import { s as snaDefine } from './snaDefine-6a2bcd94.js';
3
+
4
+ var snaPreProcess = function snaPreProcess(_ref) {
5
+ var mainNodes = _ref.mainNodes,
6
+ snaData = _ref.snaData;
7
+ if (!mainNodes || !Array.isArray(mainNodes) || !snaData || !Array.isArray(snaData)) {
8
+ // eslint-disable-next-line no-console
9
+ console.log('ERROR: wrong input data.', mainNodes, snaData);
10
+ return {
11
+ nodes: [],
12
+ links: []
13
+ };
14
+ }
15
+
16
+ // 將所有source、target都建成node 並給予node的type好區分在圖上的圓圈大小與顏色
17
+ var nodes = [];
18
+ snaData.forEach(function (item) {
19
+ var sourceId = item.sourceId,
20
+ sourceType = item.sourceType,
21
+ source = item.source,
22
+ sourceHide = item.sourceHide,
23
+ targetId = item.targetId,
24
+ targetType = item.targetType,
25
+ target = item.target,
26
+ targetHide = item.targetHide;
27
+
28
+ // 避免出現無關聯的 node
29
+ var foundSrc = nodes.find(function (n) {
30
+ return n.id === item.sourceId;
31
+ });
32
+ if (!foundSrc) {
33
+ nodes.push({
34
+ name: source,
35
+ id: sourceId,
36
+ type: mainNodes.indexOf(sourceId) !== -1 ? snaDefine.mainNode : sourceType,
37
+ hasClick: mainNodes.indexOf(sourceId) === -1,
38
+ hide: sourceHide || '0'
39
+ });
40
+ }
41
+
42
+ // 避免出現無關聯的 node
43
+ var foundTar = nodes.find(function (n) {
44
+ return n.id === item.targetId;
45
+ });
46
+ if (!foundTar) {
47
+ nodes.push({
48
+ name: target,
49
+ id: targetId,
50
+ type: mainNodes.indexOf(targetId) !== -1 ? snaDefine.mainNode : targetType,
51
+ hasClick: mainNodes.indexOf(targetId) === -1,
52
+ hide: targetHide || '0'
53
+ });
54
+ }
55
+ });
56
+
57
+ // 刪除重複的node
58
+ var uniqueNodes = _toConsumableArray(new Set(nodes.map(function (item) {
59
+ return JSON.stringify(item);
60
+ }))).map(function (item) {
61
+ return JSON.parse(item);
62
+ });
63
+
64
+ // 把有關係的node建立link
65
+ var links = [];
66
+ snaData.forEach(function (item) {
67
+ var sourceId = item.sourceId,
68
+ targetId = item.targetId;
69
+ links.push({
70
+ target: uniqueNodes.findIndex(function (uniqueNode) {
71
+ return targetId === uniqueNode.id;
72
+ }),
73
+ source: uniqueNodes.findIndex(function (uniqueNode) {
74
+ return sourceId === uniqueNode.id;
75
+ })
76
+ });
77
+ });
78
+ return {
79
+ nodes: uniqueNodes,
80
+ links: links
81
+ };
82
+ };
83
+
84
+ export { snaPreProcess as default };