@nubitio/core 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -5
- package/dist/index.d.cts +15 -1
- package/dist/index.d.mts +15 -1
- package/dist/index.mjs +21 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,8 @@ i18next = __toESM(i18next, 1);
|
|
|
31
31
|
const _coreConfig = {
|
|
32
32
|
locale: "es",
|
|
33
33
|
timezone: "UTC",
|
|
34
|
-
apiBaseUrl: "/api/"
|
|
34
|
+
apiBaseUrl: "/api/",
|
|
35
|
+
currency: void 0
|
|
35
36
|
};
|
|
36
37
|
/**
|
|
37
38
|
* Configure core runtime values (locale, timezone, apiBaseUrl).
|
|
@@ -42,6 +43,7 @@ function configureCore(config) {
|
|
|
42
43
|
if (config.locale !== void 0) _coreConfig.locale = config.locale;
|
|
43
44
|
if (config.timezone !== void 0) _coreConfig.timezone = config.timezone;
|
|
44
45
|
if (config.apiBaseUrl !== void 0) _coreConfig.apiBaseUrl = config.apiBaseUrl;
|
|
46
|
+
if ("currency" in config) _coreConfig.currency = config.currency;
|
|
45
47
|
}
|
|
46
48
|
/**
|
|
47
49
|
* @deprecated Use configureCore() instead.
|
|
@@ -56,21 +58,28 @@ function getCoreTimezone() {
|
|
|
56
58
|
function getCoreApiBaseUrl() {
|
|
57
59
|
return _coreConfig.apiBaseUrl;
|
|
58
60
|
}
|
|
61
|
+
/** App-wide default currency (ISO 4217), or undefined when not configured. */
|
|
62
|
+
function getCoreCurrency() {
|
|
63
|
+
return _coreConfig.currency;
|
|
64
|
+
}
|
|
59
65
|
const CoreConfigContext = react.default.createContext(_coreConfig);
|
|
60
|
-
const CoreConfigProvider = ({ locale, timezone, apiBaseUrl, children }) => {
|
|
66
|
+
const CoreConfigProvider = ({ locale, timezone, apiBaseUrl, currency, children }) => {
|
|
61
67
|
configureCore({
|
|
62
68
|
locale,
|
|
63
69
|
timezone,
|
|
64
|
-
apiBaseUrl
|
|
70
|
+
apiBaseUrl,
|
|
71
|
+
currency
|
|
65
72
|
});
|
|
66
73
|
const value = react.default.useMemo(() => ({
|
|
67
74
|
locale,
|
|
68
75
|
timezone,
|
|
69
|
-
apiBaseUrl
|
|
76
|
+
apiBaseUrl,
|
|
77
|
+
currency
|
|
70
78
|
}), [
|
|
71
79
|
locale,
|
|
72
80
|
timezone,
|
|
73
|
-
apiBaseUrl
|
|
81
|
+
apiBaseUrl,
|
|
82
|
+
currency
|
|
74
83
|
]);
|
|
75
84
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CoreConfigContext.Provider, {
|
|
76
85
|
value,
|
|
@@ -340,6 +349,9 @@ const coreTranslationsEs = {
|
|
|
340
349
|
"form.searchButton": "Buscar",
|
|
341
350
|
"form.actionButton": "Acción",
|
|
342
351
|
"form.detailTitle": "Detalle",
|
|
352
|
+
"form.lookupClear": "Limpiar {{label}}",
|
|
353
|
+
"form.lookupOpen": "Abrir {{label}}",
|
|
354
|
+
"form.tabsAriaLabel": "Secciones del formulario",
|
|
343
355
|
"form.lookupSearching": "Buscando...",
|
|
344
356
|
"form.lookupNoResults": "Sin resultados",
|
|
345
357
|
"form.lookupLoadingMore": "Cargando más...",
|
|
@@ -453,6 +465,9 @@ const coreTranslationsEn = {
|
|
|
453
465
|
"form.searchButton": "Search",
|
|
454
466
|
"form.actionButton": "Action",
|
|
455
467
|
"form.detailTitle": "Detail",
|
|
468
|
+
"form.lookupClear": "Clear {{label}}",
|
|
469
|
+
"form.lookupOpen": "Open {{label}}",
|
|
470
|
+
"form.tabsAriaLabel": "Form sections",
|
|
456
471
|
"form.lookupSearching": "Searching...",
|
|
457
472
|
"form.lookupNoResults": "No results",
|
|
458
473
|
"form.lookupLoadingMore": "Loading more...",
|
|
@@ -934,6 +949,7 @@ exports.createCrudEvents = createCrudEvents;
|
|
|
934
949
|
exports.createScopedEventBus = createScopedEventBus;
|
|
935
950
|
exports.dispatch = dispatch;
|
|
936
951
|
exports.getCoreApiBaseUrl = getCoreApiBaseUrl;
|
|
952
|
+
exports.getCoreCurrency = getCoreCurrency;
|
|
937
953
|
exports.getCoreLocale = getCoreLocale;
|
|
938
954
|
exports.getCoreTimezone = getCoreTimezone;
|
|
939
955
|
exports.initCoreI18n = initCoreI18n;
|
package/dist/index.d.cts
CHANGED
|
@@ -32,6 +32,12 @@ interface CoreConfig {
|
|
|
32
32
|
locale: string;
|
|
33
33
|
timezone: string;
|
|
34
34
|
apiBaseUrl: string;
|
|
35
|
+
/**
|
|
36
|
+
* ISO 4217 currency code used as the app-wide default by money formatters
|
|
37
|
+
* (e.g. summary `valueFormat: 'currency'`). No library default: when unset,
|
|
38
|
+
* formatters that need a currency fall back to plain fixed-point output.
|
|
39
|
+
*/
|
|
40
|
+
currency?: string;
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
43
|
* Configure core runtime values (locale, timezone, apiBaseUrl).
|
|
@@ -46,16 +52,21 @@ declare const configureCoreDate: typeof configureCore;
|
|
|
46
52
|
declare function getCoreLocale(): string;
|
|
47
53
|
declare function getCoreTimezone(): string;
|
|
48
54
|
declare function getCoreApiBaseUrl(): string;
|
|
55
|
+
/** App-wide default currency (ISO 4217), or undefined when not configured. */
|
|
56
|
+
declare function getCoreCurrency(): string | undefined;
|
|
49
57
|
interface CoreConfigProviderProps {
|
|
50
58
|
locale: string;
|
|
51
59
|
timezone: string;
|
|
52
60
|
apiBaseUrl: string;
|
|
61
|
+
/** ISO 4217 app-wide default currency for money formatters (e.g. 'PEN', 'USD'). */
|
|
62
|
+
currency?: string;
|
|
53
63
|
children: React.ReactNode;
|
|
54
64
|
}
|
|
55
65
|
declare const CoreConfigProvider: ({
|
|
56
66
|
locale,
|
|
57
67
|
timezone,
|
|
58
68
|
apiBaseUrl,
|
|
69
|
+
currency,
|
|
59
70
|
children
|
|
60
71
|
}: CoreConfigProviderProps) => React.JSX.Element;
|
|
61
72
|
declare function useCoreConfig(): CoreConfig;
|
|
@@ -253,6 +264,9 @@ interface CoreTranslationKeys {
|
|
|
253
264
|
'form.searchButton': string;
|
|
254
265
|
'form.actionButton': string;
|
|
255
266
|
'form.detailTitle': string;
|
|
267
|
+
'form.lookupClear': string;
|
|
268
|
+
'form.lookupOpen': string;
|
|
269
|
+
'form.tabsAriaLabel': string;
|
|
256
270
|
'form.lookupSearching': string;
|
|
257
271
|
'form.lookupNoResults': string;
|
|
258
272
|
'form.lookupLoadingMore': string;
|
|
@@ -545,4 +559,4 @@ declare class MercureManager {
|
|
|
545
559
|
/** Singleton instance — shared across the entire application. */
|
|
546
560
|
declare const mercureManager: MercureManager;
|
|
547
561
|
//#endregion
|
|
548
|
-
export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FormEventNames, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type ScopedFormEventNames, type ToolbarButtonItem, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, dispatch, getCoreApiBaseUrl, getCoreLocale, getCoreTimezone, initCoreI18n, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useEvents, useMercureHub, useMercureSubscription };
|
|
562
|
+
export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FormEventNames, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type ScopedFormEventNames, type ToolbarButtonItem, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, dispatch, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, initCoreI18n, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useEvents, useMercureHub, useMercureSubscription };
|
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,12 @@ interface CoreConfig {
|
|
|
32
32
|
locale: string;
|
|
33
33
|
timezone: string;
|
|
34
34
|
apiBaseUrl: string;
|
|
35
|
+
/**
|
|
36
|
+
* ISO 4217 currency code used as the app-wide default by money formatters
|
|
37
|
+
* (e.g. summary `valueFormat: 'currency'`). No library default: when unset,
|
|
38
|
+
* formatters that need a currency fall back to plain fixed-point output.
|
|
39
|
+
*/
|
|
40
|
+
currency?: string;
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
43
|
* Configure core runtime values (locale, timezone, apiBaseUrl).
|
|
@@ -46,16 +52,21 @@ declare const configureCoreDate: typeof configureCore;
|
|
|
46
52
|
declare function getCoreLocale(): string;
|
|
47
53
|
declare function getCoreTimezone(): string;
|
|
48
54
|
declare function getCoreApiBaseUrl(): string;
|
|
55
|
+
/** App-wide default currency (ISO 4217), or undefined when not configured. */
|
|
56
|
+
declare function getCoreCurrency(): string | undefined;
|
|
49
57
|
interface CoreConfigProviderProps {
|
|
50
58
|
locale: string;
|
|
51
59
|
timezone: string;
|
|
52
60
|
apiBaseUrl: string;
|
|
61
|
+
/** ISO 4217 app-wide default currency for money formatters (e.g. 'PEN', 'USD'). */
|
|
62
|
+
currency?: string;
|
|
53
63
|
children: React.ReactNode;
|
|
54
64
|
}
|
|
55
65
|
declare const CoreConfigProvider: ({
|
|
56
66
|
locale,
|
|
57
67
|
timezone,
|
|
58
68
|
apiBaseUrl,
|
|
69
|
+
currency,
|
|
59
70
|
children
|
|
60
71
|
}: CoreConfigProviderProps) => React.JSX.Element;
|
|
61
72
|
declare function useCoreConfig(): CoreConfig;
|
|
@@ -253,6 +264,9 @@ interface CoreTranslationKeys {
|
|
|
253
264
|
'form.searchButton': string;
|
|
254
265
|
'form.actionButton': string;
|
|
255
266
|
'form.detailTitle': string;
|
|
267
|
+
'form.lookupClear': string;
|
|
268
|
+
'form.lookupOpen': string;
|
|
269
|
+
'form.tabsAriaLabel': string;
|
|
256
270
|
'form.lookupSearching': string;
|
|
257
271
|
'form.lookupNoResults': string;
|
|
258
272
|
'form.lookupLoadingMore': string;
|
|
@@ -545,4 +559,4 @@ declare class MercureManager {
|
|
|
545
559
|
/** Singleton instance — shared across the entire application. */
|
|
546
560
|
declare const mercureManager: MercureManager;
|
|
547
561
|
//#endregion
|
|
548
|
-
export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FormEventNames, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type ScopedFormEventNames, type ToolbarButtonItem, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, dispatch, getCoreApiBaseUrl, getCoreLocale, getCoreTimezone, initCoreI18n, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useEvents, useMercureHub, useMercureSubscription };
|
|
562
|
+
export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FormEventNames, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type ScopedFormEventNames, type ToolbarButtonItem, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, dispatch, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, initCoreI18n, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useEvents, useMercureHub, useMercureSubscription };
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,8 @@ import i18next from "i18next";
|
|
|
6
6
|
const _coreConfig = {
|
|
7
7
|
locale: "es",
|
|
8
8
|
timezone: "UTC",
|
|
9
|
-
apiBaseUrl: "/api/"
|
|
9
|
+
apiBaseUrl: "/api/",
|
|
10
|
+
currency: void 0
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* Configure core runtime values (locale, timezone, apiBaseUrl).
|
|
@@ -17,6 +18,7 @@ function configureCore(config) {
|
|
|
17
18
|
if (config.locale !== void 0) _coreConfig.locale = config.locale;
|
|
18
19
|
if (config.timezone !== void 0) _coreConfig.timezone = config.timezone;
|
|
19
20
|
if (config.apiBaseUrl !== void 0) _coreConfig.apiBaseUrl = config.apiBaseUrl;
|
|
21
|
+
if ("currency" in config) _coreConfig.currency = config.currency;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* @deprecated Use configureCore() instead.
|
|
@@ -31,21 +33,28 @@ function getCoreTimezone() {
|
|
|
31
33
|
function getCoreApiBaseUrl() {
|
|
32
34
|
return _coreConfig.apiBaseUrl;
|
|
33
35
|
}
|
|
36
|
+
/** App-wide default currency (ISO 4217), or undefined when not configured. */
|
|
37
|
+
function getCoreCurrency() {
|
|
38
|
+
return _coreConfig.currency;
|
|
39
|
+
}
|
|
34
40
|
const CoreConfigContext = React.createContext(_coreConfig);
|
|
35
|
-
const CoreConfigProvider = ({ locale, timezone, apiBaseUrl, children }) => {
|
|
41
|
+
const CoreConfigProvider = ({ locale, timezone, apiBaseUrl, currency, children }) => {
|
|
36
42
|
configureCore({
|
|
37
43
|
locale,
|
|
38
44
|
timezone,
|
|
39
|
-
apiBaseUrl
|
|
45
|
+
apiBaseUrl,
|
|
46
|
+
currency
|
|
40
47
|
});
|
|
41
48
|
const value = React.useMemo(() => ({
|
|
42
49
|
locale,
|
|
43
50
|
timezone,
|
|
44
|
-
apiBaseUrl
|
|
51
|
+
apiBaseUrl,
|
|
52
|
+
currency
|
|
45
53
|
}), [
|
|
46
54
|
locale,
|
|
47
55
|
timezone,
|
|
48
|
-
apiBaseUrl
|
|
56
|
+
apiBaseUrl,
|
|
57
|
+
currency
|
|
49
58
|
]);
|
|
50
59
|
return /* @__PURE__ */ jsx(CoreConfigContext.Provider, {
|
|
51
60
|
value,
|
|
@@ -315,6 +324,9 @@ const coreTranslationsEs = {
|
|
|
315
324
|
"form.searchButton": "Buscar",
|
|
316
325
|
"form.actionButton": "Acción",
|
|
317
326
|
"form.detailTitle": "Detalle",
|
|
327
|
+
"form.lookupClear": "Limpiar {{label}}",
|
|
328
|
+
"form.lookupOpen": "Abrir {{label}}",
|
|
329
|
+
"form.tabsAriaLabel": "Secciones del formulario",
|
|
318
330
|
"form.lookupSearching": "Buscando...",
|
|
319
331
|
"form.lookupNoResults": "Sin resultados",
|
|
320
332
|
"form.lookupLoadingMore": "Cargando más...",
|
|
@@ -428,6 +440,9 @@ const coreTranslationsEn = {
|
|
|
428
440
|
"form.searchButton": "Search",
|
|
429
441
|
"form.actionButton": "Action",
|
|
430
442
|
"form.detailTitle": "Detail",
|
|
443
|
+
"form.lookupClear": "Clear {{label}}",
|
|
444
|
+
"form.lookupOpen": "Open {{label}}",
|
|
445
|
+
"form.tabsAriaLabel": "Form sections",
|
|
431
446
|
"form.lookupSearching": "Searching...",
|
|
432
447
|
"form.lookupNoResults": "No results",
|
|
433
448
|
"form.lookupLoadingMore": "Loading more...",
|
|
@@ -891,4 +906,4 @@ function useMercureSubscription(apiUrl, onUpdate, enabled = true) {
|
|
|
891
906
|
]);
|
|
892
907
|
}
|
|
893
908
|
//#endregion
|
|
894
|
-
export { CoreConfigProvider, CoreHttpClient, CoreHttpProvider, CoreProvider, CoreRuntimeProvider, DEFAULT_TIMEZONE, DateUtils, mercureManager as MercureManager, MercureProvider, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, dispatch, getCoreApiBaseUrl, getCoreLocale, getCoreTimezone, initCoreI18n, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useEvents, useMercureHub, useMercureSubscription };
|
|
909
|
+
export { CoreConfigProvider, CoreHttpClient, CoreHttpProvider, CoreProvider, CoreRuntimeProvider, DEFAULT_TIMEZONE, DateUtils, mercureManager as MercureManager, MercureProvider, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, dispatch, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, initCoreI18n, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useEvents, useMercureHub, useMercureSubscription };
|
package/package.json
CHANGED