From 69de51ea45e404e1e75f6dd173e33c7d2b092887 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Sun, 10 Jan 2021 16:47:50 +0300 Subject: [PATCH] Reefactor #1749 - Added d.ts and exports --- exports/api.d.ts | 6 ++---- exports/api.js | 9 +++++++-- src/components/api/index.d.ts | 11 +++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 src/components/api/index.d.ts diff --git a/exports/api.d.ts b/exports/api.d.ts index a6c3d0c1ff..03454f3601 100644 --- a/exports/api.d.ts +++ b/exports/api.d.ts @@ -1,7 +1,5 @@ -import PrimeReact from './components/api/PrimeReact'; - -export default PrimeReact; -export * from './components/api/Locale'; export * from './components/menuitem/MenuItem'; export * from './components/selectitem/SelectItem'; export * from './components/treenode/TreeNode'; +export { default } from './components/api'; +export * from './components/api'; diff --git a/exports/api.js b/exports/api.js index bd0d863a76..46a16f675e 100644 --- a/exports/api.js +++ b/exports/api.js @@ -1,4 +1,9 @@ 'use strict'; -module.exports = require('./components/api/PrimeReact'); -module.exports = require('./components/api/Locale'); +var module = module.exports = require('./components/api/PrimeReact'); +module.locale = require('./components/api/Locale').locale; +module.addLocale = require('./components/api/Locale').addLocale; +module.updateLocaleOption = require('./components/api/Locale').updateLocaleOption; +module.updateLocaleOptions = require('./components/api/Locale').updateLocaleOptions; +module.localeOption = require('./components/api/Locale').localeOption; +module.localeOptions = require('./components/api/Locale').localeOptions; diff --git a/src/components/api/index.d.ts b/src/components/api/index.d.ts new file mode 100644 index 0000000000..cc6ebb1894 --- /dev/null +++ b/src/components/api/index.d.ts @@ -0,0 +1,11 @@ +export default PrimeReact = { + ripple?: boolean, + locale?: string +}; + +export function locale(locale: string): object; +export function addLocale(locale: string, options: object): void; +export function updateLocaleOption(key: string, value: any, locale: string): void; +export function updateLocaleOptions(options: object, locale: string): void; +export function localeOption(key: string, locale: string): void; +export function localeOptions(locale: string): void;