Export locale config and typescript support
parent
e35f1d5927
commit
80b1be89f5
|
@ -0,0 +1 @@
|
||||||
|
export * from './components/config/PrimeVue';
|
|
@ -0,0 +1,2 @@
|
||||||
|
'use strict';
|
||||||
|
module.exports = require('./components/config/PrimeVue.js');
|
|
@ -0,0 +1,38 @@
|
||||||
|
import Vue, { PluginFunction } from 'vue';
|
||||||
|
|
||||||
|
interface PrimeVueConfiguration {
|
||||||
|
ripple?: boolean;
|
||||||
|
locale?: PrimeVueLocaleOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PrimeVueLocaleOptions {
|
||||||
|
accept?: string;
|
||||||
|
reject?: string;
|
||||||
|
choose?: string;
|
||||||
|
upload?: string;
|
||||||
|
cancel?: string;
|
||||||
|
dayNames: string[];
|
||||||
|
dayNamesShort: string[];
|
||||||
|
dayNamesMin: string[];
|
||||||
|
monthNames: string[];
|
||||||
|
monthNamesShort: string[];
|
||||||
|
today?: string;
|
||||||
|
clear?: string;
|
||||||
|
weekHeader?: string;
|
||||||
|
firstDayOfWeek?: number;
|
||||||
|
dateFormat?: string;
|
||||||
|
weak?: string;
|
||||||
|
medium?: string;
|
||||||
|
strong?: string;
|
||||||
|
passwordPrompt?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function usePrimeVue(): PrimeVueConfiguration;
|
||||||
|
|
||||||
|
export const install: PluginFunction<{}>;
|
||||||
|
|
||||||
|
declare module 'vue/types/vue' {
|
||||||
|
interface Vue {
|
||||||
|
$primevue: PrimeVueConfiguration;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import {PrimeVueSymbol} from './usePrimeVue';
|
import {PrimeVueSymbol} from './usePrimeVue';
|
||||||
import {reactive} from 'vue';
|
import {reactive,inject} from 'vue';
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
ripple: false,
|
ripple: false,
|
||||||
|
@ -26,6 +26,17 @@ const defaultOptions = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PrimeVueSymbol = Symbol();
|
||||||
|
|
||||||
|
export function usePrimeVue() {
|
||||||
|
const PrimeVue = inject(PrimeVueSymbol);
|
||||||
|
if (!PrimeVue) {
|
||||||
|
throw new Error('PrimeVue is not installed!');
|
||||||
|
}
|
||||||
|
|
||||||
|
return PrimeVue;
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install: (app, options) => {
|
install: (app, options) => {
|
||||||
let configOptions = options ? {...defaultOptions, ...options} : {...defaultOptions};
|
let configOptions = options ? {...defaultOptions, ...options} : {...defaultOptions};
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
import { inject } from 'vue';
|
|
||||||
|
|
||||||
export const PrimeVueSymbol = Symbol();
|
|
||||||
|
|
||||||
export function usePrimeVue() {
|
|
||||||
const PrimeVue = inject(PrimeVueSymbol);
|
|
||||||
if (!PrimeVue) {
|
|
||||||
throw new Error('PrimeVue is not installed!');
|
|
||||||
}
|
|
||||||
|
|
||||||
return PrimeVue;
|
|
||||||
}
|
|
Loading…
Reference in New Issue