@daoyi/nmtl-ui 2.0.1-beta.7 → 2.0.1-beta.71
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-e62927dc.js +334 -0
- package/lib/components/Autocomplete.js +13 -1
- package/lib/components/Avatar.js +53 -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-4fddcd2f.js +92 -0
- package/lib/components/Button.js +6 -1
- package/lib/components/Carousel.js +4654 -1
- package/lib/components/Checkbox.js +37 -1
- package/lib/components/CollapseContent.js +179 -1
- package/lib/components/ContactModal-33f4e605.js +12020 -0
- package/lib/components/ContactModal.js +22 -3
- package/lib/components/Drawer-fb5bc1ec.js +157 -0
- package/lib/components/Drawer.js +11 -1
- package/lib/components/Dropdown.js +134 -1
- package/lib/components/Empty-e50b760e.js +45 -0
- package/lib/components/Empty.js +5 -1
- package/lib/components/ExportButton.js +112 -1
- package/lib/components/ExtraTools-a49a1d2f.js +3537 -0
- package/lib/components/ExtraTools.js +10 -22
- package/lib/components/Filter.js +782 -12
- package/lib/components/Footer.js +271 -1
- package/lib/components/ForwardLink-6a82c19d.js +106 -0
- package/lib/components/ForwardLink.js +8 -0
- package/lib/components/Header.js +187 -1
- package/lib/components/Image.js +61 -1
- package/lib/components/Input.js +82 -1
- package/lib/components/InputMethod.js +33949 -12
- package/lib/components/KeywordSearch-3af0c402.js +140 -0
- package/lib/components/KeywordSearch.js +15 -1
- package/lib/components/KeywordTicker.js +190 -1
- package/lib/components/Keywords.js +317 -1
- package/lib/components/Loading.js +28 -1
- package/lib/components/MUITheme.js +2624 -1
- package/lib/components/Modal-2c39d5b8.js +108 -0
- package/lib/components/Modal.js +9 -1
- package/lib/components/MoreButton-6b323fe4.js +110 -0
- package/lib/components/MoreButton.js +6 -1
- package/lib/components/Pagination.js +3706 -0
- package/lib/components/Radio.js +78 -1
- package/lib/components/SNA.js +1691 -22
- package/lib/components/Select-0f131640.js +115 -0
- package/lib/components/Select.js +8 -1
- package/lib/components/Spin-1741f625.js +75 -0
- package/lib/components/Spin.js +6 -1
- package/lib/components/Table.js +51 -1
- package/lib/components/Tooltip-65a21a86.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-d9801fb7.js +576 -0
- package/lib/components/dataExport-d55d6fa3.js +92 -0
- package/lib/components/debounce-127da66c.js +355 -0
- package/lib/components/defaultTheme-5839b9b3.js +1505 -0
- package/lib/components/globalConfig.js +175 -0
- package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
- package/lib/components/index-0be0afec.js +481 -0
- package/lib/components/index-ef96775f.js +61 -0
- package/lib/components/isObjectLike-e111475d.js +190 -0
- package/lib/components/style-inject.es-1f59c1d0.js +28 -1
- package/lib/components/transform-3a04288b.js +5475 -0
- package/lib/components/withTheme-4417822c.js +6 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/utils/_rollupPluginBabelHelpers-8dd26e1a.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 +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 -0
- package/lib/utils/snaDefine.js +1 -1
- package/lib/utils/snaPreProcess.js +84 -1
- package/package.json +17 -21
- 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-0eb2d36e.js +0 -1
- package/lib/utils/_commonjsHelpers-e2cda605.js +0 -1
- package/lib/utils/_rollupPluginBabelHelpers-928a52ce.js +0 -1
|
@@ -1 +1,502 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import { b as _objectWithoutProperties, c as _objectSpread2 } from './_rollupPluginBabelHelpers-8dd26e1a.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 };
|
package/lib/utils/parseYMD.js
CHANGED
|
@@ -1 +1,36 @@
|
|
|
1
|
-
var
|
|
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
|
|
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 };
|
package/lib/utils/sendEmail.js
CHANGED
|
@@ -1 +1,39 @@
|
|
|
1
|
-
import
|
|
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] : 10000;
|
|
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 };
|
package/lib/utils/snaDefine.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { s as default } from './snaDefine-6a2bcd94.js';
|