diff --git a/rollup.config.js b/rollup.config.js index 06c8dfc6b..b671a404f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -107,10 +107,10 @@ function addUtils() { function addServices() { addEntry('confirmationservice', 'ConfirmationService.js', 'confirmationservice'); addEntry('confirmationeventbus', 'ConfirmationEventBus.js', 'confirmationeventbus'); - addEntry('useconfirm', 'useconfirm.js', 'useconfirm'); + addEntry('useconfirm', 'UseConfirm.js', 'useconfirm'); addEntry('toastservice', 'ToastService.js', 'toastservice'); addEntry('toasteventbus', 'ToastEventBus.js', 'toasteventbus'); - addEntry('usetoast', 'usetoast.js', 'usetoast'); + addEntry('usetoast', 'UseToast.js', 'usetoast'); addEntry('terminalservice', 'TerminalService.js', 'terminalservice'); } diff --git a/src/components/useconfirm/UseConfirm.js b/src/components/useconfirm/UseConfirm.js new file mode 100644 index 000000000..c0a588441 --- /dev/null +++ b/src/components/useconfirm/UseConfirm.js @@ -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; +} \ No newline at end of file diff --git a/src/components/useconfirm/UseConfirm.ts b/src/components/useconfirm/UseConfirm.ts new file mode 100644 index 000000000..44df8c048 --- /dev/null +++ b/src/components/useconfirm/UseConfirm.ts @@ -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 +} \ No newline at end of file diff --git a/src/components/useconfirm/package.json b/src/components/useconfirm/package.json new file mode 100644 index 000000000..0a73883dc --- /dev/null +++ b/src/components/useconfirm/package.json @@ -0,0 +1,6 @@ +{ + "main": "./useconfirm.cjs.js", + "module": "./useconfirm.esm.js", + "unpkg": "./useconfirm.min.js", + "types": "./UseConfirm.d.ts" +} \ No newline at end of file diff --git a/src/components/usetoast/UseToast.js b/src/components/usetoast/UseToast.js new file mode 100644 index 000000000..24713327c --- /dev/null +++ b/src/components/usetoast/UseToast.js @@ -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; +} \ No newline at end of file diff --git a/src/components/usetoast/UseToast.ts b/src/components/usetoast/UseToast.ts new file mode 100644 index 000000000..eca896906 --- /dev/null +++ b/src/components/usetoast/UseToast.ts @@ -0,0 +1 @@ +export declare function useToast(): { add(args:{ severity?: string, summary?: string, detail?: string, life?: number, closable?: boolean, group?: string }): void } \ No newline at end of file diff --git a/src/components/usetoast/package.json b/src/components/usetoast/package.json new file mode 100644 index 000000000..ac46db5f1 --- /dev/null +++ b/src/components/usetoast/package.json @@ -0,0 +1,6 @@ +{ + "main": "./usetoast.cjs.js", + "module": "./usetoast.esm.js", + "unpkg": "./usetoast.min.js", + "types": "./UseToast.d.ts" +} \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index de88b2c75..a35343fcc 100644 --- a/vue.config.js +++ b/vue.config.js @@ -7,8 +7,8 @@ module.exports = { resolve: { alias: { 'primevue/ripple': path.resolve(__dirname, 'src/components/ripple/Ripple.js'), - 'primevue/useconfirm': path.resolve(__dirname, 'src/components/useconfirm/useconfirm.js'), - 'primevue/usetoast': path.resolve(__dirname, 'src/components/usetoast/usetoast.js'), + 'primevue/useconfirm': path.resolve(__dirname, 'src/components/useconfirm/UseConfirm.js'), + 'primevue/usetoast': path.resolve(__dirname, 'src/components/usetoast/UseToast.js'), 'primevue/utils': path.resolve(__dirname, 'src/components/utils/Utils.js'), 'primevue/button': path.resolve(__dirname, 'src/components/button/Button.vue'), 'primevue/inputtext': path.resolve(__dirname, 'src/components/inputtext/InputText.vue'),