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