react-asc 25.12.0 → 25.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +6 -4
- package/index.es.js +811 -878
- package/index.js +810 -877
- package/lib/components/Form/validators/MaxValidator.d.ts +1 -1
- package/lib/components/Form/validators/MinValidator.d.ts +1 -1
- package/lib/components/List/ListItemAvatar.d.ts +3 -1
- package/package.json +8 -8
- package/vite.config.d.ts +1 -1
package/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useEffect, useRef, useState, useMemo, createContext, useContext,
|
|
2
|
+
import React, { useEffect, useRef, useState, useMemo, createContext, useContext, forwardRef, useCallback, useImperativeHandle, Fragment as Fragment$2, Component, createRef, cloneElement } from 'react';
|
|
3
3
|
import reactDom, { createPortal } from 'react-dom';
|
|
4
4
|
import { createPopper } from '@popperjs/core';
|
|
5
5
|
import saveAs from 'file-saver';
|
|
@@ -445,8 +445,8 @@ const ListItem = (props) => {
|
|
|
445
445
|
return (jsx("li", { onClick: handleClick, className: getCssClasses(), ...rest, children: children }));
|
|
446
446
|
};
|
|
447
447
|
|
|
448
|
-
var css_248z$Z = ".ListItemAvatar-module_avatar__sVWfR {\n display: flex;\n align-items: center;\n margin-right: 16px;\n}\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_sm__-lmR- svg,\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_sm__-lmR- img {\n width: 24px;\n height: 24px;\n}\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_md__SqRJi svg,\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_md__SqRJi img {\n width: 32px;\n height: 32px;\n}\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_lg__Z6LxN svg,\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_lg__Z6LxN img {\n width: 40px;\n height: 40px;\n}\n.ListItemAvatar-module_avatar__sVWfR img {\n border-radius: 50%;\n}";
|
|
449
|
-
var styles$Z = {"avatar":"ListItemAvatar-module_avatar__sVWfR","sm":"ListItemAvatar-module_sm__-lmR-","md":"ListItemAvatar-module_md__SqRJi","lg":"ListItemAvatar-module_lg__Z6LxN"};
|
|
448
|
+
var css_248z$Z = ".ListItemAvatar-module_avatar__sVWfR {\n display: flex;\n align-items: center;\n margin-right: 16px;\n}\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_sm__-lmR- svg,\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_sm__-lmR- img {\n width: 24px;\n height: 24px;\n}\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_md__SqRJi svg,\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_md__SqRJi img {\n width: 32px;\n height: 32px;\n}\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_lg__Z6LxN svg,\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_lg__Z6LxN img {\n width: 40px;\n height: 40px;\n}\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_xl__6k0DL svg,\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_xl__6k0DL img {\n width: 48px;\n height: 48px;\n}\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_xxl__e51hN svg,\n.ListItemAvatar-module_avatar__sVWfR.ListItemAvatar-module_xxl__e51hN img {\n width: 56px;\n height: 56px;\n}\n.ListItemAvatar-module_avatar__sVWfR img {\n border-radius: 50%;\n}";
|
|
449
|
+
var styles$Z = {"avatar":"ListItemAvatar-module_avatar__sVWfR","sm":"ListItemAvatar-module_sm__-lmR-","md":"ListItemAvatar-module_md__SqRJi","lg":"ListItemAvatar-module_lg__Z6LxN","xl":"ListItemAvatar-module_xl__6k0DL","xxl":"ListItemAvatar-module_xxl__e51hN"};
|
|
450
450
|
styleInject(css_248z$Z);
|
|
451
451
|
|
|
452
452
|
var ListItemAvatarSize;
|
|
@@ -454,6 +454,8 @@ var ListItemAvatarSize;
|
|
|
454
454
|
ListItemAvatarSize["sm"] = "sm";
|
|
455
455
|
ListItemAvatarSize["md"] = "md";
|
|
456
456
|
ListItemAvatarSize["lg"] = "lg";
|
|
457
|
+
ListItemAvatarSize["xl"] = "xl";
|
|
458
|
+
ListItemAvatarSize["xxl"] = "xxl";
|
|
457
459
|
})(ListItemAvatarSize || (ListItemAvatarSize = {}));
|
|
458
460
|
const ListItemAvatar = ({ avatar, avatarSize = ListItemAvatarSize.sm, ...rest }) => {
|
|
459
461
|
const getCssClasses = () => {
|
|
@@ -958,51 +960,69 @@ const CssTransition = (props) => {
|
|
|
958
960
|
jsx("div", { ref: transitionConainter, className: getCssClasses(), children: children }) }));
|
|
959
961
|
};
|
|
960
962
|
|
|
961
|
-
/**
|
|
962
|
-
*
|
|
963
|
-
*
|
|
964
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
963
|
+
/**
|
|
964
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
965
965
|
*
|
|
966
966
|
* This source code is licensed under the MIT license found in the
|
|
967
967
|
* LICENSE file in the root directory of this source tree.
|
|
968
968
|
*/
|
|
969
969
|
|
|
970
|
-
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?
|
|
971
|
-
Symbol.for("react.suspense_list"):60120,r$1=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
972
|
-
function z(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$1:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r$1;var Portal=d;
|
|
973
|
-
var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
|
|
974
|
-
var isMemo=function(a){return z(a)===r$1};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
|
|
975
|
-
var 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$1||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
|
|
976
970
|
|
|
977
|
-
var
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
971
|
+
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
972
|
+
|
|
973
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
974
|
+
|
|
975
|
+
function emptyFunction() {}
|
|
976
|
+
function emptyFunctionWithReset() {}
|
|
977
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
978
|
+
|
|
979
|
+
var factoryWithThrowingShims = function() {
|
|
980
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
981
|
+
if (secret === ReactPropTypesSecret_1) {
|
|
982
|
+
// It is still safe when called from React.
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
var err = new Error(
|
|
986
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
987
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
988
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
989
|
+
);
|
|
990
|
+
err.name = 'Invariant Violation';
|
|
991
|
+
throw err;
|
|
992
|
+
} shim.isRequired = shim;
|
|
993
|
+
function getShim() {
|
|
994
|
+
return shim;
|
|
995
|
+
} // Important!
|
|
996
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
997
|
+
var ReactPropTypes = {
|
|
998
|
+
array: shim,
|
|
999
|
+
bigint: shim,
|
|
1000
|
+
bool: shim,
|
|
1001
|
+
func: shim,
|
|
1002
|
+
number: shim,
|
|
1003
|
+
object: shim,
|
|
1004
|
+
string: shim,
|
|
1005
|
+
symbol: shim,
|
|
1006
|
+
|
|
1007
|
+
any: shim,
|
|
1008
|
+
arrayOf: getShim,
|
|
1009
|
+
element: shim,
|
|
1010
|
+
elementType: shim,
|
|
1011
|
+
instanceOf: getShim,
|
|
1012
|
+
node: shim,
|
|
1013
|
+
objectOf: getShim,
|
|
1014
|
+
oneOf: getShim,
|
|
1015
|
+
oneOfType: getShim,
|
|
1016
|
+
shape: getShim,
|
|
1017
|
+
exact: getShim,
|
|
1018
|
+
|
|
1019
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1020
|
+
resetWarningCache: emptyFunction
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1024
|
+
|
|
1025
|
+
return ReactPropTypes;
|
|
1006
1026
|
};
|
|
1007
1027
|
|
|
1008
1028
|
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
@@ -1206,6 +1226,53 @@ reactIs_development.isSuspense;
|
|
|
1206
1226
|
reactIs_development.isValidElementType;
|
|
1207
1227
|
reactIs_development.typeOf;
|
|
1208
1228
|
|
|
1229
|
+
/** @license React v16.13.1
|
|
1230
|
+
* react-is.production.min.js
|
|
1231
|
+
*
|
|
1232
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1233
|
+
*
|
|
1234
|
+
* This source code is licensed under the MIT license found in the
|
|
1235
|
+
* LICENSE file in the root directory of this source tree.
|
|
1236
|
+
*/
|
|
1237
|
+
|
|
1238
|
+
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?
|
|
1239
|
+
Symbol.for("react.suspense_list"):60120,r$1=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
1240
|
+
function z(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$1:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r$1;var Portal=d;
|
|
1241
|
+
var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
|
|
1242
|
+
var isMemo=function(a){return z(a)===r$1};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
|
|
1243
|
+
var 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$1||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
|
|
1244
|
+
|
|
1245
|
+
var reactIs_production_min = {
|
|
1246
|
+
AsyncMode: AsyncMode,
|
|
1247
|
+
ConcurrentMode: ConcurrentMode,
|
|
1248
|
+
ContextConsumer: ContextConsumer,
|
|
1249
|
+
ContextProvider: ContextProvider,
|
|
1250
|
+
Element: Element,
|
|
1251
|
+
ForwardRef: ForwardRef,
|
|
1252
|
+
Fragment: Fragment,
|
|
1253
|
+
Lazy: Lazy,
|
|
1254
|
+
Memo: Memo,
|
|
1255
|
+
Portal: Portal,
|
|
1256
|
+
Profiler: Profiler,
|
|
1257
|
+
StrictMode: StrictMode,
|
|
1258
|
+
Suspense: Suspense,
|
|
1259
|
+
isAsyncMode: isAsyncMode,
|
|
1260
|
+
isConcurrentMode: isConcurrentMode,
|
|
1261
|
+
isContextConsumer: isContextConsumer,
|
|
1262
|
+
isContextProvider: isContextProvider,
|
|
1263
|
+
isElement: isElement,
|
|
1264
|
+
isForwardRef: isForwardRef,
|
|
1265
|
+
isFragment: isFragment,
|
|
1266
|
+
isLazy: isLazy,
|
|
1267
|
+
isMemo: isMemo,
|
|
1268
|
+
isPortal: isPortal,
|
|
1269
|
+
isProfiler: isProfiler,
|
|
1270
|
+
isStrictMode: isStrictMode,
|
|
1271
|
+
isSuspense: isSuspense,
|
|
1272
|
+
isValidElementType: isValidElementType,
|
|
1273
|
+
typeOf: typeOf
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1209
1276
|
var reactIs = createCommonjsModule(function (module) {
|
|
1210
1277
|
|
|
1211
1278
|
if (process.env.NODE_ENV === 'production') {
|
|
@@ -1305,18 +1372,6 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
|
|
|
1305
1372
|
return to;
|
|
1306
1373
|
};
|
|
1307
1374
|
|
|
1308
|
-
/**
|
|
1309
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1310
|
-
*
|
|
1311
|
-
* This source code is licensed under the MIT license found in the
|
|
1312
|
-
* LICENSE file in the root directory of this source tree.
|
|
1313
|
-
*/
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1317
|
-
|
|
1318
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
1319
|
-
|
|
1320
1375
|
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
1321
1376
|
|
|
1322
1377
|
var printWarning$1 = function() {};
|
|
@@ -2009,59 +2064,6 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
2009
2064
|
return ReactPropTypes;
|
|
2010
2065
|
};
|
|
2011
2066
|
|
|
2012
|
-
function emptyFunction() {}
|
|
2013
|
-
function emptyFunctionWithReset() {}
|
|
2014
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
2015
|
-
|
|
2016
|
-
var factoryWithThrowingShims = function() {
|
|
2017
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
2018
|
-
if (secret === ReactPropTypesSecret_1) {
|
|
2019
|
-
// It is still safe when called from React.
|
|
2020
|
-
return;
|
|
2021
|
-
}
|
|
2022
|
-
var err = new Error(
|
|
2023
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
2024
|
-
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
2025
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
2026
|
-
);
|
|
2027
|
-
err.name = 'Invariant Violation';
|
|
2028
|
-
throw err;
|
|
2029
|
-
} shim.isRequired = shim;
|
|
2030
|
-
function getShim() {
|
|
2031
|
-
return shim;
|
|
2032
|
-
} // Important!
|
|
2033
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
2034
|
-
var ReactPropTypes = {
|
|
2035
|
-
array: shim,
|
|
2036
|
-
bigint: shim,
|
|
2037
|
-
bool: shim,
|
|
2038
|
-
func: shim,
|
|
2039
|
-
number: shim,
|
|
2040
|
-
object: shim,
|
|
2041
|
-
string: shim,
|
|
2042
|
-
symbol: shim,
|
|
2043
|
-
|
|
2044
|
-
any: shim,
|
|
2045
|
-
arrayOf: getShim,
|
|
2046
|
-
element: shim,
|
|
2047
|
-
elementType: shim,
|
|
2048
|
-
instanceOf: getShim,
|
|
2049
|
-
node: shim,
|
|
2050
|
-
objectOf: getShim,
|
|
2051
|
-
oneOf: getShim,
|
|
2052
|
-
oneOfType: getShim,
|
|
2053
|
-
shape: getShim,
|
|
2054
|
-
exact: getShim,
|
|
2055
|
-
|
|
2056
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
2057
|
-
resetWarningCache: emptyFunction
|
|
2058
|
-
};
|
|
2059
|
-
|
|
2060
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
2061
|
-
|
|
2062
|
-
return ReactPropTypes;
|
|
2063
|
-
};
|
|
2064
|
-
|
|
2065
2067
|
var propTypes = createCommonjsModule(function (module) {
|
|
2066
2068
|
/**
|
|
2067
2069
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
@@ -2770,29 +2772,60 @@ var memoize$1 = lodash_memoize;
|
|
|
2770
2772
|
function resolver(options) {
|
|
2771
2773
|
return JSON.stringify(options);
|
|
2772
2774
|
}
|
|
2773
|
-
function
|
|
2774
|
-
return
|
|
2775
|
+
function isString(el) {
|
|
2776
|
+
return typeof el === 'string';
|
|
2777
|
+
}
|
|
2778
|
+
function isUnique(el, index, arr) {
|
|
2779
|
+
return arr.indexOf(el) === index;
|
|
2775
2780
|
}
|
|
2776
2781
|
function isAllLowerCase(el) {
|
|
2777
2782
|
return el.toLowerCase() === el;
|
|
2778
2783
|
}
|
|
2779
|
-
function
|
|
2780
|
-
|
|
2781
|
-
|
|
2784
|
+
function fixCommas(el) {
|
|
2785
|
+
return el.indexOf(',') === -1 ? el : el.split(',');
|
|
2786
|
+
}
|
|
2787
|
+
function normalizeLocale(locale) {
|
|
2788
|
+
if (!locale) {
|
|
2789
|
+
return locale;
|
|
2790
|
+
}
|
|
2791
|
+
if (locale === 'C' || locale === 'posix' || locale === 'POSIX') {
|
|
2792
|
+
return 'en-US';
|
|
2793
|
+
}
|
|
2794
|
+
// If there's a dot (.) in the locale, it's likely in the format of "en-US.UTF-8", so we only take the first part
|
|
2795
|
+
if (locale.indexOf('.') !== -1) {
|
|
2796
|
+
var _a = locale.split('.')[0], actualLocale = _a === void 0 ? '' : _a;
|
|
2797
|
+
return normalizeLocale(actualLocale);
|
|
2782
2798
|
}
|
|
2783
|
-
|
|
2799
|
+
// If there's an at sign (@) in the locale, it's likely in the format of "en-US@posix", so we only take the first part
|
|
2800
|
+
if (locale.indexOf('@') !== -1) {
|
|
2801
|
+
var _b = locale.split('@')[0], actualLocale = _b === void 0 ? '' : _b;
|
|
2802
|
+
return normalizeLocale(actualLocale);
|
|
2803
|
+
}
|
|
2804
|
+
// If there's a dash (-) in the locale and it's not all lower case, it's already in the format of "en-US", so we return it
|
|
2805
|
+
if (locale.indexOf('-') === -1 || !isAllLowerCase(locale)) {
|
|
2806
|
+
return locale;
|
|
2807
|
+
}
|
|
2808
|
+
var _c = locale.split('-'), splitEl1 = _c[0], _d = _c[1], splitEl2 = _d === void 0 ? '' : _d;
|
|
2784
2809
|
return "".concat(splitEl1, "-").concat(splitEl2.toUpperCase());
|
|
2785
2810
|
}
|
|
2786
2811
|
function getUserLocalesInternal(_a) {
|
|
2787
2812
|
var _b = _a === void 0 ? {} : _a, _c = _b.useFallbackLocale, useFallbackLocale = _c === void 0 ? true : _c, _d = _b.fallbackLocale, fallbackLocale = _d === void 0 ? 'en-US' : _d;
|
|
2788
2813
|
var languageList = [];
|
|
2789
2814
|
if (typeof navigator !== 'undefined') {
|
|
2790
|
-
|
|
2815
|
+
var rawLanguages = navigator.languages || [];
|
|
2816
|
+
var languages = [];
|
|
2817
|
+
for (var _i = 0, rawLanguages_1 = rawLanguages; _i < rawLanguages_1.length; _i++) {
|
|
2818
|
+
var rawLanguagesItem = rawLanguages_1[_i];
|
|
2819
|
+
languages = languages.concat(fixCommas(rawLanguagesItem));
|
|
2820
|
+
}
|
|
2821
|
+
var rawLanguage = navigator.language;
|
|
2822
|
+
var language = rawLanguage ? fixCommas(rawLanguage) : rawLanguage;
|
|
2823
|
+
languageList = languageList.concat(languages, language);
|
|
2791
2824
|
}
|
|
2792
2825
|
if (useFallbackLocale) {
|
|
2793
2826
|
languageList.push(fallbackLocale);
|
|
2794
2827
|
}
|
|
2795
|
-
return
|
|
2828
|
+
return languageList.filter(isString).map(normalizeLocale).filter(isUnique);
|
|
2796
2829
|
}
|
|
2797
2830
|
var getUserLocales = memoize$1(getUserLocalesInternal, resolver);
|
|
2798
2831
|
function getUserLocaleInternal(options) {
|
|
@@ -3148,15 +3181,21 @@ function getDaysInMonth(date) {
|
|
|
3148
3181
|
return getDate(getMonthEnd(date));
|
|
3149
3182
|
}
|
|
3150
3183
|
|
|
3151
|
-
var _a;
|
|
3184
|
+
var _a$1;
|
|
3152
3185
|
var CALENDAR_TYPES = {
|
|
3186
|
+
GREGORY: 'gregory',
|
|
3187
|
+
HEBREW: 'hebrew',
|
|
3188
|
+
ISLAMIC: 'islamic',
|
|
3189
|
+
ISO_8601: 'iso8601',
|
|
3190
|
+
};
|
|
3191
|
+
var DEPRECATED_CALENDAR_TYPES = {
|
|
3153
3192
|
ARABIC: 'Arabic',
|
|
3154
3193
|
HEBREW: 'Hebrew',
|
|
3155
3194
|
ISO_8601: 'ISO 8601',
|
|
3156
3195
|
US: 'US',
|
|
3157
3196
|
};
|
|
3158
|
-
var CALENDAR_TYPE_LOCALES = (_a = {},
|
|
3159
|
-
_a[CALENDAR_TYPES.
|
|
3197
|
+
var CALENDAR_TYPE_LOCALES = (_a$1 = {},
|
|
3198
|
+
_a$1[CALENDAR_TYPES.GREGORY] = [
|
|
3160
3199
|
'en-CA',
|
|
3161
3200
|
'en-US',
|
|
3162
3201
|
'es-AR',
|
|
@@ -3177,7 +3216,8 @@ var CALENDAR_TYPE_LOCALES = (_a = {},
|
|
|
3177
3216
|
'es-VE',
|
|
3178
3217
|
'pt-BR',
|
|
3179
3218
|
],
|
|
3180
|
-
_a[CALENDAR_TYPES.
|
|
3219
|
+
_a$1[CALENDAR_TYPES.HEBREW] = ['he', 'he-IL'],
|
|
3220
|
+
_a$1[CALENDAR_TYPES.ISLAMIC] = [
|
|
3181
3221
|
// ar-LB, ar-MA intentionally missing
|
|
3182
3222
|
'ar',
|
|
3183
3223
|
'ar-AE',
|
|
@@ -3199,8 +3239,7 @@ var CALENDAR_TYPE_LOCALES = (_a = {},
|
|
|
3199
3239
|
'ps',
|
|
3200
3240
|
'ps-AR',
|
|
3201
3241
|
],
|
|
3202
|
-
_a
|
|
3203
|
-
_a);
|
|
3242
|
+
_a$1);
|
|
3204
3243
|
var WEEKDAYS = [0, 1, 2, 3, 4, 5, 6];
|
|
3205
3244
|
|
|
3206
3245
|
var formatterCache = new Map();
|
|
@@ -3263,7 +3302,7 @@ var SATURDAY = WEEKDAYS[6];
|
|
|
3263
3302
|
/**
|
|
3264
3303
|
* Gets day of the week of a given date.
|
|
3265
3304
|
* @param {Date} date Date.
|
|
3266
|
-
* @param {CalendarType} [calendarType="
|
|
3305
|
+
* @param {CalendarType} [calendarType="iso8601"] Calendar type.
|
|
3267
3306
|
* @returns {number} Day of the week.
|
|
3268
3307
|
*/
|
|
3269
3308
|
function getDayOfWeek(date, calendarType) {
|
|
@@ -3273,10 +3312,10 @@ function getDayOfWeek(date, calendarType) {
|
|
|
3273
3312
|
case CALENDAR_TYPES.ISO_8601:
|
|
3274
3313
|
// Shifts days of the week so that Monday is 0, Sunday is 6
|
|
3275
3314
|
return (weekday + 6) % 7;
|
|
3276
|
-
case CALENDAR_TYPES.
|
|
3315
|
+
case CALENDAR_TYPES.ISLAMIC:
|
|
3277
3316
|
return (weekday + 1) % 7;
|
|
3278
3317
|
case CALENDAR_TYPES.HEBREW:
|
|
3279
|
-
case CALENDAR_TYPES.
|
|
3318
|
+
case CALENDAR_TYPES.GREGORY:
|
|
3280
3319
|
return weekday;
|
|
3281
3320
|
default:
|
|
3282
3321
|
throw new Error('Unsupported calendar type.');
|
|
@@ -3313,7 +3352,7 @@ function getBeginOfDecadeYear(date) {
|
|
|
3313
3352
|
* Returns the beginning of a given week.
|
|
3314
3353
|
*
|
|
3315
3354
|
* @param {Date} date Date.
|
|
3316
|
-
* @param {CalendarType} [calendarType="
|
|
3355
|
+
* @param {CalendarType} [calendarType="iso8601"] Calendar type.
|
|
3317
3356
|
* @returns {Date} Beginning of a given week.
|
|
3318
3357
|
*/
|
|
3319
3358
|
function getBeginOfWeek(date, calendarType) {
|
|
@@ -3329,12 +3368,12 @@ function getBeginOfWeek(date, calendarType) {
|
|
|
3329
3368
|
* In US calendar week 1 is the one with January 1.
|
|
3330
3369
|
*
|
|
3331
3370
|
* @param {Date} date Date.
|
|
3332
|
-
* @param {CalendarType} [calendarType="
|
|
3371
|
+
* @param {CalendarType} [calendarType="iso8601"] Calendar type.
|
|
3333
3372
|
* @returns {number} Week number.
|
|
3334
3373
|
*/
|
|
3335
3374
|
function getWeekNumber(date, calendarType) {
|
|
3336
3375
|
if (calendarType === void 0) { calendarType = CALENDAR_TYPES.ISO_8601; }
|
|
3337
|
-
var calendarTypeForWeekNumber = calendarType === CALENDAR_TYPES.
|
|
3376
|
+
var calendarTypeForWeekNumber = calendarType === CALENDAR_TYPES.GREGORY ? CALENDAR_TYPES.GREGORY : CALENDAR_TYPES.ISO_8601;
|
|
3338
3377
|
var beginOfWeek = getBeginOfWeek(date, calendarType);
|
|
3339
3378
|
var year = getYear(date) + 1;
|
|
3340
3379
|
var dayInWeekOne;
|
|
@@ -3577,117 +3616,24 @@ function isCurrentDayOfWeek(date) {
|
|
|
3577
3616
|
* Returns a boolean determining whether a given date is a weekend day.
|
|
3578
3617
|
*
|
|
3579
3618
|
* @param {Date} date Date.
|
|
3580
|
-
* @param {CalendarType} [calendarType="
|
|
3619
|
+
* @param {CalendarType} [calendarType="iso8601"] Calendar type.
|
|
3581
3620
|
* @returns {boolean} Whether a given date is a weekend day.
|
|
3582
3621
|
*/
|
|
3583
3622
|
function isWeekend(date, calendarType) {
|
|
3584
3623
|
if (calendarType === void 0) { calendarType = CALENDAR_TYPES.ISO_8601; }
|
|
3585
3624
|
var weekday = date.getDay();
|
|
3586
3625
|
switch (calendarType) {
|
|
3587
|
-
case CALENDAR_TYPES.
|
|
3626
|
+
case CALENDAR_TYPES.ISLAMIC:
|
|
3588
3627
|
case CALENDAR_TYPES.HEBREW:
|
|
3589
3628
|
return weekday === FRIDAY || weekday === SATURDAY;
|
|
3590
3629
|
case CALENDAR_TYPES.ISO_8601:
|
|
3591
|
-
case CALENDAR_TYPES.
|
|
3630
|
+
case CALENDAR_TYPES.GREGORY:
|
|
3592
3631
|
return weekday === SATURDAY || weekday === SUNDAY;
|
|
3593
3632
|
default:
|
|
3594
3633
|
throw new Error('Unsupported calendar type.');
|
|
3595
3634
|
}
|
|
3596
3635
|
}
|
|
3597
3636
|
|
|
3598
|
-
var calendarTypes = Object.values(CALENDAR_TYPES);
|
|
3599
|
-
var allViews$1 = ['century', 'decade', 'year', 'month'];
|
|
3600
|
-
var isCalendarType = PropTypes.oneOf(calendarTypes);
|
|
3601
|
-
var isClassName = PropTypes.oneOfType([
|
|
3602
|
-
PropTypes.string,
|
|
3603
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
3604
|
-
]);
|
|
3605
|
-
function isMinDate(props, propName, componentName) {
|
|
3606
|
-
var _a = props, _b = propName, minDate = _a[_b];
|
|
3607
|
-
if (!minDate) {
|
|
3608
|
-
return null;
|
|
3609
|
-
}
|
|
3610
|
-
if (!(minDate instanceof Date)) {
|
|
3611
|
-
return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof minDate, "` supplied to `").concat(componentName, "`, expected instance of `Date`."));
|
|
3612
|
-
}
|
|
3613
|
-
var maxDate = props.maxDate;
|
|
3614
|
-
if (maxDate && minDate > maxDate) {
|
|
3615
|
-
return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof minDate, "` supplied to `").concat(componentName, "`, minDate cannot be larger than maxDate."));
|
|
3616
|
-
}
|
|
3617
|
-
return null;
|
|
3618
|
-
}
|
|
3619
|
-
function isMaxDate(props, propName, componentName) {
|
|
3620
|
-
var _a = props, _b = propName, maxDate = _a[_b];
|
|
3621
|
-
if (!maxDate) {
|
|
3622
|
-
return null;
|
|
3623
|
-
}
|
|
3624
|
-
if (!(maxDate instanceof Date)) {
|
|
3625
|
-
return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof maxDate, "` supplied to `").concat(componentName, "`, expected instance of `Date`."));
|
|
3626
|
-
}
|
|
3627
|
-
var minDate = props.minDate;
|
|
3628
|
-
if (minDate && maxDate < minDate) {
|
|
3629
|
-
return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof maxDate, "` supplied to `").concat(componentName, "`, maxDate cannot be smaller than minDate."));
|
|
3630
|
-
}
|
|
3631
|
-
return null;
|
|
3632
|
-
}
|
|
3633
|
-
var isRef = PropTypes.oneOfType([
|
|
3634
|
-
PropTypes.func,
|
|
3635
|
-
PropTypes.shape({
|
|
3636
|
-
current: PropTypes.any,
|
|
3637
|
-
}),
|
|
3638
|
-
]);
|
|
3639
|
-
var isValue$1 = PropTypes.oneOfType([
|
|
3640
|
-
PropTypes.instanceOf(Date),
|
|
3641
|
-
PropTypes.arrayOf(PropTypes.instanceOf(Date)),
|
|
3642
|
-
]);
|
|
3643
|
-
var isViews = PropTypes.arrayOf(PropTypes.oneOf(allViews$1));
|
|
3644
|
-
function isView(props, propName, componentName) {
|
|
3645
|
-
var _a = props, _b = propName, view = _a[_b];
|
|
3646
|
-
var views = props.views;
|
|
3647
|
-
var allowedViews = views || allViews$1;
|
|
3648
|
-
if (view !== undefined && (typeof view !== 'string' || allowedViews.indexOf(view) === -1)) {
|
|
3649
|
-
return new Error("Invalid prop `".concat(propName, "` of value `").concat(view, "` supplied to `").concat(componentName, "`, expected one of [").concat(allowedViews
|
|
3650
|
-
.map(function (a) { return "\"".concat(a, "\""); })
|
|
3651
|
-
.join(', '), "]."));
|
|
3652
|
-
}
|
|
3653
|
-
// Everything is fine
|
|
3654
|
-
return null;
|
|
3655
|
-
}
|
|
3656
|
-
isView.isRequired = function (props, propName, componentName) {
|
|
3657
|
-
var _a = props, _b = propName, view = _a[_b];
|
|
3658
|
-
if (!view) {
|
|
3659
|
-
return new Error("The prop `".concat(propName, "` is marked as required in `").concat(componentName, "`, but its value is `").concat(view, "`."));
|
|
3660
|
-
}
|
|
3661
|
-
return isView(props, propName, componentName);
|
|
3662
|
-
};
|
|
3663
|
-
var tileGroupProps = {
|
|
3664
|
-
activeStartDate: PropTypes.instanceOf(Date).isRequired,
|
|
3665
|
-
hover: PropTypes.instanceOf(Date),
|
|
3666
|
-
locale: PropTypes.string,
|
|
3667
|
-
maxDate: isMaxDate,
|
|
3668
|
-
minDate: isMinDate,
|
|
3669
|
-
onClick: PropTypes.func,
|
|
3670
|
-
onMouseOver: PropTypes.func,
|
|
3671
|
-
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
|
|
3672
|
-
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
3673
|
-
value: isValue$1,
|
|
3674
|
-
valueType: PropTypes.string,
|
|
3675
|
-
};
|
|
3676
|
-
var tileProps = {
|
|
3677
|
-
activeStartDate: PropTypes.instanceOf(Date).isRequired,
|
|
3678
|
-
classes: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
3679
|
-
date: PropTypes.instanceOf(Date).isRequired,
|
|
3680
|
-
locale: PropTypes.string,
|
|
3681
|
-
maxDate: isMaxDate,
|
|
3682
|
-
minDate: isMinDate,
|
|
3683
|
-
onClick: PropTypes.func,
|
|
3684
|
-
onMouseOver: PropTypes.func,
|
|
3685
|
-
style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
3686
|
-
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
|
|
3687
|
-
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
3688
|
-
tileDisabled: PropTypes.func,
|
|
3689
|
-
};
|
|
3690
|
-
|
|
3691
3637
|
var className$6 = 'react-calendar__navigation';
|
|
3692
3638
|
function Navigation(_a) {
|
|
3693
3639
|
var activeStartDate = _a.activeStartDate, drillUp = _a.drillUp, _b = _a.formatMonthYear, formatMonthYear$1 = _b === void 0 ? formatMonthYear : _b, _c = _a.formatYear, formatYear$1 = _c === void 0 ? formatYear : _c, locale = _a.locale, maxDate = _a.maxDate, minDate = _a.minDate, _d = _a.navigationAriaLabel, navigationAriaLabel = _d === void 0 ? '' : _d, navigationAriaLive = _a.navigationAriaLive, navigationLabel = _a.navigationLabel, _e = _a.next2AriaLabel, next2AriaLabel = _e === void 0 ? '' : _e, _f = _a.next2Label, next2Label = _f === void 0 ? '»' : _f, _g = _a.nextAriaLabel, nextAriaLabel = _g === void 0 ? '' : _g, _h = _a.nextLabel, nextLabel = _h === void 0 ? '›' : _h, _j = _a.prev2AriaLabel, prev2AriaLabel = _j === void 0 ? '' : _j, _k = _a.prev2Label, prev2Label = _k === void 0 ? '«' : _k, _l = _a.prevAriaLabel, prevAriaLabel = _l === void 0 ? '' : _l, _m = _a.prevLabel, prevLabel = _m === void 0 ? '‹' : _m, setActiveStartDate = _a.setActiveStartDate, showDoubleView = _a.showDoubleView, view = _a.view, views = _a.views;
|
|
@@ -3769,33 +3715,9 @@ function Navigation(_a) {
|
|
|
3769
3715
|
nextLabel !== null && (React.createElement("button", { "aria-label": nextAriaLabel, className: "".concat(className$6, "__arrow ").concat(className$6, "__next-button"), disabled: nextButtonDisabled, onClick: onClickNext, type: "button" }, nextLabel)),
|
|
3770
3716
|
next2Label !== null && shouldShowPrevNext2Buttons ? (React.createElement("button", { "aria-label": next2AriaLabel, className: "".concat(className$6, "__arrow ").concat(className$6, "__next2-button"), disabled: next2ButtonDisabled, onClick: onClickNext2, type: "button" }, next2Label)) : null));
|
|
3771
3717
|
}
|
|
3772
|
-
Navigation.propTypes = {
|
|
3773
|
-
activeStartDate: PropTypes.instanceOf(Date).isRequired,
|
|
3774
|
-
drillUp: PropTypes.func.isRequired,
|
|
3775
|
-
formatMonthYear: PropTypes.func,
|
|
3776
|
-
formatYear: PropTypes.func,
|
|
3777
|
-
locale: PropTypes.string,
|
|
3778
|
-
maxDate: PropTypes.instanceOf(Date),
|
|
3779
|
-
minDate: PropTypes.instanceOf(Date),
|
|
3780
|
-
navigationAriaLabel: PropTypes.string,
|
|
3781
|
-
navigationAriaLive: PropTypes.string,
|
|
3782
|
-
navigationLabel: PropTypes.func,
|
|
3783
|
-
next2AriaLabel: PropTypes.string,
|
|
3784
|
-
next2Label: PropTypes.node,
|
|
3785
|
-
nextAriaLabel: PropTypes.string,
|
|
3786
|
-
nextLabel: PropTypes.node,
|
|
3787
|
-
prev2AriaLabel: PropTypes.string,
|
|
3788
|
-
prev2Label: PropTypes.node,
|
|
3789
|
-
prevAriaLabel: PropTypes.string,
|
|
3790
|
-
prevLabel: PropTypes.node,
|
|
3791
|
-
setActiveStartDate: PropTypes.func.isRequired,
|
|
3792
|
-
showDoubleView: PropTypes.bool,
|
|
3793
|
-
view: isView.isRequired,
|
|
3794
|
-
views: isViews.isRequired,
|
|
3795
|
-
};
|
|
3796
3718
|
|
|
3797
|
-
var __assign$
|
|
3798
|
-
__assign$
|
|
3719
|
+
var __assign$e = (undefined && undefined.__assign) || function () {
|
|
3720
|
+
__assign$e = Object.assign || function(t) {
|
|
3799
3721
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3800
3722
|
s = arguments[i];
|
|
3801
3723
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -3803,9 +3725,9 @@ var __assign$g = (undefined && undefined.__assign) || function () {
|
|
|
3803
3725
|
}
|
|
3804
3726
|
return t;
|
|
3805
3727
|
};
|
|
3806
|
-
return __assign$
|
|
3728
|
+
return __assign$e.apply(this, arguments);
|
|
3807
3729
|
};
|
|
3808
|
-
var __rest$
|
|
3730
|
+
var __rest$a = (undefined && undefined.__rest) || function (s, e) {
|
|
3809
3731
|
var t = {};
|
|
3810
3732
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3811
3733
|
t[p] = s[p];
|
|
@@ -3820,27 +3742,41 @@ function toPercent(num) {
|
|
|
3820
3742
|
return "".concat(num, "%");
|
|
3821
3743
|
}
|
|
3822
3744
|
function Flex(_a) {
|
|
3823
|
-
var children = _a.children, className = _a.className, count = _a.count, direction = _a.direction, offset = _a.offset, style = _a.style, wrap = _a.wrap, otherProps = __rest$
|
|
3824
|
-
return (React.createElement("div", __assign$
|
|
3825
|
-
|
|
3745
|
+
var children = _a.children, className = _a.className, count = _a.count, direction = _a.direction, offset = _a.offset, style = _a.style, wrap = _a.wrap, otherProps = __rest$a(_a, ["children", "className", "count", "direction", "offset", "style", "wrap"]);
|
|
3746
|
+
return (React.createElement("div", __assign$e({ className: className, style: __assign$e({ display: 'flex', flexDirection: direction, flexWrap: wrap ? 'wrap' : 'nowrap' }, style) }, otherProps), React.Children.map(children, function (child, index) {
|
|
3747
|
+
var marginInlineStart = offset && index === 0 ? toPercent((100 * offset) / count) : null;
|
|
3748
|
+
return React.cloneElement(child, __assign$e(__assign$e({}, child.props), { style: {
|
|
3826
3749
|
flexBasis: toPercent(100 / count),
|
|
3827
3750
|
flexShrink: 0,
|
|
3828
3751
|
flexGrow: 0,
|
|
3829
3752
|
overflow: 'hidden',
|
|
3830
|
-
marginLeft:
|
|
3753
|
+
marginLeft: marginInlineStart,
|
|
3754
|
+
marginInlineStart: marginInlineStart,
|
|
3755
|
+
marginInlineEnd: 0,
|
|
3831
3756
|
} }));
|
|
3832
3757
|
})));
|
|
3833
3758
|
}
|
|
3834
|
-
Flex.propTypes = {
|
|
3835
|
-
children: PropTypes.node,
|
|
3836
|
-
className: PropTypes.string,
|
|
3837
|
-
count: PropTypes.number.isRequired,
|
|
3838
|
-
direction: PropTypes.string,
|
|
3839
|
-
offset: PropTypes.number,
|
|
3840
|
-
style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
3841
|
-
wrap: PropTypes.bool,
|
|
3842
|
-
};
|
|
3843
3759
|
|
|
3760
|
+
var isProduction = process.env.NODE_ENV === 'production';
|
|
3761
|
+
function warning(condition, message) {
|
|
3762
|
+
if (!isProduction) {
|
|
3763
|
+
if (condition) {
|
|
3764
|
+
return;
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
var text = "Warning: " + message;
|
|
3768
|
+
|
|
3769
|
+
if (typeof console !== 'undefined') {
|
|
3770
|
+
console.warn(text);
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3773
|
+
try {
|
|
3774
|
+
throw Error(text);
|
|
3775
|
+
} catch (x) {}
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3779
|
+
var _a;
|
|
3844
3780
|
/**
|
|
3845
3781
|
* Returns a value no smaller than min and no larger than max.
|
|
3846
3782
|
*
|
|
@@ -3886,6 +3822,12 @@ function getRangeClassNames(valueRange, dateRange, baseClassName) {
|
|
|
3886
3822
|
}
|
|
3887
3823
|
return classes;
|
|
3888
3824
|
}
|
|
3825
|
+
function isCompleteValue(value) {
|
|
3826
|
+
if (Array.isArray(value)) {
|
|
3827
|
+
return value[0] !== null && value[1] !== null;
|
|
3828
|
+
}
|
|
3829
|
+
return value !== null;
|
|
3830
|
+
}
|
|
3889
3831
|
function getTileClasses(args) {
|
|
3890
3832
|
if (!args) {
|
|
3891
3833
|
throw new Error('args is required');
|
|
@@ -3910,7 +3852,7 @@ function getTileClasses(args) {
|
|
|
3910
3852
|
if (isValueWithinRange(now, dateRange)) {
|
|
3911
3853
|
classes.push("".concat(className, "--now"));
|
|
3912
3854
|
}
|
|
3913
|
-
if (!value) {
|
|
3855
|
+
if (!value || !isCompleteValue(value)) {
|
|
3914
3856
|
return classes;
|
|
3915
3857
|
}
|
|
3916
3858
|
var valueRange = (function () {
|
|
@@ -3939,115 +3881,61 @@ function getTileClasses(args) {
|
|
|
3939
3881
|
}
|
|
3940
3882
|
return classes;
|
|
3941
3883
|
}
|
|
3884
|
+
var calendarTypeMap = (_a = {},
|
|
3885
|
+
_a[DEPRECATED_CALENDAR_TYPES.ARABIC] = CALENDAR_TYPES.ISLAMIC,
|
|
3886
|
+
_a[DEPRECATED_CALENDAR_TYPES.HEBREW] = CALENDAR_TYPES.HEBREW,
|
|
3887
|
+
_a[DEPRECATED_CALENDAR_TYPES.ISO_8601] = CALENDAR_TYPES.ISO_8601,
|
|
3888
|
+
_a[DEPRECATED_CALENDAR_TYPES.US] = CALENDAR_TYPES.GREGORY,
|
|
3889
|
+
_a);
|
|
3890
|
+
function isDeprecatedCalendarType(calendarType) {
|
|
3891
|
+
return calendarType !== undefined && calendarType in DEPRECATED_CALENDAR_TYPES;
|
|
3892
|
+
}
|
|
3893
|
+
var warned = false;
|
|
3894
|
+
function mapCalendarType(calendarTypeOrDeprecatedCalendarType) {
|
|
3895
|
+
if (isDeprecatedCalendarType(calendarTypeOrDeprecatedCalendarType)) {
|
|
3896
|
+
var calendarType = calendarTypeMap[calendarTypeOrDeprecatedCalendarType];
|
|
3897
|
+
warning(warned, "Specifying calendarType=\"".concat(calendarTypeOrDeprecatedCalendarType, "\" is deprecated. Use calendarType=\"").concat(calendarType, "\" instead."));
|
|
3898
|
+
warned = true;
|
|
3899
|
+
return calendarType;
|
|
3900
|
+
}
|
|
3901
|
+
return calendarTypeOrDeprecatedCalendarType;
|
|
3902
|
+
}
|
|
3942
3903
|
|
|
3943
|
-
var __assign$f = (undefined && undefined.__assign) || function () {
|
|
3944
|
-
__assign$f = Object.assign || function(t) {
|
|
3945
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3946
|
-
s = arguments[i];
|
|
3947
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
3948
|
-
t[p] = s[p];
|
|
3949
|
-
}
|
|
3950
|
-
return t;
|
|
3951
|
-
};
|
|
3952
|
-
return __assign$f.apply(this, arguments);
|
|
3953
|
-
};
|
|
3954
|
-
var __rest$8 = (undefined && undefined.__rest) || function (s, e) {
|
|
3955
|
-
var t = {};
|
|
3956
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3957
|
-
t[p] = s[p];
|
|
3958
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3959
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3960
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3961
|
-
t[p[i]] = s[p[i]];
|
|
3962
|
-
}
|
|
3963
|
-
return t;
|
|
3964
|
-
};
|
|
3965
3904
|
function TileGroup(_a) {
|
|
3966
|
-
var className = _a.className, _b = _a.count, count = _b === void 0 ? 3 : _b, dateTransform = _a.dateTransform, dateType = _a.dateType, end = _a.end, hover = _a.hover, offset = _a.offset, start = _a.start, _c = _a.step, step = _c === void 0 ? 1 : _c,
|
|
3905
|
+
var className = _a.className, _b = _a.count, count = _b === void 0 ? 3 : _b, dateTransform = _a.dateTransform, dateType = _a.dateType, end = _a.end, hover = _a.hover, offset = _a.offset, renderTile = _a.renderTile, start = _a.start, _c = _a.step, step = _c === void 0 ? 1 : _c, value = _a.value, valueType = _a.valueType;
|
|
3967
3906
|
var tiles = [];
|
|
3968
3907
|
for (var point = start; point <= end; point += step) {
|
|
3969
3908
|
var date = dateTransform(point);
|
|
3970
|
-
tiles.push(
|
|
3971
|
-
|
|
3972
|
-
valueType: valueType,
|
|
3909
|
+
tiles.push(renderTile({
|
|
3910
|
+
classes: getTileClasses({
|
|
3973
3911
|
date: date,
|
|
3974
3912
|
dateType: dateType,
|
|
3975
3913
|
hover: hover,
|
|
3976
|
-
|
|
3914
|
+
value: value,
|
|
3915
|
+
valueType: valueType,
|
|
3916
|
+
}),
|
|
3917
|
+
date: date,
|
|
3918
|
+
}));
|
|
3977
3919
|
}
|
|
3978
3920
|
return (React.createElement(Flex, { className: className, count: count, offset: offset, wrap: true }, tiles));
|
|
3979
3921
|
}
|
|
3980
|
-
TileGroup.propTypes = __assign$f(__assign$f({}, tileGroupProps), { className: PropTypes.string, count: PropTypes.number, dateTransform: PropTypes.func.isRequired, dateType: PropTypes.string, end: PropTypes.number.isRequired, offset: PropTypes.number, step: PropTypes.number, start: PropTypes.number.isRequired, tile: PropTypes.func.isRequired });
|
|
3981
3922
|
|
|
3982
|
-
|
|
3983
|
-
var
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
return function (d, b) {
|
|
3990
|
-
if (typeof b !== "function" && b !== null)
|
|
3991
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3992
|
-
extendStatics(d, b);
|
|
3993
|
-
function __() { this.constructor = d; }
|
|
3994
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
3995
|
-
};
|
|
3996
|
-
})();
|
|
3997
|
-
var __assign$e = (undefined && undefined.__assign) || function () {
|
|
3998
|
-
__assign$e = Object.assign || function(t) {
|
|
3999
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4000
|
-
s = arguments[i];
|
|
4001
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
4002
|
-
t[p] = s[p];
|
|
4003
|
-
}
|
|
4004
|
-
return t;
|
|
4005
|
-
};
|
|
4006
|
-
return __assign$e.apply(this, arguments);
|
|
4007
|
-
};
|
|
4008
|
-
function datesAreDifferent(date1, date2) {
|
|
4009
|
-
return ((date1 && !date2) ||
|
|
4010
|
-
(!date1 && date2) ||
|
|
4011
|
-
(date1 && date2 && date1.getTime() !== date2.getTime()));
|
|
4012
|
-
}
|
|
4013
|
-
var Tile = /** @class */ (function (_super) {
|
|
4014
|
-
__extends$1(Tile, _super);
|
|
4015
|
-
function Tile() {
|
|
4016
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
4017
|
-
_this.state = {};
|
|
4018
|
-
return _this;
|
|
4019
|
-
}
|
|
4020
|
-
Tile.getDerivedStateFromProps = function (nextProps, prevState) {
|
|
4021
|
-
var activeStartDate = nextProps.activeStartDate, date = nextProps.date, tileClassName = nextProps.tileClassName, tileContent = nextProps.tileContent, view = nextProps.view;
|
|
4022
|
-
var nextState = {};
|
|
3923
|
+
function Tile(props) {
|
|
3924
|
+
var activeStartDate = props.activeStartDate, children = props.children, classes = props.classes, date = props.date, formatAbbr = props.formatAbbr, locale = props.locale, maxDate = props.maxDate, maxDateTransform = props.maxDateTransform, minDate = props.minDate, minDateTransform = props.minDateTransform, onClick = props.onClick, onMouseOver = props.onMouseOver, style = props.style, tileClassNameProps = props.tileClassName, tileContentProps = props.tileContent, tileDisabled = props.tileDisabled, view = props.view;
|
|
3925
|
+
var tileClassName = useMemo(function () {
|
|
3926
|
+
var args = { activeStartDate: activeStartDate, date: date, view: view };
|
|
3927
|
+
return typeof tileClassNameProps === 'function' ? tileClassNameProps(args) : tileClassNameProps;
|
|
3928
|
+
}, [activeStartDate, date, tileClassNameProps, view]);
|
|
3929
|
+
var tileContent = useMemo(function () {
|
|
4023
3930
|
var args = { activeStartDate: activeStartDate, date: date, view: view };
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
}
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
nextState.tileContent = typeof tileContent === 'function' ? tileContent(args) : tileContent;
|
|
4033
|
-
nextState.tileContentProps = tileContent;
|
|
4034
|
-
}
|
|
4035
|
-
nextState.activeStartDateProps = activeStartDate;
|
|
4036
|
-
return nextState;
|
|
4037
|
-
};
|
|
4038
|
-
Tile.prototype.render = function () {
|
|
4039
|
-
var _a = this.props, activeStartDate = _a.activeStartDate, children = _a.children, classes = _a.classes, date = _a.date, formatAbbr = _a.formatAbbr, locale = _a.locale, maxDate = _a.maxDate, maxDateTransform = _a.maxDateTransform, minDate = _a.minDate, minDateTransform = _a.minDateTransform, onClick = _a.onClick, onMouseOver = _a.onMouseOver, style = _a.style, tileDisabled = _a.tileDisabled, view = _a.view;
|
|
4040
|
-
var _b = this.state, tileClassName = _b.tileClassName, tileContent = _b.tileContent;
|
|
4041
|
-
return (React.createElement("button", { className: clsx(classes, tileClassName), disabled: (minDate && minDateTransform(minDate) > date) ||
|
|
4042
|
-
(maxDate && maxDateTransform(maxDate) < date) ||
|
|
4043
|
-
(tileDisabled && tileDisabled({ activeStartDate: activeStartDate, date: date, view: view })), onClick: onClick ? function (event) { return onClick(date, event); } : undefined, onFocus: onMouseOver ? function () { return onMouseOver(date); } : undefined, onMouseOver: onMouseOver ? function () { return onMouseOver(date); } : undefined, style: style, type: "button" },
|
|
4044
|
-
formatAbbr ? React.createElement("abbr", { "aria-label": formatAbbr(locale, date) }, children) : children,
|
|
4045
|
-
tileContent));
|
|
4046
|
-
};
|
|
4047
|
-
Tile.propTypes = __assign$e(__assign$e({}, tileProps), { children: PropTypes.node.isRequired, formatAbbr: PropTypes.func, maxDateTransform: PropTypes.func.isRequired, minDateTransform: PropTypes.func.isRequired });
|
|
4048
|
-
return Tile;
|
|
4049
|
-
}(Component));
|
|
4050
|
-
var Tile$1 = Tile;
|
|
3931
|
+
return typeof tileContentProps === 'function' ? tileContentProps(args) : tileContentProps;
|
|
3932
|
+
}, [activeStartDate, date, tileContentProps, view]);
|
|
3933
|
+
return (React.createElement("button", { className: clsx(classes, tileClassName), disabled: (minDate && minDateTransform(minDate) > date) ||
|
|
3934
|
+
(maxDate && maxDateTransform(maxDate) < date) ||
|
|
3935
|
+
(tileDisabled && tileDisabled({ activeStartDate: activeStartDate, date: date, view: view })), onClick: onClick ? function (event) { return onClick(date, event); } : undefined, onFocus: onMouseOver ? function () { return onMouseOver(date); } : undefined, onMouseOver: onMouseOver ? function () { return onMouseOver(date); } : undefined, style: style, type: "button" },
|
|
3936
|
+
formatAbbr ? React.createElement("abbr", { "aria-label": formatAbbr(locale, date) }, children) : children,
|
|
3937
|
+
tileContent));
|
|
3938
|
+
}
|
|
4051
3939
|
|
|
4052
3940
|
var __assign$d = (undefined && undefined.__assign) || function () {
|
|
4053
3941
|
__assign$d = Object.assign || function(t) {
|
|
@@ -4060,7 +3948,7 @@ var __assign$d = (undefined && undefined.__assign) || function () {
|
|
|
4060
3948
|
};
|
|
4061
3949
|
return __assign$d.apply(this, arguments);
|
|
4062
3950
|
};
|
|
4063
|
-
var __rest$
|
|
3951
|
+
var __rest$9 = (undefined && undefined.__rest) || function (s, e) {
|
|
4064
3952
|
var t = {};
|
|
4065
3953
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4066
3954
|
t[p] = s[p];
|
|
@@ -4071,7 +3959,7 @@ var __rest$7 = (undefined && undefined.__rest) || function (s, e) {
|
|
|
4071
3959
|
}
|
|
4072
3960
|
return t;
|
|
4073
3961
|
};
|
|
4074
|
-
var __spreadArray$
|
|
3962
|
+
var __spreadArray$3 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
|
4075
3963
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4076
3964
|
if (ar || !(i in from)) {
|
|
4077
3965
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
@@ -4082,11 +3970,10 @@ var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, fr
|
|
|
4082
3970
|
};
|
|
4083
3971
|
var className$5 = 'react-calendar__century-view__decades__decade';
|
|
4084
3972
|
function Decade(_a) {
|
|
4085
|
-
var _b = _a.classes, classes = _b === void 0 ? [] : _b, _c = _a.formatYear, formatYear$1 = _c === void 0 ? formatYear : _c, otherProps = __rest$
|
|
3973
|
+
var _b = _a.classes, classes = _b === void 0 ? [] : _b, _c = _a.formatYear, formatYear$1 = _c === void 0 ? formatYear : _c, otherProps = __rest$9(_a, ["classes", "formatYear"]);
|
|
4086
3974
|
var date = otherProps.date, locale = otherProps.locale;
|
|
4087
|
-
return (React.createElement(Tile
|
|
3975
|
+
return (React.createElement(Tile, __assign$d({}, otherProps, { classes: __spreadArray$3(__spreadArray$3([], classes, true), [className$5], false), maxDateTransform: getDecadeEnd, minDateTransform: getDecadeStart, view: "century" }), getDecadeLabel(locale, formatYear$1, date)));
|
|
4088
3976
|
}
|
|
4089
|
-
Decade.propTypes = __assign$d(__assign$d({}, tileProps), { formatYear: PropTypes.func });
|
|
4090
3977
|
|
|
4091
3978
|
var __assign$c = (undefined && undefined.__assign) || function () {
|
|
4092
3979
|
__assign$c = Object.assign || function(t) {
|
|
@@ -4099,13 +3986,132 @@ var __assign$c = (undefined && undefined.__assign) || function () {
|
|
|
4099
3986
|
};
|
|
4100
3987
|
return __assign$c.apply(this, arguments);
|
|
4101
3988
|
};
|
|
3989
|
+
var __rest$8 = (undefined && undefined.__rest) || function (s, e) {
|
|
3990
|
+
var t = {};
|
|
3991
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3992
|
+
t[p] = s[p];
|
|
3993
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3994
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3995
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3996
|
+
t[p[i]] = s[p[i]];
|
|
3997
|
+
}
|
|
3998
|
+
return t;
|
|
3999
|
+
};
|
|
4102
4000
|
function Decades(props) {
|
|
4103
|
-
var activeStartDate = props.activeStartDate;
|
|
4001
|
+
var activeStartDate = props.activeStartDate, hover = props.hover, value = props.value, valueType = props.valueType, otherProps = __rest$8(props, ["activeStartDate", "hover", "value", "valueType"]);
|
|
4104
4002
|
var start = getBeginOfCenturyYear(activeStartDate);
|
|
4105
4003
|
var end = start + 99;
|
|
4106
|
-
return (React.createElement(TileGroup,
|
|
4004
|
+
return (React.createElement(TileGroup, { className: "react-calendar__century-view__decades", dateTransform: getDecadeStart, dateType: "decade", end: end, hover: hover, renderTile: function (_a) {
|
|
4005
|
+
var date = _a.date, otherTileProps = __rest$8(_a, ["date"]);
|
|
4006
|
+
return (React.createElement(Decade, __assign$c({ key: date.getTime() }, otherProps, otherTileProps, { activeStartDate: activeStartDate, date: date })));
|
|
4007
|
+
}, start: start, step: 10, value: value, valueType: valueType }));
|
|
4107
4008
|
}
|
|
4108
|
-
|
|
4009
|
+
|
|
4010
|
+
var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
|
4011
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4012
|
+
if (ar || !(i in from)) {
|
|
4013
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
4014
|
+
ar[i] = from[i];
|
|
4015
|
+
}
|
|
4016
|
+
}
|
|
4017
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
4018
|
+
};
|
|
4019
|
+
var calendarTypes = Object.values(CALENDAR_TYPES);
|
|
4020
|
+
var deprecatedCalendarTypes = Object.values(DEPRECATED_CALENDAR_TYPES);
|
|
4021
|
+
var allViews$1 = ['century', 'decade', 'year', 'month'];
|
|
4022
|
+
var isCalendarType = PropTypes.oneOf(__spreadArray$2(__spreadArray$2([], calendarTypes, true), deprecatedCalendarTypes, true));
|
|
4023
|
+
var isClassName = PropTypes.oneOfType([
|
|
4024
|
+
PropTypes.string,
|
|
4025
|
+
PropTypes.arrayOf(PropTypes.string),
|
|
4026
|
+
]);
|
|
4027
|
+
var isMinDate = function isMinDate(props, propName, componentName) {
|
|
4028
|
+
var _a = props, _b = propName, minDate = _a[_b];
|
|
4029
|
+
if (!minDate) {
|
|
4030
|
+
return null;
|
|
4031
|
+
}
|
|
4032
|
+
if (!(minDate instanceof Date)) {
|
|
4033
|
+
return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof minDate, "` supplied to `").concat(componentName, "`, expected instance of `Date`."));
|
|
4034
|
+
}
|
|
4035
|
+
var maxDate = props.maxDate;
|
|
4036
|
+
if (maxDate && minDate > maxDate) {
|
|
4037
|
+
return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof minDate, "` supplied to `").concat(componentName, "`, minDate cannot be larger than maxDate."));
|
|
4038
|
+
}
|
|
4039
|
+
return null;
|
|
4040
|
+
};
|
|
4041
|
+
var isMaxDate = function isMaxDate(props, propName, componentName) {
|
|
4042
|
+
var _a = props, _b = propName, maxDate = _a[_b];
|
|
4043
|
+
if (!maxDate) {
|
|
4044
|
+
return null;
|
|
4045
|
+
}
|
|
4046
|
+
if (!(maxDate instanceof Date)) {
|
|
4047
|
+
return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof maxDate, "` supplied to `").concat(componentName, "`, expected instance of `Date`."));
|
|
4048
|
+
}
|
|
4049
|
+
var minDate = props.minDate;
|
|
4050
|
+
if (minDate && maxDate < minDate) {
|
|
4051
|
+
return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof maxDate, "` supplied to `").concat(componentName, "`, maxDate cannot be smaller than minDate."));
|
|
4052
|
+
}
|
|
4053
|
+
return null;
|
|
4054
|
+
};
|
|
4055
|
+
var isRef = PropTypes.oneOfType([
|
|
4056
|
+
PropTypes.func,
|
|
4057
|
+
PropTypes.exact({
|
|
4058
|
+
current: PropTypes.any,
|
|
4059
|
+
}),
|
|
4060
|
+
]);
|
|
4061
|
+
var isRange = PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.oneOf([null])]).isRequired);
|
|
4062
|
+
var isValue$1 = PropTypes.oneOfType([
|
|
4063
|
+
PropTypes.instanceOf(Date),
|
|
4064
|
+
PropTypes.oneOf([null]),
|
|
4065
|
+
isRange,
|
|
4066
|
+
]);
|
|
4067
|
+
PropTypes.arrayOf(PropTypes.oneOf(allViews$1));
|
|
4068
|
+
var isView = function isView(props, propName, componentName) {
|
|
4069
|
+
var _a = props, _b = propName, view = _a[_b];
|
|
4070
|
+
if (view !== undefined && (typeof view !== 'string' || allViews$1.indexOf(view) === -1)) {
|
|
4071
|
+
return new Error("Invalid prop `".concat(propName, "` of value `").concat(view, "` supplied to `").concat(componentName, "`, expected one of [").concat(allViews$1
|
|
4072
|
+
.map(function (a) { return "\"".concat(a, "\""); })
|
|
4073
|
+
.join(', '), "]."));
|
|
4074
|
+
}
|
|
4075
|
+
// Everything is fine
|
|
4076
|
+
return null;
|
|
4077
|
+
};
|
|
4078
|
+
isView.isRequired = function isViewIsRequired(props, propName, componentName, location, propFullName) {
|
|
4079
|
+
var _a = props, _b = propName, view = _a[_b];
|
|
4080
|
+
if (!view) {
|
|
4081
|
+
return new Error("The prop `".concat(propName, "` is marked as required in `").concat(componentName, "`, but its value is `").concat(view, "`."));
|
|
4082
|
+
}
|
|
4083
|
+
return isView(props, propName, componentName);
|
|
4084
|
+
};
|
|
4085
|
+
var rangeOf = function (type) {
|
|
4086
|
+
return PropTypes.arrayOf(type);
|
|
4087
|
+
};
|
|
4088
|
+
var tileGroupProps = {
|
|
4089
|
+
activeStartDate: PropTypes.instanceOf(Date).isRequired,
|
|
4090
|
+
hover: PropTypes.instanceOf(Date),
|
|
4091
|
+
locale: PropTypes.string,
|
|
4092
|
+
maxDate: isMaxDate,
|
|
4093
|
+
minDate: isMinDate,
|
|
4094
|
+
onClick: PropTypes.func,
|
|
4095
|
+
onMouseOver: PropTypes.func,
|
|
4096
|
+
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
|
|
4097
|
+
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
4098
|
+
value: isValue$1,
|
|
4099
|
+
valueType: PropTypes.oneOf(['century', 'decade', 'year', 'month', 'day']).isRequired,
|
|
4100
|
+
};
|
|
4101
|
+
({
|
|
4102
|
+
activeStartDate: PropTypes.instanceOf(Date).isRequired,
|
|
4103
|
+
classes: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
|
|
4104
|
+
date: PropTypes.instanceOf(Date).isRequired,
|
|
4105
|
+
locale: PropTypes.string,
|
|
4106
|
+
maxDate: isMaxDate,
|
|
4107
|
+
minDate: isMinDate,
|
|
4108
|
+
onClick: PropTypes.func,
|
|
4109
|
+
onMouseOver: PropTypes.func,
|
|
4110
|
+
style: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
4111
|
+
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
|
|
4112
|
+
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
4113
|
+
tileDisabled: PropTypes.func,
|
|
4114
|
+
});
|
|
4109
4115
|
|
|
4110
4116
|
var __assign$b = (undefined && undefined.__assign) || function () {
|
|
4111
4117
|
__assign$b = Object.assign || function(t) {
|
|
@@ -4118,12 +4124,14 @@ var __assign$b = (undefined && undefined.__assign) || function () {
|
|
|
4118
4124
|
};
|
|
4119
4125
|
return __assign$b.apply(this, arguments);
|
|
4120
4126
|
};
|
|
4121
|
-
function CenturyView(props) {
|
|
4127
|
+
var CenturyView = function CenturyView(props) {
|
|
4122
4128
|
function renderDecades() {
|
|
4123
4129
|
return React.createElement(Decades, __assign$b({}, props));
|
|
4124
4130
|
}
|
|
4125
4131
|
return React.createElement("div", { className: "react-calendar__century-view" }, renderDecades());
|
|
4126
|
-
}
|
|
4132
|
+
};
|
|
4133
|
+
CenturyView.propTypes = __assign$b({}, tileGroupProps);
|
|
4134
|
+
var CenturyView$1 = CenturyView;
|
|
4127
4135
|
|
|
4128
4136
|
var __assign$a = (undefined && undefined.__assign) || function () {
|
|
4129
4137
|
__assign$a = Object.assign || function(t) {
|
|
@@ -4136,7 +4144,7 @@ var __assign$a = (undefined && undefined.__assign) || function () {
|
|
|
4136
4144
|
};
|
|
4137
4145
|
return __assign$a.apply(this, arguments);
|
|
4138
4146
|
};
|
|
4139
|
-
var __rest$
|
|
4147
|
+
var __rest$7 = (undefined && undefined.__rest) || function (s, e) {
|
|
4140
4148
|
var t = {};
|
|
4141
4149
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4142
4150
|
t[p] = s[p];
|
|
@@ -4158,11 +4166,10 @@ var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, fr
|
|
|
4158
4166
|
};
|
|
4159
4167
|
var className$4 = 'react-calendar__decade-view__years__year';
|
|
4160
4168
|
function Year(_a) {
|
|
4161
|
-
var _b = _a.classes, classes = _b === void 0 ? [] : _b, _c = _a.formatYear, formatYear$1 = _c === void 0 ? formatYear : _c, otherProps = __rest$
|
|
4169
|
+
var _b = _a.classes, classes = _b === void 0 ? [] : _b, _c = _a.formatYear, formatYear$1 = _c === void 0 ? formatYear : _c, otherProps = __rest$7(_a, ["classes", "formatYear"]);
|
|
4162
4170
|
var date = otherProps.date, locale = otherProps.locale;
|
|
4163
|
-
return (React.createElement(Tile
|
|
4171
|
+
return (React.createElement(Tile, __assign$a({}, otherProps, { classes: __spreadArray$1(__spreadArray$1([], classes, true), [className$4], false), maxDateTransform: getYearEnd, minDateTransform: getYearStart, view: "decade" }), formatYear$1(locale, date)));
|
|
4164
4172
|
}
|
|
4165
|
-
Year.propTypes = __assign$a(__assign$a({}, tileProps), { formatYear: PropTypes.func });
|
|
4166
4173
|
|
|
4167
4174
|
var __assign$9 = (undefined && undefined.__assign) || function () {
|
|
4168
4175
|
__assign$9 = Object.assign || function(t) {
|
|
@@ -4175,18 +4182,26 @@ var __assign$9 = (undefined && undefined.__assign) || function () {
|
|
|
4175
4182
|
};
|
|
4176
4183
|
return __assign$9.apply(this, arguments);
|
|
4177
4184
|
};
|
|
4185
|
+
var __rest$6 = (undefined && undefined.__rest) || function (s, e) {
|
|
4186
|
+
var t = {};
|
|
4187
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4188
|
+
t[p] = s[p];
|
|
4189
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
4190
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
4191
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
4192
|
+
t[p[i]] = s[p[i]];
|
|
4193
|
+
}
|
|
4194
|
+
return t;
|
|
4195
|
+
};
|
|
4178
4196
|
function Years(props) {
|
|
4179
|
-
var activeStartDate = props.activeStartDate;
|
|
4197
|
+
var activeStartDate = props.activeStartDate, hover = props.hover, value = props.value, valueType = props.valueType, otherProps = __rest$6(props, ["activeStartDate", "hover", "value", "valueType"]);
|
|
4180
4198
|
var start = getBeginOfDecadeYear(activeStartDate);
|
|
4181
4199
|
var end = start + 9;
|
|
4182
|
-
return (React.createElement(TileGroup,
|
|
4183
|
-
var date =
|
|
4184
|
-
date.
|
|
4185
|
-
|
|
4186
|
-
return date;
|
|
4187
|
-
}, dateType: "year", end: end, start: start, tile: Year })));
|
|
4200
|
+
return (React.createElement(TileGroup, { className: "react-calendar__decade-view__years", dateTransform: getYearStart, dateType: "year", end: end, hover: hover, renderTile: function (_a) {
|
|
4201
|
+
var date = _a.date, otherTileProps = __rest$6(_a, ["date"]);
|
|
4202
|
+
return (React.createElement(Year, __assign$9({ key: date.getTime() }, otherProps, otherTileProps, { activeStartDate: activeStartDate, date: date })));
|
|
4203
|
+
}, start: start, value: value, valueType: valueType }));
|
|
4188
4204
|
}
|
|
4189
|
-
Years.propTypes = __assign$9({}, tileGroupProps);
|
|
4190
4205
|
|
|
4191
4206
|
var __assign$8 = (undefined && undefined.__assign) || function () {
|
|
4192
4207
|
__assign$8 = Object.assign || function(t) {
|
|
@@ -4199,12 +4214,14 @@ var __assign$8 = (undefined && undefined.__assign) || function () {
|
|
|
4199
4214
|
};
|
|
4200
4215
|
return __assign$8.apply(this, arguments);
|
|
4201
4216
|
};
|
|
4202
|
-
function DecadeView(props) {
|
|
4217
|
+
var DecadeView = function DecadeView(props) {
|
|
4203
4218
|
function renderYears() {
|
|
4204
4219
|
return React.createElement(Years, __assign$8({}, props));
|
|
4205
4220
|
}
|
|
4206
4221
|
return React.createElement("div", { className: "react-calendar__decade-view" }, renderYears());
|
|
4207
|
-
}
|
|
4222
|
+
};
|
|
4223
|
+
DecadeView.propTypes = __assign$8({}, tileGroupProps);
|
|
4224
|
+
var DecadeView$1 = DecadeView;
|
|
4208
4225
|
|
|
4209
4226
|
var __assign$7 = (undefined && undefined.__assign) || function () {
|
|
4210
4227
|
__assign$7 = Object.assign || function(t) {
|
|
@@ -4241,9 +4258,8 @@ var className$3 = 'react-calendar__year-view__months__month';
|
|
|
4241
4258
|
function Month(_a) {
|
|
4242
4259
|
var _b = _a.classes, classes = _b === void 0 ? [] : _b, _c = _a.formatMonth, formatMonth$1 = _c === void 0 ? formatMonth : _c, _d = _a.formatMonthYear, formatMonthYear$1 = _d === void 0 ? formatMonthYear : _d, otherProps = __rest$5(_a, ["classes", "formatMonth", "formatMonthYear"]);
|
|
4243
4260
|
var date = otherProps.date, locale = otherProps.locale;
|
|
4244
|
-
return (React.createElement(Tile
|
|
4261
|
+
return (React.createElement(Tile, __assign$7({}, otherProps, { classes: __spreadArray(__spreadArray([], classes, true), [className$3], false), formatAbbr: formatMonthYear$1, maxDateTransform: getMonthEnd, minDateTransform: getMonthStart, view: "year" }), formatMonth$1(locale, date)));
|
|
4245
4262
|
}
|
|
4246
|
-
Month.propTypes = __assign$7(__assign$7({}, tileProps), { formatMonth: PropTypes.func, formatMonthYear: PropTypes.func });
|
|
4247
4263
|
|
|
4248
4264
|
var __assign$6 = (undefined && undefined.__assign) || function () {
|
|
4249
4265
|
__assign$6 = Object.assign || function(t) {
|
|
@@ -4256,19 +4272,31 @@ var __assign$6 = (undefined && undefined.__assign) || function () {
|
|
|
4256
4272
|
};
|
|
4257
4273
|
return __assign$6.apply(this, arguments);
|
|
4258
4274
|
};
|
|
4275
|
+
var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
|
|
4276
|
+
var t = {};
|
|
4277
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4278
|
+
t[p] = s[p];
|
|
4279
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
4280
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
4281
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
4282
|
+
t[p[i]] = s[p[i]];
|
|
4283
|
+
}
|
|
4284
|
+
return t;
|
|
4285
|
+
};
|
|
4259
4286
|
function Months(props) {
|
|
4260
|
-
var activeStartDate = props.activeStartDate;
|
|
4287
|
+
var activeStartDate = props.activeStartDate, hover = props.hover, value = props.value, valueType = props.valueType, otherProps = __rest$4(props, ["activeStartDate", "hover", "value", "valueType"]);
|
|
4261
4288
|
var start = 0;
|
|
4262
4289
|
var end = 11;
|
|
4263
4290
|
var year = getYear(activeStartDate);
|
|
4264
|
-
return (React.createElement(TileGroup,
|
|
4291
|
+
return (React.createElement(TileGroup, { className: "react-calendar__year-view__months", dateTransform: function (monthIndex) {
|
|
4265
4292
|
var date = new Date();
|
|
4266
4293
|
date.setFullYear(year, monthIndex, 1);
|
|
4267
|
-
date
|
|
4268
|
-
|
|
4269
|
-
|
|
4294
|
+
return getMonthStart(date);
|
|
4295
|
+
}, dateType: "month", end: end, hover: hover, renderTile: function (_a) {
|
|
4296
|
+
var date = _a.date, otherTileProps = __rest$4(_a, ["date"]);
|
|
4297
|
+
return (React.createElement(Month, __assign$6({ key: date.getTime() }, otherProps, otherTileProps, { activeStartDate: activeStartDate, date: date })));
|
|
4298
|
+
}, start: start, value: value, valueType: valueType }));
|
|
4270
4299
|
}
|
|
4271
|
-
Months.propTypes = __assign$6(__assign$6({}, tileGroupProps), { locale: PropTypes.string });
|
|
4272
4300
|
|
|
4273
4301
|
var __assign$5 = (undefined && undefined.__assign) || function () {
|
|
4274
4302
|
__assign$5 = Object.assign || function(t) {
|
|
@@ -4281,12 +4309,14 @@ var __assign$5 = (undefined && undefined.__assign) || function () {
|
|
|
4281
4309
|
};
|
|
4282
4310
|
return __assign$5.apply(this, arguments);
|
|
4283
4311
|
};
|
|
4284
|
-
function YearView(props) {
|
|
4312
|
+
var YearView = function YearView(props) {
|
|
4285
4313
|
function renderMonths() {
|
|
4286
4314
|
return React.createElement(Months, __assign$5({}, props));
|
|
4287
4315
|
}
|
|
4288
4316
|
return React.createElement("div", { className: "react-calendar__year-view" }, renderMonths());
|
|
4289
|
-
}
|
|
4317
|
+
};
|
|
4318
|
+
YearView.propTypes = __assign$5({}, tileGroupProps);
|
|
4319
|
+
var YearView$1 = YearView;
|
|
4290
4320
|
|
|
4291
4321
|
var __assign$4 = (undefined && undefined.__assign) || function () {
|
|
4292
4322
|
__assign$4 = Object.assign || function(t) {
|
|
@@ -4299,7 +4329,7 @@ var __assign$4 = (undefined && undefined.__assign) || function () {
|
|
|
4299
4329
|
};
|
|
4300
4330
|
return __assign$4.apply(this, arguments);
|
|
4301
4331
|
};
|
|
4302
|
-
var __rest$
|
|
4332
|
+
var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
|
|
4303
4333
|
var t = {};
|
|
4304
4334
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4305
4335
|
t[p] = s[p];
|
|
@@ -4312,7 +4342,8 @@ var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
|
|
|
4312
4342
|
};
|
|
4313
4343
|
var className$2 = 'react-calendar__month-view__days__day';
|
|
4314
4344
|
function Day(_a) {
|
|
4315
|
-
var
|
|
4345
|
+
var calendarTypeOrDeprecatedCalendarType = _a.calendarType, _b = _a.classes, classes = _b === void 0 ? [] : _b, currentMonthIndex = _a.currentMonthIndex, _c = _a.formatDay, formatDay$1 = _c === void 0 ? formatDay : _c, _d = _a.formatLongDate, formatLongDate$1 = _d === void 0 ? formatLongDate : _d, otherProps = __rest$3(_a, ["calendarType", "classes", "currentMonthIndex", "formatDay", "formatLongDate"]);
|
|
4346
|
+
var calendarType = mapCalendarType(calendarTypeOrDeprecatedCalendarType);
|
|
4316
4347
|
var date = otherProps.date, locale = otherProps.locale;
|
|
4317
4348
|
var classesProps = [];
|
|
4318
4349
|
if (classes) {
|
|
@@ -4327,9 +4358,8 @@ function Day(_a) {
|
|
|
4327
4358
|
if (date.getMonth() !== currentMonthIndex) {
|
|
4328
4359
|
classesProps.push("".concat(className$2, "--neighboringMonth"));
|
|
4329
4360
|
}
|
|
4330
|
-
return (React.createElement(Tile
|
|
4361
|
+
return (React.createElement(Tile, __assign$4({}, otherProps, { classes: classesProps, formatAbbr: formatLongDate$1, maxDateTransform: getDayEnd, minDateTransform: getDayStart, view: "month" }), formatDay$1(locale, date)));
|
|
4331
4362
|
}
|
|
4332
|
-
Day.propTypes = __assign$4(__assign$4({}, tileProps), { currentMonthIndex: PropTypes.number.isRequired, formatDay: PropTypes.func, formatLongDate: PropTypes.func });
|
|
4333
4363
|
|
|
4334
4364
|
var __assign$3 = (undefined && undefined.__assign) || function () {
|
|
4335
4365
|
__assign$3 = Object.assign || function(t) {
|
|
@@ -4342,7 +4372,7 @@ var __assign$3 = (undefined && undefined.__assign) || function () {
|
|
|
4342
4372
|
};
|
|
4343
4373
|
return __assign$3.apply(this, arguments);
|
|
4344
4374
|
};
|
|
4345
|
-
var __rest$
|
|
4375
|
+
var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
|
|
4346
4376
|
var t = {};
|
|
4347
4377
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4348
4378
|
t[p] = s[p];
|
|
@@ -4354,8 +4384,8 @@ var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
|
|
|
4354
4384
|
return t;
|
|
4355
4385
|
};
|
|
4356
4386
|
function Days(props) {
|
|
4357
|
-
var activeStartDate = props.activeStartDate, calendarType = props.calendarType;
|
|
4358
|
-
var
|
|
4387
|
+
var activeStartDate = props.activeStartDate, calendarTypeOrDeprecatedCalendarType = props.calendarType, hover = props.hover, showFixedNumberOfWeeks = props.showFixedNumberOfWeeks, showNeighboringMonth = props.showNeighboringMonth, value = props.value, valueType = props.valueType, otherProps = __rest$2(props, ["activeStartDate", "calendarType", "hover", "showFixedNumberOfWeeks", "showNeighboringMonth", "value", "valueType"]);
|
|
4388
|
+
var calendarType = mapCalendarType(calendarTypeOrDeprecatedCalendarType);
|
|
4359
4389
|
var year = getYear(activeStartDate);
|
|
4360
4390
|
var monthIndex = getMonth(activeStartDate);
|
|
4361
4391
|
var hasFixedNumberOfWeeks = showFixedNumberOfWeeks || showNeighboringMonth;
|
|
@@ -4387,19 +4417,21 @@ function Days(props) {
|
|
|
4387
4417
|
}
|
|
4388
4418
|
return daysInMonth;
|
|
4389
4419
|
})();
|
|
4390
|
-
return (React.createElement(TileGroup,
|
|
4420
|
+
return (React.createElement(TileGroup, { className: "react-calendar__month-view__days", count: 7, dateTransform: function (day) {
|
|
4391
4421
|
var date = new Date();
|
|
4392
4422
|
date.setFullYear(year, monthIndex, day);
|
|
4393
|
-
date
|
|
4394
|
-
|
|
4395
|
-
|
|
4423
|
+
return getDayStart(date);
|
|
4424
|
+
}, dateType: "day", hover: hover, end: end, renderTile: function (_a) {
|
|
4425
|
+
var date = _a.date, otherTileProps = __rest$2(_a, ["date"]);
|
|
4426
|
+
return (React.createElement(Day, __assign$3({ key: date.getTime() }, otherProps, otherTileProps, { activeStartDate: activeStartDate, calendarType: calendarTypeOrDeprecatedCalendarType, currentMonthIndex: monthIndex, date: date })));
|
|
4427
|
+
}, offset: offset, start: start, value: value, valueType: valueType }));
|
|
4396
4428
|
}
|
|
4397
|
-
Days.propTypes = __assign$3({ calendarType: isCalendarType, showFixedNumberOfWeeks: PropTypes.bool, showNeighboringMonth: PropTypes.bool }, tileGroupProps);
|
|
4398
4429
|
|
|
4399
4430
|
var className$1 = 'react-calendar__month-view__weekdays';
|
|
4400
4431
|
var weekdayClassName = "".concat(className$1, "__weekday");
|
|
4401
4432
|
function Weekdays(props) {
|
|
4402
|
-
var
|
|
4433
|
+
var calendarTypeOrDeprecatedCalendarType = props.calendarType, _a = props.formatShortWeekday, formatShortWeekday$1 = _a === void 0 ? formatShortWeekday : _a, _b = props.formatWeekday, formatWeekday$1 = _b === void 0 ? formatWeekday : _b, locale = props.locale, onMouseLeave = props.onMouseLeave;
|
|
4434
|
+
var calendarType = mapCalendarType(calendarTypeOrDeprecatedCalendarType);
|
|
4403
4435
|
var anyDate = new Date();
|
|
4404
4436
|
var beginOfMonth = getMonthStart(anyDate);
|
|
4405
4437
|
var year = getYear(beginOfMonth);
|
|
@@ -4413,13 +4445,6 @@ function Weekdays(props) {
|
|
|
4413
4445
|
}
|
|
4414
4446
|
return (React.createElement(Flex, { className: className$1, count: 7, onFocus: onMouseLeave, onMouseOver: onMouseLeave }, weekdays));
|
|
4415
4447
|
}
|
|
4416
|
-
Weekdays.propTypes = {
|
|
4417
|
-
calendarType: isCalendarType,
|
|
4418
|
-
formatShortWeekday: PropTypes.func,
|
|
4419
|
-
formatWeekday: PropTypes.func,
|
|
4420
|
-
locale: PropTypes.string,
|
|
4421
|
-
onMouseLeave: PropTypes.func,
|
|
4422
|
-
};
|
|
4423
4448
|
|
|
4424
4449
|
var __assign$2 = (undefined && undefined.__assign) || function () {
|
|
4425
4450
|
__assign$2 = Object.assign || function(t) {
|
|
@@ -4432,7 +4457,7 @@ var __assign$2 = (undefined && undefined.__assign) || function () {
|
|
|
4432
4457
|
};
|
|
4433
4458
|
return __assign$2.apply(this, arguments);
|
|
4434
4459
|
};
|
|
4435
|
-
var __rest$
|
|
4460
|
+
var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
|
|
4436
4461
|
var t = {};
|
|
4437
4462
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4438
4463
|
t[p] = s[p];
|
|
@@ -4448,22 +4473,18 @@ function WeekNumber(props) {
|
|
|
4448
4473
|
var onClickWeekNumber = props.onClickWeekNumber, weekNumber = props.weekNumber;
|
|
4449
4474
|
var children = React.createElement("span", null, weekNumber);
|
|
4450
4475
|
if (onClickWeekNumber) {
|
|
4451
|
-
var date_1 = props.date, onClickWeekNumber_1 = props.onClickWeekNumber, weekNumber_1 = props.weekNumber, otherProps = __rest$
|
|
4476
|
+
var date_1 = props.date, onClickWeekNumber_1 = props.onClickWeekNumber, weekNumber_1 = props.weekNumber, otherProps = __rest$1(props, ["date", "onClickWeekNumber", "weekNumber"]);
|
|
4452
4477
|
return (React.createElement("button", __assign$2({}, otherProps, { className: className, onClick: function (event) { return onClickWeekNumber_1(weekNumber_1, date_1, event); }, type: "button" }), children));
|
|
4453
4478
|
}
|
|
4454
4479
|
else {
|
|
4455
|
-
props.date; props.onClickWeekNumber; props.weekNumber; var otherProps = __rest$
|
|
4480
|
+
props.date; props.onClickWeekNumber; props.weekNumber; var otherProps = __rest$1(props, ["date", "onClickWeekNumber", "weekNumber"]);
|
|
4456
4481
|
return (React.createElement("div", __assign$2({}, otherProps, { className: className }), children));
|
|
4457
4482
|
}
|
|
4458
4483
|
}
|
|
4459
|
-
WeekNumber.propTypes = {
|
|
4460
|
-
date: PropTypes.instanceOf(Date).isRequired,
|
|
4461
|
-
onClickWeekNumber: PropTypes.func,
|
|
4462
|
-
weekNumber: PropTypes.node.isRequired,
|
|
4463
|
-
};
|
|
4464
4484
|
|
|
4465
4485
|
function WeekNumbers(props) {
|
|
4466
|
-
var activeStartDate = props.activeStartDate,
|
|
4486
|
+
var activeStartDate = props.activeStartDate, calendarTypeOrDeprecatedCalendarType = props.calendarType, onClickWeekNumber = props.onClickWeekNumber, onMouseLeave = props.onMouseLeave, showFixedNumberOfWeeks = props.showFixedNumberOfWeeks;
|
|
4487
|
+
var calendarType = mapCalendarType(calendarTypeOrDeprecatedCalendarType);
|
|
4467
4488
|
var numberOfWeeks = (function () {
|
|
4468
4489
|
if (showFixedNumberOfWeeks) {
|
|
4469
4490
|
return 6;
|
|
@@ -4492,13 +4513,6 @@ function WeekNumbers(props) {
|
|
|
4492
4513
|
return (React.createElement(WeekNumber, { key: weekNumber, date: date, onClickWeekNumber: onClickWeekNumber, weekNumber: weekNumber }));
|
|
4493
4514
|
})));
|
|
4494
4515
|
}
|
|
4495
|
-
WeekNumbers.propTypes = {
|
|
4496
|
-
activeStartDate: PropTypes.instanceOf(Date).isRequired,
|
|
4497
|
-
calendarType: isCalendarType,
|
|
4498
|
-
onClickWeekNumber: PropTypes.func,
|
|
4499
|
-
onMouseLeave: PropTypes.func,
|
|
4500
|
-
showFixedNumberOfWeeks: PropTypes.bool,
|
|
4501
|
-
};
|
|
4502
4516
|
|
|
4503
4517
|
var __assign$1 = (undefined && undefined.__assign) || function () {
|
|
4504
4518
|
__assign$1 = Object.assign || function(t) {
|
|
@@ -4511,7 +4525,7 @@ var __assign$1 = (undefined && undefined.__assign) || function () {
|
|
|
4511
4525
|
};
|
|
4512
4526
|
return __assign$1.apply(this, arguments);
|
|
4513
4527
|
};
|
|
4514
|
-
var __rest
|
|
4528
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
4515
4529
|
var t = {};
|
|
4516
4530
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4517
4531
|
t[p] = s[p];
|
|
@@ -4523,17 +4537,19 @@ var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
|
|
|
4523
4537
|
return t;
|
|
4524
4538
|
};
|
|
4525
4539
|
function getCalendarTypeFromLocale(locale) {
|
|
4526
|
-
|
|
4527
|
-
var
|
|
4528
|
-
|
|
4529
|
-
|
|
4540
|
+
if (locale) {
|
|
4541
|
+
for (var _i = 0, _a = Object.entries(CALENDAR_TYPE_LOCALES); _i < _a.length; _i++) {
|
|
4542
|
+
var _b = _a[_i], calendarType = _b[0], locales = _b[1];
|
|
4543
|
+
if (locales.includes(locale)) {
|
|
4544
|
+
return calendarType;
|
|
4545
|
+
}
|
|
4530
4546
|
}
|
|
4531
4547
|
}
|
|
4532
4548
|
return CALENDAR_TYPES.ISO_8601;
|
|
4533
4549
|
}
|
|
4534
|
-
function MonthView(props) {
|
|
4550
|
+
var MonthView = function MonthView(props) {
|
|
4535
4551
|
var activeStartDate = props.activeStartDate, locale = props.locale, onMouseLeave = props.onMouseLeave, showFixedNumberOfWeeks = props.showFixedNumberOfWeeks;
|
|
4536
|
-
var _a = props.calendarType, calendarType = _a === void 0 ? getCalendarTypeFromLocale(locale) : _a, formatShortWeekday = props.formatShortWeekday, formatWeekday = props.formatWeekday, onClickWeekNumber = props.onClickWeekNumber, showWeekNumbers = props.showWeekNumbers, childProps = __rest
|
|
4552
|
+
var _a = props.calendarType, calendarType = _a === void 0 ? getCalendarTypeFromLocale(locale) : _a, formatShortWeekday = props.formatShortWeekday, formatWeekday = props.formatWeekday, onClickWeekNumber = props.onClickWeekNumber, showWeekNumbers = props.showWeekNumbers, childProps = __rest(props, ["calendarType", "formatShortWeekday", "formatWeekday", "onClickWeekNumber", "showWeekNumbers"]);
|
|
4537
4553
|
function renderWeekdays() {
|
|
4538
4554
|
return (React.createElement(Weekdays, { calendarType: calendarType, formatShortWeekday: formatShortWeekday, formatWeekday: formatWeekday, locale: locale, onMouseLeave: onMouseLeave }));
|
|
4539
4555
|
}
|
|
@@ -4559,24 +4575,10 @@ function MonthView(props) {
|
|
|
4559
4575
|
} },
|
|
4560
4576
|
renderWeekdays(),
|
|
4561
4577
|
renderDays()))));
|
|
4562
|
-
}
|
|
4578
|
+
};
|
|
4563
4579
|
MonthView.propTypes = __assign$1(__assign$1({}, tileGroupProps), { calendarType: isCalendarType, formatDay: PropTypes.func, formatLongDate: PropTypes.func, formatShortWeekday: PropTypes.func, formatWeekday: PropTypes.func, onClickWeekNumber: PropTypes.func, onMouseLeave: PropTypes.func, showFixedNumberOfWeeks: PropTypes.bool, showNeighboringMonth: PropTypes.bool, showWeekNumbers: PropTypes.bool });
|
|
4580
|
+
var MonthView$1 = MonthView;
|
|
4564
4581
|
|
|
4565
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
|
4566
|
-
var extendStatics = function (d, b) {
|
|
4567
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4568
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
4569
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
4570
|
-
return extendStatics(d, b);
|
|
4571
|
-
};
|
|
4572
|
-
return function (d, b) {
|
|
4573
|
-
if (typeof b !== "function" && b !== null)
|
|
4574
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
4575
|
-
extendStatics(d, b);
|
|
4576
|
-
function __() { this.constructor = d; }
|
|
4577
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
4578
|
-
};
|
|
4579
|
-
})();
|
|
4580
4582
|
var __assign = (undefined && undefined.__assign) || function () {
|
|
4581
4583
|
__assign = Object.assign || function(t) {
|
|
4582
4584
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -4588,17 +4590,6 @@ var __assign = (undefined && undefined.__assign) || function () {
|
|
|
4588
4590
|
};
|
|
4589
4591
|
return __assign.apply(this, arguments);
|
|
4590
4592
|
};
|
|
4591
|
-
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
4592
|
-
var t = {};
|
|
4593
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4594
|
-
t[p] = s[p];
|
|
4595
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
4596
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
4597
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
4598
|
-
t[p[i]] = s[p[i]];
|
|
4599
|
-
}
|
|
4600
|
-
return t;
|
|
4601
|
-
};
|
|
4602
4593
|
var baseClassName = 'react-calendar';
|
|
4603
4594
|
var allViews = ['century', 'decade', 'year', 'month'];
|
|
4604
4595
|
var allValueTypes = ['decade', 'year', 'month', 'day'];
|
|
@@ -4606,16 +4597,6 @@ var defaultMinDate = new Date();
|
|
|
4606
4597
|
defaultMinDate.setFullYear(1, 0, 1);
|
|
4607
4598
|
defaultMinDate.setHours(0, 0, 0, 0);
|
|
4608
4599
|
var defaultMaxDate = new Date(8.64e15);
|
|
4609
|
-
var defaultProps = {
|
|
4610
|
-
goToRangeStartOnSelect: true,
|
|
4611
|
-
maxDate: defaultMaxDate,
|
|
4612
|
-
maxDetail: 'month',
|
|
4613
|
-
minDate: defaultMinDate,
|
|
4614
|
-
minDetail: 'century',
|
|
4615
|
-
returnValue: 'start',
|
|
4616
|
-
showNavigation: true,
|
|
4617
|
-
showNeighboringMonth: true,
|
|
4618
|
-
};
|
|
4619
4600
|
function toDate(value) {
|
|
4620
4601
|
if (value instanceof Date) {
|
|
4621
4602
|
return value;
|
|
@@ -4690,8 +4671,8 @@ var getDetailValueTo = function (args) { return getDetailValue(args, 1); };
|
|
|
4690
4671
|
var getDetailValueArray = function (args) {
|
|
4691
4672
|
return [getDetailValueFrom, getDetailValueTo].map(function (fn) { return fn(args); });
|
|
4692
4673
|
};
|
|
4693
|
-
function getActiveStartDate(
|
|
4694
|
-
var maxDate =
|
|
4674
|
+
function getActiveStartDate(_a) {
|
|
4675
|
+
var maxDate = _a.maxDate, maxDetail = _a.maxDetail, minDate = _a.minDate, minDetail = _a.minDetail, value = _a.value, view = _a.view;
|
|
4695
4676
|
var rangeType = getView(view, minDetail, maxDetail);
|
|
4696
4677
|
var valueFrom = getDetailValueFrom({
|
|
4697
4678
|
value: value,
|
|
@@ -4701,316 +4682,76 @@ function getActiveStartDate(props) {
|
|
|
4701
4682
|
}) || new Date();
|
|
4702
4683
|
return getBegin(rangeType, valueFrom);
|
|
4703
4684
|
}
|
|
4704
|
-
function getInitialActiveStartDate(
|
|
4705
|
-
var activeStartDate =
|
|
4685
|
+
function getInitialActiveStartDate(_a) {
|
|
4686
|
+
var activeStartDate = _a.activeStartDate, defaultActiveStartDate = _a.defaultActiveStartDate, defaultValue = _a.defaultValue, defaultView = _a.defaultView, maxDate = _a.maxDate, maxDetail = _a.maxDetail, minDate = _a.minDate, minDetail = _a.minDetail, value = _a.value, view = _a.view;
|
|
4706
4687
|
var rangeType = getView(view, minDetail, maxDetail);
|
|
4707
4688
|
var valueFrom = activeStartDate || defaultActiveStartDate;
|
|
4708
4689
|
if (valueFrom) {
|
|
4709
4690
|
return getBegin(rangeType, valueFrom);
|
|
4710
4691
|
}
|
|
4711
|
-
return getActiveStartDate(
|
|
4692
|
+
return getActiveStartDate({
|
|
4693
|
+
maxDate: maxDate,
|
|
4694
|
+
maxDetail: maxDetail,
|
|
4695
|
+
minDate: minDate,
|
|
4696
|
+
minDetail: minDetail,
|
|
4697
|
+
value: value || defaultValue,
|
|
4698
|
+
view: view || defaultView,
|
|
4699
|
+
});
|
|
4712
4700
|
}
|
|
4713
4701
|
function getIsSingleValue(value) {
|
|
4714
4702
|
return value && (!Array.isArray(value) || value.length === 1);
|
|
4715
4703
|
}
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
var Calendar =
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
view: ('view' in nextState && nextState.view) || _this.view,
|
|
4749
|
-
};
|
|
4750
|
-
function shouldUpdate(key) {
|
|
4751
|
-
// Key must exist, and…
|
|
4752
|
-
if (!(key in nextState)) {
|
|
4753
|
-
return false;
|
|
4754
|
-
}
|
|
4755
|
-
var nextValue = nextState[key];
|
|
4756
|
-
var prevValue = prevArgs[key];
|
|
4757
|
-
// …key changed from defined to undefined or the other way around, or…
|
|
4758
|
-
if (typeof nextValue !== typeof prevValue) {
|
|
4759
|
-
return true;
|
|
4760
|
-
}
|
|
4761
|
-
// …value changed.
|
|
4762
|
-
if (nextValue instanceof Date && prevValue instanceof Date) {
|
|
4763
|
-
return nextValue.getTime() !== prevValue.getTime();
|
|
4764
|
-
}
|
|
4765
|
-
else {
|
|
4766
|
-
return nextValue !== prevValue;
|
|
4767
|
-
}
|
|
4768
|
-
}
|
|
4769
|
-
if (shouldUpdate('activeStartDate')) {
|
|
4770
|
-
if (onActiveStartDateChange)
|
|
4771
|
-
onActiveStartDateChange(args);
|
|
4772
|
-
}
|
|
4773
|
-
if (shouldUpdate('view')) {
|
|
4774
|
-
if (onViewChange)
|
|
4775
|
-
onViewChange(args);
|
|
4776
|
-
}
|
|
4777
|
-
if (shouldUpdate('value')) {
|
|
4778
|
-
if (onChange) {
|
|
4779
|
-
if (!event) {
|
|
4780
|
-
throw new Error('event is required');
|
|
4781
|
-
}
|
|
4782
|
-
if (selectRange) {
|
|
4783
|
-
var isSingleValue = getIsSingleValue(nextState.value);
|
|
4784
|
-
if (!isSingleValue) {
|
|
4785
|
-
onChange(nextState.value || null, event);
|
|
4786
|
-
}
|
|
4787
|
-
else if (allowPartialRange) {
|
|
4788
|
-
if (Array.isArray(nextState.value)) {
|
|
4789
|
-
throw new Error('value must not be an array');
|
|
4790
|
-
}
|
|
4791
|
-
onChange([nextState.value || null, null], event);
|
|
4792
|
-
}
|
|
4793
|
-
}
|
|
4794
|
-
else {
|
|
4795
|
-
onChange(nextState.value || null, event);
|
|
4796
|
-
}
|
|
4797
|
-
}
|
|
4798
|
-
}
|
|
4799
|
-
if (callback)
|
|
4800
|
-
callback(args);
|
|
4801
|
-
});
|
|
4802
|
-
};
|
|
4803
|
-
/**
|
|
4804
|
-
* Called when the user uses navigation buttons.
|
|
4805
|
-
*/
|
|
4806
|
-
_this.setActiveStartDate = function (nextActiveStartDate, action) {
|
|
4807
|
-
_this.setStateAndCallCallbacks({
|
|
4808
|
-
action: action,
|
|
4809
|
-
activeStartDate: nextActiveStartDate,
|
|
4810
|
-
});
|
|
4811
|
-
};
|
|
4812
|
-
_this.drillDown = function (nextActiveStartDate, event) {
|
|
4813
|
-
if (!_this.drillDownAvailable) {
|
|
4814
|
-
return;
|
|
4815
|
-
}
|
|
4816
|
-
_this.onClickTile(nextActiveStartDate, event);
|
|
4817
|
-
var _a = _this, view = _a.view, views = _a.views;
|
|
4818
|
-
var onDrillDown = _this.props.onDrillDown;
|
|
4819
|
-
var nextView = views[views.indexOf(view) + 1];
|
|
4820
|
-
if (!nextView) {
|
|
4821
|
-
throw new Error('Attempted to drill down from the lowest view.');
|
|
4822
|
-
}
|
|
4823
|
-
_this.setStateAndCallCallbacks({
|
|
4824
|
-
action: 'drillDown',
|
|
4825
|
-
activeStartDate: nextActiveStartDate,
|
|
4826
|
-
view: nextView,
|
|
4827
|
-
}, undefined, onDrillDown);
|
|
4828
|
-
};
|
|
4829
|
-
_this.drillUp = function () {
|
|
4830
|
-
if (!_this.drillUpAvailable) {
|
|
4831
|
-
return;
|
|
4832
|
-
}
|
|
4833
|
-
var _a = _this, activeStartDate = _a.activeStartDate, view = _a.view, views = _a.views;
|
|
4834
|
-
var onDrillUp = _this.props.onDrillUp;
|
|
4835
|
-
var nextView = views[views.indexOf(view) - 1];
|
|
4836
|
-
if (!nextView) {
|
|
4837
|
-
throw new Error('Attempted to drill up from the highest view.');
|
|
4838
|
-
}
|
|
4839
|
-
var nextActiveStartDate = getBegin(nextView, activeStartDate);
|
|
4840
|
-
_this.setStateAndCallCallbacks({
|
|
4841
|
-
action: 'drillUp',
|
|
4842
|
-
activeStartDate: nextActiveStartDate,
|
|
4843
|
-
view: nextView,
|
|
4844
|
-
}, undefined, onDrillUp);
|
|
4845
|
-
};
|
|
4846
|
-
_this.onChange = function (value, event) {
|
|
4847
|
-
var previousValue = _this.value;
|
|
4848
|
-
var _a = _this.props, goToRangeStartOnSelect = _a.goToRangeStartOnSelect, selectRange = _a.selectRange;
|
|
4849
|
-
_this.onClickTile(value, event);
|
|
4850
|
-
var isFirstValueInRange = selectRange && !getIsSingleValue(previousValue);
|
|
4851
|
-
var nextValue;
|
|
4852
|
-
if (selectRange) {
|
|
4853
|
-
// Range selection turned on
|
|
4854
|
-
var valueType = _this.valueType;
|
|
4855
|
-
if (isFirstValueInRange) {
|
|
4856
|
-
// Value has 0 or 2 elements - either way we're starting a new array
|
|
4857
|
-
// First value
|
|
4858
|
-
nextValue = getBegin(valueType, value);
|
|
4859
|
-
}
|
|
4860
|
-
else {
|
|
4861
|
-
if (!previousValue) {
|
|
4862
|
-
throw new Error('previousValue is required');
|
|
4863
|
-
}
|
|
4864
|
-
if (Array.isArray(previousValue)) {
|
|
4865
|
-
throw new Error('previousValue must not be an array');
|
|
4866
|
-
}
|
|
4867
|
-
// Second value
|
|
4868
|
-
nextValue = getValueRange(valueType, previousValue, value);
|
|
4869
|
-
}
|
|
4870
|
-
}
|
|
4871
|
-
else {
|
|
4872
|
-
// Range selection turned off
|
|
4873
|
-
nextValue = _this.getProcessedValue(value);
|
|
4704
|
+
function areDatesEqual(date1, date2) {
|
|
4705
|
+
return date1 instanceof Date && date2 instanceof Date && date1.getTime() === date2.getTime();
|
|
4706
|
+
}
|
|
4707
|
+
var Calendar = forwardRef(function Calendar(props, ref) {
|
|
4708
|
+
var activeStartDateProps = props.activeStartDate, allowPartialRange = props.allowPartialRange, calendarType = props.calendarType, className = props.className, defaultActiveStartDate = props.defaultActiveStartDate, defaultValue = props.defaultValue, defaultView = props.defaultView, formatDay = props.formatDay, formatLongDate = props.formatLongDate, formatMonth = props.formatMonth, formatMonthYear = props.formatMonthYear, formatShortWeekday = props.formatShortWeekday, formatWeekday = props.formatWeekday, formatYear = props.formatYear, _a = props.goToRangeStartOnSelect, goToRangeStartOnSelect = _a === void 0 ? true : _a, inputRef = props.inputRef, locale = props.locale, _b = props.maxDate, maxDate = _b === void 0 ? defaultMaxDate : _b, _c = props.maxDetail, maxDetail = _c === void 0 ? 'month' : _c, _d = props.minDate, minDate = _d === void 0 ? defaultMinDate : _d, _e = props.minDetail, minDetail = _e === void 0 ? 'century' : _e, navigationAriaLabel = props.navigationAriaLabel, navigationAriaLive = props.navigationAriaLive, navigationLabel = props.navigationLabel, next2AriaLabel = props.next2AriaLabel, next2Label = props.next2Label, nextAriaLabel = props.nextAriaLabel, nextLabel = props.nextLabel, onActiveStartDateChange = props.onActiveStartDateChange, onChangeProps = props.onChange, onClickDay = props.onClickDay, onClickDecade = props.onClickDecade, onClickMonth = props.onClickMonth, onClickWeekNumber = props.onClickWeekNumber, onClickYear = props.onClickYear, onDrillDown = props.onDrillDown, onDrillUp = props.onDrillUp, onViewChange = props.onViewChange, prev2AriaLabel = props.prev2AriaLabel, prev2Label = props.prev2Label, prevAriaLabel = props.prevAriaLabel, prevLabel = props.prevLabel, _f = props.returnValue, returnValue = _f === void 0 ? 'start' : _f, selectRange = props.selectRange, showDoubleView = props.showDoubleView, showFixedNumberOfWeeks = props.showFixedNumberOfWeeks, _g = props.showNavigation, showNavigation = _g === void 0 ? true : _g, _h = props.showNeighboringMonth, showNeighboringMonth = _h === void 0 ? true : _h, showWeekNumbers = props.showWeekNumbers, tileClassName = props.tileClassName, tileContent = props.tileContent, tileDisabled = props.tileDisabled, valueProps = props.value, viewProps = props.view;
|
|
4709
|
+
var _j = useState(defaultActiveStartDate), activeStartDateState = _j[0], setActiveStartDateState = _j[1];
|
|
4710
|
+
var _k = useState(null), hoverState = _k[0], setHoverState = _k[1];
|
|
4711
|
+
var _l = useState(Array.isArray(defaultValue)
|
|
4712
|
+
? defaultValue.map(function (el) { return (el !== null ? toDate(el) : null); })
|
|
4713
|
+
: defaultValue !== null && defaultValue !== undefined
|
|
4714
|
+
? toDate(defaultValue)
|
|
4715
|
+
: null), valueState = _l[0], setValueState = _l[1];
|
|
4716
|
+
var _m = useState(defaultView), viewState = _m[0], setViewState = _m[1];
|
|
4717
|
+
var activeStartDate = activeStartDateProps ||
|
|
4718
|
+
activeStartDateState ||
|
|
4719
|
+
getInitialActiveStartDate({
|
|
4720
|
+
activeStartDate: activeStartDateProps,
|
|
4721
|
+
defaultActiveStartDate: defaultActiveStartDate,
|
|
4722
|
+
defaultValue: defaultValue,
|
|
4723
|
+
defaultView: defaultView,
|
|
4724
|
+
maxDate: maxDate,
|
|
4725
|
+
maxDetail: maxDetail,
|
|
4726
|
+
minDate: minDate,
|
|
4727
|
+
minDetail: minDetail,
|
|
4728
|
+
value: valueProps,
|
|
4729
|
+
view: viewProps,
|
|
4730
|
+
});
|
|
4731
|
+
var value = (function () {
|
|
4732
|
+
var rawValue = (function () {
|
|
4733
|
+
// In the middle of range selection, use value from state
|
|
4734
|
+
if (selectRange && getIsSingleValue(valueState)) {
|
|
4735
|
+
return valueState;
|
|
4874
4736
|
}
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4737
|
+
return valueProps !== undefined ? valueProps : valueState;
|
|
4738
|
+
})();
|
|
4739
|
+
if (!rawValue) {
|
|
4740
|
+
return null;
|
|
4741
|
+
}
|
|
4742
|
+
return Array.isArray(rawValue)
|
|
4743
|
+
? rawValue.map(function (el) { return (el !== null ? toDate(el) : null); })
|
|
4744
|
+
: rawValue !== null
|
|
4745
|
+
? toDate(rawValue)
|
|
4883
4746
|
: null;
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
var view = _this.view;
|
|
4893
|
-
var _a = _this
|
|
4894
|
-
.props, onClickDay = _a.onClickDay, onClickDecade = _a.onClickDecade, onClickMonth = _a.onClickMonth, onClickYear = _a.onClickYear;
|
|
4895
|
-
var callback = (function () {
|
|
4896
|
-
switch (view) {
|
|
4897
|
-
case 'century':
|
|
4898
|
-
return onClickDecade;
|
|
4899
|
-
case 'decade':
|
|
4900
|
-
return onClickYear;
|
|
4901
|
-
case 'year':
|
|
4902
|
-
return onClickMonth;
|
|
4903
|
-
case 'month':
|
|
4904
|
-
return onClickDay;
|
|
4905
|
-
default:
|
|
4906
|
-
throw new Error("Invalid view: ".concat(view, "."));
|
|
4907
|
-
}
|
|
4908
|
-
})();
|
|
4909
|
-
if (callback)
|
|
4910
|
-
callback(value, event);
|
|
4911
|
-
};
|
|
4912
|
-
_this.onMouseOver = function (value) {
|
|
4913
|
-
_this.setState(function (prevState) {
|
|
4914
|
-
if (prevState.hover && prevState.hover.getTime() === value.getTime()) {
|
|
4915
|
-
return null;
|
|
4916
|
-
}
|
|
4917
|
-
return { hover: value };
|
|
4918
|
-
});
|
|
4919
|
-
};
|
|
4920
|
-
_this.onMouseLeave = function () {
|
|
4921
|
-
_this.setState({ hover: null });
|
|
4922
|
-
};
|
|
4923
|
-
return _this;
|
|
4924
|
-
}
|
|
4925
|
-
Object.defineProperty(Calendar.prototype, "activeStartDate", {
|
|
4926
|
-
get: function () {
|
|
4927
|
-
var activeStartDateProps = this.props.activeStartDate;
|
|
4928
|
-
var activeStartDateState = this.state.activeStartDate;
|
|
4929
|
-
return (activeStartDateProps ||
|
|
4930
|
-
activeStartDateState ||
|
|
4931
|
-
getInitialActiveStartDate(this.props));
|
|
4932
|
-
},
|
|
4933
|
-
enumerable: false,
|
|
4934
|
-
configurable: true
|
|
4935
|
-
});
|
|
4936
|
-
Object.defineProperty(Calendar.prototype, "value", {
|
|
4937
|
-
get: function () {
|
|
4938
|
-
var _a = this.props, selectRange = _a.selectRange, valueProps = _a.value;
|
|
4939
|
-
var valueState = this.state.value;
|
|
4940
|
-
var rawValue = (function () {
|
|
4941
|
-
// In the middle of range selection, use value from state
|
|
4942
|
-
if (selectRange && getIsSingleValue(valueState)) {
|
|
4943
|
-
return valueState;
|
|
4944
|
-
}
|
|
4945
|
-
return valueProps !== undefined ? valueProps : valueState;
|
|
4946
|
-
})();
|
|
4947
|
-
if (!rawValue) {
|
|
4948
|
-
return null;
|
|
4949
|
-
}
|
|
4950
|
-
return Array.isArray(rawValue)
|
|
4951
|
-
? rawValue.map(function (el) { return (el !== null ? toDate(el) : el); })
|
|
4952
|
-
: rawValue !== null
|
|
4953
|
-
? toDate(rawValue)
|
|
4954
|
-
: rawValue;
|
|
4955
|
-
},
|
|
4956
|
-
enumerable: false,
|
|
4957
|
-
configurable: true
|
|
4958
|
-
});
|
|
4959
|
-
Object.defineProperty(Calendar.prototype, "valueType", {
|
|
4960
|
-
get: function () {
|
|
4961
|
-
var maxDetail = this.props.maxDetail;
|
|
4962
|
-
return getValueType(maxDetail);
|
|
4963
|
-
},
|
|
4964
|
-
enumerable: false,
|
|
4965
|
-
configurable: true
|
|
4966
|
-
});
|
|
4967
|
-
Object.defineProperty(Calendar.prototype, "view", {
|
|
4968
|
-
get: function () {
|
|
4969
|
-
var _a = this.props, minDetail = _a.minDetail, maxDetail = _a.maxDetail, viewProps = _a.view;
|
|
4970
|
-
var viewState = this.state.view;
|
|
4971
|
-
return getView(viewProps || viewState, minDetail, maxDetail);
|
|
4972
|
-
},
|
|
4973
|
-
enumerable: false,
|
|
4974
|
-
configurable: true
|
|
4975
|
-
});
|
|
4976
|
-
Object.defineProperty(Calendar.prototype, "views", {
|
|
4977
|
-
get: function () {
|
|
4978
|
-
var _a = this.props, minDetail = _a.minDetail, maxDetail = _a.maxDetail;
|
|
4979
|
-
return getLimitedViews(minDetail, maxDetail);
|
|
4980
|
-
},
|
|
4981
|
-
enumerable: false,
|
|
4982
|
-
configurable: true
|
|
4983
|
-
});
|
|
4984
|
-
Object.defineProperty(Calendar.prototype, "hover", {
|
|
4985
|
-
get: function () {
|
|
4986
|
-
var selectRange = this.props.selectRange;
|
|
4987
|
-
var hover = this.state.hover;
|
|
4988
|
-
return selectRange ? hover : null;
|
|
4989
|
-
},
|
|
4990
|
-
enumerable: false,
|
|
4991
|
-
configurable: true
|
|
4992
|
-
});
|
|
4993
|
-
Object.defineProperty(Calendar.prototype, "drillDownAvailable", {
|
|
4994
|
-
get: function () {
|
|
4995
|
-
var _a = this, view = _a.view, views = _a.views;
|
|
4996
|
-
return views.indexOf(view) < views.length - 1;
|
|
4997
|
-
},
|
|
4998
|
-
enumerable: false,
|
|
4999
|
-
configurable: true
|
|
5000
|
-
});
|
|
5001
|
-
Object.defineProperty(Calendar.prototype, "drillUpAvailable", {
|
|
5002
|
-
get: function () {
|
|
5003
|
-
var _a = this, view = _a.view, views = _a.views;
|
|
5004
|
-
return views.indexOf(view) > 0;
|
|
5005
|
-
},
|
|
5006
|
-
enumerable: false,
|
|
5007
|
-
configurable: true
|
|
5008
|
-
});
|
|
5009
|
-
/**
|
|
5010
|
-
* Gets current value in a desired format.
|
|
5011
|
-
*/
|
|
5012
|
-
Calendar.prototype.getProcessedValue = function (value) {
|
|
5013
|
-
var _a = this.props, minDate = _a.minDate, maxDate = _a.maxDate, maxDetail = _a.maxDetail, returnValue = _a.returnValue;
|
|
4747
|
+
})();
|
|
4748
|
+
var valueType = getValueType(maxDetail);
|
|
4749
|
+
var view = getView(viewProps || viewState, minDetail, maxDetail);
|
|
4750
|
+
var views = getLimitedViews(minDetail, maxDetail);
|
|
4751
|
+
var hover = selectRange ? hoverState : null;
|
|
4752
|
+
var drillDownAvailable = views.indexOf(view) < views.length - 1;
|
|
4753
|
+
var drillUpAvailable = views.indexOf(view) > 0;
|
|
4754
|
+
var getProcessedValue = useCallback(function (value) {
|
|
5014
4755
|
var processFunction = (function () {
|
|
5015
4756
|
switch (returnValue) {
|
|
5016
4757
|
case 'start':
|
|
@@ -5024,28 +4765,232 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
5024
4765
|
}
|
|
5025
4766
|
})();
|
|
5026
4767
|
return processFunction({
|
|
5027
|
-
value: value,
|
|
5028
|
-
minDate: minDate,
|
|
5029
4768
|
maxDate: maxDate,
|
|
5030
4769
|
maxDetail: maxDetail,
|
|
4770
|
+
minDate: minDate,
|
|
4771
|
+
value: value,
|
|
5031
4772
|
});
|
|
5032
|
-
};
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
var
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
:
|
|
5040
|
-
|
|
4773
|
+
}, [maxDate, maxDetail, minDate, returnValue]);
|
|
4774
|
+
var setActiveStartDate = useCallback(function (nextActiveStartDate, action) {
|
|
4775
|
+
setActiveStartDateState(nextActiveStartDate);
|
|
4776
|
+
var args = {
|
|
4777
|
+
action: action,
|
|
4778
|
+
activeStartDate: nextActiveStartDate,
|
|
4779
|
+
value: value,
|
|
4780
|
+
view: view,
|
|
4781
|
+
};
|
|
4782
|
+
if (onActiveStartDateChange && !areDatesEqual(activeStartDate, nextActiveStartDate)) {
|
|
4783
|
+
onActiveStartDateChange(args);
|
|
4784
|
+
}
|
|
4785
|
+
}, [activeStartDate, onActiveStartDateChange, value, view]);
|
|
4786
|
+
var onClickTile = useCallback(function (value, event) {
|
|
4787
|
+
var callback = (function () {
|
|
4788
|
+
switch (view) {
|
|
4789
|
+
case 'century':
|
|
4790
|
+
return onClickDecade;
|
|
4791
|
+
case 'decade':
|
|
4792
|
+
return onClickYear;
|
|
4793
|
+
case 'year':
|
|
4794
|
+
return onClickMonth;
|
|
4795
|
+
case 'month':
|
|
4796
|
+
return onClickDay;
|
|
4797
|
+
default:
|
|
4798
|
+
throw new Error("Invalid view: ".concat(view, "."));
|
|
4799
|
+
}
|
|
4800
|
+
})();
|
|
4801
|
+
if (callback)
|
|
4802
|
+
callback(value, event);
|
|
4803
|
+
}, [onClickDay, onClickDecade, onClickMonth, onClickYear, view]);
|
|
4804
|
+
var drillDown = useCallback(function (nextActiveStartDate, event) {
|
|
4805
|
+
if (!drillDownAvailable) {
|
|
4806
|
+
return;
|
|
4807
|
+
}
|
|
4808
|
+
onClickTile(nextActiveStartDate, event);
|
|
4809
|
+
var nextView = views[views.indexOf(view) + 1];
|
|
4810
|
+
if (!nextView) {
|
|
4811
|
+
throw new Error('Attempted to drill down from the lowest view.');
|
|
4812
|
+
}
|
|
4813
|
+
setActiveStartDateState(nextActiveStartDate);
|
|
4814
|
+
setViewState(nextView);
|
|
4815
|
+
var args = {
|
|
4816
|
+
action: 'drillDown',
|
|
4817
|
+
activeStartDate: nextActiveStartDate,
|
|
4818
|
+
value: value,
|
|
4819
|
+
view: nextView,
|
|
4820
|
+
};
|
|
4821
|
+
if (onActiveStartDateChange && !areDatesEqual(activeStartDate, nextActiveStartDate)) {
|
|
4822
|
+
onActiveStartDateChange(args);
|
|
4823
|
+
}
|
|
4824
|
+
if (onViewChange && view !== nextView) {
|
|
4825
|
+
onViewChange(args);
|
|
4826
|
+
}
|
|
4827
|
+
if (onDrillDown) {
|
|
4828
|
+
onDrillDown(args);
|
|
4829
|
+
}
|
|
4830
|
+
}, [
|
|
4831
|
+
activeStartDate,
|
|
4832
|
+
drillDownAvailable,
|
|
4833
|
+
onActiveStartDateChange,
|
|
4834
|
+
onClickTile,
|
|
4835
|
+
onDrillDown,
|
|
4836
|
+
onViewChange,
|
|
4837
|
+
value,
|
|
4838
|
+
view,
|
|
4839
|
+
views,
|
|
4840
|
+
]);
|
|
4841
|
+
var drillUp = useCallback(function () {
|
|
4842
|
+
if (!drillUpAvailable) {
|
|
4843
|
+
return;
|
|
4844
|
+
}
|
|
4845
|
+
var nextView = views[views.indexOf(view) - 1];
|
|
4846
|
+
if (!nextView) {
|
|
4847
|
+
throw new Error('Attempted to drill up from the highest view.');
|
|
4848
|
+
}
|
|
4849
|
+
var nextActiveStartDate = getBegin(nextView, activeStartDate);
|
|
4850
|
+
setActiveStartDateState(nextActiveStartDate);
|
|
4851
|
+
setViewState(nextView);
|
|
4852
|
+
var args = {
|
|
4853
|
+
action: 'drillUp',
|
|
4854
|
+
activeStartDate: nextActiveStartDate,
|
|
4855
|
+
value: value,
|
|
4856
|
+
view: nextView,
|
|
4857
|
+
};
|
|
4858
|
+
if (onActiveStartDateChange && !areDatesEqual(activeStartDate, nextActiveStartDate)) {
|
|
4859
|
+
onActiveStartDateChange(args);
|
|
4860
|
+
}
|
|
4861
|
+
if (onViewChange && view !== nextView) {
|
|
4862
|
+
onViewChange(args);
|
|
4863
|
+
}
|
|
4864
|
+
if (onDrillUp) {
|
|
4865
|
+
onDrillUp(args);
|
|
4866
|
+
}
|
|
4867
|
+
}, [
|
|
4868
|
+
activeStartDate,
|
|
4869
|
+
drillUpAvailable,
|
|
4870
|
+
onActiveStartDateChange,
|
|
4871
|
+
onDrillUp,
|
|
4872
|
+
onViewChange,
|
|
4873
|
+
value,
|
|
4874
|
+
view,
|
|
4875
|
+
views,
|
|
4876
|
+
]);
|
|
4877
|
+
var onChange = useCallback(function (rawNextValue, event) {
|
|
4878
|
+
var previousValue = value;
|
|
4879
|
+
onClickTile(rawNextValue, event);
|
|
4880
|
+
var isFirstValueInRange = selectRange && !getIsSingleValue(previousValue);
|
|
4881
|
+
var nextValue;
|
|
4882
|
+
if (selectRange) {
|
|
4883
|
+
// Range selection turned on
|
|
4884
|
+
if (isFirstValueInRange) {
|
|
4885
|
+
// Value has 0 or 2 elements - either way we're starting a new array
|
|
4886
|
+
// First value
|
|
4887
|
+
nextValue = getBegin(valueType, rawNextValue);
|
|
4888
|
+
}
|
|
4889
|
+
else {
|
|
4890
|
+
if (!previousValue) {
|
|
4891
|
+
throw new Error('previousValue is required');
|
|
4892
|
+
}
|
|
4893
|
+
if (Array.isArray(previousValue)) {
|
|
4894
|
+
throw new Error('previousValue must not be an array');
|
|
4895
|
+
}
|
|
4896
|
+
// Second value
|
|
4897
|
+
nextValue = getValueRange(valueType, previousValue, rawNextValue);
|
|
4898
|
+
}
|
|
4899
|
+
}
|
|
4900
|
+
else {
|
|
4901
|
+
// Range selection turned off
|
|
4902
|
+
nextValue = getProcessedValue(rawNextValue);
|
|
4903
|
+
}
|
|
4904
|
+
var nextActiveStartDate =
|
|
4905
|
+
// Range selection turned off
|
|
4906
|
+
!selectRange ||
|
|
4907
|
+
// Range selection turned on, first value
|
|
4908
|
+
isFirstValueInRange ||
|
|
4909
|
+
// Range selection turned on, second value, goToRangeStartOnSelect toggled on
|
|
4910
|
+
goToRangeStartOnSelect
|
|
4911
|
+
? getActiveStartDate({
|
|
4912
|
+
maxDate: maxDate,
|
|
4913
|
+
maxDetail: maxDetail,
|
|
4914
|
+
minDate: minDate,
|
|
4915
|
+
minDetail: minDetail,
|
|
4916
|
+
value: nextValue,
|
|
4917
|
+
view: view,
|
|
4918
|
+
})
|
|
4919
|
+
: null;
|
|
4920
|
+
event.persist();
|
|
4921
|
+
setActiveStartDateState(nextActiveStartDate);
|
|
4922
|
+
setValueState(nextValue);
|
|
4923
|
+
var args = {
|
|
4924
|
+
action: 'onChange',
|
|
4925
|
+
activeStartDate: nextActiveStartDate,
|
|
4926
|
+
value: nextValue,
|
|
4927
|
+
view: view,
|
|
4928
|
+
};
|
|
4929
|
+
if (onActiveStartDateChange && !areDatesEqual(activeStartDate, nextActiveStartDate)) {
|
|
4930
|
+
onActiveStartDateChange(args);
|
|
4931
|
+
}
|
|
4932
|
+
if (onChangeProps) {
|
|
4933
|
+
if (selectRange) {
|
|
4934
|
+
var isSingleValue = getIsSingleValue(nextValue);
|
|
4935
|
+
if (!isSingleValue) {
|
|
4936
|
+
onChangeProps(nextValue || null, event);
|
|
4937
|
+
}
|
|
4938
|
+
else if (allowPartialRange) {
|
|
4939
|
+
if (Array.isArray(nextValue)) {
|
|
4940
|
+
throw new Error('value must not be an array');
|
|
4941
|
+
}
|
|
4942
|
+
onChangeProps([nextValue || null, null], event);
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
else {
|
|
4946
|
+
onChangeProps(nextValue || null, event);
|
|
4947
|
+
}
|
|
4948
|
+
}
|
|
4949
|
+
}, [
|
|
4950
|
+
activeStartDate,
|
|
4951
|
+
allowPartialRange,
|
|
4952
|
+
getProcessedValue,
|
|
4953
|
+
goToRangeStartOnSelect,
|
|
4954
|
+
maxDate,
|
|
4955
|
+
maxDetail,
|
|
4956
|
+
minDate,
|
|
4957
|
+
minDetail,
|
|
4958
|
+
onActiveStartDateChange,
|
|
4959
|
+
onChangeProps,
|
|
4960
|
+
onClickTile,
|
|
4961
|
+
selectRange,
|
|
4962
|
+
value,
|
|
4963
|
+
valueType,
|
|
4964
|
+
view,
|
|
4965
|
+
]);
|
|
4966
|
+
function onMouseOver(nextHover) {
|
|
4967
|
+
setHoverState(nextHover);
|
|
4968
|
+
}
|
|
4969
|
+
function onMouseLeave() {
|
|
4970
|
+
setHoverState(null);
|
|
4971
|
+
}
|
|
4972
|
+
useImperativeHandle(ref, function () { return ({
|
|
4973
|
+
activeStartDate: activeStartDate,
|
|
4974
|
+
drillDown: drillDown,
|
|
4975
|
+
drillUp: drillUp,
|
|
4976
|
+
onChange: onChange,
|
|
4977
|
+
setActiveStartDate: setActiveStartDate,
|
|
4978
|
+
value: value,
|
|
4979
|
+
view: view,
|
|
4980
|
+
}); }, [activeStartDate, drillDown, drillUp, onChange, setActiveStartDate, value, view]);
|
|
4981
|
+
function renderContent(next) {
|
|
4982
|
+
var currentActiveStartDate = next
|
|
4983
|
+
? getBeginNext(view, activeStartDate)
|
|
4984
|
+
: getBegin(view, activeStartDate);
|
|
4985
|
+
var onClick = drillDownAvailable ? drillDown : onChange;
|
|
5041
4986
|
var commonProps = {
|
|
5042
|
-
activeStartDate:
|
|
4987
|
+
activeStartDate: currentActiveStartDate,
|
|
5043
4988
|
hover: hover,
|
|
5044
4989
|
locale: locale,
|
|
5045
4990
|
maxDate: maxDate,
|
|
5046
4991
|
minDate: minDate,
|
|
5047
4992
|
onClick: onClick,
|
|
5048
|
-
onMouseOver: selectRange ? onMouseOver :
|
|
4993
|
+
onMouseOver: selectRange ? onMouseOver : undefined,
|
|
5049
4994
|
tileClassName: tileClassName,
|
|
5050
4995
|
tileContent: tileContent,
|
|
5051
4996
|
tileDisabled: tileDisabled,
|
|
@@ -5054,107 +4999,95 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
5054
4999
|
};
|
|
5055
5000
|
switch (view) {
|
|
5056
5001
|
case 'century': {
|
|
5057
|
-
|
|
5058
|
-
return React.createElement(CenturyView, __assign({ formatYear: formatYear }, commonProps));
|
|
5002
|
+
return React.createElement(CenturyView$1, __assign({ formatYear: formatYear }, commonProps));
|
|
5059
5003
|
}
|
|
5060
5004
|
case 'decade': {
|
|
5061
|
-
|
|
5062
|
-
return React.createElement(DecadeView, __assign({ formatYear: formatYear }, commonProps));
|
|
5005
|
+
return React.createElement(DecadeView$1, __assign({ formatYear: formatYear }, commonProps));
|
|
5063
5006
|
}
|
|
5064
5007
|
case 'year': {
|
|
5065
|
-
|
|
5066
|
-
return (React.createElement(YearView, __assign({ formatMonth: formatMonth, formatMonthYear: formatMonthYear }, commonProps)));
|
|
5008
|
+
return (React.createElement(YearView$1, __assign({ formatMonth: formatMonth, formatMonthYear: formatMonthYear }, commonProps)));
|
|
5067
5009
|
}
|
|
5068
5010
|
case 'month': {
|
|
5069
|
-
|
|
5070
|
-
var onMouseLeave = this.onMouseLeave;
|
|
5071
|
-
return (React.createElement(MonthView, __assign({ calendarType: calendarType, formatDay: formatDay, formatLongDate: formatLongDate, formatShortWeekday: formatShortWeekday, formatWeekday: formatWeekday, onClickWeekNumber: onClickWeekNumber, onMouseLeave: selectRange ? onMouseLeave : null, showFixedNumberOfWeeks: typeof showFixedNumberOfWeeks !== 'undefined'
|
|
5011
|
+
return (React.createElement(MonthView$1, __assign({ calendarType: calendarType, formatDay: formatDay, formatLongDate: formatLongDate, formatShortWeekday: formatShortWeekday, formatWeekday: formatWeekday, onClickWeekNumber: onClickWeekNumber, onMouseLeave: selectRange ? onMouseLeave : undefined, showFixedNumberOfWeeks: typeof showFixedNumberOfWeeks !== 'undefined'
|
|
5072
5012
|
? showFixedNumberOfWeeks
|
|
5073
5013
|
: showDoubleView, showNeighboringMonth: showNeighboringMonth, showWeekNumbers: showWeekNumbers }, commonProps)));
|
|
5074
5014
|
}
|
|
5075
5015
|
default:
|
|
5076
5016
|
throw new Error("Invalid view: ".concat(view, "."));
|
|
5077
5017
|
}
|
|
5078
|
-
}
|
|
5079
|
-
|
|
5080
|
-
var showNavigation = this.props.showNavigation;
|
|
5018
|
+
}
|
|
5019
|
+
function renderNavigation() {
|
|
5081
5020
|
if (!showNavigation) {
|
|
5082
5021
|
return null;
|
|
5083
5022
|
}
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
}
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
tileDisabled: PropTypes.func,
|
|
5153
|
-
value: isValueOrValueArray,
|
|
5154
|
-
view: isView,
|
|
5155
|
-
};
|
|
5156
|
-
return Calendar;
|
|
5157
|
-
}(Component));
|
|
5023
|
+
return (React.createElement(Navigation, { activeStartDate: activeStartDate, drillUp: drillUp, formatMonthYear: formatMonthYear, formatYear: formatYear, locale: locale, maxDate: maxDate, minDate: minDate, navigationAriaLabel: navigationAriaLabel, navigationAriaLive: navigationAriaLive, navigationLabel: navigationLabel, next2AriaLabel: next2AriaLabel, next2Label: next2Label, nextAriaLabel: nextAriaLabel, nextLabel: nextLabel, prev2AriaLabel: prev2AriaLabel, prev2Label: prev2Label, prevAriaLabel: prevAriaLabel, prevLabel: prevLabel, setActiveStartDate: setActiveStartDate, showDoubleView: showDoubleView, view: view, views: views }));
|
|
5024
|
+
}
|
|
5025
|
+
var valueArray = Array.isArray(value) ? value : [value];
|
|
5026
|
+
return (React.createElement("div", { className: clsx(baseClassName, selectRange && valueArray.length === 1 && "".concat(baseClassName, "--selectRange"), showDoubleView && "".concat(baseClassName, "--doubleView"), className), ref: inputRef },
|
|
5027
|
+
renderNavigation(),
|
|
5028
|
+
React.createElement("div", { className: "".concat(baseClassName, "__viewContainer"), onBlur: selectRange ? onMouseLeave : undefined, onMouseLeave: selectRange ? onMouseLeave : undefined },
|
|
5029
|
+
renderContent(),
|
|
5030
|
+
showDoubleView ? renderContent(true) : null)));
|
|
5031
|
+
});
|
|
5032
|
+
var isActiveStartDate = PropTypes.instanceOf(Date);
|
|
5033
|
+
var isValue = PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]);
|
|
5034
|
+
var isValueOrValueArray = PropTypes.oneOfType([isValue, rangeOf(isValue)]);
|
|
5035
|
+
Calendar.propTypes = {
|
|
5036
|
+
activeStartDate: isActiveStartDate,
|
|
5037
|
+
allowPartialRange: PropTypes.bool,
|
|
5038
|
+
calendarType: isCalendarType,
|
|
5039
|
+
className: isClassName,
|
|
5040
|
+
defaultActiveStartDate: isActiveStartDate,
|
|
5041
|
+
defaultValue: isValueOrValueArray,
|
|
5042
|
+
defaultView: isView,
|
|
5043
|
+
formatDay: PropTypes.func,
|
|
5044
|
+
formatLongDate: PropTypes.func,
|
|
5045
|
+
formatMonth: PropTypes.func,
|
|
5046
|
+
formatMonthYear: PropTypes.func,
|
|
5047
|
+
formatShortWeekday: PropTypes.func,
|
|
5048
|
+
formatWeekday: PropTypes.func,
|
|
5049
|
+
formatYear: PropTypes.func,
|
|
5050
|
+
goToRangeStartOnSelect: PropTypes.bool,
|
|
5051
|
+
inputRef: isRef,
|
|
5052
|
+
locale: PropTypes.string,
|
|
5053
|
+
maxDate: isMaxDate,
|
|
5054
|
+
maxDetail: PropTypes.oneOf(allViews),
|
|
5055
|
+
minDate: isMinDate,
|
|
5056
|
+
minDetail: PropTypes.oneOf(allViews),
|
|
5057
|
+
navigationAriaLabel: PropTypes.string,
|
|
5058
|
+
navigationAriaLive: PropTypes.oneOf(['off', 'polite', 'assertive']),
|
|
5059
|
+
navigationLabel: PropTypes.func,
|
|
5060
|
+
next2AriaLabel: PropTypes.string,
|
|
5061
|
+
next2Label: PropTypes.node,
|
|
5062
|
+
nextAriaLabel: PropTypes.string,
|
|
5063
|
+
nextLabel: PropTypes.node,
|
|
5064
|
+
onActiveStartDateChange: PropTypes.func,
|
|
5065
|
+
onChange: PropTypes.func,
|
|
5066
|
+
onClickDay: PropTypes.func,
|
|
5067
|
+
onClickDecade: PropTypes.func,
|
|
5068
|
+
onClickMonth: PropTypes.func,
|
|
5069
|
+
onClickWeekNumber: PropTypes.func,
|
|
5070
|
+
onClickYear: PropTypes.func,
|
|
5071
|
+
onDrillDown: PropTypes.func,
|
|
5072
|
+
onDrillUp: PropTypes.func,
|
|
5073
|
+
onViewChange: PropTypes.func,
|
|
5074
|
+
prev2AriaLabel: PropTypes.string,
|
|
5075
|
+
prev2Label: PropTypes.node,
|
|
5076
|
+
prevAriaLabel: PropTypes.string,
|
|
5077
|
+
prevLabel: PropTypes.node,
|
|
5078
|
+
returnValue: PropTypes.oneOf(['start', 'end', 'range']),
|
|
5079
|
+
selectRange: PropTypes.bool,
|
|
5080
|
+
showDoubleView: PropTypes.bool,
|
|
5081
|
+
showFixedNumberOfWeeks: PropTypes.bool,
|
|
5082
|
+
showNavigation: PropTypes.bool,
|
|
5083
|
+
showNeighboringMonth: PropTypes.bool,
|
|
5084
|
+
showWeekNumbers: PropTypes.bool,
|
|
5085
|
+
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
|
|
5086
|
+
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
5087
|
+
tileDisabled: PropTypes.func,
|
|
5088
|
+
value: isValueOrValueArray,
|
|
5089
|
+
view: isView,
|
|
5090
|
+
};
|
|
5158
5091
|
var Calendar$1 = Calendar;
|
|
5159
5092
|
|
|
5160
5093
|
var css_248z$G = ".DatePicker-module_datePicker__mTJ3f {\n width: 100%;\n}";
|
|
@@ -5441,9 +5374,9 @@ const EmailValidator = (value) => {
|
|
|
5441
5374
|
|
|
5442
5375
|
const IsEqualValidator = (valueA, valueB) => valueA === valueB;
|
|
5443
5376
|
|
|
5444
|
-
const MaxValidator = (val, valueB) => val.length <= valueB;
|
|
5377
|
+
const MaxValidator = (val, valueB) => (val && val.length <= valueB) || false;
|
|
5445
5378
|
|
|
5446
|
-
const MinValidator = (val, minLength) => val.length >= minLength;
|
|
5379
|
+
const MinValidator = (val, minLength) => (val && val.length >= minLength) || false;
|
|
5447
5380
|
|
|
5448
5381
|
class Form extends Component {
|
|
5449
5382
|
constructor(props) {
|
|
@@ -7293,7 +7226,7 @@ Array.prototype.distinct = function (comparator) {
|
|
|
7293
7226
|
};
|
|
7294
7227
|
|
|
7295
7228
|
var dayjs_min = createCommonjsModule(function (module, exports) {
|
|
7296
|
-
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",
|
|
7229
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
7297
7230
|
});
|
|
7298
7231
|
|
|
7299
7232
|
var localizedFormat = createCommonjsModule(function (module, exports) {
|