@decaf-ts/for-angular 0.0.17 → 0.0.18
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/assets/i18n/en.json +3 -73
- package/assets/i18n/pt.json +5 -74
- package/components/crud-field/crud-field.component.d.ts +12 -3
- package/components/crud-form/crud-form.component.d.ts +36 -14
- package/components/empty-state/empty-state.component.d.ts +9 -10
- package/components/fieldset/fieldset.component.d.ts +9 -0
- package/components/filter/filter.component.d.ts +11 -2
- package/engine/NgxBaseComponent.d.ts +39 -39
- package/engine/NgxCrudFormField.d.ts +2 -1
- package/engine/NgxRenderingEngine.d.ts +44 -16
- package/engine/interfaces.d.ts +10 -0
- package/engine/types.d.ts +8 -0
- package/esm2022/components/crud-field/crud-field.component.mjs +23 -3
- package/esm2022/components/crud-form/crud-form.component.mjs +33 -18
- package/esm2022/components/empty-state/empty-state.component.mjs +11 -10
- package/esm2022/components/fieldset/fieldset.component.mjs +7 -4
- package/esm2022/components/filter/filter.component.mjs +16 -6
- package/esm2022/components/layout/layout.component.mjs +3 -3
- package/esm2022/components/list-item/list-item.component.mjs +4 -4
- package/esm2022/components/pagination/pagination.component.mjs +6 -6
- package/esm2022/engine/NgxBaseComponent.mjs +48 -53
- package/esm2022/engine/NgxCrudFormField.mjs +1 -1
- package/esm2022/engine/NgxRenderingEngine.mjs +20 -4
- package/esm2022/engine/interfaces.mjs +1 -1
- package/esm2022/engine/types.mjs +1 -1
- package/esm2022/helpers/utils.mjs +49 -32
- package/esm2022/i18n/Loader.mjs +82 -0
- package/fesm2022/decaf-ts-for-angular.mjs +288 -134
- package/fesm2022/decaf-ts-for-angular.mjs.map +1 -1
- package/helpers/utils.d.ts +42 -17
- package/i18n/Loader.d.ts +48 -0
- package/package.json +10 -1
package/helpers/utils.d.ts
CHANGED
|
@@ -152,22 +152,7 @@ export declare function isNotUndefined(prop: StringOrBoolean | undefined): boole
|
|
|
152
152
|
* @function getLocaleFromClassName
|
|
153
153
|
* @memberOf module:for-angular
|
|
154
154
|
*/
|
|
155
|
-
export declare function getLocaleFromClassName(instance: string | FunctionLike |
|
|
156
|
-
/**
|
|
157
|
-
* @description Generates a localized string by combining locale and phrase
|
|
158
|
-
* @summary This utility function creates a properly formatted locale string by combining
|
|
159
|
-
* a locale identifier with a phrase. It handles edge cases such as empty phrases,
|
|
160
|
-
* missing locales, and phrases that already include the locale prefix. This function
|
|
161
|
-
* is useful for ensuring consistent formatting of localized strings throughout the application.
|
|
162
|
-
*
|
|
163
|
-
* @param {string} locale - The locale identifier (e.g., 'en', 'fr')
|
|
164
|
-
* @param {string | undefined} phrase - The phrase to localize
|
|
165
|
-
* @return {string} The formatted locale string, or empty string if phrase is undefined
|
|
166
|
-
*
|
|
167
|
-
* @function generateLocaleFromString
|
|
168
|
-
* @memberOf module:for-angular
|
|
169
|
-
*/
|
|
170
|
-
export declare function generateLocaleFromString(locale: string, phrase: string | undefined): string;
|
|
155
|
+
export declare function getLocaleFromClassName(instance: string | FunctionLike | KeyValue, suffix?: string): string;
|
|
171
156
|
/**
|
|
172
157
|
* @description Retrieves the current locale language
|
|
173
158
|
* @summary This utility function gets the current locale language based on the user's browser settings.
|
|
@@ -250,5 +235,45 @@ export declare function itemMapper(item: KeyValue, mapper: KeyValue, props?: Key
|
|
|
250
235
|
* the original item is returned instead.
|
|
251
236
|
*/
|
|
252
237
|
export declare function dataMapper<T>(data: T[], mapper: KeyValue, props?: KeyValue): T[];
|
|
238
|
+
/**
|
|
239
|
+
* @description Removes focus from the currently active DOM element
|
|
240
|
+
* @summary This utility function blurs the currently focused element in the document,
|
|
241
|
+
* effectively removing focus traps that might prevent proper navigation or keyboard
|
|
242
|
+
* interaction. It safely accesses the document's activeElement and calls blur() if
|
|
243
|
+
* an element is currently focused. This is useful for accessibility and user experience
|
|
244
|
+
* improvements, particularly when closing modals or dialogs.
|
|
245
|
+
*
|
|
246
|
+
* @return {void}
|
|
247
|
+
*
|
|
248
|
+
* @function removeFocusTrap
|
|
249
|
+
* @memberOf module:for-angular
|
|
250
|
+
*/
|
|
253
251
|
export declare function removeFocusTrap(): void;
|
|
254
|
-
|
|
252
|
+
/**
|
|
253
|
+
* @description Cleans and normalizes whitespace in a string value
|
|
254
|
+
* @summary This utility function trims leading and trailing whitespace from a string
|
|
255
|
+
* and replaces multiple consecutive whitespace characters with a single space.
|
|
256
|
+
* Optionally converts the result to lowercase for consistent text processing.
|
|
257
|
+
* This is useful for normalizing user input, search terms, or data sanitization.
|
|
258
|
+
*
|
|
259
|
+
* @param {string} value - The string value to clean and normalize
|
|
260
|
+
* @param {boolean} [lowercase=false] - Whether to convert the result to lowercase
|
|
261
|
+
* @return {string} The cleaned and normalized string
|
|
262
|
+
*
|
|
263
|
+
* @function cleanSpaces
|
|
264
|
+
* @memberOf module:for-angular
|
|
265
|
+
*/
|
|
266
|
+
export declare function cleanSpaces(value?: string, lowercase?: boolean): string;
|
|
267
|
+
/**
|
|
268
|
+
* @description Determines if the user's system is currently in dark mode
|
|
269
|
+
* @summary This function checks the user's color scheme preference using the CSS media query
|
|
270
|
+
* '(prefers-color-scheme: dark)'. It returns a boolean indicating whether the system is
|
|
271
|
+
* currently set to dark mode. This is useful for implementing theme-aware functionality
|
|
272
|
+
* and adjusting UI elements based on the user's preferred color scheme.
|
|
273
|
+
*
|
|
274
|
+
* @return {Promise<boolean>} True if the system is in dark mode, false otherwise
|
|
275
|
+
*
|
|
276
|
+
* @function isDarkMode
|
|
277
|
+
* @memberOf module:for-angular
|
|
278
|
+
*/
|
|
279
|
+
export declare function isDarkMode(): Promise<boolean>;
|
package/i18n/Loader.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { TranslateLoader, TranslationObject } from '@ngx-translate/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { I18nResourceConfig } from '../engine/interfaces';
|
|
5
|
+
import { InjectionToken } from '@angular/core';
|
|
6
|
+
import { FunctionLike } from '../engine';
|
|
7
|
+
export declare class I18nLoader {
|
|
8
|
+
static loadFromHttp(http: HttpClient): TranslateLoader;
|
|
9
|
+
}
|
|
10
|
+
export declare function getLocaleContext(clazz: FunctionLike | object | string, suffix?: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* @description Generates a localized string by combining locale and phrase
|
|
13
|
+
* @summary This utility function creates a properly formatted locale string by combining
|
|
14
|
+
* a locale identifier with a phrase. It handles edge cases such as empty phrases,
|
|
15
|
+
* missing locales, and phrases that already include the locale prefix. This function
|
|
16
|
+
* is useful for ensuring consistent formatting of localized strings throughout the application.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} locale - The locale identifier (e.g., 'en', 'fr')
|
|
19
|
+
* @param {string | undefined} phrase - The phrase to localize
|
|
20
|
+
* @return {string} The formatted locale string, or empty string if phrase is undefined
|
|
21
|
+
*
|
|
22
|
+
* @function generateLocaleFromString
|
|
23
|
+
* @memberOf module:for-angular
|
|
24
|
+
*/
|
|
25
|
+
export declare function getLocaleContextByKey(locale: string, phrase: string | undefined): string;
|
|
26
|
+
export declare const I18N_CONFIG_TOKEN: InjectionToken<{
|
|
27
|
+
resources: I18nResourceConfig[];
|
|
28
|
+
versionedSuffix: false;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function I18nLoaderFactory(http: HttpClient): TranslateLoader;
|
|
31
|
+
export declare function getI18nLoaderFactoryProviderConfig(resources?: I18nResourceConfig | I18nResourceConfig[], versionedSuffix?: boolean): {
|
|
32
|
+
provide: InjectionToken<{
|
|
33
|
+
resources: I18nResourceConfig[];
|
|
34
|
+
versionedSuffix: false;
|
|
35
|
+
}>;
|
|
36
|
+
useValue: {
|
|
37
|
+
resources: I18nResourceConfig[];
|
|
38
|
+
versionedSuffix: boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare class MultiI18nLoader implements I18nLoader {
|
|
42
|
+
private http;
|
|
43
|
+
private resources;
|
|
44
|
+
private versionedSuffix;
|
|
45
|
+
constructor(http: HttpClient, resources?: I18nResourceConfig[], versionedSuffix?: boolean);
|
|
46
|
+
private getSuffix;
|
|
47
|
+
getTranslation(lang: string): Observable<TranslationObject>;
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decaf-ts/for-angular",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"author": "Tiago Venceslau",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/decaf-ts/for-angular.git"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=20.0.0",
|
|
12
|
+
"npm": ">=10.0.0"
|
|
13
|
+
},
|
|
6
14
|
"peerDependencies": {
|
|
7
15
|
"@angular/animations": "^18.2.13",
|
|
8
16
|
"@angular/cdk": "^18.2.14",
|
|
@@ -19,6 +27,7 @@
|
|
|
19
27
|
"@decaf-ts/decorator-validation": "^1.6.4",
|
|
20
28
|
"@decaf-ts/for-http": "latest",
|
|
21
29
|
"@decaf-ts/reflection": "latest",
|
|
30
|
+
"@decaf-ts/styles": "^0.0.3",
|
|
22
31
|
"@decaf-ts/ui-decorators": "latest",
|
|
23
32
|
"@ionic/angular": "^8.5.5",
|
|
24
33
|
"@ngx-translate/core": "^16.0.4",
|