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