react-intl 2.2.1 → 2.4.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 +1017 -1475
- package/dist/react-intl.js.map +1 -1
- package/dist/react-intl.min.js +1 -2
- package/dist/react-intl.min.js.map +1 -1
- package/lib/index.es.js +983 -1428
- package/lib/index.js +990 -1435
- package/locale-data/af.js +1 -1
- package/locale-data/agq.js +1 -1
- package/locale-data/ak.js +1 -1
- package/locale-data/am.js +1 -1
- package/locale-data/ar.js +1 -1
- package/locale-data/ars.js +1 -0
- package/locale-data/as.js +1 -1
- package/locale-data/asa.js +1 -1
- package/locale-data/ast.js +1 -1
- package/locale-data/az.js +1 -1
- package/locale-data/bas.js +1 -1
- package/locale-data/be.js +1 -1
- package/locale-data/bem.js +1 -1
- package/locale-data/bez.js +1 -1
- package/locale-data/bg.js +1 -1
- package/locale-data/bh.js +1 -1
- package/locale-data/bm.js +1 -1
- package/locale-data/bn.js +1 -1
- package/locale-data/bo.js +1 -1
- package/locale-data/br.js +1 -1
- package/locale-data/brx.js +1 -1
- package/locale-data/bs.js +1 -1
- package/locale-data/ca.js +1 -1
- package/locale-data/ce.js +1 -1
- package/locale-data/cgg.js +1 -1
- package/locale-data/chr.js +1 -1
- package/locale-data/ckb.js +1 -1
- package/locale-data/cs.js +1 -1
- package/locale-data/cu.js +1 -1
- package/locale-data/cy.js +1 -1
- package/locale-data/da.js +1 -1
- package/locale-data/dav.js +1 -1
- package/locale-data/de.js +1 -1
- package/locale-data/dje.js +1 -1
- package/locale-data/dsb.js +1 -1
- package/locale-data/dua.js +1 -1
- package/locale-data/dv.js +1 -1
- package/locale-data/dyo.js +1 -1
- package/locale-data/dz.js +1 -1
- package/locale-data/ebu.js +1 -1
- package/locale-data/ee.js +1 -1
- package/locale-data/el.js +1 -1
- package/locale-data/en.js +1 -1
- package/locale-data/eo.js +1 -1
- package/locale-data/es.js +1 -1
- package/locale-data/et.js +1 -1
- package/locale-data/eu.js +1 -1
- package/locale-data/ewo.js +1 -1
- package/locale-data/fa.js +1 -1
- package/locale-data/ff.js +1 -1
- package/locale-data/fi.js +1 -1
- package/locale-data/fil.js +1 -1
- package/locale-data/fo.js +1 -1
- package/locale-data/fr.js +1 -1
- package/locale-data/fur.js +1 -1
- package/locale-data/fy.js +1 -1
- package/locale-data/ga.js +1 -1
- package/locale-data/gd.js +1 -1
- package/locale-data/gl.js +1 -1
- package/locale-data/gsw.js +1 -1
- package/locale-data/gu.js +1 -1
- package/locale-data/guw.js +1 -1
- package/locale-data/guz.js +1 -1
- package/locale-data/gv.js +1 -1
- package/locale-data/ha.js +1 -1
- package/locale-data/haw.js +1 -1
- package/locale-data/he.js +1 -1
- package/locale-data/hi.js +1 -1
- package/locale-data/hr.js +1 -1
- package/locale-data/hsb.js +1 -1
- package/locale-data/hu.js +1 -1
- package/locale-data/hy.js +1 -1
- package/locale-data/id.js +1 -1
- package/locale-data/ig.js +1 -1
- package/locale-data/ii.js +1 -1
- package/locale-data/in.js +1 -1
- package/locale-data/index.js +1 -10
- package/locale-data/is.js +1 -1
- package/locale-data/it.js +1 -1
- package/locale-data/iu.js +1 -1
- package/locale-data/iw.js +1 -1
- package/locale-data/ja.js +1 -1
- package/locale-data/jbo.js +1 -1
- package/locale-data/jgo.js +1 -1
- package/locale-data/ji.js +1 -1
- package/locale-data/jmc.js +1 -1
- package/locale-data/jv.js +1 -1
- package/locale-data/jw.js +1 -1
- package/locale-data/ka.js +1 -1
- package/locale-data/kab.js +1 -1
- package/locale-data/kaj.js +1 -1
- package/locale-data/kam.js +1 -1
- package/locale-data/kcg.js +1 -1
- package/locale-data/kde.js +1 -1
- package/locale-data/kea.js +1 -1
- package/locale-data/khq.js +1 -1
- package/locale-data/ki.js +1 -1
- package/locale-data/kk.js +1 -1
- package/locale-data/kkj.js +1 -1
- package/locale-data/kl.js +1 -1
- package/locale-data/kln.js +1 -1
- package/locale-data/km.js +1 -1
- package/locale-data/kn.js +1 -1
- package/locale-data/ko.js +1 -1
- package/locale-data/kok.js +1 -1
- package/locale-data/ks.js +1 -1
- package/locale-data/ksb.js +1 -1
- package/locale-data/ksf.js +1 -1
- package/locale-data/ksh.js +1 -1
- package/locale-data/ku.js +1 -1
- package/locale-data/kw.js +1 -1
- package/locale-data/ky.js +1 -1
- package/locale-data/lag.js +1 -1
- package/locale-data/lb.js +1 -1
- package/locale-data/lg.js +1 -1
- package/locale-data/lkt.js +1 -1
- package/locale-data/ln.js +1 -1
- package/locale-data/lo.js +1 -1
- package/locale-data/lrc.js +1 -1
- package/locale-data/lt.js +1 -1
- package/locale-data/lu.js +1 -1
- package/locale-data/luo.js +1 -1
- package/locale-data/luy.js +1 -1
- package/locale-data/lv.js +1 -1
- package/locale-data/mas.js +1 -1
- package/locale-data/mer.js +1 -1
- package/locale-data/mfe.js +1 -1
- package/locale-data/mg.js +1 -1
- package/locale-data/mgh.js +1 -1
- package/locale-data/mgo.js +1 -1
- package/locale-data/mk.js +1 -1
- package/locale-data/ml.js +1 -1
- package/locale-data/mn.js +1 -1
- package/locale-data/mo.js +1 -1
- package/locale-data/mr.js +1 -1
- package/locale-data/ms.js +1 -1
- package/locale-data/mt.js +1 -1
- package/locale-data/mua.js +1 -1
- package/locale-data/my.js +1 -1
- package/locale-data/mzn.js +1 -1
- package/locale-data/nah.js +1 -1
- package/locale-data/naq.js +1 -1
- package/locale-data/nb.js +1 -1
- package/locale-data/nd.js +1 -1
- package/locale-data/nds.js +1 -0
- package/locale-data/ne.js +1 -1
- package/locale-data/nl.js +1 -1
- package/locale-data/nmg.js +1 -1
- package/locale-data/nn.js +1 -1
- package/locale-data/nnh.js +1 -1
- package/locale-data/no.js +1 -1
- package/locale-data/nqo.js +1 -1
- package/locale-data/nr.js +1 -1
- package/locale-data/nso.js +1 -1
- package/locale-data/nus.js +1 -1
- package/locale-data/ny.js +1 -1
- package/locale-data/nyn.js +1 -1
- package/locale-data/om.js +1 -1
- package/locale-data/or.js +1 -1
- package/locale-data/os.js +1 -1
- package/locale-data/pa.js +1 -1
- package/locale-data/pap.js +1 -1
- package/locale-data/pl.js +1 -1
- package/locale-data/prg.js +1 -1
- package/locale-data/ps.js +1 -1
- package/locale-data/pt.js +1 -1
- package/locale-data/qu.js +1 -1
- package/locale-data/rm.js +1 -1
- package/locale-data/rn.js +1 -1
- package/locale-data/ro.js +1 -1
- package/locale-data/rof.js +1 -1
- package/locale-data/ru.js +1 -1
- package/locale-data/rw.js +1 -1
- package/locale-data/rwk.js +1 -1
- package/locale-data/sah.js +1 -1
- package/locale-data/saq.js +1 -1
- package/locale-data/sbp.js +1 -1
- package/locale-data/sdh.js +1 -1
- package/locale-data/se.js +1 -1
- package/locale-data/seh.js +1 -1
- package/locale-data/ses.js +1 -1
- package/locale-data/sg.js +1 -1
- package/locale-data/sh.js +1 -1
- package/locale-data/shi.js +1 -1
- package/locale-data/si.js +1 -1
- package/locale-data/sk.js +1 -1
- package/locale-data/sl.js +1 -1
- package/locale-data/sma.js +1 -1
- package/locale-data/smi.js +1 -1
- package/locale-data/smj.js +1 -1
- package/locale-data/smn.js +1 -1
- package/locale-data/sms.js +1 -1
- package/locale-data/sn.js +1 -1
- package/locale-data/so.js +1 -1
- package/locale-data/sq.js +1 -1
- package/locale-data/sr.js +1 -1
- package/locale-data/ss.js +1 -1
- package/locale-data/ssy.js +1 -1
- package/locale-data/st.js +1 -1
- package/locale-data/sv.js +1 -1
- package/locale-data/sw.js +1 -1
- package/locale-data/syr.js +1 -1
- package/locale-data/ta.js +1 -1
- package/locale-data/te.js +1 -1
- package/locale-data/teo.js +1 -1
- package/locale-data/th.js +1 -1
- package/locale-data/ti.js +1 -1
- package/locale-data/tig.js +1 -1
- package/locale-data/tk.js +1 -1
- package/locale-data/tl.js +1 -1
- package/locale-data/tn.js +1 -1
- package/locale-data/to.js +1 -1
- package/locale-data/tr.js +1 -1
- package/locale-data/ts.js +1 -1
- package/locale-data/twq.js +1 -1
- package/locale-data/tzm.js +1 -1
- package/locale-data/ug.js +1 -1
- package/locale-data/uk.js +1 -1
- package/locale-data/ur.js +1 -1
- package/locale-data/uz.js +1 -1
- package/locale-data/vai.js +1 -1
- package/locale-data/ve.js +1 -1
- package/locale-data/vi.js +1 -1
- package/locale-data/vo.js +1 -1
- package/locale-data/vun.js +1 -1
- package/locale-data/wa.js +1 -1
- package/locale-data/wae.js +1 -1
- package/locale-data/wo.js +1 -1
- package/locale-data/xh.js +1 -1
- package/locale-data/xog.js +1 -1
- package/locale-data/yav.js +1 -1
- package/locale-data/yi.js +1 -1
- package/locale-data/yo.js +1 -1
- package/locale-data/yue.js +1 -0
- package/locale-data/zgh.js +1 -1
- package/locale-data/zh.js +1 -1
- package/locale-data/zu.js +1 -1
- package/package.json +33 -27
- package/src/components/date.js +30 -29
- package/src/components/html-message.js +63 -62
- package/src/components/message.js +117 -114
- package/src/components/number.js +30 -29
- package/src/components/plural.js +37 -36
- package/src/components/provider.js +135 -134
- package/src/components/relative.js +128 -120
- package/src/components/time.js +30 -29
- package/src/define-messages.js +3 -3
- package/src/en.js +1 -1
- package/src/format.js +209 -208
- package/src/inject.js +38 -40
- package/src/locale-data-registry.js +21 -21
- package/src/plural.js +9 -9
- package/src/types.js +58 -48
- package/src/utils.js +65 -55
- package/yarn.lock +4832 -0
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
|
|
@@ -24,7 +25,7 @@ var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralR
|
|
|
24
25
|
t0 = Number(s[0]) == n,
|
|
25
26
|
n10 = t0 && s[0].slice(-1),
|
|
26
27
|
n100 = t0 && s[0].slice(-2);if (ord) return n10 == 1 && n100 != 11 ? "one" : n10 == 2 && n100 != 12 ? "two" : n10 == 3 && n100 != 13 ? "few" : "other";return n == 1 && v0 ? "one" : "other";
|
|
27
|
-
}, "fields": { "year": { "displayName": "year", "relative": { "0": "this year", "1": "next year", "-1": "last year" }, "relativeTime": { "future": { "one": "in {0} year", "other": "in {0} years" }, "past": { "one": "{0} year ago", "other": "{0} years ago" } } }, "month": { "displayName": "month", "relative": { "0": "this month", "1": "next month", "-1": "last month" }, "relativeTime": { "future": { "one": "in {0} month", "other": "in {0} months" }, "past": { "one": "{0} month ago", "other": "{0} months ago" } } }, "day": { "displayName": "day", "relative": { "0": "today", "1": "tomorrow", "-1": "yesterday" }, "relativeTime": { "future": { "one": "in {0} day", "other": "in {0} days" }, "past": { "one": "{0} day ago", "other": "{0} days ago" } } }, "hour": { "displayName": "hour", "relativeTime": { "future": { "one": "in {0} hour", "other": "in {0} hours" }, "past": { "one": "{0} hour ago", "other": "{0} hours ago" } } }, "minute": { "displayName": "minute", "relativeTime": { "future": { "one": "in {0} minute", "other": "in {0} minutes" }, "past": { "one": "{0} minute ago", "other": "{0} minutes ago" } } }, "second": { "displayName": "second", "relative": { "0": "now" }, "relativeTime": { "future": { "one": "in {0} second", "other": "in {0} seconds" }, "past": { "one": "{0} second ago", "other": "{0} seconds ago" } } } } };
|
|
28
|
+
}, "fields": { "year": { "displayName": "year", "relative": { "0": "this year", "1": "next year", "-1": "last year" }, "relativeTime": { "future": { "one": "in {0} year", "other": "in {0} years" }, "past": { "one": "{0} year ago", "other": "{0} years ago" } } }, "month": { "displayName": "month", "relative": { "0": "this month", "1": "next month", "-1": "last month" }, "relativeTime": { "future": { "one": "in {0} month", "other": "in {0} months" }, "past": { "one": "{0} month ago", "other": "{0} months ago" } } }, "day": { "displayName": "day", "relative": { "0": "today", "1": "tomorrow", "-1": "yesterday" }, "relativeTime": { "future": { "one": "in {0} day", "other": "in {0} days" }, "past": { "one": "{0} day ago", "other": "{0} days ago" } } }, "hour": { "displayName": "hour", "relative": { "0": "this hour" }, "relativeTime": { "future": { "one": "in {0} hour", "other": "in {0} hours" }, "past": { "one": "{0} hour ago", "other": "{0} hours ago" } } }, "minute": { "displayName": "minute", "relative": { "0": "this minute" }, "relativeTime": { "future": { "one": "in {0} minute", "other": "in {0} minutes" }, "past": { "one": "{0} minute ago", "other": "{0} minutes ago" } } }, "second": { "displayName": "second", "relative": { "0": "now" }, "relativeTime": { "future": { "one": "in {0} second", "other": "in {0} seconds" }, "past": { "one": "{0} second ago", "other": "{0} seconds ago" } } } } };
|
|
28
29
|
|
|
29
30
|
/*
|
|
30
31
|
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
|
|
@@ -253,7 +254,7 @@ function StringFormat(id) {
|
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
StringFormat.prototype.format = function (value) {
|
|
256
|
-
if (!value) {
|
|
257
|
+
if (!value && typeof value !== 'number') {
|
|
257
258
|
return '';
|
|
258
259
|
}
|
|
259
260
|
|
|
@@ -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;
|
|
@@ -1757,7 +1734,15 @@ function MessageFormat(message, locales, formats) {
|
|
|
1757
1734
|
// the other `Intl` APIs.
|
|
1758
1735
|
var messageFormat = this;
|
|
1759
1736
|
this.format = function (values) {
|
|
1760
|
-
|
|
1737
|
+
try {
|
|
1738
|
+
return messageFormat._format(pattern, values);
|
|
1739
|
+
} catch (e) {
|
|
1740
|
+
if (e.variableId) {
|
|
1741
|
+
throw new Error('The intl string context variable \'' + e.variableId + '\'' + ' was not provided to the string \'' + message + '\'');
|
|
1742
|
+
} else {
|
|
1743
|
+
throw e;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1761
1746
|
};
|
|
1762
1747
|
}
|
|
1763
1748
|
|
|
@@ -1836,7 +1821,7 @@ defineProperty(MessageFormat, 'formats', {
|
|
|
1836
1821
|
|
|
1837
1822
|
// Define internal private properties for dealing with locale data.
|
|
1838
1823
|
defineProperty(MessageFormat, '__localeData__', { value: objCreate(null) });
|
|
1839
|
-
defineProperty(MessageFormat, '__addLocaleData', { value: function
|
|
1824
|
+
defineProperty(MessageFormat, '__addLocaleData', { value: function (data) {
|
|
1840
1825
|
if (!(data && data.locale)) {
|
|
1841
1826
|
throw new Error('Locale data provided to IntlMessageFormat is missing a ' + '`locale` property');
|
|
1842
1827
|
}
|
|
@@ -1890,7 +1875,8 @@ MessageFormat.prototype._format = function (pattern, values) {
|
|
|
1890
1875
|
len,
|
|
1891
1876
|
part,
|
|
1892
1877
|
id,
|
|
1893
|
-
value
|
|
1878
|
+
value,
|
|
1879
|
+
err;
|
|
1894
1880
|
|
|
1895
1881
|
for (i = 0, len = pattern.length; i < len; i += 1) {
|
|
1896
1882
|
part = pattern[i];
|
|
@@ -1905,7 +1891,9 @@ MessageFormat.prototype._format = function (pattern, values) {
|
|
|
1905
1891
|
|
|
1906
1892
|
// Enforce that all required values are provided by the caller.
|
|
1907
1893
|
if (!(values && hop.call(values, id))) {
|
|
1908
|
-
|
|
1894
|
+
err = new Error('A value must be provided for: ' + id);
|
|
1895
|
+
err.variableId = id;
|
|
1896
|
+
throw err;
|
|
1909
1897
|
}
|
|
1910
1898
|
|
|
1911
1899
|
value = values[id];
|
|
@@ -1979,7 +1967,7 @@ MessageFormat.prototype._resolveLocale = function (locales) {
|
|
|
1979
1967
|
};
|
|
1980
1968
|
|
|
1981
1969
|
// GENERATED FILE
|
|
1982
|
-
var defaultLocale = { "locale": "en", "pluralRuleFunction": function
|
|
1970
|
+
var defaultLocale = { "locale": "en", "pluralRuleFunction": function (n, ord) {
|
|
1983
1971
|
var s = String(n).split("."),
|
|
1984
1972
|
v0 = !s[1],
|
|
1985
1973
|
t0 = Number(s[0]) == n,
|
|
@@ -2150,7 +2138,7 @@ function RelativeFormat(locales, options) {
|
|
|
2150
2138
|
|
|
2151
2139
|
// Define internal private properties for dealing with locale data.
|
|
2152
2140
|
defineProperty$1(RelativeFormat, '__localeData__', { value: objCreate$1(null) });
|
|
2153
|
-
defineProperty$1(RelativeFormat, '__addLocaleData', { value: function
|
|
2141
|
+
defineProperty$1(RelativeFormat, '__addLocaleData', { value: function (data) {
|
|
2154
2142
|
if (!(data && data.locale)) {
|
|
2155
2143
|
throw new Error('Locale data provided to IntlRelativeFormat is missing a ' + '`locale` property value');
|
|
2156
2144
|
}
|
|
@@ -2372,7 +2360,7 @@ RelativeFormat.prototype._selectUnits = function (diffReport) {
|
|
|
2372
2360
|
};
|
|
2373
2361
|
|
|
2374
2362
|
// GENERATED FILE
|
|
2375
|
-
var defaultLocale$1 = { "locale": "en", "pluralRuleFunction": function
|
|
2363
|
+
var defaultLocale$1 = { "locale": "en", "pluralRuleFunction": function (n, ord) {
|
|
2376
2364
|
var s = String(n).split("."),
|
|
2377
2365
|
v0 = !s[1],
|
|
2378
2366
|
t0 = Number(s[0]) == n,
|
|
@@ -2392,36 +2380,36 @@ RelativeFormat.defaultLocale = 'en';
|
|
|
2392
2380
|
*/
|
|
2393
2381
|
|
|
2394
2382
|
function addLocaleData() {
|
|
2395
|
-
|
|
2383
|
+
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2396
2384
|
|
|
2397
|
-
|
|
2385
|
+
var locales = Array.isArray(data) ? data : [data];
|
|
2398
2386
|
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2387
|
+
locales.forEach(function (localeData) {
|
|
2388
|
+
if (localeData && localeData.locale) {
|
|
2389
|
+
MessageFormat.__addLocaleData(localeData);
|
|
2390
|
+
RelativeFormat.__addLocaleData(localeData);
|
|
2391
|
+
}
|
|
2392
|
+
});
|
|
2405
2393
|
}
|
|
2406
2394
|
|
|
2407
2395
|
function hasLocaleData(locale) {
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
while (localeParts.length > 0) {
|
|
2411
|
-
if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
|
|
2412
|
-
return true;
|
|
2413
|
-
}
|
|
2396
|
+
var localeParts = (locale || '').split('-');
|
|
2414
2397
|
|
|
2415
|
-
|
|
2398
|
+
while (localeParts.length > 0) {
|
|
2399
|
+
if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
|
|
2400
|
+
return true;
|
|
2416
2401
|
}
|
|
2417
2402
|
|
|
2418
|
-
|
|
2403
|
+
localeParts.pop();
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
return false;
|
|
2419
2407
|
}
|
|
2420
2408
|
|
|
2421
2409
|
function hasIMFAndIRFLocaleData(locale) {
|
|
2422
|
-
|
|
2410
|
+
var normalizedLocale = locale && locale.toLowerCase();
|
|
2423
2411
|
|
|
2424
|
-
|
|
2412
|
+
return !!(MessageFormat.__localeData__[normalizedLocale] && RelativeFormat.__localeData__[normalizedLocale]);
|
|
2425
2413
|
}
|
|
2426
2414
|
|
|
2427
2415
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
@@ -2430,257 +2418,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
|
|
|
2430
2418
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2431
2419
|
};
|
|
2432
2420
|
|
|
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
2421
|
|
|
2439
|
-
if (!props && childrenLength !== 0) {
|
|
2440
|
-
props = {};
|
|
2441
|
-
}
|
|
2442
2422
|
|
|
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
|
-
|
|
2458
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
2459
|
-
childArray[i] = arguments[i + 3];
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
props.children = childArray;
|
|
2463
|
-
}
|
|
2464
|
-
|
|
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
2423
|
|
|
2491
|
-
var asyncGenerator = function () {
|
|
2492
|
-
function AwaitValue(value) {
|
|
2493
|
-
this.value = value;
|
|
2494
|
-
}
|
|
2495
2424
|
|
|
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
2425
|
|
|
2518
|
-
function resume(key, arg) {
|
|
2519
|
-
try {
|
|
2520
|
-
var result = gen[key](arg);
|
|
2521
|
-
var value = result.value;
|
|
2522
2426
|
|
|
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
2427
|
|
|
2546
|
-
case "throw":
|
|
2547
|
-
front.reject(value);
|
|
2548
|
-
break;
|
|
2549
2428
|
|
|
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
|
-
|
|
2643
|
-
return pump("throw", value);
|
|
2644
|
-
};
|
|
2645
|
-
}
|
|
2646
|
-
|
|
2647
|
-
if (typeof inner.return === "function") {
|
|
2648
|
-
iter.return = function (value) {
|
|
2649
|
-
return pump("return", value);
|
|
2650
|
-
};
|
|
2651
|
-
}
|
|
2652
|
-
|
|
2653
|
-
return iter;
|
|
2654
|
-
};
|
|
2655
|
-
|
|
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
|
-
|
|
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
2429
|
|
|
2680
|
-
return step("next");
|
|
2681
|
-
});
|
|
2682
|
-
};
|
|
2683
|
-
};
|
|
2684
2430
|
|
|
2685
2431
|
var classCallCheck = function (instance, Constructor) {
|
|
2686
2432
|
if (!(instance instanceof Constructor)) {
|
|
@@ -2706,31 +2452,9 @@ var createClass = function () {
|
|
|
2706
2452
|
};
|
|
2707
2453
|
}();
|
|
2708
2454
|
|
|
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
2455
|
|
|
2723
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2724
|
-
var key = keys[i];
|
|
2725
|
-
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
|
2726
2456
|
|
|
2727
|
-
if (value && value.configurable && obj[key] === undefined) {
|
|
2728
|
-
Object.defineProperty(obj, key, value);
|
|
2729
|
-
}
|
|
2730
|
-
}
|
|
2731
2457
|
|
|
2732
|
-
return obj;
|
|
2733
|
-
};
|
|
2734
2458
|
|
|
2735
2459
|
var defineProperty$2 = function (obj, key, value) {
|
|
2736
2460
|
if (key in obj) {
|
|
@@ -2761,30 +2485,7 @@ var _extends = Object.assign || function (target) {
|
|
|
2761
2485
|
return target;
|
|
2762
2486
|
};
|
|
2763
2487
|
|
|
2764
|
-
var get = function get(object, property, receiver) {
|
|
2765
|
-
if (object === null) object = Function.prototype;
|
|
2766
|
-
var desc = Object.getOwnPropertyDescriptor(object, property);
|
|
2767
2488
|
|
|
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
2489
|
|
|
2789
2490
|
var inherits = function (subClass, superClass) {
|
|
2790
2491
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -2802,46 +2503,13 @@ var inherits = function (subClass, superClass) {
|
|
|
2802
2503
|
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
2803
2504
|
};
|
|
2804
2505
|
|
|
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
2506
|
|
|
2813
|
-
var interopRequireDefault = function (obj) {
|
|
2814
|
-
return obj && obj.__esModule ? obj : {
|
|
2815
|
-
default: obj
|
|
2816
|
-
};
|
|
2817
|
-
};
|
|
2818
2507
|
|
|
2819
|
-
var interopRequireWildcard = function (obj) {
|
|
2820
|
-
if (obj && obj.__esModule) {
|
|
2821
|
-
return obj;
|
|
2822
|
-
} else {
|
|
2823
|
-
var newObj = {};
|
|
2824
2508
|
|
|
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
2509
|
|
|
2831
|
-
newObj.default = obj;
|
|
2832
|
-
return newObj;
|
|
2833
|
-
}
|
|
2834
|
-
};
|
|
2835
2510
|
|
|
2836
|
-
var newArrowCheck = function (innerThis, boundThis) {
|
|
2837
|
-
if (innerThis !== boundThis) {
|
|
2838
|
-
throw new TypeError("Cannot instantiate an arrow function");
|
|
2839
|
-
}
|
|
2840
|
-
};
|
|
2841
2511
|
|
|
2842
|
-
|
|
2843
|
-
if (obj == null) throw new TypeError("Cannot destructure undefined");
|
|
2844
|
-
};
|
|
2512
|
+
|
|
2845
2513
|
|
|
2846
2514
|
var objectWithoutProperties = function (obj, keys) {
|
|
2847
2515
|
var target = {};
|
|
@@ -2863,112 +2531,23 @@ var possibleConstructorReturn = function (self, call) {
|
|
|
2863
2531
|
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
2864
2532
|
};
|
|
2865
2533
|
|
|
2866
|
-
var selfGlobal = typeof global === "undefined" ? self : global;
|
|
2867
2534
|
|
|
2868
|
-
var set = function set(object, property, value, receiver) {
|
|
2869
|
-
var desc = Object.getOwnPropertyDescriptor(object, property);
|
|
2870
2535
|
|
|
2871
|
-
if (desc === undefined) {
|
|
2872
|
-
var parent = Object.getPrototypeOf(object);
|
|
2873
2536
|
|
|
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
2537
|
|
|
2882
|
-
if (setter !== undefined) {
|
|
2883
|
-
setter.call(receiver, value);
|
|
2884
|
-
}
|
|
2885
|
-
}
|
|
2886
2538
|
|
|
2887
|
-
return value;
|
|
2888
|
-
};
|
|
2889
2539
|
|
|
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
2540
|
|
|
2897
|
-
try {
|
|
2898
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
2899
|
-
_arr.push(_s.value);
|
|
2900
2541
|
|
|
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
2542
|
|
|
2914
|
-
return _arr;
|
|
2915
|
-
}
|
|
2916
2543
|
|
|
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
2544
|
|
|
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
2545
|
|
|
2934
|
-
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
|
2935
|
-
_arr.push(_step.value);
|
|
2936
2546
|
|
|
2937
|
-
if (i && _arr.length === i) break;
|
|
2938
|
-
}
|
|
2939
2547
|
|
|
2940
|
-
return _arr;
|
|
2941
|
-
} else {
|
|
2942
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
2943
|
-
}
|
|
2944
|
-
};
|
|
2945
2548
|
|
|
2946
|
-
var taggedTemplateLiteral = function (strings, raw) {
|
|
2947
|
-
return Object.freeze(Object.defineProperties(strings, {
|
|
2948
|
-
raw: {
|
|
2949
|
-
value: Object.freeze(raw)
|
|
2950
|
-
}
|
|
2951
|
-
}));
|
|
2952
|
-
};
|
|
2953
2549
|
|
|
2954
|
-
var taggedTemplateLiteralLoose = function (strings, raw) {
|
|
2955
|
-
strings.raw = raw;
|
|
2956
|
-
return strings;
|
|
2957
|
-
};
|
|
2958
2550
|
|
|
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
|
-
|
|
2967
|
-
var temporalUndefined = {};
|
|
2968
|
-
|
|
2969
|
-
var toArray = function (arr) {
|
|
2970
|
-
return Array.isArray(arr) ? arr : Array.from(arr);
|
|
2971
|
-
};
|
|
2972
2551
|
|
|
2973
2552
|
var toConsumableArray = function (arr) {
|
|
2974
2553
|
if (Array.isArray(arr)) {
|
|
@@ -2980,56 +2559,21 @@ var toConsumableArray = function (arr) {
|
|
|
2980
2559
|
}
|
|
2981
2560
|
};
|
|
2982
2561
|
|
|
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
2562
|
/*
|
|
3020
2563
|
* Copyright 2015, Yahoo Inc.
|
|
3021
2564
|
* Copyrights licensed under the New BSD License.
|
|
3022
2565
|
* See the accompanying LICENSE file for terms.
|
|
3023
2566
|
*/
|
|
3024
2567
|
|
|
3025
|
-
var bool =
|
|
3026
|
-
var number =
|
|
3027
|
-
var string =
|
|
3028
|
-
var func =
|
|
3029
|
-
var object =
|
|
3030
|
-
var oneOf =
|
|
3031
|
-
var shape =
|
|
3032
|
-
var any =
|
|
2568
|
+
var bool = PropTypes.bool;
|
|
2569
|
+
var number = PropTypes.number;
|
|
2570
|
+
var string = PropTypes.string;
|
|
2571
|
+
var func = PropTypes.func;
|
|
2572
|
+
var object = PropTypes.object;
|
|
2573
|
+
var oneOf = PropTypes.oneOf;
|
|
2574
|
+
var shape = PropTypes.shape;
|
|
2575
|
+
var any = PropTypes.any;
|
|
2576
|
+
var oneOfType = PropTypes.oneOfType;
|
|
3033
2577
|
|
|
3034
2578
|
var localeMatcher = oneOf(['best fit', 'lookup']);
|
|
3035
2579
|
var narrowShortLong = oneOf(['narrow', 'short', 'long']);
|
|
@@ -3037,76 +2581,76 @@ var numeric2digit = oneOf(['numeric', '2-digit']);
|
|
|
3037
2581
|
var funcReq = func.isRequired;
|
|
3038
2582
|
|
|
3039
2583
|
var intlConfigPropTypes = {
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
2584
|
+
locale: string,
|
|
2585
|
+
formats: object,
|
|
2586
|
+
messages: object,
|
|
2587
|
+
textComponent: any,
|
|
3044
2588
|
|
|
3045
|
-
|
|
3046
|
-
|
|
2589
|
+
defaultLocale: string,
|
|
2590
|
+
defaultFormats: object
|
|
3047
2591
|
};
|
|
3048
2592
|
|
|
3049
2593
|
var intlFormatPropTypes = {
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
2594
|
+
formatDate: funcReq,
|
|
2595
|
+
formatTime: funcReq,
|
|
2596
|
+
formatRelative: funcReq,
|
|
2597
|
+
formatNumber: funcReq,
|
|
2598
|
+
formatPlural: funcReq,
|
|
2599
|
+
formatMessage: funcReq,
|
|
2600
|
+
formatHTMLMessage: funcReq
|
|
3057
2601
|
};
|
|
3058
2602
|
|
|
3059
|
-
var intlShape = shape(
|
|
3060
|
-
|
|
3061
|
-
|
|
2603
|
+
var intlShape = shape(_extends({}, intlConfigPropTypes, intlFormatPropTypes, {
|
|
2604
|
+
formatters: object,
|
|
2605
|
+
now: funcReq
|
|
3062
2606
|
}));
|
|
3063
2607
|
|
|
3064
2608
|
var messageDescriptorPropTypes = {
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
2609
|
+
id: string.isRequired,
|
|
2610
|
+
description: oneOfType([string, object]),
|
|
2611
|
+
defaultMessage: string
|
|
3068
2612
|
};
|
|
3069
2613
|
|
|
3070
2614
|
var dateTimeFormatPropTypes = {
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
2615
|
+
localeMatcher: localeMatcher,
|
|
2616
|
+
formatMatcher: oneOf(['basic', 'best fit']),
|
|
2617
|
+
|
|
2618
|
+
timeZone: string,
|
|
2619
|
+
hour12: bool,
|
|
2620
|
+
|
|
2621
|
+
weekday: narrowShortLong,
|
|
2622
|
+
era: narrowShortLong,
|
|
2623
|
+
year: numeric2digit,
|
|
2624
|
+
month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']),
|
|
2625
|
+
day: numeric2digit,
|
|
2626
|
+
hour: numeric2digit,
|
|
2627
|
+
minute: numeric2digit,
|
|
2628
|
+
second: numeric2digit,
|
|
2629
|
+
timeZoneName: oneOf(['short', 'long'])
|
|
3086
2630
|
};
|
|
3087
2631
|
|
|
3088
2632
|
var numberFormatPropTypes = {
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
2633
|
+
localeMatcher: localeMatcher,
|
|
2634
|
+
|
|
2635
|
+
style: oneOf(['decimal', 'currency', 'percent']),
|
|
2636
|
+
currency: string,
|
|
2637
|
+
currencyDisplay: oneOf(['symbol', 'code', 'name']),
|
|
2638
|
+
useGrouping: bool,
|
|
2639
|
+
|
|
2640
|
+
minimumIntegerDigits: number,
|
|
2641
|
+
minimumFractionDigits: number,
|
|
2642
|
+
maximumFractionDigits: number,
|
|
2643
|
+
minimumSignificantDigits: number,
|
|
2644
|
+
maximumSignificantDigits: number
|
|
3101
2645
|
};
|
|
3102
2646
|
|
|
3103
2647
|
var relativeFormatPropTypes = {
|
|
3104
|
-
|
|
3105
|
-
|
|
2648
|
+
style: oneOf(['best fit', 'numeric']),
|
|
2649
|
+
units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year'])
|
|
3106
2650
|
};
|
|
3107
2651
|
|
|
3108
2652
|
var pluralFormatPropTypes = {
|
|
3109
|
-
|
|
2653
|
+
style: oneOf(['cardinal', 'ordinal'])
|
|
3110
2654
|
};
|
|
3111
2655
|
|
|
3112
2656
|
/**
|
|
@@ -3131,7 +2675,7 @@ var pluralFormatPropTypes = {
|
|
|
3131
2675
|
|
|
3132
2676
|
var NODE_ENV = "development";
|
|
3133
2677
|
|
|
3134
|
-
var invariant = function
|
|
2678
|
+
var invariant = function (condition, format, a, b, c, d, e, f) {
|
|
3135
2679
|
if (NODE_ENV !== 'production') {
|
|
3136
2680
|
if (format === undefined) {
|
|
3137
2681
|
throw new Error('invariant requires an error message argument');
|
|
@@ -3172,82 +2716,82 @@ file in the root directory of React's source tree.
|
|
|
3172
2716
|
var intlConfigPropNames = Object.keys(intlConfigPropTypes);
|
|
3173
2717
|
|
|
3174
2718
|
var ESCAPED_CHARS = {
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
2719
|
+
'&': '&',
|
|
2720
|
+
'>': '>',
|
|
2721
|
+
'<': '<',
|
|
2722
|
+
'"': '"',
|
|
2723
|
+
"'": '''
|
|
3180
2724
|
};
|
|
3181
2725
|
|
|
3182
2726
|
var UNSAFE_CHARS_REGEX = /[&><"']/g;
|
|
3183
2727
|
|
|
3184
2728
|
function escape(str) {
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
2729
|
+
return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) {
|
|
2730
|
+
return ESCAPED_CHARS[match];
|
|
2731
|
+
});
|
|
3188
2732
|
}
|
|
3189
2733
|
|
|
3190
2734
|
function filterProps(props, whitelist) {
|
|
3191
|
-
|
|
2735
|
+
var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
3192
2736
|
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
2737
|
+
return whitelist.reduce(function (filtered, name) {
|
|
2738
|
+
if (props.hasOwnProperty(name)) {
|
|
2739
|
+
filtered[name] = props[name];
|
|
2740
|
+
} else if (defaults$$1.hasOwnProperty(name)) {
|
|
2741
|
+
filtered[name] = defaults$$1[name];
|
|
2742
|
+
}
|
|
3199
2743
|
|
|
3200
|
-
|
|
3201
|
-
|
|
2744
|
+
return filtered;
|
|
2745
|
+
}, {});
|
|
3202
2746
|
}
|
|
3203
2747
|
|
|
3204
2748
|
function invariantIntlContext() {
|
|
3205
|
-
|
|
3206
|
-
|
|
2749
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
2750
|
+
intl = _ref.intl;
|
|
3207
2751
|
|
|
3208
|
-
|
|
2752
|
+
invariant_1(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.');
|
|
3209
2753
|
}
|
|
3210
2754
|
|
|
3211
2755
|
function shallowEquals(objA, objB) {
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
2756
|
+
if (objA === objB) {
|
|
2757
|
+
return true;
|
|
2758
|
+
}
|
|
3215
2759
|
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
2760
|
+
if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
|
|
2761
|
+
return false;
|
|
2762
|
+
}
|
|
3219
2763
|
|
|
3220
|
-
|
|
3221
|
-
|
|
2764
|
+
var keysA = Object.keys(objA);
|
|
2765
|
+
var keysB = Object.keys(objB);
|
|
3222
2766
|
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
2767
|
+
if (keysA.length !== keysB.length) {
|
|
2768
|
+
return false;
|
|
2769
|
+
}
|
|
3226
2770
|
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
}
|
|
2771
|
+
// Test for A's keys different from B.
|
|
2772
|
+
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
|
2773
|
+
for (var i = 0; i < keysA.length; i++) {
|
|
2774
|
+
if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
|
|
2775
|
+
return false;
|
|
3233
2776
|
}
|
|
2777
|
+
}
|
|
3234
2778
|
|
|
3235
|
-
|
|
2779
|
+
return true;
|
|
3236
2780
|
}
|
|
3237
2781
|
|
|
3238
2782
|
function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
2783
|
+
var props = _ref2.props,
|
|
2784
|
+
state = _ref2.state,
|
|
2785
|
+
_ref2$context = _ref2.context,
|
|
2786
|
+
context = _ref2$context === undefined ? {} : _ref2$context;
|
|
2787
|
+
var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
2788
|
+
var _context$intl = context.intl,
|
|
2789
|
+
intl = _context$intl === undefined ? {} : _context$intl;
|
|
2790
|
+
var _nextContext$intl = nextContext.intl,
|
|
2791
|
+
nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl;
|
|
2792
|
+
|
|
2793
|
+
|
|
2794
|
+
return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)));
|
|
3251
2795
|
}
|
|
3252
2796
|
|
|
3253
2797
|
/*
|
|
@@ -3260,54 +2804,54 @@ function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
|
|
|
3260
2804
|
// https://github.com/rackt/react-redux
|
|
3261
2805
|
|
|
3262
2806
|
function getDisplayName(Component$$1) {
|
|
3263
|
-
|
|
2807
|
+
return Component$$1.displayName || Component$$1.name || 'Component';
|
|
3264
2808
|
}
|
|
3265
2809
|
|
|
3266
2810
|
function injectIntl(WrappedComponent) {
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
2811
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2812
|
+
var _options$intlPropName = options.intlPropName,
|
|
2813
|
+
intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName,
|
|
2814
|
+
_options$withRef = options.withRef,
|
|
2815
|
+
withRef = _options$withRef === undefined ? false : _options$withRef;
|
|
3272
2816
|
|
|
3273
|
-
|
|
3274
|
-
|
|
2817
|
+
var InjectIntl = function (_Component) {
|
|
2818
|
+
inherits(InjectIntl, _Component);
|
|
3275
2819
|
|
|
3276
|
-
|
|
3277
|
-
|
|
2820
|
+
function InjectIntl(props, context) {
|
|
2821
|
+
classCallCheck(this, InjectIntl);
|
|
3278
2822
|
|
|
3279
|
-
|
|
2823
|
+
var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context));
|
|
3280
2824
|
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
2825
|
+
invariantIntlContext(context);
|
|
2826
|
+
return _this;
|
|
2827
|
+
}
|
|
3284
2828
|
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
2829
|
+
createClass(InjectIntl, [{
|
|
2830
|
+
key: 'getWrappedInstance',
|
|
2831
|
+
value: function getWrappedInstance() {
|
|
2832
|
+
invariant_1(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`');
|
|
3289
2833
|
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
2834
|
+
return this.refs.wrappedInstance;
|
|
2835
|
+
}
|
|
2836
|
+
}, {
|
|
2837
|
+
key: 'render',
|
|
2838
|
+
value: function render() {
|
|
2839
|
+
return React__default.createElement(WrappedComponent, _extends({}, this.props, defineProperty$2({}, intlPropName, this.context.intl), {
|
|
2840
|
+
ref: withRef ? 'wrappedInstance' : null
|
|
2841
|
+
}));
|
|
2842
|
+
}
|
|
2843
|
+
}]);
|
|
2844
|
+
return InjectIntl;
|
|
2845
|
+
}(React.Component);
|
|
3302
2846
|
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
2847
|
+
InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')';
|
|
2848
|
+
InjectIntl.contextTypes = {
|
|
2849
|
+
intl: intlShape
|
|
2850
|
+
};
|
|
2851
|
+
InjectIntl.WrappedComponent = WrappedComponent;
|
|
3308
2852
|
|
|
3309
2853
|
|
|
3310
|
-
|
|
2854
|
+
return InjectIntl;
|
|
3311
2855
|
}
|
|
3312
2856
|
|
|
3313
2857
|
/*
|
|
@@ -3331,25 +2875,25 @@ function defineMessages(messageDescriptors) {
|
|
|
3331
2875
|
// This is a "hack" until a proper `intl-pluralformat` package is created.
|
|
3332
2876
|
|
|
3333
2877
|
function resolveLocale(locales) {
|
|
3334
|
-
|
|
3335
|
-
|
|
2878
|
+
// IntlMessageFormat#_resolveLocale() does not depend on `this`.
|
|
2879
|
+
return MessageFormat.prototype._resolveLocale(locales);
|
|
3336
2880
|
}
|
|
3337
2881
|
|
|
3338
2882
|
function findPluralFunction(locale) {
|
|
3339
|
-
|
|
3340
|
-
|
|
2883
|
+
// IntlMessageFormat#_findPluralFunction() does not depend on `this`.
|
|
2884
|
+
return MessageFormat.prototype._findPluralRuleFunction(locale);
|
|
3341
2885
|
}
|
|
3342
2886
|
|
|
3343
2887
|
var IntlPluralFormat = function IntlPluralFormat(locales) {
|
|
3344
|
-
|
|
3345
|
-
|
|
2888
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2889
|
+
classCallCheck(this, IntlPluralFormat);
|
|
3346
2890
|
|
|
3347
|
-
|
|
3348
|
-
|
|
2891
|
+
var useOrdinal = options.style === 'ordinal';
|
|
2892
|
+
var pluralFn = findPluralFunction(resolveLocale(locales));
|
|
3349
2893
|
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
2894
|
+
this.format = function (value) {
|
|
2895
|
+
return pluralFn(value, useOrdinal);
|
|
2896
|
+
};
|
|
3353
2897
|
};
|
|
3354
2898
|
|
|
3355
2899
|
/*
|
|
@@ -3372,8 +2916,8 @@ var bind = Function.prototype.bind || function (oThis) {
|
|
|
3372
2916
|
|
|
3373
2917
|
var aArgs = Array.prototype.slice.call(arguments, 1),
|
|
3374
2918
|
fToBind = this,
|
|
3375
|
-
fNOP = function
|
|
3376
|
-
fBound = function
|
|
2919
|
+
fNOP = function () {},
|
|
2920
|
+
fBound = function () {
|
|
3377
2921
|
return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
|
|
3378
2922
|
};
|
|
3379
2923
|
|
|
@@ -3469,7 +3013,7 @@ function getCacheId(inputs) {
|
|
|
3469
3013
|
for (i = 0, len = inputs.length; i < len; i += 1) {
|
|
3470
3014
|
input = inputs[i];
|
|
3471
3015
|
|
|
3472
|
-
if (input &&
|
|
3016
|
+
if (input && typeof input === 'object') {
|
|
3473
3017
|
cacheId.push(orderedProps(input));
|
|
3474
3018
|
} else {
|
|
3475
3019
|
cacheId.push(input);
|
|
@@ -3516,234 +3060,234 @@ var RELATIVE_FORMAT_OPTIONS = Object.keys(relativeFormatPropTypes);
|
|
|
3516
3060
|
var PLURAL_FORMAT_OPTIONS = Object.keys(pluralFormatPropTypes);
|
|
3517
3061
|
|
|
3518
3062
|
var RELATIVE_FORMAT_THRESHOLDS = {
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3063
|
+
second: 60, // seconds to minute
|
|
3064
|
+
minute: 60, // minutes to hour
|
|
3065
|
+
hour: 24, // hours to day
|
|
3066
|
+
day: 30, // days to month
|
|
3067
|
+
month: 12 // months to year
|
|
3068
|
+
};
|
|
3524
3069
|
|
|
3525
3070
|
function updateRelativeFormatThresholds(newThresholds) {
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3071
|
+
var thresholds = RelativeFormat.thresholds;
|
|
3072
|
+
thresholds.second = newThresholds.second;
|
|
3073
|
+
thresholds.minute = newThresholds.minute;
|
|
3074
|
+
thresholds.hour = newThresholds.hour;
|
|
3075
|
+
thresholds.day = newThresholds.day;
|
|
3076
|
+
thresholds.month = newThresholds.month;
|
|
3532
3077
|
}
|
|
3533
3078
|
|
|
3534
3079
|
function getNamedFormat(formats, type, name) {
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3080
|
+
var format = formats && formats[type] && formats[type][name];
|
|
3081
|
+
if (format) {
|
|
3082
|
+
return format;
|
|
3083
|
+
}
|
|
3539
3084
|
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3085
|
+
{
|
|
3086
|
+
console.error('[React Intl] No ' + type + ' format named: ' + name);
|
|
3087
|
+
}
|
|
3543
3088
|
}
|
|
3544
3089
|
|
|
3545
3090
|
function formatDate(config, state, value) {
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3091
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3092
|
+
var locale = config.locale,
|
|
3093
|
+
formats = config.formats;
|
|
3094
|
+
var format = options.format;
|
|
3550
3095
|
|
|
3551
3096
|
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3097
|
+
var date = new Date(value);
|
|
3098
|
+
var defaults$$1 = format && getNamedFormat(formats, 'date', format);
|
|
3099
|
+
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
|
|
3555
3100
|
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
}
|
|
3101
|
+
try {
|
|
3102
|
+
return state.getDateTimeFormat(locale, filteredOptions).format(date);
|
|
3103
|
+
} catch (e) {
|
|
3104
|
+
{
|
|
3105
|
+
console.error('[React Intl] Error formatting date.\n' + e);
|
|
3562
3106
|
}
|
|
3107
|
+
}
|
|
3563
3108
|
|
|
3564
|
-
|
|
3109
|
+
return String(date);
|
|
3565
3110
|
}
|
|
3566
3111
|
|
|
3567
3112
|
function formatTime(config, state, value) {
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3113
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3114
|
+
var locale = config.locale,
|
|
3115
|
+
formats = config.formats;
|
|
3116
|
+
var format = options.format;
|
|
3572
3117
|
|
|
3573
3118
|
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3119
|
+
var date = new Date(value);
|
|
3120
|
+
var defaults$$1 = format && getNamedFormat(formats, 'time', format);
|
|
3121
|
+
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
|
|
3577
3122
|
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3123
|
+
if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
|
|
3124
|
+
// Add default formatting options if hour, minute, or second isn't defined.
|
|
3125
|
+
filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
|
|
3126
|
+
}
|
|
3582
3127
|
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
}
|
|
3128
|
+
try {
|
|
3129
|
+
return state.getDateTimeFormat(locale, filteredOptions).format(date);
|
|
3130
|
+
} catch (e) {
|
|
3131
|
+
{
|
|
3132
|
+
console.error('[React Intl] Error formatting time.\n' + e);
|
|
3589
3133
|
}
|
|
3134
|
+
}
|
|
3590
3135
|
|
|
3591
|
-
|
|
3136
|
+
return String(date);
|
|
3592
3137
|
}
|
|
3593
3138
|
|
|
3594
3139
|
function formatRelative(config, state, value) {
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3140
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3141
|
+
var locale = config.locale,
|
|
3142
|
+
formats = config.formats;
|
|
3143
|
+
var format = options.format;
|
|
3599
3144
|
|
|
3600
3145
|
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3146
|
+
var date = new Date(value);
|
|
3147
|
+
var now = new Date(options.now);
|
|
3148
|
+
var defaults$$1 = format && getNamedFormat(formats, 'relative', format);
|
|
3149
|
+
var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1);
|
|
3605
3150
|
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3151
|
+
// Capture the current threshold values, then temporarily override them with
|
|
3152
|
+
// specific values just for this render.
|
|
3153
|
+
var oldThresholds = _extends({}, RelativeFormat.thresholds);
|
|
3154
|
+
updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
|
|
3610
3155
|
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
}
|
|
3619
|
-
} finally {
|
|
3620
|
-
updateRelativeFormatThresholds(oldThresholds);
|
|
3156
|
+
try {
|
|
3157
|
+
return state.getRelativeFormat(locale, filteredOptions).format(date, {
|
|
3158
|
+
now: isFinite(now) ? now : state.now()
|
|
3159
|
+
});
|
|
3160
|
+
} catch (e) {
|
|
3161
|
+
{
|
|
3162
|
+
console.error('[React Intl] Error formatting relative time.\n' + e);
|
|
3621
3163
|
}
|
|
3164
|
+
} finally {
|
|
3165
|
+
updateRelativeFormatThresholds(oldThresholds);
|
|
3166
|
+
}
|
|
3622
3167
|
|
|
3623
|
-
|
|
3168
|
+
return String(date);
|
|
3624
3169
|
}
|
|
3625
3170
|
|
|
3626
3171
|
function formatNumber(config, state, value) {
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3172
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3173
|
+
var locale = config.locale,
|
|
3174
|
+
formats = config.formats;
|
|
3175
|
+
var format = options.format;
|
|
3631
3176
|
|
|
3632
3177
|
|
|
3633
|
-
|
|
3634
|
-
|
|
3178
|
+
var defaults$$1 = format && getNamedFormat(formats, 'number', format);
|
|
3179
|
+
var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1);
|
|
3635
3180
|
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
}
|
|
3181
|
+
try {
|
|
3182
|
+
return state.getNumberFormat(locale, filteredOptions).format(value);
|
|
3183
|
+
} catch (e) {
|
|
3184
|
+
{
|
|
3185
|
+
console.error('[React Intl] Error formatting number.\n' + e);
|
|
3642
3186
|
}
|
|
3187
|
+
}
|
|
3643
3188
|
|
|
3644
|
-
|
|
3189
|
+
return String(value);
|
|
3645
3190
|
}
|
|
3646
3191
|
|
|
3647
3192
|
function formatPlural(config, state, value) {
|
|
3648
|
-
|
|
3649
|
-
|
|
3193
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3194
|
+
var locale = config.locale;
|
|
3650
3195
|
|
|
3651
3196
|
|
|
3652
|
-
|
|
3197
|
+
var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);
|
|
3653
3198
|
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
}
|
|
3199
|
+
try {
|
|
3200
|
+
return state.getPluralFormat(locale, filteredOptions).format(value);
|
|
3201
|
+
} catch (e) {
|
|
3202
|
+
{
|
|
3203
|
+
console.error('[React Intl] Error formatting plural.\n' + e);
|
|
3660
3204
|
}
|
|
3205
|
+
}
|
|
3661
3206
|
|
|
3662
|
-
|
|
3207
|
+
return 'other';
|
|
3663
3208
|
}
|
|
3664
3209
|
|
|
3665
3210
|
function formatMessage(config, state) {
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
var formattedMessage = void 0;
|
|
3211
|
+
var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
3212
|
+
var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3213
|
+
var locale = config.locale,
|
|
3214
|
+
formats = config.formats,
|
|
3215
|
+
messages = config.messages,
|
|
3216
|
+
defaultLocale = config.defaultLocale,
|
|
3217
|
+
defaultFormats = config.defaultFormats;
|
|
3218
|
+
var id = messageDescriptor.id,
|
|
3219
|
+
defaultMessage = messageDescriptor.defaultMessage;
|
|
3220
|
+
|
|
3221
|
+
// `id` is a required field of a Message Descriptor.
|
|
3222
|
+
|
|
3223
|
+
invariant_1(id, '[React Intl] An `id` must be provided to format a message.');
|
|
3224
|
+
|
|
3225
|
+
var message = messages && messages[id];
|
|
3226
|
+
var hasValues = Object.keys(values).length > 0;
|
|
3227
|
+
|
|
3228
|
+
// Avoid expensive message formatting for simple messages without values. In
|
|
3229
|
+
// development messages will always be formatted in case of missing values.
|
|
3230
|
+
if (!hasValues && "development" === 'production') {
|
|
3231
|
+
return message || defaultMessage || id;
|
|
3232
|
+
}
|
|
3690
3233
|
|
|
3691
|
-
|
|
3692
|
-
try {
|
|
3693
|
-
var formatter = state.getMessageFormat(message, locale, formats);
|
|
3234
|
+
var formattedMessage = void 0;
|
|
3694
3235
|
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
|
|
3699
|
-
}
|
|
3700
|
-
}
|
|
3701
|
-
} else {
|
|
3702
|
-
{
|
|
3703
|
-
// This prevents warnings from littering the console in development
|
|
3704
|
-
// when no `messages` are passed into the <IntlProvider> for the
|
|
3705
|
-
// default locale, and a default message is in the source.
|
|
3706
|
-
if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
|
|
3236
|
+
if (message) {
|
|
3237
|
+
try {
|
|
3238
|
+
var formatter = state.getMessageFormat(message, locale, formats);
|
|
3707
3239
|
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3240
|
+
formattedMessage = formatter.format(values);
|
|
3241
|
+
} catch (e) {
|
|
3242
|
+
{
|
|
3243
|
+
console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
|
|
3244
|
+
}
|
|
3711
3245
|
}
|
|
3246
|
+
} else {
|
|
3247
|
+
{
|
|
3248
|
+
// This prevents warnings from littering the console in development
|
|
3249
|
+
// when no `messages` are passed into the <IntlProvider> for the
|
|
3250
|
+
// default locale, and a default message is in the source.
|
|
3251
|
+
if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
|
|
3252
|
+
console.error('[React Intl] Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''));
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3712
3256
|
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3257
|
+
if (!formattedMessage && defaultMessage) {
|
|
3258
|
+
try {
|
|
3259
|
+
var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats);
|
|
3716
3260
|
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
}
|
|
3261
|
+
formattedMessage = _formatter.format(values);
|
|
3262
|
+
} catch (e) {
|
|
3263
|
+
{
|
|
3264
|
+
console.error('[React Intl] Error formatting the default message for: "' + id + '"' + ('\n' + e));
|
|
3265
|
+
}
|
|
3723
3266
|
}
|
|
3267
|
+
}
|
|
3724
3268
|
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
}
|
|
3269
|
+
if (!formattedMessage) {
|
|
3270
|
+
{
|
|
3271
|
+
console.error('[React Intl] Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'));
|
|
3729
3272
|
}
|
|
3273
|
+
}
|
|
3730
3274
|
|
|
3731
|
-
|
|
3275
|
+
return formattedMessage || message || defaultMessage || id;
|
|
3732
3276
|
}
|
|
3733
3277
|
|
|
3734
3278
|
function formatHTMLMessage(config, state, messageDescriptor) {
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3279
|
+
var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3280
|
+
|
|
3281
|
+
// Process all the values before they are used when formatting the ICU
|
|
3282
|
+
// Message string. Since the formatted message might be injected via
|
|
3283
|
+
// `innerHTML`, all String-based values need to be HTML-escaped.
|
|
3284
|
+
var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) {
|
|
3285
|
+
var value = rawValues[name];
|
|
3286
|
+
escaped[name] = typeof value === 'string' ? escape(value) : value;
|
|
3287
|
+
return escaped;
|
|
3288
|
+
}, {});
|
|
3289
|
+
|
|
3290
|
+
return formatMessage(config, state, messageDescriptor, escapedValues);
|
|
3747
3291
|
}
|
|
3748
3292
|
|
|
3749
3293
|
|
|
@@ -3770,170 +3314,170 @@ var intlFormatPropNames = Object.keys(intlFormatPropTypes);
|
|
|
3770
3314
|
// These are not a static property on the `IntlProvider` class so the intl
|
|
3771
3315
|
// config values can be inherited from an <IntlProvider> ancestor.
|
|
3772
3316
|
var defaultProps = {
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3317
|
+
formats: {},
|
|
3318
|
+
messages: {},
|
|
3319
|
+
textComponent: 'span',
|
|
3776
3320
|
|
|
3777
|
-
|
|
3778
|
-
|
|
3321
|
+
defaultLocale: 'en',
|
|
3322
|
+
defaultFormats: {}
|
|
3779
3323
|
};
|
|
3780
3324
|
|
|
3781
3325
|
var IntlProvider = function (_Component) {
|
|
3782
|
-
|
|
3326
|
+
inherits(IntlProvider, _Component);
|
|
3783
3327
|
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3328
|
+
function IntlProvider(props) {
|
|
3329
|
+
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3330
|
+
classCallCheck(this, IntlProvider);
|
|
3787
3331
|
|
|
3788
|
-
|
|
3332
|
+
var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context));
|
|
3789
3333
|
|
|
3790
|
-
|
|
3334
|
+
invariant_1(typeof Intl !== 'undefined', '[React Intl] The `Intl` APIs must be available in the runtime, ' + 'and do not appear to be built-in. An `Intl` polyfill should be loaded.\n' + 'See: http://formatjs.io/guides/runtime-environments/');
|
|
3791
3335
|
|
|
3792
|
-
|
|
3336
|
+
var intlContext = context.intl;
|
|
3793
3337
|
|
|
3794
|
-
|
|
3795
|
-
|
|
3338
|
+
// Used to stabilize time when performing an initial rendering so that
|
|
3339
|
+
// all relative times use the same reference "now" time.
|
|
3796
3340
|
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3341
|
+
var initialNow = void 0;
|
|
3342
|
+
if (isFinite(props.initialNow)) {
|
|
3343
|
+
initialNow = Number(props.initialNow);
|
|
3344
|
+
} else {
|
|
3345
|
+
// When an `initialNow` isn't provided via `props`, look to see an
|
|
3346
|
+
// <IntlProvider> exists in the ancestry and call its `now()`
|
|
3347
|
+
// function to propagate its value for "now".
|
|
3348
|
+
initialNow = intlContext ? intlContext.now() : Date.now();
|
|
3349
|
+
}
|
|
3350
|
+
|
|
3351
|
+
// Creating `Intl*` formatters is expensive. If there's a parent
|
|
3352
|
+
// `<IntlProvider>`, then its formatters will be used. Otherwise, this
|
|
3353
|
+
// memoize the `Intl*` constructors and cache them for the lifecycle of
|
|
3354
|
+
// this IntlProvider instance.
|
|
3355
|
+
|
|
3356
|
+
var _ref = intlContext || {},
|
|
3357
|
+
_ref$formatters = _ref.formatters,
|
|
3358
|
+
formatters = _ref$formatters === undefined ? {
|
|
3359
|
+
getDateTimeFormat: createFormatCache(Intl.DateTimeFormat),
|
|
3360
|
+
getNumberFormat: createFormatCache(Intl.NumberFormat),
|
|
3361
|
+
getMessageFormat: createFormatCache(MessageFormat),
|
|
3362
|
+
getRelativeFormat: createFormatCache(RelativeFormat),
|
|
3363
|
+
getPluralFormat: createFormatCache(IntlPluralFormat)
|
|
3364
|
+
} : _ref$formatters;
|
|
3365
|
+
|
|
3366
|
+
_this.state = _extends({}, formatters, {
|
|
3367
|
+
|
|
3368
|
+
// Wrapper to provide stable "now" time for initial render.
|
|
3369
|
+
now: function now() {
|
|
3370
|
+
return _this._didDisplay ? Date.now() : initialNow;
|
|
3371
|
+
}
|
|
3372
|
+
});
|
|
3373
|
+
return _this;
|
|
3374
|
+
}
|
|
3831
3375
|
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3376
|
+
createClass(IntlProvider, [{
|
|
3377
|
+
key: 'getConfig',
|
|
3378
|
+
value: function getConfig() {
|
|
3379
|
+
var intlContext = this.context.intl;
|
|
3836
3380
|
|
|
3837
|
-
|
|
3838
|
-
|
|
3381
|
+
// Build a whitelisted config object from `props`, defaults, and
|
|
3382
|
+
// `context.intl`, if an <IntlProvider> exists in the ancestry.
|
|
3839
3383
|
|
|
3840
|
-
|
|
3384
|
+
var config = filterProps(this.props, intlConfigPropNames$1, intlContext);
|
|
3841
3385
|
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3386
|
+
// Apply default props. This must be applied last after the props have
|
|
3387
|
+
// been resolved and inherited from any <IntlProvider> in the ancestry.
|
|
3388
|
+
// This matches how React resolves `defaultProps`.
|
|
3389
|
+
for (var propName in defaultProps) {
|
|
3390
|
+
if (config[propName] === undefined) {
|
|
3391
|
+
config[propName] = defaultProps[propName];
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3850
3394
|
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3395
|
+
if (!hasLocaleData(config.locale)) {
|
|
3396
|
+
var _config = config,
|
|
3397
|
+
locale = _config.locale,
|
|
3398
|
+
defaultLocale = _config.defaultLocale,
|
|
3399
|
+
defaultFormats = _config.defaultFormats;
|
|
3856
3400
|
|
|
3857
3401
|
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3402
|
+
{
|
|
3403
|
+
console.error('[React Intl] Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'));
|
|
3404
|
+
}
|
|
3861
3405
|
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3406
|
+
// Since there's no registered locale data for `locale`, this will
|
|
3407
|
+
// fallback to the `defaultLocale` to make sure things can render.
|
|
3408
|
+
// The `messages` are overridden to the `defaultProps` empty object
|
|
3409
|
+
// to maintain referential equality across re-renders. It's assumed
|
|
3410
|
+
// each <FormattedMessage> contains a `defaultMessage` prop.
|
|
3411
|
+
config = _extends({}, config, {
|
|
3412
|
+
locale: defaultLocale,
|
|
3413
|
+
formats: defaultFormats,
|
|
3414
|
+
messages: defaultProps.messages
|
|
3415
|
+
});
|
|
3416
|
+
}
|
|
3873
3417
|
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3418
|
+
return config;
|
|
3419
|
+
}
|
|
3420
|
+
}, {
|
|
3421
|
+
key: 'getBoundFormatFns',
|
|
3422
|
+
value: function getBoundFormatFns(config, state) {
|
|
3423
|
+
return intlFormatPropNames.reduce(function (boundFormatFns, name) {
|
|
3424
|
+
boundFormatFns[name] = format[name].bind(null, config, state);
|
|
3425
|
+
return boundFormatFns;
|
|
3426
|
+
}, {});
|
|
3427
|
+
}
|
|
3428
|
+
}, {
|
|
3429
|
+
key: 'getChildContext',
|
|
3430
|
+
value: function getChildContext() {
|
|
3431
|
+
var config = this.getConfig();
|
|
3888
3432
|
|
|
3889
|
-
|
|
3890
|
-
|
|
3433
|
+
// Bind intl factories and current config to the format functions.
|
|
3434
|
+
var boundFormatFns = this.getBoundFormatFns(config, this.state);
|
|
3891
3435
|
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3436
|
+
var _state = this.state,
|
|
3437
|
+
now = _state.now,
|
|
3438
|
+
formatters = objectWithoutProperties(_state, ['now']);
|
|
3895
3439
|
|
|
3896
3440
|
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3441
|
+
return {
|
|
3442
|
+
intl: _extends({}, config, boundFormatFns, {
|
|
3443
|
+
formatters: formatters,
|
|
3444
|
+
now: now
|
|
3445
|
+
})
|
|
3446
|
+
};
|
|
3447
|
+
}
|
|
3448
|
+
}, {
|
|
3449
|
+
key: 'shouldComponentUpdate',
|
|
3450
|
+
value: function shouldComponentUpdate() {
|
|
3451
|
+
for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3452
|
+
next[_key] = arguments[_key];
|
|
3453
|
+
}
|
|
3910
3454
|
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3455
|
+
return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
|
|
3456
|
+
}
|
|
3457
|
+
}, {
|
|
3458
|
+
key: 'componentDidMount',
|
|
3459
|
+
value: function componentDidMount() {
|
|
3460
|
+
this._didDisplay = true;
|
|
3461
|
+
}
|
|
3462
|
+
}, {
|
|
3463
|
+
key: 'render',
|
|
3464
|
+
value: function render() {
|
|
3465
|
+
return React.Children.only(this.props.children);
|
|
3466
|
+
}
|
|
3467
|
+
}]);
|
|
3468
|
+
return IntlProvider;
|
|
3925
3469
|
}(React.Component);
|
|
3926
3470
|
|
|
3927
3471
|
IntlProvider.displayName = 'IntlProvider';
|
|
3928
3472
|
IntlProvider.contextTypes = {
|
|
3929
|
-
|
|
3473
|
+
intl: intlShape
|
|
3930
3474
|
};
|
|
3931
3475
|
IntlProvider.childContextTypes = {
|
|
3932
|
-
|
|
3476
|
+
intl: intlShape.isRequired
|
|
3933
3477
|
};
|
|
3934
|
-
IntlProvider.propTypes =
|
|
3935
|
-
|
|
3936
|
-
|
|
3478
|
+
IntlProvider.propTypes = _extends({}, intlConfigPropTypes, {
|
|
3479
|
+
children: PropTypes.element.isRequired,
|
|
3480
|
+
initialNow: PropTypes.any
|
|
3937
3481
|
});
|
|
3938
3482
|
|
|
3939
3483
|
/*
|
|
@@ -3943,61 +3487,61 @@ IntlProvider.propTypes = babelHelpers$1['extends']({}, intlConfigPropTypes, {
|
|
|
3943
3487
|
*/
|
|
3944
3488
|
|
|
3945
3489
|
var FormattedDate = function (_Component) {
|
|
3946
|
-
|
|
3490
|
+
inherits(FormattedDate, _Component);
|
|
3947
3491
|
|
|
3948
|
-
|
|
3949
|
-
|
|
3492
|
+
function FormattedDate(props, context) {
|
|
3493
|
+
classCallCheck(this, FormattedDate);
|
|
3950
3494
|
|
|
3951
|
-
|
|
3495
|
+
var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context));
|
|
3952
3496
|
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3497
|
+
invariantIntlContext(context);
|
|
3498
|
+
return _this;
|
|
3499
|
+
}
|
|
3956
3500
|
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3501
|
+
createClass(FormattedDate, [{
|
|
3502
|
+
key: 'shouldComponentUpdate',
|
|
3503
|
+
value: function shouldComponentUpdate() {
|
|
3504
|
+
for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3505
|
+
next[_key] = arguments[_key];
|
|
3506
|
+
}
|
|
3963
3507
|
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3508
|
+
return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
|
|
3509
|
+
}
|
|
3510
|
+
}, {
|
|
3511
|
+
key: 'render',
|
|
3512
|
+
value: function render() {
|
|
3513
|
+
var _context$intl = this.context.intl,
|
|
3514
|
+
formatDate = _context$intl.formatDate,
|
|
3515
|
+
Text = _context$intl.textComponent;
|
|
3516
|
+
var _props = this.props,
|
|
3517
|
+
value = _props.value,
|
|
3518
|
+
children = _props.children;
|
|
3975
3519
|
|
|
3976
3520
|
|
|
3977
|
-
|
|
3521
|
+
var formattedDate = formatDate(value, this.props);
|
|
3978
3522
|
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3523
|
+
if (typeof children === 'function') {
|
|
3524
|
+
return children(formattedDate);
|
|
3525
|
+
}
|
|
3982
3526
|
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3527
|
+
return React__default.createElement(
|
|
3528
|
+
Text,
|
|
3529
|
+
null,
|
|
3530
|
+
formattedDate
|
|
3531
|
+
);
|
|
3532
|
+
}
|
|
3533
|
+
}]);
|
|
3534
|
+
return FormattedDate;
|
|
3991
3535
|
}(React.Component);
|
|
3992
3536
|
|
|
3993
3537
|
FormattedDate.displayName = 'FormattedDate';
|
|
3994
3538
|
FormattedDate.contextTypes = {
|
|
3995
|
-
|
|
3539
|
+
intl: intlShape
|
|
3996
3540
|
};
|
|
3997
|
-
FormattedDate.propTypes =
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
3541
|
+
FormattedDate.propTypes = _extends({}, dateTimeFormatPropTypes, {
|
|
3542
|
+
value: PropTypes.any.isRequired,
|
|
3543
|
+
format: PropTypes.string,
|
|
3544
|
+
children: PropTypes.func
|
|
4001
3545
|
});
|
|
4002
3546
|
|
|
4003
3547
|
/*
|
|
@@ -4007,61 +3551,61 @@ FormattedDate.propTypes = babelHelpers$1['extends']({}, dateTimeFormatPropTypes,
|
|
|
4007
3551
|
*/
|
|
4008
3552
|
|
|
4009
3553
|
var FormattedTime = function (_Component) {
|
|
4010
|
-
|
|
3554
|
+
inherits(FormattedTime, _Component);
|
|
4011
3555
|
|
|
4012
|
-
|
|
4013
|
-
|
|
3556
|
+
function FormattedTime(props, context) {
|
|
3557
|
+
classCallCheck(this, FormattedTime);
|
|
4014
3558
|
|
|
4015
|
-
|
|
3559
|
+
var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context));
|
|
4016
3560
|
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
3561
|
+
invariantIntlContext(context);
|
|
3562
|
+
return _this;
|
|
3563
|
+
}
|
|
4020
3564
|
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
3565
|
+
createClass(FormattedTime, [{
|
|
3566
|
+
key: 'shouldComponentUpdate',
|
|
3567
|
+
value: function shouldComponentUpdate() {
|
|
3568
|
+
for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3569
|
+
next[_key] = arguments[_key];
|
|
3570
|
+
}
|
|
4027
3571
|
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
3572
|
+
return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
|
|
3573
|
+
}
|
|
3574
|
+
}, {
|
|
3575
|
+
key: 'render',
|
|
3576
|
+
value: function render() {
|
|
3577
|
+
var _context$intl = this.context.intl,
|
|
3578
|
+
formatTime = _context$intl.formatTime,
|
|
3579
|
+
Text = _context$intl.textComponent;
|
|
3580
|
+
var _props = this.props,
|
|
3581
|
+
value = _props.value,
|
|
3582
|
+
children = _props.children;
|
|
4039
3583
|
|
|
4040
3584
|
|
|
4041
|
-
|
|
3585
|
+
var formattedTime = formatTime(value, this.props);
|
|
4042
3586
|
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
3587
|
+
if (typeof children === 'function') {
|
|
3588
|
+
return children(formattedTime);
|
|
3589
|
+
}
|
|
4046
3590
|
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
3591
|
+
return React__default.createElement(
|
|
3592
|
+
Text,
|
|
3593
|
+
null,
|
|
3594
|
+
formattedTime
|
|
3595
|
+
);
|
|
3596
|
+
}
|
|
3597
|
+
}]);
|
|
3598
|
+
return FormattedTime;
|
|
4055
3599
|
}(React.Component);
|
|
4056
3600
|
|
|
4057
3601
|
FormattedTime.displayName = 'FormattedTime';
|
|
4058
3602
|
FormattedTime.contextTypes = {
|
|
4059
|
-
|
|
3603
|
+
intl: intlShape
|
|
4060
3604
|
};
|
|
4061
|
-
FormattedTime.propTypes =
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
3605
|
+
FormattedTime.propTypes = _extends({}, dateTimeFormatPropTypes, {
|
|
3606
|
+
value: PropTypes.any.isRequired,
|
|
3607
|
+
format: PropTypes.string,
|
|
3608
|
+
children: PropTypes.func
|
|
4065
3609
|
});
|
|
4066
3610
|
|
|
4067
3611
|
/*
|
|
@@ -4080,177 +3624,179 @@ var DAY = 1000 * 60 * 60 * 24;
|
|
|
4080
3624
|
var MAX_TIMER_DELAY = 2147483647;
|
|
4081
3625
|
|
|
4082
3626
|
function selectUnits(delta) {
|
|
4083
|
-
|
|
3627
|
+
var absDelta = Math.abs(delta);
|
|
4084
3628
|
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
3629
|
+
if (absDelta < MINUTE) {
|
|
3630
|
+
return 'second';
|
|
3631
|
+
}
|
|
4088
3632
|
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
3633
|
+
if (absDelta < HOUR) {
|
|
3634
|
+
return 'minute';
|
|
3635
|
+
}
|
|
4092
3636
|
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
3637
|
+
if (absDelta < DAY) {
|
|
3638
|
+
return 'hour';
|
|
3639
|
+
}
|
|
4096
3640
|
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
3641
|
+
// The maximum scheduled delay will be measured in days since the maximum
|
|
3642
|
+
// timer delay is less than the number of milliseconds in 25 days.
|
|
3643
|
+
return 'day';
|
|
4100
3644
|
}
|
|
4101
3645
|
|
|
4102
3646
|
function getUnitDelay(units) {
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
3647
|
+
switch (units) {
|
|
3648
|
+
case 'second':
|
|
3649
|
+
return SECOND;
|
|
3650
|
+
case 'minute':
|
|
3651
|
+
return MINUTE;
|
|
3652
|
+
case 'hour':
|
|
3653
|
+
return HOUR;
|
|
3654
|
+
case 'day':
|
|
3655
|
+
return DAY;
|
|
3656
|
+
default:
|
|
3657
|
+
return MAX_TIMER_DELAY;
|
|
3658
|
+
}
|
|
4115
3659
|
}
|
|
4116
3660
|
|
|
4117
3661
|
function isSameDate(a, b) {
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
3662
|
+
if (a === b) {
|
|
3663
|
+
return true;
|
|
3664
|
+
}
|
|
4121
3665
|
|
|
4122
|
-
|
|
4123
|
-
|
|
3666
|
+
var aTime = new Date(a).getTime();
|
|
3667
|
+
var bTime = new Date(b).getTime();
|
|
4124
3668
|
|
|
4125
|
-
|
|
3669
|
+
return isFinite(aTime) && isFinite(bTime) && aTime === bTime;
|
|
4126
3670
|
}
|
|
4127
3671
|
|
|
4128
3672
|
var FormattedRelative = function (_Component) {
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
function FormattedRelative(props, context) {
|
|
4132
|
-
classCallCheck(this, FormattedRelative);
|
|
4133
|
-
|
|
4134
|
-
var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
|
|
4135
|
-
|
|
4136
|
-
invariantIntlContext(context);
|
|
3673
|
+
inherits(FormattedRelative, _Component);
|
|
4137
3674
|
|
|
4138
|
-
|
|
3675
|
+
function FormattedRelative(props, context) {
|
|
3676
|
+
classCallCheck(this, FormattedRelative);
|
|
4139
3677
|
|
|
4140
|
-
|
|
4141
|
-
// props + state, instead of accessing `Date.now()` inside `render()`.
|
|
4142
|
-
_this.state = { now: now };
|
|
4143
|
-
return _this;
|
|
4144
|
-
}
|
|
3678
|
+
var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
|
|
4145
3679
|
|
|
4146
|
-
|
|
4147
|
-
key: 'scheduleNextUpdate',
|
|
4148
|
-
value: function scheduleNextUpdate(props, state) {
|
|
4149
|
-
var _this2 = this;
|
|
3680
|
+
invariantIntlContext(context);
|
|
4150
3681
|
|
|
4151
|
-
|
|
3682
|
+
var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now();
|
|
4152
3683
|
|
|
4153
|
-
|
|
4154
|
-
|
|
3684
|
+
// `now` is stored as state so that `render()` remains a function of
|
|
3685
|
+
// props + state, instead of accessing `Date.now()` inside `render()`.
|
|
3686
|
+
_this.state = { now: now };
|
|
3687
|
+
return _this;
|
|
3688
|
+
}
|
|
4155
3689
|
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
3690
|
+
createClass(FormattedRelative, [{
|
|
3691
|
+
key: 'scheduleNextUpdate',
|
|
3692
|
+
value: function scheduleNextUpdate(props, state) {
|
|
3693
|
+
var _this2 = this;
|
|
4159
3694
|
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
var units = props.units || selectUnits(delta);
|
|
3695
|
+
// Cancel and pending update because we're scheduling a new update.
|
|
3696
|
+
clearTimeout(this._timer);
|
|
4163
3697
|
|
|
4164
|
-
|
|
4165
|
-
|
|
3698
|
+
var value = props.value,
|
|
3699
|
+
units = props.units,
|
|
3700
|
+
updateInterval = props.updateInterval;
|
|
4166
3701
|
|
|
4167
|
-
|
|
4168
|
-
// accurate information while reducing unnecessary re-renders. The delay
|
|
4169
|
-
// should be until the next "interesting" moment, like a tick from
|
|
4170
|
-
// "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
|
|
4171
|
-
var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
|
|
3702
|
+
var time = new Date(value).getTime();
|
|
4172
3703
|
|
|
4173
|
-
|
|
3704
|
+
// If the `updateInterval` is falsy, including `0` or we don't have a
|
|
3705
|
+
// valid date, then auto updates have been turned off, so we bail and
|
|
3706
|
+
// skip scheduling an update.
|
|
3707
|
+
if (!updateInterval || !isFinite(time)) {
|
|
3708
|
+
return;
|
|
3709
|
+
}
|
|
4174
3710
|
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
3711
|
+
var delta = time - state.now;
|
|
3712
|
+
var unitDelay = getUnitDelay(units || selectUnits(delta));
|
|
3713
|
+
var unitRemainder = Math.abs(delta % unitDelay);
|
|
3714
|
+
|
|
3715
|
+
// We want the largest possible timer delay which will still display
|
|
3716
|
+
// accurate information while reducing unnecessary re-renders. The delay
|
|
3717
|
+
// should be until the next "interesting" moment, like a tick from
|
|
3718
|
+
// "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
|
|
3719
|
+
var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
|
|
3720
|
+
|
|
3721
|
+
this._timer = setTimeout(function () {
|
|
3722
|
+
_this2.setState({ now: _this2.context.intl.now() });
|
|
3723
|
+
}, delay);
|
|
3724
|
+
}
|
|
3725
|
+
}, {
|
|
3726
|
+
key: 'componentDidMount',
|
|
3727
|
+
value: function componentDidMount() {
|
|
3728
|
+
this.scheduleNextUpdate(this.props, this.state);
|
|
3729
|
+
}
|
|
3730
|
+
}, {
|
|
3731
|
+
key: 'componentWillReceiveProps',
|
|
3732
|
+
value: function componentWillReceiveProps(_ref) {
|
|
3733
|
+
var nextValue = _ref.value;
|
|
3734
|
+
|
|
3735
|
+
// When the `props.value` date changes, `state.now` needs to be updated,
|
|
3736
|
+
// and the next update can be rescheduled.
|
|
3737
|
+
if (!isSameDate(nextValue, this.props.value)) {
|
|
3738
|
+
this.setState({ now: this.context.intl.now() });
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
}, {
|
|
3742
|
+
key: 'shouldComponentUpdate',
|
|
3743
|
+
value: function shouldComponentUpdate() {
|
|
3744
|
+
for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3745
|
+
next[_key] = arguments[_key];
|
|
3746
|
+
}
|
|
4201
3747
|
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
3748
|
+
return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
|
|
3749
|
+
}
|
|
3750
|
+
}, {
|
|
3751
|
+
key: 'componentWillUpdate',
|
|
3752
|
+
value: function componentWillUpdate(nextProps, nextState) {
|
|
3753
|
+
this.scheduleNextUpdate(nextProps, nextState);
|
|
3754
|
+
}
|
|
3755
|
+
}, {
|
|
3756
|
+
key: 'componentWillUnmount',
|
|
3757
|
+
value: function componentWillUnmount() {
|
|
3758
|
+
clearTimeout(this._timer);
|
|
3759
|
+
}
|
|
3760
|
+
}, {
|
|
3761
|
+
key: 'render',
|
|
3762
|
+
value: function render() {
|
|
3763
|
+
var _context$intl = this.context.intl,
|
|
3764
|
+
formatRelative = _context$intl.formatRelative,
|
|
3765
|
+
Text = _context$intl.textComponent;
|
|
3766
|
+
var _props = this.props,
|
|
3767
|
+
value = _props.value,
|
|
3768
|
+
children = _props.children;
|
|
4223
3769
|
|
|
4224
3770
|
|
|
4225
|
-
|
|
3771
|
+
var formattedRelative = formatRelative(value, _extends({}, this.props, this.state));
|
|
4226
3772
|
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
3773
|
+
if (typeof children === 'function') {
|
|
3774
|
+
return children(formattedRelative);
|
|
3775
|
+
}
|
|
4230
3776
|
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
3777
|
+
return React__default.createElement(
|
|
3778
|
+
Text,
|
|
3779
|
+
null,
|
|
3780
|
+
formattedRelative
|
|
3781
|
+
);
|
|
3782
|
+
}
|
|
3783
|
+
}]);
|
|
3784
|
+
return FormattedRelative;
|
|
4239
3785
|
}(React.Component);
|
|
4240
3786
|
|
|
4241
3787
|
FormattedRelative.displayName = 'FormattedRelative';
|
|
4242
3788
|
FormattedRelative.contextTypes = {
|
|
4243
|
-
|
|
3789
|
+
intl: intlShape
|
|
4244
3790
|
};
|
|
4245
3791
|
FormattedRelative.defaultProps = {
|
|
4246
|
-
|
|
3792
|
+
updateInterval: 1000 * 10
|
|
4247
3793
|
};
|
|
4248
|
-
FormattedRelative.propTypes =
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
3794
|
+
FormattedRelative.propTypes = _extends({}, relativeFormatPropTypes, {
|
|
3795
|
+
value: PropTypes.any.isRequired,
|
|
3796
|
+
format: PropTypes.string,
|
|
3797
|
+
updateInterval: PropTypes.number,
|
|
3798
|
+
initialNow: PropTypes.any,
|
|
3799
|
+
children: PropTypes.func
|
|
4254
3800
|
});
|
|
4255
3801
|
|
|
4256
3802
|
/*
|
|
@@ -4260,61 +3806,61 @@ FormattedRelative.propTypes = babelHelpers$1['extends']({}, relativeFormatPropTy
|
|
|
4260
3806
|
*/
|
|
4261
3807
|
|
|
4262
3808
|
var FormattedNumber = function (_Component) {
|
|
4263
|
-
|
|
3809
|
+
inherits(FormattedNumber, _Component);
|
|
4264
3810
|
|
|
4265
|
-
|
|
4266
|
-
|
|
3811
|
+
function FormattedNumber(props, context) {
|
|
3812
|
+
classCallCheck(this, FormattedNumber);
|
|
4267
3813
|
|
|
4268
|
-
|
|
3814
|
+
var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context));
|
|
4269
3815
|
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
3816
|
+
invariantIntlContext(context);
|
|
3817
|
+
return _this;
|
|
3818
|
+
}
|
|
4273
3819
|
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
3820
|
+
createClass(FormattedNumber, [{
|
|
3821
|
+
key: 'shouldComponentUpdate',
|
|
3822
|
+
value: function shouldComponentUpdate() {
|
|
3823
|
+
for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3824
|
+
next[_key] = arguments[_key];
|
|
3825
|
+
}
|
|
4280
3826
|
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
3827
|
+
return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
|
|
3828
|
+
}
|
|
3829
|
+
}, {
|
|
3830
|
+
key: 'render',
|
|
3831
|
+
value: function render() {
|
|
3832
|
+
var _context$intl = this.context.intl,
|
|
3833
|
+
formatNumber = _context$intl.formatNumber,
|
|
3834
|
+
Text = _context$intl.textComponent;
|
|
3835
|
+
var _props = this.props,
|
|
3836
|
+
value = _props.value,
|
|
3837
|
+
children = _props.children;
|
|
4292
3838
|
|
|
4293
3839
|
|
|
4294
|
-
|
|
3840
|
+
var formattedNumber = formatNumber(value, this.props);
|
|
4295
3841
|
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
3842
|
+
if (typeof children === 'function') {
|
|
3843
|
+
return children(formattedNumber);
|
|
3844
|
+
}
|
|
4299
3845
|
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
3846
|
+
return React__default.createElement(
|
|
3847
|
+
Text,
|
|
3848
|
+
null,
|
|
3849
|
+
formattedNumber
|
|
3850
|
+
);
|
|
3851
|
+
}
|
|
3852
|
+
}]);
|
|
3853
|
+
return FormattedNumber;
|
|
4308
3854
|
}(React.Component);
|
|
4309
3855
|
|
|
4310
3856
|
FormattedNumber.displayName = 'FormattedNumber';
|
|
4311
3857
|
FormattedNumber.contextTypes = {
|
|
4312
|
-
|
|
3858
|
+
intl: intlShape
|
|
4313
3859
|
};
|
|
4314
|
-
FormattedNumber.propTypes =
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
3860
|
+
FormattedNumber.propTypes = _extends({}, numberFormatPropTypes, {
|
|
3861
|
+
value: PropTypes.any.isRequired,
|
|
3862
|
+
format: PropTypes.string,
|
|
3863
|
+
children: PropTypes.func
|
|
4318
3864
|
});
|
|
4319
3865
|
|
|
4320
3866
|
/*
|
|
@@ -4324,73 +3870,73 @@ FormattedNumber.propTypes = babelHelpers$1['extends']({}, numberFormatPropTypes,
|
|
|
4324
3870
|
*/
|
|
4325
3871
|
|
|
4326
3872
|
var FormattedPlural = function (_Component) {
|
|
4327
|
-
|
|
3873
|
+
inherits(FormattedPlural, _Component);
|
|
3874
|
+
|
|
3875
|
+
function FormattedPlural(props, context) {
|
|
3876
|
+
classCallCheck(this, FormattedPlural);
|
|
4328
3877
|
|
|
4329
|
-
|
|
4330
|
-
classCallCheck(this, FormattedPlural);
|
|
3878
|
+
var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context));
|
|
4331
3879
|
|
|
4332
|
-
|
|
3880
|
+
invariantIntlContext(context);
|
|
3881
|
+
return _this;
|
|
3882
|
+
}
|
|
3883
|
+
|
|
3884
|
+
createClass(FormattedPlural, [{
|
|
3885
|
+
key: 'shouldComponentUpdate',
|
|
3886
|
+
value: function shouldComponentUpdate() {
|
|
3887
|
+
for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3888
|
+
next[_key] = arguments[_key];
|
|
3889
|
+
}
|
|
4333
3890
|
|
|
4334
|
-
|
|
4335
|
-
return _this;
|
|
3891
|
+
return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
|
|
4336
3892
|
}
|
|
3893
|
+
}, {
|
|
3894
|
+
key: 'render',
|
|
3895
|
+
value: function render() {
|
|
3896
|
+
var _context$intl = this.context.intl,
|
|
3897
|
+
formatPlural = _context$intl.formatPlural,
|
|
3898
|
+
Text = _context$intl.textComponent;
|
|
3899
|
+
var _props = this.props,
|
|
3900
|
+
value = _props.value,
|
|
3901
|
+
other = _props.other,
|
|
3902
|
+
children = _props.children;
|
|
4337
3903
|
|
|
4338
|
-
createClass(FormattedPlural, [{
|
|
4339
|
-
key: 'shouldComponentUpdate',
|
|
4340
|
-
value: function shouldComponentUpdate() {
|
|
4341
|
-
for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
|
|
4342
|
-
next[_key] = arguments[_key];
|
|
4343
|
-
}
|
|
4344
3904
|
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
}, {
|
|
4348
|
-
key: 'render',
|
|
4349
|
-
value: function render() {
|
|
4350
|
-
var _context$intl = this.context.intl,
|
|
4351
|
-
formatPlural = _context$intl.formatPlural,
|
|
4352
|
-
Text = _context$intl.textComponent;
|
|
4353
|
-
var _props = this.props,
|
|
4354
|
-
value = _props.value,
|
|
4355
|
-
other = _props.other,
|
|
4356
|
-
children = _props.children;
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
var pluralCategory = formatPlural(value, this.props);
|
|
4360
|
-
var formattedPlural = this.props[pluralCategory] || other;
|
|
4361
|
-
|
|
4362
|
-
if (typeof children === 'function') {
|
|
4363
|
-
return children(formattedPlural);
|
|
4364
|
-
}
|
|
3905
|
+
var pluralCategory = formatPlural(value, this.props);
|
|
3906
|
+
var formattedPlural = this.props[pluralCategory] || other;
|
|
4365
3907
|
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
3908
|
+
if (typeof children === 'function') {
|
|
3909
|
+
return children(formattedPlural);
|
|
3910
|
+
}
|
|
3911
|
+
|
|
3912
|
+
return React__default.createElement(
|
|
3913
|
+
Text,
|
|
3914
|
+
null,
|
|
3915
|
+
formattedPlural
|
|
3916
|
+
);
|
|
3917
|
+
}
|
|
3918
|
+
}]);
|
|
3919
|
+
return FormattedPlural;
|
|
4374
3920
|
}(React.Component);
|
|
4375
3921
|
|
|
4376
3922
|
FormattedPlural.displayName = 'FormattedPlural';
|
|
4377
3923
|
FormattedPlural.contextTypes = {
|
|
4378
|
-
|
|
3924
|
+
intl: intlShape
|
|
4379
3925
|
};
|
|
4380
3926
|
FormattedPlural.defaultProps = {
|
|
4381
|
-
|
|
3927
|
+
style: 'cardinal'
|
|
4382
3928
|
};
|
|
4383
|
-
FormattedPlural.propTypes =
|
|
4384
|
-
|
|
3929
|
+
FormattedPlural.propTypes = _extends({}, pluralFormatPropTypes, {
|
|
3930
|
+
value: PropTypes.any.isRequired,
|
|
4385
3931
|
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
3932
|
+
other: PropTypes.node.isRequired,
|
|
3933
|
+
zero: PropTypes.node,
|
|
3934
|
+
one: PropTypes.node,
|
|
3935
|
+
two: PropTypes.node,
|
|
3936
|
+
few: PropTypes.node,
|
|
3937
|
+
many: PropTypes.node,
|
|
4392
3938
|
|
|
4393
|
-
|
|
3939
|
+
children: PropTypes.func
|
|
4394
3940
|
});
|
|
4395
3941
|
|
|
4396
3942
|
/*
|
|
@@ -4400,146 +3946,142 @@ FormattedPlural.propTypes = babelHelpers$1['extends']({}, pluralFormatPropTypes,
|
|
|
4400
3946
|
*/
|
|
4401
3947
|
|
|
4402
3948
|
var FormattedMessage = function (_Component) {
|
|
4403
|
-
|
|
3949
|
+
inherits(FormattedMessage, _Component);
|
|
4404
3950
|
|
|
4405
|
-
|
|
4406
|
-
|
|
3951
|
+
function FormattedMessage(props, context) {
|
|
3952
|
+
classCallCheck(this, FormattedMessage);
|
|
4407
3953
|
|
|
4408
|
-
|
|
3954
|
+
var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context));
|
|
4409
3955
|
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
3956
|
+
invariantIntlContext(context);
|
|
3957
|
+
return _this;
|
|
3958
|
+
}
|
|
4413
3959
|
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
3960
|
+
createClass(FormattedMessage, [{
|
|
3961
|
+
key: 'shouldComponentUpdate',
|
|
3962
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
3963
|
+
var values = this.props.values;
|
|
3964
|
+
var nextValues = nextProps.values;
|
|
4419
3965
|
|
|
4420
3966
|
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
3967
|
+
if (!shallowEquals(nextValues, values)) {
|
|
3968
|
+
return true;
|
|
3969
|
+
}
|
|
4424
3970
|
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
3971
|
+
// Since `values` has already been checked, we know they're not
|
|
3972
|
+
// different, so the current `values` are carried over so the shallow
|
|
3973
|
+
// equals comparison on the other props isn't affected by the `values`.
|
|
3974
|
+
var nextPropsToCheck = _extends({}, nextProps, {
|
|
3975
|
+
values: values
|
|
3976
|
+
});
|
|
4431
3977
|
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
3978
|
+
for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
3979
|
+
next[_key - 1] = arguments[_key];
|
|
3980
|
+
}
|
|
4435
3981
|
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
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
|
-
})();
|
|
4496
|
-
}
|
|
3982
|
+
return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
|
|
3983
|
+
}
|
|
3984
|
+
}, {
|
|
3985
|
+
key: 'render',
|
|
3986
|
+
value: function render() {
|
|
3987
|
+
var _context$intl = this.context.intl,
|
|
3988
|
+
formatMessage = _context$intl.formatMessage,
|
|
3989
|
+
Text = _context$intl.textComponent;
|
|
3990
|
+
var _props = this.props,
|
|
3991
|
+
id = _props.id,
|
|
3992
|
+
description = _props.description,
|
|
3993
|
+
defaultMessage = _props.defaultMessage,
|
|
3994
|
+
values = _props.values,
|
|
3995
|
+
_props$tagName = _props.tagName,
|
|
3996
|
+
Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
|
|
3997
|
+
children = _props.children;
|
|
3998
|
+
|
|
3999
|
+
|
|
4000
|
+
var tokenDelimiter = void 0;
|
|
4001
|
+
var tokenizedValues = void 0;
|
|
4002
|
+
var elements = void 0;
|
|
4003
|
+
|
|
4004
|
+
var hasValues = values && Object.keys(values).length > 0;
|
|
4005
|
+
if (hasValues) {
|
|
4006
|
+
// Creates a token with a random UID that should not be guessable or
|
|
4007
|
+
// conflict with other parts of the `message` string.
|
|
4008
|
+
var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
|
|
4009
|
+
|
|
4010
|
+
var generateToken = function () {
|
|
4011
|
+
var counter = 0;
|
|
4012
|
+
return function () {
|
|
4013
|
+
return 'ELEMENT-' + uid + '-' + (counter += 1);
|
|
4014
|
+
};
|
|
4015
|
+
}();
|
|
4016
|
+
|
|
4017
|
+
// Splitting with a delimiter to support IE8. When using a regex
|
|
4018
|
+
// with a capture group IE8 does not include the capture group in
|
|
4019
|
+
// the resulting array.
|
|
4020
|
+
tokenDelimiter = '@__' + uid + '__@';
|
|
4021
|
+
tokenizedValues = {};
|
|
4022
|
+
elements = {};
|
|
4023
|
+
|
|
4024
|
+
// Iterates over the `props` to keep track of any React Element
|
|
4025
|
+
// values so they can be represented by the `token` as a placeholder
|
|
4026
|
+
// when the `message` is formatted. This allows the formatted
|
|
4027
|
+
// message to then be broken-up into parts with references to the
|
|
4028
|
+
// React Elements inserted back in.
|
|
4029
|
+
Object.keys(values).forEach(function (name) {
|
|
4030
|
+
var value = values[name];
|
|
4031
|
+
|
|
4032
|
+
if (React.isValidElement(value)) {
|
|
4033
|
+
var token = generateToken();
|
|
4034
|
+
tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
|
|
4035
|
+
elements[token] = value;
|
|
4036
|
+
} else {
|
|
4037
|
+
tokenizedValues[name] = value;
|
|
4038
|
+
}
|
|
4039
|
+
});
|
|
4040
|
+
}
|
|
4497
4041
|
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4042
|
+
var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
|
|
4043
|
+
var formattedMessage = formatMessage(descriptor, tokenizedValues || values);
|
|
4044
|
+
|
|
4045
|
+
var nodes = void 0;
|
|
4046
|
+
|
|
4047
|
+
var hasElements = elements && Object.keys(elements).length > 0;
|
|
4048
|
+
if (hasElements) {
|
|
4049
|
+
// Split the message into parts so the React Element values captured
|
|
4050
|
+
// above can be inserted back into the rendered message. This
|
|
4051
|
+
// approach allows messages to render with React Elements while
|
|
4052
|
+
// keeping React's virtual diffing working properly.
|
|
4053
|
+
nodes = formattedMessage.split(tokenDelimiter).filter(function (part) {
|
|
4054
|
+
return !!part;
|
|
4055
|
+
}).map(function (part) {
|
|
4056
|
+
return elements[part] || part;
|
|
4057
|
+
});
|
|
4058
|
+
} else {
|
|
4059
|
+
nodes = [formattedMessage];
|
|
4060
|
+
}
|
|
4517
4061
|
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4062
|
+
if (typeof children === 'function') {
|
|
4063
|
+
return children.apply(undefined, toConsumableArray(nodes));
|
|
4064
|
+
}
|
|
4521
4065
|
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
}]);
|
|
4529
|
-
return FormattedMessage;
|
|
4066
|
+
// Needs to use `createElement()` instead of JSX, otherwise React will
|
|
4067
|
+
// warn about a missing `key` prop with rich-text message formatting.
|
|
4068
|
+
return React.createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes)));
|
|
4069
|
+
}
|
|
4070
|
+
}]);
|
|
4071
|
+
return FormattedMessage;
|
|
4530
4072
|
}(React.Component);
|
|
4531
4073
|
|
|
4532
4074
|
FormattedMessage.displayName = 'FormattedMessage';
|
|
4533
4075
|
FormattedMessage.contextTypes = {
|
|
4534
|
-
|
|
4076
|
+
intl: intlShape
|
|
4535
4077
|
};
|
|
4536
4078
|
FormattedMessage.defaultProps = {
|
|
4537
|
-
|
|
4079
|
+
values: {}
|
|
4538
4080
|
};
|
|
4539
|
-
FormattedMessage.propTypes =
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4081
|
+
FormattedMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
|
|
4082
|
+
values: PropTypes.object,
|
|
4083
|
+
tagName: PropTypes.string,
|
|
4084
|
+
children: PropTypes.func
|
|
4543
4085
|
});
|
|
4544
4086
|
|
|
4545
4087
|
/*
|
|
@@ -4549,90 +4091,90 @@ FormattedMessage.propTypes = babelHelpers$1['extends']({}, messageDescriptorProp
|
|
|
4549
4091
|
*/
|
|
4550
4092
|
|
|
4551
4093
|
var FormattedHTMLMessage = function (_Component) {
|
|
4552
|
-
|
|
4094
|
+
inherits(FormattedHTMLMessage, _Component);
|
|
4553
4095
|
|
|
4554
|
-
|
|
4555
|
-
|
|
4096
|
+
function FormattedHTMLMessage(props, context) {
|
|
4097
|
+
classCallCheck(this, FormattedHTMLMessage);
|
|
4556
4098
|
|
|
4557
|
-
|
|
4099
|
+
var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context));
|
|
4558
4100
|
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4101
|
+
invariantIntlContext(context);
|
|
4102
|
+
return _this;
|
|
4103
|
+
}
|
|
4562
4104
|
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4105
|
+
createClass(FormattedHTMLMessage, [{
|
|
4106
|
+
key: 'shouldComponentUpdate',
|
|
4107
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
4108
|
+
var values = this.props.values;
|
|
4109
|
+
var nextValues = nextProps.values;
|
|
4568
4110
|
|
|
4569
4111
|
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4112
|
+
if (!shallowEquals(nextValues, values)) {
|
|
4113
|
+
return true;
|
|
4114
|
+
}
|
|
4573
4115
|
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4116
|
+
// Since `values` has already been checked, we know they're not
|
|
4117
|
+
// different, so the current `values` are carried over so the shallow
|
|
4118
|
+
// equals comparison on the other props isn't affected by the `values`.
|
|
4119
|
+
var nextPropsToCheck = _extends({}, nextProps, {
|
|
4120
|
+
values: values
|
|
4121
|
+
});
|
|
4580
4122
|
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4123
|
+
for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
4124
|
+
next[_key - 1] = arguments[_key];
|
|
4125
|
+
}
|
|
4584
4126
|
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4127
|
+
return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
|
|
4128
|
+
}
|
|
4129
|
+
}, {
|
|
4130
|
+
key: 'render',
|
|
4131
|
+
value: function render() {
|
|
4132
|
+
var _context$intl = this.context.intl,
|
|
4133
|
+
formatHTMLMessage = _context$intl.formatHTMLMessage,
|
|
4134
|
+
Text = _context$intl.textComponent;
|
|
4135
|
+
var _props = this.props,
|
|
4136
|
+
id = _props.id,
|
|
4137
|
+
description = _props.description,
|
|
4138
|
+
defaultMessage = _props.defaultMessage,
|
|
4139
|
+
rawValues = _props.values,
|
|
4140
|
+
_props$tagName = _props.tagName,
|
|
4141
|
+
Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
|
|
4142
|
+
children = _props.children;
|
|
4143
|
+
|
|
4144
|
+
|
|
4145
|
+
var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
|
|
4146
|
+
var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues);
|
|
4147
|
+
|
|
4148
|
+
if (typeof children === 'function') {
|
|
4149
|
+
return children(formattedHTMLMessage);
|
|
4150
|
+
}
|
|
4609
4151
|
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4152
|
+
// Since the message presumably has HTML in it, we need to set
|
|
4153
|
+
// `innerHTML` in order for it to be rendered and not escaped by React.
|
|
4154
|
+
// To be safe, all string prop values were escaped when formatting the
|
|
4155
|
+
// message. It is assumed that the message is not UGC, and came from the
|
|
4156
|
+
// developer making it more like a template.
|
|
4157
|
+
//
|
|
4158
|
+
// Note: There's a perf impact of using this component since there's no
|
|
4159
|
+
// way for React to do its virtual DOM diffing.
|
|
4160
|
+
var html = { __html: formattedHTMLMessage };
|
|
4161
|
+
return React__default.createElement(Component$$1, { dangerouslySetInnerHTML: html });
|
|
4162
|
+
}
|
|
4163
|
+
}]);
|
|
4164
|
+
return FormattedHTMLMessage;
|
|
4623
4165
|
}(React.Component);
|
|
4624
4166
|
|
|
4625
4167
|
FormattedHTMLMessage.displayName = 'FormattedHTMLMessage';
|
|
4626
4168
|
FormattedHTMLMessage.contextTypes = {
|
|
4627
|
-
|
|
4169
|
+
intl: intlShape
|
|
4628
4170
|
};
|
|
4629
4171
|
FormattedHTMLMessage.defaultProps = {
|
|
4630
|
-
|
|
4172
|
+
values: {}
|
|
4631
4173
|
};
|
|
4632
|
-
FormattedHTMLMessage.propTypes =
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4174
|
+
FormattedHTMLMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
|
|
4175
|
+
values: PropTypes.object,
|
|
4176
|
+
tagName: PropTypes.string,
|
|
4177
|
+
children: PropTypes.func
|
|
4636
4178
|
});
|
|
4637
4179
|
|
|
4638
4180
|
/*
|