@coreui/vue-pro 4.1.3 → 4.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +1 -1
  2. package/dist/components/button/CButton.d.ts +29 -2
  3. package/dist/components/calendar/CCalendar.d.ts +185 -0
  4. package/dist/components/calendar/index.d.ts +6 -0
  5. package/dist/components/date-picker/CDatePicker.d.ts +406 -0
  6. package/dist/components/date-picker/index.d.ts +6 -0
  7. package/dist/components/date-range-picker/CDateRangePicker.d.ts +480 -0
  8. package/dist/components/date-range-picker/index.d.ts +6 -0
  9. package/dist/components/dropdown/CDropdown.d.ts +25 -0
  10. package/dist/components/dropdown/CDropdownToggle.d.ts +35 -1
  11. package/dist/components/index.d.ts +5 -0
  12. package/dist/components/multi-select/CMultiSelect.d.ts +2 -2
  13. package/dist/components/picker/CPicker.d.ts +11 -0
  14. package/dist/components/picker/index.d.ts +6 -0
  15. package/dist/components/popover/CPopover.d.ts +1 -1
  16. package/dist/components/sidebar/CSidebar.d.ts +1 -1
  17. package/dist/components/smart-table/CSmartTable.d.ts +1 -1
  18. package/dist/components/smart-table/CSmartTableBody.d.ts +0 -11
  19. package/dist/components/smart-table/CSmartTableHead.d.ts +1 -1
  20. package/dist/components/time-picker/CTimePicker.d.ts +10 -0
  21. package/dist/components/time-picker/CTimePickerRollCol.d.ts +27 -0
  22. package/dist/components/time-picker/index.d.ts +6 -0
  23. package/dist/components/toast/CToast.d.ts +1 -1
  24. package/dist/index.es.js +3021 -915
  25. package/dist/index.es.js.map +1 -1
  26. package/dist/index.js +3029 -913
  27. package/dist/index.js.map +1 -1
  28. package/dist/utils/calendar.d.ts +21 -0
  29. package/dist/utils/time.d.ts +17 -0
  30. package/package.json +9 -9
  31. package/src/components/accordion/CAccordionButton.ts +1 -0
  32. package/src/components/accordion/__tests__/__snapshots__/CAccordionButton.spec.ts.snap +1 -1
  33. package/src/components/accordion/__tests__/__snapshots__/CAccordionHeader.spec.ts.snap +1 -1
  34. package/src/components/button/CButton.ts +30 -1
  35. package/src/components/button/__tests__/__snapshots__/CButton.spec.ts.snap +1 -1
  36. package/src/components/calendar/CCalendar.ts +546 -0
  37. package/src/components/calendar/index.ts +10 -0
  38. package/src/components/close-button/CCloseButton.ts +4 -1
  39. package/src/components/date-picker/CDatePicker.ts +243 -0
  40. package/src/components/date-picker/index.ts +10 -0
  41. package/src/components/date-range-picker/CDateRangePicker.ts +635 -0
  42. package/src/components/date-range-picker/index.ts +10 -0
  43. package/src/components/dropdown/CDropdown.ts +48 -49
  44. package/src/components/dropdown/CDropdownMenu.ts +52 -7
  45. package/src/components/dropdown/CDropdownToggle.ts +93 -29
  46. package/src/components/dropdown/__tests__/CDropdownMenu.spec.ts +7 -7
  47. package/src/components/dropdown/__tests__/CDropdownToggle.spec.ts +4 -5
  48. package/src/components/dropdown/__tests__/__snapshots__/CDropdownToggle.spec.ts.snap +2 -2
  49. package/src/components/form/CFormCheck.ts +2 -1
  50. package/src/components/form/CFormSwitch.ts +1 -7
  51. package/src/components/form/__tests__/__snapshots__/CFormCheck.spec.ts.snap +2 -8
  52. package/src/components/index.ts +5 -0
  53. package/src/components/modal/__tests__/__snapshots__/CModal.spec.ts.snap +2 -1
  54. package/src/components/picker/CPicker.ts +220 -0
  55. package/src/components/picker/index.ts +10 -0
  56. package/src/components/sidebar/__tests__/__snapshots__/CSidebar.spec.ts.snap +8 -2
  57. package/src/components/smart-table/CSmartTable.ts +2 -3
  58. package/src/components/smart-table/CSmartTableBody.ts +0 -5
  59. package/src/components/time-picker/CTimePicker.ts +410 -0
  60. package/src/components/time-picker/CTimePickerRollCol.ts +58 -0
  61. package/src/components/time-picker/index.ts +10 -0
  62. package/src/components/toast/__tests__/__snapshots__/CToastClose.spec.ts.snap +1 -1
  63. package/src/utils/calendar.ts +193 -0
  64. package/src/utils/time.ts +58 -0
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, provide, h as h$1, Transition, withDirectives, inject, watch, reactive, onBeforeMount, onMounted, onUpdated, toRefs, onUnmounted, nextTick, vShow, computed, Teleport, onBeforeUnmount } from 'vue';
1
+ import { defineComponent, ref, provide, h as h$1, Transition, withDirectives, inject, watch, reactive, onBeforeMount, onMounted, onUpdated, toRefs, onUnmounted, cloneVNode, nextTick, vShow, computed, Teleport, onBeforeUnmount } from 'vue';
2
2
 
