@docsvision/material-ui-pickers 3.2.0-beta.28 → 3.2.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MuiPickersUtilsProvider.js +11 -5
- package/dist/material-ui-pickers.esm.js +8 -1
- package/dist/material-ui-pickers.esm.js.map +1 -1
- package/dist/material-ui-pickers.js +8 -1
- package/dist/material-ui-pickers.js.map +1 -1
- package/dist/material-ui-pickers.umd.js +4839 -9
- package/dist/material-ui-pickers.umd.min.js +1 -1
- package/package.json +2 -2
|
@@ -6,17 +6,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
6
6
|
result["default"] = mod;
|
|
7
7
|
return result;
|
|
8
8
|
};
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
var React = __importStar(require("react"));
|
|
11
14
|
var PropTypes = __importStar(require("prop-types"));
|
|
15
|
+
var moment_1 = __importDefault(require("@date-io/moment"));
|
|
12
16
|
exports.MuiPickersContext = React.createContext(null);
|
|
13
17
|
exports.MuiPickersUtilsProvider = function (_a) {
|
|
14
18
|
var Utils = _a.utils, children = _a.children, locale = _a.locale, libInstance = _a.libInstance;
|
|
15
|
-
var utils = React.useMemo(function () {
|
|
16
|
-
Utils,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
var utils = React.useMemo(function () {
|
|
20
|
+
var instance = new Utils({ locale: locale, moment: libInstance });
|
|
21
|
+
if (instance instanceof moment_1.default) {
|
|
22
|
+
instance.moment.locale(locale);
|
|
23
|
+
}
|
|
24
|
+
return instance;
|
|
25
|
+
}, [Utils, libInstance, locale]);
|
|
20
26
|
return React.createElement(exports.MuiPickersContext.Provider, { value: utils, children: children });
|
|
21
27
|
};
|
|
22
28
|
exports.MuiPickersUtilsProvider.propTypes = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __rest, __assign, __extends } from 'tslib';
|
|
2
2
|
import React__default, { createContext, useMemo, createElement, useContext, useCallback, cloneElement, useEffect, useLayoutEffect, useRef, Fragment, Component, useState, forwardRef, memo, useDebugValue, useReducer } from 'react';
|
|
3
3
|
import { func, oneOfType, object, string, element, arrayOf, bool, any, number, instanceOf, oneOf, node } from 'prop-types';
|
|
4
|
+
import MomentUtils from '@date-io/moment';
|
|
4
5
|
import clsx from 'clsx';
|
|
5
6
|
import Typography from '@material-ui/core/Typography';
|
|
6
7
|
import { makeStyles, fade, createStyles, withStyles, useTheme } from '@material-ui/core/styles';
|
|
@@ -30,10 +31,16 @@ var MuiPickersUtilsProvider = function MuiPickersUtilsProvider(_a) {
|
|
|
30
31
|
locale = _a.locale,
|
|
31
32
|
libInstance = _a.libInstance;
|
|
32
33
|
var utils = useMemo(function () {
|
|
33
|
-
|
|
34
|
+
var instance = new Utils({
|
|
34
35
|
locale: locale,
|
|
35
36
|
moment: libInstance
|
|
36
37
|
});
|
|
38
|
+
|
|
39
|
+
if (instance instanceof MomentUtils) {
|
|
40
|
+
instance.moment.locale(locale);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return instance;
|
|
37
44
|
}, [Utils, libInstance, locale]);
|
|
38
45
|
return (
|
|
39
46
|
/*#__PURE__*/
|