@coreui/vue-pro 4.2.0 → 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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/components/calendar/CCalendar.d.ts +185 -0
  3. package/dist/components/calendar/index.d.ts +6 -0
  4. package/dist/components/date-picker/CDatePicker.d.ts +406 -0
  5. package/dist/components/date-picker/index.d.ts +6 -0
  6. package/dist/components/date-range-picker/CDateRangePicker.d.ts +480 -0
  7. package/dist/components/date-range-picker/index.d.ts +6 -0
  8. package/dist/components/index.d.ts +5 -0
  9. package/dist/components/multi-select/CMultiSelect.d.ts +2 -2
  10. package/dist/components/picker/CPicker.d.ts +11 -0
  11. package/dist/components/picker/index.d.ts +6 -0
  12. package/dist/components/popover/CPopover.d.ts +1 -1
  13. package/dist/components/sidebar/CSidebar.d.ts +1 -1
  14. package/dist/components/smart-table/CSmartTable.d.ts +1 -1
  15. package/dist/components/time-picker/CTimePicker.d.ts +10 -0
  16. package/dist/components/time-picker/CTimePickerRollCol.d.ts +27 -0
  17. package/dist/components/time-picker/index.d.ts +6 -0
  18. package/dist/components/toast/CToast.d.ts +1 -1
  19. package/dist/index.es.js +2849 -850
  20. package/dist/index.es.js.map +1 -1
  21. package/dist/index.js +2858 -849
  22. package/dist/index.js.map +1 -1
  23. package/dist/utils/calendar.d.ts +21 -0
  24. package/dist/utils/time.d.ts +17 -0
  25. package/package.json +1 -1
  26. package/src/components/calendar/CCalendar.ts +546 -0
  27. package/src/components/calendar/index.ts +10 -0
  28. package/src/components/date-picker/CDatePicker.ts +243 -0
  29. package/src/components/date-picker/index.ts +10 -0
  30. package/src/components/date-range-picker/CDateRangePicker.ts +635 -0
  31. package/src/components/date-range-picker/index.ts +10 -0
  32. package/src/components/dropdown/CDropdownMenu.ts +4 -2
  33. package/src/components/dropdown/CDropdownToggle.ts +24 -9
  34. package/src/components/index.ts +5 -0
  35. package/src/components/picker/CPicker.ts +220 -0
  36. package/src/components/picker/index.ts +10 -0
  37. package/src/components/time-picker/CTimePicker.ts +410 -0
  38. package/src/components/time-picker/CTimePickerRollCol.ts +58 -0
  39. package/src/components/time-picker/index.ts +10 -0
  40. package/src/utils/calendar.ts +193 -0
  41. package/src/utils/time.ts +58 -0
package/dist/index.js CHANGED
@@ -941,6 +941,553 @@ const CButtonGroupPlugin = {
941
941
  },
942
942
  };
943
943
 
944
+ const createGroupsInArray = (arr, numberOfGroups) => {
945
+ const perGroup = Math.ceil(arr.length / numberOfGroups);
946
+ return new Array(numberOfGroups)
947
+ .fill('')
948
+ .map((_, i) => arr.slice(i * perGroup, (i + 1) * perGroup));
949
+ };
950
+ const getMonthsNames = (locale) => {
951
+ const months = [];
952
+ const d = new Date();
953
+ d.setDate(1);
954
+ for (let i = 0; i < 12; i++) {
955
+ d.setMonth(i);
956
+ months.push(d.toLocaleString(locale, { month: 'short' }));
957
+ }
958
+ return months;
959
+ };
960
+ const getYears = (year) => {
961
+ const years = [];
962
+ for (let _year = year - 6; _year < year + 6; _year++) {
963
+ years.push(_year);
964
+ }
965
+ return years;
966
+ };
967
+ const getLeadingDays = (year, month, firstDayOfWeek) => {
968
+ // 0: sunday
969
+ // 1: monday
970
+ const dates = [];
971
+ const d = new Date(year, month);
972
+ const y = d.getFullYear();
973
+ const m = d.getMonth();
974
+ const firstWeekday = new Date(y, m, 1).getDay();
975
+ let leadingDays = 6 - (6 - firstWeekday) - firstDayOfWeek;
976
+ if (firstDayOfWeek) {
977
+ leadingDays = leadingDays < 0 ? 7 + leadingDays : leadingDays;
978
+ }
979
+ for (let i = leadingDays * -1; i < 0; i++) {
980
+ dates.push({
981
+ date: new Date(y, m, i + 1),
982
+ month: 'previous',
983
+ });
984
+ }
985
+ return dates;
986
+ };
987
+ const getMonthDays = (year, month) => {
988
+ const dates = [];
989
+ const lastDay = new Date(year, month + 1, 0).getDate();
990
+ for (let i = 1; i <= lastDay; i++) {
991
+ dates.push({
992
+ date: new Date(year, month, i),
993
+ month: 'current',
994
+ });
995
+ }
996
+ return dates;
997
+ };
998
+ const getTrailingDays = (year, month, leadingDays, monthDays) => {
999
+ const dates = [];
1000
+ const days = 42 - (leadingDays.length + monthDays.length);
1001
+ for (let i = 1; i <= days; i++) {
1002
+ dates.push({
1003
+ date: new Date(year, month + 1, i),
1004
+ month: 'next',
1005
+ });
1006
+ }
1007
+ return dates;
1008
+ };
1009
+ const getMonthDetails = (year, month, firstDayOfWeek) => {
1010
+ const daysPrevMonth = getLeadingDays(year, month, firstDayOfWeek);
1011
+ const daysThisMonth = getMonthDays(year, month);
1012
+ const daysNextMonth = getTrailingDays(year, month, daysPrevMonth, daysThisMonth);
1013
+ const days = [...daysPrevMonth, ...daysThisMonth, ...daysNextMonth];
1014
+ const weeks = [];
1015
+ days.forEach((day, index) => {
1016
+ if (index % 7 === 0 || weeks.length === 0) {
1017
+ weeks.push([]);
1018
+ }
1019
+ weeks[weeks.length - 1].push(day);
1020
+ });
1021
+ return weeks;
1022
+ };
1023
+ const isDateDisabled = (date, min, max, dates) => {
1024
+ let disabled;
1025
+ if (dates) {
1026
+ dates.forEach((_date) => {
1027
+ if (Array.isArray(_date)) {
1028
+ if (isDateInRange(date, _date[0], _date[1])) {
1029
+ disabled = true;
1030
+ }
1031
+ }
1032
+ if (_date instanceof Date) {
1033
+ if (isSameDateAs(date, _date)) {
1034
+ disabled = true;
1035
+ }
1036
+ }
1037
+ });
1038
+ }
1039
+ if (min && date < min) {
1040
+ disabled = true;
1041
+ }
1042
+ if (max && date > max) {
1043
+ disabled = true;
1044
+ }
1045
+ return disabled;
1046
+ };
1047
+ const isDateInRange = (date, start, end) => {
1048
+ return start && end && start <= date && date <= end;
1049
+ };
1050
+ const isDateSelected = (date, start, end) => {
1051
+ return (start && isSameDateAs(start, date)) || (end && isSameDateAs(end, date));
1052
+ };
1053
+ const isEndDate = (date, start, end) => {
1054
+ return start && end && isSameDateAs(end, date) && start < end;
1055
+ };
1056
+ const isLastDayOfMonth = (date) => {
1057
+ const test = new Date(date.getTime());
1058
+ const month = test.getMonth();
1059
+ test.setDate(test.getDate() + 1);
1060
+ return test.getMonth() !== month;
1061
+ };
1062
+ const isSameDateAs = (date, date2) => {
1063
+ return (date.getDate() == date2.getDate() &&
1064
+ date.getMonth() == date2.getMonth() &&
1065
+ date.getFullYear() == date2.getFullYear());
1066
+ };
1067
+ const isStartDate = (date, start, end) => {
1068
+ return start && end && isSameDateAs(start, date) && start < end;
1069
+ };
1070
+ const isToday = (date) => {
1071
+ const today = new Date();
1072
+ return (date.getDate() == today.getDate() &&
1073
+ date.getMonth() == today.getMonth() &&
1074
+ date.getFullYear() == today.getFullYear());
1075
+ };
1076
+ const isValidDate = (date) => {
1077
+ const d = new Date(date);
1078
+ return d instanceof Date && d.getTime();
1079
+ };
1080
+
1081
+ const CCalendar = vue.defineComponent({
1082
+ name: 'CCalendar',
1083
+ props: {
1084
+ /**
1085
+ * Default date of the component
1086
+ */
1087
+ calendarDate: {
1088
+ type: [Date, String],
1089
+ },
1090
+ /**
1091
+ * Specify the list of dates that cannot be selected.
1092
+ */
1093
+ disabledDates: {
1094
+ type: Array,
1095
+ },
1096
+ /**
1097
+ * Initial selected to date (range).
1098
+ */
1099
+ endDate: {
1100
+ type: [Date, String],
1101
+ },
1102
+ /**
1103
+ * Sets the day of start week.
1104
+ * - 0 - Sunday,
1105
+ * - 1 - Monday,
1106
+ * - 2 - Tuesday,
1107
+ * - 3 - Wednesday,
1108
+ * - 4 - Thursday,
1109
+ * - 5 - Friday,
1110
+ * - 6 - Saturday,
1111
+ * - 7 - Sunday
1112
+ */
1113
+ firstDayOfWeek: {
1114
+ type: Number,
1115
+ default: 1,
1116
+ },
1117
+ /**
1118
+ * Sets the default locale for components. If not set, it is inherited from the navigator.language.
1119
+ */
1120
+ locale: {
1121
+ type: String,
1122
+ default: 'default',
1123
+ },
1124
+ /**
1125
+ * Max selectable date.
1126
+ */
1127
+ maxDate: {
1128
+ type: [Date, String],
1129
+ },
1130
+ /**
1131
+ * Min selectable date.
1132
+ */
1133
+ minDate: {
1134
+ type: [Date, String],
1135
+ },
1136
+ /**
1137
+ * Show arrows navigation.
1138
+ */
1139
+ navigation: {
1140
+ type: Boolean,
1141
+ default: true,
1142
+ },
1143
+ /**
1144
+ * Allow range selection.
1145
+ */
1146
+ range: Boolean,
1147
+ /**
1148
+ * Toggle select mode between start and end date.
1149
+ */
1150
+ selectEndDate: Boolean,
1151
+ /**
1152
+ * Initial selected date.
1153
+ */
1154
+ startDate: {
1155
+ type: [Date, String],
1156
+ },
1157
+ /**
1158
+ * Set length or format of day name.
1159
+ *
1160
+ * @type number | 'long' | 'narrow' | 'short'
1161
+ */
1162
+ weekdayFormat: {
1163
+ type: [Number, String],
1164
+ default: 2,
1165
+ validator: (value) => {
1166
+ if (typeof value === 'string') {
1167
+ return ['long', 'narrow', 'short'].includes(value);
1168
+ }
1169
+ if (typeof value === 'number') {
1170
+ return true;
1171
+ }
1172
+ return false;
1173
+ },
1174
+ },
1175
+ },
1176
+ emits: [
1177
+ /**
1178
+ * Callback fired when the user hovers over the calendar cell.
1179
+ *
1180
+ * @property {Date | null} date
1181
+ */
1182
+ 'calendar-cell-hover',
1183
+ /**
1184
+ * Callback fired when the calendar date changed.
1185
+ *
1186
+ * @property {Date | null} date
1187
+ */
1188
+ 'calendar-date-change',
1189
+ /**
1190
+ * Callback fired when the start date changed.
1191
+ *
1192
+ * @property {Date | null} date
1193
+ */
1194
+ 'start-date-change',
1195
+ /**
1196
+ * Callback fired when the end date changed.
1197
+ *
1198
+ * @property {Date | null} date
1199
+ */
1200
+ 'end-date-change',
1201
+ ],
1202
+ setup(props, { slots, emit }) {
1203
+ const calendarDate = vue.ref(props.calendarDate ? new Date(props.calendarDate) : new Date());
1204
+ const startDate = vue.ref(props.startDate ? new Date(props.startDate) : null);
1205
+ const endDate = vue.ref(props.endDate ? new Date(props.endDate) : null);
1206
+ const selectEndDate = vue.ref(props.selectEndDate);
1207
+ const view = vue.ref('days');
1208
+ const maxDate = props.maxDate ? new Date(props.maxDate) : null;
1209
+ const minDate = props.minDate ? new Date(props.minDate) : null;
1210
+ vue.watch(() => props.calendarDate, () => {
1211
+ if (props.calendarDate)
1212
+ calendarDate.value = new Date(props.calendarDate);
1213
+ });
1214
+ vue.watch(() => props.startDate, () => {
1215
+ if (props.startDate === null) {
1216
+ startDate.value = null;
1217
+ return;
1218
+ }
1219
+ if (props.startDate) {
1220
+ const d = new Date(props.startDate);
1221
+ if (startDate.value === null) {
1222
+ startDate.value = d;
1223
+ return;
1224
+ }
1225
+ if (startDate.value && !isSameDateAs(d, startDate.value)) {
1226
+ startDate.value = d;
1227
+ }
1228
+ }
1229
+ });
1230
+ vue.watch(() => props.endDate, () => {
1231
+ if (props.endDate === null) {
1232
+ endDate.value = null;
1233
+ return;
1234
+ }
1235
+ if (props.endDate) {
1236
+ const d = new Date(props.endDate);
1237
+ if (endDate.value === null) {
1238
+ endDate.value = d;
1239
+ return;
1240
+ }
1241
+ if (endDate.value && !isSameDateAs(d, endDate.value)) {
1242
+ endDate.value = d;
1243
+ }
1244
+ }
1245
+ });
1246
+ vue.watch(() => props.selectEndDate, () => {
1247
+ selectEndDate.value = props.selectEndDate;
1248
+ });
1249
+ vue.watch(startDate, () => {
1250
+ emit('start-date-change', startDate.value);
1251
+ });
1252
+ vue.watch(endDate, () => {
1253
+ emit('end-date-change', endDate.value);
1254
+ });
1255
+ const setCalendarPage = (years, months = 0) => {
1256
+ const year = calendarDate.value.getFullYear();
1257
+ const month = calendarDate.value.getMonth();
1258
+ const d = new Date(year, month, 1);
1259
+ years && d.setFullYear(d.getFullYear() + years);
1260
+ months && d.setMonth(d.getMonth() + months);
1261
+ calendarDate.value = d;
1262
+ emit('calendar-date-change', d);
1263
+ };
1264
+ const handleCellOnClick = (date) => {
1265
+ if (isDateDisabled(date, minDate, maxDate, props.disabledDates)) {
1266
+ return;
1267
+ }
1268
+ if (props.range) {
1269
+ if (selectEndDate.value) {
1270
+ // If endDate > date
1271
+ if (startDate.value && startDate.value > date) {
1272
+ endDate.value = startDate.value;
1273
+ startDate.value = date;
1274
+ }
1275
+ else {
1276
+ endDate.value = date;
1277
+ }
1278
+ selectEndDate.value = false;
1279
+ }
1280
+ else {
1281
+ startDate.value = date;
1282
+ selectEndDate.value = true;
1283
+ }
1284
+ }
1285
+ else {
1286
+ startDate.value = date;
1287
+ }
1288
+ };
1289
+ const handleCellMouseEnter = (date) => {
1290
+ if (isDateDisabled(date, minDate, maxDate, props.disabledDates)) {
1291
+ return;
1292
+ }
1293
+ emit('calendar-cell-hover', date);
1294
+ };
1295
+ const handleCellMouseLeave = () => {
1296
+ emit('calendar-cell-hover', null);
1297
+ };
1298
+ const handleNavigationOnClick = (direction, double = false) => {
1299
+ if (direction === 'prev') {
1300
+ if (double) {
1301
+ setCalendarPage(view.value !== 'days' ? -10 : -1);
1302
+ return;
1303
+ }
1304
+ if (view.value !== 'days') {
1305
+ setCalendarPage(-1);
1306
+ return;
1307
+ }
1308
+ setCalendarPage(0, -1);
1309
+ return;
1310
+ }
1311
+ if (direction === 'next') {
1312
+ if (double) {
1313
+ setCalendarPage(view.value !== 'days' ? 10 : 1);
1314
+ return;
1315
+ }
1316
+ if (view.value !== 'days') {
1317
+ setCalendarPage(1);
1318
+ return;
1319
+ }
1320
+ setCalendarPage(0, 1);
1321
+ return;
1322
+ }
1323
+ };
1324
+ const Calendar = () => {
1325
+ const monthDetails = getMonthDetails(calendarDate.value.getFullYear(), calendarDate.value.getMonth(), props.firstDayOfWeek);
1326
+ const listOfMonths = createGroupsInArray(getMonthsNames(props.locale), 4);
1327
+ const listOfYears = createGroupsInArray(getYears(calendarDate.value.getFullYear()), 4);
1328
+ const weekDays = monthDetails[0];
1329
+ return vue.h('table', {}, [
1330
+ view.value === 'days' &&
1331
+ vue.h('thead', {}, vue.h('tr', {}, weekDays.map(({ date }) => {
1332
+ return vue.h('th', { class: 'calendar-cell' }, vue.h('div', {
1333
+ class: 'calendar-header-cell-inner',
1334
+ }, props.weekdayFormat === 'string'
1335
+ ? date.toLocaleDateString(props.locale, { weekday: props.weekdayFormat })
1336
+ : date
1337
+ .toLocaleDateString(props.locale, { weekday: 'long' })
1338
+ .slice(0, props.weekdayFormat)));
1339
+ }))),
1340
+ vue.h('tbody', {}, [
1341
+ view.value === 'days' &&
1342
+ monthDetails.map((week) => {
1343
+ return vue.h('tr', {}, week.map(({ date, month }) => {
1344
+ return vue.h('td', {
1345
+ class: [
1346
+ 'calendar-cell',
1347
+ {
1348
+ today: isToday(date),
1349
+ disabled: isDateDisabled(date, minDate, maxDate, props.disabledDates),
1350
+ next: month === 'next',
1351
+ previous: month === 'previous',
1352
+ last: isLastDayOfMonth(date),
1353
+ range: month === 'current' &&
1354
+ isDateInRange(date, startDate.value, endDate.value),
1355
+ selected: isDateSelected(date, startDate.value, endDate.value),
1356
+ start: isStartDate(date, startDate.value, endDate.value),
1357
+ end: isEndDate(date, startDate.value, endDate.value),
1358
+ },
1359
+ ],
1360
+ title: date.toLocaleDateString(props.locale),
1361
+ onClick: () => handleCellOnClick(date),
1362
+ onmouseenter: () => handleCellMouseEnter(date),
1363
+ onmouseleave: () => handleCellMouseLeave(),
1364
+ }, vue.h('div', {
1365
+ class: 'calendar-cell-inner',
1366
+ }, date.toLocaleDateString(props.locale, { day: 'numeric' })));
1367
+ }));
1368
+ }),
1369
+ view.value === 'months' &&
1370
+ listOfMonths.map((row, index) => {
1371
+ return vue.h('tr', {}, row.map((month, idx) => {
1372
+ return vue.h('td', {
1373
+ class: 'calendar-cell month',
1374
+ onClick: () => {
1375
+ setCalendarPage(0, index * 3 + idx);
1376
+ view.value = 'days';
1377
+ },
1378
+ }, vue.h('div', { class: 'calendar-cell-inner' }, month));
1379
+ }));
1380
+ }),
1381
+ view.value === 'years' &&
1382
+ listOfYears.map((row) => {
1383
+ return vue.h('tr', {}, row.map((year) => {
1384
+ return vue.h('td', {
1385
+ class: 'calendar-cell year',
1386
+ onClick: () => {
1387
+ calendarDate.value = new Date(year, calendarDate.value.getMonth(), calendarDate.value.getDate());
1388
+ view.value = 'months';
1389
+ },
1390
+ }, vue.h('div', { class: 'calendar-cell-inner' }, year));
1391
+ }));
1392
+ }),
1393
+ ]),
1394
+ ]);
1395
+ };
1396
+ const Navigation = () => {
1397
+ return vue.h('div', { class: 'calendar-nav' }, [
1398
+ props.navigation &&
1399
+ vue.h('div', {
1400
+ class: 'calendar-nav-prev',
1401
+ }, [
1402
+ vue.h(CButton, {
1403
+ color: 'transparent',
1404
+ size: 'sm',
1405
+ onClick: () => handleNavigationOnClick('prev', true),
1406
+ }, {
1407
+ /**
1408
+ * @slot Location for double previous icon.
1409
+ */
1410
+ default: () => slots.navPrevDoubleIcon
1411
+ ? slots.navPrevDoubleIcon()
1412
+ : vue.h('span', { class: 'calendar-nav-icon calendar-nav-icon-double-prev' }),
1413
+ }),
1414
+ view.value === 'days' &&
1415
+ vue.h(CButton, {
1416
+ color: 'transparent',
1417
+ size: 'sm',
1418
+ onClick: () => handleNavigationOnClick('prev'),
1419
+ }, {
1420
+ /**
1421
+ * @slot Location for previous icon.
1422
+ */
1423
+ default: () => slots.navPrevIcon
1424
+ ? slots.navPrevIcon()
1425
+ : vue.h('span', { class: 'calendar-nav-icon calendar-nav-icon-prev' }),
1426
+ }),
1427
+ ]),
1428
+ vue.h('div', {
1429
+ class: 'calendar-nav-date',
1430
+ }, [
1431
+ view.value === 'days' &&
1432
+ vue.h(CButton, {
1433
+ color: 'transparent',
1434
+ size: 'sm',
1435
+ onClick: () => {
1436
+ if (props.navigation)
1437
+ view.value = 'months';
1438
+ },
1439
+ }, () => calendarDate.value.toLocaleDateString(props.locale, { month: 'long' })),
1440
+ vue.h(CButton, {
1441
+ color: 'transparent',
1442
+ size: 'sm',
1443
+ onClick: () => {
1444
+ if (props.navigation)
1445
+ view.value = 'years';
1446
+ },
1447
+ }, () => calendarDate.value.toLocaleDateString(props.locale, { year: 'numeric' })),
1448
+ ]),
1449
+ props.navigation &&
1450
+ vue.h('div', {
1451
+ class: 'calendar-nav-next',
1452
+ }, [
1453
+ view.value === 'days' &&
1454
+ vue.h(CButton, {
1455
+ color: 'transparent',
1456
+ size: 'sm',
1457
+ onClick: () => handleNavigationOnClick('next'),
1458
+ }, {
1459
+ /**
1460
+ * @slot Location for next icon.
1461
+ */
1462
+ default: () => slots.navNextIcon
1463
+ ? slots.navNextIcon()
1464
+ : vue.h('span', { class: 'calendar-nav-icon calendar-nav-icon-next' }),
1465
+ }),
1466
+ vue.h(CButton, {
1467
+ color: 'transparent',
1468
+ size: 'sm',
1469
+ onClick: () => handleNavigationOnClick('next', true),
1470
+ }, {
1471
+ /**
1472
+ * @slot Location for double next icon.
1473
+ */
1474
+ default: () => slots.navNextDoubleIcon
1475
+ ? slots.navNextDoubleIcon()
1476
+ : vue.h('span', { class: 'calendar-nav-icon calendar-nav-icon-double-next' }),
1477
+ }),
1478
+ ]),
1479
+ ]);
1480
+ };
1481
+ return () => vue.h('div', { class: ['calendar', view.value] }, [vue.h(Navigation), vue.h(Calendar)]);
1482
+ },
1483
+ });
1484
+
1485
+ const CCalendarPlugin = {
1486
+ install: (app) => {
1487
+ app.component(CCalendar.name, CCalendar);
1488
+ },
1489
+ };
1490
+
944
1491
  const CCallout = vue.defineComponent({
945
1492
  name: 'CCallout',
946
1493
  props: {
@@ -1541,58 +2088,954 @@ const CCollapsePlugin = {
1541
2088
  },
1542
2089
  };
1543
2090
 
1544
- var top = 'top';
1545
- var bottom = 'bottom';
1546
- var right = 'right';
1547
- var left = 'left';
1548
- var auto = 'auto';
1549
- var basePlacements = [top, bottom, right, left];
1550
- var start = 'start';
1551
- var end = 'end';
1552
- var clippingParents = 'clippingParents';
1553
- var viewport = 'viewport';
1554
- var popper = 'popper';
1555
- var reference = 'reference';
1556
- var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
1557
- return acc.concat([placement + "-" + start, placement + "-" + end]);
1558
- }, []);
1559
- var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
1560
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
1561
- }, []); // modifiers that need to read the DOM
1562
-
1563
- var beforeRead = 'beforeRead';
1564
- var read = 'read';
1565
- var afterRead = 'afterRead'; // pure-logic modifiers
1566
-
1567
- var beforeMain = 'beforeMain';
1568
- var main = 'main';
1569
- var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
2091
+ const CForm = vue.defineComponent({
2092
+ name: 'CForm',
2093
+ props: {
2094
+ /**
2095
+ * Mark a form as validated. If you set it `true`, all validation styles will be applied to the forms component.
2096
+ */
2097
+ validated: {
2098
+ type: Boolean,
2099
+ required: false,
2100
+ },
2101
+ },
2102
+ setup(props, { slots }) {
2103
+ return () => vue.h('form', { class: [{ ['was-validated']: props.validated }] }, slots.default && slots.default());
2104
+ },
2105
+ });
1570
2106
 
