1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@material-ui/core/Typography'), require('@material-ui/core/styles'), require('@material-ui/core/Button'), require('@material-ui/core/Toolbar'), require('@material-ui/core/TextField'), require('@material-ui/core/IconButton'), require('@material-ui/core/InputAdornment'), require('@material-ui/core/SvgIcon'), require('react-dom'), require('@material-ui/core/CircularProgress'), require('@material-ui/core/DialogActions'), require('@material-ui/core/DialogContent'), require('@material-ui/core/Dialog'), require('@material-ui/core/Popover'), require('@material-ui/core/Grid'), require('@material-ui/core/Tab'), require('@material-ui/core/Tabs'), require('@material-ui/core/Paper')) :
|
3 | typeof define === 'function' && define.amd ? define(['exports', 'react', '@material-ui/core/Typography', '@material-ui/core/styles', '@material-ui/core/Button', '@material-ui/core/Toolbar', '@material-ui/core/TextField', '@material-ui/core/IconButton', '@material-ui/core/InputAdornment', '@material-ui/core/SvgIcon', 'react-dom', '@material-ui/core/CircularProgress', '@material-ui/core/DialogActions', '@material-ui/core/DialogContent', '@material-ui/core/Dialog', '@material-ui/core/Popover', '@material-ui/core/Grid', '@material-ui/core/Tab', '@material-ui/core/Tabs', '@material-ui/core/Paper'], factory) :
|
4 | (global = global || self, factory(global['@material-ui/pickers'] = {}, global.React, global['material-ui'].Typography, global['material-ui'], global['material-ui'].Button, global['material-ui'].Toolbar, global['material-ui'].TextField, global['material-ui'].IconButton, global['material-ui'].InputAdornment, global['material-ui'].SvgIcon, global.ReactDOM, global['material-ui'].CircularProgress, global['material-ui'].DialogActions, global['material-ui'].DialogContent, global['material-ui'].Dialog, global['material-ui'].Popover, global['material-ui'].Grid, global['material-ui'].Tab, global['material-ui'].Tabs, global['material-ui'].Paper));
|
5 | }(this, (function (exports, React, Typography, styles$5, Button, Toolbar, TextField, IconButton, InputAdornment, SvgIcon, ReactDOM, CircularProgress, DialogActions, DialogContent, Dialog, Popover, Grid, Tab, Tabs, Paper) { 'use strict';
|
6 |
|
7 | var React__default = 'default' in React ? React['default'] : React;
|
8 | Typography = Typography && Typography.hasOwnProperty('default') ? Typography['default'] : Typography;
|
9 | Button = Button && Button.hasOwnProperty('default') ? Button['default'] : Button;
|
10 | Toolbar = Toolbar && Toolbar.hasOwnProperty('default') ? Toolbar['default'] : Toolbar;
|
11 | TextField = TextField && TextField.hasOwnProperty('default') ? TextField['default'] : TextField;
|
12 | IconButton = IconButton && IconButton.hasOwnProperty('default') ? IconButton['default'] : IconButton;
|
13 | InputAdornment = InputAdornment && InputAdornment.hasOwnProperty('default') ? InputAdornment['default'] : InputAdornment;
|
14 | SvgIcon = SvgIcon && SvgIcon.hasOwnProperty('default') ? SvgIcon['default'] : SvgIcon;
|
15 | ReactDOM = ReactDOM && ReactDOM.hasOwnProperty('default') ? ReactDOM['default'] : ReactDOM;
|
16 | CircularProgress = CircularProgress && CircularProgress.hasOwnProperty('default') ? CircularProgress['default'] : CircularProgress;
|
17 | DialogActions = DialogActions && DialogActions.hasOwnProperty('default') ? DialogActions['default'] : DialogActions;
|
18 | DialogContent = DialogContent && DialogContent.hasOwnProperty('default') ? DialogContent['default'] : DialogContent;
|
19 | Dialog = Dialog && Dialog.hasOwnProperty('default') ? Dialog['default'] : Dialog;
|
20 | Popover = Popover && Popover.hasOwnProperty('default') ? Popover['default'] : Popover;
|
21 | Grid = Grid && Grid.hasOwnProperty('default') ? Grid['default'] : Grid;
|
22 | Tab = Tab && Tab.hasOwnProperty('default') ? Tab['default'] : Tab;
|
23 | Tabs = Tabs && Tabs.hasOwnProperty('default') ? Tabs['default'] : Tabs;
|
24 | Paper = Paper && Paper.hasOwnProperty('default') ? Paper['default'] : Paper;
|
25 |
|
26 | function _defineProperty(obj, key, value) {
|
27 | if (key in obj) {
|
28 | Object.defineProperty(obj, key, {
|
29 | value: value,
|
30 | enumerable: true,
|
31 | configurable: true,
|
32 | writable: true
|
33 | });
|
34 | } else {
|
35 | obj[key] = value;
|
36 | }
|
37 |
|
38 | return obj;
|
39 | }
|
40 |
|
41 | function unwrapExports (x) {
|
42 | return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
43 | }
|
44 |
|
45 | function createCommonjsModule(fn, module) {
|
46 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
47 | }
|
48 |
|
49 | var reactIs_production_min = createCommonjsModule(function (module, exports) {
|
50 | Object.defineProperty(exports,"__esModule",{value:!0});
|
51 | var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.suspense_list"):
|
52 | 60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.fundamental"):60117,w=b?Symbol.for("react.responder"):60118,x=b?Symbol.for("react.scope"):60119;function y(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function z(a){return y(a)===m}
|
53 | exports.typeOf=y;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;
|
54 | exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===v||a.$$typeof===w||a.$$typeof===x)};exports.isAsyncMode=function(a){return z(a)||y(a)===l};exports.isConcurrentMode=z;exports.isContextConsumer=function(a){return y(a)===k};exports.isContextProvider=function(a){return y(a)===h};
|
55 | exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return y(a)===n};exports.isFragment=function(a){return y(a)===e};exports.isLazy=function(a){return y(a)===t};exports.isMemo=function(a){return y(a)===r};exports.isPortal=function(a){return y(a)===d};exports.isProfiler=function(a){return y(a)===g};exports.isStrictMode=function(a){return y(a)===f};exports.isSuspense=function(a){return y(a)===p};
|
56 | });
|
57 |
|
58 | unwrapExports(reactIs_production_min);
|
59 | var reactIs_production_min_1 = reactIs_production_min.typeOf;
|
60 | var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
|
61 | var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
|
62 | var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
|
63 | var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
|
64 | var reactIs_production_min_6 = reactIs_production_min.Element;
|
65 | var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
|
66 | var reactIs_production_min_8 = reactIs_production_min.Fragment;
|
67 | var reactIs_production_min_9 = reactIs_production_min.Lazy;
|
68 | var reactIs_production_min_10 = reactIs_production_min.Memo;
|
69 | var reactIs_production_min_11 = reactIs_production_min.Portal;
|
70 | var reactIs_production_min_12 = reactIs_production_min.Profiler;
|
71 | var reactIs_production_min_13 = reactIs_production_min.StrictMode;
|
72 | var reactIs_production_min_14 = reactIs_production_min.Suspense;
|
73 | var reactIs_production_min_15 = reactIs_production_min.isValidElementType;
|
74 | var reactIs_production_min_16 = reactIs_production_min.isAsyncMode;
|
75 | var reactIs_production_min_17 = reactIs_production_min.isConcurrentMode;
|
76 | var reactIs_production_min_18 = reactIs_production_min.isContextConsumer;
|
77 | var reactIs_production_min_19 = reactIs_production_min.isContextProvider;
|
78 | var reactIs_production_min_20 = reactIs_production_min.isElement;
|
79 | var reactIs_production_min_21 = reactIs_production_min.isForwardRef;
|
80 | var reactIs_production_min_22 = reactIs_production_min.isFragment;
|
81 | var reactIs_production_min_23 = reactIs_production_min.isLazy;
|
82 | var reactIs_production_min_24 = reactIs_production_min.isMemo;
|
83 | var reactIs_production_min_25 = reactIs_production_min.isPortal;
|
84 | var reactIs_production_min_26 = reactIs_production_min.isProfiler;
|
85 | var reactIs_production_min_27 = reactIs_production_min.isStrictMode;
|
86 | var reactIs_production_min_28 = reactIs_production_min.isSuspense;
|
87 |
|
88 | var reactIs_development = createCommonjsModule(function (module, exports) {
|
89 |
|
90 |
|
91 |
|
92 | {
|
93 | (function() {
|
94 |
|
95 | Object.defineProperty(exports, '__esModule', { value: true });
|
96 |
|
97 |
|
98 |
|
99 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
100 | var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
101 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
102 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
103 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
104 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
105 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
106 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
107 |
|
108 |
|
109 | var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
110 | var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
111 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
112 | var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
113 | var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
114 | var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
115 | var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
116 | var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
117 | var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
118 | var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
119 |
|
120 | function isValidElementType(type) {
|
121 | return typeof type === 'string' || typeof type === 'function' ||
|
122 | type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE);
|
123 | }
|
124 |
|
125 | |
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 | var lowPriorityWarningWithoutStack = function () {};
|
139 |
|
140 | {
|
141 | var printWarning = function (format) {
|
142 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
143 | args[_key - 1] = arguments[_key];
|
144 | }
|
145 |
|
146 | var argIndex = 0;
|
147 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
148 | return args[argIndex++];
|
149 | });
|
150 |
|
151 | if (typeof console !== 'undefined') {
|
152 | console.warn(message);
|
153 | }
|
154 |
|
155 | try {
|
156 |
|
157 |
|
158 |
|
159 | throw new Error(message);
|
160 | } catch (x) {}
|
161 | };
|
162 |
|
163 | lowPriorityWarningWithoutStack = function (condition, format) {
|
164 | if (format === undefined) {
|
165 | throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
166 | }
|
167 |
|
168 | if (!condition) {
|
169 | for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
170 | args[_key2 - 2] = arguments[_key2];
|
171 | }
|
172 |
|
173 | printWarning.apply(void 0, [format].concat(args));
|
174 | }
|
175 | };
|
176 | }
|
177 |
|
178 | var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
179 |
|
180 | function typeOf(object) {
|
181 | if (typeof object === 'object' && object !== null) {
|
182 | var $$typeof = object.$$typeof;
|
183 |
|
184 | switch ($$typeof) {
|
185 | case REACT_ELEMENT_TYPE:
|
186 | var type = object.type;
|
187 |
|
188 | switch (type) {
|
189 | case REACT_ASYNC_MODE_TYPE:
|
190 | case REACT_CONCURRENT_MODE_TYPE:
|
191 | case REACT_FRAGMENT_TYPE:
|
192 | case REACT_PROFILER_TYPE:
|
193 | case REACT_STRICT_MODE_TYPE:
|
194 | case REACT_SUSPENSE_TYPE:
|
195 | return type;
|
196 |
|
197 | default:
|
198 | var $$typeofType = type && type.$$typeof;
|
199 |
|
200 | switch ($$typeofType) {
|
201 | case REACT_CONTEXT_TYPE:
|
202 | case REACT_FORWARD_REF_TYPE:
|
203 | case REACT_LAZY_TYPE:
|
204 | case REACT_MEMO_TYPE:
|
205 | case REACT_PROVIDER_TYPE:
|
206 | return $$typeofType;
|
207 |
|
208 | default:
|
209 | return $$typeof;
|
210 | }
|
211 |
|
212 | }
|
213 |
|
214 | case REACT_PORTAL_TYPE:
|
215 | return $$typeof;
|
216 | }
|
217 | }
|
218 |
|
219 | return undefined;
|
220 | }
|
221 |
|
222 | var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
223 | var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
224 | var ContextConsumer = REACT_CONTEXT_TYPE;
|
225 | var ContextProvider = REACT_PROVIDER_TYPE;
|
226 | var Element = REACT_ELEMENT_TYPE;
|
227 | var ForwardRef = REACT_FORWARD_REF_TYPE;
|
228 | var Fragment = REACT_FRAGMENT_TYPE;
|
229 | var Lazy = REACT_LAZY_TYPE;
|
230 | var Memo = REACT_MEMO_TYPE;
|
231 | var Portal = REACT_PORTAL_TYPE;
|
232 | var Profiler = REACT_PROFILER_TYPE;
|
233 | var StrictMode = REACT_STRICT_MODE_TYPE;
|
234 | var Suspense = REACT_SUSPENSE_TYPE;
|
235 | var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
236 |
|
237 | function isAsyncMode(object) {
|
238 | {
|
239 | if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
240 | hasWarnedAboutDeprecatedIsAsyncMode = true;
|
241 | lowPriorityWarningWithoutStack$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
242 | }
|
243 | }
|
244 |
|
245 | return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
246 | }
|
247 | function isConcurrentMode(object) {
|
248 | return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
249 | }
|
250 | function isContextConsumer(object) {
|
251 | return typeOf(object) === REACT_CONTEXT_TYPE;
|
252 | }
|
253 | function isContextProvider(object) {
|
254 | return typeOf(object) === REACT_PROVIDER_TYPE;
|
255 | }
|
256 | function isElement(object) {
|
257 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
258 | }
|
259 | function isForwardRef(object) {
|
260 | return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
261 | }
|
262 | function isFragment(object) {
|
263 | return typeOf(object) === REACT_FRAGMENT_TYPE;
|
264 | }
|
265 | function isLazy(object) {
|
266 | return typeOf(object) === REACT_LAZY_TYPE;
|
267 | }
|
268 | function isMemo(object) {
|
269 | return typeOf(object) === REACT_MEMO_TYPE;
|
270 | }
|
271 | function isPortal(object) {
|
272 | return typeOf(object) === REACT_PORTAL_TYPE;
|
273 | }
|
274 | function isProfiler(object) {
|
275 | return typeOf(object) === REACT_PROFILER_TYPE;
|
276 | }
|
277 | function isStrictMode(object) {
|
278 | return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
279 | }
|
280 | function isSuspense(object) {
|
281 | return typeOf(object) === REACT_SUSPENSE_TYPE;
|
282 | }
|
283 |
|
284 | exports.typeOf = typeOf;
|
285 | exports.AsyncMode = AsyncMode;
|
286 | exports.ConcurrentMode = ConcurrentMode;
|
287 | exports.ContextConsumer = ContextConsumer;
|
288 | exports.ContextProvider = ContextProvider;
|
289 | exports.Element = Element;
|
290 | exports.ForwardRef = ForwardRef;
|
291 | exports.Fragment = Fragment;
|
292 | exports.Lazy = Lazy;
|
293 | exports.Memo = Memo;
|
294 | exports.Portal = Portal;
|
295 | exports.Profiler = Profiler;
|
296 | exports.StrictMode = StrictMode;
|
297 | exports.Suspense = Suspense;
|
298 | exports.isValidElementType = isValidElementType;
|
299 | exports.isAsyncMode = isAsyncMode;
|
300 | exports.isConcurrentMode = isConcurrentMode;
|
301 | exports.isContextConsumer = isContextConsumer;
|
302 | exports.isContextProvider = isContextProvider;
|
303 | exports.isElement = isElement;
|
304 | exports.isForwardRef = isForwardRef;
|
305 | exports.isFragment = isFragment;
|
306 | exports.isLazy = isLazy;
|
307 | exports.isMemo = isMemo;
|
308 | exports.isPortal = isPortal;
|
309 | exports.isProfiler = isProfiler;
|
310 | exports.isStrictMode = isStrictMode;
|
311 | exports.isSuspense = isSuspense;
|
312 | })();
|
313 | }
|
314 | });
|
315 |
|
316 | unwrapExports(reactIs_development);
|
317 | var reactIs_development_1 = reactIs_development.typeOf;
|
318 | var reactIs_development_2 = reactIs_development.AsyncMode;
|
319 | var reactIs_development_3 = reactIs_development.ConcurrentMode;
|
320 | var reactIs_development_4 = reactIs_development.ContextConsumer;
|
321 | var reactIs_development_5 = reactIs_development.ContextProvider;
|
322 | var reactIs_development_6 = reactIs_development.Element;
|
323 | var reactIs_development_7 = reactIs_development.ForwardRef;
|
324 | var reactIs_development_8 = reactIs_development.Fragment;
|
325 | var reactIs_development_9 = reactIs_development.Lazy;
|
326 | var reactIs_development_10 = reactIs_development.Memo;
|
327 | var reactIs_development_11 = reactIs_development.Portal;
|
328 | var reactIs_development_12 = reactIs_development.Profiler;
|
329 | var reactIs_development_13 = reactIs_development.StrictMode;
|
330 | var reactIs_development_14 = reactIs_development.Suspense;
|
331 | var reactIs_development_15 = reactIs_development.isValidElementType;
|
332 | var reactIs_development_16 = reactIs_development.isAsyncMode;
|
333 | var reactIs_development_17 = reactIs_development.isConcurrentMode;
|
334 | var reactIs_development_18 = reactIs_development.isContextConsumer;
|
335 | var reactIs_development_19 = reactIs_development.isContextProvider;
|
336 | var reactIs_development_20 = reactIs_development.isElement;
|
337 | var reactIs_development_21 = reactIs_development.isForwardRef;
|
338 | var reactIs_development_22 = reactIs_development.isFragment;
|
339 | var reactIs_development_23 = reactIs_development.isLazy;
|
340 | var reactIs_development_24 = reactIs_development.isMemo;
|
341 | var reactIs_development_25 = reactIs_development.isPortal;
|
342 | var reactIs_development_26 = reactIs_development.isProfiler;
|
343 | var reactIs_development_27 = reactIs_development.isStrictMode;
|
344 | var reactIs_development_28 = reactIs_development.isSuspense;
|
345 |
|
346 | var reactIs = createCommonjsModule(function (module) {
|
347 |
|
348 | {
|
349 | module.exports = reactIs_development;
|
350 | }
|
351 | });
|
352 | var reactIs_1 = reactIs.typeOf;
|
353 | var reactIs_2 = reactIs.AsyncMode;
|
354 | var reactIs_3 = reactIs.ConcurrentMode;
|
355 | var reactIs_4 = reactIs.ContextConsumer;
|
356 | var reactIs_5 = reactIs.ContextProvider;
|
357 | var reactIs_6 = reactIs.Element;
|
358 | var reactIs_7 = reactIs.ForwardRef;
|
359 | var reactIs_8 = reactIs.Fragment;
|
360 | var reactIs_9 = reactIs.Lazy;
|
361 | var reactIs_10 = reactIs.Memo;
|
362 | var reactIs_11 = reactIs.Portal;
|
363 | var reactIs_12 = reactIs.Profiler;
|
364 | var reactIs_13 = reactIs.StrictMode;
|
365 | var reactIs_14 = reactIs.Suspense;
|
366 | var reactIs_15 = reactIs.isValidElementType;
|
367 | var reactIs_16 = reactIs.isAsyncMode;
|
368 | var reactIs_17 = reactIs.isConcurrentMode;
|
369 | var reactIs_18 = reactIs.isContextConsumer;
|
370 | var reactIs_19 = reactIs.isContextProvider;
|
371 | var reactIs_20 = reactIs.isElement;
|
372 | var reactIs_21 = reactIs.isForwardRef;
|
373 | var reactIs_22 = reactIs.isFragment;
|
374 | var reactIs_23 = reactIs.isLazy;
|
375 | var reactIs_24 = reactIs.isMemo;
|
376 | var reactIs_25 = reactIs.isPortal;
|
377 | var reactIs_26 = reactIs.isProfiler;
|
378 | var reactIs_27 = reactIs.isStrictMode;
|
379 | var reactIs_28 = reactIs.isSuspense;
|
380 |
|
381 | |
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
388 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
389 | var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
390 |
|
391 | function toObject(val) {
|
392 | if (val === null || val === undefined) {
|
393 | throw new TypeError('Object.assign cannot be called with null or undefined');
|
394 | }
|
395 |
|
396 | return Object(val);
|
397 | }
|
398 |
|
399 | function shouldUseNative() {
|
400 | try {
|
401 | if (!Object.assign) {
|
402 | return false;
|
403 | }
|
404 |
|
405 |
|
406 |
|
407 |
|
408 | var test1 = new String('abc');
|
409 | test1[5] = 'de';
|
410 | if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
411 | return false;
|
412 | }
|
413 |
|
414 |
|
415 | var test2 = {};
|
416 | for (var i = 0; i < 10; i++) {
|
417 | test2['_' + String.fromCharCode(i)] = i;
|
418 | }
|
419 | var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
420 | return test2[n];
|
421 | });
|
422 | if (order2.join('') !== '0123456789') {
|
423 | return false;
|
424 | }
|
425 |
|
426 |
|
427 | var test3 = {};
|
428 | 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
429 | test3[letter] = letter;
|
430 | });
|
431 | if (Object.keys(Object.assign({}, test3)).join('') !==
|
432 | 'abcdefghijklmnopqrst') {
|
433 | return false;
|
434 | }
|
435 |
|
436 | return true;
|
437 | } catch (err) {
|
438 |
|
439 | return false;
|
440 | }
|
441 | }
|
442 |
|
443 | var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
444 | var from;
|
445 | var to = toObject(target);
|
446 | var symbols;
|
447 |
|
448 | for (var s = 1; s < arguments.length; s++) {
|
449 | from = Object(arguments[s]);
|
450 |
|
451 | for (var key in from) {
|
452 | if (hasOwnProperty.call(from, key)) {
|
453 | to[key] = from[key];
|
454 | }
|
455 | }
|
456 |
|
457 | if (getOwnPropertySymbols) {
|
458 | symbols = getOwnPropertySymbols(from);
|
459 | for (var i = 0; i < symbols.length; i++) {
|
460 | if (propIsEnumerable.call(from, symbols[i])) {
|
461 | to[symbols[i]] = from[symbols[i]];
|
462 | }
|
463 | }
|
464 | }
|
465 | }
|
466 |
|
467 | return to;
|
468 | };
|
469 |
|
470 | |
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 | var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
478 |
|
479 | var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
480 |
|
481 | var printWarning = function() {};
|
482 |
|
483 | {
|
484 | var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
485 | var loggedTypeFailures = {};
|
486 | var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
487 |
|
488 | printWarning = function(text) {
|
489 | var message = 'Warning: ' + text;
|
490 | if (typeof console !== 'undefined') {
|
491 | console.error(message);
|
492 | }
|
493 | try {
|
494 |
|
495 |
|
496 |
|
497 | throw new Error(message);
|
498 | } catch (x) {}
|
499 | };
|
500 | }
|
501 |
|
502 | |
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 | function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
514 | {
|
515 | for (var typeSpecName in typeSpecs) {
|
516 | if (has(typeSpecs, typeSpecName)) {
|
517 | var error;
|
518 |
|
519 |
|
520 |
|
521 | try {
|
522 |
|
523 |
|
524 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
525 | var err = Error(
|
526 | (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
527 | 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
|
528 | );
|
529 | err.name = 'Invariant Violation';
|
530 | throw err;
|
531 | }
|
532 | error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
533 | } catch (ex) {
|
534 | error = ex;
|
535 | }
|
536 | if (error && !(error instanceof Error)) {
|
537 | printWarning(
|
538 | (componentName || 'React class') + ': type specification of ' +
|
539 | location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
540 | 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
541 | 'You may have forgotten to pass an argument to the type checker ' +
|
542 | 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
543 | 'shape all require an argument).'
|
544 | );
|
545 | }
|
546 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
547 |
|
548 |
|
549 | loggedTypeFailures[error.message] = true;
|
550 |
|
551 | var stack = getStack ? getStack() : '';
|
552 |
|
553 | printWarning(
|
554 | 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
555 | );
|
556 | }
|
557 | }
|
558 | }
|
559 | }
|
560 | }
|
561 |
|
562 | |
563 |
|
564 |
|
565 |
|
566 |
|
567 | checkPropTypes.resetWarningCache = function() {
|
568 | {
|
569 | loggedTypeFailures = {};
|
570 | }
|
571 | };
|
572 |
|
573 | var checkPropTypes_1 = checkPropTypes;
|
574 |
|
575 | var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
576 | var printWarning$1 = function() {};
|
577 |
|
578 | {
|
579 | printWarning$1 = function(text) {
|
580 | var message = 'Warning: ' + text;
|
581 | if (typeof console !== 'undefined') {
|
582 | console.error(message);
|
583 | }
|
584 | try {
|
585 |
|
586 |
|
587 |
|
588 | throw new Error(message);
|
589 | } catch (x) {}
|
590 | };
|
591 | }
|
592 |
|
593 | function emptyFunctionThatReturnsNull() {
|
594 | return null;
|
595 | }
|
596 |
|
597 | var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
598 |
|
599 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
600 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
601 |
|
602 | |
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 | function getIteratorFn(maybeIterable) {
|
617 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
618 | if (typeof iteratorFn === 'function') {
|
619 | return iteratorFn;
|
620 | }
|
621 | }
|
622 |
|
623 | |
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 | var ANONYMOUS = '<<anonymous>>';
|
671 |
|
672 |
|
673 |
|
674 | var ReactPropTypes = {
|
675 | array: createPrimitiveTypeChecker('array'),
|
676 | bool: createPrimitiveTypeChecker('boolean'),
|
677 | func: createPrimitiveTypeChecker('function'),
|
678 | number: createPrimitiveTypeChecker('number'),
|
679 | object: createPrimitiveTypeChecker('object'),
|
680 | string: createPrimitiveTypeChecker('string'),
|
681 | symbol: createPrimitiveTypeChecker('symbol'),
|
682 |
|
683 | any: createAnyTypeChecker(),
|
684 | arrayOf: createArrayOfTypeChecker,
|
685 | element: createElementTypeChecker(),
|
686 | elementType: createElementTypeTypeChecker(),
|
687 | instanceOf: createInstanceTypeChecker,
|
688 | node: createNodeChecker(),
|
689 | objectOf: createObjectOfTypeChecker,
|
690 | oneOf: createEnumTypeChecker,
|
691 | oneOfType: createUnionTypeChecker,
|
692 | shape: createShapeTypeChecker,
|
693 | exact: createStrictShapeTypeChecker,
|
694 | };
|
695 |
|
696 | |
697 |
|
698 |
|
699 |
|
700 |
|
701 | function is(x, y) {
|
702 |
|
703 | if (x === y) {
|
704 |
|
705 |
|
706 | return x !== 0 || 1 / x === 1 / y;
|
707 | } else {
|
708 |
|
709 | return x !== x && y !== y;
|
710 | }
|
711 | }
|
712 |
|
713 |
|
714 | |
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 | function PropTypeError(message) {
|
722 | this.message = message;
|
723 | this.stack = '';
|
724 | }
|
725 |
|
726 | PropTypeError.prototype = Error.prototype;
|
727 |
|
728 | function createChainableTypeChecker(validate) {
|
729 | {
|
730 | var manualPropTypeCallCache = {};
|
731 | var manualPropTypeWarningCount = 0;
|
732 | }
|
733 | function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
734 | componentName = componentName || ANONYMOUS;
|
735 | propFullName = propFullName || propName;
|
736 |
|
737 | if (secret !== ReactPropTypesSecret_1) {
|
738 | if (throwOnDirectAccess) {
|
739 |
|
740 | var err = new Error(
|
741 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
742 | 'Use `PropTypes.checkPropTypes()` to call them. ' +
|
743 | 'Read more at http://fb.me/use-check-prop-types'
|
744 | );
|
745 | err.name = 'Invariant Violation';
|
746 | throw err;
|
747 | } else if ( typeof console !== 'undefined') {
|
748 |
|
749 | var cacheKey = componentName + ':' + propName;
|
750 | if (
|
751 | !manualPropTypeCallCache[cacheKey] &&
|
752 |
|
753 | manualPropTypeWarningCount < 3
|
754 | ) {
|
755 | printWarning$1(
|
756 | 'You are manually calling a React.PropTypes validation ' +
|
757 | 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
758 | 'and will throw in the standalone `prop-types` package. ' +
|
759 | 'You may be seeing this warning due to a third-party PropTypes ' +
|
760 | 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
761 | );
|
762 | manualPropTypeCallCache[cacheKey] = true;
|
763 | manualPropTypeWarningCount++;
|
764 | }
|
765 | }
|
766 | }
|
767 | if (props[propName] == null) {
|
768 | if (isRequired) {
|
769 | if (props[propName] === null) {
|
770 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
771 | }
|
772 | return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
773 | }
|
774 | return null;
|
775 | } else {
|
776 | return validate(props, propName, componentName, location, propFullName);
|
777 | }
|
778 | }
|
779 |
|
780 | var chainedCheckType = checkType.bind(null, false);
|
781 | chainedCheckType.isRequired = checkType.bind(null, true);
|
782 |
|
783 | return chainedCheckType;
|
784 | }
|
785 |
|
786 | function createPrimitiveTypeChecker(expectedType) {
|
787 | function validate(props, propName, componentName, location, propFullName, secret) {
|
788 | var propValue = props[propName];
|
789 | var propType = getPropType(propValue);
|
790 | if (propType !== expectedType) {
|
791 |
|
792 |
|
793 |
|
794 | var preciseType = getPreciseType(propValue);
|
795 |
|
796 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
797 | }
|
798 | return null;
|
799 | }
|
800 | return createChainableTypeChecker(validate);
|
801 | }
|
802 |
|
803 | function createAnyTypeChecker() {
|
804 | return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
805 | }
|
806 |
|
807 | function createArrayOfTypeChecker(typeChecker) {
|
808 | function validate(props, propName, componentName, location, propFullName) {
|
809 | if (typeof typeChecker !== 'function') {
|
810 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
811 | }
|
812 | var propValue = props[propName];
|
813 | if (!Array.isArray(propValue)) {
|
814 | var propType = getPropType(propValue);
|
815 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
816 | }
|
817 | for (var i = 0; i < propValue.length; i++) {
|
818 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
819 | if (error instanceof Error) {
|
820 | return error;
|
821 | }
|
822 | }
|
823 | return null;
|
824 | }
|
825 | return createChainableTypeChecker(validate);
|
826 | }
|
827 |
|
828 | function createElementTypeChecker() {
|
829 | function validate(props, propName, componentName, location, propFullName) {
|
830 | var propValue = props[propName];
|
831 | if (!isValidElement(propValue)) {
|
832 | var propType = getPropType(propValue);
|
833 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
834 | }
|
835 | return null;
|
836 | }
|
837 | return createChainableTypeChecker(validate);
|
838 | }
|
839 |
|
840 | function createElementTypeTypeChecker() {
|
841 | function validate(props, propName, componentName, location, propFullName) {
|
842 | var propValue = props[propName];
|
843 | if (!reactIs.isValidElementType(propValue)) {
|
844 | var propType = getPropType(propValue);
|
845 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
846 | }
|
847 | return null;
|
848 | }
|
849 | return createChainableTypeChecker(validate);
|
850 | }
|
851 |
|
852 | function createInstanceTypeChecker(expectedClass) {
|
853 | function validate(props, propName, componentName, location, propFullName) {
|
854 | if (!(props[propName] instanceof expectedClass)) {
|
855 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
856 | var actualClassName = getClassName(props[propName]);
|
857 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
858 | }
|
859 | return null;
|
860 | }
|
861 | return createChainableTypeChecker(validate);
|
862 | }
|
863 |
|
864 | function createEnumTypeChecker(expectedValues) {
|
865 | if (!Array.isArray(expectedValues)) {
|
866 | {
|
867 | if (arguments.length > 1) {
|
868 | printWarning$1(
|
869 | 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
870 | 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
871 | );
|
872 | } else {
|
873 | printWarning$1('Invalid argument supplied to oneOf, expected an array.');
|
874 | }
|
875 | }
|
876 | return emptyFunctionThatReturnsNull;
|
877 | }
|
878 |
|
879 | function validate(props, propName, componentName, location, propFullName) {
|
880 | var propValue = props[propName];
|
881 | for (var i = 0; i < expectedValues.length; i++) {
|
882 | if (is(propValue, expectedValues[i])) {
|
883 | return null;
|
884 | }
|
885 | }
|
886 |
|
887 | var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
888 | var type = getPreciseType(value);
|
889 | if (type === 'symbol') {
|
890 | return String(value);
|
891 | }
|
892 | return value;
|
893 | });
|
894 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
895 | }
|
896 | return createChainableTypeChecker(validate);
|
897 | }
|
898 |
|
899 | function createObjectOfTypeChecker(typeChecker) {
|
900 | function validate(props, propName, componentName, location, propFullName) {
|
901 | if (typeof typeChecker !== 'function') {
|
902 | return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
903 | }
|
904 | var propValue = props[propName];
|
905 | var propType = getPropType(propValue);
|
906 | if (propType !== 'object') {
|
907 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
908 | }
|
909 | for (var key in propValue) {
|
910 | if (has$1(propValue, key)) {
|
911 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
912 | if (error instanceof Error) {
|
913 | return error;
|
914 | }
|
915 | }
|
916 | }
|
917 | return null;
|
918 | }
|
919 | return createChainableTypeChecker(validate);
|
920 | }
|
921 |
|
922 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
923 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
924 | printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') ;
|
925 | return emptyFunctionThatReturnsNull;
|
926 | }
|
927 |
|
928 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
929 | var checker = arrayOfTypeCheckers[i];
|
930 | if (typeof checker !== 'function') {
|
931 | printWarning$1(
|
932 | 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
933 | 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
934 | );
|
935 | return emptyFunctionThatReturnsNull;
|
936 | }
|
937 | }
|
938 |
|
939 | function validate(props, propName, componentName, location, propFullName) {
|
940 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
941 | var checker = arrayOfTypeCheckers[i];
|
942 | if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
|
943 | return null;
|
944 | }
|
945 | }
|
946 |
|
947 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
948 | }
|
949 | return createChainableTypeChecker(validate);
|
950 | }
|
951 |
|
952 | function createNodeChecker() {
|
953 | function validate(props, propName, componentName, location, propFullName) {
|
954 | if (!isNode(props[propName])) {
|
955 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
956 | }
|
957 | return null;
|
958 | }
|
959 | return createChainableTypeChecker(validate);
|
960 | }
|
961 |
|
962 | function createShapeTypeChecker(shapeTypes) {
|
963 | function validate(props, propName, componentName, location, propFullName) {
|
964 | var propValue = props[propName];
|
965 | var propType = getPropType(propValue);
|
966 | if (propType !== 'object') {
|
967 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
968 | }
|
969 | for (var key in shapeTypes) {
|
970 | var checker = shapeTypes[key];
|
971 | if (!checker) {
|
972 | continue;
|
973 | }
|
974 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
975 | if (error) {
|
976 | return error;
|
977 | }
|
978 | }
|
979 | return null;
|
980 | }
|
981 | return createChainableTypeChecker(validate);
|
982 | }
|
983 |
|
984 | function createStrictShapeTypeChecker(shapeTypes) {
|
985 | function validate(props, propName, componentName, location, propFullName) {
|
986 | var propValue = props[propName];
|
987 | var propType = getPropType(propValue);
|
988 | if (propType !== 'object') {
|
989 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
990 | }
|
991 |
|
992 |
|
993 | var allKeys = objectAssign({}, props[propName], shapeTypes);
|
994 | for (var key in allKeys) {
|
995 | var checker = shapeTypes[key];
|
996 | if (!checker) {
|
997 | return new PropTypeError(
|
998 | 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
999 | '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
1000 | '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
1001 | );
|
1002 | }
|
1003 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
1004 | if (error) {
|
1005 | return error;
|
1006 | }
|
1007 | }
|
1008 | return null;
|
1009 | }
|
1010 |
|
1011 | return createChainableTypeChecker(validate);
|
1012 | }
|
1013 |
|
1014 | function isNode(propValue) {
|
1015 | switch (typeof propValue) {
|
1016 | case 'number':
|
1017 | case 'string':
|
1018 | case 'undefined':
|
1019 | return true;
|
1020 | case 'boolean':
|
1021 | return !propValue;
|
1022 | case 'object':
|
1023 | if (Array.isArray(propValue)) {
|
1024 | return propValue.every(isNode);
|
1025 | }
|
1026 | if (propValue === null || isValidElement(propValue)) {
|
1027 | return true;
|
1028 | }
|
1029 |
|
1030 | var iteratorFn = getIteratorFn(propValue);
|
1031 | if (iteratorFn) {
|
1032 | var iterator = iteratorFn.call(propValue);
|
1033 | var step;
|
1034 | if (iteratorFn !== propValue.entries) {
|
1035 | while (!(step = iterator.next()).done) {
|
1036 | if (!isNode(step.value)) {
|
1037 | return false;
|
1038 | }
|
1039 | }
|
1040 | } else {
|
1041 |
|
1042 | while (!(step = iterator.next()).done) {
|
1043 | var entry = step.value;
|
1044 | if (entry) {
|
1045 | if (!isNode(entry[1])) {
|
1046 | return false;
|
1047 | }
|
1048 | }
|
1049 | }
|
1050 | }
|
1051 | } else {
|
1052 | return false;
|
1053 | }
|
1054 |
|
1055 | return true;
|
1056 | default:
|
1057 | return false;
|
1058 | }
|
1059 | }
|
1060 |
|
1061 | function isSymbol(propType, propValue) {
|
1062 |
|
1063 | if (propType === 'symbol') {
|
1064 | return true;
|
1065 | }
|
1066 |
|
1067 |
|
1068 | if (!propValue) {
|
1069 | return false;
|
1070 | }
|
1071 |
|
1072 |
|
1073 | if (propValue['@@toStringTag'] === 'Symbol') {
|
1074 | return true;
|
1075 | }
|
1076 |
|
1077 |
|
1078 | if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
1079 | return true;
|
1080 | }
|
1081 |
|
1082 | return false;
|
1083 | }
|
1084 |
|
1085 |
|
1086 | function getPropType(propValue) {
|
1087 | var propType = typeof propValue;
|
1088 | if (Array.isArray(propValue)) {
|
1089 | return 'array';
|
1090 | }
|
1091 | if (propValue instanceof RegExp) {
|
1092 |
|
1093 |
|
1094 |
|
1095 | return 'object';
|
1096 | }
|
1097 | if (isSymbol(propType, propValue)) {
|
1098 | return 'symbol';
|
1099 | }
|
1100 | return propType;
|
1101 | }
|
1102 |
|
1103 |
|
1104 |
|
1105 | function getPreciseType(propValue) {
|
1106 | if (typeof propValue === 'undefined' || propValue === null) {
|
1107 | return '' + propValue;
|
1108 | }
|
1109 | var propType = getPropType(propValue);
|
1110 | if (propType === 'object') {
|
1111 | if (propValue instanceof Date) {
|
1112 | return 'date';
|
1113 | } else if (propValue instanceof RegExp) {
|
1114 | return 'regexp';
|
1115 | }
|
1116 | }
|
1117 | return propType;
|
1118 | }
|
1119 |
|
1120 |
|
1121 |
|
1122 | function getPostfixForTypeWarning(value) {
|
1123 | var type = getPreciseType(value);
|
1124 | switch (type) {
|
1125 | case 'array':
|
1126 | case 'object':
|
1127 | return 'an ' + type;
|
1128 | case 'boolean':
|
1129 | case 'date':
|
1130 | case 'regexp':
|
1131 | return 'a ' + type;
|
1132 | default:
|
1133 | return type;
|
1134 | }
|
1135 | }
|
1136 |
|
1137 |
|
1138 | function getClassName(propValue) {
|
1139 | if (!propValue.constructor || !propValue.constructor.name) {
|
1140 | return ANONYMOUS;
|
1141 | }
|
1142 | return propValue.constructor.name;
|
1143 | }
|
1144 |
|
1145 | ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
1146 | ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
|
1147 | ReactPropTypes.PropTypes = ReactPropTypes;
|
1148 |
|
1149 | return ReactPropTypes;
|
1150 | };
|
1151 |
|
1152 | var propTypes = createCommonjsModule(function (module) {
|
1153 | |
1154 |
|
1155 |
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 | {
|
1161 | var ReactIs = reactIs;
|
1162 |
|
1163 |
|
1164 |
|
1165 | var throwOnDirectAccess = true;
|
1166 | module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
1167 | }
|
1168 | });
|
1169 | var propTypes_1 = propTypes.array;
|
1170 | var propTypes_2 = propTypes.bool;
|
1171 | var propTypes_3 = propTypes.func;
|
1172 | var propTypes_4 = propTypes.number;
|
1173 | var propTypes_5 = propTypes.object;
|
1174 | var propTypes_6 = propTypes.string;
|
1175 | var propTypes_7 = propTypes.symbol;
|
1176 | var propTypes_8 = propTypes.any;
|
1177 | var propTypes_9 = propTypes.arrayOf;
|
1178 | var propTypes_10 = propTypes.element;
|
1179 | var propTypes_11 = propTypes.elementType;
|
1180 | var propTypes_12 = propTypes.instanceOf;
|
1181 | var propTypes_13 = propTypes.node;
|
1182 | var propTypes_14 = propTypes.objectOf;
|
1183 | var propTypes_15 = propTypes.oneOf;
|
1184 | var propTypes_16 = propTypes.oneOfType;
|
1185 | var propTypes_17 = propTypes.shape;
|
1186 | var propTypes_18 = propTypes.exact;
|
1187 | var propTypes_19 = propTypes.checkPropTypes;
|
1188 | var propTypes_20 = propTypes.resetWarningCache;
|
1189 | var propTypes_21 = propTypes.PropTypes;
|
1190 |
|
1191 | var MuiPickersContext = React.createContext(null);
|
1192 | var MuiPickersUtilsProvider = function MuiPickersUtilsProvider(_ref) {
|
1193 | var Utils = _ref.utils,
|
1194 | children = _ref.children,
|
1195 | locale = _ref.locale,
|
1196 | libInstance = _ref.libInstance;
|
1197 | var utils = React.useMemo(function () {
|
1198 | return new Utils({
|
1199 | locale: locale,
|
1200 | instance: libInstance
|
1201 | });
|
1202 | }, [Utils, libInstance, locale]);
|
1203 | return React.createElement(MuiPickersContext.Provider, {
|
1204 | value: utils,
|
1205 | children: children
|
1206 | });
|
1207 | };
|
1208 | MuiPickersUtilsProvider.propTypes = {
|
1209 | utils: propTypes_3.isRequired,
|
1210 | locale: propTypes_16([propTypes_5, propTypes_6]),
|
1211 | children: propTypes_16([propTypes_10.isRequired, propTypes_9(propTypes_10.isRequired)]).isRequired
|
1212 | } ;
|
1213 |
|
1214 | var checkUtils = function checkUtils(utils) {
|
1215 | if (!utils) {
|
1216 |
|
1217 | throw new Error('Can not find utils in context. You either a) forgot to wrap your component tree in MuiPickersUtilsProvider; or b) mixed named and direct file imports. Recommendation: use named imports from the module index.');
|
1218 | }
|
1219 | };
|
1220 | function useUtils() {
|
1221 | var utils = React.useContext(MuiPickersContext);
|
1222 | checkUtils(utils);
|
1223 | return utils;
|
1224 | }
|
1225 |
|
1226 | function toVal(mix) {
|
1227 | var k, y, str='';
|
1228 | if (mix) {
|
1229 | if (typeof mix === 'object') {
|
1230 | if (!!mix.push) {
|
1231 | for (k=0; k < mix.length; k++) {
|
1232 | if (mix[k] && (y = toVal(mix[k]))) {
|
1233 | str && (str += ' ');
|
1234 | str += y;
|
1235 | }
|
1236 | }
|
1237 | } else {
|
1238 | for (k in mix) {
|
1239 | if (mix[k] && (y = toVal(k))) {
|
1240 | str && (str += ' ');
|
1241 | str += y;
|
1242 | }
|
1243 | }
|
1244 | }
|
1245 | } else if (typeof mix !== 'boolean' && !mix.call) {
|
1246 | str && (str += ' ');
|
1247 | str += mix;
|
1248 | }
|
1249 | }
|
1250 | return str;
|
1251 | }
|
1252 |
|
1253 | function clsx () {
|
1254 | var i=0, x, str='';
|
1255 | while (i < arguments.length) {
|
1256 | if (x = toVal(arguments[i++])) {
|
1257 | str && (str += ' ');
|
1258 | str += x;
|
1259 | }
|
1260 | }
|
1261 | return str;
|
1262 | }
|
1263 |
|
1264 | function _extends() {
|
1265 | _extends = Object.assign || function (target) {
|
1266 | for (var i = 1; i < arguments.length; i++) {
|
1267 | var source = arguments[i];
|
1268 |
|
1269 | for (var key in source) {
|
1270 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1271 | target[key] = source[key];
|
1272 | }
|
1273 | }
|
1274 | }
|
1275 |
|
1276 | return target;
|
1277 | };
|
1278 |
|
1279 | return _extends.apply(this, arguments);
|
1280 | }
|
1281 |
|
1282 | function _objectWithoutPropertiesLoose(source, excluded) {
|
1283 | if (source == null) return {};
|
1284 | var target = {};
|
1285 | var sourceKeys = Object.keys(source);
|
1286 | var key, i;
|
1287 |
|
1288 | for (i = 0; i < sourceKeys.length; i++) {
|
1289 | key = sourceKeys[i];
|
1290 | if (excluded.indexOf(key) >= 0) continue;
|
1291 | target[key] = source[key];
|
1292 | }
|
1293 |
|
1294 | return target;
|
1295 | }
|
1296 |
|
1297 | function _objectWithoutProperties(source, excluded) {
|
1298 | if (source == null) return {};
|
1299 | var target = _objectWithoutPropertiesLoose(source, excluded);
|
1300 | var key, i;
|
1301 |
|
1302 | if (Object.getOwnPropertySymbols) {
|
1303 | var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
1304 |
|
1305 | for (i = 0; i < sourceSymbolKeys.length; i++) {
|
1306 | key = sourceSymbolKeys[i];
|
1307 | if (excluded.indexOf(key) >= 0) continue;
|
1308 | if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
1309 | target[key] = source[key];
|
1310 | }
|
1311 | }
|
1312 |
|
1313 | return target;
|
1314 | }
|
1315 |
|
1316 | var useStyles = styles$5.makeStyles(function (theme) {
|
1317 | var textColor = theme.palette.type === 'light' ? theme.palette.primary.contrastText : theme.palette.getContrastText(theme.palette.background["default"]);
|
1318 | return {
|
1319 | toolbarTxt: {
|
1320 | color: styles$5.fade(textColor, 0.54)
|
1321 | },
|
1322 | toolbarBtnSelected: {
|
1323 | color: textColor
|
1324 | }
|
1325 | };
|
1326 | }, {
|
1327 | name: 'MuiPickersToolbarText'
|
1328 | });
|
1329 |
|
1330 | var ToolbarText = function ToolbarText(_ref) {
|
1331 | var selected = _ref.selected,
|
1332 | label = _ref.label,
|
1333 | _ref$className = _ref.className,
|
1334 | className = _ref$className === void 0 ? null : _ref$className,
|
1335 | other = _objectWithoutProperties(_ref, ["selected", "label", "className"]);
|
1336 |
|
1337 | var classes = useStyles();
|
1338 | return React.createElement(Typography, _extends({
|
1339 | children: label,
|
1340 | className: clsx(classes.toolbarTxt, className, selected && classes.toolbarBtnSelected)
|
1341 | }, other));
|
1342 | };
|
1343 |
|
1344 | var ToolbarButton = function ToolbarButton(_ref) {
|
1345 | var classes = _ref.classes,
|
1346 | _ref$className = _ref.className,
|
1347 | className = _ref$className === void 0 ? null : _ref$className,
|
1348 | label = _ref.label,
|
1349 | selected = _ref.selected,
|
1350 | variant = _ref.variant,
|
1351 | align = _ref.align,
|
1352 | typographyClassName = _ref.typographyClassName,
|
1353 | other = _objectWithoutProperties(_ref, ["classes", "className", "label", "selected", "variant", "align", "typographyClassName"]);
|
1354 |
|
1355 | return React.createElement(Button, _extends({
|
1356 | variant: "text",
|
1357 | className: clsx(classes.toolbarBtn, className)
|
1358 | }, other), React.createElement(ToolbarText, {
|
1359 | align: align,
|
1360 | className: typographyClassName,
|
1361 | variant: variant,
|
1362 | label: label,
|
1363 | selected: selected
|
1364 | }));
|
1365 | };
|
1366 |
|
1367 | ToolbarButton.propTypes = {
|
1368 | selected: propTypes_2.isRequired,
|
1369 | label: propTypes_6.isRequired,
|
1370 | classes: propTypes_8.isRequired,
|
1371 | className: propTypes_6,
|
1372 | innerRef: propTypes_8
|
1373 | } ;
|
1374 | ToolbarButton.defaultProps = {
|
1375 | className: ''
|
1376 | };
|
1377 | var styles = styles$5.createStyles({
|
1378 | toolbarBtn: {
|
1379 | padding: 0,
|
1380 | minWidth: '16px',
|
1381 | textTransform: 'none'
|
1382 | }
|
1383 | });
|
1384 | var ToolbarButton$1 = styles$5.withStyles(styles, {
|
1385 | name: 'MuiPickersToolbarButton'
|
1386 | })(ToolbarButton);
|
1387 |
|
1388 | var useStyles$1 = styles$5.makeStyles(function (theme) {
|
1389 | return {
|
1390 | toolbar: {
|
1391 | display: 'flex',
|
1392 | flexDirection: 'row',
|
1393 | alignItems: 'center',
|
1394 | justifyContent: 'center',
|
1395 | height: 100,
|
1396 | backgroundColor: theme.palette.type === 'light' ? theme.palette.primary.main : theme.palette.background["default"]
|
1397 | },
|
1398 | toolbarLandscape: {
|
1399 | height: 'auto',
|
1400 | maxWidth: 150,
|
1401 | padding: 8,
|
1402 | justifyContent: 'flex-start'
|
1403 | }
|
1404 | };
|
1405 | }, {
|
1406 | name: 'MuiPickersToolbar'
|
1407 | });
|
1408 |
|
1409 | var PickerToolbar = function PickerToolbar(_ref) {
|
1410 | var children = _ref.children,
|
1411 | isLandscape = _ref.isLandscape,
|
1412 | _ref$className = _ref.className,
|
1413 | className = _ref$className === void 0 ? null : _ref$className,
|
1414 | other = _objectWithoutProperties(_ref, ["children", "isLandscape", "className"]);
|
1415 |
|
1416 | var classes = useStyles$1();
|
1417 | return React.createElement(Toolbar, _extends({
|
1418 | className: clsx(classes.toolbar, className, isLandscape && classes.toolbarLandscape)
|
1419 | }, other), children);
|
1420 | };
|
1421 |
|
1422 |
|
1423 | function arrayIncludes(array, itemOrItems) {
|
1424 | if (Array.isArray(itemOrItems)) {
|
1425 | return itemOrItems.every(function (item) {
|
1426 | return array.indexOf(item) !== -1;
|
1427 | });
|
1428 | }
|
1429 |
|
1430 | return array.indexOf(itemOrItems) !== -1;
|
1431 | }
|
1432 |
|
1433 | var findClosestEnabledDate = function findClosestEnabledDate(_ref) {
|
1434 | var date = _ref.date,
|
1435 | utils = _ref.utils,
|
1436 | minDate = _ref.minDate,
|
1437 | maxDate = _ref.maxDate,
|
1438 | disableFuture = _ref.disableFuture,
|
1439 | disablePast = _ref.disablePast,
|
1440 | shouldDisableDate = _ref.shouldDisableDate;
|
1441 | var today = utils.startOfDay(utils.date());
|
1442 |
|
1443 | if (disablePast && utils.isBefore(minDate, today)) {
|
1444 | minDate = today;
|
1445 | }
|
1446 |
|
1447 | if (disableFuture && utils.isAfter(maxDate, today)) {
|
1448 | maxDate = today;
|
1449 | }
|
1450 |
|
1451 | var forward = date;
|
1452 | var backward = date;
|
1453 |
|
1454 | if (utils.isBefore(date, minDate)) {
|
1455 | forward = utils.date(minDate);
|
1456 | backward = null;
|
1457 | }
|
1458 |
|
1459 | if (utils.isAfter(date, maxDate)) {
|
1460 | if (backward) {
|
1461 | backward = utils.date(maxDate);
|
1462 | }
|
1463 |
|
1464 | forward = null;
|
1465 | }
|
1466 |
|
1467 | while (forward || backward) {
|
1468 | if (forward && utils.isAfter(forward, maxDate)) {
|
1469 | forward = null;
|
1470 | }
|
1471 |
|
1472 | if (backward && utils.isBefore(backward, minDate)) {
|
1473 | backward = null;
|
1474 | }
|
1475 |
|
1476 | if (forward) {
|
1477 | if (!shouldDisableDate(forward)) {
|
1478 | return forward;
|
1479 | }
|
1480 |
|
1481 | forward = utils.addDays(forward, 1);
|
1482 | }
|
1483 |
|
1484 | if (backward) {
|
1485 | if (!shouldDisableDate(backward)) {
|
1486 | return backward;
|
1487 | }
|
1488 |
|
1489 | backward = utils.addDays(backward, -1);
|
1490 | }
|
1491 | }
|
1492 |
|
1493 |
|
1494 | return utils.date();
|
1495 | };
|
1496 | var isYearOnlyView = function isYearOnlyView(views) {
|
1497 | return views.length === 1 && views[0] === 'year';
|
1498 | };
|
1499 | var isYearAndMonthViews = function isYearAndMonthViews(views) {
|
1500 | return views.length === 2 && arrayIncludes(views, 'month') && arrayIncludes(views, 'year');
|
1501 | };
|
1502 | var getFormatByViews = function getFormatByViews(views, utils) {
|
1503 | if (isYearOnlyView(views)) {
|
1504 | return utils.yearFormat;
|
1505 | }
|
1506 |
|
1507 | if (isYearAndMonthViews(views)) {
|
1508 | return utils.yearMonthFormat;
|
1509 | }
|
1510 |
|
1511 | return utils.dateFormat;
|
1512 | };
|
1513 |
|
1514 | var useStyles$2 = styles$5.makeStyles({
|
1515 | toolbar: {
|
1516 | flexDirection: 'column',
|
1517 | alignItems: 'flex-start'
|
1518 | },
|
1519 | toolbarLandscape: {
|
1520 | padding: 16
|
1521 | },
|
1522 | dateLandscape: {
|
1523 | marginRight: 16
|
1524 | }
|
1525 | }, {
|
1526 | name: 'MuiPickersDatePickerRoot'
|
1527 | });
|
1528 | var DatePickerToolbar = function DatePickerToolbar(_ref) {
|
1529 | var date = _ref.date,
|
1530 | views = _ref.views,
|
1531 | setOpenView = _ref.setOpenView,
|
1532 | isLandscape = _ref.isLandscape,
|
1533 | openView = _ref.openView;
|
1534 | var utils = useUtils();
|
1535 | var classes = useStyles$2();
|
1536 | var isYearOnly = React.useMemo(function () {
|
1537 | return isYearOnlyView(views);
|
1538 | }, [views]);
|
1539 | var isYearAndMonth = React.useMemo(function () {
|
1540 | return isYearAndMonthViews(views);
|
1541 | }, [views]);
|
1542 | return React.createElement(PickerToolbar, {
|
1543 | isLandscape: isLandscape,
|
1544 | className: clsx(!isYearOnly && classes.toolbar, isLandscape && classes.toolbarLandscape)
|
1545 | }, React.createElement(ToolbarButton$1, {
|
1546 | variant: isYearOnly ? 'h3' : 'subtitle1',
|
1547 | onClick: function onClick() {
|
1548 | return setOpenView('year');
|
1549 | },
|
1550 | selected: openView === 'year',
|
1551 | label: utils.getYearText(date)
|
1552 | }), !isYearOnly && !isYearAndMonth && React.createElement(ToolbarButton$1, {
|
1553 | variant: "h4",
|
1554 | selected: openView === 'date',
|
1555 | onClick: function onClick() {
|
1556 | return setOpenView('date');
|
1557 | },
|
1558 | align: isLandscape ? 'left' : 'center',
|
1559 | label: utils.getDatePickerHeaderText(date),
|
1560 | className: clsx(isLandscape && classes.dateLandscape)
|
1561 | }), isYearAndMonth && React.createElement(ToolbarButton$1, {
|
1562 | variant: "h4",
|
1563 | onClick: function onClick() {
|
1564 | return setOpenView('month');
|
1565 | },
|
1566 | selected: openView === 'month',
|
1567 | label: utils.getMonthText(date)
|
1568 | }));
|
1569 | };
|
1570 |
|
1571 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
1572 |
|
1573 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
1574 | var PureDateInput = function PureDateInput(_ref) {
|
1575 | var inputValue = _ref.inputValue,
|
1576 | inputVariant = _ref.inputVariant,
|
1577 | validationError = _ref.validationError,
|
1578 | InputProps = _ref.InputProps,
|
1579 | onOpen = _ref.openPicker,
|
1580 | _ref$TextFieldCompone = _ref.TextFieldComponent,
|
1581 | TextFieldComponent = _ref$TextFieldCompone === void 0 ? TextField : _ref$TextFieldCompone,
|
1582 | other = _objectWithoutProperties(_ref, ["inputValue", "inputVariant", "validationError", "InputProps", "openPicker", "TextFieldComponent"]);
|
1583 |
|
1584 | var PureDateInputProps = React.useMemo(function () {
|
1585 | return _objectSpread({}, InputProps, {
|
1586 | readOnly: true
|
1587 | });
|
1588 | }, [InputProps]);
|
1589 | return React.createElement(TextFieldComponent, _extends({
|
1590 | error: Boolean(validationError),
|
1591 | helperText: validationError
|
1592 | }, other, {
|
1593 |
|
1594 | onClick: onOpen,
|
1595 | value: inputValue,
|
1596 | variant: inputVariant,
|
1597 | InputProps: PureDateInputProps,
|
1598 | onKeyDown: function onKeyDown(e) {
|
1599 |
|
1600 | if (e.keyCode === 32) {
|
1601 | e.stopPropagation();
|
1602 | onOpen();
|
1603 | }
|
1604 | }
|
1605 | }));
|
1606 | };
|
1607 | PureDateInput.displayName = 'PureDateInput';
|
1608 |
|
1609 | function _inheritsLoose(subClass, superClass) {
|
1610 | subClass.prototype = Object.create(superClass.prototype);
|
1611 | subClass.prototype.constructor = subClass;
|
1612 | subClass.__proto__ = superClass;
|
1613 | }
|
1614 |
|
1615 | var Rifm =
|
1616 |
|
1617 | function (_React$Component) {
|
1618 | _inheritsLoose(Rifm, _React$Component);
|
1619 |
|
1620 | function Rifm(props) {
|
1621 | var _this;
|
1622 |
|
1623 | _this = _React$Component.call(this, props) || this;
|
1624 | _this._state = null;
|
1625 | _this._del = false;
|
1626 |
|
1627 | _this._handleChange = function (evt) {
|
1628 | {
|
1629 | if (evt.target.type === 'number') {
|
1630 | console.error('Rifm does not support input type=number, use type=tel instead.');
|
1631 | return;
|
1632 | }
|
1633 | }
|
1634 |
|
1635 |
|
1636 | var stateValue = _this.state.value;
|
1637 | var value = evt.target.value;
|
1638 | var input = evt.target;
|
1639 | var op = value.length > stateValue.length;
|
1640 | var del = _this._del;
|
1641 |
|
1642 | var noOp = stateValue === _this.props.format(value);
|
1643 |
|
1644 | _this.setState({
|
1645 | value: value,
|
1646 | local: true
|
1647 | }, function () {
|
1648 | var selectionStart = input.selectionStart;
|
1649 | var refuse = _this.props.refuse || /[^\d]+/g;
|
1650 | var before = value.substr(0, selectionStart).replace(refuse, '');
|
1651 | _this._state = {
|
1652 | input: input,
|
1653 | before: before,
|
1654 | op: op,
|
1655 | di: del && noOp,
|
1656 | del: del
|
1657 | };
|
1658 |
|
1659 | if (_this.props.replace && _this.props.replace(stateValue) && op && !noOp) {
|
1660 | var start = -1;
|
1661 |
|
1662 | for (var i = 0; i !== before.length; ++i) {
|
1663 | start = Math.max(start, value.toLowerCase().indexOf(before[i].toLowerCase(), start + 1));
|
1664 | }
|
1665 |
|
1666 | var c = value.substr(start + 1).replace(refuse, '')[0];
|
1667 | start = value.indexOf(c, start + 1);
|
1668 | value = "" + value.substr(0, start) + value.substr(start + 1);
|
1669 | }
|
1670 |
|
1671 | var fv = _this.props.format(value);
|
1672 |
|
1673 | if (stateValue === fv) {
|
1674 | _this.setState({
|
1675 | value: value
|
1676 | });
|
1677 | } else {
|
1678 | _this.props.onChange(fv);
|
1679 | }
|
1680 | });
|
1681 | };
|
1682 |
|
1683 | _this._hKD = function (evt) {
|
1684 | if (evt.code === 'Delete') {
|
1685 | _this._del = true;
|
1686 | }
|
1687 | };
|
1688 |
|
1689 | _this._hKU = function (evt) {
|
1690 | if (evt.code === 'Delete') {
|
1691 | _this._del = false;
|
1692 | }
|
1693 | };
|
1694 |
|
1695 | _this.state = {
|
1696 | value: props.value,
|
1697 | local: true
|
1698 | };
|
1699 | return _this;
|
1700 | }
|
1701 |
|
1702 | Rifm.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
1703 | return {
|
1704 | value: state.local ? state.value : props.value,
|
1705 | local: false
|
1706 | };
|
1707 | };
|
1708 |
|
1709 | var _proto = Rifm.prototype;
|
1710 |
|
1711 | _proto.render = function render() {
|
1712 | var _handleChange = this._handleChange,
|
1713 | value = this.state.value,
|
1714 | children = this.props.children;
|
1715 | return children({
|
1716 | value: value,
|
1717 | onChange: _handleChange
|
1718 | });
|
1719 | }
|
1720 | ;
|
1721 |
|
1722 | _proto.componentWillUnmount = function componentWillUnmount() {
|
1723 | document.removeEventListener('keydown', this._hKD);
|
1724 | document.removeEventListener('keyup', this._hKU);
|
1725 | }
|
1726 | ;
|
1727 |
|
1728 | _proto.componentDidMount = function componentDidMount() {
|
1729 | document.addEventListener('keydown', this._hKD);
|
1730 | document.addEventListener('keyup', this._hKU);
|
1731 | };
|
1732 |
|
1733 | _proto.componentDidUpdate = function componentDidUpdate() {
|
1734 | var _state = this._state;
|
1735 |
|
1736 | if (_state) {
|
1737 | var value = this.state.value;
|
1738 | var start = -1;
|
1739 |
|
1740 | for (var i = 0; i !== _state.before.length; ++i) {
|
1741 | start = Math.max(start, value.toLowerCase().indexOf(_state.before[i].toLowerCase(), start + 1));
|
1742 | }
|
1743 |
|
1744 |
|
1745 | if (this.props.replace && (_state.op || _state.del && !_state.di)) {
|
1746 | while (value[start + 1] && (this.props.refuse || /[^\d]+/).test(value[start + 1])) {
|
1747 | start += 1;
|
1748 | }
|
1749 | }
|
1750 |
|
1751 | _state.input.selectionStart = _state.input.selectionEnd = start + 1 + (_state.di ? 1 : 0);
|
1752 | }
|
1753 |
|
1754 | this._state = null;
|
1755 | };
|
1756 |
|
1757 | return Rifm;
|
1758 | }(React.Component);
|
1759 |
|
1760 | var KeyboardIcon = function KeyboardIcon(props) {
|
1761 | return React__default.createElement(SvgIcon, props, React__default.createElement("path", {
|
1762 | d: "M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"
|
1763 | }), React__default.createElement("path", {
|
1764 | fill: "none",
|
1765 | d: "M0 0h24v24H0z"
|
1766 | }));
|
1767 | };
|
1768 |
|
1769 | var getDisplayDate = function getDisplayDate(value, format, utils, isEmpty, _ref) {
|
1770 | var invalidLabel = _ref.invalidLabel,
|
1771 | emptyLabel = _ref.emptyLabel,
|
1772 | labelFunc = _ref.labelFunc;
|
1773 | var date = utils.date(value);
|
1774 |
|
1775 | if (labelFunc) {
|
1776 | return labelFunc(isEmpty ? null : date, invalidLabel);
|
1777 | }
|
1778 |
|
1779 | if (isEmpty) {
|
1780 | return emptyLabel || '';
|
1781 | }
|
1782 |
|
1783 | return utils.isValid(date) ? utils.format(date, format) : invalidLabel;
|
1784 | };
|
1785 |
|
1786 | var getComparisonMaxDate = function getComparisonMaxDate(utils, strictCompareDates, date) {
|
1787 | if (strictCompareDates) {
|
1788 | return date;
|
1789 | }
|
1790 |
|
1791 | return utils.endOfDay(date);
|
1792 | };
|
1793 |
|
1794 | var getComparisonMinDate = function getComparisonMinDate(utils, strictCompareDates, date) {
|
1795 | if (strictCompareDates) {
|
1796 | return date;
|
1797 | }
|
1798 |
|
1799 | return utils.startOfDay(date);
|
1800 | };
|
1801 |
|
1802 | var validate = function validate(value, utils, _ref2) {
|
1803 | var maxDate = _ref2.maxDate,
|
1804 | minDate = _ref2.minDate,
|
1805 | disablePast = _ref2.disablePast,
|
1806 | disableFuture = _ref2.disableFuture,
|
1807 | maxDateMessage = _ref2.maxDateMessage,
|
1808 | minDateMessage = _ref2.minDateMessage,
|
1809 | invalidDateMessage = _ref2.invalidDateMessage,
|
1810 | strictCompareDates = _ref2.strictCompareDates;
|
1811 | var parsedValue = utils.date(value);
|
1812 |
|
1813 | if (value === null) {
|
1814 | return '';
|
1815 | }
|
1816 |
|
1817 | if (!utils.isValid(value)) {
|
1818 | return invalidDateMessage;
|
1819 | }
|
1820 |
|
1821 | if (maxDate && utils.isAfter(parsedValue, getComparisonMaxDate(utils, !!strictCompareDates, utils.date(maxDate)))) {
|
1822 | return maxDateMessage;
|
1823 | }
|
1824 |
|
1825 | if (disableFuture && utils.isAfter(parsedValue, getComparisonMaxDate(utils, !!strictCompareDates, utils.date()))) {
|
1826 | return maxDateMessage;
|
1827 | }
|
1828 |
|
1829 | if (minDate && utils.isBefore(parsedValue, getComparisonMinDate(utils, !!strictCompareDates, utils.date(minDate)))) {
|
1830 | return minDateMessage;
|
1831 | }
|
1832 |
|
1833 | if (disablePast && utils.isBefore(parsedValue, getComparisonMinDate(utils, !!strictCompareDates, utils.date()))) {
|
1834 | return minDateMessage;
|
1835 | }
|
1836 |
|
1837 | return '';
|
1838 | };
|
1839 | function pick12hOr24hFormat(userFormat) {
|
1840 | var ampm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
1841 | var formats = arguments.length > 2 ? arguments[2] : undefined;
|
1842 |
|
1843 | if (userFormat) {
|
1844 | return userFormat;
|
1845 | }
|
1846 |
|
1847 | return ampm ? formats['12h'] : formats['24h'];
|
1848 | }
|
1849 | function makeMaskFromFormat(format, numberMaskChar) {
|
1850 | return format.replace(/[a-z]/gi, numberMaskChar);
|
1851 | }
|
1852 | var maskedDateFormatter = function maskedDateFormatter(mask, numberMaskChar, refuse) {
|
1853 | return function (value) {
|
1854 | var result = '';
|
1855 | var parsed = value.replace(refuse, '');
|
1856 |
|
1857 | if (parsed === '') {
|
1858 | return parsed;
|
1859 | }
|
1860 |
|
1861 | var i = 0;
|
1862 | var n = 0;
|
1863 |
|
1864 | while (i < mask.length) {
|
1865 | var maskChar = mask[i];
|
1866 |
|
1867 | if (maskChar === numberMaskChar && n < parsed.length) {
|
1868 | var parsedChar = parsed[n];
|
1869 | result += parsedChar;
|
1870 | n += 1;
|
1871 | } else {
|
1872 | result += maskChar;
|
1873 | }
|
1874 |
|
1875 | i += 1;
|
1876 | }
|
1877 |
|
1878 | return result;
|
1879 | };
|
1880 | };
|
1881 |
|
1882 | function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
1883 |
|
1884 | function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
1885 | var KeyboardDateInput = function KeyboardDateInput(_ref) {
|
1886 | var inputValue = _ref.inputValue,
|
1887 | inputVariant = _ref.inputVariant,
|
1888 | validationError = _ref.validationError,
|
1889 | KeyboardButtonProps = _ref.KeyboardButtonProps,
|
1890 | InputAdornmentProps = _ref.InputAdornmentProps,
|
1891 | onOpen = _ref.openPicker,
|
1892 | onChange = _ref.onChange,
|
1893 | InputProps = _ref.InputProps,
|
1894 | mask = _ref.mask,
|
1895 | _ref$maskChar = _ref.maskChar,
|
1896 | maskChar = _ref$maskChar === void 0 ? '_' : _ref$maskChar,
|
1897 | _ref$refuse = _ref.refuse,
|
1898 | refuse = _ref$refuse === void 0 ? /[^\d]+/gi : _ref$refuse,
|
1899 | format = _ref.format,
|
1900 | keyboardIcon = _ref.keyboardIcon,
|
1901 | disabled = _ref.disabled,
|
1902 | rifmFormatter = _ref.rifmFormatter,
|
1903 | _ref$TextFieldCompone = _ref.TextFieldComponent,
|
1904 | TextFieldComponent = _ref$TextFieldCompone === void 0 ? TextField : _ref$TextFieldCompone,
|
1905 | other = _objectWithoutProperties(_ref, ["inputValue", "inputVariant", "validationError", "KeyboardButtonProps", "InputAdornmentProps", "openPicker", "onChange", "InputProps", "mask", "maskChar", "refuse", "format", "keyboardIcon", "disabled", "rifmFormatter", "TextFieldComponent"]);
|
1906 |
|
1907 | var inputMask = mask || makeMaskFromFormat(format, maskChar);
|
1908 |
|
1909 | var formatter = React.useMemo(function () {
|
1910 | return maskedDateFormatter(inputMask, maskChar, refuse);
|
1911 | }, [inputMask, maskChar, refuse]);
|
1912 | var position = InputAdornmentProps && InputAdornmentProps.position ? InputAdornmentProps.position : 'end';
|
1913 |
|
1914 | var handleChange = function handleChange(text) {
|
1915 | var finalString = text === '' || text === inputMask ? null : text;
|
1916 | onChange(finalString);
|
1917 | };
|
1918 |
|
1919 | return React.createElement(Rifm, {
|
1920 | key: inputMask,
|
1921 | value: inputValue,
|
1922 | onChange: handleChange,
|
1923 | refuse: refuse,
|
1924 | format: rifmFormatter || formatter
|
1925 | }, function (_ref2) {
|
1926 | var onChange = _ref2.onChange,
|
1927 | value = _ref2.value;
|
1928 | return React.createElement(TextFieldComponent, _extends({
|
1929 | disabled: disabled,
|
1930 | error: Boolean(validationError),
|
1931 | helperText: validationError
|
1932 | }, other, {
|
1933 | value: value,
|
1934 | onChange: onChange,
|
1935 | variant: inputVariant,
|
1936 | InputProps: _objectSpread$1({}, InputProps, _defineProperty({}, "".concat(position, "Adornment"), React.createElement(InputAdornment, _extends({
|
1937 | position: position
|
1938 | }, InputAdornmentProps), React.createElement(IconButton, _extends({
|
1939 | disabled: disabled
|
1940 | }, KeyboardButtonProps, {
|
1941 | onClick: onOpen
|
1942 | }), keyboardIcon))))
|
1943 | }));
|
1944 | });
|
1945 | };
|
1946 | KeyboardDateInput.defaultProps = {
|
1947 | keyboardIcon: React.createElement(KeyboardIcon, null)
|
1948 | };
|
1949 |
|
1950 | function _arrayWithHoles(arr) {
|
1951 | if (Array.isArray(arr)) return arr;
|
1952 | }
|
1953 |
|
1954 | function _iterableToArrayLimit(arr, i) {
|
1955 | if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
1956 | return;
|
1957 | }
|
1958 |
|
1959 | var _arr = [];
|
1960 | var _n = true;
|
1961 | var _d = false;
|
1962 | var _e = undefined;
|
1963 |
|
1964 | try {
|
1965 | for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
1966 | _arr.push(_s.value);
|
1967 |
|
1968 | if (i && _arr.length === i) break;
|
1969 | }
|
1970 | } catch (err) {
|
1971 | _d = true;
|
1972 | _e = err;
|
1973 | } finally {
|
1974 | try {
|
1975 | if (!_n && _i["return"] != null) _i["return"]();
|
1976 | } finally {
|
1977 | if (_d) throw _e;
|
1978 | }
|
1979 | }
|
1980 |
|
1981 | return _arr;
|
1982 | }
|
1983 |
|
1984 | function _nonIterableRest() {
|
1985 | throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
1986 | }
|
1987 |
|
1988 | function _slicedToArray(arr, i) {
|
1989 | return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
1990 | }
|
1991 |
|
1992 | function useOpenState(_ref) {
|
1993 | var open = _ref.open,
|
1994 | onOpen = _ref.onOpen,
|
1995 | onClose = _ref.onClose;
|
1996 | var setIsOpenState = null;
|
1997 |
|
1998 | if (open === undefined || open === null) {
|
1999 |
|
2000 | var _useState = React.useState(false);
|
2001 |
|
2002 | var _useState2 = _slicedToArray(_useState, 2);
|
2003 |
|
2004 | open = _useState2[0];
|
2005 | setIsOpenState = _useState2[1];
|
2006 | }
|
2007 |
|
2008 |
|
2009 | var setIsOpen = React.useCallback(function (newIsOpen) {
|
2010 | setIsOpenState && setIsOpenState(newIsOpen);
|
2011 | return newIsOpen ? onOpen && onOpen() : onClose && onClose();
|
2012 | }, [onOpen, onClose, setIsOpenState]);
|
2013 | return {
|
2014 | isOpen: open,
|
2015 | setIsOpen: setIsOpen
|
2016 | };
|
2017 | }
|
2018 |
|
2019 | var useValueToDate = function useValueToDate(utils, _ref) {
|
2020 | var value = _ref.value,
|
2021 | initialFocusedDate = _ref.initialFocusedDate;
|
2022 | var nowRef = React.useRef(utils.date());
|
2023 | var date = utils.date(value || initialFocusedDate || nowRef.current);
|
2024 | return date && utils.isValid(date) ? date : nowRef.current;
|
2025 | };
|
2026 |
|
2027 | function useDateValues(props, options) {
|
2028 | var utils = useUtils();
|
2029 | var date = useValueToDate(utils, props);
|
2030 | var format = props.format || options.getDefaultFormat();
|
2031 | return {
|
2032 | date: date,
|
2033 | format: format
|
2034 | };
|
2035 | }
|
2036 |
|
2037 | function usePickerState(props, options) {
|
2038 | var autoOk = props.autoOk,
|
2039 | disabled = props.disabled,
|
2040 | readOnly = props.readOnly,
|
2041 | onAccept = props.onAccept,
|
2042 | _onChange = props.onChange,
|
2043 | onError = props.onError,
|
2044 | value = props.value,
|
2045 | variant = props.variant;
|
2046 | var utils = useUtils();
|
2047 |
|
2048 | var _useOpenState = useOpenState(props),
|
2049 | isOpen = _useOpenState.isOpen,
|
2050 | setIsOpen = _useOpenState.setIsOpen;
|
2051 |
|
2052 | var _useDateValues = useDateValues(props, options),
|
2053 | date = _useDateValues.date,
|
2054 | format = _useDateValues.format;
|
2055 |
|
2056 | var _useState = React.useState(date),
|
2057 | _useState2 = _slicedToArray(_useState, 2),
|
2058 | pickerDate = _useState2[0],
|
2059 | setPickerDate = _useState2[1];
|
2060 |
|
2061 | React.useEffect(function () {
|
2062 |
|
2063 | if (!isOpen && !utils.isEqual(pickerDate, date)) {
|
2064 | setPickerDate(date);
|
2065 | }
|
2066 | }, [date, isOpen, pickerDate, utils]);
|
2067 | var acceptDate = React.useCallback(function (acceptedDate) {
|
2068 | _onChange(acceptedDate);
|
2069 |
|
2070 | if (onAccept) {
|
2071 | onAccept(acceptedDate);
|
2072 | }
|
2073 |
|
2074 | setIsOpen(false);
|
2075 | }, [onAccept, _onChange, setIsOpen]);
|
2076 | var wrapperProps = React.useMemo(function () {
|
2077 | return {
|
2078 | format: format,
|
2079 | open: isOpen,
|
2080 | onClear: function onClear() {
|
2081 | return acceptDate(null);
|
2082 | },
|
2083 | onAccept: function onAccept() {
|
2084 | return acceptDate(pickerDate);
|
2085 | },
|
2086 | onSetToday: function onSetToday() {
|
2087 | return setPickerDate(utils.date());
|
2088 | },
|
2089 | onDismiss: function onDismiss() {
|
2090 | setIsOpen(false);
|
2091 | }
|
2092 | };
|
2093 | }, [acceptDate, format, isOpen, pickerDate, setIsOpen, utils]);
|
2094 | var pickerProps = React.useMemo(function () {
|
2095 | return {
|
2096 | date: pickerDate,
|
2097 | onChange: function onChange(newDate) {
|
2098 | var isFinish = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
2099 | setPickerDate(newDate);
|
2100 |
|
2101 | if (isFinish && autoOk) {
|
2102 | acceptDate(newDate);
|
2103 | return;
|
2104 | }
|
2105 |
|
2106 |
|
2107 | if (variant === 'inline' || variant === 'static') {
|
2108 | _onChange(newDate);
|
2109 |
|
2110 | onAccept && onAccept(newDate);
|
2111 | }
|
2112 | }
|
2113 | };
|
2114 | }, [acceptDate, autoOk, onAccept, _onChange, pickerDate, variant]);
|
2115 | var validationError = validate(value, utils, props);
|
2116 | React.useEffect(function () {
|
2117 | if (onError) {
|
2118 | onError(validationError, value);
|
2119 | }
|
2120 | }, [onError, validationError, value]);
|
2121 | var inputValue = getDisplayDate(date, format, utils, value === null, props);
|
2122 | var inputProps = React.useMemo(function () {
|
2123 | return {
|
2124 | inputValue: inputValue,
|
2125 | validationError: validationError,
|
2126 | openPicker: function openPicker() {
|
2127 | return !readOnly && !disabled && setIsOpen(true);
|
2128 | }
|
2129 | };
|
2130 | }, [disabled, inputValue, readOnly, setIsOpen, validationError]);
|
2131 | var pickerState = {
|
2132 | pickerProps: pickerProps,
|
2133 | inputProps: inputProps,
|
2134 | wrapperProps: wrapperProps
|
2135 | };
|
2136 | React.useDebugValue(pickerState);
|
2137 | return pickerState;
|
2138 | }
|
2139 |
|
2140 | function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
2141 |
|
2142 | function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
2143 | var date = propTypes_16([propTypes_5, propTypes_6, propTypes_4, propTypes_12(Date)]);
|
2144 | var datePickerView = propTypes_15(['year', 'month', 'day']);
|
2145 |
|
2146 |
|
2147 | var timePickerDefaultProps = {
|
2148 | ampm: true,
|
2149 | invalidDateMessage: 'Invalid Time Format'
|
2150 | };
|
2151 | var datePickerDefaultProps = {
|
2152 | minDate: new Date('1900-01-01'),
|
2153 | maxDate: new Date('2100-01-01'),
|
2154 | invalidDateMessage: 'Invalid Date Format',
|
2155 | minDateMessage: 'Date should not be before minimal date',
|
2156 | maxDateMessage: 'Date should not be after maximal date',
|
2157 | allowKeyboardControl: true
|
2158 | };
|
2159 | var dateTimePickerDefaultProps = _objectSpread$2({}, timePickerDefaultProps, {}, datePickerDefaultProps, {
|
2160 | showTabs: true
|
2161 | });
|
2162 |
|
2163 | function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
2164 |
|
2165 | function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
2166 |
|
2167 | function parseInputString(value, utils, format) {
|
2168 | try {
|
2169 | return utils.parse(value, format);
|
2170 | } catch (_unused) {
|
2171 | return null;
|
2172 | }
|
2173 | }
|
2174 |
|
2175 | function useKeyboardPickerState(props, options) {
|
2176 | var _props$format = props.format,
|
2177 | format = _props$format === void 0 ? options.getDefaultFormat() : _props$format,
|
2178 | inputValue = props.inputValue,
|
2179 | _onChange = props.onChange,
|
2180 | value = props.value;
|
2181 | var utils = useUtils();
|
2182 | var displayDate = getDisplayDate(value, format, utils, value === null, props);
|
2183 |
|
2184 | var _useState = React.useState(displayDate),
|
2185 | _useState2 = _slicedToArray(_useState, 2),
|
2186 | innerInputValue = _useState2[0],
|
2187 | setInnerInputValue = _useState2[1];
|
2188 |
|
2189 | var dateValue = inputValue ? parseInputString(inputValue, utils, format) : value;
|
2190 | React.useEffect(function () {
|
2191 | if (value === null || utils.isValid(value)) {
|
2192 | setInnerInputValue(displayDate);
|
2193 | }
|
2194 | }, [displayDate, setInnerInputValue, utils, value]);
|
2195 | var handleKeyboardChange = React.useCallback(function (date) {
|
2196 | _onChange(date, date === null ? null : utils.format(date, format));
|
2197 | }, [format, _onChange, utils]);
|
2198 |
|
2199 | var _usePickerState = usePickerState(
|
2200 | _objectSpread$3({}, props, {
|
2201 | value: dateValue,
|
2202 | onChange: handleKeyboardChange
|
2203 | }), options),
|
2204 | innerInputProps = _usePickerState.inputProps,
|
2205 | wrapperProps = _usePickerState.wrapperProps,
|
2206 | pickerProps = _usePickerState.pickerProps;
|
2207 |
|
2208 | var inputProps = React.useMemo(function () {
|
2209 | return _objectSpread$3({}, innerInputProps, {
|
2210 |
|
2211 | format: wrapperProps.format,
|
2212 | inputValue: inputValue || innerInputValue,
|
2213 | onChange: function onChange(value) {
|
2214 | setInnerInputValue(value || '');
|
2215 | var date = value === null ? null : utils.parse(value, wrapperProps.format);
|
2216 |
|
2217 | _onChange(date, value);
|
2218 | }
|
2219 | });
|
2220 | }, [innerInputProps, innerInputValue, inputValue, _onChange, utils, wrapperProps.format]);
|
2221 | return {
|
2222 | inputProps: inputProps,
|
2223 | wrapperProps: wrapperProps,
|
2224 | pickerProps: pickerProps
|
2225 | };
|
2226 | }
|
2227 |
|
2228 | function _classCallCheck(instance, Constructor) {
|
2229 | if (!(instance instanceof Constructor)) {
|
2230 | throw new TypeError("Cannot call a class as a function");
|
2231 | }
|
2232 | }
|
2233 |
|
2234 | function _defineProperties(target, props) {
|
2235 | for (var i = 0; i < props.length; i++) {
|
2236 | var descriptor = props[i];
|
2237 | descriptor.enumerable = descriptor.enumerable || false;
|
2238 | descriptor.configurable = true;
|
2239 | if ("value" in descriptor) descriptor.writable = true;
|
2240 | Object.defineProperty(target, descriptor.key, descriptor);
|
2241 | }
|
2242 | }
|
2243 |
|
2244 | function _createClass(Constructor, protoProps, staticProps) {
|
2245 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
2246 | if (staticProps) _defineProperties(Constructor, staticProps);
|
2247 | return Constructor;
|
2248 | }
|
2249 |
|
2250 | function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
|
2251 |
|
2252 | function _typeof(obj) {
|
2253 | if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
|
2254 | _typeof = function _typeof(obj) {
|
2255 | return _typeof2(obj);
|
2256 | };
|
2257 | } else {
|
2258 | _typeof = function _typeof(obj) {
|
2259 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
|
2260 | };
|
2261 | }
|
2262 |
|
2263 | return _typeof(obj);
|
2264 | }
|
2265 |
|
2266 | function _assertThisInitialized(self) {
|
2267 | if (self === void 0) {
|
2268 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
2269 | }
|
2270 |
|
2271 | return self;
|
2272 | }
|
2273 |
|
2274 | function _possibleConstructorReturn(self, call) {
|
2275 | if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
2276 | return call;
|
2277 | }
|
2278 |
|
2279 | return _assertThisInitialized(self);
|
2280 | }
|
2281 |
|
2282 | function _getPrototypeOf(o) {
|
2283 | _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
2284 | return o.__proto__ || Object.getPrototypeOf(o);
|
2285 | };
|
2286 | return _getPrototypeOf(o);
|
2287 | }
|
2288 |
|
2289 | function _setPrototypeOf(o, p) {
|
2290 | _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
2291 | o.__proto__ = p;
|
2292 | return o;
|
2293 | };
|
2294 |
|
2295 | return _setPrototypeOf(o, p);
|
2296 | }
|
2297 |
|
2298 | function _inherits(subClass, superClass) {
|
2299 | if (typeof superClass !== "function" && superClass !== null) {
|
2300 | throw new TypeError("Super expression must either be null or a function");
|
2301 | }
|
2302 |
|
2303 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
2304 | constructor: {
|
2305 | value: subClass,
|
2306 | writable: true,
|
2307 | configurable: true
|
2308 | }
|
2309 | });
|
2310 | if (superClass) _setPrototypeOf(subClass, superClass);
|
2311 | }
|
2312 |
|
2313 | var useStyles$3 = styles$5.makeStyles(function (theme) {
|
2314 | return {
|
2315 | day: {
|
2316 | width: 36,
|
2317 | height: 36,
|
2318 | fontSize: theme.typography.caption.fontSize,
|
2319 | margin: '0 2px',
|
2320 | color: theme.palette.text.primary,
|
2321 | fontWeight: theme.typography.fontWeightMedium,
|
2322 | padding: 0
|
2323 | },
|
2324 | hidden: {
|
2325 | opacity: 0,
|
2326 | pointerEvents: 'none'
|
2327 | },
|
2328 | current: {
|
2329 | color: theme.palette.primary.main,
|
2330 | fontWeight: 600
|
2331 | },
|
2332 | daySelected: {
|
2333 | color: theme.palette.primary.contrastText,
|
2334 | backgroundColor: theme.palette.primary.main,
|
2335 | fontWeight: theme.typography.fontWeightMedium,
|
2336 | '&:hover': {
|
2337 | backgroundColor: theme.palette.primary.main
|
2338 | }
|
2339 | },
|
2340 | dayDisabled: {
|
2341 | pointerEvents: 'none',
|
2342 | color: theme.palette.text.hint
|
2343 | }
|
2344 | };
|
2345 | }, {
|
2346 | name: 'MuiPickersDay'
|
2347 | });
|
2348 | var Day = function Day(_ref) {
|
2349 | var children = _ref.children,
|
2350 | disabled = _ref.disabled,
|
2351 | hidden = _ref.hidden,
|
2352 | current = _ref.current,
|
2353 | selected = _ref.selected,
|
2354 | other = _objectWithoutProperties(_ref, ["children", "disabled", "hidden", "current", "selected"]);
|
2355 |
|
2356 | var classes = useStyles$3();
|
2357 | var className = clsx(classes.day, hidden && classes.hidden, current && classes.current, selected && classes.daySelected, disabled && classes.dayDisabled);
|
2358 | return React.createElement(IconButton, _extends({
|
2359 | className: className,
|
2360 | tabIndex: hidden || disabled ? -1 : 0
|
2361 | }, other), React.createElement(Typography, {
|
2362 | variant: "body2",
|
2363 | color: "inherit"
|
2364 | }, children));
|
2365 | };
|
2366 | Day.displayName = 'Day';
|
2367 | Day.propTypes = {
|
2368 | current: propTypes_2,
|
2369 | disabled: propTypes_2,
|
2370 | hidden: propTypes_2,
|
2371 | selected: propTypes_2
|
2372 | } ;
|
2373 | Day.defaultProps = {
|
2374 | disabled: false,
|
2375 | hidden: false,
|
2376 | current: false,
|
2377 | selected: false
|
2378 | };
|
2379 |
|
2380 | var DayWrapper = function DayWrapper(_ref) {
|
2381 | var children = _ref.children,
|
2382 | value = _ref.value,
|
2383 | disabled = _ref.disabled,
|
2384 | onSelect = _ref.onSelect,
|
2385 | dayInCurrentMonth = _ref.dayInCurrentMonth,
|
2386 | other = _objectWithoutProperties(_ref, ["children", "value", "disabled", "onSelect", "dayInCurrentMonth"]);
|
2387 |
|
2388 | var handleClick = React.useCallback(function () {
|
2389 | return onSelect(value);
|
2390 | }, [onSelect, value]);
|
2391 | return React.createElement("div", _extends({
|
2392 | role: "presentation",
|
2393 | onClick: dayInCurrentMonth && !disabled ? handleClick : undefined,
|
2394 | onKeyPress: dayInCurrentMonth && !disabled ? handleClick : undefined
|
2395 | }, other), children);
|
2396 | };
|
2397 |
|
2398 | function hasClass(element, className) {
|
2399 | if (element.classList) return !!className && element.classList.contains(className);
|
2400 | return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
|
2401 | }
|
2402 |
|
2403 | function addClass(element, className) {
|
2404 | if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className);
|
2405 | }
|
2406 |
|
2407 | function replaceClassName(origClass, classToRemove) {
|
2408 | return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
|
2409 | }
|
2410 |
|
2411 | function removeClass(element, className) {
|
2412 | if (element.classList) {
|
2413 | element.classList.remove(className);
|
2414 | } else if (typeof element.className === 'string') {
|
2415 | element.className = replaceClassName(element.className, className);
|
2416 | } else {
|
2417 | element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
|
2418 | }
|
2419 | }
|
2420 |
|
2421 | var config = {
|
2422 | disabled: false
|
2423 | };
|
2424 |
|
2425 | var timeoutsShape = propTypes.oneOfType([propTypes.number, propTypes.shape({
|
2426 | enter: propTypes.number,
|
2427 | exit: propTypes.number,
|
2428 | appear: propTypes.number
|
2429 | }).isRequired]) ;
|
2430 | var classNamesShape = propTypes.oneOfType([propTypes.string, propTypes.shape({
|
2431 | enter: propTypes.string,
|
2432 | exit: propTypes.string,
|
2433 | active: propTypes.string
|
2434 | }), propTypes.shape({
|
2435 | enter: propTypes.string,
|
2436 | enterDone: propTypes.string,
|
2437 | enterActive: propTypes.string,
|
2438 | exit: propTypes.string,
|
2439 | exitDone: propTypes.string,
|
2440 | exitActive: propTypes.string
|
2441 | })]) ;
|
2442 |
|
2443 | var TransitionGroupContext = React__default.createContext(null);
|
2444 |
|
2445 | var UNMOUNTED = 'unmounted';
|
2446 | var EXITED = 'exited';
|
2447 | var ENTERING = 'entering';
|
2448 | var ENTERED = 'entered';
|
2449 | var EXITING = 'exiting';
|
2450 | |
2451 |
|
2452 |
|
2453 |
|
2454 |
|
2455 |
|
2456 |
|
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 |
|
2512 |
|
2513 |
|
2514 |
|
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 |
|
2520 |
|
2521 |
|
2522 |
|
2523 |
|
2524 |
|
2525 |
|
2526 |
|
2527 |
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 |
|
2541 |
|
2542 | var Transition =
|
2543 |
|
2544 | function (_React$Component) {
|
2545 | _inheritsLoose(Transition, _React$Component);
|
2546 |
|
2547 | function Transition(props, context) {
|
2548 | var _this;
|
2549 |
|
2550 | _this = _React$Component.call(this, props, context) || this;
|
2551 | var parentGroup = context;
|
2552 |
|
2553 | var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
|
2554 | var initialStatus;
|
2555 | _this.appearStatus = null;
|
2556 |
|
2557 | if (props.in) {
|
2558 | if (appear) {
|
2559 | initialStatus = EXITED;
|
2560 | _this.appearStatus = ENTERING;
|
2561 | } else {
|
2562 | initialStatus = ENTERED;
|
2563 | }
|
2564 | } else {
|
2565 | if (props.unmountOnExit || props.mountOnEnter) {
|
2566 | initialStatus = UNMOUNTED;
|
2567 | } else {
|
2568 | initialStatus = EXITED;
|
2569 | }
|
2570 | }
|
2571 |
|
2572 | _this.state = {
|
2573 | status: initialStatus
|
2574 | };
|
2575 | _this.nextCallback = null;
|
2576 | return _this;
|
2577 | }
|
2578 |
|
2579 | Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
2580 | var nextIn = _ref.in;
|
2581 |
|
2582 | if (nextIn && prevState.status === UNMOUNTED) {
|
2583 | return {
|
2584 | status: EXITED
|
2585 | };
|
2586 | }
|
2587 |
|
2588 | return null;
|
2589 | };
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 |
|
2595 |
|
2596 |
|
2597 |
|
2598 |
|
2599 |
|
2600 |
|
2601 |
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 | var _proto = Transition.prototype;
|
2608 |
|
2609 | _proto.componentDidMount = function componentDidMount() {
|
2610 | this.updateStatus(true, this.appearStatus);
|
2611 | };
|
2612 |
|
2613 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
2614 | var nextStatus = null;
|
2615 |
|
2616 | if (prevProps !== this.props) {
|
2617 | var status = this.state.status;
|
2618 |
|
2619 | if (this.props.in) {
|
2620 | if (status !== ENTERING && status !== ENTERED) {
|
2621 | nextStatus = ENTERING;
|
2622 | }
|
2623 | } else {
|
2624 | if (status === ENTERING || status === ENTERED) {
|
2625 | nextStatus = EXITING;
|
2626 | }
|
2627 | }
|
2628 | }
|
2629 |
|
2630 | this.updateStatus(false, nextStatus);
|
2631 | };
|
2632 |
|
2633 | _proto.componentWillUnmount = function componentWillUnmount() {
|
2634 | this.cancelNextCallback();
|
2635 | };
|
2636 |
|
2637 | _proto.getTimeouts = function getTimeouts() {
|
2638 | var timeout = this.props.timeout;
|
2639 | var exit, enter, appear;
|
2640 | exit = enter = appear = timeout;
|
2641 |
|
2642 | if (timeout != null && typeof timeout !== 'number') {
|
2643 | exit = timeout.exit;
|
2644 | enter = timeout.enter;
|
2645 |
|
2646 | appear = timeout.appear !== undefined ? timeout.appear : enter;
|
2647 | }
|
2648 |
|
2649 | return {
|
2650 | exit: exit,
|
2651 | enter: enter,
|
2652 | appear: appear
|
2653 | };
|
2654 | };
|
2655 |
|
2656 | _proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
2657 | if (mounting === void 0) {
|
2658 | mounting = false;
|
2659 | }
|
2660 |
|
2661 | if (nextStatus !== null) {
|
2662 |
|
2663 | this.cancelNextCallback();
|
2664 | var node = ReactDOM.findDOMNode(this);
|
2665 |
|
2666 | if (nextStatus === ENTERING) {
|
2667 | this.performEnter(node, mounting);
|
2668 | } else {
|
2669 | this.performExit(node);
|
2670 | }
|
2671 | } else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
2672 | this.setState({
|
2673 | status: UNMOUNTED
|
2674 | });
|
2675 | }
|
2676 | };
|
2677 |
|
2678 | _proto.performEnter = function performEnter(node, mounting) {
|
2679 | var _this2 = this;
|
2680 |
|
2681 | var enter = this.props.enter;
|
2682 | var appearing = this.context ? this.context.isMounting : mounting;
|
2683 | var timeouts = this.getTimeouts();
|
2684 | var enterTimeout = appearing ? timeouts.appear : timeouts.enter;
|
2685 |
|
2686 |
|
2687 | if (!mounting && !enter || config.disabled) {
|
2688 | this.safeSetState({
|
2689 | status: ENTERED
|
2690 | }, function () {
|
2691 | _this2.props.onEntered(node);
|
2692 | });
|
2693 | return;
|
2694 | }
|
2695 |
|
2696 | this.props.onEnter(node, appearing);
|
2697 | this.safeSetState({
|
2698 | status: ENTERING
|
2699 | }, function () {
|
2700 | _this2.props.onEntering(node, appearing);
|
2701 |
|
2702 | _this2.onTransitionEnd(node, enterTimeout, function () {
|
2703 | _this2.safeSetState({
|
2704 | status: ENTERED
|
2705 | }, function () {
|
2706 | _this2.props.onEntered(node, appearing);
|
2707 | });
|
2708 | });
|
2709 | });
|
2710 | };
|
2711 |
|
2712 | _proto.performExit = function performExit(node) {
|
2713 | var _this3 = this;
|
2714 |
|
2715 | var exit = this.props.exit;
|
2716 | var timeouts = this.getTimeouts();
|
2717 |
|
2718 | if (!exit || config.disabled) {
|
2719 | this.safeSetState({
|
2720 | status: EXITED
|
2721 | }, function () {
|
2722 | _this3.props.onExited(node);
|
2723 | });
|
2724 | return;
|
2725 | }
|
2726 |
|
2727 | this.props.onExit(node);
|
2728 | this.safeSetState({
|
2729 | status: EXITING
|
2730 | }, function () {
|
2731 | _this3.props.onExiting(node);
|
2732 |
|
2733 | _this3.onTransitionEnd(node, timeouts.exit, function () {
|
2734 | _this3.safeSetState({
|
2735 | status: EXITED
|
2736 | }, function () {
|
2737 | _this3.props.onExited(node);
|
2738 | });
|
2739 | });
|
2740 | });
|
2741 | };
|
2742 |
|
2743 | _proto.cancelNextCallback = function cancelNextCallback() {
|
2744 | if (this.nextCallback !== null) {
|
2745 | this.nextCallback.cancel();
|
2746 | this.nextCallback = null;
|
2747 | }
|
2748 | };
|
2749 |
|
2750 | _proto.safeSetState = function safeSetState(nextState, callback) {
|
2751 |
|
2752 |
|
2753 |
|
2754 | callback = this.setNextCallback(callback);
|
2755 | this.setState(nextState, callback);
|
2756 | };
|
2757 |
|
2758 | _proto.setNextCallback = function setNextCallback(callback) {
|
2759 | var _this4 = this;
|
2760 |
|
2761 | var active = true;
|
2762 |
|
2763 | this.nextCallback = function (event) {
|
2764 | if (active) {
|
2765 | active = false;
|
2766 | _this4.nextCallback = null;
|
2767 | callback(event);
|
2768 | }
|
2769 | };
|
2770 |
|
2771 | this.nextCallback.cancel = function () {
|
2772 | active = false;
|
2773 | };
|
2774 |
|
2775 | return this.nextCallback;
|
2776 | };
|
2777 |
|
2778 | _proto.onTransitionEnd = function onTransitionEnd(node, timeout, handler) {
|
2779 | this.setNextCallback(handler);
|
2780 | var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
|
2781 |
|
2782 | if (!node || doesNotHaveTimeoutOrListener) {
|
2783 | setTimeout(this.nextCallback, 0);
|
2784 | return;
|
2785 | }
|
2786 |
|
2787 | if (this.props.addEndListener) {
|
2788 | this.props.addEndListener(node, this.nextCallback);
|
2789 | }
|
2790 |
|
2791 | if (timeout != null) {
|
2792 | setTimeout(this.nextCallback, timeout);
|
2793 | }
|
2794 | };
|
2795 |
|
2796 | _proto.render = function render() {
|
2797 | var status = this.state.status;
|
2798 |
|
2799 | if (status === UNMOUNTED) {
|
2800 | return null;
|
2801 | }
|
2802 |
|
2803 | var _this$props = this.props,
|
2804 | children = _this$props.children,
|
2805 | childProps = _objectWithoutPropertiesLoose(_this$props, ["children"]);
|
2806 |
|
2807 |
|
2808 | delete childProps.in;
|
2809 | delete childProps.mountOnEnter;
|
2810 | delete childProps.unmountOnExit;
|
2811 | delete childProps.appear;
|
2812 | delete childProps.enter;
|
2813 | delete childProps.exit;
|
2814 | delete childProps.timeout;
|
2815 | delete childProps.addEndListener;
|
2816 | delete childProps.onEnter;
|
2817 | delete childProps.onEntering;
|
2818 | delete childProps.onEntered;
|
2819 | delete childProps.onExit;
|
2820 | delete childProps.onExiting;
|
2821 | delete childProps.onExited;
|
2822 |
|
2823 | if (typeof children === 'function') {
|
2824 |
|
2825 | return React__default.createElement(TransitionGroupContext.Provider, {
|
2826 | value: null
|
2827 | }, children(status, childProps));
|
2828 | }
|
2829 |
|
2830 | var child = React__default.Children.only(children);
|
2831 | return (
|
2832 | React__default.createElement(TransitionGroupContext.Provider, {
|
2833 | value: null
|
2834 | }, React__default.cloneElement(child, childProps))
|
2835 | );
|
2836 | };
|
2837 |
|
2838 | return Transition;
|
2839 | }(React__default.Component);
|
2840 |
|
2841 | Transition.contextType = TransitionGroupContext;
|
2842 | Transition.propTypes = {
|
2843 | |
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 |
|
2849 |
|
2850 |
|
2851 |
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 | children: propTypes.oneOfType([propTypes.func.isRequired, propTypes.element.isRequired]).isRequired,
|
2858 |
|
2859 | |
2860 |
|
2861 |
|
2862 | in: propTypes.bool,
|
2863 |
|
2864 | |
2865 |
|
2866 |
|
2867 |
|
2868 |
|
2869 |
|
2870 | mountOnEnter: propTypes.bool,
|
2871 |
|
2872 | |
2873 |
|
2874 |
|
2875 |
|
2876 | unmountOnExit: propTypes.bool,
|
2877 |
|
2878 | |
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 |
|
2885 |
|
2886 |
|
2887 |
|
2888 |
|
2889 |
|
2890 | appear: propTypes.bool,
|
2891 |
|
2892 | |
2893 |
|
2894 |
|
2895 | enter: propTypes.bool,
|
2896 |
|
2897 | |
2898 |
|
2899 |
|
2900 | exit: propTypes.bool,
|
2901 |
|
2902 | |
2903 |
|
2904 |
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 |
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 |
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 |
|
2927 |
|
2928 | timeout: function timeout(props) {
|
2929 | var pt = timeoutsShape;
|
2930 | if (!props.addEndListener) pt = pt.isRequired;
|
2931 |
|
2932 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
2933 | args[_key - 1] = arguments[_key];
|
2934 | }
|
2935 |
|
2936 | return pt.apply(void 0, [props].concat(args));
|
2937 | },
|
2938 |
|
2939 | |
2940 |
|
2941 |
|
2942 |
|
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 | addEndListener: propTypes.func,
|
2952 |
|
2953 | |
2954 |
|
2955 |
|
2956 |
|
2957 |
|
2958 |
|
2959 | onEnter: propTypes.func,
|
2960 |
|
2961 | |
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 |
|
2967 | onEntering: propTypes.func,
|
2968 |
|
2969 | |
2970 |
|
2971 |
|
2972 |
|
2973 |
|
2974 |
|
2975 | onEntered: propTypes.func,
|
2976 |
|
2977 | |
2978 |
|
2979 |
|
2980 |
|
2981 |
|
2982 | onExit: propTypes.func,
|
2983 |
|
2984 | |
2985 |
|
2986 |
|
2987 |
|
2988 |
|
2989 | onExiting: propTypes.func,
|
2990 |
|
2991 | |
2992 |
|
2993 |
|
2994 |
|
2995 |
|
2996 | onExited: propTypes.func
|
2997 |
|
2998 | } ;
|
2999 |
|
3000 | function noop() {}
|
3001 |
|
3002 | Transition.defaultProps = {
|
3003 | in: false,
|
3004 | mountOnEnter: false,
|
3005 | unmountOnExit: false,
|
3006 | appear: false,
|
3007 | enter: true,
|
3008 | exit: true,
|
3009 | onEnter: noop,
|
3010 | onEntering: noop,
|
3011 | onEntered: noop,
|
3012 | onExit: noop,
|
3013 | onExiting: noop,
|
3014 | onExited: noop
|
3015 | };
|
3016 | Transition.UNMOUNTED = 0;
|
3017 | Transition.EXITED = 1;
|
3018 | Transition.ENTERING = 2;
|
3019 | Transition.ENTERED = 3;
|
3020 | Transition.EXITING = 4;
|
3021 |
|
3022 | var _addClass = function addClass$1(node, classes) {
|
3023 | return node && classes && classes.split(' ').forEach(function (c) {
|
3024 | return addClass(node, c);
|
3025 | });
|
3026 | };
|
3027 |
|
3028 | var removeClass$1 = function removeClass$1(node, classes) {
|
3029 | return node && classes && classes.split(' ').forEach(function (c) {
|
3030 | return removeClass(node, c);
|
3031 | });
|
3032 | };
|
3033 | |
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 |
|
3039 |
|
3040 |
|
3041 |
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 |
|
3049 |
|
3050 |
|
3051 |
|
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 |
|
3064 |
|
3065 |
|
3066 |
|
3067 |
|
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 |
|
3078 |
|
3079 |
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 | var CSSTransition =
|
3100 |
|
3101 | function (_React$Component) {
|
3102 | _inheritsLoose(CSSTransition, _React$Component);
|
3103 |
|
3104 | function CSSTransition() {
|
3105 | var _this;
|
3106 |
|
3107 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
3108 | args[_key] = arguments[_key];
|
3109 | }
|
3110 |
|
3111 | _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
3112 | _this.appliedClasses = {
|
3113 | appear: {},
|
3114 | enter: {},
|
3115 | exit: {}
|
3116 | };
|
3117 |
|
3118 | _this.onEnter = function (node, appearing) {
|
3119 | _this.removeClasses(node, 'exit');
|
3120 |
|
3121 | _this.addClass(node, appearing ? 'appear' : 'enter', 'base');
|
3122 |
|
3123 | if (_this.props.onEnter) {
|
3124 | _this.props.onEnter(node, appearing);
|
3125 | }
|
3126 | };
|
3127 |
|
3128 | _this.onEntering = function (node, appearing) {
|
3129 | var type = appearing ? 'appear' : 'enter';
|
3130 |
|
3131 | _this.addClass(node, type, 'active');
|
3132 |
|
3133 | if (_this.props.onEntering) {
|
3134 | _this.props.onEntering(node, appearing);
|
3135 | }
|
3136 | };
|
3137 |
|
3138 | _this.onEntered = function (node, appearing) {
|
3139 | var type = appearing ? 'appear' : 'enter';
|
3140 |
|
3141 | _this.removeClasses(node, type);
|
3142 |
|
3143 | _this.addClass(node, type, 'done');
|
3144 |
|
3145 | if (_this.props.onEntered) {
|
3146 | _this.props.onEntered(node, appearing);
|
3147 | }
|
3148 | };
|
3149 |
|
3150 | _this.onExit = function (node) {
|
3151 | _this.removeClasses(node, 'appear');
|
3152 |
|
3153 | _this.removeClasses(node, 'enter');
|
3154 |
|
3155 | _this.addClass(node, 'exit', 'base');
|
3156 |
|
3157 | if (_this.props.onExit) {
|
3158 | _this.props.onExit(node);
|
3159 | }
|
3160 | };
|
3161 |
|
3162 | _this.onExiting = function (node) {
|
3163 | _this.addClass(node, 'exit', 'active');
|
3164 |
|
3165 | if (_this.props.onExiting) {
|
3166 | _this.props.onExiting(node);
|
3167 | }
|
3168 | };
|
3169 |
|
3170 | _this.onExited = function (node) {
|
3171 | _this.removeClasses(node, 'exit');
|
3172 |
|
3173 | _this.addClass(node, 'exit', 'done');
|
3174 |
|
3175 | if (_this.props.onExited) {
|
3176 | _this.props.onExited(node);
|
3177 | }
|
3178 | };
|
3179 |
|
3180 | _this.getClassNames = function (type) {
|
3181 | var classNames = _this.props.classNames;
|
3182 | var isStringClassNames = typeof classNames === 'string';
|
3183 | var prefix = isStringClassNames && classNames ? classNames + "-" : '';
|
3184 | var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
|
3185 | var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
|
3186 | var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
|
3187 | return {
|
3188 | baseClassName: baseClassName,
|
3189 | activeClassName: activeClassName,
|
3190 | doneClassName: doneClassName
|
3191 | };
|
3192 | };
|
3193 |
|
3194 | return _this;
|
3195 | }
|
3196 |
|
3197 | var _proto = CSSTransition.prototype;
|
3198 |
|
3199 | _proto.addClass = function addClass(node, type, phase) {
|
3200 | var className = this.getClassNames(type)[phase + "ClassName"];
|
3201 |
|
3202 | if (type === 'appear' && phase === 'done') {
|
3203 | className += " " + this.getClassNames('enter').doneClassName;
|
3204 | }
|
3205 |
|
3206 |
|
3207 |
|
3208 | if (phase === 'active') {
|
3209 |
|
3210 | node && node.scrollTop;
|
3211 | }
|
3212 |
|
3213 | this.appliedClasses[type][phase] = className;
|
3214 |
|
3215 | _addClass(node, className);
|
3216 | };
|
3217 |
|
3218 | _proto.removeClasses = function removeClasses(node, type) {
|
3219 | var _this$appliedClasses$ = this.appliedClasses[type],
|
3220 | baseClassName = _this$appliedClasses$.base,
|
3221 | activeClassName = _this$appliedClasses$.active,
|
3222 | doneClassName = _this$appliedClasses$.done;
|
3223 | this.appliedClasses[type] = {};
|
3224 |
|
3225 | if (baseClassName) {
|
3226 | removeClass$1(node, baseClassName);
|
3227 | }
|
3228 |
|
3229 | if (activeClassName) {
|
3230 | removeClass$1(node, activeClassName);
|
3231 | }
|
3232 |
|
3233 | if (doneClassName) {
|
3234 | removeClass$1(node, doneClassName);
|
3235 | }
|
3236 | };
|
3237 |
|
3238 | _proto.render = function render() {
|
3239 | var _this$props = this.props,
|
3240 | _ = _this$props.classNames,
|
3241 | props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
|
3242 |
|
3243 | return React__default.createElement(Transition, _extends({}, props, {
|
3244 | onEnter: this.onEnter,
|
3245 | onEntered: this.onEntered,
|
3246 | onEntering: this.onEntering,
|
3247 | onExit: this.onExit,
|
3248 | onExiting: this.onExiting,
|
3249 | onExited: this.onExited
|
3250 | }));
|
3251 | };
|
3252 |
|
3253 | return CSSTransition;
|
3254 | }(React__default.Component);
|
3255 |
|
3256 | CSSTransition.defaultProps = {
|
3257 | classNames: ''
|
3258 | };
|
3259 | CSSTransition.propTypes = _extends({}, Transition.propTypes, {
|
3260 | |
3261 |
|
3262 |
|
3263 |
|
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 |
|
3276 |
|
3277 |
|
3278 |
|
3279 |
|
3280 |
|
3281 |
|
3282 |
|
3283 |
|
3284 |
|
3285 |
|
3286 |
|
3287 |
|
3288 |
|
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 |
|
3295 |
|
3296 |
|
3297 |
|
3298 |
|
3299 |
|
3300 |
|
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 |
|
3311 |
|
3312 |
|
3313 |
|
3314 |
|
3315 |
|
3316 |
|
3317 |
|
3318 | classNames: classNamesShape,
|
3319 |
|
3320 | |
3321 |
|
3322 |
|
3323 |
|
3324 |
|
3325 |
|
3326 | onEnter: propTypes.func,
|
3327 |
|
3328 | |
3329 |
|
3330 |
|
3331 |
|
3332 |
|
3333 |
|
3334 | onEntering: propTypes.func,
|
3335 |
|
3336 | |
3337 |
|
3338 |
|
3339 |
|
3340 |
|
3341 |
|
3342 | onEntered: propTypes.func,
|
3343 |
|
3344 | |
3345 |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 | onExit: propTypes.func,
|
3351 |
|
3352 | |
3353 |
|
3354 |
|
3355 |
|
3356 |
|
3357 | onExiting: propTypes.func,
|
3358 |
|
3359 | |
3360 |
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 | onExited: propTypes.func
|
3366 | }) ;
|
3367 |
|
3368 | |
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 | function getChildMapping(children, mapFn) {
|
3376 | var mapper = function mapper(child) {
|
3377 | return mapFn && React.isValidElement(child) ? mapFn(child) : child;
|
3378 | };
|
3379 |
|
3380 | var result = Object.create(null);
|
3381 | if (children) React.Children.map(children, function (c) {
|
3382 | return c;
|
3383 | }).forEach(function (child) {
|
3384 |
|
3385 | result[child.key] = mapper(child);
|
3386 | });
|
3387 | return result;
|
3388 | }
|
3389 | |
3390 |
|
3391 |
|
3392 |
|
3393 |
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 | function mergeChildMappings(prev, next) {
|
3408 | prev = prev || {};
|
3409 | next = next || {};
|
3410 |
|
3411 | function getValueForKey(key) {
|
3412 | return key in next ? next[key] : prev[key];
|
3413 | }
|
3414 |
|
3415 |
|
3416 |
|
3417 | var nextKeysPending = Object.create(null);
|
3418 | var pendingKeys = [];
|
3419 |
|
3420 | for (var prevKey in prev) {
|
3421 | if (prevKey in next) {
|
3422 | if (pendingKeys.length) {
|
3423 | nextKeysPending[prevKey] = pendingKeys;
|
3424 | pendingKeys = [];
|
3425 | }
|
3426 | } else {
|
3427 | pendingKeys.push(prevKey);
|
3428 | }
|
3429 | }
|
3430 |
|
3431 | var i;
|
3432 | var childMapping = {};
|
3433 |
|
3434 | for (var nextKey in next) {
|
3435 | if (nextKeysPending[nextKey]) {
|
3436 | for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
3437 | var pendingNextKey = nextKeysPending[nextKey][i];
|
3438 | childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
3439 | }
|
3440 | }
|
3441 |
|
3442 | childMapping[nextKey] = getValueForKey(nextKey);
|
3443 | }
|
3444 |
|
3445 |
|
3446 | for (i = 0; i < pendingKeys.length; i++) {
|
3447 | childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
|
3448 | }
|
3449 |
|
3450 | return childMapping;
|
3451 | }
|
3452 |
|
3453 | function getProp(child, prop, props) {
|
3454 | return props[prop] != null ? props[prop] : child.props[prop];
|
3455 | }
|
3456 |
|
3457 | function getInitialChildMapping(props, onExited) {
|
3458 | return getChildMapping(props.children, function (child) {
|
3459 | return React.cloneElement(child, {
|
3460 | onExited: onExited.bind(null, child),
|
3461 | in: true,
|
3462 | appear: getProp(child, 'appear', props),
|
3463 | enter: getProp(child, 'enter', props),
|
3464 | exit: getProp(child, 'exit', props)
|
3465 | });
|
3466 | });
|
3467 | }
|
3468 | function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
3469 | var nextChildMapping = getChildMapping(nextProps.children);
|
3470 | var children = mergeChildMappings(prevChildMapping, nextChildMapping);
|
3471 | Object.keys(children).forEach(function (key) {
|
3472 | var child = children[key];
|
3473 | if (!React.isValidElement(child)) return;
|
3474 | var hasPrev = key in prevChildMapping;
|
3475 | var hasNext = key in nextChildMapping;
|
3476 | var prevChild = prevChildMapping[key];
|
3477 | var isLeaving = React.isValidElement(prevChild) && !prevChild.props.in;
|
3478 |
|
3479 | if (hasNext && (!hasPrev || isLeaving)) {
|
3480 |
|
3481 | children[key] = React.cloneElement(child, {
|
3482 | onExited: onExited.bind(null, child),
|
3483 | in: true,
|
3484 | exit: getProp(child, 'exit', nextProps),
|
3485 | enter: getProp(child, 'enter', nextProps)
|
3486 | });
|
3487 | } else if (!hasNext && hasPrev && !isLeaving) {
|
3488 |
|
3489 |
|
3490 | children[key] = React.cloneElement(child, {
|
3491 | in: false
|
3492 | });
|
3493 | } else if (hasNext && hasPrev && React.isValidElement(prevChild)) {
|
3494 |
|
3495 |
|
3496 |
|
3497 | children[key] = React.cloneElement(child, {
|
3498 | onExited: onExited.bind(null, child),
|
3499 | in: prevChild.props.in,
|
3500 | exit: getProp(child, 'exit', nextProps),
|
3501 | enter: getProp(child, 'enter', nextProps)
|
3502 | });
|
3503 | }
|
3504 | });
|
3505 | return children;
|
3506 | }
|
3507 |
|
3508 | var values = Object.values || function (obj) {
|
3509 | return Object.keys(obj).map(function (k) {
|
3510 | return obj[k];
|
3511 | });
|
3512 | };
|
3513 |
|
3514 | var defaultProps = {
|
3515 | component: 'div',
|
3516 | childFactory: function childFactory(child) {
|
3517 | return child;
|
3518 | }
|
3519 | |
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 | };
|
3535 |
|
3536 | var TransitionGroup =
|
3537 |
|
3538 | function (_React$Component) {
|
3539 | _inheritsLoose(TransitionGroup, _React$Component);
|
3540 |
|
3541 | function TransitionGroup(props, context) {
|
3542 | var _this;
|
3543 |
|
3544 | _this = _React$Component.call(this, props, context) || this;
|
3545 |
|
3546 | var handleExited = _this.handleExited.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
3547 |
|
3548 |
|
3549 | _this.state = {
|
3550 | contextValue: {
|
3551 | isMounting: true
|
3552 | },
|
3553 | handleExited: handleExited,
|
3554 | firstRender: true
|
3555 | };
|
3556 | return _this;
|
3557 | }
|
3558 |
|
3559 | var _proto = TransitionGroup.prototype;
|
3560 |
|
3561 | _proto.componentDidMount = function componentDidMount() {
|
3562 | this.mounted = true;
|
3563 | this.setState({
|
3564 | contextValue: {
|
3565 | isMounting: false
|
3566 | }
|
3567 | });
|
3568 | };
|
3569 |
|
3570 | _proto.componentWillUnmount = function componentWillUnmount() {
|
3571 | this.mounted = false;
|
3572 | };
|
3573 |
|
3574 | TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
|
3575 | var prevChildMapping = _ref.children,
|
3576 | handleExited = _ref.handleExited,
|
3577 | firstRender = _ref.firstRender;
|
3578 | return {
|
3579 | children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
|
3580 | firstRender: false
|
3581 | };
|
3582 | };
|
3583 |
|
3584 | _proto.handleExited = function handleExited(child, node) {
|
3585 | var currentChildMapping = getChildMapping(this.props.children);
|
3586 | if (child.key in currentChildMapping) return;
|
3587 |
|
3588 | if (child.props.onExited) {
|
3589 | child.props.onExited(node);
|
3590 | }
|
3591 |
|
3592 | if (this.mounted) {
|
3593 | this.setState(function (state) {
|
3594 | var children = _extends({}, state.children);
|
3595 |
|
3596 | delete children[child.key];
|
3597 | return {
|
3598 | children: children
|
3599 | };
|
3600 | });
|
3601 | }
|
3602 | };
|
3603 |
|
3604 | _proto.render = function render() {
|
3605 | var _this$props = this.props,
|
3606 | Component = _this$props.component,
|
3607 | childFactory = _this$props.childFactory,
|
3608 | props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
3609 |
|
3610 | var contextValue = this.state.contextValue;
|
3611 | var children = values(this.state.children).map(childFactory);
|
3612 | delete props.appear;
|
3613 | delete props.enter;
|
3614 | delete props.exit;
|
3615 |
|
3616 | if (Component === null) {
|
3617 | return React__default.createElement(TransitionGroupContext.Provider, {
|
3618 | value: contextValue
|
3619 | }, children);
|
3620 | }
|
3621 |
|
3622 | return React__default.createElement(TransitionGroupContext.Provider, {
|
3623 | value: contextValue
|
3624 | }, React__default.createElement(Component, props, children));
|
3625 | };
|
3626 |
|
3627 | return TransitionGroup;
|
3628 | }(React__default.Component);
|
3629 |
|
3630 | TransitionGroup.propTypes = {
|
3631 | |
3632 |
|
3633 |
|
3634 |
|
3635 |
|
3636 |
|
3637 |
|
3638 | component: propTypes.any,
|
3639 |
|
3640 | |
3641 |
|
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 |
|
3647 |
|
3648 |
|
3649 |
|
3650 |
|
3651 |
|
3652 |
|
3653 | children: propTypes.node,
|
3654 |
|
3655 | |
3656 |
|
3657 |
|
3658 |
|
3659 |
|
3660 | appear: propTypes.bool,
|
3661 |
|
3662 | |
3663 |
|
3664 |
|
3665 |
|
3666 |
|
3667 | enter: propTypes.bool,
|
3668 |
|
3669 | |
3670 |
|
3671 |
|
3672 |
|
3673 |
|
3674 | exit: propTypes.bool,
|
3675 |
|
3676 | |
3677 |
|
3678 |
|
3679 |
|
3680 |
|
3681 |
|
3682 |
|
3683 |
|
3684 |
|
3685 |
|
3686 | childFactory: propTypes.func
|
3687 | } ;
|
3688 | TransitionGroup.defaultProps = defaultProps;
|
3689 |
|
3690 | var animationDuration = 350;
|
3691 | var useStyles$4 = styles$5.makeStyles(function (theme) {
|
3692 | var slideTransition = theme.transitions.create('transform', {
|
3693 | duration: animationDuration,
|
3694 | easing: 'cubic-bezier(0.35, 0.8, 0.4, 1)'
|
3695 | });
|
3696 | return {
|
3697 | transitionContainer: {
|
3698 | display: 'block',
|
3699 | position: 'relative',
|
3700 | '& > *': {
|
3701 | position: 'absolute',
|
3702 | top: 0,
|
3703 | right: 0,
|
3704 | left: 0
|
3705 | }
|
3706 | },
|
3707 | 'slideEnter-left': {
|
3708 | willChange: 'transform',
|
3709 | transform: 'translate(100%)'
|
3710 | },
|
3711 | 'slideEnter-right': {
|
3712 | willChange: 'transform',
|
3713 | transform: 'translate(-100%)'
|
3714 | },
|
3715 | slideEnterActive: {
|
3716 | transform: 'translate(0%)',
|
3717 | transition: slideTransition
|
3718 | },
|
3719 | slideExit: {
|
3720 | transform: 'translate(0%)'
|
3721 | },
|
3722 | 'slideExitActiveLeft-left': {
|
3723 | willChange: 'transform',
|
3724 | transform: 'translate(-200%)',
|
3725 | transition: slideTransition
|
3726 | },
|
3727 | 'slideExitActiveLeft-right': {
|
3728 | willChange: 'transform',
|
3729 | transform: 'translate(200%)',
|
3730 | transition: slideTransition
|
3731 | }
|
3732 | };
|
3733 | }, {
|
3734 | name: 'MuiPickersSlideTransition'
|
3735 | });
|
3736 |
|
3737 | var SlideTransition = function SlideTransition(_ref) {
|
3738 | var children = _ref.children,
|
3739 | transKey = _ref.transKey,
|
3740 | slideDirection = _ref.slideDirection,
|
3741 | _ref$className = _ref.className,
|
3742 | className = _ref$className === void 0 ? null : _ref$className;
|
3743 | var classes = useStyles$4();
|
3744 | var transitionClasses = {
|
3745 | exit: classes.slideExit,
|
3746 | enterActive: classes.slideEnterActive,
|
3747 |
|
3748 | enter: classes['slideEnter-' + slideDirection],
|
3749 |
|
3750 | exitActive: classes['slideExitActiveLeft-' + slideDirection]
|
3751 | };
|
3752 | return React.createElement(TransitionGroup, {
|
3753 | className: clsx(classes.transitionContainer, className),
|
3754 | childFactory: function childFactory(element) {
|
3755 | return React.cloneElement(element, {
|
3756 | classNames: transitionClasses
|
3757 | });
|
3758 | }
|
3759 | }, React.createElement(CSSTransition, {
|
3760 | mountOnEnter: true,
|
3761 | unmountOnExit: true,
|
3762 | key: transKey + slideDirection,
|
3763 | timeout: animationDuration,
|
3764 | classNames: transitionClasses,
|
3765 | children: children
|
3766 | }));
|
3767 | };
|
3768 |
|
3769 | var ArrowLeftIcon = function ArrowLeftIcon(props) {
|
3770 | return React__default.createElement(SvgIcon, props, React__default.createElement("path", {
|
3771 | d: "M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"
|
3772 | }), React__default.createElement("path", {
|
3773 | fill: "none",
|
3774 | d: "M0 0h24v24H0V0z"
|
3775 | }));
|
3776 | };
|
3777 |
|
3778 | var ArrowRightIcon = function ArrowRightIcon(props) {
|
3779 | return React__default.createElement(SvgIcon, props, React__default.createElement("path", {
|
3780 | d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"
|
3781 | }), React__default.createElement("path", {
|
3782 | fill: "none",
|
3783 | d: "M0 0h24v24H0V0z"
|
3784 | }));
|
3785 | };
|
3786 |
|
3787 | var useStyles$5 = styles$5.makeStyles(function (theme) {
|
3788 | return {
|
3789 | switchHeader: {
|
3790 | display: 'flex',
|
3791 | justifyContent: 'space-between',
|
3792 | alignItems: 'center',
|
3793 | marginTop: theme.spacing(0.5),
|
3794 | marginBottom: theme.spacing(1)
|
3795 | },
|
3796 | transitionContainer: {
|
3797 | width: '100%',
|
3798 | overflow: 'hidden',
|
3799 | height: 23
|
3800 | },
|
3801 | iconButton: {
|
3802 | zIndex: 1,
|
3803 | backgroundColor: theme.palette.background.paper
|
3804 | },
|
3805 | daysHeader: {
|
3806 | display: 'flex',
|
3807 | justifyContent: 'center',
|
3808 | alignItems: 'center',
|
3809 | maxHeight: 16
|
3810 | },
|
3811 | dayLabel: {
|
3812 | width: 36,
|
3813 | margin: '0 2px',
|
3814 | textAlign: 'center',
|
3815 | color: theme.palette.text.hint
|
3816 | }
|
3817 | };
|
3818 | }, {
|
3819 | name: 'MuiPickersCalendarHeader'
|
3820 | });
|
3821 | var CalendarHeader = function CalendarHeader(_ref) {
|
3822 | var currentMonth = _ref.currentMonth,
|
3823 | onMonthChange = _ref.onMonthChange,
|
3824 | leftArrowIcon = _ref.leftArrowIcon,
|
3825 | rightArrowIcon = _ref.rightArrowIcon,
|
3826 | leftArrowButtonProps = _ref.leftArrowButtonProps,
|
3827 | rightArrowButtonProps = _ref.rightArrowButtonProps,
|
3828 | disablePrevMonth = _ref.disablePrevMonth,
|
3829 | disableNextMonth = _ref.disableNextMonth,
|
3830 | slideDirection = _ref.slideDirection;
|
3831 | var utils = useUtils();
|
3832 | var classes = useStyles$5();
|
3833 | var theme = styles$5.useTheme();
|
3834 | var rtl = theme.direction === 'rtl';
|
3835 |
|
3836 | var selectNextMonth = function selectNextMonth() {
|
3837 | return onMonthChange(utils.getNextMonth(currentMonth), 'left');
|
3838 | };
|
3839 |
|
3840 | var selectPreviousMonth = function selectPreviousMonth() {
|
3841 | return onMonthChange(utils.getPreviousMonth(currentMonth), 'right');
|
3842 | };
|
3843 |
|
3844 | return React.createElement("div", null, React.createElement("div", {
|
3845 | className: classes.switchHeader
|
3846 | }, React.createElement(IconButton, _extends({}, leftArrowButtonProps, {
|
3847 | disabled: disablePrevMonth,
|
3848 | onClick: selectPreviousMonth,
|
3849 | className: classes.iconButton
|
3850 | }), rtl ? rightArrowIcon : leftArrowIcon), React.createElement(SlideTransition, {
|
3851 | slideDirection: slideDirection,
|
3852 | transKey: currentMonth.toString(),
|
3853 | className: classes.transitionContainer
|
3854 | }, React.createElement(Typography, {
|
3855 | align: "center",
|
3856 | variant: "body1"
|
3857 | }, utils.getCalendarHeaderText(currentMonth))), React.createElement(IconButton, _extends({}, rightArrowButtonProps, {
|
3858 | disabled: disableNextMonth,
|
3859 | onClick: selectNextMonth,
|
3860 | className: classes.iconButton
|
3861 | }), rtl ? leftArrowIcon : rightArrowIcon)), React.createElement("div", {
|
3862 | className: classes.daysHeader
|
3863 | }, utils.getWeekdays().map(function (day, index) {
|
3864 | return React.createElement(Typography, {
|
3865 | key: index
|
3866 | ,
|
3867 | variant: "caption",
|
3868 | className: classes.dayLabel
|
3869 | }, day);
|
3870 | })));
|
3871 | };
|
3872 | CalendarHeader.displayName = 'CalendarHeader';
|
3873 | CalendarHeader.propTypes = {
|
3874 | leftArrowIcon: propTypes_13,
|
3875 | rightArrowIcon: propTypes_13,
|
3876 | disablePrevMonth: propTypes_2,
|
3877 | disableNextMonth: propTypes_2
|
3878 | } ;
|
3879 | CalendarHeader.defaultProps = {
|
3880 | leftArrowIcon: React.createElement(ArrowLeftIcon, null),
|
3881 | rightArrowIcon: React.createElement(ArrowRightIcon, null),
|
3882 | disablePrevMonth: false,
|
3883 | disableNextMonth: false
|
3884 | };
|
3885 |
|
3886 | var DIALOG_WIDTH = 310;
|
3887 | var DIALOG_WIDTH_WIDER = 325;
|
3888 | var VIEW_HEIGHT = 305;
|
3889 |
|
3890 | var useStyles$6 = styles$5.makeStyles(function (theme) {
|
3891 | return {
|
3892 | staticWrapperRoot: {
|
3893 | overflow: 'hidden',
|
3894 | minWidth: DIALOG_WIDTH,
|
3895 | display: 'flex',
|
3896 | flexDirection: 'column',
|
3897 | backgroundColor: theme.palette.background.paper
|
3898 | }
|
3899 | };
|
3900 | }, {
|
3901 | name: 'MuiPickersStaticWrapper'
|
3902 | });
|
3903 | var StaticWrapper = function StaticWrapper(_ref) {
|
3904 | var children = _ref.children;
|
3905 | var classes = useStyles$6();
|
3906 | return React.createElement("div", {
|
3907 | className: classes.staticWrapperRoot,
|
3908 | children: children
|
3909 | });
|
3910 | };
|
3911 |
|
3912 | var ModalDialog = function ModalDialog(_ref) {
|
3913 | var children = _ref.children,
|
3914 | classes = _ref.classes,
|
3915 | onAccept = _ref.onAccept,
|
3916 | onDismiss = _ref.onDismiss,
|
3917 | onClear = _ref.onClear,
|
3918 | onSetToday = _ref.onSetToday,
|
3919 | okLabel = _ref.okLabel,
|
3920 | cancelLabel = _ref.cancelLabel,
|
3921 | clearLabel = _ref.clearLabel,
|
3922 | todayLabel = _ref.todayLabel,
|
3923 | clearable = _ref.clearable,
|
3924 | showTodayButton = _ref.showTodayButton,
|
3925 | showTabs = _ref.showTabs,
|
3926 | wider = _ref.wider,
|
3927 | other = _objectWithoutProperties(_ref, ["children", "classes", "onAccept", "onDismiss", "onClear", "onSetToday", "okLabel", "cancelLabel", "clearLabel", "todayLabel", "clearable", "showTodayButton", "showTabs", "wider"]);
|
3928 |
|
3929 | return React.createElement(Dialog, _extends({
|
3930 | role: "dialog",
|
3931 | onClose: onDismiss,
|
3932 | classes: {
|
3933 | paper: clsx(classes.dialogRoot, wider && classes.dialogRootWider)
|
3934 | }
|
3935 | }, other), React.createElement(DialogContent, {
|
3936 | children: children,
|
3937 | className: classes.dialog
|
3938 | }), React.createElement(DialogActions, {
|
3939 | classes: {
|
3940 | root: clsx((clearable || showTodayButton) && classes.withAdditionalAction)
|
3941 | }
|
3942 | }, clearable && React.createElement(Button, {
|
3943 | color: "primary",
|
3944 | onClick: onClear
|
3945 | }, clearLabel), showTodayButton && React.createElement(Button, {
|
3946 | color: "primary",
|
3947 | onClick: onSetToday
|
3948 | }, todayLabel), cancelLabel && React.createElement(Button, {
|
3949 | color: "primary",
|
3950 | onClick: onDismiss
|
3951 | }, cancelLabel), okLabel && React.createElement(Button, {
|
3952 | color: "primary",
|
3953 | onClick: onAccept
|
3954 | }, okLabel)));
|
3955 | };
|
3956 | ModalDialog.displayName = 'ModalDialog';
|
3957 | var styles$1 = styles$5.createStyles({
|
3958 | dialogRoot: {
|
3959 | minWidth: DIALOG_WIDTH
|
3960 | },
|
3961 | dialogRootWider: {
|
3962 | minWidth: DIALOG_WIDTH_WIDER
|
3963 | },
|
3964 | dialog: {
|
3965 | '&:first-child': {
|
3966 | padding: 0
|
3967 | }
|
3968 | },
|
3969 | withAdditionalAction: {
|
3970 |
|
3971 |
|
3972 | justifyContent: 'flex-start',
|
3973 | '& > *:first-child': {
|
3974 | marginRight: 'auto'
|
3975 | }
|
3976 | }
|
3977 | });
|
3978 | var ModalDialog$1 = styles$5.withStyles(styles$1, {
|
3979 | name: 'MuiPickersModal'
|
3980 | })(ModalDialog);
|
3981 |
|
3982 | var useIsomorphicEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
|
3983 | function runKeyHandler(e, keyHandlers) {
|
3984 | var handler = keyHandlers[e.key];
|
3985 |
|
3986 | if (handler) {
|
3987 | handler();
|
3988 |
|
3989 | e.preventDefault();
|
3990 | }
|
3991 | }
|
3992 | function useKeyDown(active, keyHandlers) {
|
3993 | var keyHandlersRef = React.useRef(keyHandlers);
|
3994 | keyHandlersRef.current = keyHandlers;
|
3995 | useIsomorphicEffect(function () {
|
3996 | if (active) {
|
3997 | var handleKeyDown = function handleKeyDown(event) {
|
3998 | runKeyHandler(event, keyHandlersRef.current);
|
3999 | };
|
4000 |
|
4001 | window.addEventListener('keydown', handleKeyDown);
|
4002 | return function () {
|
4003 | window.removeEventListener('keydown', handleKeyDown);
|
4004 | };
|
4005 | }
|
4006 | }, [active]);
|
4007 | }
|
4008 |
|
4009 | var ModalWrapper = function ModalWrapper(_ref) {
|
4010 | var open = _ref.open,
|
4011 | children = _ref.children,
|
4012 | okLabel = _ref.okLabel,
|
4013 | cancelLabel = _ref.cancelLabel,
|
4014 | clearLabel = _ref.clearLabel,
|
4015 | todayLabel = _ref.todayLabel,
|
4016 | showTodayButton = _ref.showTodayButton,
|
4017 | clearable = _ref.clearable,
|
4018 | DialogProps = _ref.DialogProps,
|
4019 | showTabs = _ref.showTabs,
|
4020 | wider = _ref.wider,
|
4021 | InputComponent = _ref.InputComponent,
|
4022 | DateInputProps = _ref.DateInputProps,
|
4023 | onClear = _ref.onClear,
|
4024 | onAccept = _ref.onAccept,
|
4025 | onDismiss = _ref.onDismiss,
|
4026 | onSetToday = _ref.onSetToday,
|
4027 | other = _objectWithoutProperties(_ref, ["open", "children", "okLabel", "cancelLabel", "clearLabel", "todayLabel", "showTodayButton", "clearable", "DialogProps", "showTabs", "wider", "InputComponent", "DateInputProps", "onClear", "onAccept", "onDismiss", "onSetToday"]);
|
4028 |
|
4029 | useKeyDown(open, {
|
4030 | Enter: onAccept
|
4031 | });
|
4032 | return React.createElement(React.Fragment, null, React.createElement(InputComponent, _extends({}, other, DateInputProps)), React.createElement(ModalDialog$1, _extends({
|
4033 | wider: wider,
|
4034 | showTabs: showTabs,
|
4035 | open: open,
|
4036 | onClear: onClear,
|
4037 | onAccept: onAccept,
|
4038 | onDismiss: onDismiss,
|
4039 | onSetToday: onSetToday,
|
4040 | clearLabel: clearLabel,
|
4041 | todayLabel: todayLabel,
|
4042 | okLabel: okLabel,
|
4043 | cancelLabel: cancelLabel,
|
4044 | clearable: clearable,
|
4045 | showTodayButton: showTodayButton,
|
4046 | children: children
|
4047 | }, DialogProps)));
|
4048 | };
|
4049 | ModalWrapper.propTypes = {
|
4050 | okLabel: propTypes_13,
|
4051 | cancelLabel: propTypes_13,
|
4052 | clearLabel: propTypes_13,
|
4053 | clearable: propTypes_2,
|
4054 | todayLabel: propTypes_13,
|
4055 | showTodayButton: propTypes_2,
|
4056 | DialogProps: propTypes_5
|
4057 | } ;
|
4058 | ModalWrapper.defaultProps = {
|
4059 | okLabel: 'OK',
|
4060 | cancelLabel: 'Cancel',
|
4061 | clearLabel: 'Clear',
|
4062 | todayLabel: 'Today',
|
4063 | clearable: false,
|
4064 | showTodayButton: false
|
4065 | };
|
4066 |
|
4067 | var InlineWrapper = function InlineWrapper(_ref) {
|
4068 | var open = _ref.open,
|
4069 | wider = _ref.wider,
|
4070 | children = _ref.children,
|
4071 | PopoverProps = _ref.PopoverProps,
|
4072 | onClear = _ref.onClear,
|
4073 | onDismiss = _ref.onDismiss,
|
4074 | onSetToday = _ref.onSetToday,
|
4075 | onAccept = _ref.onAccept,
|
4076 | showTabs = _ref.showTabs,
|
4077 | DateInputProps = _ref.DateInputProps,
|
4078 | InputComponent = _ref.InputComponent,
|
4079 | other = _objectWithoutProperties(_ref, ["open", "wider", "children", "PopoverProps", "onClear", "onDismiss", "onSetToday", "onAccept", "showTabs", "DateInputProps", "InputComponent"]);
|
4080 |
|
4081 | var ref = React.useRef();
|
4082 | useKeyDown(open, {
|
4083 | Enter: onAccept
|
4084 | });
|
4085 | return React.createElement(React.Fragment, null, React.createElement(InputComponent, _extends({}, other, DateInputProps, {
|
4086 | inputRef: ref
|
4087 | })), React.createElement(Popover, _extends({
|
4088 | open: open,
|
4089 | onClose: onDismiss,
|
4090 | anchorEl: ref.current,
|
4091 | anchorOrigin: {
|
4092 | vertical: 'bottom',
|
4093 | horizontal: 'center'
|
4094 | },
|
4095 | transformOrigin: {
|
4096 | vertical: 'top',
|
4097 | horizontal: 'center'
|
4098 | },
|
4099 | children: children
|
4100 | }, PopoverProps)));
|
4101 | };
|
4102 | InlineWrapper.propTypes = {
|
4103 | onOpen: propTypes_3,
|
4104 | onClose: propTypes_3,
|
4105 | PopoverProps: propTypes_5
|
4106 | } ;
|
4107 |
|
4108 | function getWrapperFromVariant(variant) {
|
4109 | switch (variant) {
|
4110 | case 'inline':
|
4111 | return InlineWrapper;
|
4112 |
|
4113 | case 'static':
|
4114 | return StaticWrapper;
|
4115 |
|
4116 | default:
|
4117 | return ModalWrapper;
|
4118 | }
|
4119 | }
|
4120 | var VariantContext = React.createContext(null);
|
4121 | var Wrapper = function Wrapper(_ref) {
|
4122 | var variant = _ref.variant,
|
4123 | props = _objectWithoutProperties(_ref, ["variant"]);
|
4124 |
|
4125 | var Component = getWrapperFromVariant(variant);
|
4126 | return React.createElement(VariantContext.Provider, {
|
4127 | value: variant || 'dialog'
|
4128 | }, React.createElement(Component, props));
|
4129 | };
|
4130 |
|
4131 | var withUtils = function withUtils() {
|
4132 | return function (Component) {
|
4133 | var WithUtils = function WithUtils(props) {
|
4134 | var utils = useUtils();
|
4135 | return React.createElement(Component, _extends({
|
4136 | utils: utils
|
4137 | }, props));
|
4138 | };
|
4139 |
|
4140 | WithUtils.displayName = "WithUtils(".concat(Component.displayName || Component.name, ")");
|
4141 | return WithUtils;
|
4142 | };
|
4143 | };
|
4144 |
|
4145 | var KeyDownListener = function KeyDownListener(_ref) {
|
4146 | var onKeyDown = _ref.onKeyDown;
|
4147 | React.useEffect(function () {
|
4148 | window.addEventListener('keydown', onKeyDown);
|
4149 | return function () {
|
4150 | window.removeEventListener('keydown', onKeyDown);
|
4151 | };
|
4152 | }, [onKeyDown]);
|
4153 | return null;
|
4154 | };
|
4155 |
|
4156 | var Calendar =
|
4157 |
|
4158 | function (_React$Component) {
|
4159 | _inherits(Calendar, _React$Component);
|
4160 |
|
4161 | function Calendar() {
|
4162 | var _getPrototypeOf2;
|
4163 |
|
4164 | var _this;
|
4165 |
|
4166 | _classCallCheck(this, Calendar);
|
4167 |
|
4168 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
4169 | args[_key] = arguments[_key];
|
4170 | }
|
4171 |
|
4172 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Calendar)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
4173 | _this.state = {
|
4174 | slideDirection: 'left',
|
4175 | currentMonth: _this.props.utils.startOfMonth(_this.props.date),
|
4176 | loadingQueue: 0
|
4177 | };
|
4178 |
|
4179 | _this.pushToLoadingQueue = function () {
|
4180 | var loadingQueue = _this.state.loadingQueue + 1;
|
4181 |
|
4182 | _this.setState({
|
4183 | loadingQueue: loadingQueue
|
4184 | });
|
4185 | };
|
4186 |
|
4187 | _this.popFromLoadingQueue = function () {
|
4188 | var loadingQueue = _this.state.loadingQueue;
|
4189 | loadingQueue = loadingQueue <= 0 ? 0 : loadingQueue - 1;
|
4190 |
|
4191 | _this.setState({
|
4192 | loadingQueue: loadingQueue
|
4193 | });
|
4194 | };
|
4195 |
|
4196 | _this.handleChangeMonth = function (newMonth, slideDirection) {
|
4197 | _this.setState({
|
4198 | currentMonth: newMonth,
|
4199 | slideDirection: slideDirection
|
4200 | });
|
4201 |
|
4202 | if (_this.props.onMonthChange) {
|
4203 | var returnVal = _this.props.onMonthChange(newMonth);
|
4204 |
|
4205 | if (returnVal) {
|
4206 | _this.pushToLoadingQueue();
|
4207 |
|
4208 | returnVal.then(function () {
|
4209 | _this.popFromLoadingQueue();
|
4210 | });
|
4211 | }
|
4212 | }
|
4213 | };
|
4214 |
|
4215 | _this.validateMinMaxDate = function (day) {
|
4216 | var _this$props = _this.props,
|
4217 | minDate = _this$props.minDate,
|
4218 | maxDate = _this$props.maxDate,
|
4219 | utils = _this$props.utils,
|
4220 | disableFuture = _this$props.disableFuture,
|
4221 | disablePast = _this$props.disablePast;
|
4222 | var now = utils.date();
|
4223 | return Boolean(disableFuture && utils.isAfterDay(day, now) || disablePast && utils.isBeforeDay(day, now) || minDate && utils.isBeforeDay(day, utils.date(minDate)) || maxDate && utils.isAfterDay(day, utils.date(maxDate)));
|
4224 | };
|
4225 |
|
4226 | _this.shouldDisablePrevMonth = function () {
|
4227 | var _this$props2 = _this.props,
|
4228 | utils = _this$props2.utils,
|
4229 | disablePast = _this$props2.disablePast,
|
4230 | minDate = _this$props2.minDate;
|
4231 | var now = utils.date();
|
4232 | var firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now, utils.date(minDate)) ? now : utils.date(minDate));
|
4233 | return !utils.isBefore(firstEnabledMonth, _this.state.currentMonth);
|
4234 | };
|
4235 |
|
4236 | _this.shouldDisableNextMonth = function () {
|
4237 | var _this$props3 = _this.props,
|
4238 | utils = _this$props3.utils,
|
4239 | disableFuture = _this$props3.disableFuture,
|
4240 | maxDate = _this$props3.maxDate;
|
4241 | var now = utils.date();
|
4242 | var lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now, utils.date(maxDate)) ? now : utils.date(maxDate));
|
4243 | return !utils.isAfter(lastEnabledMonth, _this.state.currentMonth);
|
4244 | };
|
4245 |
|
4246 | _this.shouldDisableDate = function (day) {
|
4247 | var shouldDisableDate = _this.props.shouldDisableDate;
|
4248 | return _this.validateMinMaxDate(day) || Boolean(shouldDisableDate && shouldDisableDate(day));
|
4249 | };
|
4250 |
|
4251 | _this.handleDaySelect = function (day) {
|
4252 | var isFinish = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
4253 | var _this$props4 = _this.props,
|
4254 | date = _this$props4.date,
|
4255 | utils = _this$props4.utils;
|
4256 |
|
4257 | _this.props.onChange(utils.mergeDateAndTime(day, date), isFinish);
|
4258 | };
|
4259 |
|
4260 | _this.moveToDay = function (day) {
|
4261 | var utils = _this.props.utils;
|
4262 |
|
4263 | if (day && !_this.shouldDisableDate(day)) {
|
4264 | if (utils.getMonth(day) !== utils.getMonth(_this.state.currentMonth)) {
|
4265 | _this.handleChangeMonth(utils.startOfMonth(day), 'left');
|
4266 | }
|
4267 |
|
4268 | _this.handleDaySelect(day, false);
|
4269 | }
|
4270 | };
|
4271 |
|
4272 | _this.handleKeyDown = function (event) {
|
4273 | var _this$props5 = _this.props,
|
4274 | theme = _this$props5.theme,
|
4275 | date = _this$props5.date,
|
4276 | utils = _this$props5.utils;
|
4277 | runKeyHandler(event, {
|
4278 | ArrowUp: function ArrowUp() {
|
4279 | return _this.moveToDay(utils.addDays(date, -7));
|
4280 | },
|
4281 | ArrowDown: function ArrowDown() {
|
4282 | return _this.moveToDay(utils.addDays(date, 7));
|
4283 | },
|
4284 | ArrowLeft: function ArrowLeft() {
|
4285 | return _this.moveToDay(utils.addDays(date, theme.direction === 'ltr' ? -1 : 1));
|
4286 | },
|
4287 | ArrowRight: function ArrowRight() {
|
4288 | return _this.moveToDay(utils.addDays(date, theme.direction === 'ltr' ? 1 : -1));
|
4289 | }
|
4290 | });
|
4291 | };
|
4292 |
|
4293 | _this.renderWeeks = function () {
|
4294 | var _this$props6 = _this.props,
|
4295 | utils = _this$props6.utils,
|
4296 | classes = _this$props6.classes;
|
4297 | var weeks = utils.getWeekArray(_this.state.currentMonth);
|
4298 | return weeks.map(function (week) {
|
4299 | return React.createElement("div", {
|
4300 | key: "week-".concat(week[0].toString()),
|
4301 | className: classes.week
|
4302 | }, _this.renderDays(week));
|
4303 | });
|
4304 | };
|
4305 |
|
4306 | _this.renderDays = function (week) {
|
4307 | var _this$props7 = _this.props,
|
4308 | date = _this$props7.date,
|
4309 | renderDay = _this$props7.renderDay,
|
4310 | utils = _this$props7.utils;
|
4311 | var now = utils.date();
|
4312 | var selectedDate = utils.startOfDay(date);
|
4313 | var currentMonthNumber = utils.getMonth(_this.state.currentMonth);
|
4314 | return week.map(function (day) {
|
4315 | var disabled = _this.shouldDisableDate(day);
|
4316 |
|
4317 | var isDayInCurrentMonth = utils.getMonth(day) === currentMonthNumber;
|
4318 | var dayComponent = React.createElement(Day, {
|
4319 | disabled: disabled,
|
4320 | current: utils.isSameDay(day, now),
|
4321 | hidden: !isDayInCurrentMonth,
|
4322 | selected: utils.isSameDay(selectedDate, day)
|
4323 | }, utils.getDayText(day));
|
4324 |
|
4325 | if (renderDay) {
|
4326 | dayComponent = renderDay(day, selectedDate, isDayInCurrentMonth, dayComponent);
|
4327 | }
|
4328 |
|
4329 | return React.createElement(DayWrapper, {
|
4330 | value: day,
|
4331 | key: day.toString(),
|
4332 | disabled: disabled,
|
4333 | dayInCurrentMonth: isDayInCurrentMonth,
|
4334 | onSelect: _this.handleDaySelect
|
4335 | }, dayComponent);
|
4336 | });
|
4337 | };
|
4338 |
|
4339 | return _this;
|
4340 | }
|
4341 |
|
4342 | _createClass(Calendar, [{
|
4343 | key: "componentDidMount",
|
4344 | value: function componentDidMount() {
|
4345 | var _this$props8 = this.props,
|
4346 | date = _this$props8.date,
|
4347 | minDate = _this$props8.minDate,
|
4348 | maxDate = _this$props8.maxDate,
|
4349 | utils = _this$props8.utils,
|
4350 | disablePast = _this$props8.disablePast,
|
4351 | disableFuture = _this$props8.disableFuture;
|
4352 |
|
4353 | if (this.shouldDisableDate(date)) {
|
4354 | var closestEnabledDate = findClosestEnabledDate({
|
4355 | date: date,
|
4356 | utils: utils,
|
4357 | minDate: utils.date(minDate),
|
4358 | maxDate: utils.date(maxDate),
|
4359 | disablePast: Boolean(disablePast),
|
4360 | disableFuture: Boolean(disableFuture),
|
4361 | shouldDisableDate: this.shouldDisableDate
|
4362 | });
|
4363 | this.handleDaySelect(closestEnabledDate, false);
|
4364 | }
|
4365 | }
|
4366 | }, {
|
4367 | key: "render",
|
4368 | value: function render() {
|
4369 | var _this$state = this.state,
|
4370 | currentMonth = _this$state.currentMonth,
|
4371 | slideDirection = _this$state.slideDirection;
|
4372 | var _this$props9 = this.props,
|
4373 | classes = _this$props9.classes,
|
4374 | allowKeyboardControl = _this$props9.allowKeyboardControl,
|
4375 | leftArrowButtonProps = _this$props9.leftArrowButtonProps,
|
4376 | leftArrowIcon = _this$props9.leftArrowIcon,
|
4377 | rightArrowButtonProps = _this$props9.rightArrowButtonProps,
|
4378 | rightArrowIcon = _this$props9.rightArrowIcon,
|
4379 | loadingIndicator = _this$props9.loadingIndicator;
|
4380 | var loadingElement = loadingIndicator ? loadingIndicator : React.createElement(CircularProgress, null);
|
4381 | return React.createElement(React.Fragment, null, allowKeyboardControl && this.context !== 'static' && React.createElement(KeyDownListener, {
|
4382 | onKeyDown: this.handleKeyDown
|
4383 | }), React.createElement(CalendarHeader, {
|
4384 | currentMonth: currentMonth,
|
4385 | slideDirection: slideDirection,
|
4386 | onMonthChange: this.handleChangeMonth,
|
4387 | leftArrowIcon: leftArrowIcon,
|
4388 | leftArrowButtonProps: leftArrowButtonProps,
|
4389 | rightArrowIcon: rightArrowIcon,
|
4390 | rightArrowButtonProps: rightArrowButtonProps,
|
4391 | disablePrevMonth: this.shouldDisablePrevMonth(),
|
4392 | disableNextMonth: this.shouldDisableNextMonth()
|
4393 | }), React.createElement(SlideTransition, {
|
4394 | slideDirection: slideDirection,
|
4395 | transKey: currentMonth.toString(),
|
4396 | className: classes.transitionContainer
|
4397 | }, React.createElement(React.Fragment, null, this.state.loadingQueue > 0 && React.createElement("div", {
|
4398 | className: classes.progressContainer
|
4399 | }, loadingElement) || React.createElement("div", null, this.renderWeeks()))));
|
4400 | }
|
4401 | }], [{
|
4402 | key: "getDerivedStateFromProps",
|
4403 | value: function getDerivedStateFromProps(nextProps, state) {
|
4404 | var utils = nextProps.utils,
|
4405 | nextDate = nextProps.date;
|
4406 |
|
4407 | if (!utils.isEqual(nextDate, state.lastDate)) {
|
4408 | var nextMonth = utils.getMonth(nextDate);
|
4409 | var lastDate = state.lastDate || nextDate;
|
4410 | var lastMonth = utils.getMonth(lastDate);
|
4411 | return {
|
4412 | lastDate: nextDate,
|
4413 | currentMonth: nextProps.utils.startOfMonth(nextDate),
|
4414 |
|
4415 | slideDirection: nextMonth === lastMonth ? state.slideDirection : utils.isAfterDay(nextDate, lastDate) ? 'left' : 'right'
|
4416 | };
|
4417 | }
|
4418 |
|
4419 | return null;
|
4420 | }
|
4421 | }]);
|
4422 |
|
4423 | return Calendar;
|
4424 | }(React.Component);
|
4425 | Calendar.contextType = VariantContext;
|
4426 | Calendar.propTypes = {
|
4427 | renderDay: propTypes_3,
|
4428 | shouldDisableDate: propTypes_3,
|
4429 | allowKeyboardControl: propTypes_2
|
4430 | } ;
|
4431 | Calendar.defaultProps = {
|
4432 | minDate: new Date('1900-01-01'),
|
4433 | maxDate: new Date('2100-01-01'),
|
4434 | disablePast: false,
|
4435 | disableFuture: false,
|
4436 | allowKeyboardControl: true
|
4437 | };
|
4438 | var styles$2 = function styles(theme) {
|
4439 | return {
|
4440 | transitionContainer: {
|
4441 | minHeight: 36 * 6,
|
4442 | marginTop: theme.spacing(1.5)
|
4443 | },
|
4444 | progressContainer: {
|
4445 | width: '100%',
|
4446 | height: '100%',
|
4447 | display: 'flex',
|
4448 | justifyContent: 'center',
|
4449 | alignItems: 'center'
|
4450 | },
|
4451 | week: {
|
4452 | display: 'flex',
|
4453 | justifyContent: 'center'
|
4454 | }
|
4455 | };
|
4456 | };
|
4457 | var Calendar$1 = styles$5.withStyles(styles$2, {
|
4458 | name: 'MuiPickersCalendar',
|
4459 | withTheme: true
|
4460 | })(withUtils()(Calendar));
|
4461 |
|
4462 | function useViews(views, openTo, onChange) {
|
4463 | var _React$useState = React.useState(openTo && arrayIncludes(views, openTo) ? openTo : views[0]),
|
4464 | _React$useState2 = _slicedToArray(_React$useState, 2),
|
4465 | openView = _React$useState2[0],
|
4466 | setOpenView = _React$useState2[1];
|
4467 |
|
4468 | var handleChangeAndOpenNext = React.useCallback(function (date, isFinish) {
|
4469 | var nextViewToOpen = views[views.indexOf(openView) + 1];
|
4470 |
|
4471 | if (isFinish && nextViewToOpen) {
|
4472 |
|
4473 | onChange(date, false);
|
4474 | setOpenView(nextViewToOpen);
|
4475 | return;
|
4476 | }
|
4477 |
|
4478 | onChange(date, Boolean(isFinish));
|
4479 | }, [onChange, openView, views]);
|
4480 | return {
|
4481 | handleChangeAndOpenNext: handleChangeAndOpenNext,
|
4482 | openView: openView,
|
4483 | setOpenView: setOpenView
|
4484 | };
|
4485 | }
|
4486 |
|
4487 | var ClockType;
|
4488 |
|
4489 | (function (ClockType) {
|
4490 | ClockType["HOURS"] = "hours";
|
4491 | ClockType["MINUTES"] = "minutes";
|
4492 | ClockType["SECONDS"] = "seconds";
|
4493 | })(ClockType || (ClockType = {}));
|
4494 |
|
4495 | var ClockType$1 = ClockType;
|
4496 |
|
4497 | var ClockPointer =
|
4498 |
|
4499 | function (_React$Component) {
|
4500 | _inherits(ClockPointer, _React$Component);
|
4501 |
|
4502 | function ClockPointer() {
|
4503 | var _getPrototypeOf2;
|
4504 |
|
4505 | var _this;
|
4506 |
|
4507 | _classCallCheck(this, ClockPointer);
|
4508 |
|
4509 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
4510 | args[_key] = arguments[_key];
|
4511 | }
|
4512 |
|
4513 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ClockPointer)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
4514 | _this.state = {
|
4515 | toAnimateTransform: false,
|
4516 | previousType: undefined
|
4517 | };
|
4518 |
|
4519 | _this.getAngleStyle = function () {
|
4520 | var _this$props = _this.props,
|
4521 | value = _this$props.value,
|
4522 | isInner = _this$props.isInner,
|
4523 | type = _this$props.type;
|
4524 | var max = type === ClockType$1.HOURS ? 12 : 60;
|
4525 | var angle = 360 / max * value;
|
4526 |
|
4527 | if (type === ClockType$1.HOURS && value > 12) {
|
4528 | angle -= 360;
|
4529 | }
|
4530 |
|
4531 | return {
|
4532 | height: isInner ? '26%' : '40%',
|
4533 | transform: "rotateZ(".concat(angle, "deg)")
|
4534 | };
|
4535 | };
|
4536 |
|
4537 | return _this;
|
4538 | }
|
4539 |
|
4540 | _createClass(ClockPointer, [{
|
4541 | key: "render",
|
4542 | value: function render() {
|
4543 | var _this$props2 = this.props,
|
4544 | classes = _this$props2.classes,
|
4545 | hasSelected = _this$props2.hasSelected;
|
4546 | return React.createElement("div", {
|
4547 | style: this.getAngleStyle(),
|
4548 | className: clsx(classes.pointer, this.state.toAnimateTransform && classes.animateTransform)
|
4549 | }, React.createElement("div", {
|
4550 | className: clsx(classes.thumb, hasSelected && classes.noPoint)
|
4551 | }));
|
4552 | }
|
4553 | }]);
|
4554 |
|
4555 | return ClockPointer;
|
4556 | }(React.Component);
|
4557 |
|
4558 | ClockPointer.getDerivedStateFromProps = function (nextProps, state) {
|
4559 | if (nextProps.type !== state.previousType) {
|
4560 | return {
|
4561 | toAnimateTransform: true,
|
4562 | previousType: nextProps.type
|
4563 | };
|
4564 | }
|
4565 |
|
4566 | return {
|
4567 | toAnimateTransform: false,
|
4568 | previousType: nextProps.type
|
4569 | };
|
4570 | };
|
4571 |
|
4572 | var styles$3 = function styles(theme) {
|
4573 | return styles$5.createStyles({
|
4574 | pointer: {
|
4575 | width: 2,
|
4576 | backgroundColor: theme.palette.primary.main,
|
4577 | position: 'absolute',
|
4578 | left: 'calc(50% - 1px)',
|
4579 | bottom: '50%',
|
4580 | transformOrigin: 'center bottom 0px'
|
4581 | },
|
4582 | animateTransform: {
|
4583 | transition: theme.transitions.create(['transform', 'height'])
|
4584 | },
|
4585 | thumb: {
|
4586 | width: 4,
|
4587 | height: 4,
|
4588 | backgroundColor: theme.palette.primary.contrastText,
|
4589 | borderRadius: '100%',
|
4590 | position: 'absolute',
|
4591 | top: -21,
|
4592 | left: -15,
|
4593 | border: "14px solid ".concat(theme.palette.primary.main),
|
4594 | boxSizing: 'content-box'
|
4595 | },
|
4596 | noPoint: {
|
4597 | backgroundColor: theme.palette.primary.main
|
4598 | }
|
4599 | });
|
4600 | };
|
4601 | var ClockPointer$1 = styles$5.withStyles(styles$3, {
|
4602 | name: 'MuiPickersClockPointer'
|
4603 | })(ClockPointer);
|
4604 |
|
4605 | var center = {
|
4606 | x: 260 / 2,
|
4607 | y: 260 / 2
|
4608 | };
|
4609 | var basePoint = {
|
4610 | x: center.x,
|
4611 | y: 0
|
4612 | };
|
4613 | var cx = basePoint.x - center.x;
|
4614 | var cy = basePoint.y - center.y;
|
4615 |
|
4616 | var rad2deg = function rad2deg(rad) {
|
4617 | return rad * 57.29577951308232;
|
4618 | };
|
4619 |
|
4620 | var getAngleValue = function getAngleValue(step, offsetX, offsetY) {
|
4621 | var x = offsetX - center.x;
|
4622 | var y = offsetY - center.y;
|
4623 | var atan = Math.atan2(cx, cy) - Math.atan2(x, y);
|
4624 | var deg = rad2deg(atan);
|
4625 | deg = Math.round(deg / step) * step;
|
4626 | deg %= 360;
|
4627 | var value = Math.floor(deg / step) || 0;
|
4628 | var delta = Math.pow(x, 2) + Math.pow(y, 2);
|
4629 | var distance = Math.sqrt(delta);
|
4630 | return {
|
4631 | value: value,
|
4632 | distance: distance
|
4633 | };
|
4634 | };
|
4635 |
|
4636 | var getHours = function getHours(offsetX, offsetY, ampm) {
|
4637 | var _getAngleValue = getAngleValue(30, offsetX, offsetY),
|
4638 | value = _getAngleValue.value,
|
4639 | distance = _getAngleValue.distance;
|
4640 |
|
4641 | value = value || 12;
|
4642 |
|
4643 | if (!ampm) {
|
4644 | if (distance < 90) {
|
4645 | value += 12;
|
4646 | value %= 24;
|
4647 | }
|
4648 | } else {
|
4649 | value %= 12;
|
4650 | }
|
4651 |
|
4652 | return value;
|
4653 | };
|
4654 | var getMinutes = function getMinutes(offsetX, offsetY) {
|
4655 | var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
4656 | var angleStep = step * 6;
|
4657 |
|
4658 | var _getAngleValue2 = getAngleValue(angleStep, offsetX, offsetY),
|
4659 | value = _getAngleValue2.value;
|
4660 |
|
4661 | value = value * step % 60;
|
4662 | return value;
|
4663 | };
|
4664 | var getMeridiem = function getMeridiem(date, utils) {
|
4665 | return utils.getHours(date) >= 12 ? 'pm' : 'am';
|
4666 | };
|
4667 | var convertToMeridiem = function convertToMeridiem(time, meridiem, ampm, utils) {
|
4668 | if (ampm) {
|
4669 | var currentMeridiem = utils.getHours(time) >= 12 ? 'pm' : 'am';
|
4670 |
|
4671 | if (currentMeridiem !== meridiem) {
|
4672 | var hours = meridiem === 'am' ? utils.getHours(time) - 12 : utils.getHours(time) + 12;
|
4673 | return utils.setHours(time, hours);
|
4674 | }
|
4675 | }
|
4676 |
|
4677 | return time;
|
4678 | };
|
4679 |
|
4680 | var Clock =
|
4681 |
|
4682 | function (_React$Component) {
|
4683 | _inherits(Clock, _React$Component);
|
4684 |
|
4685 | function Clock() {
|
4686 | var _getPrototypeOf2;
|
4687 |
|
4688 | var _this;
|
4689 |
|
4690 | _classCallCheck(this, Clock);
|
4691 |
|
4692 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
4693 | args[_key] = arguments[_key];
|
4694 | }
|
4695 |
|
4696 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Clock)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
4697 | _this.isMoving = false;
|
4698 |
|
4699 | _this.handleTouchMove = function (e) {
|
4700 | _this.isMoving = true;
|
4701 |
|
4702 | _this.setTime(e);
|
4703 | };
|
4704 |
|
4705 | _this.handleTouchEnd = function (e) {
|
4706 | if (_this.isMoving) {
|
4707 | _this.setTime(e, true);
|
4708 |
|
4709 | _this.isMoving = false;
|
4710 | }
|
4711 | };
|
4712 |
|
4713 | _this.handleMove = function (e) {
|
4714 | e.preventDefault();
|
4715 | e.stopPropagation();
|
4716 |
|
4717 | var isButtonPressed = typeof e.buttons === 'undefined' ? e.nativeEvent.which === 1 : e.buttons === 1;
|
4718 |
|
4719 | if (isButtonPressed) {
|
4720 | _this.setTime(e.nativeEvent, false);
|
4721 | }
|
4722 | };
|
4723 |
|
4724 | _this.handleMouseUp = function (e) {
|
4725 | if (_this.isMoving) {
|
4726 | _this.isMoving = false;
|
4727 | }
|
4728 |
|
4729 | _this.setTime(e.nativeEvent, true);
|
4730 | };
|
4731 |
|
4732 | _this.hasSelected = function () {
|
4733 | var _this$props = _this.props,
|
4734 | type = _this$props.type,
|
4735 | value = _this$props.value;
|
4736 |
|
4737 | if (type === ClockType$1.HOURS) {
|
4738 | return true;
|
4739 | }
|
4740 |
|
4741 | return value % 5 === 0;
|
4742 | };
|
4743 |
|
4744 | return _this;
|
4745 | }
|
4746 |
|
4747 | _createClass(Clock, [{
|
4748 | key: "setTime",
|
4749 | value: function setTime(e) {
|
4750 | var isFinish = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
4751 | var offsetX = e.offsetX,
|
4752 | offsetY = e.offsetY;
|
4753 |
|
4754 | if (typeof offsetX === 'undefined') {
|
4755 | var rect = e.target.getBoundingClientRect();
|
4756 | offsetX = e.changedTouches[0].clientX - rect.left;
|
4757 | offsetY = e.changedTouches[0].clientY - rect.top;
|
4758 | }
|
4759 |
|
4760 | var value = this.props.type === ClockType$1.SECONDS || this.props.type === ClockType$1.MINUTES ? getMinutes(offsetX, offsetY, this.props.minutesStep) : getHours(offsetX, offsetY, Boolean(this.props.ampm));
|
4761 | this.props.onChange(value, isFinish);
|
4762 | }
|
4763 | }, {
|
4764 | key: "render",
|
4765 | value: function render() {
|
4766 | var _this$props2 = this.props,
|
4767 | classes = _this$props2.classes,
|
4768 | value = _this$props2.value,
|
4769 | children = _this$props2.children,
|
4770 | type = _this$props2.type,
|
4771 | ampm = _this$props2.ampm;
|
4772 | var isPointerInner = !ampm && type === ClockType$1.HOURS && (value < 1 || value > 12);
|
4773 | return React.createElement("div", {
|
4774 | className: classes.container
|
4775 | }, React.createElement("div", {
|
4776 | className: classes.clock
|
4777 | }, React.createElement("div", {
|
4778 | role: "menu",
|
4779 | tabIndex: -1,
|
4780 | className: classes.squareMask,
|
4781 | onTouchMove: this.handleTouchMove,
|
4782 | onTouchEnd: this.handleTouchEnd,
|
4783 | onMouseUp: this.handleMouseUp,
|
4784 | onMouseMove: this.handleMove
|
4785 | }), React.createElement("div", {
|
4786 | className: classes.pin
|
4787 | }), React.createElement(ClockPointer$1, {
|
4788 | type: type,
|
4789 | value: value,
|
4790 | isInner: isPointerInner,
|
4791 | hasSelected: this.hasSelected()
|
4792 | }), children));
|
4793 | }
|
4794 | }]);
|
4795 |
|
4796 | return Clock;
|
4797 | }(React.Component);
|
4798 | Clock.propTypes = {
|
4799 | type: propTypes_15(Object.keys(ClockType$1).map(function (key) {
|
4800 | return ClockType$1[key];
|
4801 | })).isRequired,
|
4802 | value: propTypes_4.isRequired,
|
4803 | onChange: propTypes_3.isRequired,
|
4804 | children: propTypes_9(propTypes_13).isRequired,
|
4805 | ampm: propTypes_2,
|
4806 | minutesStep: propTypes_4,
|
4807 | innerRef: propTypes_8
|
4808 | } ;
|
4809 | Clock.defaultProps = {
|
4810 | ampm: false,
|
4811 | minutesStep: 1
|
4812 | };
|
4813 | var styles$4 = function styles(theme) {
|
4814 | return styles$5.createStyles({
|
4815 | container: {
|
4816 | display: 'flex',
|
4817 | justifyContent: 'center',
|
4818 | alignItems: 'flex-end',
|
4819 | margin: "".concat(theme.spacing(2), "px 0 ").concat(theme.spacing(1), "px")
|
4820 | },
|
4821 | clock: {
|
4822 | backgroundColor: 'rgba(0,0,0,.07)',
|
4823 | borderRadius: '50%',
|
4824 | height: 260,
|
4825 | width: 260,
|
4826 | position: 'relative',
|
4827 | pointerEvents: 'none'
|
4828 | },
|
4829 | squareMask: {
|
4830 | width: '100%',
|
4831 | height: '100%',
|
4832 | position: 'absolute',
|
4833 | pointerEvents: 'auto',
|
4834 | outline: 'none',
|
4835 | touchActions: 'none',
|
4836 | userSelect: 'none',
|
4837 | '&:active': {
|
4838 | cursor: 'move'
|
4839 | }
|
4840 | },
|
4841 | pin: {
|
4842 | width: 6,
|
4843 | height: 6,
|
4844 | borderRadius: '50%',
|
4845 | backgroundColor: theme.palette.primary.main,
|
4846 | position: 'absolute',
|
4847 | top: '50%',
|
4848 | left: '50%',
|
4849 | transform: 'translate(-50%, -50%)'
|
4850 | }
|
4851 | });
|
4852 | };
|
4853 | var Clock$1 = styles$5.withStyles(styles$4, {
|
4854 | name: 'MuiPickersClock'
|
4855 | })(Clock);
|
4856 |
|
4857 | var positions = {
|
4858 | 0: [0, 40],
|
4859 | 1: [55, 19.6],
|
4860 | 2: [94.4, 59.5],
|
4861 | 3: [109, 114],
|
4862 | 4: [94.4, 168.5],
|
4863 | 5: [54.5, 208.4],
|
4864 | 6: [0, 223],
|
4865 | 7: [-54.5, 208.4],
|
4866 | 8: [-94.4, 168.5],
|
4867 | 9: [-109, 114],
|
4868 | 10: [-94.4, 59.5],
|
4869 | 11: [-54.5, 19.6],
|
4870 | 12: [0, 5],
|
4871 | 13: [36.9, 49.9],
|
4872 | 14: [64, 77],
|
4873 | 15: [74, 114],
|
4874 | 16: [64, 151],
|
4875 | 17: [37, 178],
|
4876 | 18: [0, 188],
|
4877 | 19: [-37, 178],
|
4878 | 20: [-64, 151],
|
4879 | 21: [-74, 114],
|
4880 | 22: [-64, 77],
|
4881 | 23: [-37, 50]
|
4882 | };
|
4883 | var useStyles$7 = styles$5.makeStyles(function (theme) {
|
4884 | var size = theme.spacing(4);
|
4885 | return {
|
4886 | clockNumber: {
|
4887 | width: size,
|
4888 | height: 32,
|
4889 | userSelect: 'none',
|
4890 | position: 'absolute',
|
4891 | left: "calc((100% - ".concat(typeof size === 'number' ? "".concat(size, "px") : size, ") / 2)"),
|
4892 | display: 'inline-flex',
|
4893 | justifyContent: 'center',
|
4894 | alignItems: 'center',
|
4895 | borderRadius: '50%',
|
4896 | color: theme.palette.type === 'light' ? theme.palette.text.primary : theme.palette.text.hint
|
4897 | },
|
4898 | clockNumberSelected: {
|
4899 | color: theme.palette.primary.contrastText
|
4900 | }
|
4901 | };
|
4902 | }, {
|
4903 | name: 'MuiPickersClockNumber'
|
4904 | });
|
4905 | var ClockNumber = function ClockNumber(_ref) {
|
4906 | var selected = _ref.selected,
|
4907 | label = _ref.label,
|
4908 | index = _ref.index,
|
4909 | isInner = _ref.isInner;
|
4910 | var classes = useStyles$7();
|
4911 | var className = clsx(classes.clockNumber, selected && classes.clockNumberSelected);
|
4912 | var transformStyle = React.useMemo(function () {
|
4913 | var position = positions[index];
|
4914 | return {
|
4915 | transform: "translate(".concat(position[0], "px, ").concat(position[1], "px")
|
4916 | };
|
4917 | }, [index]);
|
4918 | return React.createElement(Typography, {
|
4919 | component: "span",
|
4920 | className: className,
|
4921 | variant: isInner ? 'body2' : 'body1',
|
4922 | style: transformStyle,
|
4923 | children: label
|
4924 | });
|
4925 | };
|
4926 |
|
4927 | var getHourNumbers = function getHourNumbers(_ref) {
|
4928 | var ampm = _ref.ampm,
|
4929 | utils = _ref.utils,
|
4930 | date = _ref.date;
|
4931 | var currentHours = utils.getHours(date);
|
4932 | var hourNumbers = [];
|
4933 | var startHour = ampm ? 1 : 0;
|
4934 | var endHour = ampm ? 12 : 23;
|
4935 |
|
4936 | var isSelected = function isSelected(hour) {
|
4937 | if (ampm) {
|
4938 | if (hour === 12) {
|
4939 | return currentHours === 12 || currentHours === 0;
|
4940 | }
|
4941 |
|
4942 | return currentHours === hour || currentHours - 12 === hour;
|
4943 | }
|
4944 |
|
4945 | return currentHours === hour;
|
4946 | };
|
4947 |
|
4948 | for (var hour = startHour; hour <= endHour; hour += 1) {
|
4949 | var label = hour.toString();
|
4950 |
|
4951 | if (hour === 0) {
|
4952 | label = '00';
|
4953 | }
|
4954 |
|
4955 | var props = {
|
4956 | index: hour,
|
4957 | label: utils.formatNumber(label),
|
4958 | selected: isSelected(hour),
|
4959 | isInner: !ampm && (hour === 0 || hour > 12)
|
4960 | };
|
4961 | hourNumbers.push(React.createElement(ClockNumber, _extends({
|
4962 | key: hour
|
4963 | }, props)));
|
4964 | }
|
4965 |
|
4966 | return hourNumbers;
|
4967 | };
|
4968 | var getMinutesNumbers = function getMinutesNumbers(_ref2) {
|
4969 | var value = _ref2.value,
|
4970 | utils = _ref2.utils;
|
4971 | var f = utils.formatNumber;
|
4972 | return [React.createElement(ClockNumber, {
|
4973 | label: f('00'),
|
4974 | selected: value === 0,
|
4975 | index: 12,
|
4976 | key: 12
|
4977 | }), React.createElement(ClockNumber, {
|
4978 | label: f('05'),
|
4979 | selected: value === 5,
|
4980 | index: 1,
|
4981 | key: 1
|
4982 | }), React.createElement(ClockNumber, {
|
4983 | label: f('10'),
|
4984 | selected: value === 10,
|
4985 | index: 2,
|
4986 | key: 2
|
4987 | }), React.createElement(ClockNumber, {
|
4988 | label: f('15'),
|
4989 | selected: value === 15,
|
4990 | index: 3,
|
4991 | key: 3
|
4992 | }), React.createElement(ClockNumber, {
|
4993 | label: f('20'),
|
4994 | selected: value === 20,
|
4995 | index: 4,
|
4996 | key: 4
|
4997 | }), React.createElement(ClockNumber, {
|
4998 | label: f('25'),
|
4999 | selected: value === 25,
|
5000 | index: 5,
|
5001 | key: 5
|
5002 | }), React.createElement(ClockNumber, {
|
5003 | label: f('30'),
|
5004 | selected: value === 30,
|
5005 | index: 6,
|
5006 | key: 6
|
5007 | }), React.createElement(ClockNumber, {
|
5008 | label: f('35'),
|
5009 | selected: value === 35,
|
5010 | index: 7,
|
5011 | key: 7
|
5012 | }), React.createElement(ClockNumber, {
|
5013 | label: f('40'),
|
5014 | selected: value === 40,
|
5015 | index: 8,
|
5016 | key: 8
|
5017 | }), React.createElement(ClockNumber, {
|
5018 | label: f('45'),
|
5019 | selected: value === 45,
|
5020 | index: 9,
|
5021 | key: 9
|
5022 | }), React.createElement(ClockNumber, {
|
5023 | label: f('50'),
|
5024 | selected: value === 50,
|
5025 | index: 10,
|
5026 | key: 10
|
5027 | }), React.createElement(ClockNumber, {
|
5028 | label: f('55'),
|
5029 | selected: value === 55,
|
5030 | index: 11,
|
5031 | key: 11
|
5032 | })];
|
5033 | };
|
5034 |
|
5035 | var ClockView = function ClockView(_ref) {
|
5036 | var type = _ref.type,
|
5037 | onHourChange = _ref.onHourChange,
|
5038 | onMinutesChange = _ref.onMinutesChange,
|
5039 | onSecondsChange = _ref.onSecondsChange,
|
5040 | ampm = _ref.ampm,
|
5041 | date = _ref.date,
|
5042 | minutesStep = _ref.minutesStep;
|
5043 | var utils = useUtils();
|
5044 | var viewProps = React.useMemo(function () {
|
5045 | switch (type) {
|
5046 | case ClockType$1.HOURS:
|
5047 | return {
|
5048 | value: utils.getHours(date),
|
5049 | children: getHourNumbers({
|
5050 | date: date,
|
5051 | utils: utils,
|
5052 | ampm: Boolean(ampm)
|
5053 | }),
|
5054 | onChange: function onChange(value, isFinish) {
|
5055 | var currentMeridiem = getMeridiem(date, utils);
|
5056 | var updatedTimeWithMeridiem = convertToMeridiem(utils.setHours(date, value), currentMeridiem, Boolean(ampm), utils);
|
5057 | onHourChange(updatedTimeWithMeridiem, isFinish);
|
5058 | }
|
5059 | };
|
5060 |
|
5061 | case ClockType$1.MINUTES:
|
5062 | var minutesValue = utils.getMinutes(date);
|
5063 | return {
|
5064 | value: minutesValue,
|
5065 | children: getMinutesNumbers({
|
5066 | value: minutesValue,
|
5067 | utils: utils
|
5068 | }),
|
5069 | onChange: function onChange(value, isFinish) {
|
5070 | var updatedTime = utils.setMinutes(date, value);
|
5071 | onMinutesChange(updatedTime, isFinish);
|
5072 | }
|
5073 | };
|
5074 |
|
5075 | case ClockType$1.SECONDS:
|
5076 | var secondsValue = utils.getSeconds(date);
|
5077 | return {
|
5078 | value: secondsValue,
|
5079 | children: getMinutesNumbers({
|
5080 | value: secondsValue,
|
5081 | utils: utils
|
5082 | }),
|
5083 | onChange: function onChange(value, isFinish) {
|
5084 | var updatedTime = utils.setSeconds(date, value);
|
5085 | onSecondsChange(updatedTime, isFinish);
|
5086 | }
|
5087 | };
|
5088 |
|
5089 | default:
|
5090 | throw new Error('You must provide the type for TimePickerView');
|
5091 | }
|
5092 | }, [ampm, date, onHourChange, onMinutesChange, onSecondsChange, type, utils]);
|
5093 | return React.createElement(Clock$1, _extends({
|
5094 | type: type,
|
5095 | ampm: ampm,
|
5096 | minutesStep: minutesStep
|
5097 | }, viewProps));
|
5098 | };
|
5099 | ClockView.displayName = 'TimePickerView';
|
5100 | ClockView.propTypes = {
|
5101 | date: propTypes_5.isRequired,
|
5102 | onHourChange: propTypes_3.isRequired,
|
5103 | onMinutesChange: propTypes_3.isRequired,
|
5104 | onSecondsChange: propTypes_3.isRequired,
|
5105 | ampm: propTypes_2,
|
5106 | minutesStep: propTypes_4,
|
5107 | type: propTypes_15(Object.keys(ClockType$1).map(function (key) {
|
5108 | return ClockType$1[key];
|
5109 | })).isRequired
|
5110 | } ;
|
5111 | ClockView.defaultProps = {
|
5112 | ampm: true,
|
5113 | minutesStep: 1
|
5114 | };
|
5115 | var ClockView$1 = React.memo(ClockView);
|
5116 |
|
5117 | var useStyles$8 = styles$5.makeStyles(function (theme) {
|
5118 | return {
|
5119 | root: {
|
5120 | height: 40,
|
5121 | display: 'flex',
|
5122 | alignItems: 'center',
|
5123 | justifyContent: 'center',
|
5124 | cursor: 'pointer',
|
5125 | outline: 'none',
|
5126 | '&:focus': {
|
5127 | color: theme.palette.primary.main,
|
5128 | fontWeight: theme.typography.fontWeightMedium
|
5129 | }
|
5130 | },
|
5131 | yearSelected: {
|
5132 | margin: '10px 0',
|
5133 | fontWeight: theme.typography.fontWeightMedium
|
5134 | },
|
5135 | yearDisabled: {
|
5136 | pointerEvents: 'none',
|
5137 | color: theme.palette.text.hint
|
5138 | }
|
5139 | };
|
5140 | }, {
|
5141 | name: 'MuiPickersYear'
|
5142 | });
|
5143 | var Year = function Year(_ref) {
|
5144 | var onSelect = _ref.onSelect,
|
5145 | forwardedRef = _ref.forwardedRef,
|
5146 | value = _ref.value,
|
5147 | selected = _ref.selected,
|
5148 | disabled = _ref.disabled,
|
5149 | children = _ref.children,
|
5150 | other = _objectWithoutProperties(_ref, ["onSelect", "forwardedRef", "value", "selected", "disabled", "children"]);
|
5151 |
|
5152 | var classes = useStyles$8();
|
5153 | var handleClick = React.useCallback(function () {
|
5154 | return onSelect(value);
|
5155 | }, [onSelect, value]);
|
5156 | return React.createElement(Typography, _extends({
|
5157 | role: "button",
|
5158 | component: "div",
|
5159 | tabIndex: disabled ? -1 : 0,
|
5160 | onClick: handleClick,
|
5161 | onKeyPress: handleClick,
|
5162 | color: selected ? 'primary' : undefined,
|
5163 | variant: selected ? 'h5' : 'subtitle1',
|
5164 | children: children,
|
5165 | ref: forwardedRef,
|
5166 | className: clsx(classes.root, selected && classes.yearSelected, disabled && classes.yearDisabled)
|
5167 | }, other));
|
5168 | };
|
5169 | Year.displayName = 'Year';
|
5170 | var Year$1 = React.forwardRef(function (props, ref) {
|
5171 | return React.createElement(Year, _extends({}, props, {
|
5172 | forwardedRef: ref
|
5173 | }));
|
5174 | });
|
5175 |
|
5176 | var useStyles$9 = styles$5.makeStyles({
|
5177 | container: {
|
5178 | height: 300,
|
5179 | overflowY: 'auto'
|
5180 | }
|
5181 | }, {
|
5182 | name: 'MuiPickersYearSelection'
|
5183 | });
|
5184 | var YearSelection = function YearSelection(_ref) {
|
5185 | var date = _ref.date,
|
5186 | onChange = _ref.onChange,
|
5187 | onYearChange = _ref.onYearChange,
|
5188 | minDate = _ref.minDate,
|
5189 | maxDate = _ref.maxDate,
|
5190 | disablePast = _ref.disablePast,
|
5191 | disableFuture = _ref.disableFuture,
|
5192 | animateYearScrolling = _ref.animateYearScrolling;
|
5193 | var utils = useUtils();
|
5194 | var classes = useStyles$9();
|
5195 | var currentVariant = React.useContext(VariantContext);
|
5196 | var selectedYearRef = React.useRef(null);
|
5197 | React.useEffect(function () {
|
5198 | if (selectedYearRef.current && selectedYearRef.current.scrollIntoView) {
|
5199 | try {
|
5200 | selectedYearRef.current.scrollIntoView({
|
5201 | block: currentVariant === 'static' ? 'nearest' : 'center',
|
5202 | behavior: animateYearScrolling ? 'smooth' : 'auto'
|
5203 | });
|
5204 | } catch (e) {
|
5205 |
|
5206 | selectedYearRef.current.scrollIntoView();
|
5207 | }
|
5208 | }
|
5209 | }, []);
|
5210 |
|
5211 | var currentYear = utils.getYear(date);
|
5212 | var onYearSelect = React.useCallback(function (year) {
|
5213 | var newDate = utils.setYear(date, year);
|
5214 |
|
5215 | if (onYearChange) {
|
5216 | onYearChange(newDate);
|
5217 | }
|
5218 |
|
5219 | onChange(newDate, true);
|
5220 | }, [date, onChange, onYearChange, utils]);
|
5221 | return React.createElement("div", {
|
5222 | className: classes.container
|
5223 | }, utils.getYearRange(minDate, maxDate).map(function (year) {
|
5224 | var yearNumber = utils.getYear(year);
|
5225 | var selected = yearNumber === currentYear;
|
5226 | return React.createElement(Year$1, {
|
5227 | key: utils.getYearText(year),
|
5228 | selected: selected,
|
5229 | value: yearNumber,
|
5230 | onSelect: onYearSelect,
|
5231 | ref: selected ? selectedYearRef : undefined,
|
5232 | disabled: Boolean(disablePast && utils.isBeforeYear(year, utils.date()) || disableFuture && utils.isAfterYear(year, utils.date()))
|
5233 | }, utils.getYearText(year));
|
5234 | }));
|
5235 | };
|
5236 |
|
5237 | var useStyles$a = styles$5.makeStyles(function (theme) {
|
5238 | return {
|
5239 | root: {
|
5240 | flex: '1 0 33.33%',
|
5241 | display: 'flex',
|
5242 | alignItems: 'center',
|
5243 | justifyContent: 'center',
|
5244 | cursor: 'pointer',
|
5245 | outline: 'none',
|
5246 | height: 75,
|
5247 | transition: theme.transitions.create('font-size', {
|
5248 | duration: '100ms'
|
5249 | }),
|
5250 | '&:focus': {
|
5251 | color: theme.palette.primary.main,
|
5252 | fontWeight: theme.typography.fontWeightMedium
|
5253 | }
|
5254 | },
|
5255 | monthSelected: {
|
5256 | color: theme.palette.primary.main,
|
5257 | fontWeight: theme.typography.fontWeightMedium
|
5258 | },
|
5259 | monthDisabled: {
|
5260 | pointerEvents: 'none',
|
5261 | color: theme.palette.text.hint
|
5262 | }
|
5263 | };
|
5264 | }, {
|
5265 | name: 'MuiPickersMonth'
|
5266 | });
|
5267 | var Month = function Month(_ref) {
|
5268 | var selected = _ref.selected,
|
5269 | onSelect = _ref.onSelect,
|
5270 | disabled = _ref.disabled,
|
5271 | value = _ref.value,
|
5272 | children = _ref.children,
|
5273 | other = _objectWithoutProperties(_ref, ["selected", "onSelect", "disabled", "value", "children"]);
|
5274 |
|
5275 | var classes = useStyles$a();
|
5276 | var handleSelection = React.useCallback(function () {
|
5277 | onSelect(value);
|
5278 | }, [onSelect, value]);
|
5279 | return React.createElement(Typography, _extends({
|
5280 | role: "button",
|
5281 | component: "div",
|
5282 | className: clsx(classes.root, selected && classes.monthSelected, disabled && classes.monthDisabled),
|
5283 | tabIndex: disabled ? -1 : 0,
|
5284 | onClick: handleSelection,
|
5285 | onKeyPress: handleSelection,
|
5286 | color: selected ? 'primary' : undefined,
|
5287 | variant: selected ? 'h5' : 'subtitle1',
|
5288 | children: children
|
5289 | }, other));
|
5290 | };
|
5291 | Month.displayName = 'Month';
|
5292 |
|
5293 | var useStyles$b = styles$5.makeStyles({
|
5294 | container: {
|
5295 | width: 310,
|
5296 | display: 'flex',
|
5297 | flexWrap: 'wrap',
|
5298 | alignContent: 'stretch'
|
5299 | }
|
5300 | }, {
|
5301 | name: 'MuiPickersMonthSelection'
|
5302 | });
|
5303 | var MonthSelection = function MonthSelection(_ref) {
|
5304 | var disablePast = _ref.disablePast,
|
5305 | disableFuture = _ref.disableFuture,
|
5306 | minDate = _ref.minDate,
|
5307 | maxDate = _ref.maxDate,
|
5308 | date = _ref.date,
|
5309 | onMonthChange = _ref.onMonthChange,
|
5310 | onChange = _ref.onChange;
|
5311 | var utils = useUtils();
|
5312 | var classes = useStyles$b();
|
5313 | var currentMonth = utils.getMonth(date);
|
5314 |
|
5315 | var shouldDisableMonth = function shouldDisableMonth(month) {
|
5316 | var now = utils.date();
|
5317 | var utilMinDate = utils.date(minDate);
|
5318 | var utilMaxDate = utils.date(maxDate);
|
5319 | var firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now, utilMinDate) ? now : utilMinDate);
|
5320 | var lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now, utilMaxDate) ? now : utilMaxDate);
|
5321 | var isBeforeFirstEnabled = utils.isBefore(month, firstEnabledMonth);
|
5322 | var isAfterLastEnabled = utils.isAfter(month, lastEnabledMonth);
|
5323 | return isBeforeFirstEnabled || isAfterLastEnabled;
|
5324 | };
|
5325 |
|
5326 | var onMonthSelect = React.useCallback(function (month) {
|
5327 | var newDate = utils.setMonth(date, month);
|
5328 | onChange(newDate, true);
|
5329 |
|
5330 | if (onMonthChange) {
|
5331 | onMonthChange(newDate);
|
5332 | }
|
5333 | }, [date, onChange, onMonthChange, utils]);
|
5334 | return React.createElement("div", {
|
5335 | className: classes.container
|
5336 | }, utils.getMonthArray(date).map(function (month) {
|
5337 | var monthNumber = utils.getMonth(month);
|
5338 | var monthText = utils.format(month, 'MMM');
|
5339 | return React.createElement(Month, {
|
5340 | key: monthText,
|
5341 | value: monthNumber,
|
5342 | selected: monthNumber === currentMonth,
|
5343 | onSelect: onMonthSelect,
|
5344 | disabled: shouldDisableMonth(month)
|
5345 | }, monthText);
|
5346 | }));
|
5347 | };
|
5348 |
|
5349 | var getOrientation = function getOrientation() {
|
5350 | if (typeof window === 'undefined') {
|
5351 | return 'portrait';
|
5352 | }
|
5353 |
|
5354 | if (window.screen && window.screen.orientation && window.screen.orientation.angle) {
|
5355 | return Math.abs(window.screen.orientation.angle) === 90 ? 'landscape' : 'portrait';
|
5356 | }
|
5357 |
|
5358 |
|
5359 | if (window.orientation) {
|
5360 | return Math.abs(Number(window.orientation)) === 90 ? 'landscape' : 'portrait';
|
5361 | }
|
5362 |
|
5363 | return 'portrait';
|
5364 | };
|
5365 |
|
5366 | function useIsLandscape(customOrientation) {
|
5367 | var _React$useState = React.useState(getOrientation()),
|
5368 | _React$useState2 = _slicedToArray(_React$useState, 2),
|
5369 | orientation = _React$useState2[0],
|
5370 | setOrientation = _React$useState2[1];
|
5371 |
|
5372 | var eventHandler = React.useCallback(function () {
|
5373 | return setOrientation(getOrientation());
|
5374 | }, []);
|
5375 | useIsomorphicEffect(function () {
|
5376 | window.addEventListener('orientationchange', eventHandler);
|
5377 | return function () {
|
5378 | return window.removeEventListener('orientationchange', eventHandler);
|
5379 | };
|
5380 | }, [eventHandler]);
|
5381 | var orientationToUse = customOrientation || orientation;
|
5382 | return orientationToUse === 'landscape';
|
5383 | }
|
5384 |
|
5385 | function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
5386 |
|
5387 | function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
5388 | var viewsMap = {
|
5389 | year: YearSelection,
|
5390 | month: MonthSelection,
|
5391 | date: Calendar$1,
|
5392 | hours: ClockView,
|
5393 | minutes: ClockView,
|
5394 | seconds: ClockView
|
5395 | };
|
5396 | var useStyles$c = styles$5.makeStyles({
|
5397 | container: {
|
5398 | display: 'flex',
|
5399 | flexDirection: 'column'
|
5400 | },
|
5401 | containerLandscape: {
|
5402 | flexDirection: 'row'
|
5403 | },
|
5404 | pickerView: {
|
5405 | overflowX: 'hidden',
|
5406 | minHeight: VIEW_HEIGHT,
|
5407 | minWidth: DIALOG_WIDTH,
|
5408 | maxWidth: DIALOG_WIDTH_WIDER,
|
5409 | display: 'flex',
|
5410 | flexDirection: 'column',
|
5411 | justifyContent: 'center'
|
5412 | },
|
5413 | pickerViewLandscape: {
|
5414 | padding: '0 8px'
|
5415 | }
|
5416 | }, {
|
5417 | name: 'MuiPickersBasePicker'
|
5418 | });
|
5419 | var Picker = function Picker(_ref) {
|
5420 | var date = _ref.date,
|
5421 | views = _ref.views,
|
5422 | disableToolbar = _ref.disableToolbar,
|
5423 | onChange = _ref.onChange,
|
5424 | openTo = _ref.openTo,
|
5425 | unparsedMinDate = _ref.minDate,
|
5426 | unparsedMaxDate = _ref.maxDate,
|
5427 | ToolbarComponent = _ref.ToolbarComponent,
|
5428 | orientation = _ref.orientation,
|
5429 | rest = _objectWithoutProperties(_ref, ["date", "views", "disableToolbar", "onChange", "openTo", "minDate", "maxDate", "ToolbarComponent", "orientation"]);
|
5430 |
|
5431 | var utils = useUtils();
|
5432 | var classes = useStyles$c();
|
5433 | var isLandscape = useIsLandscape(orientation);
|
5434 |
|
5435 | var _useViews = useViews(views, openTo, onChange),
|
5436 | openView = _useViews.openView,
|
5437 | setOpenView = _useViews.setOpenView,
|
5438 | handleChangeAndOpenNext = _useViews.handleChangeAndOpenNext;
|
5439 |
|
5440 | var minDate = React.useMemo(function () {
|
5441 | return utils.date(unparsedMinDate);
|
5442 | }, [unparsedMinDate, utils]);
|
5443 | var maxDate = React.useMemo(function () {
|
5444 | return utils.date(unparsedMaxDate);
|
5445 | }, [unparsedMaxDate, utils]);
|
5446 | return React.createElement("div", {
|
5447 | className: clsx(classes.container, isLandscape && classes.containerLandscape)
|
5448 | }, !disableToolbar && React.createElement(ToolbarComponent, _extends({}, rest, {
|
5449 | views: views,
|
5450 | isLandscape: isLandscape,
|
5451 | date: date,
|
5452 | onChange: onChange,
|
5453 | setOpenView: setOpenView,
|
5454 | openView: openView
|
5455 | })), React.createElement("div", {
|
5456 | className: clsx(classes.pickerView, isLandscape && classes.pickerViewLandscape)
|
5457 | }, openView === 'year' && React.createElement(YearSelection, _extends({}, rest, {
|
5458 | date: date,
|
5459 | onChange: handleChangeAndOpenNext,
|
5460 | minDate: minDate,
|
5461 | maxDate: maxDate
|
5462 | })), openView === 'month' && React.createElement(MonthSelection, _extends({}, rest, {
|
5463 | date: date,
|
5464 | onChange: handleChangeAndOpenNext,
|
5465 | minDate: minDate,
|
5466 | maxDate: maxDate
|
5467 | })), openView === 'date' && React.createElement(Calendar$1, _extends({}, rest, {
|
5468 | date: date,
|
5469 | onChange: handleChangeAndOpenNext,
|
5470 | minDate: minDate,
|
5471 | maxDate: maxDate
|
5472 | })), (openView === 'hours' || openView === 'minutes' || openView === 'seconds') && React.createElement(ClockView, _extends({}, rest, {
|
5473 | date: date,
|
5474 | type: openView,
|
5475 | onHourChange: handleChangeAndOpenNext,
|
5476 | onMinutesChange: handleChangeAndOpenNext,
|
5477 | onSecondsChange: handleChangeAndOpenNext
|
5478 | }))));
|
5479 | };
|
5480 | Picker.defaultProps = _objectSpread$4({}, datePickerDefaultProps, {
|
5481 | views: Object.keys(viewsMap)
|
5482 | });
|
5483 |
|
5484 | function makePickerWithState(_ref) {
|
5485 | var Input = _ref.Input,
|
5486 | useState = _ref.useState,
|
5487 | useOptions = _ref.useOptions,
|
5488 | getCustomProps = _ref.getCustomProps,
|
5489 | DefaultToolbarComponent = _ref.DefaultToolbarComponent;
|
5490 |
|
5491 | function PickerWithState(props) {
|
5492 | var allowKeyboardControl = props.allowKeyboardControl,
|
5493 | ampm = props.ampm,
|
5494 | animateYearScrolling = props.animateYearScrolling,
|
5495 | autoOk = props.autoOk,
|
5496 | dateRangeIcon = props.dateRangeIcon,
|
5497 | disableFuture = props.disableFuture,
|
5498 | disablePast = props.disablePast,
|
5499 | disableToolbar = props.disableToolbar,
|
5500 | emptyLabel = props.emptyLabel,
|
5501 | format = props.format,
|
5502 | forwardedRef = props.forwardedRef,
|
5503 | hideTabs = props.hideTabs,
|
5504 | initialFocusedDate = props.initialFocusedDate,
|
5505 | invalidDateMessage = props.invalidDateMessage,
|
5506 | invalidLabel = props.invalidLabel,
|
5507 | labelFunc = props.labelFunc,
|
5508 | leftArrowButtonProps = props.leftArrowButtonProps,
|
5509 | leftArrowIcon = props.leftArrowIcon,
|
5510 | loadingIndicator = props.loadingIndicator,
|
5511 | maxDate = props.maxDate,
|
5512 | maxDateMessage = props.maxDateMessage,
|
5513 | minDate = props.minDate,
|
5514 | minDateMessage = props.minDateMessage,
|
5515 | minutesStep = props.minutesStep,
|
5516 | onAccept = props.onAccept,
|
5517 | onChange = props.onChange,
|
5518 | onClose = props.onClose,
|
5519 | onMonthChange = props.onMonthChange,
|
5520 | onOpen = props.onOpen,
|
5521 | onYearChange = props.onYearChange,
|
5522 | openTo = props.openTo,
|
5523 | orientation = props.orientation,
|
5524 | renderDay = props.renderDay,
|
5525 | rightArrowButtonProps = props.rightArrowButtonProps,
|
5526 | rightArrowIcon = props.rightArrowIcon,
|
5527 | shouldDisableDate = props.shouldDisableDate,
|
5528 | strictCompareDates = props.strictCompareDates,
|
5529 | timeIcon = props.timeIcon,
|
5530 | _props$ToolbarCompone = props.ToolbarComponent,
|
5531 | ToolbarComponent = _props$ToolbarCompone === void 0 ? DefaultToolbarComponent : _props$ToolbarCompone,
|
5532 | value = props.value,
|
5533 | variant = props.variant,
|
5534 | views = props.views,
|
5535 | other = _objectWithoutProperties(props, ["allowKeyboardControl", "ampm", "animateYearScrolling", "autoOk", "dateRangeIcon", "disableFuture", "disablePast", "disableToolbar", "emptyLabel", "format", "forwardedRef", "hideTabs", "initialFocusedDate", "invalidDateMessage", "invalidLabel", "labelFunc", "leftArrowButtonProps", "leftArrowIcon", "loadingIndicator", "maxDate", "maxDateMessage", "minDate", "minDateMessage", "minutesStep", "onAccept", "onChange", "onClose", "onMonthChange", "onOpen", "onYearChange", "openTo", "orientation", "renderDay", "rightArrowButtonProps", "rightArrowIcon", "shouldDisableDate", "strictCompareDates", "timeIcon", "ToolbarComponent", "value", "variant", "views"]);
|
5536 |
|
5537 | var injectedProps = getCustomProps ? getCustomProps(props) : {};
|
5538 | var options = useOptions(props);
|
5539 |
|
5540 | var _useState = useState(props, options),
|
5541 | pickerProps = _useState.pickerProps,
|
5542 | inputProps = _useState.inputProps,
|
5543 | wrapperProps = _useState.wrapperProps;
|
5544 |
|
5545 | return React.createElement(Wrapper, _extends({
|
5546 | variant: variant,
|
5547 | InputComponent: Input,
|
5548 | DateInputProps: inputProps
|
5549 | }, injectedProps, wrapperProps, other), React.createElement(Picker, _extends({}, pickerProps, {
|
5550 | allowKeyboardControl: allowKeyboardControl,
|
5551 | ampm: ampm,
|
5552 | animateYearScrolling: animateYearScrolling,
|
5553 | dateRangeIcon: dateRangeIcon,
|
5554 | disableFuture: disableFuture,
|
5555 | disablePast: disablePast,
|
5556 | disableToolbar: disableToolbar,
|
5557 | hideTabs: hideTabs,
|
5558 | leftArrowButtonProps: leftArrowButtonProps,
|
5559 | leftArrowIcon: leftArrowIcon,
|
5560 | loadingIndicator: loadingIndicator,
|
5561 | maxDate: maxDate,
|
5562 | minDate: minDate,
|
5563 | minutesStep: minutesStep,
|
5564 | onMonthChange: onMonthChange,
|
5565 | onYearChange: onYearChange,
|
5566 | openTo: openTo,
|
5567 | orientation: orientation,
|
5568 | renderDay: renderDay,
|
5569 | rightArrowButtonProps: rightArrowButtonProps,
|
5570 | rightArrowIcon: rightArrowIcon,
|
5571 | shouldDisableDate: shouldDisableDate,
|
5572 | strictCompareDates: strictCompareDates,
|
5573 | timeIcon: timeIcon,
|
5574 | ToolbarComponent: ToolbarComponent,
|
5575 | views: views
|
5576 | })));
|
5577 | }
|
5578 |
|
5579 | return PickerWithState;
|
5580 | }
|
5581 |
|
5582 | function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
5583 |
|
5584 | function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
5585 |
|
5586 | var defaultProps$1 = _objectSpread$5({}, datePickerDefaultProps, {
|
5587 | openTo: 'date',
|
5588 | views: ['year', 'date']
|
5589 | });
|
5590 |
|
5591 | function useOptions(props) {
|
5592 | var utils = useUtils();
|
5593 | return {
|
5594 | getDefaultFormat: function getDefaultFormat() {
|
5595 | return getFormatByViews(props.views, utils);
|
5596 | }
|
5597 | };
|
5598 | }
|
5599 |
|
5600 | var DatePicker = makePickerWithState({
|
5601 | useOptions: useOptions,
|
5602 | Input: PureDateInput,
|
5603 | useState: usePickerState,
|
5604 | DefaultToolbarComponent: DatePickerToolbar
|
5605 | });
|
5606 | var KeyboardDatePicker = makePickerWithState({
|
5607 | useOptions: useOptions,
|
5608 | Input: KeyboardDateInput,
|
5609 | useState: useKeyboardPickerState,
|
5610 | DefaultToolbarComponent: DatePickerToolbar
|
5611 | });
|
5612 | DatePicker.defaultProps = defaultProps$1;
|
5613 | KeyboardDatePicker.defaultProps = defaultProps$1;
|
5614 |
|
5615 | var useStyles$d = styles$5.makeStyles({
|
5616 | toolbarLandscape: {
|
5617 | flexWrap: 'wrap'
|
5618 | },
|
5619 | toolbarAmpmLeftPadding: {
|
5620 | paddingLeft: 50
|
5621 | },
|
5622 | separator: {
|
5623 | margin: '0 4px 0 2px',
|
5624 | cursor: 'default'
|
5625 | },
|
5626 | hourMinuteLabel: {
|
5627 | display: 'flex',
|
5628 | justifyContent: 'flex-end',
|
5629 | alignItems: 'flex-end'
|
5630 | },
|
5631 | hourMinuteLabelAmpmLandscape: {
|
5632 | marginTop: 'auto'
|
5633 | },
|
5634 | hourMinuteLabelReverse: {
|
5635 | flexDirection: 'row-reverse'
|
5636 | },
|
5637 | ampmSelection: {
|
5638 | marginLeft: 20,
|
5639 | marginRight: -20,
|
5640 | display: 'flex',
|
5641 | flexDirection: 'column'
|
5642 | },
|
5643 | ampmLandscape: {
|
5644 | margin: '4px 0 auto',
|
5645 | flexDirection: 'row',
|
5646 | justifyContent: 'space-around',
|
5647 | flexBasis: '100%'
|
5648 | },
|
5649 | ampmSelectionWithSeconds: {
|
5650 | marginLeft: 15,
|
5651 | marginRight: 10
|
5652 | },
|
5653 | ampmLabel: {
|
5654 | fontSize: 18
|
5655 | }
|
5656 | }, {
|
5657 | name: 'MuiPickersTimePickerToolbar'
|
5658 | });
|
5659 | function useMeridiemMode(date, ampm, onChange) {
|
5660 | var utils = useUtils();
|
5661 | var meridiemMode = getMeridiem(date, utils);
|
5662 | var handleMeridiemChange = React.useCallback(function (mode) {
|
5663 | var timeWithMeridiem = convertToMeridiem(date, mode, Boolean(ampm), utils);
|
5664 | onChange(timeWithMeridiem, false);
|
5665 | }, [ampm, date, onChange, utils]);
|
5666 | return {
|
5667 | meridiemMode: meridiemMode,
|
5668 | handleMeridiemChange: handleMeridiemChange
|
5669 | };
|
5670 | }
|
5671 | var TimePickerToolbar = function TimePickerToolbar(_ref) {
|
5672 | var date = _ref.date,
|
5673 | views = _ref.views,
|
5674 | ampm = _ref.ampm,
|
5675 | openView = _ref.openView,
|
5676 | onChange = _ref.onChange,
|
5677 | isLandscape = _ref.isLandscape,
|
5678 | setOpenView = _ref.setOpenView;
|
5679 | var utils = useUtils();
|
5680 | var theme = styles$5.useTheme();
|
5681 | var classes = useStyles$d();
|
5682 |
|
5683 | var _useMeridiemMode = useMeridiemMode(date, ampm, onChange),
|
5684 | meridiemMode = _useMeridiemMode.meridiemMode,
|
5685 | handleMeridiemChange = _useMeridiemMode.handleMeridiemChange;
|
5686 |
|
5687 | var clockTypographyVariant = isLandscape ? 'h3' : 'h2';
|
5688 | return React.createElement(PickerToolbar, {
|
5689 | isLandscape: isLandscape,
|
5690 | className: clsx(isLandscape ? classes.toolbarLandscape : ampm && classes.toolbarAmpmLeftPadding)
|
5691 | }, React.createElement("div", {
|
5692 | className: clsx(classes.hourMinuteLabel, ampm && isLandscape && classes.hourMinuteLabelAmpmLandscape, {
|
5693 | rtl: classes.hourMinuteLabelReverse
|
5694 | }[theme.direction])
|
5695 | }, arrayIncludes(views, 'hours') && React.createElement(ToolbarButton$1, {
|
5696 | variant: clockTypographyVariant,
|
5697 | onClick: function onClick() {
|
5698 | return setOpenView(ClockType$1.HOURS);
|
5699 | },
|
5700 | selected: openView === ClockType$1.HOURS,
|
5701 | label: utils.getHourText(date, Boolean(ampm))
|
5702 | }), arrayIncludes(views, ['hours', 'minutes']) && React.createElement(ToolbarText, {
|
5703 | label: ":",
|
5704 | variant: clockTypographyVariant,
|
5705 | selected: false,
|
5706 | className: classes.separator
|
5707 | }), arrayIncludes(views, 'minutes') && React.createElement(ToolbarButton$1, {
|
5708 | variant: clockTypographyVariant,
|
5709 | onClick: function onClick() {
|
5710 | return setOpenView(ClockType$1.MINUTES);
|
5711 | },
|
5712 | selected: openView === ClockType$1.MINUTES,
|
5713 | label: utils.getMinuteText(date)
|
5714 | }), arrayIncludes(views, ['minutes', 'seconds']) && React.createElement(ToolbarText, {
|
5715 | variant: "h2",
|
5716 | label: ":",
|
5717 | selected: false,
|
5718 | className: classes.separator
|
5719 | }), arrayIncludes(views, 'seconds') && React.createElement(ToolbarButton$1, {
|
5720 | variant: "h2",
|
5721 | onClick: function onClick() {
|
5722 | return setOpenView(ClockType$1.SECONDS);
|
5723 | },
|
5724 | selected: openView === ClockType$1.SECONDS,
|
5725 | label: utils.getSecondText(date)
|
5726 | })), ampm && React.createElement("div", {
|
5727 | className: clsx(classes.ampmSelection, isLandscape && classes.ampmLandscape, arrayIncludes(views, 'seconds') && classes.ampmSelectionWithSeconds)
|
5728 | }, React.createElement(ToolbarButton$1, {
|
5729 | disableRipple: true,
|
5730 | variant: "subtitle1",
|
5731 | selected: meridiemMode === 'am',
|
5732 | typographyClassName: classes.ampmLabel,
|
5733 | label: utils.getMeridiemText('am'),
|
5734 | onClick: function onClick() {
|
5735 | return handleMeridiemChange('am');
|
5736 | }
|
5737 | }), React.createElement(ToolbarButton$1, {
|
5738 | disableRipple: true,
|
5739 | variant: "subtitle1",
|
5740 | selected: meridiemMode === 'pm',
|
5741 | typographyClassName: classes.ampmLabel,
|
5742 | label: utils.getMeridiemText('pm'),
|
5743 | onClick: function onClick() {
|
5744 | return handleMeridiemChange('pm');
|
5745 | }
|
5746 | })));
|
5747 | };
|
5748 |
|
5749 | function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
5750 |
|
5751 | function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
5752 |
|
5753 | var defaultProps$2 = _objectSpread$6({}, timePickerDefaultProps, {
|
5754 | openTo: 'hours',
|
5755 | views: ['hours', 'minutes']
|
5756 | });
|
5757 |
|
5758 | function useOptions$1(props) {
|
5759 | var utils = useUtils();
|
5760 | return {
|
5761 | getDefaultFormat: function getDefaultFormat() {
|
5762 | return pick12hOr24hFormat(props.format, props.ampm, {
|
5763 | '12h': utils.time12hFormat,
|
5764 | '24h': utils.time24hFormat
|
5765 | });
|
5766 | }
|
5767 | };
|
5768 | }
|
5769 |
|
5770 | var TimePicker = makePickerWithState({
|
5771 | useOptions: useOptions$1,
|
5772 | Input: PureDateInput,
|
5773 | useState: usePickerState,
|
5774 | DefaultToolbarComponent: TimePickerToolbar
|
5775 | });
|
5776 | var KeyboardTimePicker = makePickerWithState({
|
5777 | useOptions: useOptions$1,
|
5778 | Input: KeyboardDateInput,
|
5779 | useState: useKeyboardPickerState,
|
5780 | DefaultToolbarComponent: TimePickerToolbar,
|
5781 | getCustomProps: function getCustomProps(props) {
|
5782 | return {
|
5783 | refuse: props.ampm ? /[^\dap]+/gi : /[^\d]+/gi
|
5784 | };
|
5785 | }
|
5786 | });
|
5787 | TimePicker.defaultProps = defaultProps$2;
|
5788 | KeyboardTimePicker.defaultProps = defaultProps$2;
|
5789 |
|
5790 | var TimeIcon = function TimeIcon(props) {
|
5791 | return React__default.createElement(SvgIcon, props, React__default.createElement("path", {
|
5792 | d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
5793 | }), React__default.createElement("path", {
|
5794 | fill: "none",
|
5795 | d: "M0 0h24v24H0z"
|
5796 | }), React__default.createElement("path", {
|
5797 | d: "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"
|
5798 | }));
|
5799 | };
|
5800 |
|
5801 | var DateRangeIcon = function DateRangeIcon(props) {
|
5802 | return React__default.createElement(SvgIcon, props, React__default.createElement("path", {
|
5803 | d: "M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"
|
5804 | }), React__default.createElement("path", {
|
5805 | fill: "none",
|
5806 | d: "M0 0h24v24H0z"
|
5807 | }));
|
5808 | };
|
5809 |
|
5810 | var viewToTabIndex = function viewToTabIndex(openView) {
|
5811 | if (openView === 'date' || openView === 'year') {
|
5812 | return 'date';
|
5813 | }
|
5814 |
|
5815 | return 'time';
|
5816 | };
|
5817 |
|
5818 | var tabIndexToView = function tabIndexToView(tab) {
|
5819 | if (tab === 'date') {
|
5820 | return 'date';
|
5821 | }
|
5822 |
|
5823 | return 'hours';
|
5824 | };
|
5825 |
|
5826 | var useStyles$e = styles$5.makeStyles(function (theme) {
|
5827 |
|
5828 | var tabsBackground = theme.palette.type === 'light' ? theme.palette.primary.main : theme.palette.background["default"];
|
5829 | return {
|
5830 | tabs: {
|
5831 | color: theme.palette.getContrastText(tabsBackground),
|
5832 | backgroundColor: tabsBackground
|
5833 | }
|
5834 | };
|
5835 | }, {
|
5836 | name: 'MuiPickerDTTabs'
|
5837 | });
|
5838 | var DateTimePickerTabs = function DateTimePickerTabs(_ref) {
|
5839 | var view = _ref.view,
|
5840 | onChange = _ref.onChange,
|
5841 | dateRangeIcon = _ref.dateRangeIcon,
|
5842 | timeIcon = _ref.timeIcon;
|
5843 | var classes = useStyles$e();
|
5844 | var theme = styles$5.useTheme();
|
5845 | var indicatorColor = theme.palette.type === 'light' ? 'secondary' : 'primary';
|
5846 |
|
5847 | var handleChange = function handleChange(e, value) {
|
5848 | if (value !== viewToTabIndex(view)) {
|
5849 | onChange(tabIndexToView(value));
|
5850 | }
|
5851 | };
|
5852 |
|
5853 | return React.createElement(Paper, null, React.createElement(Tabs, {
|
5854 | variant: "fullWidth",
|
5855 | value: viewToTabIndex(view),
|
5856 | onChange: handleChange,
|
5857 | className: classes.tabs,
|
5858 | indicatorColor: indicatorColor
|
5859 | }, React.createElement(Tab, {
|
5860 | value: "date",
|
5861 | icon: React.createElement(React.Fragment, null, dateRangeIcon)
|
5862 | }), React.createElement(Tab, {
|
5863 | value: "time",
|
5864 | icon: React.createElement(React.Fragment, null, timeIcon)
|
5865 | })));
|
5866 | };
|
5867 | DateTimePickerTabs.defaultProps = {
|
5868 | dateRangeIcon: React.createElement(DateRangeIcon, null),
|
5869 | timeIcon: React.createElement(TimeIcon, null)
|
5870 | };
|
5871 |
|
5872 | var useStyles$f = styles$5.makeStyles(function (_) {
|
5873 | return {
|
5874 | toolbar: {
|
5875 | paddingLeft: 16,
|
5876 | paddingRight: 16,
|
5877 | justifyContent: 'space-around'
|
5878 | },
|
5879 | separator: {
|
5880 | margin: '0 4px 0 2px',
|
5881 | cursor: 'default'
|
5882 | }
|
5883 | };
|
5884 | }, {
|
5885 | name: 'MuiPickerDTToolbar'
|
5886 | });
|
5887 | var DateTimePickerToolbar = function DateTimePickerToolbar(_ref) {
|
5888 | var date = _ref.date,
|
5889 | openView = _ref.openView,
|
5890 | setOpenView = _ref.setOpenView,
|
5891 | ampm = _ref.ampm,
|
5892 | hideTabs = _ref.hideTabs,
|
5893 | dateRangeIcon = _ref.dateRangeIcon,
|
5894 | timeIcon = _ref.timeIcon,
|
5895 | onChange = _ref.onChange;
|
5896 | var utils = useUtils();
|
5897 | var classes = useStyles$f();
|
5898 | var showTabs = !hideTabs && typeof window !== 'undefined' && window.innerHeight > 667;
|
5899 |
|
5900 | var _useMeridiemMode = useMeridiemMode(date, ampm, onChange),
|
5901 | meridiemMode = _useMeridiemMode.meridiemMode,
|
5902 | handleMeridiemChange = _useMeridiemMode.handleMeridiemChange;
|
5903 |
|
5904 | var theme = styles$5.useTheme();
|
5905 | var rtl = theme.direction === 'rtl';
|
5906 | return React.createElement(React.Fragment, null, React.createElement(PickerToolbar, {
|
5907 | isLandscape: false,
|
5908 | className: classes.toolbar
|
5909 | }, React.createElement(Grid, {
|
5910 | container: true,
|
5911 | justify: "center",
|
5912 | wrap: "nowrap"
|
5913 | }, React.createElement(Grid, {
|
5914 | item: true,
|
5915 | container: true,
|
5916 | xs: 5,
|
5917 | justify: "flex-start",
|
5918 | direction: "column"
|
5919 | }, React.createElement("div", null, React.createElement(ToolbarButton$1, {
|
5920 | variant: "subtitle1",
|
5921 | onClick: function onClick() {
|
5922 | return setOpenView('year');
|
5923 | },
|
5924 | selected: openView === 'year',
|
5925 | label: utils.getYearText(date)
|
5926 | })), React.createElement("div", null, React.createElement(ToolbarButton$1, {
|
5927 | variant: "h4",
|
5928 | onClick: function onClick() {
|
5929 | return setOpenView('date');
|
5930 | },
|
5931 | selected: openView === 'date',
|
5932 | label: utils.getDateTimePickerHeaderText(date)
|
5933 | }))), React.createElement(Grid, {
|
5934 | item: true,
|
5935 | container: true,
|
5936 | xs: 6,
|
5937 | justify: "center",
|
5938 | alignItems: "flex-end",
|
5939 | direction: rtl ? 'row-reverse' : 'row'
|
5940 | }, React.createElement(ToolbarButton$1, {
|
5941 | variant: "h3",
|
5942 | onClick: function onClick() {
|
5943 | return setOpenView('hours');
|
5944 | },
|
5945 | selected: openView === 'hours',
|
5946 | label: utils.getHourText(date, ampm)
|
5947 | }), React.createElement(ToolbarText, {
|
5948 | variant: "h3",
|
5949 | label: ":",
|
5950 | className: classes.separator
|
5951 | }), React.createElement(ToolbarButton$1, {
|
5952 | variant: "h3",
|
5953 | onClick: function onClick() {
|
5954 | return setOpenView('minutes');
|
5955 | },
|
5956 | selected: openView === 'minutes',
|
5957 | label: utils.getMinuteText(date)
|
5958 | })), ampm && React.createElement(Grid, {
|
5959 | item: true,
|
5960 | container: true,
|
5961 | xs: 1,
|
5962 | direction: "column",
|
5963 | justify: "flex-end"
|
5964 | }, React.createElement(ToolbarButton$1, {
|
5965 | variant: "subtitle1",
|
5966 | selected: meridiemMode === 'am',
|
5967 | label: utils.getMeridiemText('am'),
|
5968 | onClick: function onClick() {
|
5969 | return handleMeridiemChange('am');
|
5970 | }
|
5971 | }), React.createElement(ToolbarButton$1, {
|
5972 | variant: "subtitle1",
|
5973 | selected: meridiemMode === 'pm',
|
5974 | label: utils.getMeridiemText('pm'),
|
5975 | onClick: function onClick() {
|
5976 | return handleMeridiemChange('pm');
|
5977 | }
|
5978 | })))), showTabs && React.createElement(DateTimePickerTabs, {
|
5979 | dateRangeIcon: dateRangeIcon,
|
5980 | timeIcon: timeIcon,
|
5981 | view: openView,
|
5982 | onChange: setOpenView
|
5983 | }));
|
5984 | };
|
5985 |
|
5986 | function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
5987 |
|
5988 | function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
5989 |
|
5990 | var defaultProps$3 = _objectSpread$7({}, dateTimePickerDefaultProps, {
|
5991 | wider: true,
|
5992 | orientation: 'portrait',
|
5993 | openTo: 'date',
|
5994 | views: ['year', 'date', 'hours', 'minutes']
|
5995 | });
|
5996 |
|
5997 | function useOptions$2(props) {
|
5998 | var utils = useUtils();
|
5999 |
|
6000 | if (props.orientation !== 'portrait') {
|
6001 | throw new Error('We are not supporting custom orientation for DateTimePicker yet :(');
|
6002 | }
|
6003 |
|
6004 | return {
|
6005 | getDefaultFormat: function getDefaultFormat() {
|
6006 | return pick12hOr24hFormat(props.format, props.ampm, {
|
6007 | '12h': utils.dateTime12hFormat,
|
6008 | '24h': utils.dateTime24hFormat
|
6009 | });
|
6010 | }
|
6011 | };
|
6012 | }
|
6013 |
|
6014 | var DateTimePicker = makePickerWithState({
|
6015 | useOptions: useOptions$2,
|
6016 | Input: PureDateInput,
|
6017 | useState: usePickerState,
|
6018 | DefaultToolbarComponent: DateTimePickerToolbar
|
6019 | });
|
6020 | var KeyboardDateTimePicker = makePickerWithState({
|
6021 | useOptions: useOptions$2,
|
6022 | Input: KeyboardDateInput,
|
6023 | useState: useKeyboardPickerState,
|
6024 | DefaultToolbarComponent: DateTimePickerToolbar,
|
6025 | getCustomProps: function getCustomProps(props) {
|
6026 | return {
|
6027 | refuse: props.ampm ? /[^\dap]+/gi : /[^\d]+/gi
|
6028 | };
|
6029 | }
|
6030 | });
|
6031 | DateTimePicker.defaultProps = defaultProps$3;
|
6032 | KeyboardDateTimePicker.defaultProps = defaultProps$3;
|
6033 |
|
6034 | function useStaticState(_ref) {
|
6035 | var value = _ref.value,
|
6036 | _ref$autoOk = _ref.autoOk,
|
6037 | autoOk = _ref$autoOk === void 0 ? true : _ref$autoOk,
|
6038 | onChange = _ref.onChange,
|
6039 | defaultFormat = _ref.defaultFormat;
|
6040 |
|
6041 | var _usePickerState = usePickerState({
|
6042 | value: value,
|
6043 | onChange: onChange,
|
6044 | autoOk: autoOk
|
6045 | }, {
|
6046 |
|
6047 | getDefaultFormat: function getDefaultFormat() {
|
6048 | return defaultFormat || 'MM/dd/yyyy';
|
6049 | }
|
6050 | }),
|
6051 | pickerProps = _usePickerState.pickerProps,
|
6052 | wrapperProps = _usePickerState.wrapperProps,
|
6053 | inputProps = _usePickerState.inputProps;
|
6054 |
|
6055 | return {
|
6056 | pickerProps: pickerProps,
|
6057 | wrapperProps: wrapperProps,
|
6058 | inputProps: inputProps
|
6059 | };
|
6060 | }
|
6061 |
|
6062 | exports.Calendar = Calendar$1;
|
6063 | exports.Clock = Clock$1;
|
6064 | exports.ClockView = ClockView;
|
6065 | exports.DatePicker = DatePicker;
|
6066 | exports.DateTimePicker = DateTimePicker;
|
6067 | exports.Day = Day;
|
6068 | exports.KeyboardDatePicker = KeyboardDatePicker;
|
6069 | exports.KeyboardDateTimePicker = KeyboardDateTimePicker;
|
6070 | exports.KeyboardTimePicker = KeyboardTimePicker;
|
6071 | exports.MuiPickersContext = MuiPickersContext;
|
6072 | exports.MuiPickersUtilsProvider = MuiPickersUtilsProvider;
|
6073 | exports.Picker = Picker;
|
6074 | exports.TimePicker = TimePicker;
|
6075 | exports.TimePickerView = ClockView$1;
|
6076 | exports.makePickerWithState = makePickerWithState;
|
6077 | exports.useKeyboardPickerState = useKeyboardPickerState;
|
6078 | exports.usePickerState = usePickerState;
|
6079 | exports.useStaticState = useStaticState;
|
6080 | exports.useUtils = useUtils;
|
6081 | exports.validate = validate;
|
6082 |
|
6083 | Object.defineProperty(exports, '__esModule', { value: true });
|
6084 |
|
6085 | })));
|