siam-ui-utils 1.0.11 → 1.0.13
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/.eslintrc +76 -0
- package/dist_browser/src/IntlMessages.tsx +4 -1
- package/dist_browser/src/commons/defaultValues.ts +29 -0
- package/dist_browser/src/iconos/codigo-verificacion-icon.jsx +1 -1
- package/dist_browser/src/iconos/forgot-dni-icon.jsx +1 -1
- package/dist_browser/src/iconos/forgot-password-icon.jsx +1 -1
- package/dist_browser/src/iconos/user/styled-icon.jsx +2 -2
- package/dist_browser/src/index.ts +10 -4
- package/dist_browser/src/utils-arrays-reducers.ts +142 -0
- package/dist_browser/src/utils-currency.ts +39 -0
- package/dist_browser/src/utils-number.ts +39 -0
- package/dist_browser/src/utils-temp.ts +52 -0
- package/index.d.ts +58 -105
- package/package.json +10 -2
- package/src/IntlMessages.tsx +4 -1
- package/src/commons/defaultValues.ts +29 -0
- package/src/iconos/codigo-verificacion-icon.jsx +1 -1
- package/src/iconos/forgot-dni-icon.jsx +1 -1
- package/src/iconos/forgot-password-icon.jsx +1 -1
- package/src/iconos/user/styled-icon.jsx +2 -2
package/.eslintrc
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"node": true,
|
|
5
|
+
"commonjs": true,
|
|
6
|
+
"es2021": true
|
|
7
|
+
},
|
|
8
|
+
"settings": {
|
|
9
|
+
"import/resolver": {
|
|
10
|
+
"node": {
|
|
11
|
+
"extensions": [
|
|
12
|
+
".js",
|
|
13
|
+
".jsx",
|
|
14
|
+
".ts",
|
|
15
|
+
".tsx"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"react": {
|
|
20
|
+
"version": "detect"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"extends": [
|
|
24
|
+
"eslint:recommended",
|
|
25
|
+
"plugin:jsx-a11y/strict",
|
|
26
|
+
"plugin:react/recommended",
|
|
27
|
+
"plugin:@typescript-eslint/recommended",
|
|
28
|
+
"plugin:import/recommended",
|
|
29
|
+
"plugin:react-hooks/recommended"
|
|
30
|
+
],
|
|
31
|
+
"overrides": [],
|
|
32
|
+
"parser": "@typescript-eslint/parser",
|
|
33
|
+
"parserOptions": {
|
|
34
|
+
"ecmaVersion": "latest"
|
|
35
|
+
},
|
|
36
|
+
"plugins": [
|
|
37
|
+
"react",
|
|
38
|
+
"react-hooks",
|
|
39
|
+
"@typescript-eslint",
|
|
40
|
+
"prettier"
|
|
41
|
+
],
|
|
42
|
+
"rules": {
|
|
43
|
+
"no-constant-condition": "warn",
|
|
44
|
+
"@typescript-eslint/no-empty-function": "warn",
|
|
45
|
+
"no-prototype-builtins": "warn",
|
|
46
|
+
"jsx-a11y/no-static-element-interactions": "warn",
|
|
47
|
+
"jsx-a11y/click-events-have-key-events": "warn",
|
|
48
|
+
"jsx-a11y/no-noninteractive-element-interactions": "warn",
|
|
49
|
+
"@typescript-eslint/ban-types": "warn",
|
|
50
|
+
"import/no-duplicates": "warn",
|
|
51
|
+
"@typescript-eslint/no-extra-semi": "warn",
|
|
52
|
+
"@typescript-eslint/no-inferrable-types": "warn",
|
|
53
|
+
"react/prop-types": "off",
|
|
54
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
55
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
56
|
+
"prefer-const": "warn",
|
|
57
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
|
58
|
+
"jsx-a11y/label-has-associated-control": "warn",
|
|
59
|
+
"no-case-declarations": "warn",
|
|
60
|
+
"no-irregular-whitespace": "warn",
|
|
61
|
+
"@typescript-eslint/no-var-requires": "warn",
|
|
62
|
+
"no-empty": "warn",
|
|
63
|
+
"react/no-deprecated": "warn",
|
|
64
|
+
"import/prefer-default-export": "warn",
|
|
65
|
+
"import/no-cycle": "warn",
|
|
66
|
+
"react/no-unknown-property": "warn",
|
|
67
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
68
|
+
"react/no-find-dom-node": "warn",
|
|
69
|
+
"prettier/prettier": [
|
|
70
|
+
"warn",
|
|
71
|
+
{
|
|
72
|
+
"endOfLine": "crlf"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const idMutualToCodMutual: { [x: string]: string } = {
|
|
2
|
+
"01": "AMPF",
|
|
3
|
+
"02": "AMPC",
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const numberLocalConf: {
|
|
7
|
+
locales: string;
|
|
8
|
+
minimumFractionDigits: number;
|
|
9
|
+
maximumFractionDigits: number;
|
|
10
|
+
style: string;
|
|
11
|
+
currency: string;
|
|
12
|
+
} = {
|
|
13
|
+
locales: "es-AR",
|
|
14
|
+
minimumFractionDigits: 2,
|
|
15
|
+
maximumFractionDigits: 2,
|
|
16
|
+
style: "currency",
|
|
17
|
+
currency: "ARS",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const fieldTypes = {
|
|
21
|
+
string: 'string',
|
|
22
|
+
number: 'number',
|
|
23
|
+
date: 'date',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const defaultDirection = 'ltr';
|
|
28
|
+
|
|
29
|
+
export { idMutualToCodMutual, numberLocalConf, fieldTypes, defaultDirection };
|
|
@@ -3,7 +3,7 @@ import { styled } from 'styled-components';
|
|
|
3
3
|
// eslint-disable-next-line react/react-in-jsx-scope
|
|
4
4
|
const IconDiv = (props) => <div {...props} />;
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const UserIcon = styled(IconDiv)`
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
justify-content: center;
|
|
@@ -19,4 +19,4 @@ export const Icon = styled(IconDiv)`
|
|
|
19
19
|
display: ${(props) => props.display || 'none'};
|
|
20
20
|
}
|
|
21
21
|
`;
|
|
22
|
-
export default
|
|
22
|
+
export default UserIcon;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
1
|
+
export * from "./auth-header";
|
|
2
|
+
export * from "./utils";
|
|
3
|
+
export * from "./utils-arrays-reducers";
|
|
4
|
+
export * from "./utils-boolean";
|
|
5
|
+
export * from "./utils-currency";
|
|
6
|
+
export * from "./utils-dates";
|
|
7
|
+
export * from "./utils-error";
|
|
8
|
+
export * from "./utils-number";
|
|
9
|
+
export * from "./utils-percent";
|
|
10
|
+
export * from "./utils-temp";
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { fieldToDate } from './utils-dates.js';
|
|
2
|
+
import { fieldTypes} from './commons/defaultValues.js';
|
|
3
|
+
|
|
4
|
+
export const addSelectedFieldToList = (list: any[], selected = false) =>
|
|
5
|
+
list.map((item: any) => {
|
|
6
|
+
return { ...item, selected };
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const updateSelectedItemInList = (list: any[], keyField: string | number, idItem: any) =>
|
|
10
|
+
list.map((item: { [x: string]: any; selected: any; }) => {
|
|
11
|
+
return item[keyField] === idItem
|
|
12
|
+
? { ...item, selected: !item.selected }
|
|
13
|
+
: { ...item };
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const updateAllSelectedItemInList = (list: any[], newValue: any) =>
|
|
17
|
+
list.map((item: any) => {
|
|
18
|
+
return { ...item, selected: newValue };
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const toogleAllSelectedItemInList = (list: any[]) =>
|
|
22
|
+
list.map((item: { selected: any; }) => {
|
|
23
|
+
return { ...item, selected: !item.selected };
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const countItemsSelectedInList = (list: any[]) => {
|
|
27
|
+
return (list.filter((i: { selected: any; }) => i.selected) || []).length;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const castField = (field: string, type: any) => {
|
|
31
|
+
const { date, string, number } = fieldTypes;
|
|
32
|
+
switch (type) {
|
|
33
|
+
case number:
|
|
34
|
+
return Number(field);
|
|
35
|
+
case date:
|
|
36
|
+
return fieldToDate(field);
|
|
37
|
+
case string:
|
|
38
|
+
return field;
|
|
39
|
+
default:
|
|
40
|
+
return field;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const sortList = (list: { id: any; name: any; tag: any; count: any; }[], ...properties: { value: string; field: string; type: string; }[]) => {
|
|
45
|
+
let tmpList = list;
|
|
46
|
+
properties.forEach((p) => {
|
|
47
|
+
const { field, type } = p;
|
|
48
|
+
tmpList = tmpList.sort((a: { [x: string]: any; }, b: { [x: string]: any; }) =>
|
|
49
|
+
castField(a[field], type) < castField(b[field], type) ? -1 : 1
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
return tmpList;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const miGroupBy = (objectArray: any[], ...properties: any[]) => {
|
|
56
|
+
return [
|
|
57
|
+
...Object.values(
|
|
58
|
+
objectArray.reduce((accumulator: { [x: string]: any[]; }, object: { [x: string]: any; }) => {
|
|
59
|
+
const key = JSON.stringify(properties.map((x) => object[x] || null));
|
|
60
|
+
|
|
61
|
+
if (!accumulator[key]) {
|
|
62
|
+
accumulator[key] = [];
|
|
63
|
+
}
|
|
64
|
+
accumulator[key].push(object);
|
|
65
|
+
return accumulator;
|
|
66
|
+
}, {})
|
|
67
|
+
),
|
|
68
|
+
];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const getFilterItems = (dataArray: any, ...properties: (string | number)[]) => {
|
|
72
|
+
const dataGroupBy = miGroupBy(dataArray, ...properties);
|
|
73
|
+
const sumGroupBy = dataGroupBy.map((group) => ({
|
|
74
|
+
id: (group as any)[0][properties[0]],
|
|
75
|
+
name: (group as any)[0][properties[1]],
|
|
76
|
+
tag: (group as any)[0][properties[2]],
|
|
77
|
+
count: (group as any).length,
|
|
78
|
+
}));
|
|
79
|
+
return sortList(sumGroupBy, { value: 'name', field: 'name', type: 'string' });
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const filterListByItem = (list: any[], itemName: string | number, filterValue: any) => {
|
|
83
|
+
return list.filter((item: { [x: string]: any; }) => item[itemName] === filterValue);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const applyFilterToList = (list: any, filtersToApply: any) => {
|
|
87
|
+
let listFiltered = list;
|
|
88
|
+
for (const itemToFilter of filtersToApply) {
|
|
89
|
+
const { fieldName, fieldValue } = itemToFilter;
|
|
90
|
+
if (fieldValue) {
|
|
91
|
+
listFiltered = filterListByItem(listFiltered, fieldName, fieldValue);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return listFiltered;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const sumField = (data: any[], field: string | number) => {
|
|
98
|
+
return data.reduce(
|
|
99
|
+
(prevValue: number, currentValue: { [x: string]: any; }) =>
|
|
100
|
+
prevValue + parseFloat(currentValue[field] || 0),
|
|
101
|
+
0
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const removeDuplicates = (data: any[], field: string | number) => {
|
|
106
|
+
const hash = {};
|
|
107
|
+
return data.filter((o: { [x: string]: string | number; }) => {
|
|
108
|
+
return (hash as any)[o[field]] ? false : ((hash as any)[o[field]] = true);
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const convertArrayToString = (dataArray: any[], separator = '|') => {
|
|
113
|
+
const cadena = dataArray.join(separator);
|
|
114
|
+
return cadena;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const convertStringToArray = (string: string, separator = '|') => {
|
|
118
|
+
return string ? string.replace(/\s+/g, '').split(separator) : [];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const convertFieldObjStringToArray = (data: any[], field: string | number, separator: string | undefined) => {
|
|
122
|
+
const dataArray = data
|
|
123
|
+
? data.map((item: { [x: string]: any; }) => {
|
|
124
|
+
return {
|
|
125
|
+
...item,
|
|
126
|
+
[field]: item[field]
|
|
127
|
+
? convertStringToArray(item[field], separator)
|
|
128
|
+
: [],
|
|
129
|
+
};
|
|
130
|
+
})
|
|
131
|
+
: [];
|
|
132
|
+
return dataArray;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const updateItemField = (data: any[], id: string | number, idValue: any, fieldName: any, fieldValue: any) => {
|
|
136
|
+
const dataUpdate = data.map((item: { [x: string]: any; }) => {
|
|
137
|
+
return item[id] === idValue
|
|
138
|
+
? { ...item, [fieldName]: fieldValue }
|
|
139
|
+
: { ...item };
|
|
140
|
+
});
|
|
141
|
+
return dataUpdate;
|
|
142
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { numberLocalConf } from "./commons/defaultValues";
|
|
2
|
+
|
|
3
|
+
const { locales, style, currency } = numberLocalConf;
|
|
4
|
+
|
|
5
|
+
const formatter = new Intl.NumberFormat(locales, {
|
|
6
|
+
style,
|
|
7
|
+
currency,
|
|
8
|
+
} as any);
|
|
9
|
+
|
|
10
|
+
export const fieldToCurrency = (field: number): string => {
|
|
11
|
+
// ingresa string '99999.99' devuelve string $99.999,99
|
|
12
|
+
return formatter.format(field);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const fieldToNumber = (field: string): number => {
|
|
16
|
+
// ingresa string '99999.99' devuelve flotante '99999.99'
|
|
17
|
+
return parseFloat(field);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const currencyToNumber = (
|
|
21
|
+
currencyValue: string,
|
|
22
|
+
returnZero?: boolean
|
|
23
|
+
): number => {
|
|
24
|
+
// ingresa $99.999,99 devuelve flotante '99999.99'
|
|
25
|
+
if (returnZero && !currencyValue) {
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
let stringValue = currencyValue.toString().replace("$", "");
|
|
29
|
+
stringValue = stringValue.replace(/[.]/g, "");
|
|
30
|
+
stringValue = stringValue.replace(",", ".");
|
|
31
|
+
return parseFloat(stringValue);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Esta funcion debe devolver un STRING !!!! revisar compatibilidad...
|
|
35
|
+
export const currencyToPersistence = (currencyValue: string): string => {
|
|
36
|
+
// ingresa $99.999,99 devuelve string '99999.99'
|
|
37
|
+
const stringValue = currencyToNumber(currencyValue);
|
|
38
|
+
return stringValue.toString();
|
|
39
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { numberLocalConf } from "./commons/defaultValues";
|
|
2
|
+
|
|
3
|
+
const { locales, minimumFractionDigits, maximumFractionDigits, currency } =
|
|
4
|
+
numberLocalConf;
|
|
5
|
+
|
|
6
|
+
export const numberToDisplay = (
|
|
7
|
+
number: number,
|
|
8
|
+
fractionDigits: number = 0
|
|
9
|
+
): string => {
|
|
10
|
+
return number.toLocaleString(locales, {
|
|
11
|
+
minimumFractionDigits: fractionDigits,
|
|
12
|
+
maximumFractionDigits: fractionDigits,
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const numberToDisplayCurrency = (number: number): string => {
|
|
17
|
+
if (number === null || number === undefined) {
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
const res = number.toLocaleString(locales, {
|
|
21
|
+
minimumFractionDigits,
|
|
22
|
+
maximumFractionDigits,
|
|
23
|
+
style: "currency",
|
|
24
|
+
currency,
|
|
25
|
+
});
|
|
26
|
+
return res;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const numberToPersistence = (number: string): string | null => {
|
|
30
|
+
return number === "" ? null : number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const numberToStringifyPersistence = (number: number): string => {
|
|
34
|
+
return String(number);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const comprobanteToPersistence = (comprobanteStr: string): string => {
|
|
38
|
+
return comprobanteStr.replace(/[-]/g, "");
|
|
39
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defaultDirection } from './commons/defaultValues.js';
|
|
2
|
+
|
|
3
|
+
export const getDirection = () => {
|
|
4
|
+
let direction = defaultDirection;
|
|
5
|
+
if (localStorage.getItem('direction')) {
|
|
6
|
+
const localValue = localStorage.getItem('direction');
|
|
7
|
+
if (localValue === 'rtl' || localValue === 'ltr') {
|
|
8
|
+
direction = localValue;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
direction,
|
|
13
|
+
isRtl: direction === 'rtl',
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const setDirection = (localValue: string) => {
|
|
18
|
+
let direction = 'ltr';
|
|
19
|
+
if (localValue === 'rtl' || localValue === 'ltr') {
|
|
20
|
+
direction = localValue;
|
|
21
|
+
}
|
|
22
|
+
localStorage.setItem('direction', direction);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const getStartPath = () => {
|
|
26
|
+
const isReactProxyEnabled =
|
|
27
|
+
(localStorage.getItem('reactProxy') || 'N') === 'S';
|
|
28
|
+
const startPath = isReactProxyEnabled ? '/app' : '';
|
|
29
|
+
return startPath;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const toUpper = (payload: { [x: string]: any; }) => {
|
|
33
|
+
for (const prop in payload) {
|
|
34
|
+
if (typeof payload[prop] === 'string') {
|
|
35
|
+
payload[prop] = payload[prop].toUpperCase();
|
|
36
|
+
}
|
|
37
|
+
if (typeof payload[prop] === 'object') {
|
|
38
|
+
toUpper(payload[prop]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return payload;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const checkRole = (roles = [], ...properties: any[]) => {
|
|
45
|
+
let result = false;
|
|
46
|
+
properties.forEach((serchRole) => {
|
|
47
|
+
if ((roles as any).includes(serchRole)) {
|
|
48
|
+
result = true;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return result;
|
|
52
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -1,107 +1,60 @@
|
|
|
1
|
-
declare module "siam-utils" {
|
|
2
|
-
//
|
|
3
|
-
export function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
declare module "siam-ui-utils" {
|
|
2
|
+
//CUSTOMBOOSTRAP
|
|
3
|
+
export function Colxx(props);
|
|
4
|
+
export function Separator(props);
|
|
5
|
+
|
|
6
|
+
//CUSTOMSELECTINPUT
|
|
7
|
+
export function CustomSelectInput(props);
|
|
8
|
+
|
|
9
|
+
//ICONOS
|
|
10
|
+
export function AnularAyudaIcon (props);
|
|
11
|
+
export function AsesoriaBurbujaButton(props);
|
|
12
|
+
export function AsesoriaBurbujaIcon (props);
|
|
13
|
+
export function AtencionPresencial(props);
|
|
14
|
+
export function AtencionTelefonica(props);
|
|
15
|
+
export function AtencionTurnoTelefonico(props);
|
|
16
|
+
export function AtencionVirtual(props);
|
|
17
|
+
export function BibliotecaBurbujaButton(props);
|
|
18
|
+
export function BibliotecaBurbujaIcon(props);
|
|
19
|
+
export function CancelarTurnoIcon(props);
|
|
20
|
+
export function CodigoVerificacionIcon(props);
|
|
21
|
+
export const passwordEyeSvg;
|
|
22
|
+
export const passwordEyeOpenSvg;
|
|
23
|
+
export const contactoBarraSup;
|
|
24
|
+
export const pagosMenuLateral;
|
|
25
|
+
export const delegacionMenuLateral;
|
|
26
|
+
export const delegacionesVerde;
|
|
27
|
+
export const telefonoCeleste;
|
|
28
|
+
export const mailRojo;
|
|
29
|
+
export const whatAppIcon;
|
|
30
|
+
export const telefonoEmergencia;
|
|
31
|
+
export const telefonoConsulta;
|
|
32
|
+
export const telefonoExequial;
|
|
33
|
+
export const telefonoSalud;
|
|
34
|
+
export const descarga;
|
|
35
|
+
export const descargaOver;
|
|
36
|
+
export const anularAyuda;
|
|
37
|
+
export const continuar;
|
|
38
|
+
export const pdfImage;
|
|
39
|
+
export function CursoAutogestionadoColor(props);
|
|
40
|
+
export function CursoAutogestionado(props);
|
|
41
|
+
export function CursoBurbujaButton(props);
|
|
42
|
+
export function CursoBurbujaIcon(props);
|
|
43
|
+
export function CursoPresencialColor(props);
|
|
44
|
+
export function CursoPresencial(props);
|
|
45
|
+
export function CursoVirtualColor(props);
|
|
46
|
+
export function CursoVirtual(props);
|
|
47
|
+
export function DelegacionesIcon(props);
|
|
48
|
+
export function ForgotDniIcon(props);
|
|
49
|
+
export function ForgotPasswordIcon(props);
|
|
50
|
+
export function IconButtonSvg(props);
|
|
51
|
+
export function LapizActContactoPerfilButton(props);
|
|
52
|
+
export function Icon(props);
|
|
53
|
+
export function VerificarSinVerificarIcon(props);
|
|
54
|
+
export function VerificarVerificadoIcon(props);
|
|
55
|
+
export function WhatsappIconButton(props);
|
|
56
|
+
|
|
57
|
+
//ICONOS/USER
|
|
58
|
+
export function UserIcon(props);
|
|
7
59
|
|
|
8
|
-
export function fieldToCurrency(field: number): string;
|
|
9
|
-
|
|
10
|
-
export function fieldToNumber(field: string): number;
|
|
11
|
-
|
|
12
|
-
export function currencyToNumber(
|
|
13
|
-
currencyValue: string,
|
|
14
|
-
returnZero?: boolean
|
|
15
|
-
): number;
|
|
16
|
-
|
|
17
|
-
export function currencyToPersistence(currencyValue: string): string;
|
|
18
|
-
|
|
19
|
-
//UTILS-DATES
|
|
20
|
-
|
|
21
|
-
export function fieldToDate(field: string): Date;
|
|
22
|
-
|
|
23
|
-
export function dateToPersistence(date: Date): string;
|
|
24
|
-
|
|
25
|
-
export function periodToPersistence(date: Date): string;
|
|
26
|
-
|
|
27
|
-
export function fieldToPersistence(field: string): string;
|
|
28
|
-
|
|
29
|
-
export function dateToDisplay(date: Date, format: string): string;
|
|
30
|
-
|
|
31
|
-
export function fieldToDisplay(field: string, format: string): string;
|
|
32
|
-
|
|
33
|
-
export function fieldPeriodoToDate(field: string): Date;
|
|
34
|
-
|
|
35
|
-
export function dateToDisplayPeriodo(date: Date): string;
|
|
36
|
-
|
|
37
|
-
export function dateToDisplayDiaMes(date: string): string;
|
|
38
|
-
|
|
39
|
-
export function dateToDisplayHoraMinuto(date: string): string;
|
|
40
|
-
|
|
41
|
-
export function fieldPeriodoToDisplay(field: string): string;
|
|
42
|
-
|
|
43
|
-
export function subtractDays(date: Date, days: number): Date;
|
|
44
|
-
|
|
45
|
-
export function addDays(date: Date, days: number): Date;
|
|
46
|
-
|
|
47
|
-
export function diffDateDays(firstDate: any, secondDate: any): number;
|
|
48
|
-
|
|
49
|
-
export function truncDate(date: Date): Date;
|
|
50
|
-
|
|
51
|
-
//UTILS-ERROR
|
|
52
|
-
export function errorMessage(error: {
|
|
53
|
-
message: any;
|
|
54
|
-
response: { data: { message: any; error: any } };
|
|
55
|
-
}): string;
|
|
56
|
-
|
|
57
|
-
//UTILS-NUMBER
|
|
58
|
-
|
|
59
|
-
export function numberToDisplay(
|
|
60
|
-
number: number,
|
|
61
|
-
fractionDigits: number
|
|
62
|
-
): string;
|
|
63
|
-
|
|
64
|
-
export function numberToDisplayCurrency(number: number): string;
|
|
65
|
-
|
|
66
|
-
export function numberToPersistence(number: string): string | null;
|
|
67
|
-
|
|
68
|
-
export function numberToStringifyPersistence(number: number): string;
|
|
69
|
-
|
|
70
|
-
export function comprobanteToPersistence(comprobanteStr: string): string;
|
|
71
|
-
|
|
72
|
-
//UTILS-PERCENT
|
|
73
|
-
|
|
74
|
-
export function insertSimbol(
|
|
75
|
-
field: string,
|
|
76
|
-
simbol: string,
|
|
77
|
-
position?: string
|
|
78
|
-
): string;
|
|
79
|
-
|
|
80
|
-
export function persistenceToDisplayPercent(
|
|
81
|
-
field: string,
|
|
82
|
-
position?: string
|
|
83
|
-
): string;
|
|
84
|
-
|
|
85
|
-
//UTILS
|
|
86
|
-
|
|
87
|
-
export function mapOrder(array: any, order: any, key: any): any;
|
|
88
|
-
|
|
89
|
-
export function getDateWithFormat(): string;
|
|
90
|
-
|
|
91
|
-
export function getCurrentTime(): string;
|
|
92
|
-
|
|
93
|
-
export function idAyudaToKeyAyuda(idAyuda: string): any;
|
|
94
|
-
|
|
95
|
-
export const isLocalhost: boolean;
|
|
96
|
-
|
|
97
|
-
//UTILS-BOOLEAN
|
|
98
|
-
|
|
99
|
-
export function booleanToPersistence(valueBoolean: boolean): string;
|
|
100
|
-
|
|
101
|
-
export function persistenceToBoolean(valueChar: string): boolean;
|
|
102
|
-
|
|
103
|
-
//AUTH-HEADER
|
|
104
|
-
export function authHeader(): any;
|
|
105
|
-
|
|
106
|
-
export function getAuthUser(): any;
|
|
107
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "siam-ui-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"ampf-react",
|
|
6
6
|
"ampf-utils",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@types/react-intl": "^3.0.0",
|
|
28
|
+
"eslint": "^9.9.1",
|
|
28
29
|
"prop-types": "^15.8.1",
|
|
29
30
|
"react": "^18.3.1",
|
|
30
31
|
"react-intl": "^6.6.8",
|
|
@@ -41,10 +42,17 @@
|
|
|
41
42
|
"@testing-library/jest-dom": "^6.4.8",
|
|
42
43
|
"@testing-library/react": "^16.0.0",
|
|
43
44
|
"@types/react-router-dom": "^5.3.3",
|
|
45
|
+
"@typescript-eslint/parser": "^8.2.0",
|
|
44
46
|
"@vitejs/plugin-react": "^4.3.1",
|
|
45
47
|
"copyfiles": "^2.4.1",
|
|
46
48
|
"typescript": "^5.2.2",
|
|
47
49
|
"vite": "^5.3.4",
|
|
48
|
-
"vitest": "^2.0.5"
|
|
50
|
+
"vitest": "^2.0.5",
|
|
51
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
52
|
+
"eslint-config-prettier": "^8.8.0",
|
|
53
|
+
"eslint-plugin-import": "^2.27.5",
|
|
54
|
+
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
55
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
56
|
+
"eslint-plugin-react": "^7.33.0"
|
|
49
57
|
}
|
|
50
58
|
}
|
package/src/IntlMessages.tsx
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const idMutualToCodMutual: { [x: string]: string } = {
|
|
2
|
+
"01": "AMPF",
|
|
3
|
+
"02": "AMPC",
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const numberLocalConf: {
|
|
7
|
+
locales: string;
|
|
8
|
+
minimumFractionDigits: number;
|
|
9
|
+
maximumFractionDigits: number;
|
|
10
|
+
style: string;
|
|
11
|
+
currency: string;
|
|
12
|
+
} = {
|
|
13
|
+
locales: "es-AR",
|
|
14
|
+
minimumFractionDigits: 2,
|
|
15
|
+
maximumFractionDigits: 2,
|
|
16
|
+
style: "currency",
|
|
17
|
+
currency: "ARS",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const fieldTypes = {
|
|
21
|
+
string: 'string',
|
|
22
|
+
number: 'number',
|
|
23
|
+
date: 'date',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
const defaultDirection = 'ltr';
|
|
28
|
+
|
|
29
|
+
export { idMutualToCodMutual, numberLocalConf, fieldTypes, defaultDirection };
|
|
@@ -3,7 +3,7 @@ import { styled } from 'styled-components';
|
|
|
3
3
|
// eslint-disable-next-line react/react-in-jsx-scope
|
|
4
4
|
const IconDiv = (props) => <div {...props} />;
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const UserIcon = styled(IconDiv)`
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
justify-content: center;
|
|
@@ -19,4 +19,4 @@ export const Icon = styled(IconDiv)`
|
|
|
19
19
|
display: ${(props) => props.display || 'none'};
|
|
20
20
|
}
|
|
21
21
|
`;
|
|
22
|
-
export default
|
|
22
|
+
export default UserIcon;
|