1571
- var beforeWrite = 'beforeWrite';
1572
- var write = 'write';
1573
- var afterWrite = 'afterWrite';
1574
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
2107
+ /*!
2108
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
2109
+ *
2110
+ * Copyright (c) 2014-2017, Jon Schlinkert.
2111
+ * Released under the MIT License.
2112
+ */
1575
2113
 
1576
- function getNodeName(element) {
1577
- return element ? (element.nodeName || '').toLowerCase() : null;
2114
+ function isObject(o) {
2115
+ return Object.prototype.toString.call(o) === '[object Object]';
1578
2116
  }
1579
2117
 
1580
- function getWindow(node) {
1581
- if (node == null) {
1582
- return window;
1583
- }
2118
+ function isPlainObject(o) {
2119
+ var ctor,prot;
1584
2120
 
1585
- if (node.toString() !== '[object Window]') {
1586
- var ownerDocument = node.ownerDocument;
1587
- return ownerDocument ? ownerDocument.defaultView || window : window;
1588
- }
2121
+ if (isObject(o) === false) return false;
1589
2122
 
1590
- return node;
1591
- }
2123
+ // If has modified constructor
2124
+ ctor = o.constructor;
2125
+ if (ctor === undefined) return true;
1592
2126
 
1593
- function isElement(node) {
1594
- var OwnElement = getWindow(node).Element;
1595
- return node instanceof OwnElement || node instanceof Element;
2127
+ // If has modified prototype
2128
+ prot = ctor.prototype;
2129
+ if (isObject(prot) === false) return false;
2130
+
2131
+ // If constructor does not have an Object-specific method
2132
+ if (prot.hasOwnProperty('isPrototypeOf') === false) {
2133
+ return false;
2134
+ }
2135
+
2136
+ // Most likely a plain Object
2137
+ return true;
2138
+ }
2139
+
2140
+ 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()){}
2141
+
2142
+ const CFormLabel = vue.defineComponent({
2143
+ name: 'CFormLabel',
2144
+ props: {
2145
+ /**
2146
+ * A string of all className you want to be applied to the component, and override standard className value.
2147
+ */
2148
+ customClassName: {
2149
+ type: [Array, String],
2150
+ default: undefined,
2151
+ required: false,
2152
+ },
2153
+ },
2154
+ setup(props, { slots }) {
2155
+ return () => vue.h('label', {
2156
+ class: props.customClassName ? props.customClassName : 'form-label',
2157
+ }, slots.default && slots.default());
2158
+ },
2159
+ });
2160
+
2161
+ const CFormCheck = vue.defineComponent({
2162
+ name: 'CFormCheck',
2163
+ inheritAttrs: false,
2164
+ props: {
2165
+ /**
2166
+ * Create button-like checkboxes and radio buttons.
2167
+ */
2168
+ button: I({
2169
+ /**
2170
+ * Sets the color context of the component to one of CoreUI’s themed colors.
2171
+ *
2172
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
2173
+ */
2174
+ color: Color,
2175
+ /**
2176
+ * Select the shape of the component.
2177
+ *
2178
+ * @values 'rounded', 'rounded-top', 'rounded-end', 'rounded-bottom', 'rounded-start', 'rounded-circle', 'rounded-pill', 'rounded-0', 'rounded-1', 'rounded-2', 'rounded-3'
2179
+ */
2180
+ shape: Shape,
2181
+ /**
2182
+ * Size the component small or large.
2183
+ *
2184
+ * @values 'sm' | 'lg'
2185
+ */
2186
+ size: {
2187
+ type: String,
2188
+ default: undefined,
2189
+ required: false,
2190
+ validator: (value) => {
2191
+ return ['sm', 'lg'].includes(value);
2192
+ },
2193
+ },
2194
+ /**
2195
+ * Set the button variant to an outlined button or a ghost button.
2196
+ */
2197
+ variant: {
2198
+ type: String,
2199
+ default: undefined,
2200
+ required: false,
2201
+ validator: (value) => {
2202
+ return ['outline', 'ghost'].includes(value);
2203
+ },
2204
+ },
2205
+ }),
2206
+ /**
2207
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document.
2208
+ */
2209
+ id: {
2210
+ type: String,
2211
+ default: undefined,
2212
+ required: false,
2213
+ },
2214
+ /**
2215
+ * Input Checkbox indeterminate Property
2216
+ */
2217
+ indeterminate: Boolean,
2218
+ /**
2219
+ * Group checkboxes or radios on the same horizontal row by adding.
2220
+ */
2221
+ inline: {
2222
+ type: Boolean,
2223
+ required: false,
2224
+ },
2225
+ /**
2226
+ * Set component validation state to invalid.
2227
+ */
2228
+ invalid: {
2229
+ type: Boolean,
2230
+ required: false,
2231
+ },
2232
+ /**
2233
+ * The element represents a caption for a component.
2234
+ */
2235
+ label: {
2236
+ type: String,
2237
+ default: undefined,
2238
+ required: false,
2239
+ },
2240
+ /**
2241
+ * The default name for a value passed using v-model.
2242
+ */
2243
+ modelValue: {
2244
+ type: [Boolean, String],
2245
+ value: undefined,
2246
+ required: false,
2247
+ },
2248
+ /**
2249
+ * Specifies the type of component.
2250
+ *
2251
+ * @values 'checkbox', 'radio'
2252
+ */
2253
+ type: {
2254
+ type: String,
2255
+ default: 'checkbox',
2256
+ required: false,
2257
+ },
2258
+ /**
2259
+ * Set component validation state to valid.
2260
+ */
2261
+ valid: {
2262
+ type: Boolean,
2263
+ required: false,
2264
+ },
2265
+ },
2266
+ emits: [
2267
+ /**
2268
+ * Event occurs when the checked value has been changed.
2269
+ */
2270
+ 'change',
2271
+ /**
2272
+ * Emit the new value whenever there’s a change event.
2273
+ */
2274
+ 'update:modelValue',
2275
+ ],
2276
+ setup(props, { attrs, emit, slots }) {
2277
+ const handleChange = (event) => {
2278
+ const target = event.target;
2279
+ emit('change', event);
2280
+ emit('update:modelValue', target.checked);
2281
+ };
2282
+ const formControl = () => {
2283
+ return vue.h('input', {
2284
+ ...attrs,
2285
+ checked: props.modelValue,
2286
+ class: [
2287
+ props.button ? 'btn-check' : 'form-check-input',
2288
+ {
2289
+ 'is-invalid': props.invalid,
2290
+ 'is-valid': props.valid,
2291
+ },
2292
+ ],
2293
+ id: props.id,
2294
+ indeterminate: props.indeterminate,
2295
+ onChange: (event) => handleChange(event),
2296
+ type: props.type,
2297
+ });
2298
+ };
2299
+ const formLabel = () => {
2300
+ return vue.h(CFormLabel, {
2301
+ customClassName: props.button
2302
+ ? [
2303
+ 'btn',
2304
+ props.button.variant
2305
+ ? `btn-${props.button.variant}-${props.button.color}`
2306
+ : `btn-${props.button.color}`,
2307
+ {
2308
+ [`btn-${props.button.size}`]: props.button.size,
2309
+ },
2310
+ `${props.button.shape}`,
2311
+ ]
2312
+ : 'form-check-label',
2313
+ ...(props.id && { for: props.id }),
2314
+ }, {
2315
+ default: () => (slots.label && slots.label()) || props.label,
2316
+ });
2317
+ };
2318
+ return () => props.button
2319
+ ? [formControl(), (slots.label || props.label) && formLabel()]
2320
+ : props.label
2321
+ ? vue.h('div', {
2322
+ class: [
2323
+ 'form-check',
2324
+ {
2325
+ 'form-check-inline': props.inline,
2326
+ 'is-invalid': props.invalid,
2327
+ 'is-valid': props.valid,
2328
+ },
2329
+ attrs.class,
2330
+ ],
2331
+ }, [formControl(), props.label && formLabel()])
2332
+ : formControl();
2333
+ },
2334
+ });
2335
+
2336
+ const CFormFeedback = vue.defineComponent({
2337
+ name: 'CFormFeedback',
2338
+ props: {
2339
+ /**
2340
+ * Component used for the root node. Either a string to use a HTML element or a component.
2341
+ */
2342
+ component: {
2343
+ type: String,
2344
+ required: false,
2345
+ default: 'div',
2346
+ },
2347
+ /**
2348
+ * Method called immediately after the `value` prop changes.
2349
+ */
2350
+ invalid: Boolean,
2351
+ /**
2352
+ * If your form layout allows it, you can display validation feedback in a styled tooltip.
2353
+ */
2354
+ tooltip: Boolean,
2355
+ /**
2356
+ * Set component validation state to valid.
2357
+ */
2358
+ valid: Boolean,
2359
+ },
2360
+ setup(props, { slots }) {
2361
+ return () => vue.h(props.component, {
2362
+ class: [
2363
+ {
2364
+ [`invalid-${props.tooltip ? 'tooltip' : 'feedback'}`]: props.invalid,
2365
+ [`valid-${props.tooltip ? 'tooltip' : 'feedback'}`]: props.valid,
2366
+ },
2367
+ ],
2368
+ }, slots.default && slots.default());
2369
+ },
2370
+ });
2371
+
2372
+ const CFormFloating = vue.defineComponent({
2373
+ name: 'CFormFloating',
2374
+ setup(_, { slots }) {
2375
+ return () => vue.h('div', {
2376
+ class: 'form-floating',
2377
+ }, slots.default && slots.default());
2378
+ },
2379
+ });
2380
+
2381
+ const CFormInput = vue.defineComponent({
2382
+ name: 'CFormInput',
2383
+ props: {
2384
+ /**
2385
+ * Toggle the disabled state for the component.
2386
+ */
2387
+ disabled: {
2388
+ type: Boolean,
2389
+ required: false,
2390
+ },
2391
+ /**
2392
+ * Set component validation state to invalid.
2393
+ */
2394
+ invalid: {
2395
+ type: Boolean,
2396
+ required: false,
2397
+ },
2398
+ /**
2399
+ * The default name for a value passed using v-model.
2400
+ */
2401
+ modelValue: {
2402
+ type: String,
2403
+ default: undefined,
2404
+ require: false,
2405
+ },
2406
+ /**
2407
+ * 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`.
2408
+ */
2409
+ plainText: {
2410
+ type: Boolean,
2411
+ required: false,
2412
+ },
2413
+ /**
2414
+ * Toggle the readonly state for the component.
2415
+ */
2416
+ readonly: {
2417
+ type: Boolean,
2418
+ required: false,
2419
+ },
2420
+ /**
2421
+ * Size the component small or large.
2422
+ *
2423
+ * @values 'sm' | 'lg'
2424
+ */
2425
+ size: {
2426
+ type: String,
2427
+ default: undefined,
2428
+ require: false,
2429
+ validator: (value) => {
2430
+ return ['sm', 'lg'].includes(value);
2431
+ },
2432
+ },
2433
+ /**
2434
+ * Specifies the type of component.
2435
+ *
2436
+ * @values 'color' | 'file' | 'text' | string
2437
+ */
2438
+ type: {
2439
+ type: String,
2440
+ default: 'text',
2441
+ require: false,
2442
+ },
2443
+ /**
2444
+ * Set component validation state to valid.
2445
+ */
2446
+ valid: {
2447
+ type: Boolean,
2448
+ required: false,
2449
+ },
2450
+ },
2451
+ emits: [
2452
+ /**
2453
+ * Event occurs when the element loses focus, after the content has been changed.
2454
+ */
2455
+ 'change',
2456
+ /**
2457
+ * Event occurs immediately after the value of a component has changed.
2458
+ */
2459
+ 'input',
2460
+ /**
2461
+ * Emit the new value whenever there’s an input or change event.
2462
+ */
2463
+ 'update:modelValue',
2464
+ ],
2465
+ setup(props, { emit, slots }) {
2466
+ const handleChange = (event) => {
2467
+ const target = event.target;
2468
+ emit('change', event);
2469
+ emit('update:modelValue', target.value);
2470
+ };
2471
+ const handleInput = (event) => {
2472
+ const target = event.target;
2473
+ emit('input', event);
2474
+ emit('update:modelValue', target.value);
2475
+ };
2476
+ return () => vue.h('input', {
2477
+ class: [
2478
+ props.plainText ? 'form-control-plaintext' : 'form-control',
2479
+ {
2480
+ 'form-control-color': props.type === 'color',
2481
+ [`form-control-${props.size}`]: props.size,
2482
+ 'is-invalid': props.invalid,
2483
+ 'is-valid': props.valid,
2484
+ },
2485
+ ],
2486
+ disabled: props.disabled,
2487
+ onChange: (event) => handleChange(event),
2488
+ onInput: (event) => handleInput(event),
2489
+ readonly: props.readonly,
2490
+ type: props.type,
2491
+ value: props.modelValue,
2492
+ }, slots.default && slots.default());
2493
+ },
2494
+ });
2495
+
2496
+ const CFormRange = vue.defineComponent({
2497
+ name: 'CFormRange',
2498
+ props: {
2499
+ /**
2500
+ * Toggle the disabled state for the component.
2501
+ */
2502
+ disabled: {
2503
+ type: Boolean,
2504
+ default: undefined,
2505
+ required: false,
2506
+ },
2507
+ /**
2508
+ * Specifies the maximum value for the component.
2509
+ */
2510
+ max: {
2511
+ type: Number,
2512
+ default: undefined,
2513
+ required: false,
2514
+ },
2515
+ /**
2516
+ * Specifies the minimum value for the component.
2517
+ */
2518
+ min: {
2519
+ type: Number,
2520
+ default: undefined,
2521
+ required: false,
2522
+ },
2523
+ /**
2524
+ * The default name for a value passed using v-model.
2525
+ */
2526
+ modelValue: {
2527
+ type: String,
2528
+ value: undefined,
2529
+ required: false,
2530
+ },
2531
+ /**
2532
+ * Toggle the readonly state for the component.
2533
+ */
2534
+ readonly: {
2535
+ type: Boolean,
2536
+ required: false,
2537
+ },
2538
+ /**
2539
+ * Specifies the interval between legal numbers in the component.
2540
+ */
2541
+ steps: {
2542
+ type: Number,
2543
+ default: undefined,
2544
+ required: false,
2545
+ },
2546
+ /**
2547
+ * The `value` attribute of component.
2548
+ *
2549
+ * @controllable onChange
2550
+ * */
2551
+ value: {
2552
+ type: Number,
2553
+ default: undefined,
2554
+ required: false,
2555
+ },
2556
+ },
2557
+ emits: [
2558
+ /**
2559
+ * Event occurs when the value has been changed.
2560
+ */
2561
+ 'change',
2562
+ /**
2563
+ * Emit the new value whenever there’s a change event.
2564
+ */
2565
+ 'update:modelValue',
2566
+ ],
2567
+ setup(props, { emit, slots }) {
2568
+ const handleChange = (event) => {
2569
+ const target = event.target;
2570
+ emit('change', event);
2571
+ emit('update:modelValue', target.value);
2572
+ };
2573
+ return () => vue.h('input', {
2574
+ class: 'form-range',
2575
+ disabled: props.disabled,
2576
+ max: props.max,
2577
+ min: props.min,
2578
+ onChange: (event) => handleChange(event),
2579
+ steps: props.steps,
2580
+ readonly: props.readonly,
2581
+ type: 'range',
2582
+ value: props.modelValue,
2583
+ }, slots.default && slots.default());
2584
+ },
2585
+ });
2586
+
2587
+ const CFormSelect = vue.defineComponent({
2588
+ name: 'CFormSelect',
2589
+ props: {
2590
+ /**
2591
+ * Specifies the number of visible options in a drop-down list.
2592
+ */
2593
+ htmlSize: {
2594
+ type: Number,
2595
+ default: undefined,
2596
+ required: false,
2597
+ },
2598
+ /**
2599
+ * Set component validation state to invalid.
2600
+ */
2601
+ invalid: {
2602
+ type: Boolean,
2603
+ required: false,
2604
+ },
2605
+ /**
2606
+ * The default name for a value passed using v-model.
2607
+ */
2608
+ modelValue: {
2609
+ type: [String, Array],
2610
+ default: undefined,
2611
+ require: false,
2612
+ },
2613
+ multiple: {
2614
+ type: Boolean,
2615
+ required: false,
2616
+ },
2617
+ /**
2618
+ * Options list of the select component. Available keys: `label`, `value`, `disabled`.
2619
+ * Examples:
2620
+ * - `:options="[{ value: 'js', label: 'JavaScript' }, { value: 'html', label: 'HTML', disabled: true }]"`
2621
+ * - `:options="['js', 'html']"`
2622
+ */
2623
+ options: {
2624
+ type: Array,
2625
+ default: undefined,
2626
+ required: false,
2627
+ },
2628
+ /**
2629
+ * Size the component small or large.
2630
+ *
2631
+ * @values 'sm' | 'lg'
2632
+ */
2633
+ size: {
2634
+ type: String,
2635
+ default: undefined,
2636
+ require: false,
2637
+ validator: (value) => {
2638
+ return ['sm', 'lg'].includes(value);
2639
+ },
2640
+ },
2641
+ /**
2642
+ * Set component validation state to valid.
2643
+ */
2644
+ valid: {
2645
+ type: Boolean,
2646
+ required: false,
2647
+ },
2648
+ },
2649
+ emits: [
2650
+ /**
2651
+ * Event occurs when when a user changes the selected option of a `<select>` element.
2652
+ */
2653
+ 'change',
2654
+ /**
2655
+ * Emit the new value whenever there’s a change event.
2656
+ */
2657
+ 'update:modelValue',
2658
+ ],
2659
+ setup(props, { emit, slots }) {
2660
+ const handleChange = (event) => {
2661
+ const target = event.target;
2662
+ const selected = Array.from(target.options)
2663
+ .filter((option) => option.selected)
2664
+ .map((option) => option.value);
2665
+ emit('change', event);
2666
+ emit('update:modelValue', target.multiple ? selected : selected[0]);
2667
+ };
2668
+ return () => vue.h('select', {
2669
+ class: [
2670
+ 'form-select',
2671
+ {
2672
+ [`form-select-${props.size}`]: props.size,
2673
+ 'is-invalid': props.invalid,
2674
+ 'is-valid': props.valid,
2675
+ },
2676
+ ],
2677
+ multiple: props.multiple,
2678
+ onChange: (event) => handleChange(event),
2679
+ size: props.htmlSize,
2680
+ ...(props.modelValue && !props.multiple && { value: props.modelValue }),
2681
+ }, props.options
2682
+ ? props.options.map((option) => {
2683
+ return vue.h('option', {
2684
+ ...(typeof option === 'object' && {
2685
+ ...(option.disabled && { disabled: option.disabled }),
2686
+ ...(option.selected && { selected: option.selected }),
2687
+ ...(option.value && {
2688
+ value: option.value,
2689
+ ...(props.modelValue &&
2690
+ props.multiple &&
2691
+ props.modelValue.includes(option.value) && { selected: true }),
2692
+ }),
2693
+ }),
2694
+ }, typeof option === 'string' ? option : option.label);
2695
+ })
2696
+ : slots.default && slots.default());
2697
+ },
2698
+ });
2699
+
2700
+ const CFormSwitch = vue.defineComponent({
2701
+ name: 'CFormSwitch',
2702
+ inheritAttrs: false,
2703
+ props: {
2704
+ /**
2705
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document
2706
+ */
2707
+ id: {
2708
+ type: String,
2709
+ default: undefined,
2710
+ required: false,
2711
+ },
2712
+ /**
2713
+ * Set component validation state to invalid.
2714
+ */
2715
+ invalid: {
2716
+ type: Boolean,
2717
+ required: false,
2718
+ },
2719
+ /**
2720
+ * The element represents a caption for a component.
2721
+ */
2722
+ label: {
2723
+ type: String,
2724
+ default: undefined,
2725
+ required: false,
2726
+ },
2727
+ /**
2728
+ * The default name for a value passed using v-model.
2729
+ */
2730
+ modelValue: {
2731
+ type: [Boolean, String],
2732
+ value: undefined,
2733
+ required: false,
2734
+ },
2735
+ /**
2736
+ * Size the component large or extra large. Works only with `switch`.
2737
+ *
2738
+ * @values 'lg' | 'xl'
2739
+ */
2740
+ size: {
2741
+ type: String,
2742
+ default: undefined,
2743
+ required: false,
2744
+ validator: (value) => {
2745
+ return ['lg', 'xl'].includes(value);
2746
+ },
2747
+ },
2748
+ /**
2749
+ * Specifies the type of component.
2750
+ *
2751
+ * @values 'checkbox', 'radio'
2752
+ */
2753
+ type: {
2754
+ type: String,
2755
+ default: 'checkbox',
2756
+ required: false,
2757
+ },
2758
+ /**
2759
+ * Set component validation state to valid.
2760
+ */
2761
+ valid: {
2762
+ type: Boolean,
2763
+ required: false,
2764
+ },
2765
+ },
2766
+ emits: [
2767
+ /**
2768
+ * Event occurs when the checked value has been changed.
2769
+ */
2770
+ 'change',
2771
+ /**
2772
+ * Emit the new value whenever there’s a change event.
2773
+ */
2774
+ 'update:modelValue',
2775
+ ],
2776
+ setup(props, { attrs, emit }) {
2777
+ const checked = vue.ref(attrs.checked);
2778
+ vue.watch(() => props.modelValue, () => {
2779
+ if (typeof props.modelValue === 'boolean')
2780
+ checked.value = props.modelValue;
2781
+ });
2782
+ const handleChange = (event) => {
2783
+ const target = event.target;
2784
+ emit('change', event);
2785
+ emit('update:modelValue', target.checked);
2786
+ };
2787
+ return () => vue.h('div', {
2788
+ class: [
2789
+ 'form-check form-switch',
2790
+ {
2791
+ [`form-switch-${props.size}`]: props.size,
2792
+ 'is-invalid': props.invalid,
2793
+ 'is-valid': props.valid,
2794
+ },
2795
+ ],
2796
+ }, [
2797
+ vue.h('input', {
2798
+ ...attrs,
2799
+ checked: checked.value,
2800
+ class: [
2801
+ 'form-check-input',
2802
+ {
2803
+ 'is-invalid': props.invalid,
2804
+ 'is-valid': props.valid,
2805
+ },
2806
+ ],
2807
+ id: props.id,
2808
+ onChange: (event) => handleChange(event),
2809
+ type: props.type,
2810
+ }),
2811
+ props.label &&
2812
+ vue.h(CFormLabel, {
2813
+ ...(props.id && { for: props.id }),
2814
+ class: 'form-check-label',
2815
+ }, {
2816
+ default: () => props.label,
2817
+ }),
2818
+ ]);
2819
+ },
2820
+ });
2821
+
2822
+ const CFormText = vue.defineComponent({
2823
+ name: 'CFormText',
2824
+ props: {
2825
+ /**
2826
+ * Component used for the root node. Either a string to use a HTML element or a component.
2827
+ */
2828
+ component: {
2829
+ type: String,
2830
+ required: false,
2831
+ default: 'div',
2832
+ },
2833
+ },
2834
+ setup(props, { slots }) {
2835
+ return () => vue.h(props.component, { class: 'form-text' }, slots.default && slots.default());
2836
+ },
2837
+ });
2838
+
2839
+ const CFormTextarea = vue.defineComponent({
2840
+ name: 'CFormTextarea',
2841
+ props: {
2842
+ /**
2843
+ * Toggle the disabled state for the component.
2844
+ */
2845
+ disabled: {
2846
+ type: Boolean,
2847
+ required: false,
2848
+ },
2849
+ /**
2850
+ * Set component validation state to invalid.
2851
+ */
2852
+ invalid: {
2853
+ type: Boolean,
2854
+ required: false,
2855
+ },
2856
+ /**
2857
+ * The default name for a value passed using v-model.
2858
+ */
2859
+ modelValue: {
2860
+ type: String,
2861
+ default: undefined,
2862
+ require: false,
2863
+ },
2864
+ /**
2865
+ * 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`.
2866
+ */
2867
+ plainText: {
2868
+ type: Boolean,
2869
+ required: false,
2870
+ },
2871
+ /**
2872
+ * Toggle the readonly state for the component.
2873
+ */
2874
+ readonly: {
2875
+ type: Boolean,
2876
+ required: false,
2877
+ },
2878
+ /**
2879
+ * Set component validation state to valid.
2880
+ */
2881
+ valid: {
2882
+ type: Boolean,
2883
+ required: false,
2884
+ },
2885
+ },
2886
+ emits: [
2887
+ /**
2888
+ * Event occurs when the element loses focus, after the content has been changed.
2889
+ */
2890
+ 'change',
2891
+ /**
2892
+ * Event occurs immediately after the value of a component has changed.
2893
+ */
2894
+ 'input',
2895
+ /**
2896
+ * Emit the new value whenever there’s an input or change event.
2897
+ */
2898
+ 'update:modelValue',
2899
+ ],
2900
+ setup(props, { emit, slots }) {
2901
+ const handleInput = (event) => {
2902
+ const target = event.target;
2903
+ emit('input', event);
2904
+ emit('update:modelValue', target.value);
2905
+ };
2906
+ return () => vue.h('textarea', {
2907
+ disabled: props.disabled,
2908
+ readonly: props.readonly,
2909
+ class: [
2910
+ props.plainText ? 'form-control-plaintext' : 'form-control',
2911
+ {
2912
+ 'is-invalid': props.invalid,
2913
+ 'is-valid': props.valid,
2914
+ },
2915
+ ],
2916
+ onInput: (event) => handleInput(event),
2917
+ value: props.modelValue,
2918
+ }, slots.default && slots.default());
2919
+ },
2920
+ });
2921
+
2922
+ const CInputGroup = vue.defineComponent({
2923
+ name: 'CInputGroup',
2924
+ props: {
2925
+ /**
2926
+ * Size the component small or large.
2927
+ *
2928
+ * @values 'sm', 'lg'
2929
+ */
2930
+ size: {
2931
+ type: String,
2932
+ default: undefined,
2933
+ required: false,
2934
+ validator: (value) => {
2935
+ return ['sm', 'lg'].includes(value);
2936
+ },
2937
+ },
2938
+ },
2939
+ setup(props, { slots }) {
2940
+ return () => vue.h('div', {
2941
+ class: [
2942
+ 'input-group',
2943
+ {
2944
+ [`input-group-${props.size}`]: props.size,
2945
+ },
2946
+ ],
2947
+ }, slots.default && slots.default());
2948
+ },
2949
+ });
2950
+
2951
+ const CInputGroupText = vue.defineComponent({
2952
+ name: 'CInputGroupText',
2953
+ props: {
2954
+ /**
2955
+ * Component used for the root node. Either a string to use a HTML element or a component.
2956
+ */
2957
+ component: {
2958
+ type: String,
2959
+ required: false,
2960
+ default: 'span',
2961
+ },
2962
+ },
2963
+ setup(props, { slots }) {
2964
+ return () => vue.h(props.component, { class: 'input-group-text' }, slots.default && slots.default());
2965
+ },
2966
+ });
2967
+
2968
+ const CFormPlugin = {
2969
+ install: (app) => {
2970
+ app.component(CForm.name, CForm);
2971
+ app.component(CFormCheck.name, CFormCheck);
2972
+ // app.component(CFormControl.name, CFormControl)
2973
+ app.component(CFormFeedback.name, CFormFeedback);
2974
+ app.component(CFormFloating.name, CFormFloating);
2975
+ app.component(CFormInput.name, CFormInput);
2976
+ app.component(CFormLabel.name, CFormLabel);
2977
+ app.component(CFormRange.name, CFormRange);
2978
+ app.component(CFormSelect.name, CFormSelect);
2979
+ app.component(CFormSwitch.name, CFormSwitch);
2980
+ app.component(CFormText.name, CFormText);
2981
+ app.component(CFormTextarea.name, CFormTextarea);
2982
+ app.component(CInputGroup.name, CInputGroup);
2983
+ app.component(CInputGroupText.name, CInputGroupText);
2984
+ },
2985
+ };
2986
+
2987
+ var top = 'top';
2988
+ var bottom = 'bottom';
2989
+ var right = 'right';
2990
+ var left = 'left';
2991
+ var auto = 'auto';
2992
+ var basePlacements = [top, bottom, right, left];
2993
+ var start = 'start';
2994
+ var end = 'end';
2995
+ var clippingParents = 'clippingParents';
2996
+ var viewport = 'viewport';
2997
+ var popper = 'popper';
2998
+ var reference = 'reference';
2999
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
3000
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
3001
+ }, []);
3002
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
3003
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
3004
+ }, []); // modifiers that need to read the DOM
3005
+
3006
+ var beforeRead = 'beforeRead';
3007
+ var read = 'read';
3008
+ var afterRead = 'afterRead'; // pure-logic modifiers
3009
+
3010
+ var beforeMain = 'beforeMain';
3011
+ var main = 'main';
3012
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
3013
+
3014
+ var beforeWrite = 'beforeWrite';
3015
+ var write = 'write';
3016
+ var afterWrite = 'afterWrite';
3017
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
3018
+
3019
+ function getNodeName(element) {
3020
+ return element ? (element.nodeName || '').toLowerCase() : null;
3021
+ }
3022
+
3023
+ function getWindow(node) {
3024
+ if (node == null) {
3025
+ return window;
3026
+ }
3027
+
3028
+ if (node.toString() !== '[object Window]') {
3029
+ var ownerDocument = node.ownerDocument;
3030
+ return ownerDocument ? ownerDocument.defaultView || window : window;
3031
+ }
3032
+
3033
+ return node;
3034
+ }
3035
+
3036
+ function isElement(node) {
3037
+ var OwnElement = getWindow(node).Element;
3038
+ return node instanceof OwnElement || node instanceof Element;
1596
3039
  }
