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