3
3
  const CAccordion = defineComponent({
4
4
  name: 'CAccordion',
@@ -172,6 +172,7 @@ const CAccordionButton = defineComponent({
172
172
  const toggleVisibility = inject('toggleVisibility');
173
173
  const visible = inject('visible');
174
174
  return () => h$1('button', {
175
+ type: 'button',
175
176
  'aria-expanded': !visible.value,
176
177
  class: ['accordion-button', { ['collapsed']: !visible.value }],
177
178
  onClick: () => toggleVisibility(),
@@ -343,6 +344,9 @@ const CCloseButton = defineComponent({
343
344
  ],
344
345
  setup(props, { emit }) {
345
346
  const handleClick = () => {
347
+ if (props.disabled) {
348
+ return;
349
+ }
346
350
  emit('click');
347
351
  };
348
352
  return () => h$1('button', {
@@ -818,6 +822,20 @@ const CButton = defineComponent({
818
822
  return ['sm', 'lg'].includes(value);
819
823
  },
820
824
  },
825
+ /**
826
+ * Specifies the type of button. Always specify the type attribute for the `<button>` element.
827
+ * Different browsers may use different default types for the `<button>` element.
828
+ *
829
+ * @values 'button', 'submit', 'reset'
830
+ */
831
+ type: {
832
+ type: String,
833
+ default: 'button',
834
+ required: false,
835
+ validator: (value) => {
836
+ return ['button', 'submit', 'reset'].includes(value);
837
+ },
838
+ },
821
839
  /**
822
840
  * Set the button variant to an outlined button or a ghost button.
823
841
  *
@@ -832,7 +850,19 @@ const CButton = defineComponent({
832
850
  },
833
851
  },
834
852
  },
835
- setup(props, { slots }) {
853
+ emits: [
854
+ /**
855
+ * Event called when the user clicks on the button.
856
+ */
857
+ 'click',
858
+ ],
859
+ setup(props, { emit, slots }) {
860
+ const handleClick = () => {
861
+ if (props.disabled) {
862
+ return;
863
+ }
864
+ emit('click');
865
+ };
836
866
  return () => h$1(props.component, {
837
867
  class: [
838
868
  'btn',
@@ -847,6 +877,8 @@ const CButton = defineComponent({
847
877
  disabled: props.disabled && props.component !== 'a',
848
878
  ...(props.component === 'a' && props.disabled && { 'aria-disabled': true, tabIndex: -1 }),
849
879
  ...(props.component === 'a' && props.href && { href: props.href }),
880
+ ...(props.component === 'button' && { type: props.type }),
881
+ onClick: handleClick,
850
882
  }, slots.default && slots.default());
851
883
  },
852
884
  });
@@ -905,6 +937,553 @@ const CButtonGroupPlugin = {
905
937
  },
906
938
  };
907
939
 
940
+ const createGroupsInArray = (arr, numberOfGroups) => {
941
+ const perGroup = Math.ceil(arr.length / numberOfGroups);
942
+ return new Array(numberOfGroups)
943
+ .fill('')
944
+ .map((_, i) => arr.slice(i * perGroup, (i + 1) * perGroup));
945
+ };
946
+ const getMonthsNames = (locale) => {
947
+ const months = [];
948
+ const d = new Date();
949
+ d.setDate(1);
950
+ for (let i = 0; i < 12; i++) {
951
+ d.setMonth(i);
952
+ months.push(d.toLocaleString(locale, { month: 'short' }));
953
+ }
954
+ return months;
955
+ };
956
+ const getYears = (year) => {
957
+ const years = [];
958
+ for (let _year = year - 6; _year < year + 6; _year++) {
959
+ years.push(_year);
960
+ }
961
+ return years;
962
+ };
963
+ const getLeadingDays = (year, month, firstDayOfWeek) => {
964
+ // 0: sunday
965
+ // 1: monday
966
+ const dates = [];
967
+ const d = new Date(year, month);
968
+ const y = d.getFullYear();
969
+ const m = d.getMonth();
970
+ const firstWeekday = new Date(y, m, 1).getDay();
971
+ let leadingDays = 6 - (6 - firstWeekday) - firstDayOfWeek;
972
+ if (firstDayOfWeek) {
973
+ leadingDays = leadingDays < 0 ? 7 + leadingDays : leadingDays;
974
+ }
975
+ for (let i = leadingDays * -1; i < 0; i++) {
976
+ dates.push({
977
+ date: new Date(y, m, i + 1),
978
+ month: 'previous',
979
+ });
980
+ }
981
+ return dates;
982
+ };
983
+ const getMonthDays = (year, month) => {
984
+ const dates = [];
985
+ const lastDay = new Date(year, month + 1, 0).getDate();
986
+ for (let i = 1; i <= lastDay; i++) {
987
+ dates.push({
988
+ date: new Date(year, month, i),
989
+ month: 'current',
990
+ });
991
+ }
992
+ return dates;
993
+ };
994
+ const getTrailingDays = (year, month, leadingDays, monthDays) => {
995
+ const dates = [];
996
+ const days = 42 - (leadingDays.length + monthDays.length);
997
+ for (let i = 1; i <= days; i++) {
998
+ dates.push({
999
+ date: new Date(year, month + 1, i),
1000
+ month: 'next',
1001
+ });
1002
+ }
1003
+ return dates;
1004
+ };
1005
+ const getMonthDetails = (year, month, firstDayOfWeek) => {
1006
+ const daysPrevMonth = getLeadingDays(year, month, firstDayOfWeek);
1007
+ const daysThisMonth = getMonthDays(year, month);
1008
+ const daysNextMonth = getTrailingDays(year, month, daysPrevMonth, daysThisMonth);
1009
+ const days = [...daysPrevMonth, ...daysThisMonth, ...daysNextMonth];
1010
+ const weeks = [];
1011
+ days.forEach((day, index) => {
1012
+ if (index % 7 === 0 || weeks.length === 0) {
1013
+ weeks.push([]);
1014
+ }
1015
+ weeks[weeks.length - 1].push(day);
1016
+ });
1017
+ return weeks;
1018
+ };
1019
+ const isDateDisabled = (date, min, max, dates) => {
1020
+ let disabled;
1021
+ if (dates) {
1022
+ dates.forEach((_date) => {
1023
+ if (Array.isArray(_date)) {
1024
+ if (isDateInRange(date, _date[0], _date[1])) {
1025
+ disabled = true;
1026
+ }
1027
+ }
1028
+ if (_date instanceof Date) {
1029
+ if (isSameDateAs(date, _date)) {
1030
+ disabled = true;
1031
+ }
1032
+ }
1033
+ });
1034
+ }
1035
+ if (min && date < min) {
1036
+ disabled = true;
1037
+ }
1038
+ if (max && date > max) {
1039
+ disabled = true;
1040
+ }
1041
+ return disabled;
1042
+ };
1043
+ const isDateInRange = (date, start, end) => {
1044
+ return start && end && start <= date && date <= end;
1045
+ };
1046
+ const isDateSelected = (date, start, end) => {
1047
+ return (start && isSameDateAs(start, date)) || (end && isSameDateAs(end, date));
1048
+ };
1049
+ const isEndDate = (date, start, end) => {
1050
+ return start && end && isSameDateAs(end, date) && start < end;
1051
+ };
1052
+ const isLastDayOfMonth = (date) => {
1053
+ const test = new Date(date.getTime());
1054
+ const month = test.getMonth();
1055
+ test.setDate(test.getDate() + 1);
1056
+ return test.getMonth() !== month;
1057
+ };
1058
+ const isSameDateAs = (date, date2) => {
1059
+ return (date.getDate() == date2.getDate() &&
1060
+ date.getMonth() == date2.getMonth() &&
1061
+ date.getFullYear() == date2.getFullYear());
1062
+ };
1063
+ const isStartDate = (date, start, end) => {
1064
+ return start && end && isSameDateAs(start, date) && start < end;
1065
+ };
1066
+ const isToday = (date) => {
1067
+ const today = new Date();
1068
+ return (date.getDate() == today.getDate() &&
1069
+ date.getMonth() == today.getMonth() &&
1070
+ date.getFullYear() == today.getFullYear());
1071
+ };
1072
+ const isValidDate = (date) => {
1073
+ const d = new Date(date);
1074
+ return d instanceof Date && d.getTime();
1075
+ };
1076
+
1077
+ const CCalendar = defineComponent({
1078
+ name: 'CCalendar',
1079
+ props: {
1080
+ /**
1081
+ * Default date of the component
1082
+ */
1083
+ calendarDate: {
1084
+ type: [Date, String],
1085
+ },
1086
+ /**
1087
+ * Specify the list of dates that cannot be selected.
1088
+ */
1089
+ disabledDates: {
1090
+ type: Array,
1091
+ },
1092
+ /**
1093
+ * Initial selected to date (range).
1094
+ */
1095
+ endDate: {
1096
+ type: [Date, String],
1097
+ },
1098
+ /**
1099
+ * Sets the day of start week.
1100
+ * - 0 - Sunday,
1101
+ * - 1 - Monday,
1102
+ * - 2 - Tuesday,
1103
+ * - 3 - Wednesday,
1104
+ * - 4 - Thursday,
1105
+ * - 5 - Friday,
1106
+ * - 6 - Saturday,
1107
+ * - 7 - Sunday
1108
+ */
1109
+ firstDayOfWeek: {
1110
+ type: Number,
1111
+ default: 1,
1112
+ },
1113
+ /**
1114
+ * Sets the default locale for components. If not set, it is inherited from the navigator.language.
1115
+ */
1116
+ locale: {
1117
+ type: String,
1118
+ default: 'default',
1119
+ },
1120
+ /**
1121
+ * Max selectable date.
1122
+ */
1123
+ maxDate: {
1124
+ type: [Date, String],
1125
+ },
1126
+ /**
1127
+ * Min selectable date.
1128
+ */
1129
+ minDate: {
1130
+ type: [Date, String],
1131
+ },
1132
+ /**
1133
+ * Show arrows navigation.
1134
+ */
1135
+ navigation: {
1136
+ type: Boolean,
1137
+ default: true,
1138
+ },
1139
+ /**
1140
+ * Allow range selection.
1141
+ */
1142
+ range: Boolean,
1143
+ /**
1144
+ * Toggle select mode between start and end date.
1145
+ */
1146
+ selectEndDate: Boolean,
1147
+ /**
1148
+ * Initial selected date.
1149
+ */
1150
+ startDate: {
1151
+ type: [Date, String],
1152
+ },
1153
+ /**
1154
+ * Set length or format of day name.
1155
+ *
1156
+ * @type number | 'long' | 'narrow' | 'short'
1157
+ */
1158
+ weekdayFormat: {
1159
+ type: [Number, String],
1160
+ default: 2,
1161
+ validator: (value) => {
1162
+ if (typeof value === 'string') {
1163
+ return ['long', 'narrow', 'short'].includes(value);
1164
+ }
1165
+ if (typeof value === 'number') {
1166
+ return true;
1167
+ }
1168
+ return false;
1169
+ },
1170
+ },
1171
+ },
1172
+ emits: [
1173
+ /**
1174
+ * Callback fired when the user hovers over the calendar cell.
1175
+ *
1176
+ * @property {Date | null} date
1177
+ */
1178
+ 'calendar-cell-hover',
1179
+ /**
1180
+ * Callback fired when the calendar date changed.
1181
+ *
1182
+ * @property {Date | null} date
1183
+ */
1184
+ 'calendar-date-change',
1185
+ /**
1186
+ * Callback fired when the start date changed.
1187
+ *
1188
+ * @property {Date | null} date
1189
+ */
1190
+ 'start-date-change',
1191
+ /**
1192
+ * Callback fired when the end date changed.
1193
+ *
1194
+ * @property {Date | null} date
1195
+ */
1196
+ 'end-date-change',
1197
+ ],
1198
+ setup(props, { slots, emit }) {
1199
+ const calendarDate = ref(props.calendarDate ? new Date(props.calendarDate) : new Date());
1200
+ const startDate = ref(props.startDate ? new Date(props.startDate) : null);
1201
+ const endDate = ref(props.endDate ? new Date(props.endDate) : null);
1202
+ const selectEndDate = ref(props.selectEndDate);
1203
+ const view = ref('days');
1204
+ const maxDate = props.maxDate ? new Date(props.maxDate) : null;
1205
+ const minDate = props.minDate ? new Date(props.minDate) : null;
1206
+ watch(() => props.calendarDate, () => {
1207
+ if (props.calendarDate)
1208
+ calendarDate.value = new Date(props.calendarDate);
1209
+ });
1210
+ watch(() => props.startDate, () => {
1211
+ if (props.startDate === null) {
1212
+ startDate.value = null;
1213
+ return;
1214
+ }
1215
+ if (props.startDate) {
1216
+ const d = new Date(props.startDate);
1217
+ if (startDate.value === null) {
1218
+ startDate.value = d;
1219
+ return;
1220
+ }
1221
+ if (startDate.value && !isSameDateAs(d, startDate.value)) {
1222
+ startDate.value = d;
1223
+ }
1224
+ }
1225
+ });
1226
+ watch(() => props.endDate, () => {
1227
+ if (props.endDate === null) {
1228
+ endDate.value = null;
1229
+ return;
1230
+ }
1231
+ if (props.endDate) {
1232
+ const d = new Date(props.endDate);
1233
+ if (endDate.value === null) {
1234
+ endDate.value = d;
1235
+ return;
1236
+ }
1237
+ if (endDate.value && !isSameDateAs(d, endDate.value)) {
1238
+ endDate.value = d;
1239
+ }
1240
+ }
1241
+ });
1242
+ watch(() => props.selectEndDate, () => {
1243
+ selectEndDate.value = props.selectEndDate;
1244
+ });
1245
+ watch(startDate, () => {
1246
+ emit('start-date-change', startDate.value);
1247
+ });
1248
+ watch(endDate, () => {
1249
+ emit('end-date-change', endDate.value);
1250
+ });
1251
+ const setCalendarPage = (years, months = 0) => {
1252
+ const year = calendarDate.value.getFullYear();
1253
+ const month = calendarDate.value.getMonth();
1254
+ const d = new Date(year, month, 1);
1255
+ years && d.setFullYear(d.getFullYear() + years);
1256
+ months && d.setMonth(d.getMonth() + months);
1257
+ calendarDate.value = d;
1258
+ emit('calendar-date-change', d);
1259
+ };
1260
+ const handleCellOnClick = (date) => {
1261
+ if (isDateDisabled(date, minDate, maxDate, props.disabledDates)) {
1262
+ return;
1263
+ }
1264
+ if (props.range) {
1265
+ if (selectEndDate.value) {
1266
+ // If endDate > date
1267
+ if (startDate.value && startDate.value > date) {
1268
+ endDate.value = startDate.value;
1269
+ startDate.value = date;
1270
+ }
1271
+ else {
1272
+ endDate.value = date;
1273
+ }
1274
+ selectEndDate.value = false;
1275
+ }
1276
+ else {
1277
+ startDate.value = date;
1278
+ selectEndDate.value = true;
1279
+ }
1280
+ }
1281
+ else {
1282
+ startDate.value = date;
1283
+ }
1284
+ };
1285
+ const handleCellMouseEnter = (date) => {
1286
+ if (isDateDisabled(date, minDate, maxDate, props.disabledDates)) {
1287
+ return;
1288
+ }
1289
+ emit('calendar-cell-hover', date);
1290
+ };
1291
+ const handleCellMouseLeave = () => {
1292
+ emit('calendar-cell-hover', null);
1293
+ };
1294
+ const handleNavigationOnClick = (direction, double = false) => {
1295
+ if (direction === 'prev') {
1296
+ if (double) {
1297
+ setCalendarPage(view.value !== 'days' ? -10 : -1);
1298
+ return;
1299
+ }
1300
+ if (view.value !== 'days') {
1301
+ setCalendarPage(-1);
1302
+ return;
1303
+ }
1304
+ setCalendarPage(0, -1);
1305
+ return;
1306
+ }
1307
+ if (direction === 'next') {
1308
+ if (double) {
1309
+ setCalendarPage(view.value !== 'days' ? 10 : 1);
1310
+ return;
1311
+ }
1312
+ if (view.value !== 'days') {
1313
+ setCalendarPage(1);
1314
+ return;
1315
+ }
1316
+ setCalendarPage(0, 1);
1317
+ return;
1318
+ }
1319
+ };
1320
+ const Calendar = () => {
1321
+ const monthDetails = getMonthDetails(calendarDate.value.getFullYear(), calendarDate.value.getMonth(), props.firstDayOfWeek);
1322
+ const listOfMonths = createGroupsInArray(getMonthsNames(props.locale), 4);
1323
+ const listOfYears = createGroupsInArray(getYears(calendarDate.value.getFullYear()), 4);
1324
+ const weekDays = monthDetails[0];
1325
+ return h$1('table', {}, [
1326
+ view.value === 'days' &&
1327
+ h$1('thead', {}, h$1('tr', {}, weekDays.map(({ date }) => {
1328
+ return h$1('th', { class: 'calendar-cell' }, h$1('div', {
1329
+ class: 'calendar-header-cell-inner',
1330
+ }, props.weekdayFormat === 'string'
1331
+ ? date.toLocaleDateString(props.locale, { weekday: props.weekdayFormat })
1332
+ : date
1333
+ .toLocaleDateString(props.locale, { weekday: 'long' })
1334
+ .slice(0, props.weekdayFormat)));
1335
+ }))),
1336
+ h$1('tbody', {}, [
1337
+ view.value === 'days' &&
1338
+ monthDetails.map((week) => {
1339
+ return h$1('tr', {}, week.map(({ date, month }) => {
1340
+ return h$1('td', {
1341
+ class: [
1342
+ 'calendar-cell',
1343
+ {
1344
+ today: isToday(date),
1345
+ disabled: isDateDisabled(date, minDate, maxDate, props.disabledDates),
1346
+ next: month === 'next',
1347
+ previous: month === 'previous',
1348
+ last: isLastDayOfMonth(date),
1349
+ range: month === 'current' &&
1350
+ isDateInRange(date, startDate.value, endDate.value),
1351
+ selected: isDateSelected(date, startDate.value, endDate.value),
1352
+ start: isStartDate(date, startDate.value, endDate.value),
1353
+ end: isEndDate(date, startDate.value, endDate.value),
1354
+ },
1355
+ ],
1356
+ title: date.toLocaleDateString(props.locale),
1357
+ onClick: () => handleCellOnClick(date),
1358
+ onmouseenter: () => handleCellMouseEnter(date),
1359
+ onmouseleave: () => handleCellMouseLeave(),
1360
+ }, h$1('div', {
1361
+ class: 'calendar-cell-inner',
1362
+ }, date.toLocaleDateString(props.locale, { day: 'numeric' })));
1363
+ }));
1364
+ }),
1365
+ view.value === 'months' &&
1366
+ listOfMonths.map((row, index) => {
1367
+ return h$1('tr', {}, row.map((month, idx) => {
1368
+ return h$1('td', {
1369
+ class: 'calendar-cell month',
1370
+ onClick: () => {
1371
+ setCalendarPage(0, index * 3 + idx);
1372
+ view.value = 'days';
1373
+ },
1374
+ }, h$1('div', { class: 'calendar-cell-inner' }, month));
1375
+ }));
1376
+ }),
1377
+ view.value === 'years' &&
1378
+ listOfYears.map((row) => {
1379
+ return h$1('tr', {}, row.map((year) => {
1380
+ return h$1('td', {
1381
+ class: 'calendar-cell year',
1382
+ onClick: () => {
1383
+ calendarDate.value = new Date(year, calendarDate.value.getMonth(), calendarDate.value.getDate());
1384
+ view.value = 'months';
1385
+ },
1386
+ }, h$1('div', { class: 'calendar-cell-inner' }, year));
1387
+ }));
1388
+ }),
1389
+ ]),
1390
+ ]);
1391
+ };
1392
+ const Navigation = () => {
1393
+ return h$1('div', { class: 'calendar-nav' }, [
1394
+ props.navigation &&
1395
+ h$1('div', {
1396
+ class: 'calendar-nav-prev',
1397
+ }, [
1398
+ h$1(CButton, {
1399
+ color: 'transparent',
1400
+ size: 'sm',
1401
+ onClick: () => handleNavigationOnClick('prev', true),
1402
+ }, {
1403
+ /**
1404
+ * @slot Location for double previous icon.
1405
+ */
1406
+ default: () => slots.navPrevDoubleIcon
1407
+ ? slots.navPrevDoubleIcon()
1408
+ : h$1('span', { class: 'calendar-nav-icon calendar-nav-icon-double-prev' }),
1409
+ }),
1410
+ view.value === 'days' &&
1411
+ h$1(CButton, {
1412
+ color: 'transparent',
1413
+ size: 'sm',
1414
+ onClick: () => handleNavigationOnClick('prev'),
1415
+ }, {
1416
+ /**
1417
+ * @slot Location for previous icon.
1418
+ */
1419
+ default: () => slots.navPrevIcon
1420
+ ? slots.navPrevIcon()
1421
+ : h$1('span', { class: 'calendar-nav-icon calendar-nav-icon-prev' }),
1422
+ }),
1423
+ ]),
1424
+ h$1('div', {
1425
+ class: 'calendar-nav-date',
1426
+ }, [
1427
+ view.value === 'days' &&
1428
+ h$1(CButton, {
1429
+ color: 'transparent',
1430
+ size: 'sm',
1431
+ onClick: () => {
1432
+ if (props.navigation)
1433
+ view.value = 'months';
1434
+ },
1435
+ }, () => calendarDate.value.toLocaleDateString(props.locale, { month: 'long' })),
1436
+ h$1(CButton, {
1437
+ color: 'transparent',
1438
+ size: 'sm',
1439
+ onClick: () => {
1440
+ if (props.navigation)
1441
+ view.value = 'years';
1442
+ },
1443
+ }, () => calendarDate.value.toLocaleDateString(props.locale, { year: 'numeric' })),
1444
+ ]),
1445
+ props.navigation &&
1446
+ h$1('div', {
1447
+ class: 'calendar-nav-next',
1448
+ }, [
1449
+ view.value === 'days' &&
1450
+ h$1(CButton, {
1451
+ color: 'transparent',
1452
+ size: 'sm',
1453
+ onClick: () => handleNavigationOnClick('next'),
1454
+ }, {
1455
+ /**
1456
+ * @slot Location for next icon.
1457
+ */
1458
+ default: () => slots.navNextIcon
1459
+ ? slots.navNextIcon()
1460
+ : h$1('span', { class: 'calendar-nav-icon calendar-nav-icon-next' }),
1461
+ }),
1462
+ h$1(CButton, {
1463
+ color: 'transparent',
1464
+ size: 'sm',
1465
+ onClick: () => handleNavigationOnClick('next', true),
1466
+ }, {
1467
+ /**
1468
+ * @slot Location for double next icon.
1469
+ */
1470
+ default: () => slots.navNextDoubleIcon
1471
+ ? slots.navNextDoubleIcon()
1472
+ : h$1('span', { class: 'calendar-nav-icon calendar-nav-icon-double-next' }),
1473
+ }),
1474
+ ]),
1475
+ ]);
1476
+ };
1477
+ return () => h$1('div', { class: ['calendar', view.value] }, [h$1(Navigation), h$1(Calendar)]);
1478
+ },
1479
+ });
1480
+
1481
+ const CCalendarPlugin = {
1482
+ install: (app) => {
1483
+ app.component(CCalendar.name, CCalendar);
1484
+ },
1485
+ };
1486
+
908
1487
  const CCallout = defineComponent({
909
1488
  name: 'CCallout',
910
1489
  props: {
@@ -1505,32 +2084,928 @@ const CCollapsePlugin = {
1505
2084
  },
1506
2085
  };
1507
2086
 
1508
- var top = 'top';
1509
- var bottom = 'bottom';
1510
- var right = 'right';
1511
- var left = 'left';
1512
- var auto = 'auto';
1513
- var basePlacements = [top, bottom, right, left];
1514
- var start = 'start';
1515
- var end = 'end';
1516
- var clippingParents = 'clippingParents';
1517
- var viewport = 'viewport';
1518
- var popper = 'popper';
1519
- var reference = 'reference';
1520
- var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
1521
- return acc.concat([placement + "-" + start, placement + "-" + end]);
1522
- }, []);
1523
- var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
1524
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
1525
- }, []); // modifiers that need to read the DOM
2087
+ const CForm = defineComponent({
2088
+ name: 'CForm',
2089
+ props: {
2090
+ /**
2091
+ * Mark a form as validated. If you set it `true`, all validation styles will be applied to the forms component.
2092
+ */
2093
+ validated: {
2094
+ type: Boolean,
2095
+ required: false,
2096
+ },
2097
+ },
2098
+ setup(props, { slots }) {
2099
+ return () => h$1('form', { class: [{ ['was-validated']: props.validated }] }, slots.default && slots.default());
2100
+ },
2101
+ });
1526
2102
 
1527
- var beforeRead = 'beforeRead';
1528
- var read = 'read';
1529
- var afterRead = 'afterRead'; // pure-logic modifiers
2103
+ /*!
2104
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
2105
+ *
2106
+ * Copyright (c) 2014-2017, Jon Schlinkert.
2107
+ * Released under the MIT License.
2108
+ */
1530
2109
 
1531
- var beforeMain = 'beforeMain';
1532
- var main = 'main';
1533
- var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
2110
+ function isObject(o) {
2111
+ return Object.prototype.toString.call(o) === '[object Object]';
2112
+ }
2113
+
2114
+ function isPlainObject(o) {
2115
+ var ctor,prot;
2116
+
2117
+ if (isObject(o) === false) return false;
2118
+
2119
+ // If has modified constructor
2120
+ ctor = o.constructor;
2121
+ if (ctor === undefined) return true;
2122
+
2123
+ // If has modified prototype
2124
+ prot = ctor.prototype;
2125
+ if (isObject(prot) === false) return false;
2126
+
2127
+ // If constructor does not have an Object-specific method
2128
+ if (prot.hasOwnProperty('isPrototypeOf') === false) {
2129
+ return false;
2130
+ }
2131
+
2132
+ // Most likely a plain Object
2133
+ return true;
2134
+ }
2135
+
2136
+ function t(){return t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e},t.apply(this,arguments)}function r(e,t){if(null==e)return {};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}const n={silent:!1,logLevel:"warn"},i=["validator"],o=Object.prototype,a=o.toString,s=o.hasOwnProperty,u=/^\s*function (\w+)/;function l(e){var t;const r=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(r){const e=r.toString().match(u);return e?e[1]:""}return ""}const c=isPlainObject,f=e=>e;let d=f;if("production"!==process.env.NODE_ENV){const e="undefined"!=typeof console;d=e?function(e,t=n.logLevel){!1===n.silent&&console[t](`[VueTypes warn]: ${e}`);}:f;}const p=(e,t)=>s.call(e,t),y=Number.isInteger||function(e){return "number"==typeof e&&isFinite(e)&&Math.floor(e)===e},v=Array.isArray||function(e){return "[object Array]"===a.call(e)},h=e=>"[object Function]"===a.call(e),b=e=>c(e)&&p(e,"_vueTypes_name"),g=e=>c(e)&&(p(e,"type")||["_vueTypes_name","validator","default","required"].some(t=>p(e,t)));function O(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function m(e,t,r=!1){let n,i=!0,o="";n=c(e)?e:{type:e};const a=b(n)?n._vueTypes_name+" - ":"";if(g(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return i;if(!n.required&&void 0===t)return i;v(n.type)?(i=n.type.some(e=>!0===m(e,t,!0)),o=n.type.map(e=>l(e)).join(" or ")):(o=l(n),i="Array"===o?v(t):"Object"===o?c(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return "";const t=e.constructor.toString().match(u);return t?t[1]:""}(t)===o:t instanceof n.type);}if(!i){const e=`${a}value "${t}" should be of type "${o}"`;return !1===r?(d(e),!1):e}if(p(n,"validator")&&h(n.validator)){const e=d,o=[];if(d=e=>{o.push(e);},i=n.validator(t),d=e,!i){const e=(o.length>1?"* ":"")+o.join("\n* ");return o.length=0,!1===r?(d(e),i):e}}return i}function j(e,t){const r=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get(){return this.required=!0,this}},def:{value(e){return void 0===e?(p(this,"default")&&delete this.default,this):h(e)||!0===m(this,e,!0)?(this.default=v(e)?()=>[...e]:c(e)?()=>Object.assign({},e):e,this):(d(`${this._vueTypes_name} - invalid default value: "${e}"`),this)}}}),{validator:n}=r;return h(n)&&(r.validator=O(n,r)),r}function _(e,t){const r=j(e,t);return Object.defineProperty(r,"validate",{value(e){return h(this.validator)&&d(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:\n${JSON.stringify(this)}`),this.validator=O(e,this),this}})}function T(e,t,n){const o=function(e){const t={};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=Object.getOwnPropertyDescriptor(e,r);}),Object.defineProperties({},t)}(t);if(o._vueTypes_name=e,!c(n))return o;const{validator:a}=n,s=r(n,i);if(h(a)){let{validator:e}=o;e&&(e=null!==(l=(u=e).__original)&&void 0!==l?l:u),o.validator=O(e?function(t){return e.call(this,t)&&a.call(this,t)}:a,o);}var u,l;return Object.assign(o,s)}function $(e){return e.replace(/^(?!\s*$)/gm," ")}const w=()=>_("any",{}),P=()=>_("function",{type:Function}),x=()=>_("boolean",{type:Boolean}),E=()=>_("string",{type:String}),N=()=>_("number",{type:Number}),q=()=>_("array",{type:Array}),A=()=>_("object",{type:Object}),V=()=>j("integer",{type:Number,validator:e=>y(e)}),S=()=>j("symbol",{validator:e=>"symbol"==typeof e});function k(e,t="custom validation failed"){if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return j(e.name||"<<anonymous function>>",{type:null,validator(r){const n=e(r);return n||d(`${this._vueTypes_name} - ${t}`),n}})}function D(e){if(!v(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");const t=`oneOf - value should be one of "${e.join('", "')}".`,r=e.reduce((e,t)=>{if(null!=t){const r=t.constructor;-1===e.indexOf(r)&&e.push(r);}return e},[]);return j("oneOf",{type:r.length>0?r:void 0,validator(r){const n=-1!==e.indexOf(r);return n||d(t),n}})}function L(e){if(!v(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");let t=!1,r=[];for(let n=0;n<e.length;n+=1){const i=e[n];if(g(i)){if(b(i)&&"oneOf"===i._vueTypes_name&&i.type){r=r.concat(i.type);continue}if(h(i.validator)&&(t=!0),!0===i.type||!i.type){d('oneOfType - invalid usage of "true" or "null" as types.');continue}r=r.concat(i.type);}else r.push(i);}r=r.filter((e,t)=>r.indexOf(e)===t);const n=r.length>0?r:null;return j("oneOfType",t?{type:n,validator(t){const r=[],n=e.some(e=>{const n=m(b(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return "string"==typeof n&&r.push(n),!0===n});return n||d(`oneOfType - provided value does not match any of the ${r.length} passed-in validators:\n${$(r.join("\n"))}`),n}}:{type:n})}function F(e){return j("arrayOf",{type:Array,validator(t){let r="";const n=t.every(t=>(r=m(e,t,!0),!0===r));return n||d(`arrayOf - value validation error:\n${$(r)}`),n}})}function Y(e){return j("instanceOf",{type:e})}function B(e){return j("objectOf",{type:Object,validator(t){let r="";const n=Object.keys(t).every(n=>(r=m(e,t[n],!0),!0===r));return n||d(`objectOf - value validation error:\n${$(r)}`),n}})}function I(e){const t=Object.keys(e),r=t.filter(t=>{var r;return !(null===(r=e[t])||void 0===r||!r.required)}),n=j("shape",{type:Object,validator(n){if(!c(n))return !1;const i=Object.keys(n);if(r.length>0&&r.some(e=>-1===i.indexOf(e))){const e=r.filter(e=>-1===i.indexOf(e));return d(1===e.length?`shape - required property "${e[0]}" is not defined.`:`shape - required properties "${e.join('", "')}" are not defined.`),!1}return i.every(r=>{if(-1===t.indexOf(r))return !0===this._vueTypes_isLoose||(d(`shape - shape definition does not include a "${r}" property. Allowed keys: "${t.join('", "')}".`),!1);const i=m(e[r],n[r],!0);return "string"==typeof i&&d(`shape - "${r}" property validation error:\n ${$(i)}`),!0===i})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),n}const J=["name","validate","getter"],M=/*#__PURE__*/(()=>{var e,t;return t=e=class{static get any(){return w()}static get func(){return P().def(this.defaults.func)}static get bool(){return x().def(this.defaults.bool)}static get string(){return E().def(this.defaults.string)}static get number(){return N().def(this.defaults.number)}static get array(){return q().def(this.defaults.array)}static get object(){return A().def(this.defaults.object)}static get integer(){return V().def(this.defaults.integer)}static get symbol(){return S()}static extend(e){if(v(e))return e.forEach(e=>this.extend(e)),this;const{name:t,validate:n=!1,getter:i=!1}=e,o=r(e,J);if(p(this,t))throw new TypeError(`[VueTypes error]: Type "${t}" already defined`);const{type:a}=o;if(b(a))return delete o.type,Object.defineProperty(this,t,i?{get:()=>T(t,a,o)}:{value(...e){const r=T(t,a,o);return r.validator&&(r.validator=r.validator.bind(r,...e)),r}});let s;return s=i?{get(){const e=Object.assign({},o);return n?_(t,e):j(t,e)},enumerable:!0}:{value(...e){const r=Object.assign({},o);let i;return i=n?_(t,r):j(t,r),r.validator&&(i.validator=r.validator.bind(i,...e)),i},enumerable:!0},Object.defineProperty(this,t,s)}},e.defaults={},e.sensibleDefaults=void 0,e.config=n,e.custom=k,e.oneOf=D,e.instanceOf=Y,e.oneOfType=L,e.arrayOf=F,e.objectOf=B,e.shape=I,e.utils={validate:(e,t)=>!0===m(t,e,!0),toType:(e,t,r=!1)=>r?_(e,t):j(e,t)},t})();function R(e={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var r,n;return n=r=class extends M{static get sensibleDefaults(){return t({},this.defaults)}static set sensibleDefaults(r){this.defaults=!1!==r?t({},!0!==r?r:e):{};}},r.defaults=t({},e),n}class z extends(R()){}
2137
+
2138
+ const CFormLabel = defineComponent({
2139
+ name: 'CFormLabel',
2140
+ props: {
2141
+ /**
2142
+ * A string of all className you want to be applied to the component, and override standard className value.
2143
+ */
2144
+ customClassName: {
2145
+ type: [Array, String],
2146
+ default: undefined,
2147
+ required: false,
2148
+ },
2149
+ },
2150
+ setup(props, { slots }) {
2151
+ return () => h$1('label', {
2152
+ class: props.customClassName ? props.customClassName : 'form-label',
2153
+ }, slots.default && slots.default());
2154
+ },
2155
+ });
2156
+
2157
+ const CFormCheck = defineComponent({
2158
+ name: 'CFormCheck',
2159
+ inheritAttrs: false,
2160
+ props: {
2161
+ /**
2162
+ * Create button-like checkboxes and radio buttons.
2163
+ */
2164
+ button: I({
2165
+ /**
2166
+ * Sets the color context of the component to one of CoreUI’s themed colors.
2167
+ *
2168
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
2169
+ */
2170
+ color: Color,
2171
+ /**
2172
+ * Select the shape of the component.
2173
+ *
2174
+ * @values 'rounded', 'rounded-top', 'rounded-end', 'rounded-bottom', 'rounded-start', 'rounded-circle', 'rounded-pill', 'rounded-0', 'rounded-1', 'rounded-2', 'rounded-3'
2175
+ */
2176
+ shape: Shape,
2177
+ /**
2178
+ * Size the component small or large.
2179
+ *
2180
+ * @values 'sm' | 'lg'
2181
+ */
2182
+ size: {
2183
+ type: String,
2184
+ default: undefined,
2185
+ required: false,
2186
+ validator: (value) => {
2187
+ return ['sm', 'lg'].includes(value);
2188
+ },
2189
+ },
2190
+ /**
2191
+ * Set the button variant to an outlined button or a ghost button.
2192
+ */
2193
+ variant: {
2194
+ type: String,
2195
+ default: undefined,
2196
+ required: false,
2197
+ validator: (value) => {
2198
+ return ['outline', 'ghost'].includes(value);
2199
+ },
2200
+ },
2201
+ }),
2202
+ /**
2203
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document.
2204
+ */
2205
+ id: {
2206
+ type: String,
2207
+ default: undefined,
2208
+ required: false,
2209
+ },
2210
+ /**
2211
+ * Input Checkbox indeterminate Property
2212
+ */
2213
+ indeterminate: Boolean,
2214
+ /**
2215
+ * Group checkboxes or radios on the same horizontal row by adding.
2216
+ */
2217
+ inline: {
2218
+ type: Boolean,
2219
+ required: false,
2220
+ },
2221
+ /**
2222
+ * Set component validation state to invalid.
2223
+ */
2224
+ invalid: {
2225
+ type: Boolean,
2226
+ required: false,
2227
+ },
2228
+ /**
2229
+ * The element represents a caption for a component.
2230
+ */
2231
+ label: {
2232
+ type: String,
2233
+ default: undefined,
2234
+ required: false,
2235
+ },
2236
+ /**
2237
+ * The default name for a value passed using v-model.
2238
+ */
2239
+ modelValue: {
2240
+ type: [Boolean, String],
2241
+ value: undefined,
2242
+ required: false,
2243
+ },
2244
+ /**
2245
+ * Specifies the type of component.
2246
+ *
2247
+ * @values 'checkbox', 'radio'
2248
+ */
2249
+ type: {
2250
+ type: String,
2251
+ default: 'checkbox',
2252
+ required: false,
2253
+ },
2254
+ /**
2255
+ * Set component validation state to valid.
2256
+ */
2257
+ valid: {
2258
+ type: Boolean,
2259
+ required: false,
2260
+ },
2261
+ },
2262
+ emits: [
2263
+ /**
2264
+ * Event occurs when the checked value has been changed.
2265
+ */
2266
+ 'change',
2267
+ /**
2268
+ * Emit the new value whenever there’s a change event.
2269
+ */
2270
+ 'update:modelValue',
2271
+ ],
2272
+ setup(props, { attrs, emit, slots }) {
2273
+ const handleChange = (event) => {
2274
+ const target = event.target;
2275
+ emit('change', event);
2276
+ emit('update:modelValue', target.checked);
2277
+ };
2278
+ const formControl = () => {
2279
+ return h$1('input', {
2280
+ ...attrs,
2281
+ checked: props.modelValue,
2282
+ class: [
2283
+ props.button ? 'btn-check' : 'form-check-input',
2284
+ {
2285
+ 'is-invalid': props.invalid,
2286
+ 'is-valid': props.valid,
2287
+ },
2288
+ ],
2289
+ id: props.id,
2290
+ indeterminate: props.indeterminate,
2291
+ onChange: (event) => handleChange(event),
2292
+ type: props.type,
2293
+ });
2294
+ };
2295
+ const formLabel = () => {
2296
+ return h$1(CFormLabel, {
2297
+ customClassName: props.button
2298
+ ? [
2299
+ 'btn',
2300
+ props.button.variant
2301
+ ? `btn-${props.button.variant}-${props.button.color}`
2302
+ : `btn-${props.button.color}`,
2303
+ {
2304
+ [`btn-${props.button.size}`]: props.button.size,
2305
+ },
2306
+ `${props.button.shape}`,
2307
+ ]
2308
+ : 'form-check-label',
2309
+ ...(props.id && { for: props.id }),
2310
+ }, {
2311
+ default: () => (slots.label && slots.label()) || props.label,
2312
+ });
2313
+ };
2314
+ return () => props.button
2315
+ ? [formControl(), (slots.label || props.label) && formLabel()]
2316
+ : props.label
2317
+ ? h$1('div', {
2318
+ class: [
2319
+ 'form-check',
2320
+ {
2321
+ 'form-check-inline': props.inline,
2322
+ 'is-invalid': props.invalid,
2323
+ 'is-valid': props.valid,
2324
+ },
2325
+ attrs.class,
2326
+ ],
2327
+ }, [formControl(), props.label && formLabel()])
2328
+ : formControl();
2329
+ },
2330
+ });
2331
+
2332
+ const CFormFeedback = defineComponent({
2333
+ name: 'CFormFeedback',
2334
+ props: {
2335
+ /**
2336
+ * Component used for the root node. Either a string to use a HTML element or a component.
2337
+ */
2338
+ component: {
2339
+ type: String,
2340
+ required: false,
2341
+ default: 'div',
2342
+ },
2343
+ /**
2344
+ * Method called immediately after the `value` prop changes.
2345
+ */
2346
+ invalid: Boolean,
2347
+ /**
2348
+ * If your form layout allows it, you can display validation feedback in a styled tooltip.
2349
+ */
2350
+ tooltip: Boolean,
2351
+ /**
2352
+ * Set component validation state to valid.
2353
+ */
2354
+ valid: Boolean,
2355
+ },
2356
+ setup(props, { slots }) {
2357
+ return () => h$1(props.component, {
2358
+ class: [
2359
+ {
2360
+ [`invalid-${props.tooltip ? 'tooltip' : 'feedback'}`]: props.invalid,
2361
+ [`valid-${props.tooltip ? 'tooltip' : 'feedback'}`]: props.valid,
2362
+ },
2363
+ ],
2364
+ }, slots.default && slots.default());
2365
+ },
2366
+ });
2367
+
2368
+ const CFormFloating = defineComponent({
2369
+ name: 'CFormFloating',
2370
+ setup(_, { slots }) {
2371
+ return () => h$1('div', {
2372
+ class: 'form-floating',
2373
+ }, slots.default && slots.default());
2374
+ },
2375
+ });
2376
+
2377
+ const CFormInput = defineComponent({
2378
+ name: 'CFormInput',
2379
+ props: {
2380
+ /**
2381
+ * Toggle the disabled state for the component.
2382
+ */
2383
+ disabled: {
2384
+ type: Boolean,
2385
+ required: false,
2386
+ },
2387
+ /**
2388
+ * Set component validation state to invalid.
2389
+ */
2390
+ invalid: {
2391
+ type: Boolean,
2392
+ required: false,
2393
+ },
2394
+ /**
2395
+ * The default name for a value passed using v-model.
2396
+ */
2397
+ modelValue: {
2398
+ type: String,
2399
+ default: undefined,
2400
+ require: false,
2401
+ },
2402
+ /**
2403
+ * Render the component styled as plain text. Removes the default form field styling and preserve the correct margin and padding. Recommend to use only along side `readonly`.
2404
+ */
2405
+ plainText: {
2406
+ type: Boolean,
2407
+ required: false,
2408
+ },
2409
+ /**
2410
+ * Toggle the readonly state for the component.
2411
+ */
2412
+ readonly: {
2413
+ type: Boolean,
2414
+ required: false,
2415
+ },
2416
+ /**
2417
+ * Size the component small or large.
2418
+ *
2419
+ * @values 'sm' | 'lg'
2420
+ */
2421
+ size: {
2422
+ type: String,
2423
+ default: undefined,
2424
+ require: false,
2425
+ validator: (value) => {
2426
+ return ['sm', 'lg'].includes(value);
2427
+ },
2428
+ },
2429
+ /**
2430
+ * Specifies the type of component.
2431
+ *
2432
+ * @values 'color' | 'file' | 'text' | string
2433
+ */
2434
+ type: {
2435
+ type: String,
2436
+ default: 'text',
2437
+ require: false,
2438
+ },
2439
+ /**
2440
+ * Set component validation state to valid.
2441
+ */
2442
+ valid: {
2443
+ type: Boolean,
2444
+ required: false,
2445
+ },
2446
+ },
2447
+ emits: [
2448
+ /**
2449
+ * Event occurs when the element loses focus, after the content has been changed.
2450
+ */
2451
+ 'change',
2452
+ /**
2453
+ * Event occurs immediately after the value of a component has changed.
2454
+ */
2455
+ 'input',
2456
+ /**
2457
+ * Emit the new value whenever there’s an input or change event.
2458
+ */
2459
+ 'update:modelValue',
2460
+ ],
2461
+ setup(props, { emit, slots }) {
2462
+ const handleChange = (event) => {
2463
+ const target = event.target;
2464
+ emit('change', event);
2465
+ emit('update:modelValue', target.value);
2466
+ };
2467
+ const handleInput = (event) => {
2468
+ const target = event.target;
2469
+ emit('input', event);
2470
+ emit('update:modelValue', target.value);
2471
+ };
2472
+ return () => h$1('input', {
2473
+ class: [
2474
+ props.plainText ? 'form-control-plaintext' : 'form-control',
2475
+ {
2476
+ 'form-control-color': props.type === 'color',
2477
+ [`form-control-${props.size}`]: props.size,
2478
+ 'is-invalid': props.invalid,
2479
+ 'is-valid': props.valid,
2480
+ },
2481
+ ],
2482
+ disabled: props.disabled,
2483
+ onChange: (event) => handleChange(event),
2484
+ onInput: (event) => handleInput(event),
2485
+ readonly: props.readonly,
2486
+ type: props.type,
2487
+ value: props.modelValue,
2488
+ }, slots.default && slots.default());
2489
+ },
2490
+ });
2491
+
2492
+ const CFormRange = defineComponent({
2493
+ name: 'CFormRange',
2494
+ props: {
2495
+ /**
2496
+ * Toggle the disabled state for the component.
2497
+ */
2498
+ disabled: {
2499
+ type: Boolean,
2500
+ default: undefined,
2501
+ required: false,
2502
+ },
2503
+ /**
2504
+ * Specifies the maximum value for the component.
2505
+ */
2506
+ max: {
2507
+ type: Number,
2508
+ default: undefined,
2509
+ required: false,
2510
+ },
2511
+ /**
2512
+ * Specifies the minimum value for the component.
2513
+ */
2514
+ min: {
2515
+ type: Number,
2516
+ default: undefined,
2517
+ required: false,
2518
+ },
2519
+ /**
2520
+ * The default name for a value passed using v-model.
2521
+ */
2522
+ modelValue: {
2523
+ type: String,
2524
+ value: undefined,
2525
+ required: false,
2526
+ },
2527
+ /**
2528
+ * Toggle the readonly state for the component.
2529
+ */
2530
+ readonly: {
2531
+ type: Boolean,
2532
+ required: false,
2533
+ },
2534
+ /**
2535
+ * Specifies the interval between legal numbers in the component.
2536
+ */
2537
+ steps: {
2538
+ type: Number,
2539
+ default: undefined,
2540
+ required: false,
2541
+ },
2542
+ /**
2543
+ * The `value` attribute of component.
2544
+ *
2545
+ * @controllable onChange
2546
+ * */
2547
+ value: {
2548
+ type: Number,
2549
+ default: undefined,
2550
+ required: false,
2551
+ },
2552
+ },
2553
+ emits: [
2554
+ /**
2555
+ * Event occurs when the value has been changed.
2556
+ */
2557
+ 'change',
2558
+ /**
2559
+ * Emit the new value whenever there’s a change event.
2560
+ */
2561
+ 'update:modelValue',
2562
+ ],
2563
+ setup(props, { emit, slots }) {
2564
+ const handleChange = (event) => {
2565
+ const target = event.target;
2566
+ emit('change', event);
2567
+ emit('update:modelValue', target.value);
2568
+ };
2569
+ return () => h$1('input', {
2570
+ class: 'form-range',
2571
+ disabled: props.disabled,
2572
+ max: props.max,
2573
+ min: props.min,
2574
+ onChange: (event) => handleChange(event),
2575
+ steps: props.steps,
2576
+ readonly: props.readonly,
2577
+ type: 'range',
2578
+ value: props.modelValue,
2579
+ }, slots.default && slots.default());
2580
+ },
2581
+ });
2582
+
2583
+ const CFormSelect = defineComponent({
2584
+ name: 'CFormSelect',
2585
+ props: {
2586
+ /**
2587
+ * Specifies the number of visible options in a drop-down list.
2588
+ */
2589
+ htmlSize: {
2590
+ type: Number,
2591
+ default: undefined,
2592
+ required: false,
2593
+ },
2594
+ /**
2595
+ * Set component validation state to invalid.
2596
+ */
2597
+ invalid: {
2598
+ type: Boolean,
2599
+ required: false,
2600
+ },
2601
+ /**
2602
+ * The default name for a value passed using v-model.
2603
+ */
2604
+ modelValue: {
2605
+ type: [String, Array],
2606
+ default: undefined,
2607
+ require: false,
2608
+ },
2609
+ multiple: {
2610
+ type: Boolean,
2611
+ required: false,
2612
+ },
2613
+ /**
2614
+ * Options list of the select component. Available keys: `label`, `value`, `disabled`.
2615
+ * Examples:
2616
+ * - `:options="[{ value: 'js', label: 'JavaScript' }, { value: 'html', label: 'HTML', disabled: true }]"`
2617
+ * - `:options="['js', 'html']"`
2618
+ */
2619
+ options: {
2620
+ type: Array,
2621
+ default: undefined,
2622
+ required: false,
2623
+ },
2624
+ /**
2625
+ * Size the component small or large.
2626
+ *
2627
+ * @values 'sm' | 'lg'
2628
+ */
2629
+ size: {
2630
+ type: String,
2631
+ default: undefined,
2632
+ require: false,
2633
+ validator: (value) => {
2634
+ return ['sm', 'lg'].includes(value);
2635
+ },
2636
+ },
2637
+ /**
2638
+ * Set component validation state to valid.
2639
+ */
2640
+ valid: {
2641
+ type: Boolean,
2642
+ required: false,
2643
+ },
2644
+ },
2645
+ emits: [
2646
+ /**
2647
+ * Event occurs when when a user changes the selected option of a `<select>` element.
2648
+ */
2649
+ 'change',
2650
+ /**
2651
+ * Emit the new value whenever there’s a change event.
2652
+ */
2653
+ 'update:modelValue',
2654
+ ],
2655
+ setup(props, { emit, slots }) {
2656
+ const handleChange = (event) => {
2657
+ const target = event.target;
2658
+ const selected = Array.from(target.options)
2659
+ .filter((option) => option.selected)
2660
+ .map((option) => option.value);
2661
+ emit('change', event);
2662
+ emit('update:modelValue', target.multiple ? selected : selected[0]);
2663
+ };
2664
+ return () => h$1('select', {
2665
+ class: [
2666
+ 'form-select',
2667
+ {
2668
+ [`form-select-${props.size}`]: props.size,
2669
+ 'is-invalid': props.invalid,
2670
+ 'is-valid': props.valid,
2671
+ },
2672
+ ],
2673
+ multiple: props.multiple,
2674
+ onChange: (event) => handleChange(event),
2675
+ size: props.htmlSize,
2676
+ ...(props.modelValue && !props.multiple && { value: props.modelValue }),
2677
+ }, props.options
2678
+ ? props.options.map((option) => {
2679
+ return h$1('option', {
2680
+ ...(typeof option === 'object' && {
2681
+ ...(option.disabled && { disabled: option.disabled }),
2682
+ ...(option.selected && { selected: option.selected }),
2683
+ ...(option.value && {
2684
+ value: option.value,
2685
+ ...(props.modelValue &&
2686
+ props.multiple &&
2687
+ props.modelValue.includes(option.value) && { selected: true }),
2688
+ }),
2689
+ }),
2690
+ }, typeof option === 'string' ? option : option.label);
2691
+ })
2692
+ : slots.default && slots.default());
2693
+ },
2694
+ });
2695
+
2696
+ const CFormSwitch = defineComponent({
2697
+ name: 'CFormSwitch',
2698
+ inheritAttrs: false,
2699
+ props: {
2700
+ /**
2701
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document
2702
+ */
2703
+ id: {
2704
+ type: String,
2705
+ default: undefined,
2706
+ required: false,
2707
+ },
2708
+ /**
2709
+ * Set component validation state to invalid.
2710
+ */
2711
+ invalid: {
2712
+ type: Boolean,
2713
+ required: false,
2714
+ },
2715
+ /**
2716
+ * The element represents a caption for a component.
2717
+ */
2718
+ label: {
2719
+ type: String,
2720
+ default: undefined,
2721
+ required: false,
2722
+ },
2723
+ /**
2724
+ * The default name for a value passed using v-model.
2725
+ */
2726
+ modelValue: {
2727
+ type: [Boolean, String],
2728
+ value: undefined,
2729
+ required: false,
2730
+ },
2731
+ /**
2732
+ * Size the component large or extra large. Works only with `switch`.
2733
+ *
2734
+ * @values 'lg' | 'xl'
2735
+ */
2736
+ size: {
2737
+ type: String,
2738
+ default: undefined,
2739
+ required: false,
2740
+ validator: (value) => {
2741
+ return ['lg', 'xl'].includes(value);
2742
+ },
2743
+ },
2744
+ /**
2745
+ * Specifies the type of component.
2746
+ *
2747
+ * @values 'checkbox', 'radio'
2748
+ */
2749
+ type: {
2750
+ type: String,
2751
+ default: 'checkbox',
2752
+ required: false,
2753
+ },
2754
+ /**
2755
+ * Set component validation state to valid.
2756
+ */
2757
+ valid: {
2758
+ type: Boolean,
2759
+ required: false,
2760
+ },
2761
+ },
2762
+ emits: [
2763
+ /**
2764
+ * Event occurs when the checked value has been changed.
2765
+ */
2766
+ 'change',
2767
+ /**
2768
+ * Emit the new value whenever there’s a change event.
2769
+ */
2770
+ 'update:modelValue',
2771
+ ],
2772
+ setup(props, { attrs, emit }) {
2773
+ const checked = ref(attrs.checked);
2774
+ watch(() => props.modelValue, () => {
2775
+ if (typeof props.modelValue === 'boolean')
2776
+ checked.value = props.modelValue;
2777
+ });
2778
+ const handleChange = (event) => {
2779
+ const target = event.target;
2780
+ emit('change', event);
2781
+ emit('update:modelValue', target.checked);
2782
+ };
2783
+ return () => h$1('div', {
2784
+ class: [
2785
+ 'form-check form-switch',
2786
+ {
2787
+ [`form-switch-${props.size}`]: props.size,
2788
+ 'is-invalid': props.invalid,
2789
+ 'is-valid': props.valid,
2790
+ },
2791
+ ],
2792
+ }, [
2793
+ h$1('input', {
2794
+ ...attrs,
2795
+ checked: checked.value,
2796
+ class: [
2797
+ 'form-check-input',
2798
+ {
2799
+ 'is-invalid': props.invalid,
2800
+ 'is-valid': props.valid,
2801
+ },
2802
+ ],
2803
+ id: props.id,
2804
+ onChange: (event) => handleChange(event),
2805
+ type: props.type,
2806
+ }),
2807
+ props.label &&
2808
+ h$1(CFormLabel, {
2809
+ ...(props.id && { for: props.id }),
2810
+ class: 'form-check-label',
2811
+ }, {
2812
+ default: () => props.label,
2813
+ }),
2814
+ ]);
2815
+ },
2816
+ });
2817
+
2818
+ const CFormText = defineComponent({
2819
+ name: 'CFormText',
2820
+ props: {
2821
+ /**
2822
+ * Component used for the root node. Either a string to use a HTML element or a component.
2823
+ */
2824
+ component: {
2825
+ type: String,
2826
+ required: false,
2827
+ default: 'div',
2828
+ },
2829
+ },
2830
+ setup(props, { slots }) {
2831
+ return () => h$1(props.component, { class: 'form-text' }, slots.default && slots.default());
2832
+ },
2833
+ });
2834
+
2835
+ const CFormTextarea = defineComponent({
2836
+ name: 'CFormTextarea',
2837
+ props: {
2838
+ /**
2839
+ * Toggle the disabled state for the component.
2840
+ */
2841
+ disabled: {
2842
+ type: Boolean,
2843
+ required: false,
2844
+ },
2845
+ /**
2846
+ * Set component validation state to invalid.
2847
+ */
2848
+ invalid: {
2849
+ type: Boolean,
2850
+ required: false,
2851
+ },
2852
+ /**
2853
+ * The default name for a value passed using v-model.
2854
+ */
2855
+ modelValue: {
2856
+ type: String,
2857
+ default: undefined,
2858
+ require: false,
2859
+ },
2860
+ /**
2861
+ * Render the component styled as plain text. Removes the default form field styling and preserve the correct margin and padding. Recommend to use only along side `readonly`.
2862
+ */
2863
+ plainText: {
2864
+ type: Boolean,
2865
+ required: false,
2866
+ },
2867
+ /**
2868
+ * Toggle the readonly state for the component.
2869
+ */
2870
+ readonly: {
2871
+ type: Boolean,
2872
+ required: false,
2873
+ },
2874
+ /**
2875
+ * Set component validation state to valid.
2876
+ */
2877
+ valid: {
2878
+ type: Boolean,
2879
+ required: false,
2880
+ },
2881
+ },
2882
+ emits: [
2883
+ /**
2884
+ * Event occurs when the element loses focus, after the content has been changed.
2885
+ */
2886
+ 'change',
2887
+ /**
2888
+ * Event occurs immediately after the value of a component has changed.
2889
+ */
2890
+ 'input',
2891
+ /**
2892
+ * Emit the new value whenever there’s an input or change event.
2893
+ */
2894
+ 'update:modelValue',
2895
+ ],
2896
+ setup(props, { emit, slots }) {
2897
+ const handleInput = (event) => {
2898
+ const target = event.target;
2899
+ emit('input', event);
2900
+ emit('update:modelValue', target.value);
2901
+ };
2902
+ return () => h$1('textarea', {
2903
+ disabled: props.disabled,
2904
+ readonly: props.readonly,
2905
+ class: [
2906
+ props.plainText ? 'form-control-plaintext' : 'form-control',
2907
+ {
2908
+ 'is-invalid': props.invalid,
2909
+ 'is-valid': props.valid,
2910
+ },
2911
+ ],
2912
+ onInput: (event) => handleInput(event),
2913
+ value: props.modelValue,
2914
+ }, slots.default && slots.default());
2915
+ },
2916
+ });
2917
+
2918
+ const CInputGroup = defineComponent({
2919
+ name: 'CInputGroup',
2920
+ props: {
2921
+ /**
2922
+ * Size the component small or large.
2923
+ *
2924
+ * @values 'sm', 'lg'
2925
+ */
2926
+ size: {
2927
+ type: String,
2928
+ default: undefined,
2929
+ required: false,
2930
+ validator: (value) => {
2931
+ return ['sm', 'lg'].includes(value);
2932
+ },
2933
+ },
2934
+ },
2935
+ setup(props, { slots }) {
2936
+ return () => h$1('div', {
2937
+ class: [
2938
+ 'input-group',
2939
+ {
2940
+ [`input-group-${props.size}`]: props.size,
2941
+ },
2942
+ ],
2943
+ }, slots.default && slots.default());
2944
+ },
2945
+ });
2946
+
2947
+ const CInputGroupText = defineComponent({
2948
+ name: 'CInputGroupText',
2949
+ props: {
2950
+ /**
2951
+ * Component used for the root node. Either a string to use a HTML element or a component.
2952
+ */
2953
+ component: {
2954
+ type: String,
2955
+ required: false,
2956
+ default: 'span',
2957
+ },
2958
+ },
2959
+ setup(props, { slots }) {
2960
+ return () => h$1(props.component, { class: 'input-group-text' }, slots.default && slots.default());
2961
+ },
2962
+ });
2963
+
2964
+ const CFormPlugin = {
2965
+ install: (app) => {
2966
+ app.component(CForm.name, CForm);
2967
+ app.component(CFormCheck.name, CFormCheck);
2968
+ // app.component(CFormControl.name, CFormControl)
2969
+ app.component(CFormFeedback.name, CFormFeedback);
2970
+ app.component(CFormFloating.name, CFormFloating);
2971
+ app.component(CFormInput.name, CFormInput);
2972
+ app.component(CFormLabel.name, CFormLabel);
2973
+ app.component(CFormRange.name, CFormRange);
2974
+ app.component(CFormSelect.name, CFormSelect);
2975
+ app.component(CFormSwitch.name, CFormSwitch);
2976
+ app.component(CFormText.name, CFormText);
2977
+ app.component(CFormTextarea.name, CFormTextarea);
2978
+ app.component(CInputGroup.name, CInputGroup);
2979
+ app.component(CInputGroupText.name, CInputGroupText);
2980
+ },
2981
+ };
2982
+
2983
+ var top = 'top';
2984
+ var bottom = 'bottom';
2985
+ var right = 'right';
2986
+ var left = 'left';
2987
+ var auto = 'auto';
2988
+ var basePlacements = [top, bottom, right, left];
2989
+ var start = 'start';
2990
+ var end = 'end';
2991
+ var clippingParents = 'clippingParents';
2992
+ var viewport = 'viewport';
2993
+ var popper = 'popper';
2994
+ var reference = 'reference';
2995
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
2996
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
2997
+ }, []);
2998
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
2999
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
3000
+ }, []); // modifiers that need to read the DOM
3001
+
3002
+ var beforeRead = 'beforeRead';
3003
+ var read = 'read';
3004
+ var afterRead = 'afterRead'; // pure-logic modifiers
3005
+
3006
+ var beforeMain = 'beforeMain';
3007
+ var main = 'main';
3008
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
1534
3009
 
1535
3010
  var beforeWrite = 'beforeWrite';
1536
3011
  var write = 'write';
@@ -1805,6 +3280,10 @@ function getContainingBlock(element) {
1805
3280
 
1806
3281
  var currentNode = getParentNode(element);
1807
3282
 
3283
+ if (isShadowRoot(currentNode)) {
3284
+ currentNode = currentNode.host;
3285
+ }
3286
+
1808
3287
  while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
1809
3288
  var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that
1810
3289
  // create a containing block.
@@ -2037,7 +3516,7 @@ function mapToStyles(_ref2) {
2037
3516
 
2038
3517
  if (placement === top || (placement === left || placement === right) && variation === end) {
2039
3518
  sideY = bottom;
2040
- var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
3519
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
2041
3520
  offsetParent[heightProp];
2042
3521
  y -= offsetY - popperRect.height;
2043
3522
  y *= gpuAcceleration ? 1 : -1;
@@ -2045,7 +3524,7 @@ function mapToStyles(_ref2) {
2045
3524
 
2046
3525
  if (placement === left || (placement === top || placement === bottom) && variation === end) {
2047
3526
  sideX = right;
2048
- var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
3527
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
2049
3528
  offsetParent[widthProp];
2050
3529
  x -= offsetX - popperRect.width;
2051
3530
  x *= gpuAcceleration ? 1 : -1;
@@ -3504,6 +4983,20 @@ const CDropdown = defineComponent({
3504
4983
  }
3505
4984
  },
3506
4985
  },
4986
+ /**
4987
+ * Configure the auto close behavior of the dropdown:
4988
+ * - `true` - the dropdown will be closed by clicking outside or inside the dropdown menu.
4989
+ * - `false` - the dropdown will be closed by clicking the toggle button and manually calling hide or toggle method. (Also will not be closed by pressing esc key)
4990
+ * - `'inside'` - the dropdown will be closed (only) by clicking inside the dropdown menu.
4991
+ * - `'outside'` - the dropdown will be closed (only) by clicking outside the dropdown menu.
4992
+ */
4993
+ autoClose: {
4994
+ type: [Boolean, String],
4995
+ default: true,
4996
+ validator: (value) => {
4997
+ return typeof value === 'boolean' || ['inside', 'outside'].includes(value);
4998
+ },
4999
+ },
3507
5000
  /**
3508
5001
  * Sets a darker color scheme to match a dark navbar.
3509
5002
  */
@@ -3589,21 +5082,23 @@ const CDropdown = defineComponent({
3589
5082
  'show',
3590
5083
  ],
3591
5084
  setup(props, { slots, emit }) {
3592
- const dropdownRef = ref();
5085
+ const dropdownToggleRef = ref();
3593
5086
  const dropdownMenuRef = ref();
3594
5087
  const placement = ref(props.placement);
3595
5088
  const popper = ref();
3596
- const config = reactive({
5089
+ const visible = ref(props.visible);
5090
+ watch(() => props.visible, () => {
5091
+ visible.value = props.visible;
5092
+ });
5093
+ provide('config', {
5094
+ autoClose: props.autoClose,
3597
5095
  alignment: props.alignment,
3598
5096
  dark: props.dark,
3599
5097
  popper: props.popper,
3600
- visible: props.visible,
3601
5098
  });
3602
- const { visible } = toRefs(config);
3603
- provide('config', config);
3604
5099
  provide('variant', props.variant);
3605
5100
  provide('visible', visible);
3606
- provide('dropdownRef', dropdownRef);
5101
+ provide('dropdownToggleRef', dropdownToggleRef);
3607
5102
  provide('dropdownMenuRef', dropdownMenuRef);
3608
5103
  if (props.direction === 'dropup') {
3609
5104
  placement.value = 'top-start';
@@ -3622,8 +5117,8 @@ const CDropdown = defineComponent({
3622
5117
  if (typeof props.alignment === 'object') {
3623
5118
  return;
3624
5119
  }
3625
- if (dropdownRef.value) {
3626
- popper.value = createPopper(dropdownRef.value, dropdownMenuRef.value, {
5120
+ if (dropdownToggleRef.value) {
5121
+ popper.value = createPopper(dropdownToggleRef.value, dropdownMenuRef.value, {
3627
5122
  placement: placement.value,
3628
5123
  });
3629
5124
  }
@@ -3634,40 +5129,28 @@ const CDropdown = defineComponent({
3634
5129
  }
3635
5130
  popper.value = undefined;
3636
5131
  };
3637
- const toggleMenu = function () {
3638
- if (props.disabled === false) {
3639
- if (visible.value === true) {
3640
- visible.value = false;
3641
- }
3642
- else {
3643
- visible.value = true;
3644
- }
5132
+ const toggleMenu = (_visible) => {
5133
+ if (props.disabled) {
5134
+ return;
3645
5135
  }
3646
- };
3647
- provide('toggleMenu', toggleMenu);
3648
- const hideMenu = function () {
3649
- if (props.disabled === false) {
3650
- visible.value = false;
5136
+ if (typeof _visible == 'boolean') {
5137
+ visible.value = _visible;
5138
+ return;
3651
5139
  }
3652
- };
3653
- const handleKeyup = (event) => {
3654
- if (dropdownRef.value && !dropdownRef.value.contains(event.target)) {
3655
- hideMenu();
5140
+ if (visible.value === true) {
5141
+ visible.value = false;
5142
+ return;
3656
5143
  }
5144
+ visible.value = true;
3657
5145
  };
3658
- const handleClickOutside = (event) => {
3659
- if (dropdownRef.value && !dropdownRef.value.contains(event.target)) {
3660
- hideMenu();
5146
+ provide('toggleMenu', toggleMenu);
5147
+ const hideMenu = () => {
5148
+ if (props.disabled) {
5149
+ return;
3661
5150
  }
5151
+ visible.value = false;
3662
5152
  };
3663
- onMounted(() => {
3664
- window.addEventListener('click', handleClickOutside);
3665
- window.addEventListener('keyup', handleKeyup);
3666
- });
3667
- onUnmounted(() => {
3668
- window.removeEventListener('click', handleClickOutside);
3669
- window.removeEventListener('keyup', handleKeyup);
3670
- });
5153
+ provide('hideMenu', hideMenu);
3671
5154
  watch(visible, () => {
3672
5155
  props.popper && (visible.value ? initPopper() : destroyPopper());
3673
5156
  visible.value ? emit('show') : emit('hide');
@@ -3773,10 +5256,12 @@ const CDropdownMenu = defineComponent({
3773
5256
  },
3774
5257
  },
3775
5258
  setup(props, { slots }) {
5259
+ const dropdownToggleRef = inject('dropdownToggleRef');
3776
5260
  const dropdownMenuRef = inject('dropdownMenuRef');
3777
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3778
- const config = inject('config');
3779
- const { alignment, dark, popper, visible } = toRefs(config);
5261
+ const config = inject('config'); // eslint-disable-line @typescript-eslint/no-explicit-any
5262
+ const hideMenu = inject('hideMenu');
5263
+ const visible = inject('visible');
5264
+ const { autoClose, alignment, dark, popper } = config;
3780
5265
  // eslint-disable-next-line @typescript-eslint/ban-types
3781
5266
  const alignmentClassNames = (alignment) => {
3782
5267
  const classNames = [];
@@ -3790,13 +5275,46 @@ const CDropdownMenu = defineComponent({
3790
5275
  }
3791
5276
  return classNames;
3792
5277
  };
5278
+ const handleKeyup = (event) => {
5279
+ if (autoClose === false) {
5280
+ return;
5281
+ }
5282
+ if (event.key === 'Escape') {
5283
+ hideMenu();
5284
+ }
5285
+ };
5286
+ const handleMouseUp = (event) => {
5287
+ if (dropdownToggleRef.value?.contains(event.target)) {
5288
+ return;
5289
+ }
5290
+ if (autoClose === true) {
5291
+ hideMenu();
5292
+ return;
5293
+ }
5294
+ if (autoClose === 'inside' && dropdownMenuRef.value?.contains(event.target)) {
5295
+ hideMenu();
5296
+ return;
5297
+ }
5298
+ if (autoClose === 'outside' &&
5299
+ !dropdownMenuRef.value?.contains(event.target)) {
5300
+ hideMenu();
5301
+ }
5302
+ };
5303
+ onUpdated(() => {
5304
+ visible.value && window.addEventListener('mouseup', handleMouseUp);
5305
+ visible.value && window.addEventListener('keyup', handleKeyup);
5306
+ });
5307
+ onUnmounted(() => {
5308
+ window.removeEventListener('mouseup', handleMouseUp);
5309
+ window.removeEventListener('keyup', handleKeyup);
5310
+ });
3793
5311
  return () => h$1(props.component, {
3794
5312
  class: [
3795
5313
  'dropdown-menu',
3796
- { 'dropdown-menu-dark': dark.value, show: visible.value },
3797
- alignmentClassNames(alignment.value),
5314
+ { 'dropdown-menu-dark': dark, show: visible.value },
5315
+ alignmentClassNames(alignment),
3798
5316
  ],
3799
- ...((typeof alignment.value === 'object' || !popper.value) && {
5317
+ ...((typeof alignment === 'object' || !popper) && {
3800
5318
  'data-coreui-popper': 'static',
3801
5319
  }),
3802
5320
  ref: dropdownMenuRef,
@@ -3839,6 +5357,10 @@ const CDropdownToggle = defineComponent({
3839
5357
  default: 'button',
3840
5358
  require: false,
3841
5359
  },
5360
+ /**
5361
+ * Create a custom toggler which accepts any content.
5362
+ */
5363
+ custom: Boolean,
3842
5364
  /**
3843
5365
  * Toggle the disabled state for the component.
3844
5366
  */
@@ -3870,6 +5392,16 @@ const CDropdownToggle = defineComponent({
3870
5392
  type: Boolean,
3871
5393
  required: false,
3872
5394
  },
5395
+ /**
5396
+ * Sets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them.
5397
+ *
5398
+ * @type 'hover' | 'focus' | 'click'
5399
+ */
5400
+ trigger: {
5401
+ type: String,
5402
+ default: 'click',
5403
+ required: false,
5404
+ },
3873
5405
  /**
3874
5406
  * Set the button variant to an outlined button or a ghost button.
3875
5407
  *
@@ -3885,7 +5417,8 @@ const CDropdownToggle = defineComponent({
3885
5417
  },
3886
5418
  },
3887
5419
  setup(props, { slots }) {
3888
- const dropdownRef = inject('dropdownRef');
5420
+ const togglerRef = ref();
5421
+ const dropdownToggleRef = inject('dropdownToggleRef');
3889
5422
  const dropdownVariant = inject('variant');
3890
5423
  const visible = inject('visible');
3891
5424
  const toggleMenu = inject('toggleMenu');
@@ -3893,43 +5426,83 @@ const CDropdownToggle = defineComponent({
3893
5426
  {
3894
5427
  'dropdown-toggle': props.caret,
3895
5428
  'dropdown-toggle-split': props.split,
3896
- show: visible,
3897
5429
  active: props.active,
3898
5430
  disabled: props.disabled,
3899
5431
  },
3900
5432
  ];
3901
- const buttonClassName = [
3902
- 'btn',
3903
- props.variant ? `btn-${props.variant}-${props.color}` : `btn-${props.color}`,
3904
- {
3905
- [`btn-${props.size}`]: props.size,
3906
- },
3907
- props.shape,
3908
- ];
3909
- return () => dropdownVariant === 'nav-item'
3910
- ? h$1('a', {
3911
- active: props.active,
3912
- class: ['nav-link', className],
3913
- disabled: props.disabled,
3914
- href: '#',
3915
- onClick: (event) => {
3916
- event.preventDefault();
3917
- return toggleMenu();
5433
+ const triggers = {
5434
+ ...((props.trigger === 'click' || props.trigger.includes('click')) && {
5435
+ onClick: () => {
5436
+ if (props.disabled) {
5437
+ return;
5438
+ }
5439
+ toggleMenu();
3918
5440
  },
3919
- ref: dropdownRef,
3920
- }, { default: () => slots.default && slots.default() })
3921
- : h$1(
3922
- // TODO: check how to use CButton component
3923
- props.component, {
3924
- class: [...className, ...buttonClassName],
3925
- active: props.active,
3926
- disabled: props.disabled,
3927
- onClick: () => toggleMenu(),
3928
- ...(props.component === 'button' && { type: 'button' }),
3929
- ref: dropdownRef,
3930
- }, props.split
3931
- ? h$1('span', { class: 'visually-hidden' }, 'Toggle Dropdown')
3932
- : slots.default && slots.default());
5441
+ }),
5442
+ ...((props.trigger === 'focus' || props.trigger.includes('focus')) && {
5443
+ onfocus: () => {
5444
+ if (props.disabled) {
5445
+ return;
5446
+ }
5447
+ toggleMenu(true);
5448
+ },
5449
+ onblur: () => {
5450
+ if (props.disabled) {
5451
+ return;
5452
+ }
5453
+ toggleMenu(false);
5454
+ },
5455
+ }),
5456
+ };
5457
+ onMounted(() => {
5458
+ if (togglerRef.value) {
5459
+ dropdownToggleRef.value = togglerRef.value.$el;
5460
+ }
5461
+ });
5462
+ return () => props.custom
5463
+ ? slots.default &&
5464
+ slots.default().map((slot) => cloneVNode(slot, {
5465
+ ref: (el) => {
5466
+ togglerRef.value = el;
5467
+ },
5468
+ ...triggers,
5469
+ }))
5470
+ : dropdownVariant === 'nav-item'
5471
+ ? h$1('a', {
5472
+ active: props.active,
5473
+ class: [
5474
+ 'nav-link',
5475
+ className,
5476
+ {
5477
+ show: visible.value,
5478
+ },
5479
+ ],
5480
+ disabled: props.disabled,
5481
+ href: '#',
5482
+ ref: dropdownToggleRef,
5483
+ ...triggers,
5484
+ }, { default: () => slots.default && slots.default() })
5485
+ : h$1(CButton, {
5486
+ class: [
5487
+ className,
5488
+ {
5489
+ show: visible.value,
5490
+ },
5491
+ ],
5492
+ active: props.active,
5493
+ color: props.color,
5494
+ disabled: props.disabled,
5495
+ ref: (el) => {
5496
+ togglerRef.value = el;
5497
+ },
5498
+ shape: props.shape,
5499
+ size: props.size,
5500
+ ...triggers,
5501
+ ...(props.component === 'button' && { type: 'button' }),
5502
+ variant: props.variant,
5503
+ }, () => props.split
5504
+ ? h$1('span', { class: 'visually-hidden' }, 'Toggle Dropdown')
5505
+ : slots.default && slots.default());
3933
5506
  },
3934
5507
  });
3935
5508
 
@@ -3944,1101 +5517,1630 @@ const CDropdownPlugin = {
3944
5517
  },
3945
5518
  };
3946
5519
 
3947
- const CSpinner = defineComponent({
3948
- name: 'CSpinner',
5520
+ const CPicker = defineComponent({
5521
+ name: 'CPicker',
3949
5522
  props: {
5523
+ ...CDropdown.props,
3950
5524
  /**
3951
- * Sets the color context of the component to one of CoreUI’s themed colors.
3952
- *
3953
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
5525
+ * Toggle visibility or set the content of cancel button.
3954
5526
  */
3955
- color: {
3956
- type: String,
3957
- default: undefined,
3958
- required: false,
3959
- validator: (value) => {
3960
- return [
3961
- 'primary',
3962
- 'secondary',
3963
- 'success',
3964
- 'danger',
3965
- 'warning',
3966
- 'info',
3967
- 'dark',
3968
- 'light',
3969
- ].includes(value);
3970
- },
5527
+ cancelButton: {
5528
+ type: [Boolean, String],
5529
+ default: 'Cancel',
3971
5530
  },
3972
5531
  /**
3973
- * Component used for the root node. Either a string to use a HTML element or a component.
5532
+ * Sets the color context of the cancel button to one of CoreUI’s themed colors.
5533
+ *
5534
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
3974
5535
  */
3975
- component: {
3976
- type: String,
3977
- default: 'div',
3978
- required: false,
5536
+ cancelButtonColor: {
5537
+ ...Color,
5538
+ default: 'primary',
3979
5539
  },
3980
5540
  /**
3981
- * Size the component small.
5541
+ * Size the cancel button small or large.
3982
5542
  *
3983
- * @values 'sm'
5543
+ * @values 'sm', 'lg'
3984
5544
  */
3985
- size: {
5545
+ cancelButtonSize: {
3986
5546
  type: String,
3987
- default: undefined,
3988
- required: false,
5547
+ default: 'sm',
3989
5548
  validator: (value) => {
3990
- return value === 'sm';
5549
+ return ['sm', 'lg'].includes(value);
3991
5550
  },
3992
5551
  },
3993
5552
  /**
3994
- * Set the button variant to an outlined button or a ghost button.
5553
+ * Set the cancel button variant to an outlined button or a ghost button.
3995
5554
  *
3996
- * @values 'border', 'grow'
5555
+ * @values 'ghost', 'outline'
3997
5556
  */
3998
- variant: {
5557
+ cancelButtonVariant: {
3999
5558
  type: String,
4000
- default: 'border',
4001
- required: false,
5559
+ default: 'ghost',
4002
5560
  validator: (value) => {
4003
- return ['border', 'grow'].includes(value);
5561
+ return ['ghost', 'outline'].includes(value);
4004
5562
  },
4005
5563
  },
4006
5564
  /**
4007
- * Set visually hidden label for accessibility purposes.
5565
+ * Toggle visibility or set the content of confirm button.
4008
5566
  */
4009
- visuallyHiddenLabel: {
4010
- type: String,
4011
- default: 'Loading...',
4012
- required: false,
5567
+ confirmButton: {
5568
+ type: [Boolean, String],
5569
+ default: 'OK',
4013
5570
  },
4014
- },
4015
- setup(props) {
4016
- return () => h$1(props.component, {
4017
- class: [
4018
- `spinner-${props.variant}`,
4019
- `text-${props.color}`,
4020
- props.size && `spinner-${props.variant}-${props.size}`,
4021
- ],
4022
- role: 'status',
4023
- }, h$1('span', { class: ['visually-hidden'] }, props.visuallyHiddenLabel));
4024
- },
4025
- });
4026
-
4027
- const CSpinnerPlugin = {
4028
- install: (app) => {
4029
- app.component(CSpinner.name, CSpinner);
4030
- },
4031
- };
4032
-
4033
- const CElementCover = defineComponent({
4034
- name: 'CElementCover',
4035
- props: {
4036
5571
  /**
4037
- * Array of custom boundaries. Use to create custom cover area (instead of parent element area). Area is defined by four sides: 'top', 'bottom', 'right', 'left'. If side is not defined by any custom boundary it is equal to parent element boundary. Each custom boundary is object with keys:
4038
- * - sides (array) - select boundaries of element to define boundaries. Sides names: 'top', 'bottom', 'right', 'left'.
4039
- * - query (string) - query used to get element which define boundaries. Search will be done only inside parent element, by parent.querySelector(query) function. [docs]
5572
+ * Sets the color context of the confirm button to one of CoreUI’s themed colors.
4040
5573
  *
4041
- * @type {sides: string[], query: string}[]
5574
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4042
5575
  */
4043
- boundaries: {
4044
- // TODO: check if this is correct, TJ
4045
- type: Array,
4046
- require: true,
5576
+ confirmButtonColor: {
5577
+ ...Color,
5578
+ default: 'primary',
4047
5579
  },
4048
5580
  /**
4049
- * Opacity of the cover. [docs]
4050
- *
4051
- * @type number
4052
- */
4053
- opacity: {
4054
- type: Number,
4055
- require: false,
4056
- },
4057
- },
4058
- setup(props) {
4059
- let containerCoords = {};
4060
- const elementRef = ref();
4061
- const getCustomBoundaries = () => {
4062
- if (!props.boundaries || elementRef === null) {
4063
- return {};
4064
- }
4065
- const parent = elementRef.value.parentElement;
4066
- if (!parent) {
4067
- return {};
4068
- }
4069
- const parentCoords = parent.getBoundingClientRect();
4070
- const customBoundaries = {};
4071
- props.boundaries.forEach((value) => {
4072
- const element = parent.querySelector(value.query);
4073
- if (!element || !value.sides) {
4074
- return;
4075
- }
4076
- const coords = element.getBoundingClientRect();
4077
- value.sides.forEach((side) => {
4078
- const sideMargin = Math.abs(coords[side] - parentCoords[side]);
4079
- customBoundaries[side] = `${sideMargin}px`;
4080
- });
4081
- });
4082
- return customBoundaries;
4083
- };
4084
- onMounted(function () {
4085
- nextTick(function () {
4086
- containerCoords = getCustomBoundaries();
4087
- });
4088
- });
4089
- return () => h$1('div', {
4090
- style: {
4091
- ...containerCoords,
4092
- position: 'absolute',
4093
- 'background-color': `rgb(255,255,255,${props.opacity})`,
4094
- },
4095
- ref: elementRef,
4096
- }, h$1('div', // TODO: use slot to override this
4097
- {
4098
- style: {
4099
- position: 'absolute',
4100
- top: '50%',
4101
- left: '50%',
4102
- transform: 'translateX(-50%) translateY(-50%)',
4103
- },
4104
- }, h$1(CSpinner, {
4105
- variant: 'grow',
4106
- color: 'primary',
4107
- })));
4108
- },
4109
- });
4110
-
4111
- const CElementCoverPlugin = {
4112
- install: (app) => {
4113
- app.component(CElementCover.name, CElementCover);
4114
- },
4115
- };
4116
-
4117
- const CFooter = defineComponent({
4118
- name: 'CFooter',
4119
- props: {
5581
+ * Size the confirm button small or large.
5582
+ *
5583
+ * @values 'sm', 'lg'
5584
+ */
5585
+ confirmButtonSize: {
5586
+ type: String,
5587
+ default: 'sm',
5588
+ validator: (value) => {
5589
+ return ['sm', 'lg'].includes(value);
5590
+ },
5591
+ },
4120
5592
  /**
4121
- * Place footer in non-static positions.
5593
+ * Set the confirm button variant to an outlined button or a ghost button.
4122
5594
  *
4123
- * @values 'fixed', 'sticky'
5595
+ * @values 'ghost', 'outline'
4124
5596
  */
4125
- position: {
5597
+ confirmButtonVariant: {
4126
5598
  type: String,
4127
- default: undefined,
4128
- required: false,
4129
5599
  validator: (value) => {
4130
- return ['fixed', 'sticky'].includes(value);
5600
+ return ['ghost', 'outline'].includes(value);
4131
5601
  },
4132
5602
  },
5603
+ /**
5604
+ * Set container type for the component.
5605
+ */
5606
+ container: {
5607
+ type: String,
5608
+ default: 'dropdown',
5609
+ },
5610
+ /**
5611
+ * Toggle the disabled state for the component.
5612
+ */
5613
+ disabled: Boolean,
5614
+ /**
5615
+ * Toggle visibility of footer element or set the content of footer.
5616
+ */
5617
+ footer: Boolean,
5618
+ /**
5619
+ * Toggle the visibility of the component.
5620
+ */
5621
+ visible: Boolean,
4133
5622
  },
4134
- setup(props, { slots }) {
4135
- return () => h$1('div', { class: ['footer', { [`footer-${props.position}`]: props.position }] }, slots.default && slots.default());
5623
+ emits: [
5624
+ /**
5625
+ * Callback fired when the cancel button has been clicked.
5626
+ */
5627
+ 'cancel',
5628
+ /**
5629
+ * Callback fired when the confirm button has been clicked.
5630
+ */
5631
+ 'confirm',
5632
+ /**
5633
+ * Callback fired when the component requests to be hidden.
5634
+ */
5635
+ 'hide',
5636
+ /**
5637
+ * Callback fired when the component requests to be shown.
5638
+ */
5639
+ 'show',
5640
+ ],
5641
+ setup(props, { emit, slots }) {
5642
+ const visible = ref(props.visible);
5643
+ watch(() => props.visible, () => {
5644
+ visible.value = props.visible;
5645
+ });
5646
+ const handleConfirm = () => {
5647
+ emit('confirm');
5648
+ visible.value = false;
5649
+ };
5650
+ const Footer = () => h$1('div', { class: 'picker-footer' }, [
5651
+ props.cancelButton &&
5652
+ h$1(CButton, {
5653
+ color: props.cancelButtonColor,
5654
+ onClick: () => emit('cancel'),
5655
+ size: props.cancelButtonSize,
5656
+ variant: props.cancelButtonVariant,
5657
+ },
5658
+ /**
5659
+ * @slot Location for the cancel button content.
5660
+ */
5661
+ () => (slots.cancelButton ? slots.cancelButton() : props.cancelButton)),
5662
+ props.confirmButton &&
5663
+ h$1(CButton, {
5664
+ color: props.confirmButtonColor,
5665
+ onClick: handleConfirm,
5666
+ size: props.confirmButtonSize,
5667
+ variant: props.confirmButtonVariant,
5668
+ },
5669
+ /**
5670
+ * @slot Location for the confirm button content.
5671
+ */
5672
+ () => (slots.confirmButton ? slots.confirmButton() : props.confirmButton)),
5673
+ ]);
5674
+ switch (props.container) {
5675
+ case 'inline':
5676
+ return () => h$1('div', { class: 'picker' }, slots.default && slots.default());
5677
+ default:
5678
+ return () => h$1(CDropdown, {
5679
+ autoClose: 'outside',
5680
+ class: 'picker',
5681
+ onHide: () => {
5682
+ visible.value = false;
5683
+ emit('hide');
5684
+ },
5685
+ onShow: () => {
5686
+ visible.value = true;
5687
+ emit('show');
5688
+ },
5689
+ variant: 'dropdown',
5690
+ visible: visible.value,
5691
+ }, () => [
5692
+ h$1(CDropdownToggle, {
5693
+ custom: true,
5694
+ disabled: visible.value || props.disabled,
5695
+ }, {
5696
+ /**
5697
+ * @slot Location for the toggler element.
5698
+ */
5699
+ default: () => slots.toggler && slots.toggler(),
5700
+ }),
5701
+ h$1(CDropdownMenu, {}, () => [
5702
+ slots.default && slots.default(),
5703
+ props.footer && Footer(),
5704
+ ]),
5705
+ ]);
5706
+ }
4136
5707
  },
4137
5708
  });
4138
5709
 
4139
- const CFooterPlugin = {
5710
+ const CPickerPlugin = {
4140
5711
  install: (app) => {
4141
- app.component(CFooter.name, CFooter);
5712
+ app.component(CPicker.name, CPicker);
4142
5713
  },
4143
5714
  };
4144
5715
 
4145
- const CForm = defineComponent({
4146
- name: 'CForm',
5716
+ const CTimePickerRollCol = defineComponent({
5717
+ name: 'CTimePickerRollCol',
4147
5718
  props: {
4148
- /**
4149
- * Mark a form as validated. If you set it `true`, all validation styles will be applied to the forms component.
4150
- */
4151
- validated: {
4152
- type: Boolean,
4153
- required: false,
5719
+ elements: {
5720
+ type: Array,
5721
+ required: true,
5722
+ },
5723
+ selected: {
5724
+ type: [Number, String],
4154
5725
  },
4155
5726
  },
4156
- setup(props, { slots }) {
4157
- return () => h$1('form', { class: [{ ['was-validated']: props.validated }] }, slots.default && slots.default());
5727
+ emits: ['click'],
5728
+ setup(props, { emit }) {
5729
+ const init = ref(true);
5730
+ const colRef = ref();
5731
+ onUpdated(() => {
5732
+ const nodeEl = colRef.value?.querySelector('.selected');
5733
+ if (nodeEl && nodeEl instanceof HTMLElement) {
5734
+ colRef.value?.scrollTo({
5735
+ top: nodeEl.offsetTop,
5736
+ behavior: init.value ? 'auto' : 'smooth',
5737
+ });
5738
+ }
5739
+ init.value = false;
5740
+ });
5741
+ return () => h$1('div', { class: 'time-picker-roll-col', ref: colRef }, props.elements.map((element) => {
5742
+ return h$1('div', {
5743
+ class: [
5744
+ 'time-picker-roll-cell',
5745
+ {
5746
+ selected: element.value === props.selected,
5747
+ },
5748
+ ],
5749
+ onClick: () => emit('click', element.value),
5750
+ role: 'button',
5751
+ }, element.label);
5752
+ }));
4158
5753
  },
4159
5754
  });
4160
5755
 
4161
- /*!
4162
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
4163
- *
4164
- * Copyright (c) 2014-2017, Jon Schlinkert.
4165
- * Released under the MIT License.
4166
- */
4167
-
4168
- function isObject(o) {
4169
- return Object.prototype.toString.call(o) === '[object Object]';
4170
- }
4171
-
4172
- function isPlainObject(o) {
4173
- var ctor,prot;
4174
-
4175
- if (isObject(o) === false) return false;
4176
-
4177
- // If has modified constructor
4178
- ctor = o.constructor;
4179
- if (ctor === undefined) return true;
4180
-
4181
- // If has modified prototype
4182
- prot = ctor.prototype;
4183
- if (isObject(prot) === false) return false;
4184
-
4185
- // If constructor does not have an Object-specific method
4186
- if (prot.hasOwnProperty('isPrototypeOf') === false) {
4187
- return false;
4188
- }
4189
-
4190
- // Most likely a plain Object
4191
- return true;
4192
- }
4193
-
4194
- function t(){return t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e},t.apply(this,arguments)}function r(e,t){if(null==e)return {};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}const n={silent:!1,logLevel:"warn"},i=["validator"],o=Object.prototype,a=o.toString,s=o.hasOwnProperty,u=/^\s*function (\w+)/;function l(e){var t;const r=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(r){const e=r.toString().match(u);return e?e[1]:""}return ""}const c=isPlainObject,f=e=>e;let d=f;if("production"!==process.env.NODE_ENV){const e="undefined"!=typeof console;d=e?function(e,t=n.logLevel){!1===n.silent&&console[t](`[VueTypes warn]: ${e}`);}:f;}const p=(e,t)=>s.call(e,t),y=Number.isInteger||function(e){return "number"==typeof e&&isFinite(e)&&Math.floor(e)===e},v=Array.isArray||function(e){return "[object Array]"===a.call(e)},h=e=>"[object Function]"===a.call(e),b=e=>c(e)&&p(e,"_vueTypes_name"),g=e=>c(e)&&(p(e,"type")||["_vueTypes_name","validator","default","required"].some(t=>p(e,t)));function O(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function m(e,t,r=!1){let n,i=!0,o="";n=c(e)?e:{type:e};const a=b(n)?n._vueTypes_name+" - ":"";if(g(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return i;if(!n.required&&void 0===t)return i;v(n.type)?(i=n.type.some(e=>!0===m(e,t,!0)),o=n.type.map(e=>l(e)).join(" or ")):(o=l(n),i="Array"===o?v(t):"Object"===o?c(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return "";const t=e.constructor.toString().match(u);return t?t[1]:""}(t)===o:t instanceof n.type);}if(!i){const e=`${a}value "${t}" should be of type "${o}"`;return !1===r?(d(e),!1):e}if(p(n,"validator")&&h(n.validator)){const e=d,o=[];if(d=e=>{o.push(e);},i=n.validator(t),d=e,!i){const e=(o.length>1?"* ":"")+o.join("\n* ");return o.length=0,!1===r?(d(e),i):e}}return i}function j(e,t){const r=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get(){return this.required=!0,this}},def:{value(e){return void 0===e?(p(this,"default")&&delete this.default,this):h(e)||!0===m(this,e,!0)?(this.default=v(e)?()=>[...e]:c(e)?()=>Object.assign({},e):e,this):(d(`${this._vueTypes_name} - invalid default value: "${e}"`),this)}}}),{validator:n}=r;return h(n)&&(r.validator=O(n,r)),r}function _(e,t){const r=j(e,t);return Object.defineProperty(r,"validate",{value(e){return h(this.validator)&&d(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:\n${JSON.stringify(this)}`),this.validator=O(e,this),this}})}function T(e,t,n){const o=function(e){const t={};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=Object.getOwnPropertyDescriptor(e,r);}),Object.defineProperties({},t)}(t);if(o._vueTypes_name=e,!c(n))return o;const{validator:a}=n,s=r(n,i);if(h(a)){let{validator:e}=o;e&&(e=null!==(l=(u=e).__original)&&void 0!==l?l:u),o.validator=O(e?function(t){return e.call(this,t)&&a.call(this,t)}:a,o);}var u,l;return Object.assign(o,s)}function $(e){return e.replace(/^(?!\s*$)/gm," ")}const w=()=>_("any",{}),P=()=>_("function",{type:Function}),x=()=>_("boolean",{type:Boolean}),E=()=>_("string",{type:String}),N=()=>_("number",{type:Number}),q=()=>_("array",{type:Array}),A=()=>_("object",{type:Object}),V=()=>j("integer",{type:Number,validator:e=>y(e)}),S=()=>j("symbol",{validator:e=>"symbol"==typeof e});function k(e,t="custom validation failed"){if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return j(e.name||"<<anonymous function>>",{type:null,validator(r){const n=e(r);return n||d(`${this._vueTypes_name} - ${t}`),n}})}function D(e){if(!v(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");const t=`oneOf - value should be one of "${e.join('", "')}".`,r=e.reduce((e,t)=>{if(null!=t){const r=t.constructor;-1===e.indexOf(r)&&e.push(r);}return e},[]);return j("oneOf",{type:r.length>0?r:void 0,validator(r){const n=-1!==e.indexOf(r);return n||d(t),n}})}function L(e){if(!v(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");let t=!1,r=[];for(let n=0;n<e.length;n+=1){const i=e[n];if(g(i)){if(b(i)&&"oneOf"===i._vueTypes_name&&i.type){r=r.concat(i.type);continue}if(h(i.validator)&&(t=!0),!0===i.type||!i.type){d('oneOfType - invalid usage of "true" or "null" as types.');continue}r=r.concat(i.type);}else r.push(i);}r=r.filter((e,t)=>r.indexOf(e)===t);const n=r.length>0?r:null;return j("oneOfType",t?{type:n,validator(t){const r=[],n=e.some(e=>{const n=m(b(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return "string"==typeof n&&r.push(n),!0===n});return n||d(`oneOfType - provided value does not match any of the ${r.length} passed-in validators:\n${$(r.join("\n"))}`),n}}:{type:n})}function F(e){return j("arrayOf",{type:Array,validator(t){let r="";const n=t.every(t=>(r=m(e,t,!0),!0===r));return n||d(`arrayOf - value validation error:\n${$(r)}`),n}})}function Y(e){return j("instanceOf",{type:e})}function B(e){return j("objectOf",{type:Object,validator(t){let r="";const n=Object.keys(t).every(n=>(r=m(e,t[n],!0),!0===r));return n||d(`objectOf - value validation error:\n${$(r)}`),n}})}function I(e){const t=Object.keys(e),r=t.filter(t=>{var r;return !(null===(r=e[t])||void 0===r||!r.required)}),n=j("shape",{type:Object,validator(n){if(!c(n))return !1;const i=Object.keys(n);if(r.length>0&&r.some(e=>-1===i.indexOf(e))){const e=r.filter(e=>-1===i.indexOf(e));return d(1===e.length?`shape - required property "${e[0]}" is not defined.`:`shape - required properties "${e.join('", "')}" are not defined.`),!1}return i.every(r=>{if(-1===t.indexOf(r))return !0===this._vueTypes_isLoose||(d(`shape - shape definition does not include a "${r}" property. Allowed keys: "${t.join('", "')}".`),!1);const i=m(e[r],n[r],!0);return "string"==typeof i&&d(`shape - "${r}" property validation error:\n ${$(i)}`),!0===i})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),n}const J=["name","validate","getter"],M=/*#__PURE__*/(()=>{var e,t;return t=e=class{static get any(){return w()}static get func(){return P().def(this.defaults.func)}static get bool(){return x().def(this.defaults.bool)}static get string(){return E().def(this.defaults.string)}static get number(){return N().def(this.defaults.number)}static get array(){return q().def(this.defaults.array)}static get object(){return A().def(this.defaults.object)}static get integer(){return V().def(this.defaults.integer)}static get symbol(){return S()}static extend(e){if(v(e))return e.forEach(e=>this.extend(e)),this;const{name:t,validate:n=!1,getter:i=!1}=e,o=r(e,J);if(p(this,t))throw new TypeError(`[VueTypes error]: Type "${t}" already defined`);const{type:a}=o;if(b(a))return delete o.type,Object.defineProperty(this,t,i?{get:()=>T(t,a,o)}:{value(...e){const r=T(t,a,o);return r.validator&&(r.validator=r.validator.bind(r,...e)),r}});let s;return s=i?{get(){const e=Object.assign({},o);return n?_(t,e):j(t,e)},enumerable:!0}:{value(...e){const r=Object.assign({},o);let i;return i=n?_(t,r):j(t,r),r.validator&&(i.validator=r.validator.bind(i,...e)),i},enumerable:!0},Object.defineProperty(this,t,s)}},e.defaults={},e.sensibleDefaults=void 0,e.config=n,e.custom=k,e.oneOf=D,e.instanceOf=Y,e.oneOfType=L,e.arrayOf=F,e.objectOf=B,e.shape=I,e.utils={validate:(e,t)=>!0===m(t,e,!0),toType:(e,t,r=!1)=>r?_(e,t):j(e,t)},t})();function R(e={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var r,n;return n=r=class extends M{static get sensibleDefaults(){return t({},this.defaults)}static set sensibleDefaults(r){this.defaults=!1!==r?t({},!0!==r?r:e):{};}},r.defaults=t({},e),n}class z extends(R()){}
5756
+ const convert12hTo24h = (abbr, hour) => {
5757
+ if (abbr === 'am' && hour === 12) {
5758
+ return 0;
5759
+ }
5760
+ if (abbr === 'am') {
5761
+ return hour;
5762
+ }
5763
+ if (abbr === 'pm' && hour === 12) {
5764
+ return 12;
5765
+ }
5766
+ return hour + 12;
5767
+ };
5768
+ const convert24hTo12h = (hour) => hour % 12 || 12;
5769
+ const convertTimeToDate = (time) => time ? (time instanceof Date ? new Date(time) : new Date(`1970-01-01 ${time}`)) : null;
5770
+ const getAmPm = (date, locale) => {
5771
+ if (date.toLocaleTimeString(locale).includes('AM')) {
5772
+ return 'am';
5773
+ }
5774
+ if (date.toLocaleTimeString(locale).includes('PM')) {
5775
+ return 'pm';
5776
+ }
5777
+ return date.getHours() >= 12 ? 'pm' : 'am';
5778
+ };
5779
+ const getListOfHours = (locale) => Array.from({ length: isAmPm(locale) ? 12 : 24 }, (_, i) => {
5780
+ return {
5781
+ value: isAmPm(locale) ? i + 1 : i,
5782
+ label: (isAmPm(locale) ? i + 1 : i).toLocaleString(locale),
5783
+ };
5784
+ });
5785
+ const getMinutesOrSeconds = (locale) => Array.from({ length: 60 }, (_, i) => {
5786
+ return {
5787
+ value: i,
5788
+ label: i.toLocaleString(locale).padStart(2, (0).toLocaleString(locale)),
5789
+ };
5790
+ });
5791
+ const getSelectedHour = (date, locale) => date ? (isAmPm(locale) ? convert24hTo12h(date.getHours()) : date.getHours()) : '';
5792
+ const getSelectedMinutes = (date) => (date ? date.getMinutes() : '');
5793
+ const getSelectedSeconds = (date) => (date ? date.getSeconds() : '');
5794
+ const isAmPm = (locale) => ['am', 'AM', 'pm', 'PM'].some((el) => new Date().toLocaleString(locale).includes(el));
5795
+ const isValidTime = (time) => {
5796
+ const d = new Date(`1970-01-01 ${time}`);
5797
+ return d instanceof Date && d.getTime();
5798
+ };
4195
5799
 
4196
- const CFormLabel = defineComponent({
4197
- name: 'CFormLabel',
5800
+ const CTimePicker = defineComponent({
5801
+ name: 'CTimePicker',
4198
5802
  props: {
5803
+ ...CPicker.props,
4199
5804
  /**
4200
- * A string of all className you want to be applied to the component, and override standard className value.
5805
+ * Toggle visibility or set the content of cancel button.
4201
5806
  */
4202
- customClassName: {
4203
- type: [Array, String],
4204
- default: undefined,
4205
- required: false,
5807
+ cancelButton: {
5808
+ type: [Boolean, String],
5809
+ default: 'Cancel',
4206
5810
  },
4207
- },
4208
- setup(props, { slots }) {
4209
- return () => h$1('label', {
4210
- class: props.customClassName ? props.customClassName : 'form-label',
4211
- }, slots.default && slots.default());
4212
- },
4213
- });
4214
-
4215
- const CFormCheck = defineComponent({
4216
- name: 'CFormCheck',
4217
- inheritAttrs: false,
4218
- props: {
4219
5811
  /**
4220
- * Create button-like checkboxes and radio buttons.
5812
+ * Sets the color context of the cancel button to one of CoreUI’s themed colors.
5813
+ *
5814
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4221
5815
  */
4222
- button: I({
4223
- /**
4224
- * Sets the color context of the component to one of CoreUI’s themed colors.
4225
- *
4226
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4227
- */
4228
- color: Color,
4229
- /**
4230
- * Select the shape of the component.
4231
- *
4232
- * @values 'rounded', 'rounded-top', 'rounded-end', 'rounded-bottom', 'rounded-start', 'rounded-circle', 'rounded-pill', 'rounded-0', 'rounded-1', 'rounded-2', 'rounded-3'
4233
- */
4234
- shape: Shape,
4235
- /**
4236
- * Size the component small or large.
4237
- *
4238
- * @values 'sm' | 'lg'
4239
- */
4240
- size: {
4241
- type: String,
4242
- default: undefined,
4243
- required: false,
4244
- validator: (value) => {
4245
- return ['sm', 'lg'].includes(value);
4246
- },
5816
+ cancelButtonColor: {
5817
+ ...Color,
5818
+ default: 'primary',
5819
+ },
5820
+ /**
5821
+ * Size the cancel button small or large.
5822
+ *
5823
+ * @values 'sm', 'lg'
5824
+ */
5825
+ cancelButtonSize: {
5826
+ type: String,
5827
+ default: 'sm',
5828
+ validator: (value) => {
5829
+ return ['sm', 'lg'].includes(value);
4247
5830
  },
4248
- /**
4249
- * Set the button variant to an outlined button or a ghost button.
4250
- */
4251
- variant: {
4252
- type: String,
4253
- default: undefined,
4254
- required: false,
4255
- validator: (value) => {
4256
- return ['outline', 'ghost'].includes(value);
4257
- },
5831
+ },
5832
+ /**
5833
+ * Set the cancel button variant to an outlined button or a ghost button.
5834
+ *
5835
+ * @values 'ghost', 'outline'
5836
+ */
5837
+ cancelButtonVariant: {
5838
+ type: String,
5839
+ default: 'ghost',
5840
+ validator: (value) => {
5841
+ return ['ghost', 'outline'].includes(value);
4258
5842
  },
4259
- }),
5843
+ },
4260
5844
  /**
4261
- * The id global attribute defines an identifier (ID) that must be unique in the whole document.
5845
+ * Toggle visibility of the cleaner button.
4262
5846
  */
4263
- id: {
5847
+ cleaner: {
5848
+ type: Boolean,
5849
+ default: true,
5850
+ },
5851
+ /**
5852
+ * Toggle visibility or set the content of confirm button.
5853
+ */
5854
+ confirmButton: {
5855
+ type: [Boolean, String],
5856
+ default: 'OK',
5857
+ },
5858
+ /**
5859
+ * Sets the color context of the confirm button to one of CoreUI’s themed colors.
5860
+ *
5861
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
5862
+ */
5863
+ confirmButtonColor: {
5864
+ ...Color,
5865
+ default: 'primary',
5866
+ },
5867
+ /**
5868
+ * Size the confirm button small or large.
5869
+ *
5870
+ * @values 'sm', 'lg'
5871
+ */
5872
+ confirmButtonSize: {
4264
5873
  type: String,
4265
- default: undefined,
4266
- required: false,
5874
+ default: 'sm',
5875
+ validator: (value) => {
5876
+ return ['sm', 'lg'].includes(value);
5877
+ },
4267
5878
  },
4268
5879
  /**
4269
- * Input Checkbox indeterminate Property
5880
+ * Set the confirm button variant to an outlined button or a ghost button.
5881
+ *
5882
+ * @values 'ghost', 'outline'
4270
5883
  */
4271
- indeterminate: Boolean,
5884
+ confirmButtonVariant: {
5885
+ type: String,
5886
+ validator: (value) => {
5887
+ return ['ghost', 'outline'].includes(value);
5888
+ },
5889
+ },
4272
5890
  /**
4273
- * Group checkboxes or radios on the same horizontal row by adding.
5891
+ * Toggle visibility or set the content of the input indicator.
5892
+ */
5893
+ indicator: {
5894
+ type: Boolean,
5895
+ default: true,
5896
+ },
5897
+ /**
5898
+ * Toggle the readonly state for the component.
5899
+ */
5900
+ inputReadOnly: Boolean,
5901
+ /**
5902
+ * Sets the default locale for components. If not set, it is inherited from the navigator.language.
4274
5903
  */
4275
- inline: {
4276
- type: Boolean,
4277
- required: false,
5904
+ locale: {
5905
+ type: String,
5906
+ defalut: 'default',
4278
5907
  },
4279
5908
  /**
4280
- * Set component validation state to invalid.
5909
+ * Specifies a short hint that is visible in the input.
4281
5910
  */
4282
- invalid: {
4283
- type: Boolean,
4284
- required: false,
5911
+ placeholder: {
5912
+ type: String,
5913
+ default: 'Select time',
4285
5914
  },
4286
5915
  /**
4287
- * The element represents a caption for a component.
5916
+ * Size the component small or large.
5917
+ *
5918
+ * @values 'sm', 'lg'
4288
5919
  */
4289
- label: {
5920
+ size: {
4290
5921
  type: String,
4291
5922
  default: undefined,
4292
- required: false,
5923
+ validator: (value) => {
5924
+ return ['sm', 'lg'].includes(value);
5925
+ },
4293
5926
  },
4294
5927
  /**
4295
- * The default name for a value passed using v-model.
5928
+ * Initial selected time.
4296
5929
  */
4297
- modelValue: {
4298
- type: [Boolean, String],
4299
- value: undefined,
4300
- required: false,
5930
+ time: {
5931
+ type: [Date, String],
4301
5932
  },
4302
5933
  /**
4303
- * Specifies the type of component.
5934
+ * Set the time picker variant to a roll or select.
4304
5935
  *
4305
- * @values 'checkbox', 'radio'
5936
+ * @values 'roll', 'select'
4306
5937
  */
4307
- type: {
5938
+ variant: {
4308
5939
  type: String,
4309
- default: 'checkbox',
4310
- required: false,
4311
- },
4312
- /**
4313
- * Set component validation state to valid.
4314
- */
4315
- valid: {
4316
- type: Boolean,
4317
- required: false,
5940
+ default: 'roll',
5941
+ validator: (value) => {
5942
+ return ['roll', 'select'].includes(value);
5943
+ },
4318
5944
  },
4319
5945
  },
4320
5946
  emits: [
4321
5947
  /**
4322
- * Event occurs when the checked value has been changed.
5948
+ * Callback fired when the time changed.
4323
5949
  */
4324
5950
  'change',
4325
5951
  /**
4326
- * Emit the new value whenever there’s a change event.
5952
+ * Callback fired when the component requests to be hidden.
4327
5953
  */
4328
- 'update:modelValue',
5954
+ 'hide',
5955
+ /**
5956
+ * Callback fired when the component requests to be shown.
5957
+ */
5958
+ 'show',
4329
5959
  ],
4330
- setup(props, { attrs, emit, slots }) {
4331
- const handleChange = (event) => {
4332
- const target = event.target;
4333
- emit('change', event);
4334
- emit('update:modelValue', target.checked);
5960
+ setup(props, { emit, slots }) {
5961
+ const date = ref(convertTimeToDate(props.time));
5962
+ const initialDate = ref(null);
5963
+ const ampm = ref(date.value ? getAmPm(new Date(date.value), props.locale) : 'am');
5964
+ watch(() => props.time, () => {
5965
+ date.value = convertTimeToDate(props.time);
5966
+ });
5967
+ watch(date, () => {
5968
+ if (date.value) {
5969
+ ampm.value = getAmPm(new Date(date.value), props.locale);
5970
+ }
5971
+ });
5972
+ const handleClear = (event) => {
5973
+ event.stopPropagation();
5974
+ date.value = null;
5975
+ };
5976
+ const handleTimeChange = (set, value) => {
5977
+ const _date = date.value || new Date('1970-01-01');
5978
+ if (set === 'toggle') {
5979
+ if (value === 'am') {
5980
+ _date.setHours(_date.getHours() - 12);
5981
+ }
5982
+ if (value === 'pm') {
5983
+ _date.setHours(_date.getHours() + 12);
5984
+ }
5985
+ }
5986
+ if (set === 'hours') {
5987
+ if (isAmPm(props.locale)) {
5988
+ _date.setHours(convert12hTo24h(ampm.value, parseInt(value)));
5989
+ }
5990
+ else {
5991
+ _date.setHours(parseInt(value));
5992
+ }
5993
+ }
5994
+ if (set === 'minutes') {
5995
+ _date.setMinutes(parseInt(value));
5996
+ }
5997
+ if (set === 'seconds') {
5998
+ _date.setSeconds(parseInt(value));
5999
+ }
6000
+ date.value = new Date(_date);
6001
+ emit('change', _date.toTimeString(), _date.toLocaleTimeString(), _date);
4335
6002
  };
4336
- const formControl = () => {
4337
- return h$1('input', {
4338
- checked: props.modelValue,
6003
+ const InputGroup = () => h$1(CInputGroup, { class: 'picker-input-group', size: props.size }, () => [
6004
+ h$1(CFormInput, {
6005
+ disabled: props.disabled,
6006
+ onInput: (event) => {
6007
+ if (isValidTime(event.target.value)) {
6008
+ date.value = convertTimeToDate(event.target.value);
6009
+ }
6010
+ },
6011
+ placeholder: props.placeholder,
6012
+ readonly: props.inputReadOnly,
6013
+ value: date.value ? date.value.toLocaleTimeString(props.locale) : '',
6014
+ }),
6015
+ (props.indicator || props.cleaner) &&
6016
+ h$1(CInputGroupText, {}, () => [
6017
+ props.indicator &&
6018
+ h$1('span', {
6019
+ class: 'picker-input-group-indicator',
6020
+ }, slots.indicator
6021
+ ? slots.indicator()
6022
+ : h$1('span', { class: 'picker-input-group-icon time-picker-input-icon' })),
6023
+ props.cleaner &&
6024
+ h$1('span', {
6025
+ class: 'picker-input-group-cleaner',
6026
+ onClick: (event) => handleClear(event),
6027
+ role: 'button',
6028
+ }, slots.cleaner
6029
+ ? slots.cleaner()
6030
+ : h$1('span', { class: 'picker-input-group-icon time-picker-cleaner-icon' })),
6031
+ ]),
6032
+ ]);
6033
+ const TimePickerSelect = () => [
6034
+ h$1('span', { class: 'time-picker-inline-icon' }),
6035
+ h$1(CFormSelect, {
6036
+ disabled: props.disabled,
6037
+ options: getListOfHours(props.locale).map((option) => {
6038
+ return {
6039
+ value: option.value.toString(),
6040
+ label: option.label,
6041
+ };
6042
+ }),
6043
+ onChange: (event) => handleTimeChange('hours', event.target.value),
6044
+ ...(date.value && { value: getSelectedHour(date.value, props.locale) }),
6045
+ }),
6046
+ ':',
6047
+ h$1(CFormSelect, {
6048
+ disabled: props.disabled,
6049
+ options: Array.from({ length: 60 }, (_, i) => {
6050
+ return {
6051
+ value: i.toString(),
6052
+ label: i.toLocaleString(props.locale).padStart(2, (0).toLocaleString(props.locale)),
6053
+ };
6054
+ }),
6055
+ onChange: (event) => handleTimeChange('minutes', event.target.value),
6056
+ ...(date.value && { value: getSelectedMinutes(date.value) }),
6057
+ }),
6058
+ ':',
6059
+ h$1(CFormSelect, {
6060
+ disabled: props.disabled,
6061
+ options: Array.from({ length: 60 }, (_, i) => {
6062
+ return {
6063
+ value: i.toString(),
6064
+ label: i.toLocaleString(props.locale).padStart(2, (0).toLocaleString(props.locale)),
6065
+ };
6066
+ }),
6067
+ onChange: (event) => handleTimeChange('seconds', event.target.value),
6068
+ ...(date.value && { value: getSelectedSeconds(date.value) }),
6069
+ }),
6070
+ isAmPm(props.locale) &&
6071
+ h$1(CFormSelect, {
6072
+ disabled: props.disabled,
6073
+ options: [
6074
+ { value: 'am', label: 'AM' },
6075
+ { value: 'pm', label: 'PM' },
6076
+ ],
6077
+ onChange: (event) => handleTimeChange('toggle', event.target.value),
6078
+ value: ampm.value,
6079
+ }),
6080
+ ];
6081
+ const TimePickerRoll = () => [
6082
+ h$1(CTimePickerRollCol, {
6083
+ elements: getListOfHours(props.locale),
6084
+ onClick: (index) => handleTimeChange('hours', index.toString()),
6085
+ selected: getSelectedHour(date.value, props.locale),
6086
+ }),
6087
+ h$1(CTimePickerRollCol, {
6088
+ elements: getMinutesOrSeconds(props.locale),
6089
+ onClick: (index) => handleTimeChange('minutes', index.toString()),
6090
+ selected: getSelectedMinutes(date.value),
6091
+ }),
6092
+ h$1(CTimePickerRollCol, {
6093
+ elements: getMinutesOrSeconds(props.locale),
6094
+ onClick: (index) => handleTimeChange('seconds', index.toString()),
6095
+ selected: getSelectedSeconds(date.value),
6096
+ }),
6097
+ isAmPm(props.locale) &&
6098
+ h$1(CTimePickerRollCol, {
6099
+ elements: [
6100
+ { value: 'am', label: 'AM' },
6101
+ { value: 'pm', label: 'PM' },
6102
+ ],
6103
+ onClick: (value) => handleTimeChange('toggle', value),
6104
+ selected: ampm.value,
6105
+ }),
6106
+ ];
6107
+ return () => h$1(CPicker, {
6108
+ cancelButton: props.cancelButton,
6109
+ cancelButtonColor: props.cancelButtonColor,
6110
+ cancelButtonSize: props.cancelButtonSize,
6111
+ cancelButtonVariant: props.cancelButtonVariant,
6112
+ class: 'time-picker',
6113
+ confirmButton: props.confirmButton,
6114
+ confirmButtonColor: props.confirmButtonColor,
6115
+ confirmButtonSize: props.confirmButtonSize,
6116
+ confirmButtonVariant: props.confirmButtonVariant,
6117
+ container: props.container,
6118
+ disabled: props.disabled,
6119
+ footer: true,
6120
+ onCancel: () => {
6121
+ if (initialDate.value) {
6122
+ date.value = new Date(initialDate.value);
6123
+ }
6124
+ },
6125
+ onHide: () => {
6126
+ emit('hide');
6127
+ },
6128
+ onShow: () => {
6129
+ if (date.value) {
6130
+ initialDate.value = new Date(date.value);
6131
+ }
6132
+ emit('show');
6133
+ },
6134
+ }, {
6135
+ ...(slots.cancelButton && {
6136
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
6137
+ }),
6138
+ ...(slots.confirmButton && {
6139
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
6140
+ }),
6141
+ toggler: () => InputGroup(),
6142
+ default: () => h$1('div', {
4339
6143
  class: [
4340
- props.button ? 'btn-check' : 'form-check-input',
6144
+ 'time-picker-body',
4341
6145
  {
4342
- 'is-invalid': props.invalid,
4343
- 'is-valid': props.valid,
6146
+ ['time-picker-roll']: props.variant === 'roll',
4344
6147
  },
4345
6148
  ],
4346
- id: props.id,
4347
- indeterminate: props.indeterminate,
4348
- onChange: (event) => handleChange(event),
4349
- type: props.type,
4350
- ...attrs,
4351
- });
4352
- };
4353
- const formLabel = () => {
4354
- return h$1(CFormLabel, {
4355
- customClassName: props.button
4356
- ? [
4357
- 'btn',
4358
- props.button.variant
4359
- ? `btn-${props.button.variant}-${props.button.color}`
4360
- : `btn-${props.button.color}`,
4361
- {
4362
- [`btn-${props.button.size}`]: props.button.size,
4363
- },
4364
- `${props.button.shape}`,
4365
- ]
4366
- : 'form-check-label',
4367
- ...(props.id && { for: props.id }),
4368
- }, {
4369
- default: () => (slots.label && slots.label()) || props.label,
4370
- });
4371
- };
4372
- return () => props.button
4373
- ? [formControl(), (slots.label || props.label) && formLabel()]
4374
- : props.label
4375
- ? h$1('div', {
4376
- class: [
4377
- 'form-check',
4378
- {
4379
- 'form-check-inline': props.inline,
4380
- 'is-invalid': props.invalid,
4381
- 'is-valid': props.valid,
4382
- },
4383
- ],
4384
- }, [formControl(), props.label && formLabel()])
4385
- : formControl();
6149
+ }, props.variant === 'select' ? TimePickerSelect() : TimePickerRoll()),
6150
+ });
4386
6151
  },
4387
6152
  });
4388
6153
 
4389
- const CFormFeedback = defineComponent({
4390
- name: 'CFormFeedback',
6154
+ const CTimePickerPlugin = {
6155
+ install: (app) => {
6156
+ app.component(CTimePicker.name, CTimePicker);
6157
+ },
6158
+ };
6159
+
6160
+ const CDateRangePicker = defineComponent({
6161
+ name: 'CDateRangePicker',
4391
6162
  props: {
4392
6163
  /**
4393
- * Component used for the root node. Either a string to use a HTML element or a component.
6164
+ * The number of calendars that render on desktop devices.
4394
6165
  */
4395
- component: {
6166
+ calendars: {
6167
+ type: Number,
6168
+ default: 2,
6169
+ },
6170
+ /**
6171
+ * Default date of the component
6172
+ */
6173
+ calendarDate: {
6174
+ type: [Date, String],
6175
+ },
6176
+ /**
6177
+ * Toggle visibility or set the content of cancel button.
6178
+ */
6179
+ cancelButton: {
6180
+ type: [Boolean, String],
6181
+ default: 'Cancel',
6182
+ },
6183
+ /**
6184
+ * Sets the color context of the cancel button to one of CoreUI’s themed colors.
6185
+ *
6186
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
6187
+ */
6188
+ cancelButtonColor: {
6189
+ ...Color,
6190
+ default: 'primary',
6191
+ },
6192
+ /**
6193
+ * Size the cancel button small or large.
6194
+ *
6195
+ * @values 'sm', 'lg'
6196
+ */
6197
+ cancelButtonSize: {
4396
6198
  type: String,
4397
- required: false,
4398
- default: 'div',
6199
+ default: 'sm',
6200
+ validator: (value) => {
6201
+ return ['sm', 'lg'].includes(value);
6202
+ },
4399
6203
  },
4400
6204
  /**
4401
- * Method called immediately after the `value` prop changes.
6205
+ * Set the cancel button variant to an outlined button or a ghost button.
6206
+ *
6207
+ * @values 'ghost', 'outline'
4402
6208
  */
4403
- invalid: Boolean,
6209
+ cancelButtonVariant: {
6210
+ type: String,
6211
+ default: 'ghost',
6212
+ validator: (value) => {
6213
+ return ['ghost', 'outline'].includes(value);
6214
+ },
6215
+ },
4404
6216
  /**
4405
- * If your form layout allows it, you can display validation feedback in a styled tooltip.
6217
+ * Toggle visibility of the cleaner button.
4406
6218
  */
4407
- tooltip: Boolean,
6219
+ cleaner: {
6220
+ type: Boolean,
6221
+ default: true,
6222
+ },
4408
6223
  /**
4409
- * Set component validation state to valid.
6224
+ * Toggle visibility or set the content of confirm button.
4410
6225
  */
4411
- valid: Boolean,
4412
- },
4413
- setup(props, { slots }) {
4414
- return () => h$1(props.component, {
4415
- class: [
4416
- {
4417
- [`invalid-${props.tooltip ? 'tooltip' : 'feedback'}`]: props.invalid,
4418
- [`valid-${props.tooltip ? 'tooltip' : 'feedback'}`]: props.valid,
4419
- },
4420
- ],
4421
- }, slots.default && slots.default());
4422
- },
4423
- });
4424
-
4425
- const CFormFloating = defineComponent({
4426
- name: 'CFormFloating',
4427
- setup(_, { slots }) {
4428
- return () => h$1('div', {
4429
- class: 'form-floating',
4430
- }, slots.default && slots.default());
4431
- },
4432
- });
4433
-
4434
- const CFormInput = defineComponent({
4435
- name: 'CFormInput',
4436
- props: {
6226
+ confirmButton: {
6227
+ type: [Boolean, String],
6228
+ default: 'OK',
6229
+ },
6230
+ /**
6231
+ * Sets the color context of the confirm button to one of CoreUI’s themed colors.
6232
+ *
6233
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
6234
+ */
6235
+ confirmButtonColor: {
6236
+ ...Color,
6237
+ default: 'primary',
6238
+ },
6239
+ /**
6240
+ * Size the confirm button small or large.
6241
+ *
6242
+ * @values 'sm', 'lg'
6243
+ */
6244
+ confirmButtonSize: {
6245
+ type: String,
6246
+ default: 'sm',
6247
+ validator: (value) => {
6248
+ return ['sm', 'lg'].includes(value);
6249
+ },
6250
+ },
6251
+ /**
6252
+ * Set the confirm button variant to an outlined button or a ghost button.
6253
+ *
6254
+ * @values 'ghost', 'outline'
6255
+ */
6256
+ confirmButtonVariant: {
6257
+ type: String,
6258
+ validator: (value) => {
6259
+ return ['ghost', 'outline'].includes(value);
6260
+ },
6261
+ },
4437
6262
  /**
4438
6263
  * Toggle the disabled state for the component.
4439
6264
  */
4440
- disabled: {
4441
- type: Boolean,
4442
- required: false,
6265
+ disabled: Boolean,
6266
+ /**
6267
+ * Specify the list of dates that cannot be selected.
6268
+ */
6269
+ disabledDates: {
6270
+ type: Array,
4443
6271
  },
4444
6272
  /**
4445
- * Set component validation state to invalid.
6273
+ * Initial selected to date (range).
4446
6274
  */
4447
- invalid: {
4448
- type: Boolean,
6275
+ endDate: {
6276
+ type: [Date, String],
4449
6277
  required: false,
4450
6278
  },
4451
6279
  /**
4452
- * The default name for a value passed using v-model.
6280
+ * Sets the day of start week.
6281
+ * - 0 - Sunday,
6282
+ * - 1 - Monday,
6283
+ * - 2 - Tuesday,
6284
+ * - 3 - Wednesday,
6285
+ * - 4 - Thursday,
6286
+ * - 5 - Friday,
6287
+ * - 6 - Saturday,
6288
+ * - 7 - Sunday
4453
6289
  */
4454
- modelValue: {
4455
- type: String,
4456
- default: undefined,
4457
- require: false,
6290
+ firstDayOfWeek: {
6291
+ type: Number,
6292
+ default: 1,
4458
6293
  },
4459
6294
  /**
4460
- * Render the component styled as plain text. Removes the default form field styling and preserve the correct margin and padding. Recommend to use only along side `readonly`.
6295
+ * Toggle visibility of footer element or set the content of footer.
4461
6296
  */
4462
- plainText: {
4463
- type: Boolean,
4464
- required: false,
4465
- },
6297
+ footer: Boolean,
4466
6298
  /**
4467
- * Toggle the readonly state for the component.
6299
+ * Toggle visibility or set the content of the input indicator.
4468
6300
  */
4469
- readonly: {
6301
+ indicator: {
4470
6302
  type: Boolean,
4471
- required: false,
6303
+ default: true,
4472
6304
  },
4473
6305
  /**
4474
- * Size the component small or large.
4475
- *
4476
- * @values 'sm' | 'lg'
6306
+ * Toggle the readonly state for the component.
4477
6307
  */
4478
- size: {
4479
- type: String,
4480
- default: undefined,
4481
- require: false,
4482
- validator: (value) => {
4483
- return ['sm', 'lg'].includes(value);
4484
- },
4485
- },
6308
+ inputReadOnly: Boolean,
4486
6309
  /**
4487
- * Specifies the type of component.
4488
- *
4489
- * @values 'color' | 'file' | 'text' | string
6310
+ * Sets the default locale for components. If not set, it is inherited from the navigator.language.
4490
6311
  */
4491
- type: {
6312
+ locale: {
4492
6313
  type: String,
4493
- default: 'text',
4494
- require: false,
6314
+ default: 'default',
4495
6315
  },
4496
6316
  /**
4497
- * Set component validation state to valid.
6317
+ * Max selectable date.
4498
6318
  */
4499
- valid: {
4500
- type: Boolean,
4501
- required: false,
6319
+ maxDate: {
6320
+ type: [Date, String],
4502
6321
  },
4503
- },
4504
- emits: [
4505
6322
  /**
4506
- * Event occurs when the element loses focus, after the content has been changed.
6323
+ * Min selectable date.
4507
6324
  */
4508
- 'change',
6325
+ minDate: {
6326
+ type: [Date, String],
6327
+ },
4509
6328
  /**
4510
- * Event occurs immediately after the value of a component has changed.
6329
+ * Show arrows navigation.
4511
6330
  */
4512
- 'input',
6331
+ navigation: {
6332
+ type: Boolean,
6333
+ default: true,
6334
+ },
4513
6335
  /**
4514
- * Emit the new value whenever there’s an input or change event.
6336
+ * Specifies a short hint that is visible in the input.
4515
6337
  */
4516
- 'update:modelValue',
4517
- ],
4518
- setup(props, { emit, slots }) {
4519
- const handleChange = (event) => {
4520
- const target = event.target;
4521
- emit('change', event);
4522
- emit('update:modelValue', target.value);
4523
- };
4524
- const handleInput = (event) => {
4525
- const target = event.target;
4526
- emit('input', event);
4527
- emit('update:modelValue', target.value);
4528
- };
4529
- return () => h$1('input', {
4530
- class: [
4531
- props.plainText ? 'form-control-plaintext' : 'form-control',
4532
- {
4533
- 'form-control-color': props.type === 'color',
4534
- [`form-control-${props.size}`]: props.size,
4535
- 'is-invalid': props.invalid,
4536
- 'is-valid': props.valid,
4537
- },
4538
- ],
4539
- disabled: props.disabled,
4540
- onChange: (event) => handleChange(event),
4541
- onInput: (event) => handleInput(event),
4542
- readonly: props.readonly,
4543
- type: props.type,
4544
- value: props.modelValue,
4545
- }, slots.default && slots.default());
4546
- },
4547
- });
4548
-
4549
- const CFormRange = defineComponent({
4550
- name: 'CFormRange',
4551
- props: {
6338
+ placeholder: {
6339
+ type: [String, Array],
6340
+ default: () => ['Start date', 'End date'],
6341
+ },
4552
6342
  /**
4553
- * Toggle the disabled state for the component.
6343
+ * @ignore
4554
6344
  */
4555
- disabled: {
6345
+ range: {
4556
6346
  type: Boolean,
4557
- default: undefined,
4558
- required: false,
6347
+ default: true,
4559
6348
  },
4560
6349
  /**
4561
- * Specifies the maximum value for the component.
6350
+ * Predefined date ranges the user can select from.
4562
6351
  */
4563
- max: {
4564
- type: Number,
4565
- default: undefined,
4566
- required: false,
4567
- },
6352
+ ranges: Object,
4568
6353
  /**
4569
- * Specifies the minimum value for the component.
6354
+ * Toggle select mode between start and end date.
4570
6355
  */
4571
- min: {
4572
- type: Number,
4573
- default: undefined,
4574
- required: false,
6356
+ selectEndDate: Boolean,
6357
+ /**
6358
+ * Default icon or character character that separates two dates.
6359
+ */
6360
+ separator: {
6361
+ type: Boolean,
6362
+ default: true,
4575
6363
  },
4576
6364
  /**
4577
- * The default name for a value passed using v-model.
6365
+ * Size the component small or large.
6366
+ *
6367
+ * @values 'sm', 'lg'
4578
6368
  */
4579
- modelValue: {
6369
+ size: {
4580
6370
  type: String,
4581
- value: undefined,
4582
6371
  required: false,
6372
+ validator: (value) => {
6373
+ return ['sm', 'lg'].includes(value);
6374
+ },
4583
6375
  },
4584
6376
  /**
4585
- * Toggle the readonly state for the component.
6377
+ * Initial selected date.
4586
6378
  */
4587
- readonly: {
4588
- type: Boolean,
4589
- required: false,
6379
+ startDate: {
6380
+ type: [Date, String],
4590
6381
  },
4591
6382
  /**
4592
- * Specifies the interval between legal numbers in the component.
6383
+ * Provide an additional time selection by adding select boxes to choose times.
4593
6384
  */
4594
- steps: {
4595
- type: Number,
4596
- default: undefined,
4597
- required: false,
4598
- },
6385
+ timepicker: Boolean,
4599
6386
  /**
4600
- * The `value` attribute of component.
6387
+ * Set length or format of day name.
4601
6388
  *
4602
- * @controllable onChange
4603
- * */
4604
- value: {
4605
- type: Number,
4606
- default: undefined,
4607
- required: false,
6389
+ * @type number | 'long' | 'narrow' | 'short'
6390
+ */
6391
+ weekdayFormat: {
6392
+ type: [Number, String],
6393
+ default: 2,
6394
+ validator: (value) => {
6395
+ if (typeof value === 'string') {
6396
+ return ['long', 'narrow', 'short'].includes(value);
6397
+ }
6398
+ if (typeof value === 'number') {
6399
+ return true;
6400
+ }
6401
+ return false;
6402
+ },
4608
6403
  },
4609
6404
  },
4610
- emits: [
6405
+ emit: [
4611
6406
  /**
4612
- * Event occurs when the value has been changed.
6407
+ * Callback fired when the end date changed.
4613
6408
  */
4614
- 'change',
6409
+ 'end-date-change',
4615
6410
  /**
4616
- * Emit the new value whenever there’s a change event.
6411
+ * Callback fired when the component requests to be hidden.
4617
6412
  */
4618
- 'update:modelValue',
6413
+ 'hide',
6414
+ /**
6415
+ * Callback fired when the component requests to be shown.
6416
+ */
6417
+ 'show',
6418
+ /**
6419
+ * Callback fired when the start date changed.
6420
+ */
6421
+ 'start-date-change',
4619
6422
  ],
4620
- setup(props, { emit, slots }) {
4621
- const handleChange = (event) => {
4622
- const target = event.target;
4623
- emit('change', event);
4624
- emit('update:modelValue', target.value);
6423
+ setup(props, { slots, emit }) {
6424
+ const calendarDate = ref(props.calendarDate
6425
+ ? new Date(props.calendarDate)
6426
+ : props.startDate
6427
+ ? new Date(props.startDate)
6428
+ : props.endDate
6429
+ ? new Date(props.endDate)
6430
+ : new Date());
6431
+ const inputStartHoverValue = ref(null);
6432
+ const inputEndHoverValue = ref(null);
6433
+ const startDate = ref(props.startDate ? new Date(props.startDate) : null);
6434
+ const endDate = ref(props.endDate ? new Date(props.endDate) : null);
6435
+ const initialStartDate = ref(startDate.value ? new Date(startDate.value) : null);
6436
+ const initialEndDate = ref(endDate.value ? new Date(endDate.value) : null);
6437
+ const selectEndDate = ref(false);
6438
+ const isMobile = ref(false);
6439
+ onMounted(() => {
6440
+ isMobile.value = window.innerWidth < 768;
6441
+ });
6442
+ watch(() => props.startDate, () => {
6443
+ if (props.startDate) {
6444
+ calendarDate.value = new Date(props.startDate);
6445
+ }
6446
+ });
6447
+ watch(() => props.endDate, () => {
6448
+ if (props.endDate) {
6449
+ calendarDate.value = new Date(props.endDate);
6450
+ }
6451
+ });
6452
+ const setInputValue = (date, timepicker) => {
6453
+ if (date) {
6454
+ return timepicker
6455
+ ? date.toLocaleString(props.locale)
6456
+ : date.toLocaleDateString(props.locale);
6457
+ }
6458
+ return '';
4625
6459
  };
4626
- return () => h$1('input', {
4627
- class: 'form-range',
6460
+ const handleCalendarCellHover = (date) => {
6461
+ if (selectEndDate.value) {
6462
+ inputEndHoverValue.value = date === null ? null : date;
6463
+ return;
6464
+ }
6465
+ inputStartHoverValue.value = date === null ? null : date;
6466
+ };
6467
+ const handleCalendarDateChange = (date, difference) => {
6468
+ if (difference) {
6469
+ calendarDate.value = new Date(date.getFullYear(), date.getMonth() - difference, 1);
6470
+ return;
6471
+ }
6472
+ calendarDate.value = date;
6473
+ };
6474
+ const handleStartDateChange = (date) => {
6475
+ startDate.value = date;
6476
+ inputStartHoverValue.value = null;
6477
+ if (props.range) {
6478
+ selectEndDate.value = true;
6479
+ }
6480
+ emit('start-date-change', date);
6481
+ };
6482
+ const handleEndDateChange = (date) => {
6483
+ endDate.value = date;
6484
+ inputEndHoverValue.value = null;
6485
+ if (props.range) {
6486
+ selectEndDate.value = false;
6487
+ }
6488
+ emit('end-date-change', date);
6489
+ };
6490
+ const handleClear = (event) => {
6491
+ event.stopPropagation();
6492
+ startDate.value = null;
6493
+ endDate.value = null;
6494
+ inputStartHoverValue.value = null;
6495
+ inputEndHoverValue.value = null;
6496
+ };
6497
+ const InputGroup = () => h$1(CInputGroup, {
6498
+ class: 'picker-input-group',
6499
+ size: props.size,
6500
+ }, () => [
6501
+ h$1(CFormInput, {
6502
+ class: {
6503
+ hover: inputStartHoverValue.value,
6504
+ },
6505
+ disabled: props.disabled,
6506
+ onClick: () => {
6507
+ selectEndDate.value = false;
6508
+ },
6509
+ onInput: (event) => {
6510
+ if (isValidDate(event.target.value)) {
6511
+ calendarDate.value = new Date(event.target.value);
6512
+ startDate.value = new Date(event.target.value);
6513
+ }
6514
+ },
6515
+ placeholder: Array.isArray(props.placeholder)
6516
+ ? props.placeholder[0]
6517
+ : props.placeholder,
6518
+ readonly: props.inputReadOnly,
6519
+ value: inputStartHoverValue.value
6520
+ ? setInputValue(inputStartHoverValue.value, props.timepicker)
6521
+ : setInputValue(startDate.value, props.timepicker),
6522
+ }),
6523
+ props.range &&
6524
+ props.separator !== false &&
6525
+ h$1(CInputGroupText, {}, () => slots.separator
6526
+ ? slots.separator()
6527
+ : h$1('span', { class: 'picker-input-group-icon date-picker-arrow-icon' })),
6528
+ props.range &&
6529
+ h$1(CFormInput, {
6530
+ class: {
6531
+ hover: inputEndHoverValue.value,
6532
+ },
6533
+ disabled: props.disabled,
6534
+ onClick: () => {
6535
+ selectEndDate.value = true;
6536
+ },
6537
+ onInput: (event) => {
6538
+ if (isValidDate(event.target.value)) {
6539
+ calendarDate.value = new Date(event.target.value);
6540
+ endDate.value = new Date(event.target.value);
6541
+ }
6542
+ },
6543
+ placeholder: props.placeholder[1],
6544
+ readonly: props.inputReadOnly,
6545
+ value: inputEndHoverValue.value
6546
+ ? setInputValue(inputEndHoverValue.value, props.timepicker)
6547
+ : setInputValue(endDate.value, props.timepicker),
6548
+ }),
6549
+ (props.indicator || props.cleaner) &&
6550
+ h$1(CInputGroupText, {}, () => [
6551
+ props.indicator &&
6552
+ h$1('span', {
6553
+ class: 'picker-input-group-indicator',
6554
+ }, slots.indicator
6555
+ ? slots.indicator()
6556
+ : h$1('span', { class: 'picker-input-group-icon date-picker-input-icon' })),
6557
+ props.cleaner &&
6558
+ h$1('span', {
6559
+ class: 'picker-input-group-cleaner',
6560
+ onClick: (event) => handleClear(event),
6561
+ role: 'button',
6562
+ }, slots.cleaner
6563
+ ? slots.cleaner()
6564
+ : h$1('span', { class: 'picker-input-group-icon date-picker-cleaner-icon' })),
6565
+ ]),
6566
+ ]);
6567
+ return () => h$1(CPicker, {
6568
+ cancelButton: props.cancelButton,
6569
+ cancelButtonColor: props.cancelButtonColor,
6570
+ cancelButtonSize: props.cancelButtonSize,
6571
+ cancelButtonVariant: props.cancelButtonVariant,
6572
+ class: 'date-picker',
6573
+ confirmButton: props.confirmButton,
6574
+ confirmButtonColor: props.confirmButtonColor,
6575
+ confirmButtonSize: props.confirmButtonSize,
6576
+ confirmButtonVariant: props.confirmButtonVariant,
4628
6577
  disabled: props.disabled,
4629
- max: props.max,
4630
- min: props.min,
4631
- onChange: (event) => handleChange(event),
4632
- steps: props.steps,
4633
- readonly: props.readonly,
4634
- type: 'range',
4635
- value: props.modelValue,
4636
- }, slots.default && slots.default());
6578
+ footer: props.footer || props.timepicker,
6579
+ onCancel: () => {
6580
+ startDate.value = initialStartDate.value;
6581
+ endDate.value = initialEndDate.value;
6582
+ },
6583
+ onHide: () => {
6584
+ emit('hide');
6585
+ },
6586
+ onShow: () => {
6587
+ if (startDate.value) {
6588
+ initialStartDate.value = new Date(startDate.value);
6589
+ }
6590
+ if (endDate.value) {
6591
+ initialEndDate.value = new Date(endDate.value);
6592
+ }
6593
+ emit('show');
6594
+ },
6595
+ }, {
6596
+ ...(slots.cancelButton && {
6597
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
6598
+ }),
6599
+ ...(slots.confirmButton && {
6600
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
6601
+ }),
6602
+ toggler: () => InputGroup(),
6603
+ default: () => h$1('div', {
6604
+ class: 'date-picker-body',
6605
+ }, [
6606
+ props.ranges &&
6607
+ h$1('div', { class: 'date-picker-ranges' }, Object.keys(props.ranges).map((key) => h$1(CButton, {
6608
+ color: 'secondary',
6609
+ onClick: () => {
6610
+ if (props.ranges) {
6611
+ startDate.value = props.ranges[key][0];
6612
+ endDate.value = props.ranges[key][1];
6613
+ }
6614
+ },
6615
+ variant: 'ghost',
6616
+ }, () => key))),
6617
+ h$1('div', { class: 'date-picker-calendars' }, [...Array(isMobile.value ? 1 : props.calendars)].map((_, index) => h$1('div', { class: 'date-picker-calendar' }, [
6618
+ h$1(CCalendar, {
6619
+ calendarDate: new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth() + index, 1),
6620
+ disabledDates: props.disabledDates,
6621
+ ...(endDate.value && { endDate: endDate.value }),
6622
+ firstDayOfWeek: props.firstDayOfWeek,
6623
+ locale: props.locale,
6624
+ maxDate: props.maxDate,
6625
+ minDate: props.minDate,
6626
+ navigation: props.navigation,
6627
+ range: true,
6628
+ selectEndDate: selectEndDate.value,
6629
+ ...(startDate.value && { startDate: startDate.value }),
6630
+ onCalendarCellHover: (date) => handleCalendarCellHover(date),
6631
+ onCalendarDateChange: (date) => handleCalendarDateChange(date, index),
6632
+ onStartDateChange: (date) => handleStartDateChange(date),
6633
+ onEndDateChange: (date) => handleEndDateChange(date),
6634
+ }, {
6635
+ /**
6636
+ * @slot Location for next icon.
6637
+ */
6638
+ ...(slots.navNextIcon && {
6639
+ navNextIcon: () => slots.navNextIcon && slots.navNextIcon(),
6640
+ }),
6641
+ /**
6642
+ * @slot Location for next double icon.
6643
+ */
6644
+ ...(slots.navNextDoubleIcon && {
6645
+ navNextDoubleIcon: () => slots.navNextDoubleIcon && slots.navNextDoubleIcon(),
6646
+ }),
6647
+ /**
6648
+ * @slot Location for previous icon.
6649
+ */
6650
+ ...(slots.navPrevIcon && {
6651
+ navPrevIcon: () => slots.navPrevIcon && slots.navPrevIcon(),
6652
+ }),
6653
+ /**
6654
+ * @slot Location for double previous icon.
6655
+ */
6656
+ ...(slots.navPrevDoubleIcon && {
6657
+ navPrevDoubleIcon: () => slots.navPrevDoubleIcon && slots.navPrevDoubleIcon(),
6658
+ }),
6659
+ }),
6660
+ !isMobile.value &&
6661
+ props.timepicker &&
6662
+ (index === 0 || props.calendars - index === 1) &&
6663
+ h$1(CTimePicker, {
6664
+ container: 'inline',
6665
+ disabled: index === 0
6666
+ ? startDate.value === null
6667
+ ? true
6668
+ : false
6669
+ : endDate.value === null
6670
+ ? true
6671
+ : false,
6672
+ locale: props.locale,
6673
+ onChange: (_, __, date) => index === 0 ? handleStartDateChange(date) : handleEndDateChange(date),
6674
+ time: index === 0 ? startDate.value : endDate.value,
6675
+ variant: 'select',
6676
+ }),
6677
+ isMobile.value &&
6678
+ props.timepicker && [
6679
+ h$1(CTimePicker, {
6680
+ container: 'inline',
6681
+ disabled: startDate.value === null ? true : false,
6682
+ locale: props.locale,
6683
+ onChange: (_, __, date) => handleStartDateChange(date),
6684
+ time: startDate.value,
6685
+ variant: 'select',
6686
+ }),
6687
+ h$1(CTimePicker, {
6688
+ container: 'inline',
6689
+ disabled: endDate.value === null ? true : false,
6690
+ locale: props.locale,
6691
+ onChange: (_, __, date) => handleEndDateChange(date),
6692
+ time: endDate.value,
6693
+ variant: 'select',
6694
+ }),
6695
+ ],
6696
+ ]))),
6697
+ ]),
6698
+ });
4637
6699
  },
4638
6700
  });
4639
6701
 
4640
- const CFormSelect = defineComponent({
4641
- name: 'CFormSelect',
6702
+ const CDateRangePickerPlugin = {
6703
+ install: (app) => {
6704
+ app.component(CDateRangePicker.name, CDateRangePicker);
6705
+ },
6706
+ };
6707
+
6708
+ const CDatePicker = defineComponent({
6709
+ name: 'CDatePicker',
4642
6710
  props: {
4643
6711
  /**
4644
- * Specifies the number of visible options in a drop-down list.
6712
+ * Default date of the component
6713
+ */
6714
+ calendarDate: {
6715
+ type: [Date, String],
6716
+ },
6717
+ /**
6718
+ * Toggle visibility or set the content of cancel button.
6719
+ */
6720
+ cancelButton: {
6721
+ type: [Boolean, String],
6722
+ default: 'Cancel',
6723
+ },
6724
+ /**
6725
+ * Sets the color context of the cancel button to one of CoreUI’s themed colors.
6726
+ *
6727
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4645
6728
  */
4646
- htmlSize: {
4647
- type: Number,
4648
- default: undefined,
4649
- required: false,
6729
+ cancelButtonColor: {
6730
+ ...Color,
6731
+ default: 'primary',
4650
6732
  },
4651
6733
  /**
4652
- * Set component validation state to invalid.
6734
+ * Size the cancel button small or large.
6735
+ *
6736
+ * @values 'sm', 'lg'
4653
6737
  */
4654
- invalid: {
4655
- type: Boolean,
4656
- required: false,
6738
+ cancelButtonSize: {
6739
+ type: String,
6740
+ default: 'sm',
6741
+ validator: (value) => {
6742
+ return ['sm', 'lg'].includes(value);
6743
+ },
4657
6744
  },
4658
6745
  /**
4659
- * The default name for a value passed using v-model.
6746
+ * Set the cancel button variant to an outlined button or a ghost button.
6747
+ *
6748
+ * @values 'ghost', 'outline'
4660
6749
  */
4661
- modelValue: {
4662
- type: [String, Array],
4663
- default: undefined,
4664
- require: false,
6750
+ cancelButtonVariant: {
6751
+ type: String,
6752
+ default: 'ghost',
6753
+ validator: (value) => {
6754
+ return ['ghost', 'outline'].includes(value);
6755
+ },
4665
6756
  },
4666
- multiple: {
6757
+ /**
6758
+ * Toggle visibility of the cleaner button.
6759
+ */
6760
+ cleaner: {
4667
6761
  type: Boolean,
4668
- required: false,
6762
+ default: true,
4669
6763
  },
4670
6764
  /**
4671
- * Options list of the select component. Available keys: `label`, `value`, `disabled`.
4672
- * Examples:
4673
- * - `:options="[{ value: 'js', label: 'JavaScript' }, { value: 'html', label: 'HTML', disabled: true }]"`
4674
- * - `:options="['js', 'html']"`
6765
+ * Toggle visibility or set the content of confirm button.
4675
6766
  */
4676
- options: {
4677
- type: Array,
4678
- default: undefined,
4679
- required: false,
6767
+ confirmButton: {
6768
+ type: [Boolean, String],
6769
+ default: 'OK',
4680
6770
  },
4681
6771
  /**
4682
- * Size the component small or large.
6772
+ * Sets the color context of the confirm button to one of CoreUI’s themed colors.
4683
6773
  *
4684
- * @values 'sm' | 'lg'
6774
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4685
6775
  */
4686
- size: {
6776
+ confirmButtonColor: {
6777
+ ...Color,
6778
+ default: 'primary',
6779
+ },
6780
+ /**
6781
+ * Size the confirm button small or large.
6782
+ *
6783
+ * @values 'sm', 'lg'
6784
+ */
6785
+ confirmButtonSize: {
4687
6786
  type: String,
4688
- default: undefined,
4689
- require: false,
6787
+ default: 'sm',
4690
6788
  validator: (value) => {
4691
6789
  return ['sm', 'lg'].includes(value);
4692
6790
  },
4693
6791
  },
4694
6792
  /**
4695
- * Set component validation state to valid.
6793
+ * Set the confirm button variant to an outlined button or a ghost button.
6794
+ *
6795
+ * @values 'ghost', 'outline'
4696
6796
  */
4697
- valid: {
4698
- type: Boolean,
4699
- required: false,
6797
+ confirmButtonVariant: {
6798
+ type: String,
6799
+ validator: (value) => {
6800
+ return ['ghost', 'outline'].includes(value);
6801
+ },
4700
6802
  },
4701
- },
4702
- emits: [
4703
6803
  /**
4704
- * Event occurs when when a user changes the selected option of a `<select>` element.
6804
+ * Toggle the disabled state for the component.
4705
6805
  */
4706
- 'change',
6806
+ disabled: Boolean,
4707
6807
  /**
4708
- * Emit the new value whenever there’s a change event.
6808
+ * Specify the list of dates that cannot be selected.
4709
6809
  */
4710
- 'update:modelValue',
4711
- ],
4712
- setup(props, { emit, slots }) {
4713
- const handleChange = (event) => {
4714
- const target = event.target;
4715
- const selected = Array.from(target.options)
4716
- .filter((option) => option.selected)
4717
- .map((option) => option.value);
4718
- emit('change', event);
4719
- emit('update:modelValue', target.multiple ? selected : selected[0]);
4720
- };
4721
- return () => h$1('select', {
4722
- class: [
4723
- 'form-select',
4724
- {
4725
- [`form-select-${props.size}`]: props.size,
4726
- 'is-invalid': props.invalid,
4727
- 'is-valid': props.valid,
4728
- },
4729
- ],
4730
- multiple: props.multiple,
4731
- onChange: (event) => handleChange(event),
4732
- size: props.htmlSize,
4733
- ...(props.modelValue && !props.multiple && { value: props.modelValue }),
4734
- }, props.options
4735
- ? props.options.map((option) => {
4736
- return h$1('option', {
4737
- ...(typeof option === 'object' && {
4738
- ...(option.disabled && { disabled: option.disabled }),
4739
- ...(option.selected && { selected: option.selected }),
4740
- ...(option.value && {
4741
- value: option.value,
4742
- ...(props.modelValue &&
4743
- props.multiple &&
4744
- props.modelValue.includes(option.value) && { selected: true }),
4745
- }),
4746
- }),
4747
- }, typeof option === 'string' ? option : option.label);
4748
- })
4749
- : slots.default && slots.default());
4750
- },
4751
- });
4752
-
4753
- const CFormSwitch = defineComponent({
4754
- name: 'CFormSwitch',
4755
- inheritAttrs: false,
4756
- props: {
6810
+ disabledDates: {
6811
+ type: Array,
6812
+ },
4757
6813
  /**
4758
- * The id global attribute defines an identifier (ID) that must be unique in the whole document
6814
+ * Initial selected date.
4759
6815
  */
4760
- id: {
4761
- type: String,
4762
- default: undefined,
6816
+ date: {
6817
+ type: [Date, String],
4763
6818
  required: false,
4764
6819
  },
4765
6820
  /**
4766
- * Set component validation state to invalid.
6821
+ * Sets the day of start week.
6822
+ * - 0 - Sunday,
6823
+ * - 1 - Monday,
6824
+ * - 2 - Tuesday,
6825
+ * - 3 - Wednesday,
6826
+ * - 4 - Thursday,
6827
+ * - 5 - Friday,
6828
+ * - 6 - Saturday,
6829
+ * - 7 - Sunday
4767
6830
  */
4768
- invalid: {
4769
- type: Boolean,
4770
- required: false,
6831
+ firstDayOfWeek: {
6832
+ type: Number,
6833
+ default: 1,
4771
6834
  },
4772
6835
  /**
4773
- * The element represents a caption for a component.
6836
+ * Toggle visibility of footer element or set the content of footer.
4774
6837
  */
4775
- label: {
4776
- type: String,
4777
- default: undefined,
4778
- required: false,
4779
- },
6838
+ footer: Boolean,
4780
6839
  /**
4781
- * The default name for a value passed using v-model.
6840
+ * Toggle visibility or set the content of the input indicator.
4782
6841
  */
4783
- modelValue: {
4784
- type: [Boolean, String],
4785
- value: undefined,
4786
- required: false,
6842
+ indicator: {
6843
+ type: Boolean,
6844
+ default: true,
4787
6845
  },
4788
6846
  /**
4789
- * Size the component large or extra large. Works only with `switch`.
4790
- *
4791
- * @values 'lg' | 'xl'
6847
+ * Toggle the readonly state for the component.
4792
6848
  */
4793
- size: {
6849
+ inputReadOnly: Boolean,
6850
+ /**
6851
+ * Sets the default locale for components. If not set, it is inherited from the navigator.language.
6852
+ */
6853
+ locale: {
4794
6854
  type: String,
4795
- default: undefined,
4796
- required: false,
4797
- validator: (value) => {
4798
- return ['lg', 'xl'].includes(value);
4799
- },
6855
+ default: 'default',
4800
6856
  },
4801
6857
  /**
4802
- * Specifies the type of component.
4803
- *
4804
- * @values 'checkbox', 'radio'
6858
+ * Max selectable date.
4805
6859
  */
4806
- type: {
4807
- type: String,
4808
- default: 'checkbox',
4809
- required: false,
6860
+ maxDate: {
6861
+ type: [Date, String],
4810
6862
  },
4811
6863
  /**
4812
- * Set component validation state to valid.
6864
+ * Min selectable date.
4813
6865
  */
4814
- valid: {
4815
- type: Boolean,
4816
- required: false,
6866
+ minDate: {
6867
+ type: [Date, String],
4817
6868
  },
4818
- },
4819
- emits: [
4820
6869
  /**
4821
- * Event occurs when the checked value has been changed.
6870
+ * Show arrows navigation.
4822
6871
  */
4823
- 'change',
6872
+ navigation: {
6873
+ type: Boolean,
6874
+ default: true,
6875
+ },
4824
6876
  /**
4825
- * Emit the new value whenever there’s a change event.
6877
+ * Specifies a short hint that is visible in the input.
4826
6878
  */
4827
- 'update:modelValue',
4828
- ],
4829
- setup(props, { attrs, emit }) {
4830
- const checked = ref(attrs.checked);
4831
- onMounted(() => {
4832
- if (props.modelValue && typeof props.modelValue === 'boolean') {
4833
- console.log(props.modelValue);
4834
- }
4835
- });
4836
- watch(() => props.modelValue, () => {
4837
- if (typeof props.modelValue === 'boolean')
4838
- checked.value = props.modelValue;
4839
- });
4840
- const handleChange = (event) => {
4841
- const target = event.target;
4842
- emit('change', event);
4843
- emit('update:modelValue', target.checked);
4844
- };
4845
- return () => h$1('div', {
4846
- class: [
4847
- 'form-check form-switch',
4848
- {
4849
- [`form-switch-${props.size}`]: props.size,
4850
- 'is-invalid': props.invalid,
4851
- 'is-valid': props.valid,
4852
- },
4853
- ],
4854
- }, [
4855
- h$1('input', {
4856
- ...attrs,
4857
- checked: checked.value,
4858
- class: [
4859
- 'form-check-input',
4860
- {
4861
- 'is-invalid': props.invalid,
4862
- 'is-valid': props.valid,
4863
- },
4864
- ],
4865
- id: props.id,
4866
- onChange: (event) => handleChange(event),
4867
- type: props.type,
4868
- }),
4869
- props.label &&
4870
- h$1(CFormLabel, {
4871
- ...(props.id && { for: props.id }),
4872
- class: 'form-check-label',
4873
- }, {
4874
- default: () => props.label,
4875
- }),
4876
- ]);
4877
- },
4878
- });
4879
-
4880
- const CFormText = defineComponent({
4881
- name: 'CFormText',
4882
- props: {
6879
+ placeholder: {
6880
+ type: String,
6881
+ default: 'Select date',
6882
+ },
4883
6883
  /**
4884
- * Component used for the root node. Either a string to use a HTML element or a component.
6884
+ * Size the component small or large.
6885
+ *
6886
+ * @values 'sm', 'lg'
4885
6887
  */
4886
- component: {
6888
+ size: {
4887
6889
  type: String,
4888
6890
  required: false,
4889
- default: 'div',
6891
+ validator: (value) => {
6892
+ return ['sm', 'lg'].includes(value);
6893
+ },
6894
+ },
6895
+ /**
6896
+ * Provide an additional time selection by adding select boxes to choose times.
6897
+ */
6898
+ timepicker: Boolean,
6899
+ /**
6900
+ * Set length or format of day name.
6901
+ *
6902
+ * @type number | 'long' | 'narrow' | 'short'
6903
+ */
6904
+ weekdayFormat: {
6905
+ type: [Number, String],
6906
+ default: 2,
6907
+ validator: (value) => {
6908
+ if (typeof value === 'string') {
6909
+ return ['long', 'narrow', 'short'].includes(value);
6910
+ }
6911
+ if (typeof value === 'number') {
6912
+ return true;
6913
+ }
6914
+ return false;
6915
+ },
4890
6916
  },
4891
6917
  },
4892
- setup(props, { slots }) {
4893
- return () => h$1(props.component, { class: 'form-text' }, slots.default && slots.default());
6918
+ emit: [
6919
+ /**
6920
+ * Callback fired when the date changed.
6921
+ */
6922
+ 'date-change',
6923
+ ],
6924
+ setup(props, { emit }) {
6925
+ return () => h$1(CDateRangePicker, {
6926
+ calendars: 1,
6927
+ onStartDateChange: (date) => emit('date-change', date),
6928
+ range: false,
6929
+ startDate: props.date,
6930
+ ...props,
6931
+ // cleaner: props.cleaner,
6932
+ // disabled: props.disabled,
6933
+ // indicator: props.indicator,
6934
+ // inputReadOnly: props.inputReadOnly,
6935
+ // locale: props.locale,
6936
+ // placeholder: props.placeholder,
6937
+ // size: props.size,
6938
+ // timepicker: props.timepicker,
6939
+ });
4894
6940
  },
4895
6941
  });
4896
6942
 
4897
- const CFormTextarea = defineComponent({
4898
- name: 'CFormTextarea',
6943
+ const CDatePickerPlugin = {
6944
+ install: (app) => {
6945
+ app.component(CDatePicker.name, CDatePicker);
6946
+ },
6947
+ };
6948
+
6949
+ const CSpinner = defineComponent({
6950
+ name: 'CSpinner',
4899
6951
  props: {
4900
6952
  /**
4901
- * Toggle the disabled state for the component.
6953
+ * Sets the color context of the component to one of CoreUI’s themed colors.
6954
+ *
6955
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4902
6956
  */
4903
- disabled: {
4904
- type: Boolean,
6957
+ color: {
6958
+ type: String,
6959
+ default: undefined,
4905
6960
  required: false,
6961
+ validator: (value) => {
6962
+ return [
6963
+ 'primary',
6964
+ 'secondary',
6965
+ 'success',
6966
+ 'danger',
6967
+ 'warning',
6968
+ 'info',
6969
+ 'dark',
6970
+ 'light',
6971
+ ].includes(value);
6972
+ },
4906
6973
  },
4907
6974
  /**
4908
- * Set component validation state to invalid.
6975
+ * Component used for the root node. Either a string to use a HTML element or a component.
4909
6976
  */
4910
- invalid: {
4911
- type: Boolean,
6977
+ component: {
6978
+ type: String,
6979
+ default: 'div',
4912
6980
  required: false,
4913
6981
  },
4914
6982
  /**
4915
- * The default name for a value passed using v-model.
6983
+ * Size the component small.
6984
+ *
6985
+ * @values 'sm'
4916
6986
  */
4917
- modelValue: {
6987
+ size: {
4918
6988
  type: String,
4919
6989
  default: undefined,
4920
- require: false,
4921
- },
4922
- /**
4923
- * Render the component styled as plain text. Removes the default form field styling and preserve the correct margin and padding. Recommend to use only along side `readonly`.
4924
- */
4925
- plainText: {
4926
- type: Boolean,
4927
6990
  required: false,
6991
+ validator: (value) => {
6992
+ return value === 'sm';
6993
+ },
4928
6994
  },
4929
6995
  /**
4930
- * Toggle the readonly state for the component.
6996
+ * Set the button variant to an outlined button or a ghost button.
6997
+ *
6998
+ * @values 'border', 'grow'
4931
6999
  */
4932
- readonly: {
4933
- type: Boolean,
7000
+ variant: {
7001
+ type: String,
7002
+ default: 'border',
4934
7003
  required: false,
7004
+ validator: (value) => {
7005
+ return ['border', 'grow'].includes(value);
7006
+ },
4935
7007
  },
4936
7008
  /**
4937
- * Set component validation state to valid.
7009
+ * Set visually hidden label for accessibility purposes.
4938
7010
  */
4939
- valid: {
4940
- type: Boolean,
7011
+ visuallyHiddenLabel: {
7012
+ type: String,
7013
+ default: 'Loading...',
4941
7014
  required: false,
4942
7015
  },
4943
7016
  },
4944
- emits: [
4945
- /**
4946
- * Event occurs when the element loses focus, after the content has been changed.
4947
- */
4948
- 'change',
4949
- /**
4950
- * Event occurs immediately after the value of a component has changed.
4951
- */
4952
- 'input',
4953
- /**
4954
- * Emit the new value whenever there’s an input or change event.
4955
- */
4956
- 'update:modelValue',
4957
- ],
4958
- setup(props, { emit, slots }) {
4959
- const handleInput = (event) => {
4960
- const target = event.target;
4961
- emit('input', event);
4962
- emit('update:modelValue', target.value);
4963
- };
4964
- return () => h$1('textarea', {
4965
- disabled: props.disabled,
4966
- readonly: props.readonly,
7017
+ setup(props) {
7018
+ return () => h$1(props.component, {
4967
7019
  class: [
4968
- props.plainText ? 'form-control-plaintext' : 'form-control',
4969
- {
4970
- 'is-invalid': props.invalid,
4971
- 'is-valid': props.valid,
4972
- },
7020
+ `spinner-${props.variant}`,
7021
+ `text-${props.color}`,
7022
+ props.size && `spinner-${props.variant}-${props.size}`,
4973
7023
  ],
4974
- onInput: (event) => handleInput(event),
4975
- value: props.modelValue,
4976
- }, slots.default && slots.default());
7024
+ role: 'status',
7025
+ }, h$1('span', { class: ['visually-hidden'] }, props.visuallyHiddenLabel));
4977
7026
  },
4978
7027
  });
4979
7028
 
4980
- const CInputGroup = defineComponent({
4981
- name: 'CInputGroup',
7029
+ const CSpinnerPlugin = {
7030
+ install: (app) => {
7031
+ app.component(CSpinner.name, CSpinner);
7032
+ },
7033
+ };
7034
+
7035
+ const CElementCover = defineComponent({
7036
+ name: 'CElementCover',
4982
7037
  props: {
4983
7038
  /**
4984
- * Size the component small or large.
7039
+ * Array of custom boundaries. Use to create custom cover area (instead of parent element area). Area is defined by four sides: 'top', 'bottom', 'right', 'left'. If side is not defined by any custom boundary it is equal to parent element boundary. Each custom boundary is object with keys:
7040
+ * - sides (array) - select boundaries of element to define boundaries. Sides names: 'top', 'bottom', 'right', 'left'.
7041
+ * - query (string) - query used to get element which define boundaries. Search will be done only inside parent element, by parent.querySelector(query) function. [docs]
4985
7042
  *
4986
- * @values 'sm', 'lg'
7043
+ * @type {sides: string[], query: string}[]
4987
7044
  */
4988
- size: {
4989
- type: String,
4990
- default: undefined,
4991
- required: false,
4992
- validator: (value) => {
4993
- return ['sm', 'lg'].includes(value);
4994
- },
7045
+ boundaries: {
7046
+ // TODO: check if this is correct, TJ
7047
+ type: Array,
7048
+ require: true,
7049
+ },
7050
+ /**
7051
+ * Opacity of the cover. [docs]
7052
+ *
7053
+ * @type number
7054
+ */
7055
+ opacity: {
7056
+ type: Number,
7057
+ require: false,
4995
7058
  },
4996
7059
  },
4997
- setup(props, { slots }) {
7060
+ setup(props) {
7061
+ let containerCoords = {};
7062
+ const elementRef = ref();
7063
+ const getCustomBoundaries = () => {
7064
+ if (!props.boundaries || elementRef === null) {
7065
+ return {};
7066
+ }
7067
+ const parent = elementRef.value.parentElement;
7068
+ if (!parent) {
7069
+ return {};
7070
+ }
7071
+ const parentCoords = parent.getBoundingClientRect();
7072
+ const customBoundaries = {};
7073
+ props.boundaries.forEach((value) => {
7074
+ const element = parent.querySelector(value.query);
7075
+ if (!element || !value.sides) {
7076
+ return;
7077
+ }
7078
+ const coords = element.getBoundingClientRect();
7079
+ value.sides.forEach((side) => {
7080
+ const sideMargin = Math.abs(coords[side] - parentCoords[side]);
7081
+ customBoundaries[side] = `${sideMargin}px`;
7082
+ });
7083
+ });
7084
+ return customBoundaries;
7085
+ };
7086
+ onMounted(function () {
7087
+ nextTick(function () {
7088
+ containerCoords = getCustomBoundaries();
7089
+ });
7090
+ });
4998
7091
  return () => h$1('div', {
4999
- class: [
5000
- 'input-group',
5001
- {
5002
- [`input-group-${props.size}`]: props.size,
5003
- },
5004
- ],
5005
- }, slots.default && slots.default());
7092
+ style: {
7093
+ ...containerCoords,
7094
+ position: 'absolute',
7095
+ 'background-color': `rgb(255,255,255,${props.opacity})`,
7096
+ },
7097
+ ref: elementRef,
7098
+ }, h$1('div', // TODO: use slot to override this
7099
+ {
7100
+ style: {
7101
+ position: 'absolute',
7102
+ top: '50%',
7103
+ left: '50%',
7104
+ transform: 'translateX(-50%) translateY(-50%)',
7105
+ },
7106
+ }, h$1(CSpinner, {
7107
+ variant: 'grow',
7108
+ color: 'primary',
7109
+ })));
5006
7110
  },
5007
7111
  });
5008
7112
 
5009
- const CInputGroupText = defineComponent({
5010
- name: 'CInputGroupText',
7113
+ const CElementCoverPlugin = {
7114
+ install: (app) => {
7115
+ app.component(CElementCover.name, CElementCover);
7116
+ },
7117
+ };
7118
+
7119
+ const CFooter = defineComponent({
7120
+ name: 'CFooter',
5011
7121
  props: {
5012
7122
  /**
5013
- * Component used for the root node. Either a string to use a HTML element or a component.
7123
+ * Place footer in non-static positions.
7124
+ *
7125
+ * @values 'fixed', 'sticky'
5014
7126
  */
5015
- component: {
7127
+ position: {
5016
7128
  type: String,
7129
+ default: undefined,
5017
7130
  required: false,
5018
- default: 'span',
7131
+ validator: (value) => {
7132
+ return ['fixed', 'sticky'].includes(value);
7133
+ },
5019
7134
  },
5020
7135
  },
5021
7136
  setup(props, { slots }) {
5022
- return () => h$1(props.component, { class: 'input-group-text' }, slots.default && slots.default());
7137
+ return () => h$1('div', { class: ['footer', { [`footer-${props.position}`]: props.position }] }, slots.default && slots.default());
5023
7138
  },
5024
7139
  });
5025
7140
 
5026
- const CFormPlugin = {
7141
+ const CFooterPlugin = {
5027
7142
  install: (app) => {
5028
- app.component(CForm.name, CForm);
5029
- app.component(CFormCheck.name, CFormCheck);
5030
- // app.component(CFormControl.name, CFormControl)
5031
- app.component(CFormFeedback.name, CFormFeedback);
5032
- app.component(CFormFloating.name, CFormFloating);
5033
- app.component(CFormInput.name, CFormInput);
5034
- app.component(CFormLabel.name, CFormLabel);
5035
- app.component(CFormRange.name, CFormRange);
5036
- app.component(CFormSelect.name, CFormSelect);
5037
- app.component(CFormSwitch.name, CFormSwitch);
5038
- app.component(CFormText.name, CFormText);
5039
- app.component(CFormTextarea.name, CFormTextarea);
5040
- app.component(CInputGroup.name, CInputGroup);
5041
- app.component(CInputGroupText.name, CInputGroupText);
7143
+ app.component(CFooter.name, CFooter);
5042
7144
  },
5043
7145
  };
5044
7146
 
@@ -8550,11 +10652,6 @@ const CSmartTableBody = defineComponent({
8550
10652
  default: undefined,
8551
10653
  require: false,
8552
10654
  },
8553
- columns: {
8554
- type: Array,
8555
- default: () => [],
8556
- require: true,
8557
- },
8558
10655
  rawColumnNames: {
8559
10656
  type: Array,
8560
10657
  default: () => [],
@@ -9668,7 +11765,7 @@ const CSmartTable = defineComponent({
9668
11765
  ...props.tableHeadProps,
9669
11766
  columnFilter: props.columnFilter,
9670
11767
  columnFilterValue: columnFilterState.value,
9671
- columns: rawColumnNames.value,
11768
+ columns: props.columns ? props.columns : rawColumnNames.value,
9672
11769
  columnSorter: props.columnSorter,
9673
11770
  selectable: props.selectable,
9674
11771
  selectAll: selectedAll.value,
@@ -9715,7 +11812,6 @@ const CSmartTable = defineComponent({
9715
11812
  currentItems: currentItems.value,
9716
11813
  firstItemOnActivePageIndex: firstItemOnActivePageIndex.value,
9717
11814
  noItemsLabel: props.noItemsLabel,
9718
- columns: rawColumnNames.value,
9719
11815
  scopedSlots: slots,
9720
11816
  selectable: props.selectable,
9721
11817
  onRowChecked: (id, value) => handleRowChecked(id, value),
@@ -9730,7 +11826,7 @@ const CSmartTable = defineComponent({
9730
11826
  ...props.tableFootProps,
9731
11827
  columnFilter: false,
9732
11828
  columnSorter: false,
9733
- columns: rawColumnNames.value,
11829
+ columns: props.columns ? props.columns : rawColumnNames.value,
9734
11830
  selectable: props.selectable,
9735
11831
  selectAll: selectedAll.value,
9736
11832
  onFilterInput: (key, value) => columnFilterChange(key, value, 'input'),
@@ -10759,6 +12855,8 @@ var Components = /*#__PURE__*/Object.freeze({
10759
12855
  CButtonGroupPlugin: CButtonGroupPlugin,
10760
12856
  CButtonToolbar: CButtonToolbar,
10761
12857
  CButtonGroup: CButtonGroup,
12858
+ CCalendar: CCalendar,
12859
+ CCalendarPlugin: CCalendarPlugin,
10762
12860
  CCalloutPlugin: CCalloutPlugin,
10763
12861
  CCallout: CCallout,
10764
12862
  CCardPlugin: CCardPlugin,
@@ -10781,6 +12879,10 @@ var Components = /*#__PURE__*/Object.freeze({
10781
12879
  CCloseButton: CCloseButton,
10782
12880
  CCollapsePlugin: CCollapsePlugin,
10783
12881
  CCollapse: CCollapse,
12882
+ CDatePickerPlugin: CDatePickerPlugin,
12883
+ CDatePicker: CDatePicker,
12884
+ CDateRangePickerPlugin: CDateRangePickerPlugin,
12885
+ CDateRangePicker: CDateRangePicker,
10784
12886
  CDropdownPlugin: CDropdownPlugin,
10785
12887
  CDropdown: CDropdown,
10786
12888
  CDropdownItem: CDropdownItem,
@@ -10856,6 +12958,8 @@ var Components = /*#__PURE__*/Object.freeze({
10856
12958
  CPagination: CPagination,
10857
12959
  CPaginationItem: CPaginationItem,
10858
12960
  CSmartPagination: CSmartPagination,
12961
+ CPicker: CPicker,
12962
+ CPickerPlugin: CPickerPlugin,
10859
12963
  CPlaceholderPlugin: CPlaceholderPlugin,
10860
12964
  CPlaceholder: CPlaceholder,
10861
12965
  CProgressPlugin: CProgressPlugin,
@@ -10886,6 +12990,8 @@ var Components = /*#__PURE__*/Object.freeze({
10886
12990
  CTabsPlugin: CTabsPlugin,
10887
12991
  CTabContent: CTabContent,
10888
12992
  CTabPane: CTabPane,
12993
+ CTimePicker: CTimePicker,
12994
+ CTimePickerPlugin: CTimePickerPlugin,
10889
12995
  CToastPlugin: CToastPlugin,
10890
12996
  CToast: CToast,
10891
12997
  CToastBody: CToastBody,
@@ -11132,5 +13238,5 @@ const CoreuiVue = {
11132
13238
  },
11133
13239
  };
11134
13240
 
11135
- export { CAccordion, CAccordionBody, CAccordionButton, CAccordionCollapse, CAccordionHeader, CAccordionItem, CAccordionPlugin, CAlert, CAlertHeading, CAlertLink, CAlertPlugin, CAvatar, CAvatarPlugin, CBackdrop, CBackdropPlugin, CBadge, CBadgePlugin, CBreadcrumb, CBreadcrumbItem, CBreadcrumbPlugin, CButton, CButtonGroup, CButtonGroupPlugin, CButtonPlugin, CButtonToolbar, CCLinkPlugin, CCallout, CCalloutPlugin, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardPlugin, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCarouselPlugin, CCloseButton, CCloseButtonPlugin, CCol, CCollapse, CCollapsePlugin, CContainer, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownMenu, CDropdownPlugin, CDropdownToggle, CElementCover, CElementCoverPlugin, CFooter, CFooterPlugin, CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormPlugin, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CGridPlugin, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderPlugin, CHeaderText, CHeaderToggler, CImage, CImagePlugin, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CListGroupPlugin, CLoadingButton, CLoadingButtonPlugin, CModal, CModalBody, CModalFooter, CModalHeader, CModalPlugin, CModalTitle, CMultiSelect, CMultiSelectPlugin, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavPlugin, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarPlugin, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasPlugin, COffcanvasTitle, CPagination, CPaginationItem, CPaginationPlugin, CPlaceholder, CPlaceholderPlugin, CPopover, CPopoverPlugin, CProgress, CProgressBar, CProgressPlugin, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarPlugin, CSidebarToggler, CSmartPagination, CSmartTable, CSmartTablePlugin, CSpinner, CSpinnerPlugin, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTablePlugin, CTableRow, CTabsPlugin, CToast, CToastBody, CToastClose, CToastHeader, CToastPlugin, CToaster, CTooltip, CTooltipPlugin, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, CWidgetsStatsPlugin, CoreuiVue as default, vcplaceholder, vcpopover, vctooltip };
13241
+ export { CAccordion, CAccordionBody, CAccordionButton, CAccordionCollapse, CAccordionHeader, CAccordionItem, CAccordionPlugin, CAlert, CAlertHeading, CAlertLink, CAlertPlugin, CAvatar, CAvatarPlugin, CBackdrop, CBackdropPlugin, CBadge, CBadgePlugin, CBreadcrumb, CBreadcrumbItem, CBreadcrumbPlugin, CButton, CButtonGroup, CButtonGroupPlugin, CButtonPlugin, CButtonToolbar, CCLinkPlugin, CCalendar, CCalendarPlugin, CCallout, CCalloutPlugin, CCard, CCardBody, CCardFooter, CCardGroup, CCardHeader, CCardImage, CCardImageOverlay, CCardLink, CCardPlugin, CCardSubtitle, CCardText, CCardTitle, CCarousel, CCarouselCaption, CCarouselItem, CCarouselPlugin, CCloseButton, CCloseButtonPlugin, CCol, CCollapse, CCollapsePlugin, CContainer, CDatePicker, CDatePickerPlugin, CDateRangePicker, CDateRangePickerPlugin, CDropdown, CDropdownDivider, CDropdownHeader, CDropdownItem, CDropdownMenu, CDropdownPlugin, CDropdownToggle, CElementCover, CElementCoverPlugin, CFooter, CFooterPlugin, CForm, CFormCheck, CFormFeedback, CFormFloating, CFormInput, CFormLabel, CFormPlugin, CFormRange, CFormSelect, CFormSwitch, CFormText, CFormTextarea, CGridPlugin, CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderPlugin, CHeaderText, CHeaderToggler, CImage, CImagePlugin, CInputGroup, CInputGroupText, CLink, CListGroup, CListGroupItem, CListGroupPlugin, CLoadingButton, CLoadingButtonPlugin, CModal, CModalBody, CModalFooter, CModalHeader, CModalPlugin, CModalTitle, CMultiSelect, CMultiSelectPlugin, CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavPlugin, CNavTitle, CNavbar, CNavbarBrand, CNavbarNav, CNavbarPlugin, CNavbarText, CNavbarToggler, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasPlugin, COffcanvasTitle, CPagination, CPaginationItem, CPaginationPlugin, CPicker, CPickerPlugin, CPlaceholder, CPlaceholderPlugin, CPopover, CPopoverPlugin, CProgress, CProgressBar, CProgressPlugin, CRow, CSidebar, CSidebarBrand, CSidebarFooter, CSidebarHeader, CSidebarNav, CSidebarPlugin, CSidebarToggler, CSmartPagination, CSmartTable, CSmartTablePlugin, CSpinner, CSpinnerPlugin, CTabContent, CTabPane, CTable, CTableBody, CTableCaption, CTableDataCell, CTableFoot, CTableHead, CTableHeaderCell, CTablePlugin, CTableRow, CTabsPlugin, CTimePicker, CTimePickerPlugin, CToast, CToastBody, CToastClose, CToastHeader, CToastPlugin, CToaster, CTooltip, CTooltipPlugin, CWidgetStatsA, CWidgetStatsB, CWidgetStatsC, CWidgetStatsD, CWidgetStatsE, CWidgetStatsF, CWidgetsStatsPlugin, CoreuiVue as default, vcplaceholder, vcpopover, vctooltip };
11136
13242
  //# sourceMappingURL=index.es.js.map