Rename refacrtor on useToast-useConfirm

pull/880/head
Cagatay Civici 2021-01-18 18:16:32 +03:00
parent abb3a7bd8c
commit c7e860d247
8 changed files with 60 additions and 4 deletions

View File

@ -107,10 +107,10 @@ function addUtils() {
function addServices() { function addServices() {
addEntry('confirmationservice', 'ConfirmationService.js', 'confirmationservice'); addEntry('confirmationservice', 'ConfirmationService.js', 'confirmationservice');
addEntry('confirmationeventbus', 'ConfirmationEventBus.js', 'confirmationeventbus'); addEntry('confirmationeventbus', 'ConfirmationEventBus.js', 'confirmationeventbus');
addEntry('useconfirm', 'useconfirm.js', 'useconfirm'); addEntry('useconfirm', 'UseConfirm.js', 'useconfirm');
addEntry('toastservice', 'ToastService.js', 'toastservice'); addEntry('toastservice', 'ToastService.js', 'toastservice');
addEntry('toasteventbus', 'ToastEventBus.js', 'toasteventbus'); addEntry('toasteventbus', 'ToastEventBus.js', 'toasteventbus');
addEntry('usetoast', 'usetoast.js', 'usetoast'); addEntry('usetoast', 'UseToast.js', 'usetoast');
addEntry('terminalservice', 'TerminalService.js', 'terminalservice'); addEntry('terminalservice', 'TerminalService.js', 'terminalservice');
} }

View File

@ -0,0 +1,12 @@
import { inject } from 'vue';
export const PrimeVueConfirmSymbol = Symbol();
export function useConfirm() {
const PrimeVueConfirm = inject(PrimeVueConfirmSymbol);
if (!PrimeVueConfirm) {
throw new Error('No PrimeVue Confirmation provided!');
}
return PrimeVueConfirm;
}

View File

@ -0,0 +1,19 @@
export declare function useConfirm(): {
require(args:{
message?: string;
group?: string;
icon?: string;
header?: string;
accept?: Function;
reject?: Function;
acceptLabel?: string;
rejectLabel?: string;
acceptIcon?: string;
rejectIcon?: string;
blockScroll?: boolean;
acceptClass?: string;
rejectClass?: string;
}): void
close(): void
}

View File

@ -0,0 +1,6 @@
{
"main": "./useconfirm.cjs.js",
"module": "./useconfirm.esm.js",
"unpkg": "./useconfirm.min.js",
"types": "./UseConfirm.d.ts"
}

View File

@ -0,0 +1,12 @@
import { inject } from 'vue';
export const PrimeVueToastSymbol = Symbol();
export function useToast() {
const PrimeVueToast = inject(PrimeVueToastSymbol);
if (!PrimeVueToast) {
throw new Error('No PrimeVue Toast provided!');
}
return PrimeVueToast;
}

View File

@ -0,0 +1 @@
export declare function useToast(): { add(args:{ severity?: string, summary?: string, detail?: string, life?: number, closable?: boolean, group?: string }): void }

View File

@ -0,0 +1,6 @@
{
"main": "./usetoast.cjs.js",
"module": "./usetoast.esm.js",
"unpkg": "./usetoast.min.js",
"types": "./UseToast.d.ts"
}

View File

@ -7,8 +7,8 @@ module.exports = {
resolve: { resolve: {
alias: { alias: {
'primevue/ripple': path.resolve(__dirname, 'src/components/ripple/Ripple.js'), 'primevue/ripple': path.resolve(__dirname, 'src/components/ripple/Ripple.js'),
'primevue/useconfirm': path.resolve(__dirname, 'src/components/useconfirm/useconfirm.js'), 'primevue/useconfirm': path.resolve(__dirname, 'src/components/useconfirm/UseConfirm.js'),
'primevue/usetoast': path.resolve(__dirname, 'src/components/usetoast/usetoast.js'), 'primevue/usetoast': path.resolve(__dirname, 'src/components/usetoast/UseToast.js'),
'primevue/utils': path.resolve(__dirname, 'src/components/utils/Utils.js'), 'primevue/utils': path.resolve(__dirname, 'src/components/utils/Utils.js'),
'primevue/button': path.resolve(__dirname, 'src/components/button/Button.vue'), 'primevue/button': path.resolve(__dirname, 'src/components/button/Button.vue'),
'primevue/inputtext': path.resolve(__dirname, 'src/components/inputtext/InputText.vue'), 'primevue/inputtext': path.resolve(__dirname, 'src/components/inputtext/InputText.vue'),