@firedesktop/react-base 2.1.25 → 3.0.1
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/LICENSE +162 -0
- package/README.md +174 -94
- package/dist/components/AppIcon.d.ts +20 -20
- package/dist/components/AppIcon.js +53 -64
- package/dist/components/AppIcon.js.map +1 -1
- package/dist/components/AppInput.d.ts +20 -20
- package/dist/components/AppInput.js +7 -18
- package/dist/components/AppInput.js.map +1 -1
- package/dist/components/AppPagination.d.ts +11 -11
- package/dist/components/AppPagination.js +63 -74
- package/dist/components/AppPagination.js.map +1 -1
- package/dist/components/Spin.d.ts +6 -6
- package/dist/components/Spin.js +21 -17
- package/dist/components/Spin.js.map +1 -1
- package/dist/components/Toaster/Toaster.d.ts +7 -7
- package/dist/components/Toaster/Toaster.js +41 -29
- package/dist/components/Toaster/Toaster.js.map +1 -1
- package/dist/components/Toaster/Types.d.ts +6 -6
- package/dist/components/Toaster/Types.js +1 -1
- package/dist/components/index.d.ts +7 -7
- package/dist/components/index.js +7 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/utils/CurrencyUtiles.d.ts +4 -4
- package/dist/utils/CurrencyUtiles.js +35 -30
- package/dist/utils/CurrencyUtiles.js.map +1 -1
- package/dist/utils/DateUtils.d.ts +7 -7
- package/dist/utils/DateUtils.js +111 -100
- package/dist/utils/DateUtils.js.map +1 -1
- package/dist/utils/FileUtils.d.ts +5 -5
- package/dist/utils/FileUtils.js +73 -73
- package/dist/utils/FileUtils.js.map +1 -1
- package/dist/utils/Logger.d.ts +13 -0
- package/dist/utils/Logger.js +44 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/RegExValidation.d.ts +4 -4
- package/dist/utils/RegExValidation.js +19 -19
- package/dist/utils/UrlUtils.d.ts +4 -4
- package/dist/utils/UrlUtils.js +15 -15
- package/dist/utils/UrlUtils.js.map +1 -1
- package/dist/utils/configuration/ConfigurationLoader.d.ts +6 -6
- package/dist/utils/configuration/ConfigurationLoader.js +76 -75
- package/dist/utils/configuration/ConfigurationLoader.js.map +1 -1
- package/dist/utils/configuration/ConfigurationManager.d.ts +5 -5
- package/dist/utils/configuration/ConfigurationManager.js +96 -89
- package/dist/utils/configuration/ConfigurationManager.js.map +1 -1
- package/dist/utils/configuration/ConfigurationReturner.d.ts +9 -9
- package/dist/utils/configuration/ConfigurationReturner.js +70 -69
- package/dist/utils/configuration/ConfigurationReturner.js.map +1 -1
- package/dist/utils/configuration/index.d.ts +4 -4
- package/dist/utils/configuration/index.js +4 -4
- package/dist/utils/fetch/Types.d.ts +10 -10
- package/dist/utils/fetch/Types.js +1 -1
- package/dist/utils/fetch/fetchWrapper.d.ts +14 -14
- package/dist/utils/fetch/fetchWrapper.js +268 -233
- package/dist/utils/fetch/fetchWrapper.js.map +1 -1
- package/dist/utils/fetch/index.d.ts +3 -3
- package/dist/utils/fetch/index.js +3 -3
- package/dist/utils/index.d.ts +10 -9
- package/dist/utils/index.js +10 -9
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/labels/LanguageLoader.d.ts +7 -7
- package/dist/utils/labels/LanguageLoader.js +130 -100
- package/dist/utils/labels/LanguageLoader.js.map +1 -1
- package/dist/utils/labels/LanguageManager.d.ts +6 -6
- package/dist/utils/labels/LanguageManager.js +118 -110
- package/dist/utils/labels/LanguageManager.js.map +1 -1
- package/dist/utils/labels/LanguageReturner.d.ts +10 -10
- package/dist/utils/labels/LanguageReturner.js +70 -69
- package/dist/utils/labels/LanguageReturner.js.map +1 -1
- package/dist/utils/labels/index.d.ts +4 -4
- package/dist/utils/labels/index.js +4 -4
- package/docs/APP_ICON.md +82 -0
- package/docs/APP_INPUT.md +81 -0
- package/docs/APP_PAGINATION.md +61 -0
- package/docs/CONFIGURATION.md +105 -0
- package/docs/FETCH_WRAPPER.md +163 -0
- package/docs/LABELS.md +148 -0
- package/docs/LOGGER.md +112 -0
- package/docs/SECURITY_AUDIT_2026-02-05.md +468 -0
- package/docs/SPIN.md +45 -0
- package/docs/TOASTER.md +75 -0
- package/docs/UTILITIES.md +177 -0
- package/package.json +28 -38
- package/src/App.css +0 -12
- package/src/lib/components/AppIcon.tsx +0 -784
- package/src/lib/components/AppInput.tsx +0 -66
- package/src/lib/components/AppPagination.tsx +0 -124
- package/src/lib/components/Spin.tsx +0 -31
- package/src/lib/components/Toaster/Toaster.tsx +0 -50
- package/src/lib/components/Toaster/Types.ts +0 -11
- package/src/lib/components/index.ts +0 -8
- package/src/lib/index.ts +0 -15
- package/src/lib/styles/base.css +0 -392
- package/src/lib/styles/syncfusion_bootstrap4.css +0 -10
- package/src/lib/styles/toaster.css +0 -50
- package/src/lib/utils/CurrencyUtiles.ts +0 -48
- package/src/lib/utils/DateUtils.ts +0 -135
- package/src/lib/utils/FileUtils.ts +0 -40
- package/src/lib/utils/RegExValidation.ts +0 -49
- package/src/lib/utils/UrlUtils.ts +0 -17
- package/src/lib/utils/configuration/ConfigurationLoader.tsx +0 -43
- package/src/lib/utils/configuration/ConfigurationManager.ts +0 -38
- package/src/lib/utils/configuration/ConfigurationReturner.tsx +0 -39
- package/src/lib/utils/configuration/index.ts +0 -9
- package/src/lib/utils/fetch/Types.ts +0 -11
- package/src/lib/utils/fetch/fetchWrapper.ts +0 -174
- package/src/lib/utils/fetch/index.ts +0 -4
- package/src/lib/utils/index.ts +0 -11
- package/src/lib/utils/labels/LanguageLoader.tsx +0 -69
- package/src/lib/utils/labels/LanguageManager.ts +0 -61
- package/src/lib/utils/labels/LanguageReturner.tsx +0 -41
- package/src/lib/utils/labels/index.ts +0 -9
package/src/lib/utils/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as Fetch from './fetch';
|
|
2
|
-
import * as Configuration from './configuration';
|
|
3
|
-
import CurrencyUtiles from './CurrencyUtiles';
|
|
4
|
-
import DateUtils from './DateUtils';
|
|
5
|
-
import FileUtils from './FileUtils';
|
|
6
|
-
import RegExValidation from './RegExValidation';
|
|
7
|
-
import UrlUtils from './UrlUtils';
|
|
8
|
-
|
|
9
|
-
import * as Labels from './labels';
|
|
10
|
-
|
|
11
|
-
export { Configuration, CurrencyUtiles, DateUtils, Fetch, FileUtils, Labels, RegExValidation, UrlUtils };
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import React, { useEffect } from 'react';
|
|
3
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
-
|
|
5
|
-
import LanguageManager from './LanguageManager';
|
|
6
|
-
|
|
7
|
-
export type languageLoaderParamsType = {
|
|
8
|
-
updateAppState: (name: string, value: object) => any,
|
|
9
|
-
language: string,
|
|
10
|
-
path?: string,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function LanguageLoader({ updateAppState, language, path }: languageLoaderParamsType) {
|
|
14
|
-
const dispatch = useDispatch();
|
|
15
|
-
const labels: any = useSelector((state: any) => state.labels);
|
|
16
|
-
const { loadLabels } = LanguageManager();
|
|
17
|
-
|
|
18
|
-
var avoidCache = new Date().getTime();
|
|
19
|
-
|
|
20
|
-
const fileName = `${language}.json`;
|
|
21
|
-
|
|
22
|
-
const baseLanguageFullPath = `./labels/${fileName}?${avoidCache}`;
|
|
23
|
-
|
|
24
|
-
let fullPath = `./labels/${fileName}?${avoidCache}`;
|
|
25
|
-
if (path)
|
|
26
|
-
fullPath = `./${path}/${fileName}?${avoidCache}`;
|
|
27
|
-
|
|
28
|
-
// Do it on change language
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
async function justAsync() {
|
|
31
|
-
if (!labels || !labels.language || labels.language !== language) {
|
|
32
|
-
|
|
33
|
-
console.log(`Loading Base Language Labels for this Site in this path: ${baseLanguageFullPath}`);
|
|
34
|
-
let allLabels: any = {};
|
|
35
|
-
try {
|
|
36
|
-
allLabels = await loadLabels(baseLanguageFullPath);
|
|
37
|
-
console.log(`Loaded Base Language Labels for this Site in this path: ${baseLanguageFullPath}`, allLabels);
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
console.error(`Problem loading Base Site Language Labels in this path: ${baseLanguageFullPath}`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
console.log(`Loading Custom Language Labels for this Site in this path: ${fullPath}`);
|
|
44
|
-
loadLabels(fullPath).then((response: any) => {
|
|
45
|
-
if (response) {
|
|
46
|
-
console.log(`Loaded Custom Language Labels for this Site in this path: ${fullPath}`, response);
|
|
47
|
-
const merged = _.merge(allLabels, response);
|
|
48
|
-
dispatch(updateAppState('labels', merged));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
console.warn(`Custom Site Language Labels NOT FOUND in this path: ${fullPath}`);
|
|
52
|
-
dispatch(updateAppState('labels', allLabels));
|
|
53
|
-
}
|
|
54
|
-
}).catch((err: any) => {
|
|
55
|
-
console.warn(`Custom Site Language Labels NOT FOUND in this path: ${fullPath}`);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
justAsync();
|
|
60
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
-
}, [language]);
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<>
|
|
65
|
-
</>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default LanguageLoader;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
function LanguageManager() {
|
|
2
|
-
|
|
3
|
-
async function loadLabels(fullPath: string) {
|
|
4
|
-
try {
|
|
5
|
-
const res = await fetch(fullPath, {
|
|
6
|
-
headers: {
|
|
7
|
-
'Content-Type': 'application/json; charset=utf-8',
|
|
8
|
-
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
9
|
-
'Expires': '0',
|
|
10
|
-
'pragma': 'no-cache'
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
return await res.json();
|
|
14
|
-
}
|
|
15
|
-
catch (err) {
|
|
16
|
-
console.warn(`Site Labels, Path ${fullPath} NOT FOUND`);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
async function loadLabelsWithDispatch(dispatch: any, updateAppState: any, labels: any, language: string) {
|
|
21
|
-
if (!labels || !labels.language || labels.language !== language) {
|
|
22
|
-
var avoidCache = new Date().getTime();
|
|
23
|
-
const fullPath = `./labels/${language}.json?${avoidCache}`;
|
|
24
|
-
console.log(`Loading Labels for this Language ${language}, from this path: ${fullPath}`);
|
|
25
|
-
loadLabels(fullPath).then((response: any) => {
|
|
26
|
-
console.log(`Loaded Labels for this Language ${language}`, response);
|
|
27
|
-
dispatch(updateAppState('labels', response));
|
|
28
|
-
}).catch((err: any) => {
|
|
29
|
-
console.warn(`Problem loading the Site Labels, language: ${language}, fullPath: ${fullPath}`);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function getLabel(labels: any, id: string, defaultValue?: string) {
|
|
35
|
-
if (labels === null || labels === undefined)
|
|
36
|
-
return defaultValue || '';
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
const splits = id.split('.');
|
|
40
|
-
let message = labels;
|
|
41
|
-
for (let index = 0; index < splits.length; index++) {
|
|
42
|
-
const element = splits[index];
|
|
43
|
-
message = message[element];
|
|
44
|
-
}
|
|
45
|
-
if (message !== null && message !== undefined)
|
|
46
|
-
return message;
|
|
47
|
-
|
|
48
|
-
return defaultValue ? defaultValue : id;
|
|
49
|
-
} catch (ex) {
|
|
50
|
-
return defaultValue ? defaultValue : id;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
getLabel,
|
|
56
|
-
loadLabels,
|
|
57
|
-
loadLabelsWithDispatch
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default LanguageManager;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
import LanguageManager from './LanguageManager';
|
|
4
|
-
|
|
5
|
-
export type Labels_Type = {
|
|
6
|
-
language: string
|
|
7
|
-
}
|
|
8
|
-
export type languageLoaderParamsType = {
|
|
9
|
-
labels?: Labels_Type
|
|
10
|
-
language: string
|
|
11
|
-
onLanguageLoad: (language?: Labels_Type) => void
|
|
12
|
-
path: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function LanguageReturner({ labels, language, onLanguageLoad, path }: languageLoaderParamsType) {
|
|
16
|
-
const { loadLabels } = LanguageManager();
|
|
17
|
-
|
|
18
|
-
const fullPath = `${path}/${language}.json`;
|
|
19
|
-
|
|
20
|
-
// Do it on change language
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
async function justAsync() {
|
|
23
|
-
if (!labels || !labels.language || labels.language !== language) {
|
|
24
|
-
console.log(`Loading Language Labels for this Path: ${path} in this fullpath: ${fullPath}`);
|
|
25
|
-
await loadLabels(fullPath).then((response: any) => {
|
|
26
|
-
console.log(`Loaded Language Labels for this Path: ${path} in this fullpath: ${fullPath}`, response);
|
|
27
|
-
onLanguageLoad(response);
|
|
28
|
-
}).catch((err: any) => {
|
|
29
|
-
console.error(`Problem loading the Path: ${path} Language Labels in this fullpath: ${fullPath}`);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
justAsync();
|
|
34
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
-
}, [language]);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<React.Fragment>
|
|
39
|
-
</React.Fragment>
|
|
40
|
-
);
|
|
41
|
-
}
|