93 lines
2.8 KiB
JavaScript
93 lines
2.8 KiB
JavaScript
import {reactive,inject} from 'vue';
|
|
import {FilterMatchMode} from 'primevue/api';
|
|
|
|
const defaultOptions = {
|
|
ripple: false,
|
|
locale: {
|
|
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',
|
|
is: 'Is',
|
|
isNot: 'Is not',
|
|
before: 'Before',
|
|
after: 'After',
|
|
clear: 'Clear',
|
|
apply: 'Apply',
|
|
matchAll: 'Match All',
|
|
matchAny: 'Match Any',
|
|
addRule: 'Add Rule',
|
|
removeRule: 'Remove Rule',
|
|
accept: 'Yes',
|
|
reject: 'No',
|
|
choose: 'Choose',
|
|
upload: 'Upload',
|
|
cancel: 'Cancel',
|
|
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"],
|
|
today: 'Today',
|
|
weekHeader: 'Wk',
|
|
firstDayOfWeek: 0,
|
|
dateFormat: 'mm/dd/yy',
|
|
weak: 'Weak',
|
|
medium: 'Medium',
|
|
strong: 'Strong',
|
|
passwordPrompt: 'Enter a password'
|
|
},
|
|
filterMatchModeOptions: {
|
|
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.IS,
|
|
FilterMatchMode.IS_NOT,
|
|
FilterMatchMode.BEFORE,
|
|
FilterMatchMode.AFTER
|
|
]
|
|
}
|
|
};
|
|
|
|
const PrimeVueSymbol = Symbol();
|
|
|
|
export function usePrimeVue() {
|
|
const PrimeVue = inject(PrimeVueSymbol);
|
|
if (!PrimeVue) {
|
|
throw new Error('PrimeVue is not installed!');
|
|
}
|
|
|
|
return PrimeVue;
|
|
}
|
|
|
|
export default {
|
|
install: (app, options) => {
|
|
let configOptions = options ? {...defaultOptions, ...options} : {...defaultOptions};
|
|
const PrimeVue = {
|
|
config: reactive(configOptions)
|
|
};
|
|
app.config.globalProperties.$primevue = PrimeVue;
|
|
app.provide(PrimeVueSymbol, PrimeVue);
|
|
}
|
|
}; |