1597
3040
 
1598
3041
  function isHTMLElement(node) {
@@ -3840,7 +5283,7 @@ const CDropdownMenu = vue.defineComponent({
3840
5283
  if (autoClose === false) {
3841
5284
  return;
3842
5285
  }
3843
- if (!dropdownMenuRef.value?.contains(event.target)) {
5286
+ if (event.key === 'Escape') {
3844
5287
  hideMenu();
3845
5288
  }
3846
5289
  };
@@ -3992,14 +5435,27 @@ const CDropdownToggle = vue.defineComponent({
3992
5435
  },
3993
5436
  ];
3994
5437
  const triggers = {
3995
- ...((props.trigger === 'click' || props.trigger.includes('click')) &&
3996
- !props.disabled && {
3997
- onClick: () => toggleMenu(),
5438
+ ...((props.trigger === 'click' || props.trigger.includes('click')) && {
5439
+ onClick: () => {
5440
+ if (props.disabled) {
5441
+ return;
5442
+ }
5443
+ toggleMenu();
5444
+ },
3998
5445
  }),
3999
- ...((props.trigger === 'focus' || props.trigger.includes('focus')) &&
4000
- !props.disabled && {
4001
- onfocus: () => toggleMenu(true),
4002
- onblur: () => toggleMenu(false),
5446
+ ...((props.trigger === 'focus' || props.trigger.includes('focus')) && {
5447
+ onfocus: () => {
5448
+ if (props.disabled) {
5449
+ return;
5450
+ }
5451
+ toggleMenu(true);
5452
+ },
5453
+ onblur: () => {
5454
+ if (props.disabled) {
5455
+ return;
5456
+ }
5457
+ toggleMenu(false);
5458
+ },
4003
5459
  }),
4004
5460
  };
4005
5461
  vue.onMounted(() => {
@@ -4065,1097 +5521,1630 @@ const CDropdownPlugin = {
4065
5521
  },
4066
5522
  };
4067
5523
 
4068
- const CSpinner = vue.defineComponent({
4069
- name: 'CSpinner',
5524
+ const CPicker = vue.defineComponent({
5525
+ name: 'CPicker',
4070
5526
  props: {
5527
+ ...CDropdown.props,
4071
5528
  /**
4072
- * Sets the color context of the component to one of CoreUI’s themed colors.
5529
+ * Toggle visibility or set the content of cancel button.
5530
+ */
5531
+ cancelButton: {
5532
+ type: [Boolean, String],
5533
+ default: 'Cancel',
5534
+ },
5535
+ /**
5536
+ * Sets the color context of the cancel button to one of CoreUI’s themed colors.
4073
5537
  *
4074
5538
  * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4075
5539
  */
4076
- color: {
5540
+ cancelButtonColor: {
5541
+ ...Color,
5542
+ default: 'primary',
5543
+ },
5544
+ /**
5545
+ * Size the cancel button small or large.
5546
+ *
5547
+ * @values 'sm', 'lg'
5548
+ */
5549
+ cancelButtonSize: {
4077
5550
  type: String,
4078
- default: undefined,
4079
- required: false,
5551
+ default: 'sm',
4080
5552
  validator: (value) => {
4081
- return [
4082
- 'primary',
4083
- 'secondary',
4084
- 'success',
4085
- 'danger',
4086
- 'warning',
4087
- 'info',
4088
- 'dark',
4089
- 'light',
4090
- ].includes(value);
5553
+ return ['sm', 'lg'].includes(value);
4091
5554
  },
4092
5555
  },
4093
5556
  /**
4094
- * Component used for the root node. Either a string to use a HTML element or a component.
5557
+ * Set the cancel button variant to an outlined button or a ghost button.
5558
+ *
5559
+ * @values 'ghost', 'outline'
4095
5560
  */
4096
- component: {
5561
+ cancelButtonVariant: {
4097
5562
  type: String,
4098
- default: 'div',
4099
- required: false,
5563
+ default: 'ghost',
5564
+ validator: (value) => {
5565
+ return ['ghost', 'outline'].includes(value);
5566
+ },
4100
5567
  },
4101
5568
  /**
4102
- * Size the component small.
5569
+ * Toggle visibility or set the content of confirm button.
5570
+ */
5571
+ confirmButton: {
5572
+ type: [Boolean, String],
5573
+ default: 'OK',
5574
+ },
5575
+ /**
5576
+ * Sets the color context of the confirm button to one of CoreUI’s themed colors.
4103
5577
  *
4104
- * @values 'sm'
5578
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4105
5579
  */
4106
- size: {
5580
+ confirmButtonColor: {
5581
+ ...Color,
5582
+ default: 'primary',
5583
+ },
5584
+ /**
5585
+ * Size the confirm button small or large.
5586
+ *
5587
+ * @values 'sm', 'lg'
5588
+ */
5589
+ confirmButtonSize: {
4107
5590
  type: String,
4108
- default: undefined,
4109
- required: false,
5591
+ default: 'sm',
4110
5592
  validator: (value) => {
4111
- return value === 'sm';
5593
+ return ['sm', 'lg'].includes(value);
4112
5594
  },
4113
5595
  },
4114
5596
  /**
4115
- * Set the button variant to an outlined button or a ghost button.
5597
+ * Set the confirm button variant to an outlined button or a ghost button.
4116
5598
  *
4117
- * @values 'border', 'grow'
5599
+ * @values 'ghost', 'outline'
4118
5600
  */
4119
- variant: {
5601
+ confirmButtonVariant: {
4120
5602
  type: String,
4121
- default: 'border',
4122
- required: false,
4123
5603
  validator: (value) => {
4124
- return ['border', 'grow'].includes(value);
5604
+ return ['ghost', 'outline'].includes(value);
4125
5605
  },
4126
5606
  },
4127
5607
  /**
4128
- * Set visually hidden label for accessibility purposes.
5608
+ * Set container type for the component.
4129
5609
  */
4130
- visuallyHiddenLabel: {
5610
+ container: {
4131
5611
  type: String,
4132
- default: 'Loading...',
4133
- required: false,
5612
+ default: 'dropdown',
4134
5613
  },
5614
+ /**
5615
+ * Toggle the disabled state for the component.
5616
+ */
5617
+ disabled: Boolean,
5618
+ /**
5619
+ * Toggle visibility of footer element or set the content of footer.
5620
+ */
5621
+ footer: Boolean,
5622
+ /**
5623
+ * Toggle the visibility of the component.
5624
+ */
5625
+ visible: Boolean,
4135
5626
  },
4136
- setup(props) {
4137
- return () => vue.h(props.component, {
4138
- class: [
4139
- `spinner-${props.variant}`,
4140
- `text-${props.color}`,
4141
- props.size && `spinner-${props.variant}-${props.size}`,
4142
- ],
4143
- role: 'status',
4144
- }, vue.h('span', { class: ['visually-hidden'] }, props.visuallyHiddenLabel));
5627
+ emits: [
5628
+ /**
5629
+ * Callback fired when the cancel button has been clicked.
5630
+ */
5631
+ 'cancel',
5632
+ /**
5633
+ * Callback fired when the confirm button has been clicked.
5634
+ */
5635
+ 'confirm',
5636
+ /**
5637
+ * Callback fired when the component requests to be hidden.
5638
+ */
5639
+ 'hide',
5640
+ /**
5641
+ * Callback fired when the component requests to be shown.
5642
+ */
5643
+ 'show',
5644
+ ],
5645
+ setup(props, { emit, slots }) {
5646
+ const visible = vue.ref(props.visible);
5647
+ vue.watch(() => props.visible, () => {
5648
+ visible.value = props.visible;
5649
+ });
5650
+ const handleConfirm = () => {
5651
+ emit('confirm');
5652
+ visible.value = false;
5653
+ };
5654
+ const Footer = () => vue.h('div', { class: 'picker-footer' }, [
5655
+ props.cancelButton &&
5656
+ vue.h(CButton, {
5657
+ color: props.cancelButtonColor,
5658
+ onClick: () => emit('cancel'),
5659
+ size: props.cancelButtonSize,
5660
+ variant: props.cancelButtonVariant,
5661
+ },
5662
+ /**
5663
+ * @slot Location for the cancel button content.
5664
+ */
5665
+ () => (slots.cancelButton ? slots.cancelButton() : props.cancelButton)),
5666
+ props.confirmButton &&
5667
+ vue.h(CButton, {
5668
+ color: props.confirmButtonColor,
5669
+ onClick: handleConfirm,
5670
+ size: props.confirmButtonSize,
5671
+ variant: props.confirmButtonVariant,
5672
+ },
5673
+ /**
5674
+ * @slot Location for the confirm button content.
5675
+ */
5676
+ () => (slots.confirmButton ? slots.confirmButton() : props.confirmButton)),
5677
+ ]);
5678
+ switch (props.container) {
5679
+ case 'inline':
5680
+ return () => vue.h('div', { class: 'picker' }, slots.default && slots.default());
5681
+ default:
5682
+ return () => vue.h(CDropdown, {
5683
+ autoClose: 'outside',
5684
+ class: 'picker',
5685
+ onHide: () => {
5686
+ visible.value = false;
5687
+ emit('hide');
5688
+ },
5689
+ onShow: () => {
5690
+ visible.value = true;
5691
+ emit('show');
5692
+ },
5693
+ variant: 'dropdown',
5694
+ visible: visible.value,
5695
+ }, () => [
5696
+ vue.h(CDropdownToggle, {
5697
+ custom: true,
5698
+ disabled: visible.value || props.disabled,
5699
+ }, {
5700
+ /**
5701
+ * @slot Location for the toggler element.
5702
+ */
5703
+ default: () => slots.toggler && slots.toggler(),
5704
+ }),
5705
+ vue.h(CDropdownMenu, {}, () => [
5706
+ slots.default && slots.default(),
5707
+ props.footer && Footer(),
5708
+ ]),
5709
+ ]);
5710
+ }
5711
+ },
5712
+ });
5713
+
5714
+ const CPickerPlugin = {
5715
+ install: (app) => {
5716
+ app.component(CPicker.name, CPicker);
5717
+ },
5718
+ };
5719
+
5720
+ const CTimePickerRollCol = vue.defineComponent({
5721
+ name: 'CTimePickerRollCol',
5722
+ props: {
5723
+ elements: {
5724
+ type: Array,
5725
+ required: true,
5726
+ },
5727
+ selected: {
5728
+ type: [Number, String],
5729
+ },
5730
+ },
5731
+ emits: ['click'],
5732
+ setup(props, { emit }) {
5733
+ const init = vue.ref(true);
5734
+ const colRef = vue.ref();
5735
+ vue.onUpdated(() => {
5736
+ const nodeEl = colRef.value?.querySelector('.selected');
5737
+ if (nodeEl && nodeEl instanceof HTMLElement) {
5738
+ colRef.value?.scrollTo({
5739
+ top: nodeEl.offsetTop,
5740
+ behavior: init.value ? 'auto' : 'smooth',
5741
+ });
5742
+ }
5743
+ init.value = false;
5744
+ });
5745
+ return () => vue.h('div', { class: 'time-picker-roll-col', ref: colRef }, props.elements.map((element) => {
5746
+ return vue.h('div', {
5747
+ class: [
5748
+ 'time-picker-roll-cell',
5749
+ {
5750
+ selected: element.value === props.selected,
5751
+ },
5752
+ ],
5753
+ onClick: () => emit('click', element.value),
5754
+ role: 'button',
5755
+ }, element.label);
5756
+ }));
4145
5757
  },
4146
5758
  });
4147
5759
 
4148
- const CSpinnerPlugin = {
4149
- install: (app) => {
4150
- app.component(CSpinner.name, CSpinner);
4151
- },
5760
+ const convert12hTo24h = (abbr, hour) => {
5761
+ if (abbr === 'am' && hour === 12) {
5762
+ return 0;
5763
+ }
5764
+ if (abbr === 'am') {
5765
+ return hour;
5766
+ }
5767
+ if (abbr === 'pm' && hour === 12) {
5768
+ return 12;
5769
+ }
5770
+ return hour + 12;
5771
+ };
5772
+ const convert24hTo12h = (hour) => hour % 12 || 12;
5773
+ const convertTimeToDate = (time) => time ? (time instanceof Date ? new Date(time) : new Date(`1970-01-01 ${time}`)) : null;
5774
+ const getAmPm = (date, locale) => {
5775
+ if (date.toLocaleTimeString(locale).includes('AM')) {
5776
+ return 'am';
5777
+ }
5778
+ if (date.toLocaleTimeString(locale).includes('PM')) {
5779
+ return 'pm';
5780
+ }
5781
+ return date.getHours() >= 12 ? 'pm' : 'am';
5782
+ };
5783
+ const getListOfHours = (locale) => Array.from({ length: isAmPm(locale) ? 12 : 24 }, (_, i) => {
5784
+ return {
5785
+ value: isAmPm(locale) ? i + 1 : i,
5786
+ label: (isAmPm(locale) ? i + 1 : i).toLocaleString(locale),
5787
+ };
5788
+ });
5789
+ const getMinutesOrSeconds = (locale) => Array.from({ length: 60 }, (_, i) => {
5790
+ return {
5791
+ value: i,
5792
+ label: i.toLocaleString(locale).padStart(2, (0).toLocaleString(locale)),
5793
+ };
5794
+ });
5795
+ const getSelectedHour = (date, locale) => date ? (isAmPm(locale) ? convert24hTo12h(date.getHours()) : date.getHours()) : '';
5796
+ const getSelectedMinutes = (date) => (date ? date.getMinutes() : '');
5797
+ const getSelectedSeconds = (date) => (date ? date.getSeconds() : '');
5798
+ const isAmPm = (locale) => ['am', 'AM', 'pm', 'PM'].some((el) => new Date().toLocaleString(locale).includes(el));
5799
+ const isValidTime = (time) => {
5800
+ const d = new Date(`1970-01-01 ${time}`);
5801
+ return d instanceof Date && d.getTime();
4152
5802
  };
4153
5803
 
4154
- const CElementCover = vue.defineComponent({
4155
- name: 'CElementCover',
5804
+ const CTimePicker = vue.defineComponent({
5805
+ name: 'CTimePicker',
4156
5806
  props: {
5807
+ ...CPicker.props,
4157
5808
  /**
4158
- * 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:
4159
- * - sides (array) - select boundaries of element to define boundaries. Sides names: 'top', 'bottom', 'right', 'left'.
4160
- * - query (string) - query used to get element which define boundaries. Search will be done only inside parent element, by parent.querySelector(query) function. [docs]
4161
- *
4162
- * @type {sides: string[], query: string}[]
5809
+ * Toggle visibility or set the content of cancel button.
4163
5810
  */
4164
- boundaries: {
4165
- // TODO: check if this is correct, TJ
4166
- type: Array,
4167
- require: true,
5811
+ cancelButton: {
5812
+ type: [Boolean, String],
5813
+ default: 'Cancel',
4168
5814
  },
4169
5815
  /**
4170
- * Opacity of the cover. [docs]
5816
+ * Sets the color context of the cancel button to one of CoreUI’s themed colors.
4171
5817
  *
4172
- * @type number
5818
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4173
5819
  */
4174
- opacity: {
4175
- type: Number,
4176
- require: false,
5820
+ cancelButtonColor: {
5821
+ ...Color,
5822
+ default: 'primary',
4177
5823
  },
4178
- },
4179
- setup(props) {
4180
- let containerCoords = {};
4181
- const elementRef = vue.ref();
4182
- const getCustomBoundaries = () => {
4183
- if (!props.boundaries || elementRef === null) {
4184
- return {};
4185
- }
4186
- const parent = elementRef.value.parentElement;
4187
- if (!parent) {
4188
- return {};
4189
- }
4190
- const parentCoords = parent.getBoundingClientRect();
4191
- const customBoundaries = {};
4192
- props.boundaries.forEach((value) => {
4193
- const element = parent.querySelector(value.query);
4194
- if (!element || !value.sides) {
4195
- return;
4196
- }
4197
- const coords = element.getBoundingClientRect();
4198
- value.sides.forEach((side) => {
4199
- const sideMargin = Math.abs(coords[side] - parentCoords[side]);
4200
- customBoundaries[side] = `${sideMargin}px`;
4201
- });
4202
- });
4203
- return customBoundaries;
4204
- };
4205
- vue.onMounted(function () {
4206
- vue.nextTick(function () {
4207
- containerCoords = getCustomBoundaries();
4208
- });
4209
- });
4210
- return () => vue.h('div', {
4211
- style: {
4212
- ...containerCoords,
4213
- position: 'absolute',
4214
- 'background-color': `rgb(255,255,255,${props.opacity})`,
4215
- },
4216
- ref: elementRef,
4217
- }, vue.h('div', // TODO: use slot to override this
4218
- {
4219
- style: {
4220
- position: 'absolute',
4221
- top: '50%',
4222
- left: '50%',
4223
- transform: 'translateX(-50%) translateY(-50%)',
5824
+ /**
5825
+ * Size the cancel button small or large.
5826
+ *
5827
+ * @values 'sm', 'lg'
5828
+ */
5829
+ cancelButtonSize: {
5830
+ type: String,
5831
+ default: 'sm',
5832
+ validator: (value) => {
5833
+ return ['sm', 'lg'].includes(value);
4224
5834
  },
4225
- }, vue.h(CSpinner, {
4226
- variant: 'grow',
4227
- color: 'primary',
4228
- })));
4229
- },
4230
- });
4231
-
4232
- const CElementCoverPlugin = {
4233
- install: (app) => {
4234
- app.component(CElementCover.name, CElementCover);
4235
- },
4236
- };
4237
-
4238
- const CFooter = vue.defineComponent({
4239
- name: 'CFooter',
4240
- props: {
5835
+ },
4241
5836
  /**
4242
- * Place footer in non-static positions.
5837
+ * Set the cancel button variant to an outlined button or a ghost button.
4243
5838
  *
4244
- * @values 'fixed', 'sticky'
5839
+ * @values 'ghost', 'outline'
4245
5840
  */
4246
- position: {
5841
+ cancelButtonVariant: {
4247
5842
  type: String,
4248
- default: undefined,
4249
- required: false,
5843
+ default: 'ghost',
4250
5844
  validator: (value) => {
4251
- return ['fixed', 'sticky'].includes(value);
5845
+ return ['ghost', 'outline'].includes(value);
4252
5846
  },
4253
5847
  },
4254
- },
4255
- setup(props, { slots }) {
4256
- return () => vue.h('div', { class: ['footer', { [`footer-${props.position}`]: props.position }] }, slots.default && slots.default());
4257
- },
4258
- });
4259
-
4260
- const CFooterPlugin = {
4261
- install: (app) => {
4262
- app.component(CFooter.name, CFooter);
4263
- },
4264
- };
4265
-
4266
- const CForm = vue.defineComponent({
4267
- name: 'CForm',
4268
- props: {
4269
5848
  /**
4270
- * Mark a form as validated. If you set it `true`, all validation styles will be applied to the forms component.
5849
+ * Toggle visibility of the cleaner button.
4271
5850
  */
4272
- validated: {
5851
+ cleaner: {
4273
5852
  type: Boolean,
4274
- required: false,
5853
+ default: true,
4275
5854
  },
4276
- },
4277
- setup(props, { slots }) {
4278
- return () => vue.h('form', { class: [{ ['was-validated']: props.validated }] }, slots.default && slots.default());
4279
- },
4280
- });
4281
-
4282
- /*!
4283
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
4284
- *
4285
- * Copyright (c) 2014-2017, Jon Schlinkert.
4286
- * Released under the MIT License.
4287
- */
4288
-
4289
- function isObject(o) {
4290
- return Object.prototype.toString.call(o) === '[object Object]';
4291
- }
4292
-
4293
- function isPlainObject(o) {
4294
- var ctor,prot;
4295
-
4296
- if (isObject(o) === false) return false;
4297
-
4298
- // If has modified constructor
4299
- ctor = o.constructor;
4300
- if (ctor === undefined) return true;
4301
-
4302
- // If has modified prototype
4303
- prot = ctor.prototype;
4304
- if (isObject(prot) === false) return false;
4305
-
4306
- // If constructor does not have an Object-specific method
4307
- if (prot.hasOwnProperty('isPrototypeOf') === false) {
4308
- return false;
4309
- }
4310
-
4311
- // Most likely a plain Object
4312
- return true;
4313
- }
4314
-
4315
- 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()){}
4316
-
4317
- const CFormLabel = vue.defineComponent({
4318
- name: 'CFormLabel',
4319
- props: {
4320
5855
  /**
4321
- * A string of all className you want to be applied to the component, and override standard className value.
5856
+ * Toggle visibility or set the content of confirm button.
4322
5857
  */
4323
- customClassName: {
4324
- type: [Array, String],
4325
- default: undefined,
4326
- required: false,
5858
+ confirmButton: {
5859
+ type: [Boolean, String],
5860
+ default: 'OK',
4327
5861
  },
4328
- },
4329
- setup(props, { slots }) {
4330
- return () => vue.h('label', {
4331
- class: props.customClassName ? props.customClassName : 'form-label',
4332
- }, slots.default && slots.default());
4333
- },
4334
- });
4335
-
4336
- const CFormCheck = vue.defineComponent({
4337
- name: 'CFormCheck',
4338
- inheritAttrs: false,
4339
- props: {
4340
5862
  /**
4341
- * Create button-like checkboxes and radio buttons.
5863
+ * Sets the color context of the confirm button to one of CoreUI’s themed colors.
5864
+ *
5865
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4342
5866
  */
4343
- button: I({
4344
- /**
4345
- * Sets the color context of the component to one of CoreUI’s themed colors.
4346
- *
4347
- * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4348
- */
4349
- color: Color,
4350
- /**
4351
- * Select the shape of the component.
4352
- *
4353
- * @values 'rounded', 'rounded-top', 'rounded-end', 'rounded-bottom', 'rounded-start', 'rounded-circle', 'rounded-pill', 'rounded-0', 'rounded-1', 'rounded-2', 'rounded-3'
4354
- */
4355
- shape: Shape,
4356
- /**
4357
- * Size the component small or large.
4358
- *
4359
- * @values 'sm' | 'lg'
4360
- */
4361
- size: {
4362
- type: String,
4363
- default: undefined,
4364
- required: false,
4365
- validator: (value) => {
4366
- return ['sm', 'lg'].includes(value);
4367
- },
4368
- },
4369
- /**
4370
- * Set the button variant to an outlined button or a ghost button.
4371
- */
4372
- variant: {
4373
- type: String,
4374
- default: undefined,
4375
- required: false,
4376
- validator: (value) => {
4377
- return ['outline', 'ghost'].includes(value);
4378
- },
5867
+ confirmButtonColor: {
5868
+ ...Color,
5869
+ default: 'primary',
5870
+ },
5871
+ /**
5872
+ * Size the confirm button small or large.
5873
+ *
5874
+ * @values 'sm', 'lg'
5875
+ */
5876
+ confirmButtonSize: {
5877
+ type: String,
5878
+ default: 'sm',
5879
+ validator: (value) => {
5880
+ return ['sm', 'lg'].includes(value);
4379
5881
  },
4380
- }),
5882
+ },
4381
5883
  /**
4382
- * The id global attribute defines an identifier (ID) that must be unique in the whole document.
5884
+ * Set the confirm button variant to an outlined button or a ghost button.
5885
+ *
5886
+ * @values 'ghost', 'outline'
4383
5887
  */
4384
- id: {
5888
+ confirmButtonVariant: {
4385
5889
  type: String,
4386
- default: undefined,
4387
- required: false,
5890
+ validator: (value) => {
5891
+ return ['ghost', 'outline'].includes(value);
5892
+ },
5893
+ },
5894
+ /**
5895
+ * Toggle visibility or set the content of the input indicator.
5896
+ */
5897
+ indicator: {
5898
+ type: Boolean,
5899
+ default: true,
4388
5900
  },
4389
5901
  /**
4390
- * Input Checkbox indeterminate Property
5902
+ * Toggle the readonly state for the component.
4391
5903
  */
4392
- indeterminate: Boolean,
5904
+ inputReadOnly: Boolean,
4393
5905
  /**
4394
- * Group checkboxes or radios on the same horizontal row by adding.
5906
+ * Sets the default locale for components. If not set, it is inherited from the navigator.language.
4395
5907
  */
4396
- inline: {
4397
- type: Boolean,
4398
- required: false,
5908
+ locale: {
5909
+ type: String,
5910
+ defalut: 'default',
4399
5911
  },
4400
5912
  /**
4401
- * Set component validation state to invalid.
5913
+ * Specifies a short hint that is visible in the input.
4402
5914
  */
4403
- invalid: {
4404
- type: Boolean,
4405
- required: false,
5915
+ placeholder: {
5916
+ type: String,
5917
+ default: 'Select time',
4406
5918
  },
4407
5919
  /**
4408
- * The element represents a caption for a component.
5920
+ * Size the component small or large.
5921
+ *
5922
+ * @values 'sm', 'lg'
4409
5923
  */
4410
- label: {
5924
+ size: {
4411
5925
  type: String,
4412
5926
  default: undefined,
4413
- required: false,
5927
+ validator: (value) => {
5928
+ return ['sm', 'lg'].includes(value);
5929
+ },
4414
5930
  },
4415
5931
  /**
4416
- * The default name for a value passed using v-model.
5932
+ * Initial selected time.
4417
5933
  */
4418
- modelValue: {
4419
- type: [Boolean, String],
4420
- value: undefined,
4421
- required: false,
5934
+ time: {
5935
+ type: [Date, String],
4422
5936
  },
4423
5937
  /**
4424
- * Specifies the type of component.
5938
+ * Set the time picker variant to a roll or select.
4425
5939
  *
4426
- * @values 'checkbox', 'radio'
5940
+ * @values 'roll', 'select'
4427
5941
  */
4428
- type: {
5942
+ variant: {
4429
5943
  type: String,
4430
- default: 'checkbox',
4431
- required: false,
4432
- },
4433
- /**
4434
- * Set component validation state to valid.
4435
- */
4436
- valid: {
4437
- type: Boolean,
4438
- required: false,
5944
+ default: 'roll',
5945
+ validator: (value) => {
5946
+ return ['roll', 'select'].includes(value);
5947
+ },
4439
5948
  },
4440
5949
  },
4441
5950
  emits: [
4442
5951
  /**
4443
- * Event occurs when the checked value has been changed.
5952
+ * Callback fired when the time changed.
4444
5953
  */
4445
5954
  'change',
4446
5955
  /**
4447
- * Emit the new value whenever there’s a change event.
5956
+ * Callback fired when the component requests to be hidden.
4448
5957
  */
4449
- 'update:modelValue',
5958
+ 'hide',
5959
+ /**
5960
+ * Callback fired when the component requests to be shown.
5961
+ */
5962
+ 'show',
4450
5963
  ],
4451
- setup(props, { attrs, emit, slots }) {
4452
- const handleChange = (event) => {
4453
- const target = event.target;
4454
- emit('change', event);
4455
- emit('update:modelValue', target.checked);
5964
+ setup(props, { emit, slots }) {
5965
+ const date = vue.ref(convertTimeToDate(props.time));
5966
+ const initialDate = vue.ref(null);
5967
+ const ampm = vue.ref(date.value ? getAmPm(new Date(date.value), props.locale) : 'am');
5968
+ vue.watch(() => props.time, () => {
5969
+ date.value = convertTimeToDate(props.time);
5970
+ });
5971
+ vue.watch(date, () => {
5972
+ if (date.value) {
5973
+ ampm.value = getAmPm(new Date(date.value), props.locale);
5974
+ }
5975
+ });
5976
+ const handleClear = (event) => {
5977
+ event.stopPropagation();
5978
+ date.value = null;
5979
+ };
5980
+ const handleTimeChange = (set, value) => {
5981
+ const _date = date.value || new Date('1970-01-01');
5982
+ if (set === 'toggle') {
5983
+ if (value === 'am') {
5984
+ _date.setHours(_date.getHours() - 12);
5985
+ }
5986
+ if (value === 'pm') {
5987
+ _date.setHours(_date.getHours() + 12);
5988
+ }
5989
+ }
5990
+ if (set === 'hours') {
5991
+ if (isAmPm(props.locale)) {
5992
+ _date.setHours(convert12hTo24h(ampm.value, parseInt(value)));
5993
+ }
5994
+ else {
5995
+ _date.setHours(parseInt(value));
5996
+ }
5997
+ }
5998
+ if (set === 'minutes') {
5999
+ _date.setMinutes(parseInt(value));
6000
+ }
6001
+ if (set === 'seconds') {
6002
+ _date.setSeconds(parseInt(value));
6003
+ }
6004
+ date.value = new Date(_date);
6005
+ emit('change', _date.toTimeString(), _date.toLocaleTimeString(), _date);
4456
6006
  };
4457
- const formControl = () => {
4458
- return vue.h('input', {
4459
- ...attrs,
4460
- checked: props.modelValue,
6007
+ const InputGroup = () => vue.h(CInputGroup, { class: 'picker-input-group', size: props.size }, () => [
6008
+ vue.h(CFormInput, {
6009
+ disabled: props.disabled,
6010
+ onInput: (event) => {
6011
+ if (isValidTime(event.target.value)) {
6012
+ date.value = convertTimeToDate(event.target.value);
6013
+ }
6014
+ },
6015
+ placeholder: props.placeholder,
6016
+ readonly: props.inputReadOnly,
6017
+ value: date.value ? date.value.toLocaleTimeString(props.locale) : '',
6018
+ }),
6019
+ (props.indicator || props.cleaner) &&
6020
+ vue.h(CInputGroupText, {}, () => [
6021
+ props.indicator &&
6022
+ vue.h('span', {
6023
+ class: 'picker-input-group-indicator',
6024
+ }, slots.indicator
6025
+ ? slots.indicator()
6026
+ : vue.h('span', { class: 'picker-input-group-icon time-picker-input-icon' })),
6027
+ props.cleaner &&
6028
+ vue.h('span', {
6029
+ class: 'picker-input-group-cleaner',
6030
+ onClick: (event) => handleClear(event),
6031
+ role: 'button',
6032
+ }, slots.cleaner
6033
+ ? slots.cleaner()
6034
+ : vue.h('span', { class: 'picker-input-group-icon time-picker-cleaner-icon' })),
6035
+ ]),
6036
+ ]);
6037
+ const TimePickerSelect = () => [
6038
+ vue.h('span', { class: 'time-picker-inline-icon' }),
6039
+ vue.h(CFormSelect, {
6040
+ disabled: props.disabled,
6041
+ options: getListOfHours(props.locale).map((option) => {
6042
+ return {
6043
+ value: option.value.toString(),
6044
+ label: option.label,
6045
+ };
6046
+ }),
6047
+ onChange: (event) => handleTimeChange('hours', event.target.value),
6048
+ ...(date.value && { value: getSelectedHour(date.value, props.locale) }),
6049
+ }),
6050
+ ':',
6051
+ vue.h(CFormSelect, {
6052
+ disabled: props.disabled,
6053
+ options: Array.from({ length: 60 }, (_, i) => {
6054
+ return {
6055
+ value: i.toString(),
6056
+ label: i.toLocaleString(props.locale).padStart(2, (0).toLocaleString(props.locale)),
6057
+ };
6058
+ }),
6059
+ onChange: (event) => handleTimeChange('minutes', event.target.value),
6060
+ ...(date.value && { value: getSelectedMinutes(date.value) }),
6061
+ }),
6062
+ ':',
6063
+ vue.h(CFormSelect, {
6064
+ disabled: props.disabled,
6065
+ options: Array.from({ length: 60 }, (_, i) => {
6066
+ return {
6067
+ value: i.toString(),
6068
+ label: i.toLocaleString(props.locale).padStart(2, (0).toLocaleString(props.locale)),
6069
+ };
6070
+ }),
6071
+ onChange: (event) => handleTimeChange('seconds', event.target.value),
6072
+ ...(date.value && { value: getSelectedSeconds(date.value) }),
6073
+ }),
6074
+ isAmPm(props.locale) &&
6075
+ vue.h(CFormSelect, {
6076
+ disabled: props.disabled,
6077
+ options: [
6078
+ { value: 'am', label: 'AM' },
6079
+ { value: 'pm', label: 'PM' },
6080
+ ],
6081
+ onChange: (event) => handleTimeChange('toggle', event.target.value),
6082
+ value: ampm.value,
6083
+ }),
6084
+ ];
6085
+ const TimePickerRoll = () => [
6086
+ vue.h(CTimePickerRollCol, {
6087
+ elements: getListOfHours(props.locale),
6088
+ onClick: (index) => handleTimeChange('hours', index.toString()),
6089
+ selected: getSelectedHour(date.value, props.locale),
6090
+ }),
6091
+ vue.h(CTimePickerRollCol, {
6092
+ elements: getMinutesOrSeconds(props.locale),
6093
+ onClick: (index) => handleTimeChange('minutes', index.toString()),
6094
+ selected: getSelectedMinutes(date.value),
6095
+ }),
6096
+ vue.h(CTimePickerRollCol, {
6097
+ elements: getMinutesOrSeconds(props.locale),
6098
+ onClick: (index) => handleTimeChange('seconds', index.toString()),
6099
+ selected: getSelectedSeconds(date.value),
6100
+ }),
6101
+ isAmPm(props.locale) &&
6102
+ vue.h(CTimePickerRollCol, {
6103
+ elements: [
6104
+ { value: 'am', label: 'AM' },
6105
+ { value: 'pm', label: 'PM' },
6106
+ ],
6107
+ onClick: (value) => handleTimeChange('toggle', value),
6108
+ selected: ampm.value,
6109
+ }),
6110
+ ];
6111
+ return () => vue.h(CPicker, {
6112
+ cancelButton: props.cancelButton,
6113
+ cancelButtonColor: props.cancelButtonColor,
6114
+ cancelButtonSize: props.cancelButtonSize,
6115
+ cancelButtonVariant: props.cancelButtonVariant,
6116
+ class: 'time-picker',
6117
+ confirmButton: props.confirmButton,
6118
+ confirmButtonColor: props.confirmButtonColor,
6119
+ confirmButtonSize: props.confirmButtonSize,
6120
+ confirmButtonVariant: props.confirmButtonVariant,
6121
+ container: props.container,
6122
+ disabled: props.disabled,
6123
+ footer: true,
6124
+ onCancel: () => {
6125
+ if (initialDate.value) {
6126
+ date.value = new Date(initialDate.value);
6127
+ }
6128
+ },
6129
+ onHide: () => {
6130
+ emit('hide');
6131
+ },
6132
+ onShow: () => {
6133
+ if (date.value) {
6134
+ initialDate.value = new Date(date.value);
6135
+ }
6136
+ emit('show');
6137
+ },
6138
+ }, {
6139
+ ...(slots.cancelButton && {
6140
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
6141
+ }),
6142
+ ...(slots.confirmButton && {
6143
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
6144
+ }),
6145
+ toggler: () => InputGroup(),
6146
+ default: () => vue.h('div', {
4461
6147
  class: [
4462
- props.button ? 'btn-check' : 'form-check-input',
6148
+ 'time-picker-body',
4463
6149
  {
4464
- 'is-invalid': props.invalid,
4465
- 'is-valid': props.valid,
6150
+ ['time-picker-roll']: props.variant === 'roll',
4466
6151
  },
4467
6152
  ],
4468
- id: props.id,
4469
- indeterminate: props.indeterminate,
4470
- onChange: (event) => handleChange(event),
4471
- type: props.type,
4472
- });
4473
- };
4474
- const formLabel = () => {
4475
- return vue.h(CFormLabel, {
4476
- customClassName: props.button
4477
- ? [
4478
- 'btn',
4479
- props.button.variant
4480
- ? `btn-${props.button.variant}-${props.button.color}`
4481
- : `btn-${props.button.color}`,
4482
- {
4483
- [`btn-${props.button.size}`]: props.button.size,
4484
- },
4485
- `${props.button.shape}`,
4486
- ]
4487
- : 'form-check-label',
4488
- ...(props.id && { for: props.id }),
4489
- }, {
4490
- default: () => (slots.label && slots.label()) || props.label,
4491
- });
4492
- };
4493
- return () => props.button
4494
- ? [formControl(), (slots.label || props.label) && formLabel()]
4495
- : props.label
4496
- ? vue.h('div', {
4497
- class: [
4498
- 'form-check',
4499
- {
4500
- 'form-check-inline': props.inline,
4501
- 'is-invalid': props.invalid,
4502
- 'is-valid': props.valid,
4503
- },
4504
- attrs.class,
4505
- ],
4506
- }, [formControl(), props.label && formLabel()])
4507
- : formControl();
6153
+ }, props.variant === 'select' ? TimePickerSelect() : TimePickerRoll()),
6154
+ });
4508
6155
  },
4509
6156
  });
4510
6157
 
4511
- const CFormFeedback = vue.defineComponent({
4512
- name: 'CFormFeedback',
6158
+ const CTimePickerPlugin = {
6159
+ install: (app) => {
6160
+ app.component(CTimePicker.name, CTimePicker);
6161
+ },
6162
+ };
6163
+
6164
+ const CDateRangePicker = vue.defineComponent({
6165
+ name: 'CDateRangePicker',
4513
6166
  props: {
4514
6167
  /**
4515
- * Component used for the root node. Either a string to use a HTML element or a component.
6168
+ * The number of calendars that render on desktop devices.
4516
6169
  */
4517
- component: {
6170
+ calendars: {
6171
+ type: Number,
6172
+ default: 2,
6173
+ },
6174
+ /**
6175
+ * Default date of the component
6176
+ */
6177
+ calendarDate: {
6178
+ type: [Date, String],
6179
+ },
6180
+ /**
6181
+ * Toggle visibility or set the content of cancel button.
6182
+ */
6183
+ cancelButton: {
6184
+ type: [Boolean, String],
6185
+ default: 'Cancel',
6186
+ },
6187
+ /**
6188
+ * Sets the color context of the cancel button to one of CoreUI’s themed colors.
6189
+ *
6190
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
6191
+ */
6192
+ cancelButtonColor: {
6193
+ ...Color,
6194
+ default: 'primary',
6195
+ },
6196
+ /**
6197
+ * Size the cancel button small or large.
6198
+ *
6199
+ * @values 'sm', 'lg'
6200
+ */
6201
+ cancelButtonSize: {
4518
6202
  type: String,
4519
- required: false,
4520
- default: 'div',
6203
+ default: 'sm',
6204
+ validator: (value) => {
6205
+ return ['sm', 'lg'].includes(value);
6206
+ },
4521
6207
  },
4522
6208
  /**
4523
- * Method called immediately after the `value` prop changes.
6209
+ * Set the cancel button variant to an outlined button or a ghost button.
6210
+ *
6211
+ * @values 'ghost', 'outline'
4524
6212
  */
4525
- invalid: Boolean,
6213
+ cancelButtonVariant: {
6214
+ type: String,
6215
+ default: 'ghost',
6216
+ validator: (value) => {
6217
+ return ['ghost', 'outline'].includes(value);
6218
+ },
6219
+ },
4526
6220
  /**
4527
- * If your form layout allows it, you can display validation feedback in a styled tooltip.
6221
+ * Toggle visibility of the cleaner button.
4528
6222
  */
4529
- tooltip: Boolean,
6223
+ cleaner: {
6224
+ type: Boolean,
6225
+ default: true,
6226
+ },
4530
6227
  /**
4531
- * Set component validation state to valid.
6228
+ * Toggle visibility or set the content of confirm button.
4532
6229
  */
4533
- valid: Boolean,
4534
- },
4535
- setup(props, { slots }) {
4536
- return () => vue.h(props.component, {
4537
- class: [
4538
- {
4539
- [`invalid-${props.tooltip ? 'tooltip' : 'feedback'}`]: props.invalid,
4540
- [`valid-${props.tooltip ? 'tooltip' : 'feedback'}`]: props.valid,
4541
- },
4542
- ],
4543
- }, slots.default && slots.default());
4544
- },
4545
- });
4546
-
4547
- const CFormFloating = vue.defineComponent({
4548
- name: 'CFormFloating',
4549
- setup(_, { slots }) {
4550
- return () => vue.h('div', {
4551
- class: 'form-floating',
4552
- }, slots.default && slots.default());
4553
- },
4554
- });
4555
-
4556
- const CFormInput = vue.defineComponent({
4557
- name: 'CFormInput',
4558
- props: {
6230
+ confirmButton: {
6231
+ type: [Boolean, String],
6232
+ default: 'OK',
6233
+ },
6234
+ /**
6235
+ * Sets the color context of the confirm button to one of CoreUI’s themed colors.
6236
+ *
6237
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
6238
+ */
6239
+ confirmButtonColor: {
6240
+ ...Color,
6241
+ default: 'primary',
6242
+ },
6243
+ /**
6244
+ * Size the confirm button small or large.
6245
+ *
6246
+ * @values 'sm', 'lg'
6247
+ */
6248
+ confirmButtonSize: {
6249
+ type: String,
6250
+ default: 'sm',
6251
+ validator: (value) => {
6252
+ return ['sm', 'lg'].includes(value);
6253
+ },
6254
+ },
6255
+ /**
6256
+ * Set the confirm button variant to an outlined button or a ghost button.
6257
+ *
6258
+ * @values 'ghost', 'outline'
6259
+ */
6260
+ confirmButtonVariant: {
6261
+ type: String,
6262
+ validator: (value) => {
6263
+ return ['ghost', 'outline'].includes(value);
6264
+ },
6265
+ },
4559
6266
  /**
4560
6267
  * Toggle the disabled state for the component.
4561
6268
  */
4562
- disabled: {
4563
- type: Boolean,
4564
- required: false,
6269
+ disabled: Boolean,
6270
+ /**
6271
+ * Specify the list of dates that cannot be selected.
6272
+ */
6273
+ disabledDates: {
6274
+ type: Array,
4565
6275
  },
4566
6276
  /**
4567
- * Set component validation state to invalid.
6277
+ * Initial selected to date (range).
4568
6278
  */
4569
- invalid: {
4570
- type: Boolean,
6279
+ endDate: {
6280
+ type: [Date, String],
4571
6281
  required: false,
4572
6282
  },
4573
6283
  /**
4574
- * The default name for a value passed using v-model.
6284
+ * Sets the day of start week.
6285
+ * - 0 - Sunday,
6286
+ * - 1 - Monday,
6287
+ * - 2 - Tuesday,
6288
+ * - 3 - Wednesday,
6289
+ * - 4 - Thursday,
6290
+ * - 5 - Friday,
6291
+ * - 6 - Saturday,
6292
+ * - 7 - Sunday
4575
6293
  */
4576
- modelValue: {
4577
- type: String,
4578
- default: undefined,
4579
- require: false,
6294
+ firstDayOfWeek: {
6295
+ type: Number,
6296
+ default: 1,
4580
6297
  },
4581
6298
  /**
4582
- * 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`.
6299
+ * Toggle visibility of footer element or set the content of footer.
4583
6300
  */
4584
- plainText: {
4585
- type: Boolean,
4586
- required: false,
4587
- },
6301
+ footer: Boolean,
4588
6302
  /**
4589
- * Toggle the readonly state for the component.
6303
+ * Toggle visibility or set the content of the input indicator.
4590
6304
  */
4591
- readonly: {
6305
+ indicator: {
4592
6306
  type: Boolean,
4593
- required: false,
6307
+ default: true,
4594
6308
  },
4595
6309
  /**
4596
- * Size the component small or large.
4597
- *
4598
- * @values 'sm' | 'lg'
6310
+ * Toggle the readonly state for the component.
4599
6311
  */
4600
- size: {
4601
- type: String,
4602
- default: undefined,
4603
- require: false,
4604
- validator: (value) => {
4605
- return ['sm', 'lg'].includes(value);
4606
- },
4607
- },
6312
+ inputReadOnly: Boolean,
4608
6313
  /**
4609
- * Specifies the type of component.
4610
- *
4611
- * @values 'color' | 'file' | 'text' | string
6314
+ * Sets the default locale for components. If not set, it is inherited from the navigator.language.
4612
6315
  */
4613
- type: {
6316
+ locale: {
4614
6317
  type: String,
4615
- default: 'text',
4616
- require: false,
6318
+ default: 'default',
4617
6319
  },
4618
6320
  /**
4619
- * Set component validation state to valid.
6321
+ * Max selectable date.
4620
6322
  */
4621
- valid: {
4622
- type: Boolean,
4623
- required: false,
6323
+ maxDate: {
6324
+ type: [Date, String],
4624
6325
  },
4625
- },
4626
- emits: [
4627
6326
  /**
4628
- * Event occurs when the element loses focus, after the content has been changed.
6327
+ * Min selectable date.
4629
6328
  */
4630
- 'change',
6329
+ minDate: {
6330
+ type: [Date, String],
6331
+ },
4631
6332
  /**
4632
- * Event occurs immediately after the value of a component has changed.
6333
+ * Show arrows navigation.
4633
6334
  */
4634
- 'input',
6335
+ navigation: {
6336
+ type: Boolean,
6337
+ default: true,
6338
+ },
4635
6339
  /**
4636
- * Emit the new value whenever there’s an input or change event.
6340
+ * Specifies a short hint that is visible in the input.
4637
6341
  */
4638
- 'update:modelValue',
4639
- ],
4640
- setup(props, { emit, slots }) {
4641
- const handleChange = (event) => {
4642
- const target = event.target;
4643
- emit('change', event);
4644
- emit('update:modelValue', target.value);
4645
- };
4646
- const handleInput = (event) => {
4647
- const target = event.target;
4648
- emit('input', event);
4649
- emit('update:modelValue', target.value);
4650
- };
4651
- return () => vue.h('input', {
4652
- class: [
4653
- props.plainText ? 'form-control-plaintext' : 'form-control',
4654
- {
4655
- 'form-control-color': props.type === 'color',
4656
- [`form-control-${props.size}`]: props.size,
4657
- 'is-invalid': props.invalid,
4658
- 'is-valid': props.valid,
4659
- },
4660
- ],
4661
- disabled: props.disabled,
4662
- onChange: (event) => handleChange(event),
4663
- onInput: (event) => handleInput(event),
4664
- readonly: props.readonly,
4665
- type: props.type,
4666
- value: props.modelValue,
4667
- }, slots.default && slots.default());
4668
- },
4669
- });
4670
-
4671
- const CFormRange = vue.defineComponent({
4672
- name: 'CFormRange',
4673
- props: {
6342
+ placeholder: {
6343
+ type: [String, Array],
6344
+ default: () => ['Start date', 'End date'],
6345
+ },
4674
6346
  /**
4675
- * Toggle the disabled state for the component.
6347
+ * @ignore
4676
6348
  */
4677
- disabled: {
6349
+ range: {
4678
6350
  type: Boolean,
4679
- default: undefined,
4680
- required: false,
6351
+ default: true,
4681
6352
  },
4682
6353
  /**
4683
- * Specifies the maximum value for the component.
6354
+ * Predefined date ranges the user can select from.
4684
6355
  */
4685
- max: {
4686
- type: Number,
4687
- default: undefined,
4688
- required: false,
4689
- },
6356
+ ranges: Object,
4690
6357
  /**
4691
- * Specifies the minimum value for the component.
6358
+ * Toggle select mode between start and end date.
4692
6359
  */
4693
- min: {
4694
- type: Number,
4695
- default: undefined,
4696
- required: false,
6360
+ selectEndDate: Boolean,
6361
+ /**
6362
+ * Default icon or character character that separates two dates.
6363
+ */
6364
+ separator: {
6365
+ type: Boolean,
6366
+ default: true,
4697
6367
  },
4698
6368
  /**
4699
- * The default name for a value passed using v-model.
6369
+ * Size the component small or large.
6370
+ *
6371
+ * @values 'sm', 'lg'
4700
6372
  */
4701
- modelValue: {
6373
+ size: {
4702
6374
  type: String,
4703
- value: undefined,
4704
6375
  required: false,
6376
+ validator: (value) => {
6377
+ return ['sm', 'lg'].includes(value);
6378
+ },
4705
6379
  },
4706
6380
  /**
4707
- * Toggle the readonly state for the component.
6381
+ * Initial selected date.
4708
6382
  */
4709
- readonly: {
4710
- type: Boolean,
4711
- required: false,
6383
+ startDate: {
6384
+ type: [Date, String],
4712
6385
  },
4713
6386
  /**
4714
- * Specifies the interval between legal numbers in the component.
6387
+ * Provide an additional time selection by adding select boxes to choose times.
4715
6388
  */
4716
- steps: {
4717
- type: Number,
4718
- default: undefined,
4719
- required: false,
4720
- },
6389
+ timepicker: Boolean,
4721
6390
  /**
4722
- * The `value` attribute of component.
6391
+ * Set length or format of day name.
4723
6392
  *
4724
- * @controllable onChange
4725
- * */
4726
- value: {
4727
- type: Number,
4728
- default: undefined,
4729
- required: false,
6393
+ * @type number | 'long' | 'narrow' | 'short'
6394
+ */
6395
+ weekdayFormat: {
6396
+ type: [Number, String],
6397
+ default: 2,
6398
+ validator: (value) => {
6399
+ if (typeof value === 'string') {
6400
+ return ['long', 'narrow', 'short'].includes(value);
6401
+ }
6402
+ if (typeof value === 'number') {
6403
+ return true;
6404
+ }
6405
+ return false;
6406
+ },
4730
6407
  },
4731
6408
  },
4732
- emits: [
6409
+ emit: [
4733
6410
  /**
4734
- * Event occurs when the value has been changed.
6411
+ * Callback fired when the end date changed.
4735
6412
  */
4736
- 'change',
6413
+ 'end-date-change',
4737
6414
  /**
4738
- * Emit the new value whenever there’s a change event.
6415
+ * Callback fired when the component requests to be hidden.
4739
6416
  */
4740
- 'update:modelValue',
6417
+ 'hide',
6418
+ /**
6419
+ * Callback fired when the component requests to be shown.
6420
+ */
6421
+ 'show',
6422
+ /**
6423
+ * Callback fired when the start date changed.
6424
+ */
6425
+ 'start-date-change',
4741
6426
  ],
4742
- setup(props, { emit, slots }) {
4743
- const handleChange = (event) => {
4744
- const target = event.target;
4745
- emit('change', event);
4746
- emit('update:modelValue', target.value);
6427
+ setup(props, { slots, emit }) {
6428
+ const calendarDate = vue.ref(props.calendarDate
6429
+ ? new Date(props.calendarDate)
6430
+ : props.startDate
6431
+ ? new Date(props.startDate)
6432
+ : props.endDate
6433
+ ? new Date(props.endDate)
6434
+ : new Date());
6435
+ const inputStartHoverValue = vue.ref(null);
6436
+ const inputEndHoverValue = vue.ref(null);
6437
+ const startDate = vue.ref(props.startDate ? new Date(props.startDate) : null);
6438
+ const endDate = vue.ref(props.endDate ? new Date(props.endDate) : null);
6439
+ const initialStartDate = vue.ref(startDate.value ? new Date(startDate.value) : null);
6440
+ const initialEndDate = vue.ref(endDate.value ? new Date(endDate.value) : null);
6441
+ const selectEndDate = vue.ref(false);
6442
+ const isMobile = vue.ref(false);
6443
+ vue.onMounted(() => {
6444
+ isMobile.value = window.innerWidth < 768;
6445
+ });
6446
+ vue.watch(() => props.startDate, () => {
6447
+ if (props.startDate) {
6448
+ calendarDate.value = new Date(props.startDate);
6449
+ }
6450
+ });
6451
+ vue.watch(() => props.endDate, () => {
6452
+ if (props.endDate) {
6453
+ calendarDate.value = new Date(props.endDate);
6454
+ }
6455
+ });
6456
+ const setInputValue = (date, timepicker) => {
6457
+ if (date) {
6458
+ return timepicker
6459
+ ? date.toLocaleString(props.locale)
6460
+ : date.toLocaleDateString(props.locale);
6461
+ }
6462
+ return '';
4747
6463
  };
4748
- return () => vue.h('input', {
4749
- class: 'form-range',
6464
+ const handleCalendarCellHover = (date) => {
6465
+ if (selectEndDate.value) {
6466
+ inputEndHoverValue.value = date === null ? null : date;
6467
+ return;
6468
+ }
6469
+ inputStartHoverValue.value = date === null ? null : date;
6470
+ };
6471
+ const handleCalendarDateChange = (date, difference) => {
6472
+ if (difference) {
6473
+ calendarDate.value = new Date(date.getFullYear(), date.getMonth() - difference, 1);
6474
+ return;
6475
+ }
6476
+ calendarDate.value = date;
6477
+ };
6478
+ const handleStartDateChange = (date) => {
6479
+ startDate.value = date;
6480
+ inputStartHoverValue.value = null;
6481
+ if (props.range) {
6482
+ selectEndDate.value = true;
6483
+ }
6484
+ emit('start-date-change', date);
6485
+ };
6486
+ const handleEndDateChange = (date) => {
6487
+ endDate.value = date;
6488
+ inputEndHoverValue.value = null;
6489
+ if (props.range) {
6490
+ selectEndDate.value = false;
6491
+ }
6492
+ emit('end-date-change', date);
6493
+ };
6494
+ const handleClear = (event) => {
6495
+ event.stopPropagation();
6496
+ startDate.value = null;
6497
+ endDate.value = null;
6498
+ inputStartHoverValue.value = null;
6499
+ inputEndHoverValue.value = null;
6500
+ };
6501
+ const InputGroup = () => vue.h(CInputGroup, {
6502
+ class: 'picker-input-group',
6503
+ size: props.size,
6504
+ }, () => [
6505
+ vue.h(CFormInput, {
6506
+ class: {
6507
+ hover: inputStartHoverValue.value,
6508
+ },
6509
+ disabled: props.disabled,
6510
+ onClick: () => {
6511
+ selectEndDate.value = false;
6512
+ },
6513
+ onInput: (event) => {
6514
+ if (isValidDate(event.target.value)) {
6515
+ calendarDate.value = new Date(event.target.value);
6516
+ startDate.value = new Date(event.target.value);
6517
+ }
6518
+ },
6519
+ placeholder: Array.isArray(props.placeholder)
6520
+ ? props.placeholder[0]
6521
+ : props.placeholder,
6522
+ readonly: props.inputReadOnly,
6523
+ value: inputStartHoverValue.value
6524
+ ? setInputValue(inputStartHoverValue.value, props.timepicker)
6525
+ : setInputValue(startDate.value, props.timepicker),
6526
+ }),
6527
+ props.range &&
6528
+ props.separator !== false &&
6529
+ vue.h(CInputGroupText, {}, () => slots.separator
6530
+ ? slots.separator()
6531
+ : vue.h('span', { class: 'picker-input-group-icon date-picker-arrow-icon' })),
6532
+ props.range &&
6533
+ vue.h(CFormInput, {
6534
+ class: {
6535
+ hover: inputEndHoverValue.value,
6536
+ },
6537
+ disabled: props.disabled,
6538
+ onClick: () => {
6539
+ selectEndDate.value = true;
6540
+ },
6541
+ onInput: (event) => {
6542
+ if (isValidDate(event.target.value)) {
6543
+ calendarDate.value = new Date(event.target.value);
6544
+ endDate.value = new Date(event.target.value);
6545
+ }
6546
+ },
6547
+ placeholder: props.placeholder[1],
6548
+ readonly: props.inputReadOnly,
6549
+ value: inputEndHoverValue.value
6550
+ ? setInputValue(inputEndHoverValue.value, props.timepicker)
6551
+ : setInputValue(endDate.value, props.timepicker),
6552
+ }),
6553
+ (props.indicator || props.cleaner) &&
6554
+ vue.h(CInputGroupText, {}, () => [
6555
+ props.indicator &&
6556
+ vue.h('span', {
6557
+ class: 'picker-input-group-indicator',
6558
+ }, slots.indicator
6559
+ ? slots.indicator()
6560
+ : vue.h('span', { class: 'picker-input-group-icon date-picker-input-icon' })),
6561
+ props.cleaner &&
6562
+ vue.h('span', {
6563
+ class: 'picker-input-group-cleaner',
6564
+ onClick: (event) => handleClear(event),
6565
+ role: 'button',
6566
+ }, slots.cleaner
6567
+ ? slots.cleaner()
6568
+ : vue.h('span', { class: 'picker-input-group-icon date-picker-cleaner-icon' })),
6569
+ ]),
6570
+ ]);
6571
+ return () => vue.h(CPicker, {
6572
+ cancelButton: props.cancelButton,
6573
+ cancelButtonColor: props.cancelButtonColor,
6574
+ cancelButtonSize: props.cancelButtonSize,
6575
+ cancelButtonVariant: props.cancelButtonVariant,
6576
+ class: 'date-picker',
6577
+ confirmButton: props.confirmButton,
6578
+ confirmButtonColor: props.confirmButtonColor,
6579
+ confirmButtonSize: props.confirmButtonSize,
6580
+ confirmButtonVariant: props.confirmButtonVariant,
4750
6581
  disabled: props.disabled,
4751
- max: props.max,
4752
- min: props.min,
4753
- onChange: (event) => handleChange(event),
4754
- steps: props.steps,
4755
- readonly: props.readonly,
4756
- type: 'range',
4757
- value: props.modelValue,
4758
- }, slots.default && slots.default());
6582
+ footer: props.footer || props.timepicker,
6583
+ onCancel: () => {
6584
+ startDate.value = initialStartDate.value;
6585
+ endDate.value = initialEndDate.value;
6586
+ },
6587
+ onHide: () => {
6588
+ emit('hide');
6589
+ },
6590
+ onShow: () => {
6591
+ if (startDate.value) {
6592
+ initialStartDate.value = new Date(startDate.value);
6593
+ }
6594
+ if (endDate.value) {
6595
+ initialEndDate.value = new Date(endDate.value);
6596
+ }
6597
+ emit('show');
6598
+ },
6599
+ }, {
6600
+ ...(slots.cancelButton && {
6601
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
6602
+ }),
6603
+ ...(slots.confirmButton && {
6604
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
6605
+ }),
6606
+ toggler: () => InputGroup(),
6607
+ default: () => vue.h('div', {
6608
+ class: 'date-picker-body',
6609
+ }, [
6610
+ props.ranges &&
6611
+ vue.h('div', { class: 'date-picker-ranges' }, Object.keys(props.ranges).map((key) => vue.h(CButton, {
6612
+ color: 'secondary',
6613
+ onClick: () => {
6614
+ if (props.ranges) {
6615
+ startDate.value = props.ranges[key][0];
6616
+ endDate.value = props.ranges[key][1];
6617
+ }
6618
+ },
6619
+ variant: 'ghost',
6620
+ }, () => key))),
6621
+ vue.h('div', { class: 'date-picker-calendars' }, [...Array(isMobile.value ? 1 : props.calendars)].map((_, index) => vue.h('div', { class: 'date-picker-calendar' }, [
6622
+ vue.h(CCalendar, {
6623
+ calendarDate: new Date(calendarDate.value.getFullYear(), calendarDate.value.getMonth() + index, 1),
6624
+ disabledDates: props.disabledDates,
6625
+ ...(endDate.value && { endDate: endDate.value }),
6626
+ firstDayOfWeek: props.firstDayOfWeek,
6627
+ locale: props.locale,
6628
+ maxDate: props.maxDate,
6629
+ minDate: props.minDate,
6630
+ navigation: props.navigation,
6631
+ range: true,
6632
+ selectEndDate: selectEndDate.value,
6633
+ ...(startDate.value && { startDate: startDate.value }),
6634
+ onCalendarCellHover: (date) => handleCalendarCellHover(date),
6635
+ onCalendarDateChange: (date) => handleCalendarDateChange(date, index),
6636
+ onStartDateChange: (date) => handleStartDateChange(date),
6637
+ onEndDateChange: (date) => handleEndDateChange(date),
6638
+ }, {
6639
+ /**
6640
+ * @slot Location for next icon.
6641
+ */
6642
+ ...(slots.navNextIcon && {
6643
+ navNextIcon: () => slots.navNextIcon && slots.navNextIcon(),
6644
+ }),
6645
+ /**
6646
+ * @slot Location for next double icon.
6647
+ */
6648
+ ...(slots.navNextDoubleIcon && {
6649
+ navNextDoubleIcon: () => slots.navNextDoubleIcon && slots.navNextDoubleIcon(),
6650
+ }),
6651
+ /**
6652
+ * @slot Location for previous icon.
6653
+ */
6654
+ ...(slots.navPrevIcon && {
6655
+ navPrevIcon: () => slots.navPrevIcon && slots.navPrevIcon(),
6656
+ }),
6657
+ /**
6658
+ * @slot Location for double previous icon.
6659
+ */
6660
+ ...(slots.navPrevDoubleIcon && {
6661
+ navPrevDoubleIcon: () => slots.navPrevDoubleIcon && slots.navPrevDoubleIcon(),
6662
+ }),
6663
+ }),
6664
+ !isMobile.value &&
6665
+ props.timepicker &&
6666
+ (index === 0 || props.calendars - index === 1) &&
6667
+ vue.h(CTimePicker, {
6668
+ container: 'inline',
6669
+ disabled: index === 0
6670
+ ? startDate.value === null
6671
+ ? true
6672
+ : false
6673
+ : endDate.value === null
6674
+ ? true
6675
+ : false,
6676
+ locale: props.locale,
6677
+ onChange: (_, __, date) => index === 0 ? handleStartDateChange(date) : handleEndDateChange(date),
6678
+ time: index === 0 ? startDate.value : endDate.value,
6679
+ variant: 'select',
6680
+ }),
6681
+ isMobile.value &&
6682
+ props.timepicker && [
6683
+ vue.h(CTimePicker, {
6684
+ container: 'inline',
6685
+ disabled: startDate.value === null ? true : false,
6686
+ locale: props.locale,
6687
+ onChange: (_, __, date) => handleStartDateChange(date),
6688
+ time: startDate.value,
6689
+ variant: 'select',
6690
+ }),
6691
+ vue.h(CTimePicker, {
6692
+ container: 'inline',
6693
+ disabled: endDate.value === null ? true : false,
6694
+ locale: props.locale,
6695
+ onChange: (_, __, date) => handleEndDateChange(date),
6696
+ time: endDate.value,
6697
+ variant: 'select',
6698
+ }),
6699
+ ],
6700
+ ]))),
6701
+ ]),
6702
+ });
6703
+ },
6704
+ });
6705
+
6706
+ const CDateRangePickerPlugin = {
6707
+ install: (app) => {
6708
+ app.component(CDateRangePicker.name, CDateRangePicker);
4759
6709
  },
4760
- });
6710
+ };
4761
6711
 
4762
- const CFormSelect = vue.defineComponent({
4763
- name: 'CFormSelect',
6712
+ const CDatePicker = vue.defineComponent({
6713
+ name: 'CDatePicker',
4764
6714
  props: {
4765
6715
  /**
4766
- * Specifies the number of visible options in a drop-down list.
6716
+ * Default date of the component
4767
6717
  */
4768
- htmlSize: {
4769
- type: Number,
4770
- default: undefined,
4771
- required: false,
6718
+ calendarDate: {
6719
+ type: [Date, String],
4772
6720
  },
4773
6721
  /**
4774
- * Set component validation state to invalid.
6722
+ * Toggle visibility or set the content of cancel button.
4775
6723
  */
4776
- invalid: {
4777
- type: Boolean,
4778
- required: false,
6724
+ cancelButton: {
6725
+ type: [Boolean, String],
6726
+ default: 'Cancel',
4779
6727
  },
4780
6728
  /**
4781
- * The default name for a value passed using v-model.
6729
+ * Sets the color context of the cancel button to one of CoreUI’s themed colors.
6730
+ *
6731
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4782
6732
  */
4783
- modelValue: {
4784
- type: [String, Array],
4785
- default: undefined,
4786
- require: false,
4787
- },
4788
- multiple: {
4789
- type: Boolean,
4790
- required: false,
6733
+ cancelButtonColor: {
6734
+ ...Color,
6735
+ default: 'primary',
4791
6736
  },
4792
6737
  /**
4793
- * Options list of the select component. Available keys: `label`, `value`, `disabled`.
4794
- * Examples:
4795
- * - `:options="[{ value: 'js', label: 'JavaScript' }, { value: 'html', label: 'HTML', disabled: true }]"`
4796
- * - `:options="['js', 'html']"`
6738
+ * Size the cancel button small or large.
6739
+ *
6740
+ * @values 'sm', 'lg'
4797
6741
  */
4798
- options: {
4799
- type: Array,
4800
- default: undefined,
4801
- required: false,
6742
+ cancelButtonSize: {
6743
+ type: String,
6744
+ default: 'sm',
6745
+ validator: (value) => {
6746
+ return ['sm', 'lg'].includes(value);
6747
+ },
4802
6748
  },
4803
6749
  /**
4804
- * Size the component small or large.
6750
+ * Set the cancel button variant to an outlined button or a ghost button.
4805
6751
  *
4806
- * @values 'sm' | 'lg'
6752
+ * @values 'ghost', 'outline'
4807
6753
  */
4808
- size: {
6754
+ cancelButtonVariant: {
4809
6755
  type: String,
4810
- default: undefined,
4811
- require: false,
6756
+ default: 'ghost',
4812
6757
  validator: (value) => {
4813
- return ['sm', 'lg'].includes(value);
6758
+ return ['ghost', 'outline'].includes(value);
4814
6759
  },
4815
6760
  },
4816
6761
  /**
4817
- * Set component validation state to valid.
6762
+ * Toggle visibility of the cleaner button.
4818
6763
  */
4819
- valid: {
6764
+ cleaner: {
4820
6765
  type: Boolean,
4821
- required: false,
6766
+ default: true,
4822
6767
  },
4823
- },
4824
- emits: [
4825
6768
  /**
4826
- * Event occurs when when a user changes the selected option of a `<select>` element.
6769
+ * Toggle visibility or set the content of confirm button.
4827
6770
  */
4828
- 'change',
6771
+ confirmButton: {
6772
+ type: [Boolean, String],
6773
+ default: 'OK',
6774
+ },
4829
6775
  /**
4830
- * Emit the new value whenever there’s a change event.
6776
+ * Sets the color context of the confirm button to one of CoreUI’s themed colors.
6777
+ *
6778
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4831
6779
  */
4832
- 'update:modelValue',
4833
- ],
4834
- setup(props, { emit, slots }) {
4835
- const handleChange = (event) => {
4836
- const target = event.target;
4837
- const selected = Array.from(target.options)
4838
- .filter((option) => option.selected)
4839
- .map((option) => option.value);
4840
- emit('change', event);
4841
- emit('update:modelValue', target.multiple ? selected : selected[0]);
4842
- };
4843
- return () => vue.h('select', {
4844
- class: [
4845
- 'form-select',
4846
- {
4847
- [`form-select-${props.size}`]: props.size,
4848
- 'is-invalid': props.invalid,
4849
- 'is-valid': props.valid,
4850
- },
4851
- ],
4852
- multiple: props.multiple,
4853
- onChange: (event) => handleChange(event),
4854
- size: props.htmlSize,
4855
- ...(props.modelValue && !props.multiple && { value: props.modelValue }),
4856
- }, props.options
4857
- ? props.options.map((option) => {
4858
- return vue.h('option', {
4859
- ...(typeof option === 'object' && {
4860
- ...(option.disabled && { disabled: option.disabled }),
4861
- ...(option.selected && { selected: option.selected }),
4862
- ...(option.value && {
4863
- value: option.value,
4864
- ...(props.modelValue &&
4865
- props.multiple &&
4866
- props.modelValue.includes(option.value) && { selected: true }),
4867
- }),
4868
- }),
4869
- }, typeof option === 'string' ? option : option.label);
4870
- })
4871
- : slots.default && slots.default());
4872
- },
4873
- });
4874
-
4875
- const CFormSwitch = vue.defineComponent({
4876
- name: 'CFormSwitch',
4877
- inheritAttrs: false,
4878
- props: {
6780
+ confirmButtonColor: {
6781
+ ...Color,
6782
+ default: 'primary',
6783
+ },
4879
6784
  /**
4880
- * The id global attribute defines an identifier (ID) that must be unique in the whole document
6785
+ * Size the confirm button small or large.
6786
+ *
6787
+ * @values 'sm', 'lg'
4881
6788
  */
4882
- id: {
6789
+ confirmButtonSize: {
4883
6790
  type: String,
4884
- default: undefined,
4885
- required: false,
6791
+ default: 'sm',
6792
+ validator: (value) => {
6793
+ return ['sm', 'lg'].includes(value);
6794
+ },
4886
6795
  },
4887
6796
  /**
4888
- * Set component validation state to invalid.
6797
+ * Set the confirm button variant to an outlined button or a ghost button.
6798
+ *
6799
+ * @values 'ghost', 'outline'
4889
6800
  */
4890
- invalid: {
4891
- type: Boolean,
4892
- required: false,
6801
+ confirmButtonVariant: {
6802
+ type: String,
6803
+ validator: (value) => {
6804
+ return ['ghost', 'outline'].includes(value);
6805
+ },
4893
6806
  },
4894
6807
  /**
4895
- * The element represents a caption for a component.
6808
+ * Toggle the disabled state for the component.
4896
6809
  */
4897
- label: {
4898
- type: String,
4899
- default: undefined,
4900
- required: false,
6810
+ disabled: Boolean,
6811
+ /**
6812
+ * Specify the list of dates that cannot be selected.
6813
+ */
6814
+ disabledDates: {
6815
+ type: Array,
4901
6816
  },
4902
6817
  /**
4903
- * The default name for a value passed using v-model.
6818
+ * Initial selected date.
4904
6819
  */
4905
- modelValue: {
4906
- type: [Boolean, String],
4907
- value: undefined,
6820
+ date: {
6821
+ type: [Date, String],
4908
6822
  required: false,
4909
6823
  },
4910
6824
  /**
4911
- * Size the component large or extra large. Works only with `switch`.
4912
- *
4913
- * @values 'lg' | 'xl'
6825
+ * Sets the day of start week.
6826
+ * - 0 - Sunday,
6827
+ * - 1 - Monday,
6828
+ * - 2 - Tuesday,
6829
+ * - 3 - Wednesday,
6830
+ * - 4 - Thursday,
6831
+ * - 5 - Friday,
6832
+ * - 6 - Saturday,
6833
+ * - 7 - Sunday
4914
6834
  */
4915
- size: {
4916
- type: String,
4917
- default: undefined,
4918
- required: false,
4919
- validator: (value) => {
4920
- return ['lg', 'xl'].includes(value);
4921
- },
6835
+ firstDayOfWeek: {
6836
+ type: Number,
6837
+ default: 1,
4922
6838
  },
4923
6839
  /**
4924
- * Specifies the type of component.
4925
- *
4926
- * @values 'checkbox', 'radio'
6840
+ * Toggle visibility of footer element or set the content of footer.
4927
6841
  */
4928
- type: {
6842
+ footer: Boolean,
6843
+ /**
6844
+ * Toggle visibility or set the content of the input indicator.
6845
+ */
6846
+ indicator: {
6847
+ type: Boolean,
6848
+ default: true,
6849
+ },
6850
+ /**
6851
+ * Toggle the readonly state for the component.
6852
+ */
6853
+ inputReadOnly: Boolean,
6854
+ /**
6855
+ * Sets the default locale for components. If not set, it is inherited from the navigator.language.
6856
+ */
6857
+ locale: {
4929
6858
  type: String,
4930
- default: 'checkbox',
4931
- required: false,
6859
+ default: 'default',
4932
6860
  },
4933
6861
  /**
4934
- * Set component validation state to valid.
6862
+ * Max selectable date.
4935
6863
  */
4936
- valid: {
4937
- type: Boolean,
4938
- required: false,
6864
+ maxDate: {
6865
+ type: [Date, String],
4939
6866
  },
4940
- },
4941
- emits: [
4942
6867
  /**
4943
- * Event occurs when the checked value has been changed.
6868
+ * Min selectable date.
4944
6869
  */
4945
- 'change',
6870
+ minDate: {
6871
+ type: [Date, String],
6872
+ },
4946
6873
  /**
4947
- * Emit the new value whenever there’s a change event.
6874
+ * Show arrows navigation.
4948
6875
  */
4949
- 'update:modelValue',
4950
- ],
4951
- setup(props, { attrs, emit }) {
4952
- const checked = vue.ref(attrs.checked);
4953
- vue.watch(() => props.modelValue, () => {
4954
- if (typeof props.modelValue === 'boolean')
4955
- checked.value = props.modelValue;
4956
- });
4957
- const handleChange = (event) => {
4958
- const target = event.target;
4959
- emit('change', event);
4960
- emit('update:modelValue', target.checked);
4961
- };
4962
- return () => vue.h('div', {
4963
- class: [
4964
- 'form-check form-switch',
4965
- {
4966
- [`form-switch-${props.size}`]: props.size,
4967
- 'is-invalid': props.invalid,
4968
- 'is-valid': props.valid,
4969
- },
4970
- ],
4971
- }, [
4972
- vue.h('input', {
4973
- ...attrs,
4974
- checked: checked.value,
4975
- class: [
4976
- 'form-check-input',
4977
- {
4978
- 'is-invalid': props.invalid,
4979
- 'is-valid': props.valid,
4980
- },
4981
- ],
4982
- id: props.id,
4983
- onChange: (event) => handleChange(event),
4984
- type: props.type,
4985
- }),
4986
- props.label &&
4987
- vue.h(CFormLabel, {
4988
- ...(props.id && { for: props.id }),
4989
- class: 'form-check-label',
4990
- }, {
4991
- default: () => props.label,
4992
- }),
4993
- ]);
4994
- },
4995
- });
4996
-
4997
- const CFormText = vue.defineComponent({
4998
- name: 'CFormText',
4999
- props: {
6876
+ navigation: {
6877
+ type: Boolean,
6878
+ default: true,
6879
+ },
5000
6880
  /**
5001
- * Component used for the root node. Either a string to use a HTML element or a component.
6881
+ * Specifies a short hint that is visible in the input.
5002
6882
  */
5003
- component: {
6883
+ placeholder: {
6884
+ type: String,
6885
+ default: 'Select date',
6886
+ },
6887
+ /**
6888
+ * Size the component small or large.
6889
+ *
6890
+ * @values 'sm', 'lg'
6891
+ */
6892
+ size: {
5004
6893
  type: String,
5005
6894
  required: false,
5006
- default: 'div',
6895
+ validator: (value) => {
6896
+ return ['sm', 'lg'].includes(value);
6897
+ },
6898
+ },
6899
+ /**
6900
+ * Provide an additional time selection by adding select boxes to choose times.
6901
+ */
6902
+ timepicker: Boolean,
6903
+ /**
6904
+ * Set length or format of day name.
6905
+ *
6906
+ * @type number | 'long' | 'narrow' | 'short'
6907
+ */
6908
+ weekdayFormat: {
6909
+ type: [Number, String],
6910
+ default: 2,
6911
+ validator: (value) => {
6912
+ if (typeof value === 'string') {
6913
+ return ['long', 'narrow', 'short'].includes(value);
6914
+ }
6915
+ if (typeof value === 'number') {
6916
+ return true;
6917
+ }
6918
+ return false;
6919
+ },
5007
6920
  },
5008
6921
  },
5009
- setup(props, { slots }) {
5010
- return () => vue.h(props.component, { class: 'form-text' }, slots.default && slots.default());
6922
+ emit: [
6923
+ /**
6924
+ * Callback fired when the date changed.
6925
+ */
6926
+ 'date-change',
6927
+ ],
6928
+ setup(props, { emit }) {
6929
+ return () => vue.h(CDateRangePicker, {
6930
+ calendars: 1,
6931
+ onStartDateChange: (date) => emit('date-change', date),
6932
+ range: false,
6933
+ startDate: props.date,
6934
+ ...props,
6935
+ // cleaner: props.cleaner,
6936
+ // disabled: props.disabled,
6937
+ // indicator: props.indicator,
6938
+ // inputReadOnly: props.inputReadOnly,
6939
+ // locale: props.locale,
6940
+ // placeholder: props.placeholder,
6941
+ // size: props.size,
6942
+ // timepicker: props.timepicker,
6943
+ });
5011
6944
  },
5012
6945
  });
5013
6946
 
5014
- const CFormTextarea = vue.defineComponent({
5015
- name: 'CFormTextarea',
6947
+ const CDatePickerPlugin = {
6948
+ install: (app) => {
6949
+ app.component(CDatePicker.name, CDatePicker);
6950
+ },
6951
+ };
6952
+
6953
+ const CSpinner = vue.defineComponent({
6954
+ name: 'CSpinner',
5016
6955
  props: {
5017
6956
  /**
5018
- * Toggle the disabled state for the component.
6957
+ * Sets the color context of the component to one of CoreUI’s themed colors.
6958
+ *
6959
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
5019
6960
  */
5020
- disabled: {
5021
- type: Boolean,
6961
+ color: {
6962
+ type: String,
6963
+ default: undefined,
5022
6964
  required: false,
6965
+ validator: (value) => {
6966
+ return [
6967
+ 'primary',
6968
+ 'secondary',
6969
+ 'success',
6970
+ 'danger',
6971
+ 'warning',
6972
+ 'info',
6973
+ 'dark',
6974
+ 'light',
6975
+ ].includes(value);
6976
+ },
5023
6977
  },
5024
6978
  /**
5025
- * Set component validation state to invalid.
6979
+ * Component used for the root node. Either a string to use a HTML element or a component.
5026
6980
  */
5027
- invalid: {
5028
- type: Boolean,
6981
+ component: {
6982
+ type: String,
6983
+ default: 'div',
5029
6984
  required: false,
5030
6985
  },
5031
6986
  /**
5032
- * The default name for a value passed using v-model.
6987
+ * Size the component small.
6988
+ *
6989
+ * @values 'sm'
5033
6990
  */
5034
- modelValue: {
6991
+ size: {
5035
6992
  type: String,
5036
6993
  default: undefined,
5037
- require: false,
5038
- },
5039
- /**
5040
- * 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`.
5041
- */
5042
- plainText: {
5043
- type: Boolean,
5044
6994
  required: false,
6995
+ validator: (value) => {
6996
+ return value === 'sm';
6997
+ },
5045
6998
  },
5046
6999
  /**
5047
- * Toggle the readonly state for the component.
7000
+ * Set the button variant to an outlined button or a ghost button.
7001
+ *
7002
+ * @values 'border', 'grow'
5048
7003
  */
5049
- readonly: {
5050
- type: Boolean,
7004
+ variant: {
7005
+ type: String,
7006
+ default: 'border',
5051
7007
  required: false,
7008
+ validator: (value) => {
7009
+ return ['border', 'grow'].includes(value);
7010
+ },
5052
7011
  },
5053
7012
  /**
5054
- * Set component validation state to valid.
7013
+ * Set visually hidden label for accessibility purposes.
5055
7014
  */
5056
- valid: {
5057
- type: Boolean,
7015
+ visuallyHiddenLabel: {
7016
+ type: String,
7017
+ default: 'Loading...',
5058
7018
  required: false,
5059
7019
  },
5060
7020
  },
5061
- emits: [
5062
- /**
5063
- * Event occurs when the element loses focus, after the content has been changed.
5064
- */
5065
- 'change',
5066
- /**
5067
- * Event occurs immediately after the value of a component has changed.
5068
- */
5069
- 'input',
5070
- /**
5071
- * Emit the new value whenever there’s an input or change event.
5072
- */
5073
- 'update:modelValue',
5074
- ],
5075
- setup(props, { emit, slots }) {
5076
- const handleInput = (event) => {
5077
- const target = event.target;
5078
- emit('input', event);
5079
- emit('update:modelValue', target.value);
5080
- };
5081
- return () => vue.h('textarea', {
5082
- disabled: props.disabled,
5083
- readonly: props.readonly,
7021
+ setup(props) {
7022
+ return () => vue.h(props.component, {
5084
7023
  class: [
5085
- props.plainText ? 'form-control-plaintext' : 'form-control',
5086
- {
5087
- 'is-invalid': props.invalid,
5088
- 'is-valid': props.valid,
5089
- },
7024
+ `spinner-${props.variant}`,
7025
+ `text-${props.color}`,
7026
+ props.size && `spinner-${props.variant}-${props.size}`,
5090
7027
  ],
5091
- onInput: (event) => handleInput(event),
5092
- value: props.modelValue,
5093
- }, slots.default && slots.default());
7028
+ role: 'status',
7029
+ }, vue.h('span', { class: ['visually-hidden'] }, props.visuallyHiddenLabel));
5094
7030
  },
5095
7031
  });
5096
7032
 
5097
- const CInputGroup = vue.defineComponent({
5098
- name: 'CInputGroup',
7033
+ const CSpinnerPlugin = {
7034
+ install: (app) => {
7035
+ app.component(CSpinner.name, CSpinner);
7036
+ },
7037
+ };
7038
+
7039
+ const CElementCover = vue.defineComponent({
7040
+ name: 'CElementCover',
5099
7041
  props: {
5100
7042
  /**
5101
- * Size the component small or large.
7043
+ * 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:
7044
+ * - sides (array) - select boundaries of element to define boundaries. Sides names: 'top', 'bottom', 'right', 'left'.
7045
+ * - query (string) - query used to get element which define boundaries. Search will be done only inside parent element, by parent.querySelector(query) function. [docs]
5102
7046
  *
5103
- * @values 'sm', 'lg'
7047
+ * @type {sides: string[], query: string}[]
5104
7048
  */
5105
- size: {
5106
- type: String,
5107
- default: undefined,
5108
- required: false,
5109
- validator: (value) => {
5110
- return ['sm', 'lg'].includes(value);
5111
- },
7049
+ boundaries: {
7050
+ // TODO: check if this is correct, TJ
7051
+ type: Array,
7052
+ require: true,
7053
+ },
7054
+ /**
7055
+ * Opacity of the cover. [docs]
7056
+ *
7057
+ * @type number
7058
+ */
7059
+ opacity: {
7060
+ type: Number,
7061
+ require: false,
5112
7062
  },
5113
7063
  },
5114
- setup(props, { slots }) {
7064
+ setup(props) {
7065
+ let containerCoords = {};
7066
+ const elementRef = vue.ref();
7067
+ const getCustomBoundaries = () => {
7068
+ if (!props.boundaries || elementRef === null) {
7069
+ return {};
7070
+ }
7071
+ const parent = elementRef.value.parentElement;
7072
+ if (!parent) {
7073
+ return {};
7074
+ }
7075
+ const parentCoords = parent.getBoundingClientRect();
7076
+ const customBoundaries = {};
7077
+ props.boundaries.forEach((value) => {
7078
+ const element = parent.querySelector(value.query);
7079
+ if (!element || !value.sides) {
7080
+ return;
7081
+ }
7082
+ const coords = element.getBoundingClientRect();
7083
+ value.sides.forEach((side) => {
7084
+ const sideMargin = Math.abs(coords[side] - parentCoords[side]);
7085
+ customBoundaries[side] = `${sideMargin}px`;
7086
+ });
7087
+ });
7088
+ return customBoundaries;
7089
+ };
7090
+ vue.onMounted(function () {
7091
+ vue.nextTick(function () {
7092
+ containerCoords = getCustomBoundaries();
7093
+ });
7094
+ });
5115
7095
  return () => vue.h('div', {
5116
- class: [
5117
- 'input-group',
5118
- {
5119
- [`input-group-${props.size}`]: props.size,
5120
- },
5121
- ],
5122
- }, slots.default && slots.default());
7096
+ style: {
7097
+ ...containerCoords,
7098
+ position: 'absolute',
7099
+ 'background-color': `rgb(255,255,255,${props.opacity})`,
7100
+ },
7101
+ ref: elementRef,
7102
+ }, vue.h('div', // TODO: use slot to override this
7103
+ {
7104
+ style: {
7105
+ position: 'absolute',
7106
+ top: '50%',
7107
+ left: '50%',
7108
+ transform: 'translateX(-50%) translateY(-50%)',
7109
+ },
7110
+ }, vue.h(CSpinner, {
7111
+ variant: 'grow',
7112
+ color: 'primary',
7113
+ })));
5123
7114
  },
5124
7115
  });
5125
7116
 
5126
- const CInputGroupText = vue.defineComponent({
5127
- name: 'CInputGroupText',
7117
+ const CElementCoverPlugin = {
7118
+ install: (app) => {
7119
+ app.component(CElementCover.name, CElementCover);
7120
+ },
7121
+ };
7122
+
7123
+ const CFooter = vue.defineComponent({
7124
+ name: 'CFooter',
5128
7125
  props: {
5129
7126
  /**
5130
- * Component used for the root node. Either a string to use a HTML element or a component.
7127
+ * Place footer in non-static positions.
7128
+ *
7129
+ * @values 'fixed', 'sticky'
5131
7130
  */
5132
- component: {
7131
+ position: {
5133
7132
  type: String,
7133
+ default: undefined,
5134
7134
  required: false,
5135
- default: 'span',
7135
+ validator: (value) => {
7136
+ return ['fixed', 'sticky'].includes(value);
7137
+ },
5136
7138
  },
5137
7139
  },
5138
7140
  setup(props, { slots }) {
5139
- return () => vue.h(props.component, { class: 'input-group-text' }, slots.default && slots.default());
7141
+ return () => vue.h('div', { class: ['footer', { [`footer-${props.position}`]: props.position }] }, slots.default && slots.default());
5140
7142
  },
5141
7143
  });
5142
7144
 
5143
- const CFormPlugin = {
7145
+ const CFooterPlugin = {
5144
7146
  install: (app) => {
5145
- app.component(CForm.name, CForm);
5146
- app.component(CFormCheck.name, CFormCheck);
5147
- // app.component(CFormControl.name, CFormControl)
5148
- app.component(CFormFeedback.name, CFormFeedback);
5149
- app.component(CFormFloating.name, CFormFloating);
5150
- app.component(CFormInput.name, CFormInput);
5151
- app.component(CFormLabel.name, CFormLabel);
5152
- app.component(CFormRange.name, CFormRange);
5153
- app.component(CFormSelect.name, CFormSelect);
5154
- app.component(CFormSwitch.name, CFormSwitch);
5155
- app.component(CFormText.name, CFormText);
5156
- app.component(CFormTextarea.name, CFormTextarea);
5157
- app.component(CInputGroup.name, CInputGroup);
5158
- app.component(CInputGroupText.name, CInputGroupText);
7147
+ app.component(CFooter.name, CFooter);
5159
7148
  },
5160
7149
  };
5161
7150
 
@@ -10870,6 +12859,8 @@ var Components = /*#__PURE__*/Object.freeze({
10870
12859
  CButtonGroupPlugin: CButtonGroupPlugin,
10871
12860
  CButtonToolbar: CButtonToolbar,
10872
12861
  CButtonGroup: CButtonGroup,
12862
+ CCalendar: CCalendar,
12863
+ CCalendarPlugin: CCalendarPlugin,
10873
12864
  CCalloutPlugin: CCalloutPlugin,
10874
12865
  CCallout: CCallout,
10875
12866
  CCardPlugin: CCardPlugin,
@@ -10892,6 +12883,10 @@ var Components = /*#__PURE__*/Object.freeze({
10892
12883
  CCloseButton: CCloseButton,
10893
12884
  CCollapsePlugin: CCollapsePlugin,
10894
12885
  CCollapse: CCollapse,
12886
+ CDatePickerPlugin: CDatePickerPlugin,
12887
+ CDatePicker: CDatePicker,
12888
+ CDateRangePickerPlugin: CDateRangePickerPlugin,
12889
+ CDateRangePicker: CDateRangePicker,
10895
12890
  CDropdownPlugin: CDropdownPlugin,
10896
12891
  CDropdown: CDropdown,
10897
12892
  CDropdownItem: CDropdownItem,
@@ -10967,6 +12962,8 @@ var Components = /*#__PURE__*/Object.freeze({
10967
12962
  CPagination: CPagination,
10968
12963
  CPaginationItem: CPaginationItem,
10969
12964
  CSmartPagination: CSmartPagination,
12965
+ CPicker: CPicker,
12966
+ CPickerPlugin: CPickerPlugin,
10970
12967
  CPlaceholderPlugin: CPlaceholderPlugin,
10971
12968
  CPlaceholder: CPlaceholder,
10972
12969
  CProgressPlugin: CProgressPlugin,
@@ -10997,6 +12994,8 @@ var Components = /*#__PURE__*/Object.freeze({
10997
12994
  CTabsPlugin: CTabsPlugin,
10998
12995
  CTabContent: CTabContent,
10999
12996
  CTabPane: CTabPane,
12997
+ CTimePicker: CTimePicker,
12998
+ CTimePickerPlugin: CTimePickerPlugin,
11000
12999
  CToastPlugin: CToastPlugin,
11001
13000
  CToast: CToast,
11002
13001
  CToastBody: CToastBody,
@@ -11269,6 +13268,8 @@ exports.CButtonGroupPlugin = CButtonGroupPlugin;
11269
13268
  exports.CButtonPlugin = CButtonPlugin;
11270
13269
  exports.CButtonToolbar = CButtonToolbar;
11271
13270
  exports.CCLinkPlugin = CCLinkPlugin;
13271
+ exports.CCalendar = CCalendar;
13272
+ exports.CCalendarPlugin = CCalendarPlugin;
11272
13273
  exports.CCallout = CCallout;
11273
13274
  exports.CCalloutPlugin = CCalloutPlugin;
11274
13275
  exports.CCard = CCard;
@@ -11293,6 +13294,10 @@ exports.CCol = CCol;
11293
13294
  exports.CCollapse = CCollapse;
11294
13295
  exports.CCollapsePlugin = CCollapsePlugin;
11295
13296
  exports.CContainer = CContainer;
13297
+ exports.CDatePicker = CDatePicker;
13298
+ exports.CDatePickerPlugin = CDatePickerPlugin;
13299
+ exports.CDateRangePicker = CDateRangePicker;
13300
+ exports.CDateRangePickerPlugin = CDateRangePickerPlugin;
11296
13301
  exports.CDropdown = CDropdown;
11297
13302
  exports.CDropdownDivider = CDropdownDivider;
11298
13303
  exports.CDropdownHeader = CDropdownHeader;
@@ -11363,6 +13368,8 @@ exports.COffcanvasTitle = COffcanvasTitle;
11363
13368
  exports.CPagination = CPagination;
11364
13369
  exports.CPaginationItem = CPaginationItem;
11365
13370
  exports.CPaginationPlugin = CPaginationPlugin;
13371
+ exports.CPicker = CPicker;
13372
+ exports.CPickerPlugin = CPickerPlugin;
11366
13373
  exports.CPlaceholder = CPlaceholder;
11367
13374
  exports.CPlaceholderPlugin = CPlaceholderPlugin;
11368
13375
  exports.CPopover = CPopover;
@@ -11395,6 +13402,8 @@ exports.CTableHeaderCell = CTableHeaderCell;
11395
13402
  exports.CTablePlugin = CTablePlugin;
11396
13403
  exports.CTableRow = CTableRow;
11397
13404
  exports.CTabsPlugin = CTabsPlugin;
13405
+ exports.CTimePicker = CTimePicker;
13406
+ exports.CTimePickerPlugin = CTimePickerPlugin;
11398
13407
  exports.CToast = CToast;
11399
13408
  exports.CToastBody = CToastBody;
11400
13409
  exports.CToastClose = CToastClose;