2022-09-14 11:26:01 +00:00
|
|
|
import { reactive, inject } from 'vue';
|
|
|
|
import { FilterMatchMode } from 'primevue/api';
|
2020-12-09 12:24:11 +00:00
|
|
|
|
|
|
|
const defaultOptions = {
|
|
|
|
ripple: false,
|
2021-05-12 09:13:50 +00:00
|
|
|
inputStyle: 'outlined',
|
2020-12-09 12:24:11 +00:00
|
|
|
locale: {
|
2021-02-06 09:26:12 +00:00
|
|
|
startsWith: 'Starts with',
|
|
|
|
contains: 'Contains',
|
|
|
|
notContains: 'Not contains',
|
|
|
|
endsWith: 'Ends with',
|
|
|
|
equals: 'Equals',
|
|
|
|
notEquals: 'Not equals',
|
|
|
|
noFilter: 'No Filter',
|
|
|
|
lt: 'Less than',
|
|
|
|
lte: 'Less than or equal to',
|
|
|
|
gt: 'Greater than',
|
|
|
|
gte: 'Greater than or equal to',
|
2021-02-08 12:35:16 +00:00
|
|
|
dateIs: 'Date is',
|
|
|
|
dateIsNot: 'Date is not',
|
|
|
|
dateBefore: 'Date is before',
|
|
|
|
dateAfter: 'Date is after',
|
2021-02-06 09:26:12 +00:00
|
|
|
clear: 'Clear',
|
|
|
|
apply: 'Apply',
|
|
|
|
matchAll: 'Match All',
|
|
|
|
matchAny: 'Match Any',
|
|
|
|
addRule: 'Add Rule',
|
|
|
|
removeRule: 'Remove Rule',
|
2020-12-09 12:24:11 +00:00
|
|
|
accept: 'Yes',
|
|
|
|
reject: 'No',
|
|
|
|
choose: 'Choose',
|
|
|
|
upload: 'Upload',
|
|
|
|
cancel: 'Cancel',
|
2022-09-14 11:26:01 +00:00
|
|
|
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
|
|
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
|
|
dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
|
|
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
|
|
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
2022-07-19 13:04:04 +00:00
|
|
|
chooseYear: 'Choose Year',
|
|
|
|
chooseMonth: 'Choose Month',
|
|
|
|
chooseDate: 'Choose Date',
|
|
|
|
prevDecade: 'Previous Decade',
|
|
|
|
nextDecade: 'Next Decade',
|
|
|
|
prevYear: 'Previous Year',
|
|
|
|
nextYear: 'Next Year',
|
|
|
|
prevMonth: 'Previous Month',
|
|
|
|
nextMonth: 'Next Month',
|
|
|
|
prevHour: 'Previous Hour',
|
|
|
|
nextHour: 'Next Hour',
|
|
|
|
prevMinute: 'Previous Minute',
|
|
|
|
nextMinute: 'Next Minute',
|
|
|
|
prevSecond: 'Previous Second',
|
|
|
|
nextSecond: 'Next Second',
|
|
|
|
am: 'am',
|
|
|
|
pm: 'pm',
|
2020-12-09 12:24:11 +00:00
|
|
|
today: 'Today',
|
|
|
|
weekHeader: 'Wk',
|
|
|
|
firstDayOfWeek: 0,
|
|
|
|
dateFormat: 'mm/dd/yy',
|
|
|
|
weak: 'Weak',
|
|
|
|
medium: 'Medium',
|
|
|
|
strong: 'Strong',
|
2021-02-15 08:50:11 +00:00
|
|
|
passwordPrompt: 'Enter a password',
|
2022-07-29 00:50:40 +00:00
|
|
|
emptyFilterMessage: 'No results found', // @deprecated Use 'emptySearchMessage' option instead.
|
|
|
|
searchMessage: '{0} results are available',
|
|
|
|
selectionMessage: '{0} items selected',
|
|
|
|
emptySelectionMessage: 'No selected item',
|
|
|
|
emptySearchMessage: 'No results found',
|
2022-07-18 10:36:43 +00:00
|
|
|
emptyMessage: 'No available options',
|
|
|
|
aria: {
|
|
|
|
trueLabel: 'True',
|
|
|
|
falseLabel: 'False',
|
2022-07-22 13:30:42 +00:00
|
|
|
nullLabel: 'Not Selected',
|
2022-07-29 13:52:08 +00:00
|
|
|
star: '1 star',
|
|
|
|
stars: '{star} stars',
|
2022-07-29 04:21:24 +00:00
|
|
|
selectAll: 'All items selected',
|
|
|
|
unselectAll: 'All items unselected',
|
2022-09-14 11:26:01 +00:00
|
|
|
close: 'Close',
|
|
|
|
previous: 'Previous',
|
|
|
|
next: 'Next'
|
2022-07-18 10:36:43 +00:00
|
|
|
}
|
2021-02-06 09:26:12 +00:00
|
|
|
},
|
|
|
|
filterMatchModeOptions: {
|
2022-09-14 11:26:01 +00:00
|
|
|
text: [FilterMatchMode.STARTS_WITH, FilterMatchMode.CONTAINS, FilterMatchMode.NOT_CONTAINS, FilterMatchMode.ENDS_WITH, FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS],
|
|
|
|
numeric: [FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS, FilterMatchMode.LESS_THAN, FilterMatchMode.LESS_THAN_OR_EQUAL_TO, FilterMatchMode.GREATER_THAN, FilterMatchMode.GREATER_THAN_OR_EQUAL_TO],
|
|
|
|
date: [FilterMatchMode.DATE_IS, FilterMatchMode.DATE_IS_NOT, FilterMatchMode.DATE_BEFORE, FilterMatchMode.DATE_AFTER]
|
2021-04-13 13:59:08 +00:00
|
|
|
},
|
|
|
|
zIndex: {
|
|
|
|
modal: 1100,
|
|
|
|
overlay: 1000,
|
|
|
|
menu: 1000,
|
|
|
|
tooltip: 1100
|
2020-12-09 12:24:11 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-12-10 08:03:08 +00:00
|
|
|
const PrimeVueSymbol = Symbol();
|
|
|
|
|
|
|
|
export function usePrimeVue() {
|
|
|
|
const PrimeVue = inject(PrimeVueSymbol);
|
2022-09-14 11:26:01 +00:00
|
|
|
|
2020-12-10 08:03:08 +00:00
|
|
|
if (!PrimeVue) {
|
|
|
|
throw new Error('PrimeVue is not installed!');
|
2022-07-29 00:50:40 +00:00
|
|
|
}
|
|
|
|
|
2020-12-10 08:03:08 +00:00
|
|
|
return PrimeVue;
|
|
|
|
}
|
|
|
|
|
2020-12-09 12:24:11 +00:00
|
|
|
export default {
|
|
|
|
install: (app, options) => {
|
2022-09-14 11:26:01 +00:00
|
|
|
let configOptions = options ? { ...defaultOptions, ...options } : { ...defaultOptions };
|
2020-12-09 12:24:11 +00:00
|
|
|
const PrimeVue = {
|
|
|
|
config: reactive(configOptions)
|
|
|
|
};
|
2022-09-14 11:26:01 +00:00
|
|
|
|
2020-12-09 12:24:11 +00:00
|
|
|
app.config.globalProperties.$primevue = PrimeVue;
|
|
|
|
app.provide(PrimeVueSymbol, PrimeVue);
|
|
|
|
}
|
2022-07-29 00:50:40 +00:00
|
|
|
};
|