@coreui/react-pro 4.13.1 → 5.0.0-alpha.1
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/README.md +1 -1
- package/dist/components/calendar/CCalendar.d.ts +25 -7
- package/dist/components/calendar/utils.d.ts +12 -3
- package/dist/components/close-button/CCloseButton.d.ts +6 -0
- package/dist/components/date-range-picker/CDateRangePicker copy.d.ts +114 -0
- package/dist/components/multi-select/types.d.ts +2 -2
- package/dist/components/multi-select/utils.d.ts +2 -2
- package/dist/components/multi-select-new/CMultiSelect.d.ts +133 -0
- package/dist/components/multi-select-new/CMultiSelectNativeSelect.d.ts +7 -0
- package/dist/components/multi-select-new/CMultiSelectNew.d.ts +121 -0
- package/dist/components/multi-select-new/CMultiSelectOptions.d.ts +16 -0
- package/dist/components/multi-select-new/CMultiSelectSelection.d.ts +11 -0
- package/dist/components/multi-select-new/index.d.ts +2 -0
- package/dist/components/multi-select-new/types.d.ts +15 -0
- package/dist/components/multi-select-new/utils.d.ts +11 -0
- package/dist/components/nav/CNav.d.ts +1 -1
- package/dist/components/navbar/CNavbar.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvas.d.ts +4 -0
- package/dist/components/picker/CPicker copy.d.ts +82 -0
- package/dist/components/picker copy/CPicker.d.ts +82 -0
- package/dist/components/smart-table/CSmartTableBody.d.ts +2 -1
- package/dist/components/smart-table/CSmartTableCleaner.d.ts +7 -0
- package/dist/components/smart-table/CSmartTableInterface.d.ts +1 -3
- package/dist/components/smart-table/types.d.ts +2 -2
- package/dist/components/smart-table/utils.d.ts +3 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/index.es.js +523 -265
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +523 -264
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/components/calendar/CCalendar.tsx +396 -193
- package/src/components/calendar/utils.ts +91 -4
- package/src/components/carousel/CCarousel.tsx +9 -5
- package/src/components/close-button/CCloseButton.tsx +9 -1
- package/src/components/date-range-picker/CDateRangePicker.tsx +65 -81
- package/src/components/dropdown/CDropdownMenu.tsx +1 -1
- package/src/components/multi-select/CMultiSelect.tsx +18 -10
- package/src/components/multi-select/CMultiSelectNativeSelect.tsx +1 -1
- package/src/components/multi-select/CMultiSelectOptions.tsx +1 -1
- package/src/components/multi-select/CMultiSelectSelection.tsx +4 -6
- package/src/components/multi-select/types.ts +2 -2
- package/src/components/multi-select/utils.ts +5 -5
- package/src/components/nav/CNav.tsx +2 -2
- package/src/components/navbar/CNavbar.tsx +2 -2
- package/src/components/offcanvas/COffcanvas.tsx +7 -0
- package/src/components/picker/CPicker.tsx +2 -11
- package/src/components/smart-table/CSmartTable.tsx +2 -1
- package/src/components/smart-table/CSmartTableBody.tsx +11 -5
- package/src/components/smart-table/CSmartTableInterface.tsx +1 -3
- package/src/components/smart-table/types.ts +2 -2
- package/src/components/smart-table/utils.ts +40 -5
- package/src/components/time-picker/CTimePicker.tsx +20 -37
- package/src/components/time-picker/utils.ts +5 -1
- package/src/hooks/index.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -2479,6 +2479,54 @@ CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends$1({},
|
|
|
2479
2479
|
}) : {};
|
|
2480
2480
|
var CSSTransition$1 = CSSTransition;
|
|
2481
2481
|
|
|
2482
|
+
var getStoredTheme = function (localStorageItemName) {
|
|
2483
|
+
return typeof window !== 'undefined' && localStorage.getItem(localStorageItemName);
|
|
2484
|
+
};
|
|
2485
|
+
var setStoredTheme = function (localStorageItemName, colorMode) {
|
|
2486
|
+
return localStorage.setItem(localStorageItemName, colorMode);
|
|
2487
|
+
};
|
|
2488
|
+
var getPreferredColorScheme = function (localStorageItemName) {
|
|
2489
|
+
if (typeof window === 'undefined') {
|
|
2490
|
+
return 'light';
|
|
2491
|
+
}
|
|
2492
|
+
var storedTheme = getStoredTheme(localStorageItemName);
|
|
2493
|
+
if (storedTheme) {
|
|
2494
|
+
return storedTheme;
|
|
2495
|
+
}
|
|
2496
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
2497
|
+
};
|
|
2498
|
+
var setTheme = function (colorMode) {
|
|
2499
|
+
document.documentElement.dataset.coreuiTheme =
|
|
2500
|
+
colorMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
2501
|
+
? 'dark'
|
|
2502
|
+
: colorMode;
|
|
2503
|
+
var event = new Event('ColorSchemeChange');
|
|
2504
|
+
document.documentElement.dispatchEvent(event);
|
|
2505
|
+
};
|
|
2506
|
+
var useColorModes = function (localStorageItemName) {
|
|
2507
|
+
if (localStorageItemName === void 0) { localStorageItemName = 'coreui-react-color-scheme'; }
|
|
2508
|
+
var _a = React$1.useState(getPreferredColorScheme(localStorageItemName)), colorMode = _a[0], setColorMode = _a[1];
|
|
2509
|
+
React$1.useEffect(function () {
|
|
2510
|
+
if (colorMode) {
|
|
2511
|
+
setStoredTheme(localStorageItemName, colorMode);
|
|
2512
|
+
setTheme(colorMode);
|
|
2513
|
+
}
|
|
2514
|
+
}, [colorMode]);
|
|
2515
|
+
React$1.useEffect(function () {
|
|
2516
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function () {
|
|
2517
|
+
var storedTheme = getStoredTheme(localStorageItemName);
|
|
2518
|
+
if (storedTheme !== 'light' && storedTheme !== 'dark' && colorMode) {
|
|
2519
|
+
setTheme(colorMode);
|
|
2520
|
+
}
|
|
2521
|
+
});
|
|
2522
|
+
});
|
|
2523
|
+
return {
|
|
2524
|
+
colorMode: colorMode,
|
|
2525
|
+
isColorModeSet: function () { return Boolean(getStoredTheme(localStorageItemName)); },
|
|
2526
|
+
setColorMode: setColorMode,
|
|
2527
|
+
};
|
|
2528
|
+
};
|
|
2529
|
+
|
|
2482
2530
|
// code borrowed from https://github.com/reach/reach-ui
|
|
2483
2531
|
// problem described https://github.com/facebook/react/issues/13029
|
|
2484
2532
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -4542,13 +4590,14 @@ CAccordionHeader.propTypes = {
|
|
|
4542
4590
|
CAccordionHeader.displayName = 'CAccordionHeader';
|
|
4543
4591
|
|
|
4544
4592
|
var CCloseButton = React$1.forwardRef(function (_a, ref) {
|
|
4545
|
-
var className = _a.className, disabled = _a.disabled, white = _a.white, rest = __rest$1(_a, ["className", "disabled", "white"]);
|
|
4593
|
+
var className = _a.className, dark = _a.dark, disabled = _a.disabled, white = _a.white, rest = __rest$1(_a, ["className", "dark", "disabled", "white"]);
|
|
4546
4594
|
return (React$1.createElement("button", __assign$1({ type: "button", className: classNames$1('btn', 'btn-close', {
|
|
4547
4595
|
'btn-close-white': white,
|
|
4548
|
-
}, disabled, className), "aria-label": "Close", disabled: disabled }, rest, { ref: ref })));
|
|
4596
|
+
}, disabled, className), "aria-label": "Close", disabled: disabled }, (dark && { 'data-coreui-theme': 'dark' }), rest, { ref: ref })));
|
|
4549
4597
|
});
|
|
4550
4598
|
CCloseButton.propTypes = {
|
|
4551
4599
|
className: PropTypes$1.string,
|
|
4600
|
+
dark: PropTypes$1.bool,
|
|
4552
4601
|
disabled: PropTypes$1.bool,
|
|
4553
4602
|
white: PropTypes$1.bool,
|
|
4554
4603
|
};
|
|
@@ -5062,17 +5111,18 @@ var CCarousel = React$1.forwardRef(function (_a, ref) {
|
|
|
5062
5111
|
setTouchPosition(touchDown);
|
|
5063
5112
|
};
|
|
5064
5113
|
return (React$1.createElement("div", __assign$1({ className: classNames$1('carousel slide', {
|
|
5065
|
-
'carousel-dark': dark,
|
|
5066
5114
|
'carousel-fade': transition === 'crossfade',
|
|
5067
|
-
}, className), onMouseEnter: _pause, onMouseLeave: cycle }, (touch && { onTouchStart: handleTouchStart, onTouchMove: handleTouchMove }), rest, { ref: forkedRef }),
|
|
5115
|
+
}, className) }, (dark && { 'data-coreui-theme': 'dark' }), { onMouseEnter: _pause, onMouseLeave: cycle }, (touch && { onTouchStart: handleTouchStart, onTouchMove: handleTouchMove }), rest, { ref: forkedRef }),
|
|
5068
5116
|
React$1.createElement(CCarouselContext.Provider, { value: {
|
|
5069
5117
|
setAnimating: setAnimating,
|
|
5070
5118
|
setCustomInterval: setCustomInterval,
|
|
5071
5119
|
} },
|
|
5072
|
-
indicators && (React$1.createElement("
|
|
5073
|
-
return (React$1.createElement("
|
|
5120
|
+
indicators && (React$1.createElement("div", { className: "carousel-indicators" }, Array.from({ length: itemsNumber }, function (_, i) { return i; }).map(function (index) {
|
|
5121
|
+
return (React$1.createElement("button", __assign$1({ key: "indicator".concat(index), onClick: function () {
|
|
5074
5122
|
!animating && handleIndicatorClick(index);
|
|
5075
|
-
}, className:
|
|
5123
|
+
}, className: classNames$1({
|
|
5124
|
+
active: active === index
|
|
5125
|
+
}), "data-coreui-target": "" }, (active === index && { 'aria-current': true }), { "aria-label": "Slide ".concat(index + 1) })));
|
|
5076
5126
|
}))),
|
|
5077
5127
|
React$1.createElement("div", { className: "carousel-inner" }, React$1.Children.map(children, function (child, index) {
|
|
5078
5128
|
if (React$1.isValidElement(child)) {
|
|
@@ -8499,12 +8549,60 @@ lib.useDeviceSelectors = useDeviceSelectors;
|
|
|
8499
8549
|
lib.useMobileOrientation = useMobileOrientation;
|
|
8500
8550
|
lib.withOrientationChange = withOrientationChange;
|
|
8501
8551
|
|
|
8552
|
+
var convertIsoWeekToDate = function (isoWeek) {
|
|
8553
|
+
var _a = isoWeek.split(/w/i), year = _a[0], week = _a[1];
|
|
8554
|
+
// Get date for 4th of January for year
|
|
8555
|
+
var date = new Date(Number(year), 0, 4);
|
|
8556
|
+
// Get previous Monday, add 7 days for each week after first
|
|
8557
|
+
date.setDate(date.getDate() - (date.getDay() || 7) + 1 + (Number(week) - 1) * 7);
|
|
8558
|
+
return date;
|
|
8559
|
+
};
|
|
8560
|
+
var convertToDateObject = function (date, selectionType) {
|
|
8561
|
+
// if (date === null) {
|
|
8562
|
+
// return null
|
|
8563
|
+
// }
|
|
8564
|
+
if (date instanceof Date) {
|
|
8565
|
+
return date;
|
|
8566
|
+
}
|
|
8567
|
+
if (selectionType === 'week') {
|
|
8568
|
+
return convertIsoWeekToDate(date);
|
|
8569
|
+
}
|
|
8570
|
+
return new Date(Date.parse(date));
|
|
8571
|
+
};
|
|
8502
8572
|
var createGroupsInArray = function (arr, numberOfGroups) {
|
|
8503
8573
|
var perGroup = Math.ceil(arr.length / numberOfGroups);
|
|
8504
8574
|
return Array.from({ length: numberOfGroups })
|
|
8505
8575
|
.fill('')
|
|
8506
8576
|
.map(function (_, i) { return arr.slice(i * perGroup, (i + 1) * perGroup); });
|
|
8507
8577
|
};
|
|
8578
|
+
var getCalendarDate = function (calendarDate, order, view) {
|
|
8579
|
+
if (order !== 0 && view === 'days') {
|
|
8580
|
+
return new Date(Date.UTC(calendarDate.getFullYear(), calendarDate.getMonth() + order, 1));
|
|
8581
|
+
}
|
|
8582
|
+
if (order !== 0 && view === 'months') {
|
|
8583
|
+
return new Date(Date.UTC(calendarDate.getFullYear() + order, calendarDate.getMonth(), 1));
|
|
8584
|
+
}
|
|
8585
|
+
if (order !== 0 && view === 'years') {
|
|
8586
|
+
return new Date(Date.UTC(calendarDate.getFullYear() + (12 * order), calendarDate.getMonth(), 1));
|
|
8587
|
+
}
|
|
8588
|
+
return calendarDate;
|
|
8589
|
+
};
|
|
8590
|
+
var getDateBySelectionType = function (date, selectionType) {
|
|
8591
|
+
if (date === null) {
|
|
8592
|
+
return null;
|
|
8593
|
+
}
|
|
8594
|
+
if (selectionType === 'week') {
|
|
8595
|
+
return "".concat(date.getFullYear(), "W").concat(getWeekNumber(date));
|
|
8596
|
+
}
|
|
8597
|
+
if (selectionType === 'month') {
|
|
8598
|
+
var monthNumber = "0".concat(date.getMonth() + 1).slice(-2);
|
|
8599
|
+
return "".concat(date.getFullYear(), "-").concat(monthNumber);
|
|
8600
|
+
}
|
|
8601
|
+
if (selectionType === 'year') {
|
|
8602
|
+
return "".concat(date.getFullYear());
|
|
8603
|
+
}
|
|
8604
|
+
return date;
|
|
8605
|
+
};
|
|
8508
8606
|
var getMonthsNames = function (locale) {
|
|
8509
8607
|
var months = [];
|
|
8510
8608
|
var d = new Date();
|
|
@@ -8564,6 +8662,11 @@ var getTrailingDays = function (year, month, leadingDays, monthDays) {
|
|
|
8564
8662
|
}
|
|
8565
8663
|
return dates;
|
|
8566
8664
|
};
|
|
8665
|
+
var getWeekNumber = function (date) {
|
|
8666
|
+
var week1 = new Date(date.getFullYear(), 0, 4);
|
|
8667
|
+
return (1 +
|
|
8668
|
+
Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + ((week1.getDay() + 6) % 7)) / 7));
|
|
8669
|
+
};
|
|
8567
8670
|
var getMonthDetails = function (year, month, firstDayOfWeek) {
|
|
8568
8671
|
var daysPrevMonth = getLeadingDays(year, month, firstDayOfWeek);
|
|
8569
8672
|
var daysThisMonth = getMonthDays(year, month);
|
|
@@ -8572,9 +8675,14 @@ var getMonthDetails = function (year, month, firstDayOfWeek) {
|
|
|
8572
8675
|
var weeks = [];
|
|
8573
8676
|
days.forEach(function (day, index) {
|
|
8574
8677
|
if (index % 7 === 0 || weeks.length === 0) {
|
|
8575
|
-
weeks.push(
|
|
8678
|
+
weeks.push({
|
|
8679
|
+
days: [],
|
|
8680
|
+
});
|
|
8681
|
+
}
|
|
8682
|
+
if ((index + 1) % 7 === 0) {
|
|
8683
|
+
weeks[weeks.length - 1].weekNumber = getWeekNumber(day.date);
|
|
8576
8684
|
}
|
|
8577
|
-
weeks[weeks.length - 1].push(day);
|
|
8685
|
+
weeks[weeks.length - 1].days.push(day);
|
|
8578
8686
|
});
|
|
8579
8687
|
return weeks;
|
|
8580
8688
|
};
|
|
@@ -8619,15 +8727,6 @@ var isDateInRange = function (date, start, end) {
|
|
|
8619
8727
|
var isDateSelected = function (date, start, end) {
|
|
8620
8728
|
return (start && isSameDateAs(start, date)) || (end && isSameDateAs(end, date));
|
|
8621
8729
|
};
|
|
8622
|
-
var isEndDate = function (date, start, end) {
|
|
8623
|
-
return start && end && isSameDateAs(end, date) && start < end;
|
|
8624
|
-
};
|
|
8625
|
-
var isLastDayOfMonth = function (date) {
|
|
8626
|
-
var test = new Date(date.getTime());
|
|
8627
|
-
var month = test.getMonth();
|
|
8628
|
-
test.setDate(test.getDate() + 1);
|
|
8629
|
-
return test.getMonth() !== month;
|
|
8630
|
-
};
|
|
8631
8730
|
var isSameDateAs = function (date, date2) {
|
|
8632
8731
|
if (date instanceof Date && date2 instanceof Date) {
|
|
8633
8732
|
return (date.getDate() === date2.getDate() &&
|
|
@@ -8639,9 +8738,6 @@ var isSameDateAs = function (date, date2) {
|
|
|
8639
8738
|
}
|
|
8640
8739
|
return false;
|
|
8641
8740
|
};
|
|
8642
|
-
var isStartDate = function (date, start, end) {
|
|
8643
|
-
return start && end && isSameDateAs(start, date) && start < end;
|
|
8644
|
-
};
|
|
8645
8741
|
var isToday = function (date) {
|
|
8646
8742
|
var today = new Date();
|
|
8647
8743
|
return (date.getDate() === today.getDate() &&
|
|
@@ -8650,151 +8746,206 @@ var isToday = function (date) {
|
|
|
8650
8746
|
};
|
|
8651
8747
|
|
|
8652
8748
|
var Calendar = function (props) {
|
|
8653
|
-
var
|
|
8654
|
-
var _a = React$1.useState(
|
|
8655
|
-
var _b = React$1.useState([]), listOfMonths = _b[0], setListOfMonths = _b[1];
|
|
8656
|
-
React$1.useEffect(function () {
|
|
8657
|
-
if (addMonths !== 0) {
|
|
8658
|
-
setDate(new Date(calendarDate.getFullYear(), calendarDate.getMonth() + addMonths, 1));
|
|
8659
|
-
return;
|
|
8660
|
-
}
|
|
8661
|
-
setDate(calendarDate);
|
|
8662
|
-
}, [calendarDate]);
|
|
8749
|
+
var calendarDate = props.calendarDate, dayFormat = props.dayFormat, disabledDates = props.disabledDates, endDate = props.endDate, firstDayOfWeek = props.firstDayOfWeek, hoverDate = props.hoverDate, locale = props.locale, maxDate = props.maxDate, minDate = props.minDate, onCalendarClick = props.onCalendarClick, onCalendarKeyDown = props.onCalendarKeyDown, onCalendarMouseEnter = props.onCalendarMouseEnter, onCalendarMouseLeave = props.onCalendarMouseLeave, selectAdjacementDays = props.selectAdjacementDays, selectEndDate = props.selectEndDate, selectionType = props.selectionType, showWeekNumber = props.showWeekNumber, showAdjacementDays = props.showAdjacementDays, startDate = props.startDate, view = props.view, weekdayFormat = props.weekdayFormat, weekNumbersLabel = props.weekNumbersLabel;
|
|
8750
|
+
var _a = React$1.useState([]), listOfMonths = _a[0], setListOfMonths = _a[1];
|
|
8663
8751
|
React$1.useEffect(function () {
|
|
8664
8752
|
setListOfMonths(createGroupsInArray(getMonthsNames(locale), 4));
|
|
8665
8753
|
}, []);
|
|
8666
|
-
var monthDetails = getMonthDetails(
|
|
8667
|
-
var listOfYears = createGroupsInArray(getYears(
|
|
8668
|
-
var weekDays = monthDetails[0];
|
|
8754
|
+
var monthDetails = getMonthDetails(calendarDate.getFullYear(), calendarDate.getMonth(), firstDayOfWeek);
|
|
8755
|
+
var listOfYears = createGroupsInArray(getYears(calendarDate.getFullYear()), 4);
|
|
8756
|
+
var weekDays = monthDetails[0].days;
|
|
8669
8757
|
return (React$1.createElement("table", null,
|
|
8670
8758
|
view === 'days' && (React$1.createElement("thead", null,
|
|
8671
|
-
React$1.createElement("tr", null,
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8759
|
+
React$1.createElement("tr", null,
|
|
8760
|
+
showWeekNumber && (React$1.createElement("th", { className: "calendar-cell" },
|
|
8761
|
+
React$1.createElement("div", { className: "calendar-header-cell-inner" }, weekNumbersLabel))),
|
|
8762
|
+
weekDays.map(function (_a, idx) {
|
|
8763
|
+
var date = _a.date;
|
|
8764
|
+
return (React$1.createElement("th", { key: idx, className: "calendar-cell" },
|
|
8765
|
+
React$1.createElement("div", { className: "calendar-header-cell-inner" }, typeof weekdayFormat === 'function'
|
|
8766
|
+
? weekdayFormat(date)
|
|
8767
|
+
: typeof weekdayFormat === 'string'
|
|
8768
|
+
? date.toLocaleDateString(locale, { weekday: weekdayFormat })
|
|
8769
|
+
: date.toLocaleDateString(locale, { weekday: 'long' }).slice(0, weekdayFormat))));
|
|
8770
|
+
})))),
|
|
8680
8771
|
React$1.createElement("tbody", null,
|
|
8681
8772
|
view === 'days' &&
|
|
8682
8773
|
monthDetails.map(function (week, index) {
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8774
|
+
var date = convertToDateObject(week.weekNumber === 0
|
|
8775
|
+
? "".concat(calendarDate.getFullYear(), "W53")
|
|
8776
|
+
: "".concat(calendarDate.getFullYear(), "W").concat(week.weekNumber), selectionType);
|
|
8777
|
+
var isDisabled = isDateDisabled(date, minDate, maxDate, disabledDates);
|
|
8778
|
+
return (React$1.createElement("tr", __assign$1({ className: classNames$1('calendar-row', {
|
|
8779
|
+
disabled: isDisabled,
|
|
8780
|
+
range: selectionType === 'week' && isDateInRange(date, startDate, endDate),
|
|
8781
|
+
'range-hover': selectionType === 'week' && hoverDate && selectEndDate
|
|
8782
|
+
? isDateInRange(date, startDate, hoverDate)
|
|
8783
|
+
: isDateInRange(date, hoverDate, endDate),
|
|
8784
|
+
selected: isDateSelected(date, startDate, endDate),
|
|
8785
|
+
}), key: index, tabIndex: selectionType === 'week' && !isDisabled ? 0 : -1 }, (selectionType === 'week' &&
|
|
8786
|
+
!isDisabled && {
|
|
8787
|
+
onBlur: function () { return onCalendarMouseLeave(); },
|
|
8788
|
+
onClick: function () { return onCalendarClick(date); },
|
|
8789
|
+
onFocus: function () { return onCalendarMouseEnter(date); },
|
|
8790
|
+
onKeyDown: function (event) { return onCalendarKeyDown(event, date); },
|
|
8791
|
+
onMouseEnter: function () { return onCalendarMouseEnter(date); },
|
|
8792
|
+
onMouseLeave: function () { return onCalendarMouseLeave(); },
|
|
8793
|
+
})),
|
|
8794
|
+
showWeekNumber && (React$1.createElement("th", { className: "calendar-cell-week-number" }, week.weekNumber === 0 ? 53 : week.weekNumber)),
|
|
8795
|
+
week.days.map(function (_a, idx) {
|
|
8796
|
+
var _b;
|
|
8797
|
+
var date = _a.date, month = _a.month;
|
|
8798
|
+
var isDisabled = isDateDisabled(date, minDate, maxDate, disabledDates);
|
|
8799
|
+
return month === 'current' || showAdjacementDays ? (React$1.createElement("td", __assign$1({ className: classNames$1('calendar-cell', __assign$1(__assign$1({}, (selectionType === 'day' && {
|
|
8800
|
+
clickable: month !== 'current' && selectAdjacementDays,
|
|
8801
|
+
disabled: isDisabled,
|
|
8802
|
+
'range-hover': month === 'current' &&
|
|
8803
|
+
(hoverDate && selectEndDate
|
|
8804
|
+
? isDateInRange(date, startDate, hoverDate)
|
|
8805
|
+
: isDateInRange(date, hoverDate, endDate)),
|
|
8806
|
+
range: month === 'current' && isDateInRange(date, startDate, endDate),
|
|
8807
|
+
selected: isDateSelected(date, startDate, endDate),
|
|
8808
|
+
})), (_b = {}, _b[month] = true, _b.today = month === 'current' && isToday(date), _b))), key: idx, tabIndex: selectionType === 'day' &&
|
|
8809
|
+
(month === 'current' || selectAdjacementDays) &&
|
|
8810
|
+
!isDisabled
|
|
8811
|
+
? 0
|
|
8812
|
+
: -1, title: date.toLocaleDateString(locale) }, (selectionType === 'day' &&
|
|
8813
|
+
(month === 'current' || selectAdjacementDays) && {
|
|
8814
|
+
onBlur: function () { return onCalendarMouseLeave(); },
|
|
8815
|
+
onClick: function () { return onCalendarClick(date); },
|
|
8816
|
+
onFocus: function () { return onCalendarMouseEnter(date); },
|
|
8817
|
+
onKeyDown: function (event) { return onCalendarKeyDown(event, date); },
|
|
8818
|
+
onMouseEnter: function () { return onCalendarMouseEnter(date); },
|
|
8819
|
+
onMouseLeave: function () { return onCalendarMouseLeave(); },
|
|
8820
|
+
}), (month !== 'current' &&
|
|
8821
|
+
!selectAdjacementDays && {
|
|
8822
|
+
onMouseEnter: function () { return onCalendarMouseLeave(); },
|
|
8823
|
+
})),
|
|
8824
|
+
React$1.createElement("div", { className: "calendar-cell-inner" }, typeof dayFormat === 'function'
|
|
8825
|
+
? dayFormat(date)
|
|
8826
|
+
: date.toLocaleDateString(locale, { day: dayFormat })))) : (React$1.createElement("td", { key: idx }));
|
|
8827
|
+
})));
|
|
8719
8828
|
}),
|
|
8720
8829
|
view === 'months' &&
|
|
8721
8830
|
listOfMonths.map(function (row, index) {
|
|
8722
8831
|
return (React$1.createElement("tr", { key: index }, row.map(function (month, idx) {
|
|
8723
|
-
|
|
8832
|
+
var monthNumber = index * 3 + idx;
|
|
8833
|
+
var date = new Date(Date.UTC(calendarDate.getFullYear(), monthNumber, 1));
|
|
8834
|
+
var isDisabled = isDateDisabled(date, minDate, maxDate, disabledDates);
|
|
8835
|
+
return (React$1.createElement("td", __assign$1({ className: classNames$1('calendar-cell', {
|
|
8836
|
+
disabled: isDisabled,
|
|
8837
|
+
selected: isDateSelected(date, startDate, endDate),
|
|
8838
|
+
'range-hover': selectionType === 'month' &&
|
|
8839
|
+
(hoverDate && selectEndDate
|
|
8840
|
+
? isDateInRange(date, startDate, hoverDate)
|
|
8841
|
+
: isDateInRange(date, hoverDate, endDate)),
|
|
8842
|
+
range: isDateInRange(date, startDate, endDate),
|
|
8843
|
+
}), key: idx, tabIndex: !isDisabled ? 0 : -1 }, (!isDisabled && {
|
|
8844
|
+
onBlur: function () { return onCalendarMouseLeave(); },
|
|
8845
|
+
onClick: function () { return onCalendarClick(date); },
|
|
8846
|
+
onFocus: function () { return onCalendarMouseEnter(date); },
|
|
8847
|
+
onKeyDown: function (event) { return onCalendarKeyDown(event, date); },
|
|
8848
|
+
onMouseEnter: function () { return onCalendarMouseEnter(date); },
|
|
8849
|
+
onMouseLeave: function () { return onCalendarMouseLeave(); },
|
|
8850
|
+
})),
|
|
8724
8851
|
React$1.createElement("div", { className: "calendar-cell-inner" }, month)));
|
|
8725
8852
|
})));
|
|
8726
8853
|
}),
|
|
8727
8854
|
view === 'years' &&
|
|
8728
8855
|
listOfYears.map(function (row, index) {
|
|
8729
8856
|
return (React$1.createElement("tr", { key: index }, row.map(function (year, idx) {
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8857
|
+
var date = new Date(Date.UTC(year, 0, 1));
|
|
8858
|
+
var isDisabled = isDateDisabled(date, minDate, maxDate, disabledDates);
|
|
8859
|
+
return (React$1.createElement("td", __assign$1({ className: classNames$1('calendar-cell year', {
|
|
8860
|
+
disabled: isDisabled,
|
|
8861
|
+
selected: isDateSelected(date, startDate, endDate),
|
|
8862
|
+
'range-hover': selectionType === 'year' &&
|
|
8863
|
+
(hoverDate && selectEndDate
|
|
8864
|
+
? isDateInRange(date, startDate, hoverDate)
|
|
8865
|
+
: isDateInRange(date, hoverDate, endDate)),
|
|
8866
|
+
range: isDateInRange(date, startDate, endDate),
|
|
8867
|
+
}), key: idx, tabIndex: !isDisabled ? 0 : -1 }, (!isDisabled && {
|
|
8868
|
+
onBlur: function () { return onCalendarMouseLeave(); },
|
|
8869
|
+
onClick: function () { return onCalendarClick(date); },
|
|
8870
|
+
onFocus: function () { return onCalendarMouseEnter(date); },
|
|
8871
|
+
onKeyDown: function (event) { return onCalendarKeyDown(event, date); },
|
|
8872
|
+
onMouseEnter: function () { return onCalendarMouseEnter(date); },
|
|
8873
|
+
onMouseLeave: function () { return onCalendarMouseLeave(); },
|
|
8874
|
+
})),
|
|
8735
8875
|
React$1.createElement("div", { className: "calendar-cell-inner" }, new Date(year, 0, 1).toLocaleDateString(locale, { year: 'numeric' }))));
|
|
8736
8876
|
})));
|
|
8737
8877
|
}))));
|
|
8738
8878
|
};
|
|
8739
8879
|
var Navigation = function (props) {
|
|
8740
|
-
var
|
|
8741
|
-
var _a = React$1.useState(), date = _a[0], setDate = _a[1];
|
|
8742
|
-
React$1.useEffect(function () {
|
|
8743
|
-
if (addMonths !== 0) {
|
|
8744
|
-
setDate(new Date(calendarDate.getFullYear(), calendarDate.getMonth() + addMonths, 1));
|
|
8745
|
-
return;
|
|
8746
|
-
}
|
|
8747
|
-
setDate(calendarDate);
|
|
8748
|
-
}, [calendarDate]);
|
|
8880
|
+
var calendarDate = props.calendarDate, locale = props.locale, navigation = props.navigation, navNextDoubleIcon = props.navNextDoubleIcon, navNextIcon = props.navNextIcon, navPrevDoubleIcon = props.navPrevDoubleIcon, navPrevIcon = props.navPrevIcon, navYearFirst = props.navYearFirst, onMonthClick = props.onMonthClick, onNavigationClick = props.onNavigationClick, onYearClick = props.onYearClick, view = props.view;
|
|
8749
8881
|
return (React$1.createElement("div", { className: "calendar-nav" },
|
|
8750
8882
|
navigation && (React$1.createElement("div", { className: "calendar-nav-prev" },
|
|
8751
8883
|
React$1.createElement(CButton, { color: "transparent", size: "sm", onClick: function () { return onNavigationClick('prev', true); } }, navPrevDoubleIcon !== null && navPrevDoubleIcon !== void 0 ? navPrevDoubleIcon : (React$1.createElement("span", { className: "calendar-nav-icon calendar-nav-icon-double-prev" }))),
|
|
8752
8884
|
view === 'days' && (React$1.createElement(CButton, { color: "transparent", size: "sm", onClick: function () { return onNavigationClick('prev'); } }, navPrevIcon !== null && navPrevIcon !== void 0 ? navPrevIcon : React$1.createElement("span", { className: "calendar-nav-icon calendar-nav-icon-prev" }))))),
|
|
8753
8885
|
React$1.createElement("div", __assign$1({ className: "calendar-nav-date" }, (navYearFirst && { style: { display: 'flex', justifyContent: 'center' } })),
|
|
8754
|
-
view === 'days' && (React$1.createElement(CButton, { color: "transparent", size: "sm", onClick: function () { return navigation && onMonthClick(); } },
|
|
8755
|
-
React$1.createElement(CButton, __assign$1({ color: "transparent", size: "sm", onClick: function () { return navigation && onYearClick(); } }, (navYearFirst && { style: { order: '-1' } })),
|
|
8886
|
+
view === 'days' && (React$1.createElement(CButton, { color: "transparent", size: "sm", onClick: function () { return navigation && onMonthClick(); } }, calendarDate && calendarDate.toLocaleDateString(locale, { month: 'long' }))),
|
|
8887
|
+
React$1.createElement(CButton, __assign$1({ color: "transparent", size: "sm", onClick: function () { return navigation && onYearClick(); } }, (navYearFirst && { style: { order: '-1' } })), calendarDate && calendarDate.toLocaleDateString(locale, { year: 'numeric' }))),
|
|
8756
8888
|
navigation && (React$1.createElement("div", { className: "calendar-nav-next" },
|
|
8757
8889
|
view === 'days' && (React$1.createElement(CButton, { color: "transparent", size: "sm", onClick: function () { return onNavigationClick('next'); } }, navNextIcon !== null && navNextIcon !== void 0 ? navNextIcon : React$1.createElement("span", { className: "calendar-nav-icon calendar-nav-icon-next" }))),
|
|
8758
8890
|
React$1.createElement(CButton, { color: "transparent", size: "sm", onClick: function () { return onNavigationClick('next', true); } }, navNextDoubleIcon !== null && navNextDoubleIcon !== void 0 ? navNextDoubleIcon : (React$1.createElement("span", { className: "calendar-nav-icon calendar-nav-icon-double-next" })))))));
|
|
8759
8891
|
};
|
|
8760
8892
|
var CCalendar = React$1.forwardRef(function (_a, ref) {
|
|
8761
|
-
var
|
|
8893
|
+
var _b;
|
|
8894
|
+
var startDate = _a.startDate, endDate = _a.endDate, _c = _a.calendarDate, calendarDate = _c === void 0 ? startDate || endDate || null : _c, _d = _a.calendars, calendars = _d === void 0 ? 1 : _d, className = _a.className, _e = _a.dayFormat, dayFormat = _e === void 0 ? 'numeric' : _e, disabledDates = _a.disabledDates, _f = _a.firstDayOfWeek, firstDayOfWeek = _f === void 0 ? 1 : _f, _g = _a.locale, locale = _g === void 0 ? 'default' : _g, maxDate = _a.maxDate, minDate = _a.minDate, _h = _a.navigation, navigation = _h === void 0 ? true : _h, navNextIcon = _a.navNextIcon, navNextDoubleIcon = _a.navNextDoubleIcon, navPrevIcon = _a.navPrevIcon, navPrevDoubleIcon = _a.navPrevDoubleIcon, navYearFirst = _a.navYearFirst, range = _a.range, _j = _a.selectAdjacementDays, selectAdjacementDays = _j === void 0 ? false : _j, selectEndDate = _a.selectEndDate, _k = _a.selectionType, selectionType = _k === void 0 ? 'day' : _k, _l = _a.showAdjacementDays, showAdjacementDays = _l === void 0 ? true : _l, _m = _a.showWeekNumber, showWeekNumber = _m === void 0 ? false : _m, _o = _a.weekdayFormat, weekdayFormat = _o === void 0 ? 2 : _o, weekNumbersLabel = _a.weekNumbersLabel, onCalendarDateChange = _a.onCalendarDateChange, onDateHover = _a.onDateHover, onEndDateChange = _a.onEndDateChange, onStartDateChange = _a.onStartDateChange, onSelectEndChange = _a.onSelectEndChange, onViewChanged = _a.onViewChanged;
|
|
8895
|
+
var calendarRef = React$1.useRef(null);
|
|
8896
|
+
var forkedRef = useForkedRef(ref, calendarRef);
|
|
8762
8897
|
var isInitialMount = React$1.useRef(true);
|
|
8763
|
-
var
|
|
8898
|
+
var _p = React$1.useState(null), _calendarDate = _p[0], setCalendarDate = _p[1];
|
|
8899
|
+
React$1.useEffect(function () {
|
|
8900
|
+
if (selectionType === 'day' || selectionType === 'week') {
|
|
8901
|
+
setView('days');
|
|
8902
|
+
return;
|
|
8903
|
+
}
|
|
8904
|
+
if (selectionType === 'month') {
|
|
8905
|
+
setView('months');
|
|
8906
|
+
return;
|
|
8907
|
+
}
|
|
8908
|
+
if (selectionType === 'year') {
|
|
8909
|
+
setView('years');
|
|
8910
|
+
return;
|
|
8911
|
+
}
|
|
8912
|
+
}, [selectionType]);
|
|
8764
8913
|
React$1.useEffect(function () {
|
|
8765
8914
|
if (calendarDate === null) {
|
|
8766
8915
|
setCalendarDate(new Date());
|
|
8767
8916
|
return;
|
|
8768
8917
|
}
|
|
8769
8918
|
if (calendarDate) {
|
|
8770
|
-
var date =
|
|
8919
|
+
var date = convertToDateObject(calendarDate, selectionType);
|
|
8771
8920
|
!isSameDateAs(_calendarDate, date) && setCalendarDate(date);
|
|
8772
8921
|
}
|
|
8773
8922
|
}, [calendarDate]);
|
|
8774
|
-
var
|
|
8923
|
+
var _q = useStateWithCallback(startDate ? convertToDateObject(startDate, selectionType) : null, function () {
|
|
8924
|
+
return onStartDateChange && onStartDateChange(getDateBySelectionType(_startDate, selectionType));
|
|
8925
|
+
}, !isInitialMount.current), _startDate = _q[0], setStartDate = _q[1];
|
|
8775
8926
|
React$1.useEffect(function () {
|
|
8776
|
-
var date = startDate ?
|
|
8927
|
+
var date = startDate ? convertToDateObject(startDate, selectionType) : null;
|
|
8777
8928
|
if (!isSameDateAs(date, _startDate)) {
|
|
8778
8929
|
setStartDate(date);
|
|
8779
8930
|
}
|
|
8780
8931
|
}, [startDate]);
|
|
8781
|
-
var
|
|
8932
|
+
var _r = useStateWithCallback(endDate ? convertToDateObject(endDate, selectionType) : null, function () { return onEndDateChange && onEndDateChange(getDateBySelectionType(_endDate, selectionType)); }, !isInitialMount.current), _endDate = _r[0], setEndDate = _r[1];
|
|
8782
8933
|
React$1.useEffect(function () {
|
|
8783
|
-
var date = endDate ?
|
|
8934
|
+
var date = endDate ? convertToDateObject(endDate, selectionType) : null;
|
|
8784
8935
|
if (!isSameDateAs(date, _endDate)) {
|
|
8785
8936
|
setEndDate(date);
|
|
8786
8937
|
}
|
|
8787
8938
|
}, [endDate]);
|
|
8788
|
-
var
|
|
8789
|
-
var
|
|
8939
|
+
var _s = React$1.useState(null), _hoverDate = _s[0], setHoverDate = _s[1];
|
|
8940
|
+
var _t = React$1.useState(maxDate ? convertToDateObject(maxDate, selectionType) : null), _maxDate = _t[0], setMaxDate = _t[1];
|
|
8790
8941
|
React$1.useEffect(function () {
|
|
8791
|
-
maxDate && setMaxDate(
|
|
8942
|
+
maxDate && setMaxDate(convertToDateObject(maxDate, selectionType));
|
|
8792
8943
|
}, [maxDate]);
|
|
8793
|
-
var
|
|
8944
|
+
var _u = React$1.useState(minDate ? convertToDateObject(minDate, selectionType) : null), _minDate = _u[0], setMinDate = _u[1];
|
|
8794
8945
|
React$1.useEffect(function () {
|
|
8795
|
-
minDate && setMinDate(
|
|
8946
|
+
minDate && setMinDate(convertToDateObject(minDate, selectionType));
|
|
8796
8947
|
}, [minDate]);
|
|
8797
|
-
var
|
|
8948
|
+
var _v = useStateWithCallback(selectEndDate, onSelectEndChange), _selectEndDate = _v[0], setSelectEndDate = _v[1];
|
|
8798
8949
|
React$1.useEffect(function () {
|
|
8799
8950
|
setSelectEndDate(selectEndDate);
|
|
8800
8951
|
}, [selectEndDate]);
|
|
@@ -8804,7 +8955,7 @@ var CCalendar = React$1.forwardRef(function (_a, ref) {
|
|
|
8804
8955
|
onSelectEndChange &&
|
|
8805
8956
|
onSelectEndChange(_selectEndDate);
|
|
8806
8957
|
}, [_selectEndDate]);
|
|
8807
|
-
var
|
|
8958
|
+
var _w = useStateWithCallback('days', onViewChanged), view = _w[0], setView = _w[1];
|
|
8808
8959
|
React$1.useEffect(function () {
|
|
8809
8960
|
isInitialMount.current = false;
|
|
8810
8961
|
}, []);
|
|
@@ -8822,12 +8973,24 @@ var CCalendar = React$1.forwardRef(function (_a, ref) {
|
|
|
8822
8973
|
setCalendarDate(d);
|
|
8823
8974
|
onCalendarDateChange && onCalendarDateChange(d);
|
|
8824
8975
|
};
|
|
8825
|
-
var
|
|
8976
|
+
var handleCalendarClick = function (date, index) {
|
|
8826
8977
|
if (isDateDisabled(date, _minDate, _maxDate, disabledDates)) {
|
|
8827
8978
|
return;
|
|
8828
8979
|
}
|
|
8829
8980
|
var _date = new Date(date);
|
|
8830
|
-
|
|
8981
|
+
if (view === 'days') {
|
|
8982
|
+
setCalendarDate(index ? new Date(_date.setMonth(_date.getMonth() - index)) : _date);
|
|
8983
|
+
}
|
|
8984
|
+
if (view === 'months' && selectionType !== 'month') {
|
|
8985
|
+
setCalendarDate(index ? new Date(_date.setMonth(_date.getMonth() - index)) : _date);
|
|
8986
|
+
setView('days');
|
|
8987
|
+
return;
|
|
8988
|
+
}
|
|
8989
|
+
if (view === 'years' && selectionType !== 'year') {
|
|
8990
|
+
setCalendarDate(index ? new Date(_date.setFullYear(_date.getFullYear() - index)) : _date);
|
|
8991
|
+
setView('months');
|
|
8992
|
+
return;
|
|
8993
|
+
}
|
|
8831
8994
|
if (range) {
|
|
8832
8995
|
if (_selectEndDate) {
|
|
8833
8996
|
setSelectEndDate(false);
|
|
@@ -8860,31 +9023,88 @@ var CCalendar = React$1.forwardRef(function (_a, ref) {
|
|
|
8860
9023
|
}
|
|
8861
9024
|
setStartDate(date);
|
|
8862
9025
|
};
|
|
8863
|
-
var
|
|
9026
|
+
var handleCalendarKeyDown = function (event, date, index) {
|
|
8864
9027
|
if (event.code === 'Space' || event.key === 'Enter') {
|
|
8865
9028
|
event.preventDefault();
|
|
8866
|
-
|
|
9029
|
+
handleCalendarClick(date, index);
|
|
9030
|
+
}
|
|
9031
|
+
if (event.key === 'ArrowRight' ||
|
|
9032
|
+
event.key === 'ArrowLeft' ||
|
|
9033
|
+
event.key === 'ArrowUp' ||
|
|
9034
|
+
event.key === 'ArrowDown') {
|
|
9035
|
+
event.preventDefault();
|
|
9036
|
+
if (maxDate &&
|
|
9037
|
+
date >= convertToDateObject(maxDate, selectionType) &&
|
|
9038
|
+
(event.key === 'ArrowRight' || event.key === 'ArrowDown')) {
|
|
9039
|
+
return;
|
|
9040
|
+
}
|
|
9041
|
+
if (minDate &&
|
|
9042
|
+
date <= convertToDateObject(minDate, selectionType) &&
|
|
9043
|
+
(event.key === 'ArrowLeft' || event.key === 'ArrowUp')) {
|
|
9044
|
+
return;
|
|
9045
|
+
}
|
|
9046
|
+
var element_1 = event.target;
|
|
9047
|
+
if (selectionType === 'week' && element_1.tabIndex === -1) {
|
|
9048
|
+
element_1 = element_1.closest('tr[tabindex="0"]');
|
|
9049
|
+
}
|
|
9050
|
+
var list_1 = [].concat.apply([], Element.prototype.querySelectorAll.call(calendarRef.current, 'td[tabindex="0"], tr[tabindex="0"]'));
|
|
9051
|
+
var index_1 = list_1.indexOf(element_1);
|
|
9052
|
+
var first = index_1 === 0;
|
|
9053
|
+
var last = index_1 === list_1.length - 1;
|
|
9054
|
+
var toBoundary = {
|
|
9055
|
+
start: index_1,
|
|
9056
|
+
end: list_1.length - (index_1 + 1),
|
|
9057
|
+
};
|
|
9058
|
+
var gap_1 = {
|
|
9059
|
+
ArrowRight: 1,
|
|
9060
|
+
ArrowLeft: -1,
|
|
9061
|
+
ArrowUp: selectionType === 'week' && view === 'days' ? -1 : view === 'days' ? -7 : -3,
|
|
9062
|
+
ArrowDown: selectionType === 'week' && view === 'days' ? 1 : view === 'days' ? 7 : 3,
|
|
9063
|
+
};
|
|
9064
|
+
if ((event.key === 'ArrowRight' && last) ||
|
|
9065
|
+
(event.key === 'ArrowDown' && toBoundary['end'] < gap_1['ArrowDown']) ||
|
|
9066
|
+
(event.key === 'ArrowLeft' && first) ||
|
|
9067
|
+
(event.key === 'ArrowUp' && toBoundary['start'] < Math.abs(gap_1['ArrowUp']))) {
|
|
9068
|
+
if (view === 'days') {
|
|
9069
|
+
setCalendarPage(0, event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 1 : -1);
|
|
9070
|
+
}
|
|
9071
|
+
if (view === 'months') {
|
|
9072
|
+
setCalendarPage(event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 1 : -1);
|
|
9073
|
+
}
|
|
9074
|
+
if (view === 'years') {
|
|
9075
|
+
setCalendarPage(event.key === 'ArrowRight' || event.key === 'ArrowDown' ? 10 : -10);
|
|
9076
|
+
}
|
|
9077
|
+
setTimeout(function () {
|
|
9078
|
+
var _a;
|
|
9079
|
+
var _list = [].concat.apply([], Element.prototype.querySelectorAll.call((_a = element_1.parentNode) === null || _a === void 0 ? void 0 : _a.parentNode, 'td[tabindex="0"], tr[tabindex="0"]'));
|
|
9080
|
+
if (_list.length && event.key === 'ArrowRight') {
|
|
9081
|
+
_list[0].focus();
|
|
9082
|
+
}
|
|
9083
|
+
if (_list.length && event.key === 'ArrowLeft') {
|
|
9084
|
+
_list[_list.length - 1].focus();
|
|
9085
|
+
}
|
|
9086
|
+
if (_list.length && event.key === 'ArrowDown') {
|
|
9087
|
+
_list[gap_1['ArrowDown'] - (list_1.length - index_1)].focus();
|
|
9088
|
+
}
|
|
9089
|
+
if (_list.length && event.key === 'ArrowUp') {
|
|
9090
|
+
_list[_list.length - (Math.abs(gap_1['ArrowUp']) + 1 - (index_1 + 1))].focus();
|
|
9091
|
+
}
|
|
9092
|
+
}, 1);
|
|
9093
|
+
return;
|
|
9094
|
+
}
|
|
9095
|
+
list_1[index_1 + gap_1[event.key]].focus();
|
|
8867
9096
|
}
|
|
8868
9097
|
};
|
|
8869
|
-
var
|
|
9098
|
+
var handleCalendarMouseEnter = function (date) {
|
|
8870
9099
|
if (isDateDisabled(date, _minDate, _maxDate, disabledDates)) {
|
|
8871
9100
|
return;
|
|
8872
9101
|
}
|
|
8873
9102
|
setHoverDate(date);
|
|
8874
|
-
|
|
9103
|
+
date && onDateHover && onDateHover(getDateBySelectionType(date, selectionType));
|
|
8875
9104
|
};
|
|
8876
|
-
var
|
|
9105
|
+
var handleCalendarMouseLeave = function () {
|
|
8877
9106
|
setHoverDate(null);
|
|
8878
|
-
|
|
8879
|
-
};
|
|
8880
|
-
var handleMonthClick = function (month) {
|
|
8881
|
-
setCalendarPage(0, 0, month);
|
|
8882
|
-
setView('days');
|
|
8883
|
-
};
|
|
8884
|
-
var handleMonthKeyDown = function (event, month) {
|
|
8885
|
-
if (event.code === 'Space' || event.key === 'Enter') {
|
|
8886
|
-
handleMonthClick(month);
|
|
8887
|
-
}
|
|
9107
|
+
onDateHover && onDateHover(null);
|
|
8888
9108
|
};
|
|
8889
9109
|
var handleNavigationOnClick = function (direction, double) {
|
|
8890
9110
|
if (double === void 0) { double = false; }
|
|
@@ -8913,19 +9133,16 @@ var CCalendar = React$1.forwardRef(function (_a, ref) {
|
|
|
8913
9133
|
return;
|
|
8914
9134
|
}
|
|
8915
9135
|
};
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
Array.from({ length: calendars }, function (_, index) { return (React$1.createElement("div", { className: classNames$1('calendar', view), key: index, ref: ref },
|
|
8927
|
-
React$1.createElement(Navigation, { addMonths: index, calendarDate: _calendarDate, locale: locale, navigation: navigation, navNextDoubleIcon: navNextDoubleIcon, navNextIcon: navNextIcon, navPrevDoubleIcon: navPrevDoubleIcon, navPrevIcon: navPrevIcon, navYearFirst: navYearFirst, onMonthClick: function () { return setView('months'); }, onNavigationClick: handleNavigationOnClick, onYearClick: function () { return setView('years'); }, view: view }),
|
|
8928
|
-
React$1.createElement(Calendar, { addMonths: index, calendarDate: _calendarDate, dayFormat: dayFormat, disabledDates: disabledDates, endDate: _endDate, firstDayOfWeek: firstDayOfWeek, hoverDate: _hoverDate, locale: locale, maxDate: _maxDate, minDate: _minDate, onDayClick: function (date) { return handleDayClick(date, index); }, onDayKeyDown: function (event, date) { return handleDayKeyDown(event, date, index); }, onDayMouseEnter: handleDayMouseEnter, onDayMouseLeave: handleDayMouseLeave, onMonthClick: handleMonthClick, onMonthKeyDown: handleMonthKeyDown, onYearClick: handleYearClick, onYearKeyDown: handleYearKeyDown, selectEndDate: _selectEndDate, selectAdjacementDays: selectAdjacementDays, showAdjacementDays: showAdjacementDays, startDate: _startDate, view: view, weekdayFormat: weekdayFormat }))); })));
|
|
9136
|
+
return (React$1.createElement("div", { className: classNames$1('calendars', (_b = {},
|
|
9137
|
+
_b["select-".concat(selectionType)] = selectionType && view === 'days',
|
|
9138
|
+
_b['show-week-numbers'] = showWeekNumber,
|
|
9139
|
+
_b), className), ref: forkedRef }, _calendarDate &&
|
|
9140
|
+
Array.from({ length: calendars }, function (_, index) {
|
|
9141
|
+
var calendarDate = getCalendarDate(_calendarDate, index, view);
|
|
9142
|
+
return (React$1.createElement("div", { className: classNames$1('calendar', view), key: index },
|
|
9143
|
+
React$1.createElement(Navigation, { calendarDate: calendarDate, locale: locale, navigation: navigation, navNextDoubleIcon: navNextDoubleIcon, navNextIcon: navNextIcon, navPrevDoubleIcon: navPrevDoubleIcon, navPrevIcon: navPrevIcon, navYearFirst: navYearFirst, onMonthClick: function () { return setView('months'); }, onNavigationClick: handleNavigationOnClick, onYearClick: function () { return setView('years'); }, view: view }),
|
|
9144
|
+
React$1.createElement(Calendar, { calendarDate: calendarDate, dayFormat: dayFormat, disabledDates: disabledDates, endDate: _endDate, firstDayOfWeek: firstDayOfWeek, hoverDate: _hoverDate, locale: locale, maxDate: _maxDate, minDate: _minDate, onCalendarClick: function (date) { return handleCalendarClick(date, index); }, onCalendarKeyDown: function (event, date) { return handleCalendarKeyDown(event, date, index); }, onCalendarMouseEnter: handleCalendarMouseEnter, onCalendarMouseLeave: handleCalendarMouseLeave, order: index, selectAdjacementDays: selectAdjacementDays, selectEndDate: _selectEndDate, selectionType: selectionType, showAdjacementDays: showAdjacementDays, showWeekNumber: showWeekNumber, startDate: _startDate, view: view, weekdayFormat: weekdayFormat, weekNumbersLabel: weekNumbersLabel })));
|
|
9145
|
+
})));
|
|
8929
9146
|
});
|
|
8930
9147
|
CCalendar.propTypes = {
|
|
8931
9148
|
className: PropTypes$1.string,
|
|
@@ -8950,14 +9167,17 @@ CCalendar.propTypes = {
|
|
|
8950
9167
|
range: PropTypes$1.bool,
|
|
8951
9168
|
selectAdjacementDays: PropTypes$1.bool,
|
|
8952
9169
|
selectEndDate: PropTypes$1.bool,
|
|
9170
|
+
selectionType: PropTypes$1.oneOf(['day', 'week', 'month', 'year']),
|
|
8953
9171
|
showAdjacementDays: PropTypes$1.bool,
|
|
9172
|
+
showWeekNumber: PropTypes$1.bool,
|
|
8954
9173
|
startDate: PropTypes$1.oneOfType([PropTypes$1.instanceOf(Date), PropTypes$1.string]),
|
|
8955
9174
|
weekdayFormat: PropTypes$1.oneOfType([
|
|
8956
9175
|
PropTypes$1.func,
|
|
8957
9176
|
PropTypes$1.number,
|
|
8958
9177
|
PropTypes$1.oneOf(['long', 'narrow', 'short']),
|
|
8959
9178
|
]),
|
|
8960
|
-
|
|
9179
|
+
weekNumbersLabel: PropTypes$1.string,
|
|
9180
|
+
onDateHover: PropTypes$1.func,
|
|
8961
9181
|
onCalendarDateChange: PropTypes$1.func,
|
|
8962
9182
|
onEndDateChange: PropTypes$1.func,
|
|
8963
9183
|
onSelectEndChange: PropTypes$1.func,
|
|
@@ -9110,7 +9330,7 @@ var CPicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9110
9330
|
return (React$1.createElement("div", { className: classNames$1('picker', className), ref: pickerForkedRef }, children));
|
|
9111
9331
|
}
|
|
9112
9332
|
default: {
|
|
9113
|
-
return (React$1.createElement("div", { className: classNames$1(
|
|
9333
|
+
return (React$1.createElement("div", { className: classNames$1(className, {
|
|
9114
9334
|
show: _visible,
|
|
9115
9335
|
}), onClick: function () { return !disabled && setVisible(true); }, ref: pickerForkedRef },
|
|
9116
9336
|
toggler &&
|
|
@@ -9118,9 +9338,7 @@ var CPicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9118
9338
|
React$1.cloneElement(toggler, {
|
|
9119
9339
|
ref: togglerRef,
|
|
9120
9340
|
}),
|
|
9121
|
-
React$1.createElement("div", { className:
|
|
9122
|
-
show: _visible,
|
|
9123
|
-
}, dropdownClassNames), ref: dropdownRef },
|
|
9341
|
+
React$1.createElement("div", { className: dropdownClassNames, ref: dropdownRef },
|
|
9124
9342
|
children,
|
|
9125
9343
|
footer && footerContent)));
|
|
9126
9344
|
}
|
|
@@ -9189,7 +9407,11 @@ var convert12hTo24h = function (abbr, hour) {
|
|
|
9189
9407
|
};
|
|
9190
9408
|
var convert24hTo12h = function (hour) { return hour % 12 || 12; };
|
|
9191
9409
|
var convertTimeToDate = function (time) {
|
|
9192
|
-
return time
|
|
9410
|
+
return time
|
|
9411
|
+
? time instanceof Date
|
|
9412
|
+
? time
|
|
9413
|
+
: new Date("1970-01-01 ".concat(time))
|
|
9414
|
+
: null;
|
|
9193
9415
|
};
|
|
9194
9416
|
var getAmPm = function (date, locale) {
|
|
9195
9417
|
if (date.toLocaleTimeString(locale).includes('AM')) {
|
|
@@ -9333,37 +9555,39 @@ var CTimePicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9333
9555
|
setDate(new Date(_date));
|
|
9334
9556
|
onTimeChange && onTimeChange(_date.toTimeString(), _date.toLocaleTimeString(), _date);
|
|
9335
9557
|
};
|
|
9336
|
-
var InputGroup = function () {
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9558
|
+
var InputGroup = function () { return (React$1.createElement("div", { className: "time-picker-input-group" },
|
|
9559
|
+
React$1.createElement("input", { autoComplete: "off", className: "time-picker-input",
|
|
9560
|
+
// delay={true}
|
|
9561
|
+
disabled: disabled, onChange: function (event) {
|
|
9562
|
+
return isValidTime(event.target.value) && setDate(convertTimeToDate(event.target.value));
|
|
9563
|
+
}, placeholder: placeholder, readOnly: inputReadOnly, required: required, ref: inputRef }),
|
|
9564
|
+
indicator &&
|
|
9565
|
+
(typeof indicator === 'boolean' ? React$1.createElement("div", { className: "time-picker-indicator" }) : indicator),
|
|
9566
|
+
cleaner &&
|
|
9567
|
+
date &&
|
|
9568
|
+
(typeof cleaner === 'boolean' ? (React$1.createElement("div", { className: "time-picker-cleaner", onClick: function (event) { return handleClear(event); } })) : (React$1.isValidElement(cleaner) &&
|
|
9569
|
+
React$1.cloneElement(cleaner, {
|
|
9570
|
+
onClick: function (event) { return handleClear(event); },
|
|
9571
|
+
}))))); };
|
|
9348
9572
|
var TimePickerSelect = function () {
|
|
9349
9573
|
return (React$1.createElement(React$1.Fragment, null,
|
|
9350
9574
|
React$1.createElement("span", { className: "time-picker-inline-icon" }),
|
|
9351
|
-
React$1.createElement("select", { className: "
|
|
9575
|
+
React$1.createElement("select", { className: "time-picker-inline-select", disabled: disabled, onChange: function (event) {
|
|
9352
9576
|
return handleTimeChange('hours', event.target.value);
|
|
9353
9577
|
}, value: getSelectedHour(date, locale) }, localizedTimePartials &&
|
|
9354
9578
|
localizedTimePartials.listOfHours.map(function (option, index) { return (React$1.createElement("option", { value: option.value.toString(), key: index }, option.label)); })),
|
|
9355
9579
|
React$1.createElement(React$1.Fragment, null, ":"),
|
|
9356
|
-
React$1.createElement("select", { className: "
|
|
9580
|
+
React$1.createElement("select", { className: "time-picker-inline-select", disabled: disabled, onChange: function (event) {
|
|
9357
9581
|
return handleTimeChange('minutes', event.target.value);
|
|
9358
9582
|
}, value: getSelectedMinutes(date) }, localizedTimePartials &&
|
|
9359
9583
|
localizedTimePartials.listOfMinutes.map(function (option, index) { return (React$1.createElement("option", { value: option.value.toString(), key: index }, option.label)); })),
|
|
9360
9584
|
seconds && (React$1.createElement(React$1.Fragment, null,
|
|
9361
9585
|
React$1.createElement(React$1.Fragment, null, ":"),
|
|
9362
|
-
React$1.createElement("select", { className: "
|
|
9586
|
+
React$1.createElement("select", { className: "time-picker-inline-select", disabled: disabled, onChange: function (event) {
|
|
9363
9587
|
return handleTimeChange('seconds', event.target.value);
|
|
9364
9588
|
}, value: getSelectedSeconds(date) }, localizedTimePartials &&
|
|
9365
9589
|
localizedTimePartials.listOfSeconds.map(function (option, index) { return (React$1.createElement("option", { value: option.value.toString(), key: index }, option.label)); })))),
|
|
9366
|
-
localizedTimePartials && localizedTimePartials.hour12 && (React$1.createElement("select", { className: "
|
|
9590
|
+
localizedTimePartials && localizedTimePartials.hour12 && (React$1.createElement("select", { className: "time-picker-inline-select", disabled: disabled, onChange: function (event) {
|
|
9367
9591
|
return handleTimeChange('toggle', event.target.value);
|
|
9368
9592
|
}, value: _ampm },
|
|
9369
9593
|
React$1.createElement("option", { value: "am" }, "AM"),
|
|
@@ -9383,7 +9607,7 @@ var CTimePicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9383
9607
|
_b.disabled = disabled,
|
|
9384
9608
|
_b['is-invalid'] = isValid === false ? true : false,
|
|
9385
9609
|
_b['is-valid'] = isValid,
|
|
9386
|
-
_b), className), container: container, disabled: disabled, dropdownClassNames: "time-picker-dropdown", footer: footer, footerContent: React$1.createElement("div", { className: "picker-footer" },
|
|
9610
|
+
_b), className), container: container, disabled: disabled, dropdownClassNames: "time-picker-dropdown", footer: footer, footerContent: React$1.createElement("div", { className: "time-picker-footer" },
|
|
9387
9611
|
cancelButton && (React$1.createElement(CButton, { color: cancelButtonColor, size: cancelButtonSize, variant: cancelButtonVariant, onClick: function () {
|
|
9388
9612
|
initialDate && setDate(new Date(initialDate));
|
|
9389
9613
|
setVisible(false);
|
|
@@ -9441,42 +9665,42 @@ var getLocalDateFromString = function (string, locale, time) {
|
|
|
9441
9665
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9442
9666
|
var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
|
|
9443
9667
|
var _b;
|
|
9444
|
-
var _c = _a.calendars, calendars = _c === void 0 ? 2 : _c, calendarDate = _a.calendarDate, _d = _a.cancelButton, cancelButton = _d === void 0 ? 'Cancel' : _d, _e = _a.cancelButtonColor, cancelButtonColor = _e === void 0 ? 'primary' : _e, _f = _a.cancelButtonSize, cancelButtonSize = _f === void 0 ? 'sm' : _f, _g = _a.cancelButtonVariant, cancelButtonVariant = _g === void 0 ? 'ghost' : _g, className = _a.className, _h = _a.cleaner, cleaner = _h === void 0 ? true : _h, _j = _a.closeOnSelect, closeOnSelect = _j === void 0 ? true : _j, _k = _a.confirmButton, confirmButton = _k === void 0 ? 'OK' : _k, _l = _a.confirmButtonColor, confirmButtonColor = _l === void 0 ? 'primary' : _l, _m = _a.confirmButtonSize, confirmButtonSize = _m === void 0 ? 'sm' : _m, confirmButtonVariant = _a.confirmButtonVariant, _o = _a.indicator, indicator = _o === void 0 ? true : _o, dayFormat = _a.dayFormat, disabled = _a.disabled, disabledDates = _a.disabledDates, endDate = _a.endDate, feedback = _a.feedback, feedbackInvalid = _a.feedbackInvalid, feedbackValid = _a.feedbackValid, firstDayOfWeek = _a.firstDayOfWeek, format$1 = _a.format, footer = _a.footer, id = _a.id, inputReadOnly = _a.inputReadOnly, invalid = _a.invalid, label = _a.label, _p = _a.locale, locale = _p === void 0 ? 'default' : _p, maxDate = _a.maxDate, minDate = _a.minDate, navigation = _a.navigation, navYearFirst = _a.navYearFirst, onEndDateChange = _a.onEndDateChange, onHide = _a.onHide, onStartDateChange = _a.onStartDateChange, onShow = _a.onShow, _q = _a.placeholder, placeholder = _q === void 0 ? ['Start date', 'End date'] : _q, _r = _a.range, range = _r === void 0 ? true : _r, ranges = _a.ranges, _s = _a.rangesButtonsColor, rangesButtonsColor = _s === void 0 ? 'secondary' : _s, rangesButtonsSize = _a.rangesButtonsSize, _t = _a.rangesButtonsVariant, rangesButtonsVariant = _t === void 0 ? 'ghost' : _t, required = _a.required, _u = _a.separator, separator = _u === void 0 ? true : _u, selectAdjacementDays = _a.selectAdjacementDays, showAdjacementDays = _a.showAdjacementDays, size = _a.size, startDate = _a.startDate, text = _a.text, timepicker = _a.timepicker, toggler = _a.toggler,
|
|
9668
|
+
var _c = _a.calendars, calendars = _c === void 0 ? 2 : _c, calendarDate = _a.calendarDate, _d = _a.cancelButton, cancelButton = _d === void 0 ? 'Cancel' : _d, _e = _a.cancelButtonColor, cancelButtonColor = _e === void 0 ? 'primary' : _e, _f = _a.cancelButtonSize, cancelButtonSize = _f === void 0 ? 'sm' : _f, _g = _a.cancelButtonVariant, cancelButtonVariant = _g === void 0 ? 'ghost' : _g, className = _a.className, _h = _a.cleaner, cleaner = _h === void 0 ? true : _h, _j = _a.closeOnSelect, closeOnSelect = _j === void 0 ? true : _j, _k = _a.confirmButton, confirmButton = _k === void 0 ? 'OK' : _k, _l = _a.confirmButtonColor, confirmButtonColor = _l === void 0 ? 'primary' : _l, _m = _a.confirmButtonSize, confirmButtonSize = _m === void 0 ? 'sm' : _m, confirmButtonVariant = _a.confirmButtonVariant, _o = _a.indicator, indicator = _o === void 0 ? true : _o, dayFormat = _a.dayFormat, disabled = _a.disabled, disabledDates = _a.disabledDates, endDate = _a.endDate, feedback = _a.feedback, feedbackInvalid = _a.feedbackInvalid, feedbackValid = _a.feedbackValid, firstDayOfWeek = _a.firstDayOfWeek, format$1 = _a.format, footer = _a.footer, id = _a.id, inputReadOnly = _a.inputReadOnly, invalid = _a.invalid, label = _a.label, _p = _a.locale, locale = _p === void 0 ? 'default' : _p, maxDate = _a.maxDate, minDate = _a.minDate, navigation = _a.navigation, navYearFirst = _a.navYearFirst, onEndDateChange = _a.onEndDateChange, onHide = _a.onHide, onStartDateChange = _a.onStartDateChange, onShow = _a.onShow, _q = _a.placeholder, placeholder = _q === void 0 ? ['Start date', 'End date'] : _q, _r = _a.range, range = _r === void 0 ? true : _r, ranges = _a.ranges, _s = _a.rangesButtonsColor, rangesButtonsColor = _s === void 0 ? 'secondary' : _s, rangesButtonsSize = _a.rangesButtonsSize, _t = _a.rangesButtonsVariant, rangesButtonsVariant = _t === void 0 ? 'ghost' : _t, required = _a.required, _u = _a.separator, separator = _u === void 0 ? true : _u, selectAdjacementDays = _a.selectAdjacementDays, _v = _a.selectionType, selectionType = _v === void 0 ? 'day' : _v, showAdjacementDays = _a.showAdjacementDays, showWeekNumber = _a.showWeekNumber, size = _a.size, startDate = _a.startDate, text = _a.text, timepicker = _a.timepicker, toggler = _a.toggler, _w = _a.todayButton, todayButton = _w === void 0 ? 'Today' : _w, _x = _a.todayButtonColor, todayButtonColor = _x === void 0 ? 'primary' : _x, _y = _a.todayButtonSize, todayButtonSize = _y === void 0 ? 'sm' : _y, todayButtonVariant = _a.todayButtonVariant, tooltipFeedback = _a.tooltipFeedback, valid = _a.valid, visible = _a.visible, weekdayFormat = _a.weekdayFormat, rest = __rest$1(_a, ["calendars", "calendarDate", "cancelButton", "cancelButtonColor", "cancelButtonSize", "cancelButtonVariant", "className", "cleaner", "closeOnSelect", "confirmButton", "confirmButtonColor", "confirmButtonSize", "confirmButtonVariant", "indicator", "dayFormat", "disabled", "disabledDates", "endDate", "feedback", "feedbackInvalid", "feedbackValid", "firstDayOfWeek", "format", "footer", "id", "inputReadOnly", "invalid", "label", "locale", "maxDate", "minDate", "navigation", "navYearFirst", "onEndDateChange", "onHide", "onStartDateChange", "onShow", "placeholder", "range", "ranges", "rangesButtonsColor", "rangesButtonsSize", "rangesButtonsVariant", "required", "separator", "selectAdjacementDays", "selectionType", "showAdjacementDays", "showWeekNumber", "size", "startDate", "text", "timepicker", "toggler", "todayButton", "todayButtonColor", "todayButtonSize", "todayButtonVariant", "tooltipFeedback", "valid", "visible", "weekdayFormat"]);
|
|
9445
9669
|
var inputEndRef = React$1.useRef(null);
|
|
9446
9670
|
var inputStartRef = React$1.useRef(null);
|
|
9447
9671
|
var formRef = React$1.useRef();
|
|
9448
|
-
var
|
|
9449
|
-
var
|
|
9450
|
-
var
|
|
9451
|
-
var
|
|
9452
|
-
var
|
|
9453
|
-
var
|
|
9454
|
-
var
|
|
9455
|
-
var
|
|
9456
|
-
var
|
|
9457
|
-
var
|
|
9458
|
-
var
|
|
9459
|
-
var
|
|
9672
|
+
var _z = React$1.useState(calendarDate !== null && calendarDate !== void 0 ? calendarDate : null), _calendarDate = _z[0], setCalendarDate = _z[1];
|
|
9673
|
+
var _0 = React$1.useState(endDate !== null && endDate !== void 0 ? endDate : null), _endDate = _0[0], setEndDate = _0[1];
|
|
9674
|
+
var _1 = React$1.useState(maxDate !== null && maxDate !== void 0 ? maxDate : null), _maxDate = _1[0], setMaxDate = _1[1];
|
|
9675
|
+
var _2 = React$1.useState(minDate !== null && minDate !== void 0 ? minDate : null), _minDate = _2[0], setMinDate = _2[1];
|
|
9676
|
+
var _3 = React$1.useState(startDate !== null && startDate !== void 0 ? startDate : null), _startDate = _3[0], setStartDate = _3[1];
|
|
9677
|
+
var _4 = React$1.useState(visible), _visible = _4[0], setVisible = _4[1];
|
|
9678
|
+
var _5 = React$1.useState(startDate !== null && startDate !== void 0 ? startDate : null), initialStartDate = _5[0], setInitialStartDate = _5[1];
|
|
9679
|
+
var _6 = React$1.useState(endDate !== null && endDate !== void 0 ? endDate : null), initialEndDate = _6[0], setInitialEndDate = _6[1];
|
|
9680
|
+
var _7 = React$1.useState(null), inputStartHoverValue = _7[0], setInputStartHoverValue = _7[1];
|
|
9681
|
+
var _8 = React$1.useState(null), inputEndHoverValue = _8[0], setInputEndHoverValue = _8[1];
|
|
9682
|
+
var _9 = React$1.useState(valid !== null && valid !== void 0 ? valid : (invalid === true ? false : undefined)), isValid = _9[0], setIsValid = _9[1];
|
|
9683
|
+
var _10 = React$1.useState(false), selectEndDate = _10[0], setSelectEndDate = _10[1];
|
|
9460
9684
|
React$1.useEffect(function () {
|
|
9461
9685
|
setIsValid(valid !== null && valid !== void 0 ? valid : (invalid === true ? false : undefined));
|
|
9462
9686
|
}, [valid, invalid]);
|
|
9463
9687
|
React$1.useEffect(function () {
|
|
9464
9688
|
if (startDate) {
|
|
9465
|
-
setStartDate(
|
|
9466
|
-
setCalendarDate(
|
|
9689
|
+
setStartDate(startDate);
|
|
9690
|
+
setCalendarDate(startDate);
|
|
9467
9691
|
}
|
|
9468
9692
|
}, [startDate]);
|
|
9469
9693
|
React$1.useEffect(function () {
|
|
9470
9694
|
if (endDate) {
|
|
9471
|
-
setEndDate(
|
|
9472
|
-
setCalendarDate(
|
|
9695
|
+
setEndDate(endDate);
|
|
9696
|
+
setCalendarDate(endDate);
|
|
9473
9697
|
}
|
|
9474
9698
|
}, [endDate]);
|
|
9475
9699
|
React$1.useEffect(function () {
|
|
9476
|
-
maxDate && setMaxDate(
|
|
9700
|
+
maxDate && setMaxDate(maxDate);
|
|
9477
9701
|
}, [maxDate]);
|
|
9478
9702
|
React$1.useEffect(function () {
|
|
9479
|
-
minDate && setMinDate(
|
|
9703
|
+
minDate && setMinDate(minDate);
|
|
9480
9704
|
}, [minDate]);
|
|
9481
9705
|
React$1.useEffect(function () {
|
|
9482
9706
|
if (inputStartHoverValue) {
|
|
@@ -9506,11 +9730,15 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9506
9730
|
}
|
|
9507
9731
|
}, [formRef, _startDate, _endDate]);
|
|
9508
9732
|
var formatDate = function (date) {
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9733
|
+
if (selectionType !== 'day') {
|
|
9734
|
+
return date;
|
|
9735
|
+
}
|
|
9736
|
+
var _date = new Date(date);
|
|
9737
|
+
return format$1 ?
|
|
9738
|
+
format(_date, format$1) :
|
|
9739
|
+
timepicker ?
|
|
9740
|
+
_date.toLocaleString(locale) :
|
|
9741
|
+
_date.toLocaleDateString(locale);
|
|
9514
9742
|
};
|
|
9515
9743
|
var setInputValue = function (el, date) {
|
|
9516
9744
|
if (!el) {
|
|
@@ -9522,14 +9750,9 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9522
9750
|
}
|
|
9523
9751
|
el.value = '';
|
|
9524
9752
|
};
|
|
9525
|
-
var
|
|
9753
|
+
var handleDateHover = function (date) {
|
|
9526
9754
|
selectEndDate ? setInputEndHoverValue(date) : setInputStartHoverValue(date);
|
|
9527
9755
|
};
|
|
9528
|
-
var handleCalendarDateChange = function (date, difference) {
|
|
9529
|
-
difference
|
|
9530
|
-
? setCalendarDate(new Date(date.getFullYear(), date.getMonth() - difference, 1))
|
|
9531
|
-
: setCalendarDate(date);
|
|
9532
|
-
};
|
|
9533
9756
|
var handleClear = function (event) {
|
|
9534
9757
|
event.stopPropagation();
|
|
9535
9758
|
setStartDate(null);
|
|
@@ -9566,42 +9789,45 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9566
9789
|
setVisible(false);
|
|
9567
9790
|
}
|
|
9568
9791
|
};
|
|
9569
|
-
var InputGroup = function () {
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
(indicator
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9792
|
+
var InputGroup = function () { return (React$1.createElement("div", { className: "date-picker-input-group" },
|
|
9793
|
+
React$1.createElement("input", __assign$1({ autoComplete: "off", className: classNames$1('date-picker-input', {
|
|
9794
|
+
hover: inputStartHoverValue,
|
|
9795
|
+
}),
|
|
9796
|
+
// delay={true} TODO
|
|
9797
|
+
disabled: disabled }, (id && { name: range ? "".concat(id, "-start-date") : "".concat(id, "-date") }), { placeholder: Array.isArray(placeholder) ? placeholder[0] : placeholder, readOnly: inputReadOnly || typeof format$1 === 'string', required: required, onChange: function (event) {
|
|
9798
|
+
var date = getLocalDateFromString(event.target.value, locale, timepicker);
|
|
9799
|
+
if (date instanceof Date && date.getTime()) {
|
|
9800
|
+
setCalendarDate(date);
|
|
9801
|
+
setStartDate(date);
|
|
9802
|
+
}
|
|
9803
|
+
}, onClick: function () { return setSelectEndDate(false); }, ref: inputStartRef })),
|
|
9804
|
+
range && separator !== false && React$1.createElement("div", { className: "date-picker-separator" }),
|
|
9805
|
+
range && (React$1.createElement("input", __assign$1({ autoComplete: "off", className: classNames$1('date-picker-input', {
|
|
9806
|
+
hover: inputEndHoverValue,
|
|
9807
|
+
}),
|
|
9808
|
+
// delay={true} TODO
|
|
9809
|
+
disabled: disabled }, (id && { name: "".concat(id, "-end-date") }), { placeholder: placeholder[1], readOnly: inputReadOnly || typeof format$1 === 'string', required: required, onChange: function (event) {
|
|
9810
|
+
var date = getLocalDateFromString(event.target.value, locale, timepicker);
|
|
9811
|
+
if (date instanceof Date && date.getTime()) {
|
|
9812
|
+
setCalendarDate(date);
|
|
9813
|
+
setEndDate(date);
|
|
9814
|
+
}
|
|
9815
|
+
}, onClick: function () { return setSelectEndDate(true); }, ref: inputEndRef }))),
|
|
9816
|
+
indicator &&
|
|
9817
|
+
(typeof indicator === 'boolean' ? React$1.createElement("div", { className: "date-picker-indicator" }) : indicator),
|
|
9818
|
+
cleaner &&
|
|
9819
|
+
(_startDate || _endDate) &&
|
|
9820
|
+
(typeof cleaner === 'boolean' ? (React$1.createElement("div", { className: "date-picker-cleaner", onClick: function (event) { return handleClear(event); } })) : (React$1.isValidElement(cleaner) &&
|
|
9821
|
+
React$1.cloneElement(cleaner, {
|
|
9822
|
+
onClick: function (event) { return handleClear(event); },
|
|
9823
|
+
}))))); };
|
|
9598
9824
|
return (React$1.createElement(CFormControlWrapper, { describedby: rest['aria-describedby'], feedback: feedback, feedbackInvalid: feedbackInvalid, feedbackValid: feedbackValid, id: id, invalid: isValid === false ? true : false, label: label, text: text, tooltipFeedback: tooltipFeedback, valid: isValid },
|
|
9599
9825
|
React$1.createElement(CPicker, __assign$1({ className: classNames$1('date-picker', (_b = {},
|
|
9600
9826
|
_b["date-picker-".concat(size)] = size,
|
|
9601
9827
|
_b.disabled = disabled,
|
|
9602
9828
|
_b['is-invalid'] = isValid === false ? true : false,
|
|
9603
9829
|
_b['is-valid'] = isValid,
|
|
9604
|
-
_b), className), disabled: disabled, footer: footer || timepicker, footerContent: React$1.createElement("div", { className: "picker-footer" },
|
|
9830
|
+
_b), className), disabled: disabled, dropdownClassNames: "date-picker-dropdown", footer: footer || timepicker, footerContent: React$1.createElement("div", { className: "date-picker-footer" },
|
|
9605
9831
|
todayButton && (React$1.createElement(CButton, { className: "me-auto", color: todayButtonColor, size: todayButtonSize, variant: todayButtonVariant, onClick: function () {
|
|
9606
9832
|
var date = new Date();
|
|
9607
9833
|
handleStartDateChange(date);
|
|
@@ -9629,10 +9855,10 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9629
9855
|
handleStartDateChange(ranges[key][0]);
|
|
9630
9856
|
handleEndDateChange(ranges[key][1]);
|
|
9631
9857
|
}, size: rangesButtonsSize, variant: rangesButtonsVariant }, key)); }))),
|
|
9632
|
-
React$1.createElement(CCalendar, { calendarDate: _calendarDate, calendars: isMobile_1 ? 1 : calendars, className: "date-picker-calendars", dayFormat: dayFormat, disabledDates: disabledDates, endDate: _endDate, firstDayOfWeek: firstDayOfWeek, locale: locale, maxDate: _maxDate, minDate: _minDate, navigation: navigation, navYearFirst: navYearFirst, range: range, selectAdjacementDays: selectAdjacementDays, selectEndDate: selectEndDate, showAdjacementDays: showAdjacementDays, startDate: _startDate,
|
|
9858
|
+
React$1.createElement(CCalendar, { calendarDate: _calendarDate, calendars: isMobile_1 ? 1 : calendars, className: "date-picker-calendars", dayFormat: dayFormat, disabledDates: disabledDates, endDate: _endDate, firstDayOfWeek: firstDayOfWeek, locale: locale, maxDate: _maxDate, minDate: _minDate, navigation: navigation, navYearFirst: navYearFirst, range: range, selectAdjacementDays: selectAdjacementDays, selectEndDate: selectEndDate, selectionType: selectionType, showAdjacementDays: showAdjacementDays, showWeekNumber: showWeekNumber, startDate: _startDate, onDateHover: function (date) { return handleDateHover(date); }, onCalendarDateChange: function (date) { return setCalendarDate(date); }, onStartDateChange: function (date) { return handleStartDateChange(date); }, onEndDateChange: function (date) { return handleEndDateChange(date); }, onSelectEndChange: function (value) { return setSelectEndDate(value); }, weekdayFormat: weekdayFormat }),
|
|
9633
9859
|
timepicker && (React$1.createElement("div", { className: "date-picker-timepickers" }, isMobile_1 || (range && calendars === 1) ? (React$1.createElement(React$1.Fragment, null,
|
|
9634
|
-
React$1.createElement(CTimePicker, { container: "inline", disabled: _startDate === null ? true : false, locale: locale, onTimeChange: function (_, __, date) { return date && handleStartDateChange(date); }, time: _startDate, variant: "select" }),
|
|
9635
|
-
React$1.createElement(CTimePicker, { container: "inline", disabled: _endDate === null ? true : false, locale: locale, onTimeChange: function (_, __, date) { return date && handleEndDateChange(date); }, time: _endDate, variant: "select" }))) : (Array.from({ length: calendars }).map(function (_, index) { return (React$1.createElement(CTimePicker, { container: "inline", disabled: index === 0
|
|
9860
|
+
React$1.createElement(CTimePicker, { container: "inline", disabled: _startDate === null ? true : false, locale: locale, onTimeChange: function (_, __, date) { return date && handleStartDateChange(date); }, time: _startDate && new Date(_startDate), variant: "select" }),
|
|
9861
|
+
React$1.createElement(CTimePicker, { container: "inline", disabled: _endDate === null ? true : false, locale: locale, onTimeChange: function (_, __, date) { return date && handleEndDateChange(date); }, time: _endDate && new Date(_endDate), variant: "select" }))) : (Array.from({ length: calendars }).map(function (_, index) { return (React$1.createElement(CTimePicker, { container: "inline", disabled: index === 0
|
|
9636
9862
|
? _startDate === null
|
|
9637
9863
|
? true
|
|
9638
9864
|
: false
|
|
@@ -9642,7 +9868,9 @@ var CDateRangePicker = React$1.forwardRef(function (_a, ref) {
|
|
|
9642
9868
|
return index === 0
|
|
9643
9869
|
? date && handleStartDateChange(date)
|
|
9644
9870
|
: date && handleEndDateChange(date);
|
|
9645
|
-
}, time: index === 0
|
|
9871
|
+
}, time: index === 0
|
|
9872
|
+
? _startDate && new Date(_startDate)
|
|
9873
|
+
: _endDate && new Date(_endDate), variant: "select" })); }))))))));
|
|
9646
9874
|
});
|
|
9647
9875
|
CDateRangePicker.displayName = 'CDateRangePicker';
|
|
9648
9876
|
CDateRangePicker.propTypes = __assign$1(__assign$1(__assign$1(__assign$1({}, CCalendar.propTypes), CFormControlWrapper.propTypes), CPicker.propTypes), { cancelButton: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), cancelButtonColor: (_a = CButton.propTypes) === null || _a === void 0 ? void 0 : _a.color, cancelButtonSize: (_b = CButton.propTypes) === null || _b === void 0 ? void 0 : _b.size, cancelButtonVariant: (_c = CButton.propTypes) === null || _c === void 0 ? void 0 : _c.variant, calendars: PropTypes$1.number, className: PropTypes$1.string, cleaner: PropTypes$1.bool, closeOnSelect: PropTypes$1.bool, confirmButton: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), confirmButtonColor: (_d = CButton.propTypes) === null || _d === void 0 ? void 0 : _d.color, confirmButtonSize: (_e = CButton.propTypes) === null || _e === void 0 ? void 0 : _e.size, confirmButtonVariant: (_f = CButton.propTypes) === null || _f === void 0 ? void 0 : _f.variant, id: PropTypes$1.string, indicator: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.node]), inputReadOnly: PropTypes$1.bool, placeholder: PropTypes$1.oneOfType([
|
|
@@ -9852,9 +10080,8 @@ var CDropdownMenu = React$1.forwardRef(function (_a, ref) {
|
|
|
9852
10080
|
var forkedRef = useForkedRef(ref, dropdownMenuRef);
|
|
9853
10081
|
return (React$1.createElement(CConditionalPortal, { portal: portal !== null && portal !== void 0 ? portal : false },
|
|
9854
10082
|
React$1.createElement(Component, __assign$1({ className: classNames$1('dropdown-menu', {
|
|
9855
|
-
'dropdown-menu-dark': dark,
|
|
9856
10083
|
show: visible,
|
|
9857
|
-
}, alignment && alignmentClassNames(alignment), className), ref: forkedRef, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), rest), Component === 'ul'
|
|
10084
|
+
}, alignment && alignmentClassNames(alignment), className), ref: forkedRef, role: "menu", "aria-hidden": !visible }, (!popper && { 'data-coreui-popper': 'static' }), (dark && { 'data-coreui-theme': 'dark' }), rest), Component === 'ul'
|
|
9858
10085
|
? React$1.Children.map(children, function (child, index) {
|
|
9859
10086
|
if (React$1.isValidElement(child)) {
|
|
9860
10087
|
return React$1.createElement("li", { key: index }, React$1.cloneElement(child));
|
|
@@ -10697,7 +10924,7 @@ CModalTitle.displayName = 'CModalTitle';
|
|
|
10697
10924
|
var createNativeOptions = function (options) {
|
|
10698
10925
|
return options &&
|
|
10699
10926
|
options.map(function (option, index) {
|
|
10700
|
-
return option.options ? (React$1.createElement("optgroup", { label: option.label, key: index }, createNativeOptions(option.options))) : (React$1.createElement("option", { value: option.value, key: index, disabled: option.disabled }, option.
|
|
10927
|
+
return option.options ? (React$1.createElement("optgroup", { label: option.label, key: index }, createNativeOptions(option.options))) : (React$1.createElement("option", { value: option.value, key: index, disabled: option.disabled }, option.label));
|
|
10701
10928
|
});
|
|
10702
10929
|
};
|
|
10703
10930
|
var CMultiSelectNativeSelect = React$1.forwardRef(function (_a, ref) {
|
|
@@ -10787,8 +11014,8 @@ CVirtualScroller.propTypes = {
|
|
|
10787
11014
|
};
|
|
10788
11015
|
CVirtualScroller.displayName = 'CVirtualScroller';
|
|
10789
11016
|
|
|
10790
|
-
var createOption = function (
|
|
10791
|
-
var value =
|
|
11017
|
+
var createOption = function (label, options) {
|
|
11018
|
+
var value = label.toLowerCase().replace(/\s/g, '-');
|
|
10792
11019
|
var uniqueValue = value;
|
|
10793
11020
|
var i = 1;
|
|
10794
11021
|
while (options.some(function (option) { return String(option.value) === uniqueValue; })) {
|
|
@@ -10798,7 +11025,7 @@ var createOption = function (text, options) {
|
|
|
10798
11025
|
return [
|
|
10799
11026
|
{
|
|
10800
11027
|
value: uniqueValue,
|
|
10801
|
-
|
|
11028
|
+
label: label,
|
|
10802
11029
|
custom: true,
|
|
10803
11030
|
},
|
|
10804
11031
|
];
|
|
@@ -10810,9 +11037,9 @@ var filterOptionsList = function (search, _options) {
|
|
|
10810
11037
|
var option = _options_1[_i];
|
|
10811
11038
|
var options = option.options &&
|
|
10812
11039
|
option.options.filter(function (option) {
|
|
10813
|
-
return option.
|
|
11040
|
+
return option.lable && option.label.toLowerCase().includes(search.toLowerCase());
|
|
10814
11041
|
});
|
|
10815
|
-
if ((option.
|
|
11042
|
+
if ((option.lable && option.label.toLowerCase().includes(search.toLowerCase())) ||
|
|
10816
11043
|
(options && options.length > 0)) {
|
|
10817
11044
|
optionsList.push(Object.assign({}, option, options && options.length > 0 && { options: options }));
|
|
10818
11045
|
}
|
|
@@ -10914,7 +11141,7 @@ var CMultiSelectOptions = React$1.forwardRef(function (_a, ref) {
|
|
|
10914
11141
|
'form-multi-select-option-with-checkbox': optionsStyle === 'checkbox',
|
|
10915
11142
|
'form-multi-selected': selected.some(function (_option) { return _option.value === option.value; }),
|
|
10916
11143
|
disabled: option.disabled,
|
|
10917
|
-
}), key: index, onClick: function () { return handleOptionOnClick && handleOptionOnClick(option); }, onKeyDown: function (event) { return handleKeyDown(event, option); }, tabIndex: 0 }, optionsTemplate ? optionsTemplate(option) : option.
|
|
11144
|
+
}), key: index, onClick: function () { return handleOptionOnClick && handleOptionOnClick(option); }, onKeyDown: function (event) { return handleKeyDown(event, option); }, tabIndex: 0 }, optionsTemplate ? optionsTemplate(option) : option.label)) : (React$1.createElement("div", { className: "form-multi-select-optgroup-label", key: index }, optionsGroupsTemplate ? optionsGroupsTemplate(option) : option.label));
|
|
10918
11145
|
})) : (React$1.createElement("div", { className: "form-multi-select-options-empty" }, searchNoResultsLabel));
|
|
10919
11146
|
};
|
|
10920
11147
|
return (React$1.createElement(React$1.Fragment, null,
|
|
@@ -10953,19 +11180,18 @@ var CMultiSelectSelection = React$1.forwardRef(function (_a, ref) {
|
|
|
10953
11180
|
selected.map(function (option, index) {
|
|
10954
11181
|
if (selectionType === 'tags') {
|
|
10955
11182
|
return (React$1.createElement("span", { className: "form-multi-select-tag", key: index },
|
|
10956
|
-
option.
|
|
10957
|
-
!option.disabled && (React$1.createElement("button", { className: "form-multi-select-tag-delete", "aria-label": "Close", onClick: function () { return onRemove && onRemove(option); } }
|
|
10958
|
-
React$1.createElement("span", { "aria-hidden": "true" }, "\u00D7")))));
|
|
11183
|
+
option.label,
|
|
11184
|
+
!option.disabled && (React$1.createElement("button", { className: "form-multi-select-tag-delete", "aria-label": "Close", onClick: function () { return onRemove && onRemove(option); } }))));
|
|
10959
11185
|
}
|
|
10960
11186
|
return;
|
|
10961
11187
|
}),
|
|
10962
11188
|
multiple &&
|
|
10963
11189
|
selectionType === 'text' &&
|
|
10964
11190
|
selected.map(function (option, index) { return (React$1.createElement("span", { key: index },
|
|
10965
|
-
option.
|
|
11191
|
+
option.label,
|
|
10966
11192
|
index === selected.length - 1 ? '' : ',',
|
|
10967
11193
|
"\u00A0")); }),
|
|
10968
|
-
!multiple && !search && selected.map(function (option) { return option.
|
|
11194
|
+
!multiple && !search && selected.map(function (option) { return option.label; })[0],
|
|
10969
11195
|
children));
|
|
10970
11196
|
});
|
|
10971
11197
|
CMultiSelectSelection.propTypes = {
|
|
@@ -11002,7 +11228,7 @@ var CMultiSelect = React$1.forwardRef(function (_a, ref) {
|
|
|
11002
11228
|
var flattenedOptions = React$1.useMemo(function () { return flattenOptionsArray(options); }, [JSON.stringify(options)]);
|
|
11003
11229
|
var userOption = React$1.useMemo(function () {
|
|
11004
11230
|
if (allowCreateOptions &&
|
|
11005
|
-
filteredOptions.some(function (option) { return option.
|
|
11231
|
+
filteredOptions.some(function (option) { return option.label && option.label.toLowerCase() === searchValue.toLowerCase(); })) {
|
|
11006
11232
|
return false;
|
|
11007
11233
|
}
|
|
11008
11234
|
return searchRef.current && createOption(String(searchValue), flattenedOptions);
|
|
@@ -11085,7 +11311,7 @@ var CMultiSelect = React$1.forwardRef(function (_a, ref) {
|
|
|
11085
11311
|
}
|
|
11086
11312
|
if (!userOption) {
|
|
11087
11313
|
setSelected(__spreadArray(__spreadArray([], selected, true), [
|
|
11088
|
-
filteredOptions.find(function (option) { return String(option.
|
|
11314
|
+
filteredOptions.find(function (option) { return String(option.label).toLowerCase() === searchValue.toLowerCase(); }),
|
|
11089
11315
|
], false));
|
|
11090
11316
|
}
|
|
11091
11317
|
setSearchValue('');
|
|
@@ -11136,14 +11362,11 @@ var CMultiSelect = React$1.forwardRef(function (_a, ref) {
|
|
|
11136
11362
|
setSelected(selected.filter(function (option) { return option.disabled; }));
|
|
11137
11363
|
};
|
|
11138
11364
|
return (React$1.createElement(CFormControlWrapper, { describedby: rest['aria-describedby'], feedback: feedback, feedbackInvalid: feedbackInvalid, feedbackValid: feedbackValid, id: id, invalid: invalid, label: label, text: text, tooltipFeedback: tooltipFeedback, valid: valid },
|
|
11139
|
-
React$1.createElement(CMultiSelectNativeSelect, {
|
|
11365
|
+
React$1.createElement(CMultiSelectNativeSelect, { id: id, multiple: multiple, options: selected, required: required, value: multiple
|
|
11140
11366
|
? selected.map(function (option) { return option.value.toString(); })
|
|
11141
11367
|
: selected.map(function (option) { return option.value; })[0], onChange: function () { return onChange && onChange(selected); }, ref: nativeSelectRef }),
|
|
11142
|
-
React$1.createElement("div", { className: classNames$1('form-multi-select', (_b = {
|
|
11143
|
-
'form-multi-select-with-cleaner': cleaner
|
|
11144
|
-
},
|
|
11368
|
+
React$1.createElement("div", { className: classNames$1('form-multi-select', (_b = {},
|
|
11145
11369
|
_b["form-multi-select-".concat(size)] = size,
|
|
11146
|
-
_b['form-multi-select-selection-tags'] = multiple && selectionType === 'tags',
|
|
11147
11370
|
_b.disabled = disabled,
|
|
11148
11371
|
_b['is-invalid'] = invalid,
|
|
11149
11372
|
_b['is-valid'] = valid,
|
|
@@ -11154,10 +11377,16 @@ var CMultiSelect = React$1.forwardRef(function (_a, ref) {
|
|
|
11154
11377
|
selectionType === 'counter' && {
|
|
11155
11378
|
placeholder: "".concat(selected.length, " ").concat(selectionTypeCounterText),
|
|
11156
11379
|
}), (selected.length > 0 &&
|
|
11157
|
-
!multiple && { placeholder: selected.map(function (option) { return option.
|
|
11380
|
+
!multiple && { placeholder: selected.map(function (option) { return option.label; })[0] }), (multiple &&
|
|
11158
11381
|
selected.length > 0 &&
|
|
11159
11382
|
selectionType !== 'counter' && { size: searchValue.length + 2 }), { ref: searchRef })))),
|
|
11160
|
-
|
|
11383
|
+
React$1.createElement("div", { className: "form-multi-select-buttons" },
|
|
11384
|
+
!disabled && cleaner && selected.length > 0 && (React$1.createElement("button", { type: "button", className: "form-multi-select-cleaner", onClick: function () { return handleDeselectAll(); } })),
|
|
11385
|
+
React$1.createElement("button", { type: "button", className: "form-multi-select-indicator", onClick: function (event) {
|
|
11386
|
+
event.preventDefault();
|
|
11387
|
+
event.stopPropagation();
|
|
11388
|
+
setVisible(!_visible);
|
|
11389
|
+
} }))),
|
|
11161
11390
|
React$1.createElement("div", { className: "form-multi-select-dropdown", role: "menu", ref: dropdownRef },
|
|
11162
11391
|
multiple && selectAll && (React$1.createElement("button", { type: "button", className: "form-multi-select-all", onClick: function () { return handleSelectAll(); } }, selectAllLabel)),
|
|
11163
11392
|
React$1.createElement(CMultiSelectOptions, { handleOptionOnClick: function (option) { return !disabled && handleOptionOnClick(option); }, loading: loading, options: filteredOptions.length === 0 && allowCreateOptions
|
|
@@ -11180,7 +11409,7 @@ CNav.propTypes = {
|
|
|
11180
11409
|
className: PropTypes$1.string,
|
|
11181
11410
|
component: PropTypes$1.elementType,
|
|
11182
11411
|
layout: PropTypes$1.oneOf(['fill', 'justified']),
|
|
11183
|
-
variant: PropTypes$1.oneOf(['
|
|
11412
|
+
variant: PropTypes$1.oneOf(['pills', 'tabs', 'underline']),
|
|
11184
11413
|
};
|
|
11185
11414
|
CNav.displayName = 'CNav';
|
|
11186
11415
|
|
|
@@ -11334,9 +11563,8 @@ var CNavbar = React$1.forwardRef(function (_a, ref) {
|
|
|
11334
11563
|
var children = _a.children, className = _a.className, color = _a.color, colorScheme = _a.colorScheme, _c = _a.component, Component = _c === void 0 ? 'nav' : _c, container = _a.container, expand = _a.expand, placement = _a.placement, rest = __rest$1(_a, ["children", "className", "color", "colorScheme", "component", "container", "expand", "placement"]);
|
|
11335
11564
|
return (React$1.createElement(Component, __assign$1({ className: classNames$1('navbar', (_b = {},
|
|
11336
11565
|
_b["bg-".concat(color)] = color,
|
|
11337
|
-
_b["navbar-".concat(colorScheme)] = colorScheme,
|
|
11338
11566
|
_b[typeof expand === 'boolean' ? 'navbar-expand' : "navbar-expand-".concat(expand)] = expand,
|
|
11339
|
-
_b), placement, className) }, rest, { ref: ref }), container ? (React$1.createElement("div", { className: typeof container === 'string' ? "container-".concat(container) : 'container' }, children)) : (React$1.createElement(React$1.Fragment, null, children))));
|
|
11567
|
+
_b), placement, className) }, (colorScheme && { 'data-coreui-theme': colorScheme }), rest, { ref: ref }), container ? (React$1.createElement("div", { className: typeof container === 'string' ? "container-".concat(container) : 'container' }, children)) : (React$1.createElement(React$1.Fragment, null, children))));
|
|
11340
11568
|
});
|
|
11341
11569
|
CNavbar.propTypes = {
|
|
11342
11570
|
children: PropTypes$1.node,
|
|
@@ -11407,7 +11635,7 @@ CNavbarToggler.propTypes = {
|
|
|
11407
11635
|
CNavbarToggler.displayName = 'CNavbarToggler';
|
|
11408
11636
|
|
|
11409
11637
|
var COffcanvas = React$1.forwardRef(function (_a, ref) {
|
|
11410
|
-
var children = _a.children, _b = _a.backdrop, backdrop = _b === void 0 ? true : _b, className = _a.className, _c = _a.keyboard, keyboard = _c === void 0 ? true : _c, onHide = _a.onHide, onShow = _a.onShow, placement = _a.placement, _d = _a.portal, portal = _d === void 0 ? false : _d, _e = _a.responsive, responsive = _e === void 0 ? true : _e, _f = _a.scroll, scroll = _f === void 0 ? false : _f, _g = _a.visible, visible = _g === void 0 ? false : _g, rest = __rest$1(_a, ["children", "backdrop", "className", "keyboard", "onHide", "onShow", "placement", "portal", "responsive", "scroll", "visible"]);
|
|
11638
|
+
var children = _a.children, _b = _a.backdrop, backdrop = _b === void 0 ? true : _b, className = _a.className, dark = _a.dark, _c = _a.keyboard, keyboard = _c === void 0 ? true : _c, onHide = _a.onHide, onShow = _a.onShow, placement = _a.placement, _d = _a.portal, portal = _d === void 0 ? false : _d, _e = _a.responsive, responsive = _e === void 0 ? true : _e, _f = _a.scroll, scroll = _f === void 0 ? false : _f, _g = _a.visible, visible = _g === void 0 ? false : _g, rest = __rest$1(_a, ["children", "backdrop", "className", "dark", "keyboard", "onHide", "onShow", "placement", "portal", "responsive", "scroll", "visible"]);
|
|
11411
11639
|
var _h = React$1.useState(visible), _visible = _h[0], setVisible = _h[1];
|
|
11412
11640
|
var offcanvasRef = React$1.useRef(null);
|
|
11413
11641
|
var forkedRef = useForkedRef(ref, offcanvasRef);
|
|
@@ -11448,7 +11676,7 @@ var COffcanvas = React$1.forwardRef(function (_a, ref) {
|
|
|
11448
11676
|
_a.showing = state === 'entering',
|
|
11449
11677
|
_a.show = state === 'entered',
|
|
11450
11678
|
_a['show hiding'] = state === 'exiting',
|
|
11451
|
-
_a), className), role: "dialog", tabIndex: -1, onKeyDown: handleKeyDown }, rest, { ref: forkedRef }), children)));
|
|
11679
|
+
_a), className), role: "dialog", tabIndex: -1, onKeyDown: handleKeyDown }, (dark && { 'data-coreui-theme': 'dark' }), rest, { ref: forkedRef }), children)));
|
|
11452
11680
|
}),
|
|
11453
11681
|
backdrop && (React$1.createElement(CConditionalPortal, { portal: portal },
|
|
11454
11682
|
React$1.createElement(CBackdrop, { className: "offcanvas-backdrop", onClick: handleBackdropDismiss, visible: _visible })))));
|
|
@@ -11457,6 +11685,7 @@ COffcanvas.propTypes = {
|
|
|
11457
11685
|
backdrop: PropTypes$1.oneOfType([PropTypes$1.bool, PropTypes$1.oneOf(['static'])]),
|
|
11458
11686
|
children: PropTypes$1.node,
|
|
11459
11687
|
className: PropTypes$1.string,
|
|
11688
|
+
dark: PropTypes$1.bool,
|
|
11460
11689
|
keyboard: PropTypes$1.bool,
|
|
11461
11690
|
onHide: PropTypes$1.func,
|
|
11462
11691
|
onShow: PropTypes$1.func,
|
|
@@ -13417,7 +13646,7 @@ var getClickedColumnName = function (target, columnNames) {
|
|
|
13417
13646
|
var closest = target.closest('tr');
|
|
13418
13647
|
var children = closest ? Array.from(closest.children) : [];
|
|
13419
13648
|
var clickedCell = children.filter(function (child) { return child.contains(target); })[0];
|
|
13420
|
-
return columnNames[children.indexOf(clickedCell)];
|
|
13649
|
+
return columnNames[children.indexOf(clickedCell) - 1];
|
|
13421
13650
|
};
|
|
13422
13651
|
var getColumnKey = function (column) {
|
|
13423
13652
|
return typeof column === 'object' ? column.key : column;
|
|
@@ -13429,6 +13658,12 @@ var getColumnLabel = function (column) {
|
|
|
13429
13658
|
: pretifyName(column.key)
|
|
13430
13659
|
: pretifyName(column);
|
|
13431
13660
|
};
|
|
13661
|
+
var getColumnName = function (column) {
|
|
13662
|
+
if (typeof column === 'object') {
|
|
13663
|
+
return column.key;
|
|
13664
|
+
}
|
|
13665
|
+
return column;
|
|
13666
|
+
};
|
|
13432
13667
|
var getColumnNames = function (columns, items) {
|
|
13433
13668
|
if (columns) {
|
|
13434
13669
|
var _columns = [];
|
|
@@ -13537,10 +13772,32 @@ var getColumnSorterState = function (key, sorterState) {
|
|
|
13537
13772
|
var getColumnValues = function (items, key) {
|
|
13538
13773
|
return items.map(function (item) { return item[key]; });
|
|
13539
13774
|
};
|
|
13540
|
-
var getTableDataCellProps = function (item, colName) {
|
|
13541
|
-
var props =
|
|
13775
|
+
var getTableDataCellProps = function (column, item, colName) {
|
|
13776
|
+
var props = {};
|
|
13777
|
+
if (typeof column === 'object' && column._colProps) {
|
|
13778
|
+
Object.assign(props, column._colProps);
|
|
13779
|
+
}
|
|
13780
|
+
if (item._cellProps && item._cellProps['all']) {
|
|
13781
|
+
Object.assign(props, item._cellProps['all']);
|
|
13782
|
+
}
|
|
13783
|
+
if (item._cellProps && item._cellProps[colName]) {
|
|
13784
|
+
Object.assign(props, item._cellProps[colName]);
|
|
13785
|
+
}
|
|
13542
13786
|
return props;
|
|
13543
13787
|
};
|
|
13788
|
+
var getTableDataCellStyles = function (column, item, colName) {
|
|
13789
|
+
var styles = {};
|
|
13790
|
+
if (typeof column === 'object' && column._colStyle) {
|
|
13791
|
+
Object.assign(styles, column._colStyle);
|
|
13792
|
+
}
|
|
13793
|
+
if (item._cellStyle && item._cellStyle['all']) {
|
|
13794
|
+
Object.assign(styles, item._cellStyle['all']);
|
|
13795
|
+
}
|
|
13796
|
+
if (item._cellStyle && item._cellStyle[colName]) {
|
|
13797
|
+
Object.assign(styles, item._cellStyle[colName]);
|
|
13798
|
+
}
|
|
13799
|
+
return styles;
|
|
13800
|
+
};
|
|
13544
13801
|
var getTableHeaderCellProps = function (column) {
|
|
13545
13802
|
if (typeof column === 'object' && column._props) {
|
|
13546
13803
|
return column._props;
|
|
@@ -13598,8 +13855,8 @@ var sortItems = function (columnSorter, items, itemsDataColumns, sorterState) {
|
|
|
13598
13855
|
};
|
|
13599
13856
|
|
|
13600
13857
|
var CSmartTableBody = React$1.forwardRef(function (_a, ref) {
|
|
13601
|
-
var clickableRows = _a.clickableRows, columnNames = _a.columnNames, currentItems = _a.currentItems, firstItemOnActivePageIndex = _a.firstItemOnActivePageIndex, noItemsLabel = _a.noItemsLabel, onRowChecked = _a.onRowChecked, onRowClick = _a.onRowClick, scopedColumns = _a.scopedColumns, selectable = _a.selectable, selected = _a.selected, rest = __rest$1(_a, ["clickableRows", "columnNames", "currentItems", "firstItemOnActivePageIndex", "noItemsLabel", "onRowChecked", "onRowClick", "scopedColumns", "selectable", "selected"]);
|
|
13602
|
-
var colspan = selectable ?
|
|
13858
|
+
var clickableRows = _a.clickableRows, columnNames = _a.columnNames, columns = _a.columns, currentItems = _a.currentItems, firstItemOnActivePageIndex = _a.firstItemOnActivePageIndex, noItemsLabel = _a.noItemsLabel, onRowChecked = _a.onRowChecked, onRowClick = _a.onRowClick, scopedColumns = _a.scopedColumns, selectable = _a.selectable, selected = _a.selected, rest = __rest$1(_a, ["clickableRows", "columnNames", "columns", "currentItems", "firstItemOnActivePageIndex", "noItemsLabel", "onRowChecked", "onRowClick", "scopedColumns", "selectable", "selected"]);
|
|
13859
|
+
var colspan = selectable ? columns.length + 1 : columns.length;
|
|
13603
13860
|
return (React$1.createElement(CTableBody, __assign$1({}, (clickableRows && {
|
|
13604
13861
|
style: { cursor: 'pointer' },
|
|
13605
13862
|
}), rest, { ref: ref }), currentItems.length > 0 ? (currentItems.map(function (item, trIndex) {
|
|
@@ -13617,13 +13874,14 @@ var CSmartTableBody = React$1.forwardRef(function (_a, ref) {
|
|
|
13617
13874
|
delete _item['_selected'];
|
|
13618
13875
|
onRowChecked && onRowChecked(_item, event.target.checked);
|
|
13619
13876
|
} }))),
|
|
13620
|
-
|
|
13877
|
+
columns.map(function (column, index) {
|
|
13878
|
+
var colName = getColumnName(column);
|
|
13621
13879
|
return ((scopedColumns &&
|
|
13622
13880
|
scopedColumns[colName] &&
|
|
13623
13881
|
React$1.cloneElement(scopedColumns[colName](item, trIndex + firstItemOnActivePageIndex), {
|
|
13624
13882
|
key: index,
|
|
13625
13883
|
})) ||
|
|
13626
|
-
(item[colName] !== undefined && (React$1.createElement(CTableDataCell, __assign$1({}, getTableDataCellProps(item, colName), { key: index }), item[colName]))));
|
|
13884
|
+
(item[colName] !== undefined && (React$1.createElement(CTableDataCell, __assign$1({}, getTableDataCellProps(column, item, colName), { style: getTableDataCellStyles(column, item, colName), key: index }), item[colName]))));
|
|
13627
13885
|
})),
|
|
13628
13886
|
scopedColumns && scopedColumns.details && (React$1.createElement(React$1.Fragment, null,
|
|
13629
13887
|
React$1.createElement(CTableRow, null,
|
|
@@ -13955,9 +14213,9 @@ var CSmartTable = React$1.forwardRef(function (_a, ref) {
|
|
|
13955
14213
|
header && (React$1.createElement(CSmartTableHead, __assign$1({}, tableHeadProps, { columnFilter: columnFilter, columnFilterState: columnFilterState, columns: columns !== null && columns !== void 0 ? columns : columnNames, columnSorter: columnSorter, items: _items, selectable: selectable, selectAll: selectAll, selectedAll: selectedAll, sorterState: sorterState, sortingIcon: sortingIcon, sortingIconAscending: sortingIconAscending, sortingIconDescending: sortingIconDescending, handleFilterOnChange: function (key, event) {
|
|
13956
14214
|
return handleColumnFilterChange(key, event, 'change');
|
|
13957
14215
|
}, handleFilterOnInput: function (key, event) { return handleColumnFilterChange(key, event, 'input'); }, handleOnCustomFilterChange: function (key, event) { return handleColumnFilterChange(key, event); }, handleSelectAllChecked: function () { return handleSelectAllChecked(); }, handleSort: function (key, index) { return handleSorterChange(key, index); } }))),
|
|
13958
|
-
React$1.createElement(CSmartTableBody, __assign$1({ clickableRows: clickableRows, currentItems: currentItems, firstItemOnActivePageIndex: firstItemOnActivePageIndex, noItemsLabel: noItemsLabel, onRowClick: function (item, index, columnName, event) {
|
|
14216
|
+
React$1.createElement(CSmartTableBody, __assign$1({ clickableRows: clickableRows, columnNames: columnNames, columns: columns !== null && columns !== void 0 ? columns : columnNames, currentItems: currentItems, firstItemOnActivePageIndex: firstItemOnActivePageIndex, noItemsLabel: noItemsLabel, onRowClick: function (item, index, columnName, event) {
|
|
13959
14217
|
return clickableRows && onRowClick && onRowClick(item, index, columnName, event);
|
|
13960
|
-
}, onRowChecked: function (item, value) { return handleRowChecked(item, value); },
|
|
14218
|
+
}, onRowChecked: function (item, value) { return handleRowChecked(item, value); }, scopedColumns: scopedColumns, selectable: selectable, selected: _selected }, tableBodyProps)),
|
|
13961
14219
|
typeof footer === 'boolean' && footer && (React$1.createElement(CSmartTableHead, __assign$1({ component: CTableFoot }, tableFootProps, { columnFilter: false, columnSorter: false, columns: columns !== null && columns !== void 0 ? columns : columnNames, items: _items, handleSelectAllChecked: function () { return handleSelectAllChecked(); }, selectable: selectable, selectAll: selectAll, selectedAll: selectedAll, showGroups: false }))),
|
|
13962
14220
|
Array.isArray(footer) && (React$1.createElement(CTableFoot, __assign$1({}, tableFootProps),
|
|
13963
14221
|
React$1.createElement(CTableRow, null, footer.map(function (item, index) { return (React$1.createElement(CTableDataCell, __assign$1({}, (typeof item === 'object' && item._props && __assign$1({}, item._props)), { key: index }), typeof item === 'object' ? item.label : item)); }))))),
|
|
@@ -14696,6 +14954,7 @@ exports.CWidgetStatsC = CWidgetStatsC;
|
|
|
14696
14954
|
exports.CWidgetStatsD = CWidgetStatsD;
|
|
14697
14955
|
exports.CWidgetStatsE = CWidgetStatsE;
|
|
14698
14956
|
exports.CWidgetStatsF = CWidgetStatsF;
|
|
14957
|
+
exports.useColorModes = useColorModes;
|
|
14699
14958
|
exports.useForkedRef = useForkedRef;
|
|
14700
14959
|
exports.usePopper = usePopper;
|
|
14701
14960
|
exports.useStateWithCallback = useStateWithCallback;
|