react-intl 2.2.0 → 2.3.0
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/CONTRIBUTING.md +20 -0
- package/dist/react-intl.js +145 -615
- package/dist/react-intl.js.map +1 -1
- package/dist/react-intl.min.js +2 -2
- package/dist/react-intl.min.js.map +1 -1
- package/lib/index.es.js +74 -520
- package/lib/index.js +110 -556
- package/package.json +24 -20
- package/yarn.lock +4804 -0
- package/src/components/date.js +0 -46
- package/src/components/html-message.js +0 -87
- package/src/components/message.js +0 -134
- package/src/components/number.js +0 -46
- package/src/components/plural.js +0 -58
- package/src/components/provider.js +0 -176
- package/src/components/relative.js +0 -163
- package/src/components/time.js +0 -46
- package/src/define-messages.js +0 -11
- package/src/en.js +0 -2
- package/src/format.js +0 -275
- package/src/index.js +0 -12
- package/src/inject.js +0 -61
- package/src/locale-data-registry.js +0 -42
- package/src/plural.js +0 -28
- package/src/react-intl.js +0 -24
- package/src/types.js +0 -88
- package/src/utils.js +0 -93
package/dist/react-intl.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2017, Yahoo Inc.
|
|
3
3
|
* Copyrights licensed under the New BSD License.
|
|
4
4
|
* See the accompanying LICENSE file for terms.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
(function (global, factory) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}(this, (function (exports,React) { 'use strict';
|
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('prop-types'), require('react')) :
|
|
9
|
+
typeof define === 'function' && define.amd ? define(['exports', 'prop-types', 'react'], factory) :
|
|
10
|
+
(factory((global.ReactIntl = global.ReactIntl || {}),global.PropTypes,global.React));
|
|
11
|
+
}(this, (function (exports,PropTypes,React) { 'use strict';
|
|
12
12
|
|
|
13
13
|
if (typeof React === 'undefined') {
|
|
14
14
|
throw new ReferenceError('React must be loaded before ReactIntl.');
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
PropTypes = 'default' in PropTypes ? PropTypes['default'] : PropTypes;
|
|
18
19
|
var React__default = 'default' in React ? React['default'] : React;
|
|
19
20
|
|
|
20
21
|
// GENERATED FILE
|
|
@@ -333,14 +334,14 @@ var parser = (function () {
|
|
|
333
334
|
peg$startRuleFunctions = { start: peg$parsestart },
|
|
334
335
|
peg$startRuleFunction = peg$parsestart,
|
|
335
336
|
peg$c0 = [],
|
|
336
|
-
peg$c1 = function
|
|
337
|
+
peg$c1 = function (elements) {
|
|
337
338
|
return {
|
|
338
339
|
type: 'messageFormatPattern',
|
|
339
340
|
elements: elements
|
|
340
341
|
};
|
|
341
342
|
},
|
|
342
343
|
peg$c2 = peg$FAILED,
|
|
343
|
-
peg$c3 = function
|
|
344
|
+
peg$c3 = function (text) {
|
|
344
345
|
var string = '',
|
|
345
346
|
i,
|
|
346
347
|
j,
|
|
@@ -358,7 +359,7 @@ var parser = (function () {
|
|
|
358
359
|
|
|
359
360
|
return string;
|
|
360
361
|
},
|
|
361
|
-
peg$c4 = function
|
|
362
|
+
peg$c4 = function (messageText) {
|
|
362
363
|
return {
|
|
363
364
|
type: 'messageTextElement',
|
|
364
365
|
value: messageText
|
|
@@ -373,7 +374,7 @@ var parser = (function () {
|
|
|
373
374
|
peg$c11 = { type: "literal", value: ",", description: "\",\"" },
|
|
374
375
|
peg$c12 = "}",
|
|
375
376
|
peg$c13 = { type: "literal", value: "}", description: "\"}\"" },
|
|
376
|
-
peg$c14 = function
|
|
377
|
+
peg$c14 = function (id, format) {
|
|
377
378
|
return {
|
|
378
379
|
type: 'argumentElement',
|
|
379
380
|
id: id,
|
|
@@ -386,7 +387,7 @@ var parser = (function () {
|
|
|
386
387
|
peg$c18 = { type: "literal", value: "date", description: "\"date\"" },
|
|
387
388
|
peg$c19 = "time",
|
|
388
389
|
peg$c20 = { type: "literal", value: "time", description: "\"time\"" },
|
|
389
|
-
peg$c21 = function
|
|
390
|
+
peg$c21 = function (type, style) {
|
|
390
391
|
return {
|
|
391
392
|
type: type + 'Format',
|
|
392
393
|
style: style && style[2]
|
|
@@ -394,7 +395,7 @@ var parser = (function () {
|
|
|
394
395
|
},
|
|
395
396
|
peg$c22 = "plural",
|
|
396
397
|
peg$c23 = { type: "literal", value: "plural", description: "\"plural\"" },
|
|
397
|
-
peg$c24 = function
|
|
398
|
+
peg$c24 = function (pluralStyle) {
|
|
398
399
|
return {
|
|
399
400
|
type: pluralStyle.type,
|
|
400
401
|
ordinal: false,
|
|
@@ -404,7 +405,7 @@ var parser = (function () {
|
|
|
404
405
|
},
|
|
405
406
|
peg$c25 = "selectordinal",
|
|
406
407
|
peg$c26 = { type: "literal", value: "selectordinal", description: "\"selectordinal\"" },
|
|
407
|
-
peg$c27 = function
|
|
408
|
+
peg$c27 = function (pluralStyle) {
|
|
408
409
|
return {
|
|
409
410
|
type: pluralStyle.type,
|
|
410
411
|
ordinal: true,
|
|
@@ -414,7 +415,7 @@ var parser = (function () {
|
|
|
414
415
|
},
|
|
415
416
|
peg$c28 = "select",
|
|
416
417
|
peg$c29 = { type: "literal", value: "select", description: "\"select\"" },
|
|
417
|
-
peg$c30 = function
|
|
418
|
+
peg$c30 = function (options) {
|
|
418
419
|
return {
|
|
419
420
|
type: 'selectFormat',
|
|
420
421
|
options: options
|
|
@@ -422,7 +423,7 @@ var parser = (function () {
|
|
|
422
423
|
},
|
|
423
424
|
peg$c31 = "=",
|
|
424
425
|
peg$c32 = { type: "literal", value: "=", description: "\"=\"" },
|
|
425
|
-
peg$c33 = function
|
|
426
|
+
peg$c33 = function (selector, pattern) {
|
|
426
427
|
return {
|
|
427
428
|
type: 'optionalFormatPattern',
|
|
428
429
|
selector: selector,
|
|
@@ -431,10 +432,10 @@ var parser = (function () {
|
|
|
431
432
|
},
|
|
432
433
|
peg$c34 = "offset:",
|
|
433
434
|
peg$c35 = { type: "literal", value: "offset:", description: "\"offset:\"" },
|
|
434
|
-
peg$c36 = function
|
|
435
|
+
peg$c36 = function (number) {
|
|
435
436
|
return number;
|
|
436
437
|
},
|
|
437
|
-
peg$c37 = function
|
|
438
|
+
peg$c37 = function (offset, options) {
|
|
438
439
|
return {
|
|
439
440
|
type: 'pluralFormat',
|
|
440
441
|
offset: offset,
|
|
@@ -453,37 +454,37 @@ var parser = (function () {
|
|
|
453
454
|
peg$c47 = { type: "literal", value: "0", description: "\"0\"" },
|
|
454
455
|
peg$c48 = /^[1-9]/,
|
|
455
456
|
peg$c49 = { type: "class", value: "[1-9]", description: "[1-9]" },
|
|
456
|
-
peg$c50 = function
|
|
457
|
+
peg$c50 = function (digits) {
|
|
457
458
|
return parseInt(digits, 10);
|
|
458
459
|
},
|
|
459
460
|
peg$c51 = /^[^{}\\\0-\x1F \t\n\r]/,
|
|
460
461
|
peg$c52 = { type: "class", value: "[^{}\\\\\\0-\\x1F \\t\\n\\r]", description: "[^{}\\\\\\0-\\x1F \\t\\n\\r]" },
|
|
461
462
|
peg$c53 = "\\\\",
|
|
462
463
|
peg$c54 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" },
|
|
463
|
-
peg$c55 = function
|
|
464
|
+
peg$c55 = function () {
|
|
464
465
|
return '\\';
|
|
465
466
|
},
|
|
466
467
|
peg$c56 = "\\#",
|
|
467
468
|
peg$c57 = { type: "literal", value: "\\#", description: "\"\\\\#\"" },
|
|
468
|
-
peg$c58 = function
|
|
469
|
+
peg$c58 = function () {
|
|
469
470
|
return '\\#';
|
|
470
471
|
},
|
|
471
472
|
peg$c59 = "\\{",
|
|
472
473
|
peg$c60 = { type: "literal", value: "\\{", description: "\"\\\\{\"" },
|
|
473
|
-
peg$c61 = function
|
|
474
|
-
return '
|
|
474
|
+
peg$c61 = function () {
|
|
475
|
+
return '\u007B';
|
|
475
476
|
},
|
|
476
477
|
peg$c62 = "\\}",
|
|
477
478
|
peg$c63 = { type: "literal", value: "\\}", description: "\"\\\\}\"" },
|
|
478
|
-
peg$c64 = function
|
|
479
|
-
return '
|
|
479
|
+
peg$c64 = function () {
|
|
480
|
+
return '\u007D';
|
|
480
481
|
},
|
|
481
|
-
peg$c65 =
|
|
482
|
-
peg$c66 = { type: "literal", value:
|
|
483
|
-
peg$c67 = function
|
|
482
|
+
peg$c65 = "\\u",
|
|
483
|
+
peg$c66 = { type: "literal", value: "\\u", description: "\"\\\\u\"" },
|
|
484
|
+
peg$c67 = function (digits) {
|
|
484
485
|
return String.fromCharCode(parseInt(digits, 16));
|
|
485
486
|
},
|
|
486
|
-
peg$c68 = function
|
|
487
|
+
peg$c68 = function (chars) {
|
|
487
488
|
return chars.join('');
|
|
488
489
|
},
|
|
489
490
|
peg$currPos = 0,
|
|
@@ -503,30 +504,6 @@ var parser = (function () {
|
|
|
503
504
|
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
504
505
|
}
|
|
505
506
|
|
|
506
|
-
function text() {
|
|
507
|
-
return input.substring(peg$reportedPos, peg$currPos);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
function offset() {
|
|
511
|
-
return peg$reportedPos;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
function line() {
|
|
515
|
-
return peg$computePosDetails(peg$reportedPos).line;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
function column() {
|
|
519
|
-
return peg$computePosDetails(peg$reportedPos).column;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
function expected(description) {
|
|
523
|
-
throw peg$buildException(null, [{ type: "other", description: description }], peg$reportedPos);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
function error(message) {
|
|
527
|
-
throw peg$buildException(message, null, peg$reportedPos);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
507
|
function peg$computePosDetails(pos) {
|
|
531
508
|
function advance(details, startPos, endPos) {
|
|
532
509
|
var p, ch;
|
|
@@ -539,7 +516,7 @@ var parser = (function () {
|
|
|
539
516
|
}
|
|
540
517
|
details.column = 1;
|
|
541
518
|
details.seenCR = false;
|
|
542
|
-
} else if (ch === "\r" || ch ===
|
|
519
|
+
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
|
|
543
520
|
details.line++;
|
|
544
521
|
details.column = 1;
|
|
545
522
|
details.seenCR = true;
|
|
@@ -1836,7 +1813,7 @@ defineProperty(MessageFormat, 'formats', {
|
|
|
1836
1813
|
|
|
1837
1814
|
// Define internal private properties for dealing with locale data.
|
|
1838
1815
|
defineProperty(MessageFormat, '__localeData__', { value: objCreate(null) });
|
|
1839
|
-
defineProperty(MessageFormat, '__addLocaleData', { value: function
|
|
1816
|
+
defineProperty(MessageFormat, '__addLocaleData', { value: function (data) {
|
|
1840
1817
|
if (!(data && data.locale)) {
|
|
1841
1818
|
throw new Error('Locale data provided to IntlMessageFormat is missing a ' + '`locale` property');
|
|
1842
1819
|
}
|
|
@@ -1979,7 +1956,7 @@ MessageFormat.prototype._resolveLocale = function (locales) {
|
|
|
1979
1956
|
};
|
|
1980
1957
|
|
|
1981
1958
|
// GENERATED FILE
|
|
1982
|
-
var defaultLocale = { "locale": "en", "pluralRuleFunction": function
|
|
1959
|
+
var defaultLocale = { "locale": "en", "pluralRuleFunction": function (n, ord) {
|
|
1983
1960
|
var s = String(n).split("."),
|
|
1984
1961
|
v0 = !s[1],
|
|
1985
1962
|
t0 = Number(s[0]) == n,
|
|
@@ -2150,7 +2127,7 @@ function RelativeFormat(locales, options) {
|
|
|
2150
2127
|
|
|
2151
2128
|
// Define internal private properties for dealing with locale data.
|
|
2152
2129
|
defineProperty$1(RelativeFormat, '__localeData__', { value: objCreate$1(null) });
|
|
2153
|
-
defineProperty$1(RelativeFormat, '__addLocaleData', { value: function
|
|
2130
|
+
defineProperty$1(RelativeFormat, '__addLocaleData', { value: function (data) {
|
|
2154
2131
|
if (!(data && data.locale)) {
|
|
2155
2132
|
throw new Error('Locale data provided to IntlRelativeFormat is missing a ' + '`locale` property value');
|
|
2156
2133
|
}
|
|
@@ -2372,7 +2349,7 @@ RelativeFormat.prototype._selectUnits = function (diffReport) {
|
|
|
2372
2349
|
};
|
|
2373
2350
|
|
|
2374
2351
|
// GENERATED FILE
|
|
2375
|
-
var defaultLocale$1 = { "locale": "en", "pluralRuleFunction": function
|
|
2352
|
+
var defaultLocale$1 = { "locale": "en", "pluralRuleFunction": function (n, ord) {
|
|
2376
2353
|
var s = String(n).split("."),
|
|
2377
2354
|
v0 = !s[1],
|
|
2378
2355
|
t0 = Number(s[0]) == n,
|
|
@@ -2430,257 +2407,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
|
|
|
2430
2407
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2431
2408
|
};
|
|
2432
2409
|
|
|
2433
|
-
var jsx = function () {
|
|
2434
|
-
var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
|
|
2435
|
-
return function createRawReactElement(type, props, key, children) {
|
|
2436
|
-
var defaultProps = type && type.defaultProps;
|
|
2437
|
-
var childrenLength = arguments.length - 3;
|
|
2438
2410
|
|
|
2439
|
-
if (!props && childrenLength !== 0) {
|
|
2440
|
-
props = {};
|
|
2441
|
-
}
|
|
2442
|
-
|
|
2443
|
-
if (props && defaultProps) {
|
|
2444
|
-
for (var propName in defaultProps) {
|
|
2445
|
-
if (props[propName] === void 0) {
|
|
2446
|
-
props[propName] = defaultProps[propName];
|
|
2447
|
-
}
|
|
2448
|
-
}
|
|
2449
|
-
} else if (!props) {
|
|
2450
|
-
props = defaultProps || {};
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
if (childrenLength === 1) {
|
|
2454
|
-
props.children = children;
|
|
2455
|
-
} else if (childrenLength > 1) {
|
|
2456
|
-
var childArray = Array(childrenLength);
|
|
2457
2411
|
|
|
2458
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
2459
|
-
childArray[i] = arguments[i + 3];
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
props.children = childArray;
|
|
2463
|
-
}
|
|
2464
2412
|
|
|
2465
|
-
return {
|
|
2466
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
|
2467
|
-
type: type,
|
|
2468
|
-
key: key === undefined ? null : '' + key,
|
|
2469
|
-
ref: null,
|
|
2470
|
-
props: props,
|
|
2471
|
-
_owner: null
|
|
2472
|
-
};
|
|
2473
|
-
};
|
|
2474
|
-
}();
|
|
2475
|
-
|
|
2476
|
-
var asyncIterator = function (iterable) {
|
|
2477
|
-
if (typeof Symbol === "function") {
|
|
2478
|
-
if (Symbol.asyncIterator) {
|
|
2479
|
-
var method = iterable[Symbol.asyncIterator];
|
|
2480
|
-
if (method != null) return method.call(iterable);
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
if (Symbol.iterator) {
|
|
2484
|
-
return iterable[Symbol.iterator]();
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
|
|
2488
|
-
throw new TypeError("Object is not async iterable");
|
|
2489
|
-
};
|
|
2490
|
-
|
|
2491
|
-
var asyncGenerator = function () {
|
|
2492
|
-
function AwaitValue(value) {
|
|
2493
|
-
this.value = value;
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
|
-
function AsyncGenerator(gen) {
|
|
2497
|
-
var front, back;
|
|
2498
|
-
|
|
2499
|
-
function send(key, arg) {
|
|
2500
|
-
return new Promise(function (resolve, reject) {
|
|
2501
|
-
var request = {
|
|
2502
|
-
key: key,
|
|
2503
|
-
arg: arg,
|
|
2504
|
-
resolve: resolve,
|
|
2505
|
-
reject: reject,
|
|
2506
|
-
next: null
|
|
2507
|
-
};
|
|
2508
|
-
|
|
2509
|
-
if (back) {
|
|
2510
|
-
back = back.next = request;
|
|
2511
|
-
} else {
|
|
2512
|
-
front = back = request;
|
|
2513
|
-
resume(key, arg);
|
|
2514
|
-
}
|
|
2515
|
-
});
|
|
2516
|
-
}
|
|
2517
|
-
|
|
2518
|
-
function resume(key, arg) {
|
|
2519
|
-
try {
|
|
2520
|
-
var result = gen[key](arg);
|
|
2521
|
-
var value = result.value;
|
|
2522
|
-
|
|
2523
|
-
if (value instanceof AwaitValue) {
|
|
2524
|
-
Promise.resolve(value.value).then(function (arg) {
|
|
2525
|
-
resume("next", arg);
|
|
2526
|
-
}, function (arg) {
|
|
2527
|
-
resume("throw", arg);
|
|
2528
|
-
});
|
|
2529
|
-
} else {
|
|
2530
|
-
settle(result.done ? "return" : "normal", result.value);
|
|
2531
|
-
}
|
|
2532
|
-
} catch (err) {
|
|
2533
|
-
settle("throw", err);
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
|
-
|
|
2537
|
-
function settle(type, value) {
|
|
2538
|
-
switch (type) {
|
|
2539
|
-
case "return":
|
|
2540
|
-
front.resolve({
|
|
2541
|
-
value: value,
|
|
2542
|
-
done: true
|
|
2543
|
-
});
|
|
2544
|
-
break;
|
|
2545
|
-
|
|
2546
|
-
case "throw":
|
|
2547
|
-
front.reject(value);
|
|
2548
|
-
break;
|
|
2549
|
-
|
|
2550
|
-
default:
|
|
2551
|
-
front.resolve({
|
|
2552
|
-
value: value,
|
|
2553
|
-
done: false
|
|
2554
|
-
});
|
|
2555
|
-
break;
|
|
2556
|
-
}
|
|
2557
|
-
|
|
2558
|
-
front = front.next;
|
|
2559
|
-
|
|
2560
|
-
if (front) {
|
|
2561
|
-
resume(front.key, front.arg);
|
|
2562
|
-
} else {
|
|
2563
|
-
back = null;
|
|
2564
|
-
}
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
this._invoke = send;
|
|
2568
|
-
|
|
2569
|
-
if (typeof gen.return !== "function") {
|
|
2570
|
-
this.return = undefined;
|
|
2571
|
-
}
|
|
2572
|
-
}
|
|
2573
|
-
|
|
2574
|
-
if (typeof Symbol === "function" && Symbol.asyncIterator) {
|
|
2575
|
-
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
|
|
2576
|
-
return this;
|
|
2577
|
-
};
|
|
2578
|
-
}
|
|
2579
|
-
|
|
2580
|
-
AsyncGenerator.prototype.next = function (arg) {
|
|
2581
|
-
return this._invoke("next", arg);
|
|
2582
|
-
};
|
|
2583
|
-
|
|
2584
|
-
AsyncGenerator.prototype.throw = function (arg) {
|
|
2585
|
-
return this._invoke("throw", arg);
|
|
2586
|
-
};
|
|
2587
|
-
|
|
2588
|
-
AsyncGenerator.prototype.return = function (arg) {
|
|
2589
|
-
return this._invoke("return", arg);
|
|
2590
|
-
};
|
|
2591
|
-
|
|
2592
|
-
return {
|
|
2593
|
-
wrap: function (fn) {
|
|
2594
|
-
return function () {
|
|
2595
|
-
return new AsyncGenerator(fn.apply(this, arguments));
|
|
2596
|
-
};
|
|
2597
|
-
},
|
|
2598
|
-
await: function (value) {
|
|
2599
|
-
return new AwaitValue(value);
|
|
2600
|
-
}
|
|
2601
|
-
};
|
|
2602
|
-
}();
|
|
2603
|
-
|
|
2604
|
-
var asyncGeneratorDelegate = function (inner, awaitWrap) {
|
|
2605
|
-
var iter = {},
|
|
2606
|
-
waiting = false;
|
|
2607
|
-
|
|
2608
|
-
function pump(key, value) {
|
|
2609
|
-
waiting = true;
|
|
2610
|
-
value = new Promise(function (resolve) {
|
|
2611
|
-
resolve(inner[key](value));
|
|
2612
|
-
});
|
|
2613
|
-
return {
|
|
2614
|
-
done: false,
|
|
2615
|
-
value: awaitWrap(value)
|
|
2616
|
-
};
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
if (typeof Symbol === "function" && Symbol.iterator) {
|
|
2622
|
-
iter[Symbol.iterator] = function () {
|
|
2623
|
-
return this;
|
|
2624
|
-
};
|
|
2625
|
-
}
|
|
2626
|
-
|
|
2627
|
-
iter.next = function (value) {
|
|
2628
|
-
if (waiting) {
|
|
2629
|
-
waiting = false;
|
|
2630
|
-
return value;
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2633
|
-
return pump("next", value);
|
|
2634
|
-
};
|
|
2635
|
-
|
|
2636
|
-
if (typeof inner.throw === "function") {
|
|
2637
|
-
iter.throw = function (value) {
|
|
2638
|
-
if (waiting) {
|
|
2639
|
-
waiting = false;
|
|
2640
|
-
throw value;
|
|
2641
|
-
}
|
|
2642
2413
|
|
|
2643
|
-
return pump("throw", value);
|
|
2644
|
-
};
|
|
2645
|
-
}
|
|
2646
2414
|
|
|
2647
|
-
if (typeof inner.return === "function") {
|
|
2648
|
-
iter.return = function (value) {
|
|
2649
|
-
return pump("return", value);
|
|
2650
|
-
};
|
|
2651
|
-
}
|
|
2652
2415
|
|
|
2653
|
-
return iter;
|
|
2654
|
-
};
|
|
2655
2416
|
|
|
2656
|
-
var asyncToGenerator = function (fn) {
|
|
2657
|
-
return function () {
|
|
2658
|
-
var gen = fn.apply(this, arguments);
|
|
2659
|
-
return new Promise(function (resolve, reject) {
|
|
2660
|
-
function step(key, arg) {
|
|
2661
|
-
try {
|
|
2662
|
-
var info = gen[key](arg);
|
|
2663
|
-
var value = info.value;
|
|
2664
|
-
} catch (error) {
|
|
2665
|
-
reject(error);
|
|
2666
|
-
return;
|
|
2667
|
-
}
|
|
2668
2417
|
|
|
2669
|
-
if (info.done) {
|
|
2670
|
-
resolve(value);
|
|
2671
|
-
} else {
|
|
2672
|
-
return Promise.resolve(value).then(function (value) {
|
|
2673
|
-
step("next", value);
|
|
2674
|
-
}, function (err) {
|
|
2675
|
-
step("throw", err);
|
|
2676
|
-
});
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
2418
|
|
|
2680
|
-
return step("next");
|
|
2681
|
-
});
|
|
2682
|
-
};
|
|
2683
|
-
};
|
|
2684
2419
|
|
|
2685
2420
|
var classCallCheck = function (instance, Constructor) {
|
|
2686
2421
|
if (!(instance instanceof Constructor)) {
|
|
@@ -2706,31 +2441,9 @@ var createClass = function () {
|
|
|
2706
2441
|
};
|
|
2707
2442
|
}();
|
|
2708
2443
|
|
|
2709
|
-
var defineEnumerableProperties = function (obj, descs) {
|
|
2710
|
-
for (var key in descs) {
|
|
2711
|
-
var desc = descs[key];
|
|
2712
|
-
desc.configurable = desc.enumerable = true;
|
|
2713
|
-
if ("value" in desc) desc.writable = true;
|
|
2714
|
-
Object.defineProperty(obj, key, desc);
|
|
2715
|
-
}
|
|
2716
|
-
|
|
2717
|
-
return obj;
|
|
2718
|
-
};
|
|
2719
|
-
|
|
2720
|
-
var defaults = function (obj, defaults) {
|
|
2721
|
-
var keys = Object.getOwnPropertyNames(defaults);
|
|
2722
2444
|
|
|
2723
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2724
|
-
var key = keys[i];
|
|
2725
|
-
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
|
2726
2445
|
|
|
2727
|
-
if (value && value.configurable && obj[key] === undefined) {
|
|
2728
|
-
Object.defineProperty(obj, key, value);
|
|
2729
|
-
}
|
|
2730
|
-
}
|
|
2731
2446
|
|
|
2732
|
-
return obj;
|
|
2733
|
-
};
|
|
2734
2447
|
|
|
2735
2448
|
var defineProperty$2 = function (obj, key, value) {
|
|
2736
2449
|
if (key in obj) {
|
|
@@ -2761,30 +2474,7 @@ var _extends = Object.assign || function (target) {
|
|
|
2761
2474
|
return target;
|
|
2762
2475
|
};
|
|
2763
2476
|
|
|
2764
|
-
var get = function get(object, property, receiver) {
|
|
2765
|
-
if (object === null) object = Function.prototype;
|
|
2766
|
-
var desc = Object.getOwnPropertyDescriptor(object, property);
|
|
2767
2477
|
|
|
2768
|
-
if (desc === undefined) {
|
|
2769
|
-
var parent = Object.getPrototypeOf(object);
|
|
2770
|
-
|
|
2771
|
-
if (parent === null) {
|
|
2772
|
-
return undefined;
|
|
2773
|
-
} else {
|
|
2774
|
-
return get(parent, property, receiver);
|
|
2775
|
-
}
|
|
2776
|
-
} else if ("value" in desc) {
|
|
2777
|
-
return desc.value;
|
|
2778
|
-
} else {
|
|
2779
|
-
var getter = desc.get;
|
|
2780
|
-
|
|
2781
|
-
if (getter === undefined) {
|
|
2782
|
-
return undefined;
|
|
2783
|
-
}
|
|
2784
|
-
|
|
2785
|
-
return getter.call(receiver);
|
|
2786
|
-
}
|
|
2787
|
-
};
|
|
2788
2478
|
|
|
2789
2479
|
var inherits = function (subClass, superClass) {
|
|
2790
2480
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -2802,46 +2492,13 @@ var inherits = function (subClass, superClass) {
|
|
|
2802
2492
|
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2803
2493
|
};
|
|
2804
2494
|
|
|
2805
|
-
var _instanceof = function (left, right) {
|
|
2806
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
2807
|
-
return right[Symbol.hasInstance](left);
|
|
2808
|
-
} else {
|
|
2809
|
-
return left instanceof right;
|
|
2810
|
-
}
|
|
2811
|
-
};
|
|
2812
2495
|
|
|
2813
|
-
var interopRequireDefault = function (obj) {
|
|
2814
|
-
return obj && obj.__esModule ? obj : {
|
|
2815
|
-
default: obj
|
|
2816
|
-
};
|
|
2817
|
-
};
|
|
2818
2496
|
|
|
2819
|
-
var interopRequireWildcard = function (obj) {
|
|
2820
|
-
if (obj && obj.__esModule) {
|
|
2821
|
-
return obj;
|
|
2822
|
-
} else {
|
|
2823
|
-
var newObj = {};
|
|
2824
2497
|
|
|
2825
|
-
if (obj != null) {
|
|
2826
|
-
for (var key in obj) {
|
|
2827
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
|
|
2828
|
-
}
|
|
2829
|
-
}
|
|
2830
2498
|
|
|
2831
|
-
newObj.default = obj;
|
|
2832
|
-
return newObj;
|
|
2833
|
-
}
|
|
2834
|
-
};
|
|
2835
2499
|
|
|
2836
|
-
var newArrowCheck = function (innerThis, boundThis) {
|
|
2837
|
-
if (innerThis !== boundThis) {
|
|
2838
|
-
throw new TypeError("Cannot instantiate an arrow function");
|
|
2839
|
-
}
|
|
2840
|
-
};
|
|
2841
2500
|
|
|
2842
|
-
|
|
2843
|
-
if (obj == null) throw new TypeError("Cannot destructure undefined");
|
|
2844
|
-
};
|
|
2501
|
+
|
|
2845
2502
|
|
|
2846
2503
|
var objectWithoutProperties = function (obj, keys) {
|
|
2847
2504
|
var target = {};
|
|
@@ -2863,112 +2520,23 @@ var possibleConstructorReturn = function (self, call) {
|
|
|
2863
2520
|
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
2864
2521
|
};
|
|
2865
2522
|
|
|
2866
|
-
var selfGlobal = typeof global === "undefined" ? self : global;
|
|
2867
2523
|
|
|
2868
|
-
var set = function set(object, property, value, receiver) {
|
|
2869
|
-
var desc = Object.getOwnPropertyDescriptor(object, property);
|
|
2870
2524
|
|
|
2871
|
-
if (desc === undefined) {
|
|
2872
|
-
var parent = Object.getPrototypeOf(object);
|
|
2873
2525
|
|
|
2874
|
-
if (parent !== null) {
|
|
2875
|
-
set(parent, property, value, receiver);
|
|
2876
|
-
}
|
|
2877
|
-
} else if ("value" in desc && desc.writable) {
|
|
2878
|
-
desc.value = value;
|
|
2879
|
-
} else {
|
|
2880
|
-
var setter = desc.set;
|
|
2881
2526
|
|
|
2882
|
-
if (setter !== undefined) {
|
|
2883
|
-
setter.call(receiver, value);
|
|
2884
|
-
}
|
|
2885
|
-
}
|
|
2886
2527
|
|
|
2887
|
-
return value;
|
|
2888
|
-
};
|
|
2889
2528
|
|
|
2890
|
-
var slicedToArray = function () {
|
|
2891
|
-
function sliceIterator(arr, i) {
|
|
2892
|
-
var _arr = [];
|
|
2893
|
-
var _n = true;
|
|
2894
|
-
var _d = false;
|
|
2895
|
-
var _e = undefined;
|
|
2896
2529
|
|
|
2897
|
-
try {
|
|
2898
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
2899
|
-
_arr.push(_s.value);
|
|
2900
2530
|
|
|
2901
|
-
if (i && _arr.length === i) break;
|
|
2902
|
-
}
|
|
2903
|
-
} catch (err) {
|
|
2904
|
-
_d = true;
|
|
2905
|
-
_e = err;
|
|
2906
|
-
} finally {
|
|
2907
|
-
try {
|
|
2908
|
-
if (!_n && _i["return"]) _i["return"]();
|
|
2909
|
-
} finally {
|
|
2910
|
-
if (_d) throw _e;
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
2531
|
|
|
2914
|
-
return _arr;
|
|
2915
|
-
}
|
|
2916
2532
|
|
|
2917
|
-
return function (arr, i) {
|
|
2918
|
-
if (Array.isArray(arr)) {
|
|
2919
|
-
return arr;
|
|
2920
|
-
} else if (Symbol.iterator in Object(arr)) {
|
|
2921
|
-
return sliceIterator(arr, i);
|
|
2922
|
-
} else {
|
|
2923
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
2924
|
-
}
|
|
2925
|
-
};
|
|
2926
|
-
}();
|
|
2927
2533
|
|
|
2928
|
-
var slicedToArrayLoose = function (arr, i) {
|
|
2929
|
-
if (Array.isArray(arr)) {
|
|
2930
|
-
return arr;
|
|
2931
|
-
} else if (Symbol.iterator in Object(arr)) {
|
|
2932
|
-
var _arr = [];
|
|
2933
|
-
|
|
2934
|
-
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
|
2935
|
-
_arr.push(_step.value);
|
|
2936
2534
|
|
|
2937
|
-
if (i && _arr.length === i) break;
|
|
2938
|
-
}
|
|
2939
2535
|
|
|
2940
|
-
return _arr;
|
|
2941
|
-
} else {
|
|
2942
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
2943
|
-
}
|
|
2944
|
-
};
|
|
2945
|
-
|
|
2946
|
-
var taggedTemplateLiteral = function (strings, raw) {
|
|
2947
|
-
return Object.freeze(Object.defineProperties(strings, {
|
|
2948
|
-
raw: {
|
|
2949
|
-
value: Object.freeze(raw)
|
|
2950
|
-
}
|
|
2951
|
-
}));
|
|
2952
|
-
};
|
|
2953
2536
|
|
|
2954
|
-
var taggedTemplateLiteralLoose = function (strings, raw) {
|
|
2955
|
-
strings.raw = raw;
|
|
2956
|
-
return strings;
|
|
2957
|
-
};
|
|
2958
2537
|
|
|
2959
|
-
var temporalRef = function (val, name, undef) {
|
|
2960
|
-
if (val === undef) {
|
|
2961
|
-
throw new ReferenceError(name + " is not defined - temporal dead zone");
|
|
2962
|
-
} else {
|
|
2963
|
-
return val;
|
|
2964
|
-
}
|
|
2965
|
-
};
|
|
2966
2538
|
|
|
2967
|
-
var temporalUndefined = {};
|
|
2968
2539
|
|
|
2969
|
-
var toArray = function (arr) {
|
|
2970
|
-
return Array.isArray(arr) ? arr : Array.from(arr);
|
|
2971
|
-
};
|
|
2972
2540
|
|
|
2973
2541
|
var toConsumableArray = function (arr) {
|
|
2974
2542
|
if (Array.isArray(arr)) {
|
|
@@ -2980,56 +2548,20 @@ var toConsumableArray = function (arr) {
|
|
|
2980
2548
|
}
|
|
2981
2549
|
};
|
|
2982
2550
|
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
var babelHelpers$1 = Object.freeze({
|
|
2986
|
-
jsx: jsx,
|
|
2987
|
-
asyncIterator: asyncIterator,
|
|
2988
|
-
asyncGenerator: asyncGenerator,
|
|
2989
|
-
asyncGeneratorDelegate: asyncGeneratorDelegate,
|
|
2990
|
-
asyncToGenerator: asyncToGenerator,
|
|
2991
|
-
classCallCheck: classCallCheck,
|
|
2992
|
-
createClass: createClass,
|
|
2993
|
-
defineEnumerableProperties: defineEnumerableProperties,
|
|
2994
|
-
defaults: defaults,
|
|
2995
|
-
defineProperty: defineProperty$2,
|
|
2996
|
-
get: get,
|
|
2997
|
-
inherits: inherits,
|
|
2998
|
-
interopRequireDefault: interopRequireDefault,
|
|
2999
|
-
interopRequireWildcard: interopRequireWildcard,
|
|
3000
|
-
newArrowCheck: newArrowCheck,
|
|
3001
|
-
objectDestructuringEmpty: objectDestructuringEmpty,
|
|
3002
|
-
objectWithoutProperties: objectWithoutProperties,
|
|
3003
|
-
possibleConstructorReturn: possibleConstructorReturn,
|
|
3004
|
-
selfGlobal: selfGlobal,
|
|
3005
|
-
set: set,
|
|
3006
|
-
slicedToArray: slicedToArray,
|
|
3007
|
-
slicedToArrayLoose: slicedToArrayLoose,
|
|
3008
|
-
taggedTemplateLiteral: taggedTemplateLiteral,
|
|
3009
|
-
taggedTemplateLiteralLoose: taggedTemplateLiteralLoose,
|
|
3010
|
-
temporalRef: temporalRef,
|
|
3011
|
-
temporalUndefined: temporalUndefined,
|
|
3012
|
-
toArray: toArray,
|
|
3013
|
-
toConsumableArray: toConsumableArray,
|
|
3014
|
-
typeof: _typeof,
|
|
3015
|
-
extends: _extends,
|
|
3016
|
-
instanceof: _instanceof
|
|
3017
|
-
});
|
|
3018
|
-
|
|
3019
2551
|
/*
|
|
3020
2552
|
* Copyright 2015, Yahoo Inc.
|
|
3021
2553
|
* Copyrights licensed under the New BSD License.
|
|
3022
2554
|
* See the accompanying LICENSE file for terms.
|
|
3023
2555
|
*/
|
|
3024
2556
|
|
|
3025
|
-
var bool =
|
|
3026
|
-
var number =
|
|
3027
|
-
var string =
|
|
3028
|
-
var func =
|
|
3029
|
-
var object =
|
|
3030
|
-
var oneOf =
|
|
3031
|
-
var shape =
|
|
3032
|
-
var
|
|
2557
|
+
var bool = PropTypes.bool;
|
|
2558
|
+
var number = PropTypes.number;
|
|
2559
|
+
var string = PropTypes.string;
|
|
2560
|
+
var func = PropTypes.func;
|
|
2561
|
+
var object = PropTypes.object;
|
|
2562
|
+
var oneOf = PropTypes.oneOf;
|
|
2563
|
+
var shape = PropTypes.shape;
|
|
2564
|
+
var any = PropTypes.any;
|
|
3033
2565
|
|
|
3034
2566
|
var localeMatcher = oneOf(['best fit', 'lookup']);
|
|
3035
2567
|
var narrowShortLong = oneOf(['narrow', 'short', 'long']);
|
|
@@ -3040,7 +2572,7 @@ var intlConfigPropTypes = {
|
|
|
3040
2572
|
locale: string,
|
|
3041
2573
|
formats: object,
|
|
3042
2574
|
messages: object,
|
|
3043
|
-
textComponent:
|
|
2575
|
+
textComponent: any,
|
|
3044
2576
|
|
|
3045
2577
|
defaultLocale: string,
|
|
3046
2578
|
defaultFormats: object
|
|
@@ -3056,7 +2588,7 @@ var intlFormatPropTypes = {
|
|
|
3056
2588
|
formatHTMLMessage: funcReq
|
|
3057
2589
|
};
|
|
3058
2590
|
|
|
3059
|
-
var intlShape = shape(
|
|
2591
|
+
var intlShape = shape(_extends({}, intlConfigPropTypes, intlFormatPropTypes, {
|
|
3060
2592
|
formatters: object,
|
|
3061
2593
|
now: funcReq
|
|
3062
2594
|
}));
|
|
@@ -3131,7 +2663,7 @@ var pluralFormatPropTypes = {
|
|
|
3131
2663
|
|
|
3132
2664
|
var NODE_ENV = "development";
|
|
3133
2665
|
|
|
3134
|
-
var invariant = function
|
|
2666
|
+
var invariant = function (condition, format, a, b, c, d, e, f) {
|
|
3135
2667
|
if (NODE_ENV !== 'production') {
|
|
3136
2668
|
if (format === undefined) {
|
|
3137
2669
|
throw new Error('invariant requires an error message argument');
|
|
@@ -3213,7 +2745,7 @@ function shallowEquals(objA, objB) {
|
|
|
3213
2745
|
return true;
|
|
3214
2746
|
}
|
|
3215
2747
|
|
|
3216
|
-
if ((typeof objA === 'undefined' ? 'undefined' :
|
|
2748
|
+
if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
|
|
3217
2749
|
return false;
|
|
3218
2750
|
}
|
|
3219
2751
|
|
|
@@ -3292,7 +2824,7 @@ function injectIntl(WrappedComponent) {
|
|
|
3292
2824
|
}, {
|
|
3293
2825
|
key: 'render',
|
|
3294
2826
|
value: function render() {
|
|
3295
|
-
return React__default.createElement(WrappedComponent,
|
|
2827
|
+
return React__default.createElement(WrappedComponent, _extends({}, this.props, defineProperty$2({}, intlPropName, this.context.intl), {
|
|
3296
2828
|
ref: withRef ? 'wrappedInstance' : null
|
|
3297
2829
|
}));
|
|
3298
2830
|
}
|
|
@@ -3372,8 +2904,8 @@ var bind = Function.prototype.bind || function (oThis) {
|
|
|
3372
2904
|
|
|
3373
2905
|
var aArgs = Array.prototype.slice.call(arguments, 1),
|
|
3374
2906
|
fToBind = this,
|
|
3375
|
-
fNOP = function
|
|
3376
|
-
fBound = function
|
|
2907
|
+
fNOP = function () {},
|
|
2908
|
+
fBound = function () {
|
|
3377
2909
|
return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
|
|
3378
2910
|
};
|
|
3379
2911
|
|
|
@@ -3469,7 +3001,7 @@ function getCacheId(inputs) {
|
|
|
3469
3001
|
for (i = 0, len = inputs.length; i < len; i += 1) {
|
|
3470
3002
|
input = inputs[i];
|
|
3471
3003
|
|
|
3472
|
-
if (input &&
|
|
3004
|
+
if (input && typeof input === 'object') {
|
|
3473
3005
|
cacheId.push(orderedProps(input));
|
|
3474
3006
|
} else {
|
|
3475
3007
|
cacheId.push(input);
|
|
@@ -3577,7 +3109,7 @@ function formatTime(config, state, value) {
|
|
|
3577
3109
|
|
|
3578
3110
|
if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
|
|
3579
3111
|
// Add default formatting options if hour, minute, or second isn't defined.
|
|
3580
|
-
filteredOptions =
|
|
3112
|
+
filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
|
|
3581
3113
|
}
|
|
3582
3114
|
|
|
3583
3115
|
try {
|
|
@@ -3605,7 +3137,7 @@ function formatRelative(config, state, value) {
|
|
|
3605
3137
|
|
|
3606
3138
|
// Capture the current threshold values, then temporarily override them with
|
|
3607
3139
|
// specific values just for this render.
|
|
3608
|
-
var oldThresholds =
|
|
3140
|
+
var oldThresholds = _extends({}, RelativeFormat.thresholds);
|
|
3609
3141
|
updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
|
|
3610
3142
|
|
|
3611
3143
|
try {
|
|
@@ -3819,7 +3351,7 @@ var IntlProvider = function (_Component) {
|
|
|
3819
3351
|
getPluralFormat: createFormatCache(IntlPluralFormat)
|
|
3820
3352
|
} : _ref$formatters;
|
|
3821
3353
|
|
|
3822
|
-
_this.state =
|
|
3354
|
+
_this.state = _extends({}, formatters, {
|
|
3823
3355
|
|
|
3824
3356
|
// Wrapper to provide stable "now" time for initial render.
|
|
3825
3357
|
now: function now() {
|
|
@@ -3864,7 +3396,7 @@ var IntlProvider = function (_Component) {
|
|
|
3864
3396
|
// The `messages` are overridden to the `defaultProps` empty object
|
|
3865
3397
|
// to maintain referential equality across re-renders. It's assumed
|
|
3866
3398
|
// each <FormattedMessage> contains a `defaultMessage` prop.
|
|
3867
|
-
config =
|
|
3399
|
+
config = _extends({}, config, {
|
|
3868
3400
|
locale: defaultLocale,
|
|
3869
3401
|
formats: defaultFormats,
|
|
3870
3402
|
messages: defaultProps.messages
|
|
@@ -3895,7 +3427,7 @@ var IntlProvider = function (_Component) {
|
|
|
3895
3427
|
|
|
3896
3428
|
|
|
3897
3429
|
return {
|
|
3898
|
-
intl:
|
|
3430
|
+
intl: _extends({}, config, boundFormatFns, {
|
|
3899
3431
|
formatters: formatters,
|
|
3900
3432
|
now: now
|
|
3901
3433
|
})
|
|
@@ -3931,9 +3463,9 @@ IntlProvider.contextTypes = {
|
|
|
3931
3463
|
IntlProvider.childContextTypes = {
|
|
3932
3464
|
intl: intlShape.isRequired
|
|
3933
3465
|
};
|
|
3934
|
-
IntlProvider.propTypes =
|
|
3935
|
-
children:
|
|
3936
|
-
initialNow:
|
|
3466
|
+
IntlProvider.propTypes = _extends({}, intlConfigPropTypes, {
|
|
3467
|
+
children: PropTypes.element.isRequired,
|
|
3468
|
+
initialNow: PropTypes.any
|
|
3937
3469
|
});
|
|
3938
3470
|
|
|
3939
3471
|
/*
|
|
@@ -3994,10 +3526,10 @@ FormattedDate.displayName = 'FormattedDate';
|
|
|
3994
3526
|
FormattedDate.contextTypes = {
|
|
3995
3527
|
intl: intlShape
|
|
3996
3528
|
};
|
|
3997
|
-
FormattedDate.propTypes =
|
|
3998
|
-
value:
|
|
3999
|
-
format:
|
|
4000
|
-
children:
|
|
3529
|
+
FormattedDate.propTypes = _extends({}, dateTimeFormatPropTypes, {
|
|
3530
|
+
value: PropTypes.any.isRequired,
|
|
3531
|
+
format: PropTypes.string,
|
|
3532
|
+
children: PropTypes.func
|
|
4001
3533
|
});
|
|
4002
3534
|
|
|
4003
3535
|
/*
|
|
@@ -4058,10 +3590,10 @@ FormattedTime.displayName = 'FormattedTime';
|
|
|
4058
3590
|
FormattedTime.contextTypes = {
|
|
4059
3591
|
intl: intlShape
|
|
4060
3592
|
};
|
|
4061
|
-
FormattedTime.propTypes =
|
|
4062
|
-
value:
|
|
4063
|
-
format:
|
|
4064
|
-
children:
|
|
3593
|
+
FormattedTime.propTypes = _extends({}, dateTimeFormatPropTypes, {
|
|
3594
|
+
value: PropTypes.any.isRequired,
|
|
3595
|
+
format: PropTypes.string,
|
|
3596
|
+
children: PropTypes.func
|
|
4065
3597
|
});
|
|
4066
3598
|
|
|
4067
3599
|
/*
|
|
@@ -4148,20 +3680,24 @@ var FormattedRelative = function (_Component) {
|
|
|
4148
3680
|
value: function scheduleNextUpdate(props, state) {
|
|
4149
3681
|
var _this2 = this;
|
|
4150
3682
|
|
|
4151
|
-
|
|
3683
|
+
// Cancel and pending update because we're scheduling a new update.
|
|
3684
|
+
clearTimeout(this._timer);
|
|
3685
|
+
|
|
3686
|
+
var value = props.value,
|
|
3687
|
+
units = props.units,
|
|
3688
|
+
updateInterval = props.updateInterval;
|
|
4152
3689
|
|
|
4153
|
-
|
|
4154
|
-
// have been turned off, so we bail and skip scheduling an update.
|
|
3690
|
+
var time = new Date(value).getTime();
|
|
4155
3691
|
|
|
4156
|
-
|
|
3692
|
+
// If the `updateInterval` is falsy, including `0` or we don't have a
|
|
3693
|
+
// valid date, then auto updates have been turned off, so we bail and
|
|
3694
|
+
// skip scheduling an update.
|
|
3695
|
+
if (!updateInterval || !isFinite(time)) {
|
|
4157
3696
|
return;
|
|
4158
3697
|
}
|
|
4159
3698
|
|
|
4160
|
-
var time = new Date(props.value).getTime();
|
|
4161
3699
|
var delta = time - state.now;
|
|
4162
|
-
var
|
|
4163
|
-
|
|
4164
|
-
var unitDelay = getUnitDelay(units);
|
|
3700
|
+
var unitDelay = getUnitDelay(units || selectUnits(delta));
|
|
4165
3701
|
var unitRemainder = Math.abs(delta % unitDelay);
|
|
4166
3702
|
|
|
4167
3703
|
// We want the largest possible timer delay which will still display
|
|
@@ -4170,8 +3706,6 @@ var FormattedRelative = function (_Component) {
|
|
|
4170
3706
|
// "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
|
|
4171
3707
|
var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
|
|
4172
3708
|
|
|
4173
|
-
clearTimeout(this._timer);
|
|
4174
|
-
|
|
4175
3709
|
this._timer = setTimeout(function () {
|
|
4176
3710
|
_this2.setState({ now: _this2.context.intl.now() });
|
|
4177
3711
|
}, delay);
|
|
@@ -4222,7 +3756,7 @@ var FormattedRelative = function (_Component) {
|
|
|
4222
3756
|
children = _props.children;
|
|
4223
3757
|
|
|
4224
3758
|
|
|
4225
|
-
var formattedRelative = formatRelative(value,
|
|
3759
|
+
var formattedRelative = formatRelative(value, _extends({}, this.props, this.state));
|
|
4226
3760
|
|
|
4227
3761
|
if (typeof children === 'function') {
|
|
4228
3762
|
return children(formattedRelative);
|
|
@@ -4245,12 +3779,12 @@ FormattedRelative.contextTypes = {
|
|
|
4245
3779
|
FormattedRelative.defaultProps = {
|
|
4246
3780
|
updateInterval: 1000 * 10
|
|
4247
3781
|
};
|
|
4248
|
-
FormattedRelative.propTypes =
|
|
4249
|
-
value:
|
|
4250
|
-
format:
|
|
4251
|
-
updateInterval:
|
|
4252
|
-
initialNow:
|
|
4253
|
-
children:
|
|
3782
|
+
FormattedRelative.propTypes = _extends({}, relativeFormatPropTypes, {
|
|
3783
|
+
value: PropTypes.any.isRequired,
|
|
3784
|
+
format: PropTypes.string,
|
|
3785
|
+
updateInterval: PropTypes.number,
|
|
3786
|
+
initialNow: PropTypes.any,
|
|
3787
|
+
children: PropTypes.func
|
|
4254
3788
|
});
|
|
4255
3789
|
|
|
4256
3790
|
/*
|
|
@@ -4311,10 +3845,10 @@ FormattedNumber.displayName = 'FormattedNumber';
|
|
|
4311
3845
|
FormattedNumber.contextTypes = {
|
|
4312
3846
|
intl: intlShape
|
|
4313
3847
|
};
|
|
4314
|
-
FormattedNumber.propTypes =
|
|
4315
|
-
value:
|
|
4316
|
-
format:
|
|
4317
|
-
children:
|
|
3848
|
+
FormattedNumber.propTypes = _extends({}, numberFormatPropTypes, {
|
|
3849
|
+
value: PropTypes.any.isRequired,
|
|
3850
|
+
format: PropTypes.string,
|
|
3851
|
+
children: PropTypes.func
|
|
4318
3852
|
});
|
|
4319
3853
|
|
|
4320
3854
|
/*
|
|
@@ -4380,17 +3914,17 @@ FormattedPlural.contextTypes = {
|
|
|
4380
3914
|
FormattedPlural.defaultProps = {
|
|
4381
3915
|
style: 'cardinal'
|
|
4382
3916
|
};
|
|
4383
|
-
FormattedPlural.propTypes =
|
|
4384
|
-
value:
|
|
3917
|
+
FormattedPlural.propTypes = _extends({}, pluralFormatPropTypes, {
|
|
3918
|
+
value: PropTypes.any.isRequired,
|
|
4385
3919
|
|
|
4386
|
-
other:
|
|
4387
|
-
zero:
|
|
4388
|
-
one:
|
|
4389
|
-
two:
|
|
4390
|
-
few:
|
|
4391
|
-
many:
|
|
3920
|
+
other: PropTypes.node.isRequired,
|
|
3921
|
+
zero: PropTypes.node,
|
|
3922
|
+
one: PropTypes.node,
|
|
3923
|
+
two: PropTypes.node,
|
|
3924
|
+
few: PropTypes.node,
|
|
3925
|
+
many: PropTypes.node,
|
|
4392
3926
|
|
|
4393
|
-
children:
|
|
3927
|
+
children: PropTypes.func
|
|
4394
3928
|
});
|
|
4395
3929
|
|
|
4396
3930
|
/*
|
|
@@ -4425,7 +3959,7 @@ var FormattedMessage = function (_Component) {
|
|
|
4425
3959
|
// Since `values` has already been checked, we know they're not
|
|
4426
3960
|
// different, so the current `values` are carried over so the shallow
|
|
4427
3961
|
// equals comparison on the other props isn't affected by the `values`.
|
|
4428
|
-
var nextPropsToCheck =
|
|
3962
|
+
var nextPropsToCheck = _extends({}, nextProps, {
|
|
4429
3963
|
values: values
|
|
4430
3964
|
});
|
|
4431
3965
|
|
|
@@ -4457,42 +3991,40 @@ var FormattedMessage = function (_Component) {
|
|
|
4457
3991
|
|
|
4458
3992
|
var hasValues = values && Object.keys(values).length > 0;
|
|
4459
3993
|
if (hasValues) {
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
var
|
|
4466
|
-
|
|
4467
|
-
return
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
});
|
|
4495
|
-
})();
|
|
3994
|
+
// Creates a token with a random UID that should not be guessable or
|
|
3995
|
+
// conflict with other parts of the `message` string.
|
|
3996
|
+
var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
|
|
3997
|
+
|
|
3998
|
+
var generateToken = function () {
|
|
3999
|
+
var counter = 0;
|
|
4000
|
+
return function () {
|
|
4001
|
+
return 'ELEMENT-' + uid + '-' + (counter += 1);
|
|
4002
|
+
};
|
|
4003
|
+
}();
|
|
4004
|
+
|
|
4005
|
+
// Splitting with a delimiter to support IE8. When using a regex
|
|
4006
|
+
// with a capture group IE8 does not include the capture group in
|
|
4007
|
+
// the resulting array.
|
|
4008
|
+
tokenDelimiter = '@__' + uid + '__@';
|
|
4009
|
+
tokenizedValues = {};
|
|
4010
|
+
elements = {};
|
|
4011
|
+
|
|
4012
|
+
// Iterates over the `props` to keep track of any React Element
|
|
4013
|
+
// values so they can be represented by the `token` as a placeholder
|
|
4014
|
+
// when the `message` is formatted. This allows the formatted
|
|
4015
|
+
// message to then be broken-up into parts with references to the
|
|
4016
|
+
// React Elements inserted back in.
|
|
4017
|
+
Object.keys(values).forEach(function (name) {
|
|
4018
|
+
var value = values[name];
|
|
4019
|
+
|
|
4020
|
+
if (React.isValidElement(value)) {
|
|
4021
|
+
var token = generateToken();
|
|
4022
|
+
tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
|
|
4023
|
+
elements[token] = value;
|
|
4024
|
+
} else {
|
|
4025
|
+
tokenizedValues[name] = value;
|
|
4026
|
+
}
|
|
4027
|
+
});
|
|
4496
4028
|
}
|
|
4497
4029
|
|
|
4498
4030
|
var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
|
|
@@ -4519,11 +4051,9 @@ var FormattedMessage = function (_Component) {
|
|
|
4519
4051
|
return children.apply(undefined, toConsumableArray(nodes));
|
|
4520
4052
|
}
|
|
4521
4053
|
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
nodes
|
|
4526
|
-
);
|
|
4054
|
+
// Needs to use `createElement()` instead of JSX, otherwise React will
|
|
4055
|
+
// warn about a missing `key` prop with rich-text message formatting.
|
|
4056
|
+
return React.createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes)));
|
|
4527
4057
|
}
|
|
4528
4058
|
}]);
|
|
4529
4059
|
return FormattedMessage;
|
|
@@ -4536,10 +4066,10 @@ FormattedMessage.contextTypes = {
|
|
|
4536
4066
|
FormattedMessage.defaultProps = {
|
|
4537
4067
|
values: {}
|
|
4538
4068
|
};
|
|
4539
|
-
FormattedMessage.propTypes =
|
|
4540
|
-
values:
|
|
4541
|
-
tagName:
|
|
4542
|
-
children:
|
|
4069
|
+
FormattedMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
|
|
4070
|
+
values: PropTypes.object,
|
|
4071
|
+
tagName: PropTypes.string,
|
|
4072
|
+
children: PropTypes.func
|
|
4543
4073
|
});
|
|
4544
4074
|
|
|
4545
4075
|
/*
|
|
@@ -4574,7 +4104,7 @@ var FormattedHTMLMessage = function (_Component) {
|
|
|
4574
4104
|
// Since `values` has already been checked, we know they're not
|
|
4575
4105
|
// different, so the current `values` are carried over so the shallow
|
|
4576
4106
|
// equals comparison on the other props isn't affected by the `values`.
|
|
4577
|
-
var nextPropsToCheck =
|
|
4107
|
+
var nextPropsToCheck = _extends({}, nextProps, {
|
|
4578
4108
|
values: values
|
|
4579
4109
|
});
|
|
4580
4110
|
|
|
@@ -4629,10 +4159,10 @@ FormattedHTMLMessage.contextTypes = {
|
|
|
4629
4159
|
FormattedHTMLMessage.defaultProps = {
|
|
4630
4160
|
values: {}
|
|
4631
4161
|
};
|
|
4632
|
-
FormattedHTMLMessage.propTypes =
|
|
4633
|
-
values:
|
|
4634
|
-
tagName:
|
|
4635
|
-
children:
|
|
4162
|
+
FormattedHTMLMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
|
|
4163
|
+
values: PropTypes.object,
|
|
4164
|
+
tagName: PropTypes.string,
|
|
4165
|
+
children: PropTypes.func
|
|
4636
4166
|
});
|
|
4637
4167
|
|
|
4638
4168
|
/*
|