@fixefy/fixefy-ui-utils 0.0.9 → 0.0.10
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-cjs/index.js +39 -17
- package/dist-cjs/index.js.map +1 -0
- package/{dist-types → dist-cjs/types}/index.d.ts +0 -3
- package/{dist-types → dist-cjs/types}/types/index.d.ts +5 -5
- package/dist-es/index.js +39 -14
- package/dist-es/index.js.map +1 -0
- package/dist-es/types/auth/index.d.ts +2 -0
- package/dist-es/types/aws/data_models.d.ts +21 -0
- package/dist-es/types/commander/index.d.ts +33 -0
- package/dist-es/types/constants/index.d.ts +6 -0
- package/dist-es/types/files/index.d.ts +2 -0
- package/dist-es/types/graphql/index.d.ts +38 -0
- package/dist-es/types/headers/index.d.ts +12 -0
- package/dist-es/types/images/index.d.ts +4 -0
- package/dist-es/types/index.d.ts +11 -0
- package/dist-es/types/json/index.d.ts +7 -0
- package/dist-es/types/page_context/index.d.ts +248 -0
- package/dist-es/types/redirect/index.d.ts +2 -0
- package/dist-es/types/resolvers/index.d.ts +11 -0
- package/dist-es/types/transform/index.d.ts +2 -0
- package/dist-es/types/types/index.d.ts +39 -0
- package/dist-es/types/validate/index.d.ts +5 -0
- package/package.json +71 -64
- package/dist-cjs/auth/index.jsx +0 -13
- package/dist-cjs/aws/aws_lambda_helper.js +0 -49
- package/dist-cjs/aws/aws_s3_helper.js +0 -1
- package/dist-cjs/aws/data_models.js +0 -2
- package/dist-cjs/aws/index.js +0 -4
- package/dist-cjs/commander/index.jsx +0 -280
- package/dist-cjs/constants/index.jsx +0 -87
- package/dist-cjs/contents/index.jsx +0 -32
- package/dist-cjs/files/index.jsx +0 -27
- package/dist-cjs/graphql/index.jsx +0 -217
- package/dist-cjs/headers/index.jsx +0 -68
- package/dist-cjs/images/index.jsx +0 -13
- package/dist-cjs/json/index.js +0 -135
- package/dist-cjs/package.json +0 -3
- package/dist-cjs/page_context/index.jsx +0 -494
- package/dist-cjs/redirect/index.jsx +0 -15
- package/dist-cjs/renderer/index.jsx +0 -66
- package/dist-cjs/resolvers/index.jsx +0 -35
- package/dist-cjs/transform/index.jsx +0 -40
- package/dist-cjs/types/index.js +0 -2
- package/dist-cjs/validate/index.jsx +0 -48
- package/dist-es/auth/index.jsx +0 -11
- package/dist-es/aws/aws_lambda_helper.js +0 -41
- package/dist-es/aws/aws_s3_helper.js +0 -1
- package/dist-es/aws/data_models.js +0 -1
- package/dist-es/commander/index.jsx +0 -250
- package/dist-es/constants/index.jsx +0 -84
- package/dist-es/contents/index.jsx +0 -31
- package/dist-es/files/index.jsx +0 -22
- package/dist-es/graphql/index.jsx +0 -235
- package/dist-es/headers/index.jsx +0 -57
- package/dist-es/images/index.jsx +0 -9
- package/dist-es/json/index.js +0 -125
- package/dist-es/package.json +0 -3
- package/dist-es/page_context/index.jsx +0 -511
- package/dist-es/redirect/index.jsx +0 -12
- package/dist-es/renderer/index.jsx +0 -60
- package/dist-es/resolvers/index.jsx +0 -31
- package/dist-es/transform/index.jsx +0 -35
- package/dist-es/types/index.js +0 -1
- package/dist-es/validate/index.jsx +0 -40
- package/dist-types/aws/aws_lambda_helper.d.ts +0 -5
- package/dist-types/aws/aws_s3_helper.d.ts +0 -0
- package/dist-types/contents/index.d.ts +0 -3
- package/dist-types/renderer/index.d.ts +0 -9
- /package/{dist-types → dist-cjs/types}/auth/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/aws/data_models.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/aws/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/commander/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/constants/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/files/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/graphql/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/headers/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/images/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/json/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/page_context/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/redirect/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/resolvers/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/transform/index.d.ts +0 -0
- /package/{dist-types → dist-cjs/types}/validate/index.d.ts +0 -0
- /package/dist-es/{aws/index.js → types/aws/index.d.ts} +0 -0
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isObjectId = exports.isStringValid = exports.isObjectValid = exports.isDateValid = exports.isArrayValid = void 0;
|
|
4
|
-
const isArrayValid = (arr, minLength = 1, maxLength = 0) => {
|
|
5
|
-
let rv = Object.prototype.toString.call(arr) == '[object Array]' && (0, exports.isObjectValid)(arr) && arr.length >= minLength;
|
|
6
|
-
if (maxLength > 0) {
|
|
7
|
-
rv = rv && arr.length <= maxLength;
|
|
8
|
-
}
|
|
9
|
-
return rv;
|
|
10
|
-
};
|
|
11
|
-
exports.isArrayValid = isArrayValid;
|
|
12
|
-
const isDateValid = (date) => {
|
|
13
|
-
return false;
|
|
14
|
-
};
|
|
15
|
-
exports.isDateValid = isDateValid;
|
|
16
|
-
const isObjectValid = (obj, isCheckKeys = false) => {
|
|
17
|
-
let rv = typeof obj !== 'undefined' && obj !== null;
|
|
18
|
-
if (isCheckKeys) {
|
|
19
|
-
rv = rv && Object.keys(obj).length > 0;
|
|
20
|
-
}
|
|
21
|
-
return rv;
|
|
22
|
-
};
|
|
23
|
-
exports.isObjectValid = isObjectValid;
|
|
24
|
-
const isStringValid = (str, minLength = null, maxLength = null, isValidateType = true) => {
|
|
25
|
-
if (str == null)
|
|
26
|
-
return false;
|
|
27
|
-
if (isValidateType && typeof str !== 'string')
|
|
28
|
-
return false;
|
|
29
|
-
if (str.toString().length == 0)
|
|
30
|
-
return false;
|
|
31
|
-
if (minLength && isNaN(minLength) === false && minLength > 0) {
|
|
32
|
-
return str.toString().length >= minLength;
|
|
33
|
-
}
|
|
34
|
-
if (maxLength && isNaN(maxLength) === false && maxLength > 0) {
|
|
35
|
-
return str.toString().length <= maxLength;
|
|
36
|
-
}
|
|
37
|
-
return true;
|
|
38
|
-
};
|
|
39
|
-
exports.isStringValid = isStringValid;
|
|
40
|
-
const isObjectId = (value) => {
|
|
41
|
-
if ((0, exports.isStringValid)(value) === false)
|
|
42
|
-
return false;
|
|
43
|
-
const regex = /^[0-9a-fA-F]{24}$/;
|
|
44
|
-
const matches = regex.exec(value);
|
|
45
|
-
const rv = matches != null && (0, exports.isArrayValid)(matches);
|
|
46
|
-
return rv;
|
|
47
|
-
};
|
|
48
|
-
exports.isObjectId = isObjectId;
|
package/dist-es/auth/index.jsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { parseCookies } from 'nookies';
|
|
2
|
-
export const attachAuth = (ctx, headers) => {
|
|
3
|
-
const token = getToken(ctx);
|
|
4
|
-
return {
|
|
5
|
-
...headers,
|
|
6
|
-
authorization: `Bearer ${token}`,
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export const getToken = (ctx) => {
|
|
10
|
-
return parseCookies(ctx)['token'];
|
|
11
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import AWS from 'aws-sdk';
|
|
2
|
-
export const getLambda = (args) => {
|
|
3
|
-
const { key, region, secret } = args, lambdaCredentials = new AWS.Credentials({ accessKeyId: key, secretAccessKey: secret }), rv = new AWS.Lambda({ credentials: lambdaCredentials, region, maxRetries: 0, httpOptions: { connectTimeout: 30000, timeout: 300000 } });
|
|
4
|
-
return rv;
|
|
5
|
-
};
|
|
6
|
-
export const getLambdaParams = (args) => {
|
|
7
|
-
const { authorization, file_name, function_name: functionName, raw, ws } = args, clientContextObj = { authorization, file_name, ws }, clientContext = '';
|
|
8
|
-
const rv = {
|
|
9
|
-
ClientContext: clientContext,
|
|
10
|
-
FunctionName: functionName,
|
|
11
|
-
InvocationType: 'RequestResponse',
|
|
12
|
-
Payload: '',
|
|
13
|
-
};
|
|
14
|
-
return rv;
|
|
15
|
-
};
|
|
16
|
-
export const generateMappings = async (args) => {
|
|
17
|
-
const params = getLambdaParams(args);
|
|
18
|
-
const lambda = getLambda(args);
|
|
19
|
-
const p = new Promise((resolve, reject) => {
|
|
20
|
-
lambda.invoke(params, (err, data) => {
|
|
21
|
-
if (err) {
|
|
22
|
-
reject(err);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
resolve(data);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
const result = await p;
|
|
30
|
-
const rv = getLambdaResult({ result });
|
|
31
|
-
return rv;
|
|
32
|
-
};
|
|
33
|
-
export const getLambdaResult = (args) => {
|
|
34
|
-
const { result: { ExecutedVersion: executedVersion, FunctionError: functionError, LogResult: logResult, Payload: payload, StatusCode: statusCode }, } = args;
|
|
35
|
-
let rv = { execute_version: executedVersion, function_error: functionError, log_result: logResult, status_code: statusCode };
|
|
36
|
-
if (payload != null) {
|
|
37
|
-
const payloadObject = JSON.parse(payload);
|
|
38
|
-
rv = { ...rv, body: payloadObject, error: payloadObject.errorMessage };
|
|
39
|
-
}
|
|
40
|
-
return rv;
|
|
41
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { EntityTypes } from '../';
|
|
2
|
-
import { format } from 'date-fns';
|
|
3
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
import NumericHelper from '@fixefy/fixefy-numeric';
|
|
5
|
-
export function buildCode(obj, level = 0, name) {
|
|
6
|
-
const toRender = [];
|
|
7
|
-
const keys = Object.keys(obj);
|
|
8
|
-
if (keys.length < 1) {
|
|
9
|
-
toRender.push(lineString(level, name) + '{}');
|
|
10
|
-
return toRender;
|
|
11
|
-
}
|
|
12
|
-
toRender.push(lineString(level, name) + '{');
|
|
13
|
-
keys.forEach((key) => {
|
|
14
|
-
if (key === '__typename')
|
|
15
|
-
return;
|
|
16
|
-
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
17
|
-
toRender.push(...buildCode(obj[key], level + 1, key));
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
const val = getVal(obj[key]);
|
|
21
|
-
toRender.push(lineString(level + 1, key) + val);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
toRender.push(lineString(level) + '}');
|
|
25
|
-
return toRender;
|
|
26
|
-
}
|
|
27
|
-
export const copyToClipboard = (str) => {
|
|
28
|
-
if (window == undefined)
|
|
29
|
-
return;
|
|
30
|
-
const el = document.createElement('textarea');
|
|
31
|
-
el.value = str;
|
|
32
|
-
el.setAttribute('readonly', '');
|
|
33
|
-
el.style.position = 'absolute';
|
|
34
|
-
el.style.left = '-9999px';
|
|
35
|
-
document.body.appendChild(el);
|
|
36
|
-
el.select();
|
|
37
|
-
document.execCommand('copy');
|
|
38
|
-
document.body.removeChild(el);
|
|
39
|
-
};
|
|
40
|
-
export function convertToString(input) {
|
|
41
|
-
if (input) {
|
|
42
|
-
return typeof input === 'string' ? input : String(input);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export const determineIconByEvent = (event) => {
|
|
46
|
-
let rv;
|
|
47
|
-
if (event) {
|
|
48
|
-
switch (event.type) {
|
|
49
|
-
case 'charged':
|
|
50
|
-
rv = '../../static/images/transactions/billing.svg';
|
|
51
|
-
break;
|
|
52
|
-
case 'packed':
|
|
53
|
-
rv = '../../static/images/transactions/system.svg';
|
|
54
|
-
break;
|
|
55
|
-
default:
|
|
56
|
-
rv = '../../static/images/transactions/user.svg';
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return rv;
|
|
61
|
-
};
|
|
62
|
-
export function formatNumberWithCommas(number) {
|
|
63
|
-
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
64
|
-
}
|
|
65
|
-
export function getNormalizationKeyForEntity(entity_type) {
|
|
66
|
-
let rv;
|
|
67
|
-
switch (entity_type.toLowerCase()) {
|
|
68
|
-
case EntityTypes.User:
|
|
69
|
-
rv = 'username';
|
|
70
|
-
break;
|
|
71
|
-
case EntityTypes.Pricing:
|
|
72
|
-
rv = 'value';
|
|
73
|
-
break;
|
|
74
|
-
case EntityTypes.Metadata:
|
|
75
|
-
rv = 'title';
|
|
76
|
-
break;
|
|
77
|
-
case EntityTypes.Transaction:
|
|
78
|
-
case EntityTypes.Transmission:
|
|
79
|
-
rv = 'readable_id';
|
|
80
|
-
break;
|
|
81
|
-
default:
|
|
82
|
-
rv = 'title';
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
return rv;
|
|
86
|
-
}
|
|
87
|
-
export const getStringValueByValueType = ({ value, name }) => {
|
|
88
|
-
let rv;
|
|
89
|
-
switch (typeof value) {
|
|
90
|
-
case 'boolean':
|
|
91
|
-
rv = value === true ? 'YES' : 'NO';
|
|
92
|
-
break;
|
|
93
|
-
case 'number':
|
|
94
|
-
if (isValidTimestamp(value)) {
|
|
95
|
-
rv = normalizeTimestamp(value, false);
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
let _rv = Number(value) === value && value % 1 === 0 ? value : value.toFixed(2);
|
|
99
|
-
if (name === 'variance') {
|
|
100
|
-
_rv = (_rv * 100).toFixed(1);
|
|
101
|
-
rv = `${_rv}%`;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
rv = _rv;
|
|
105
|
-
}
|
|
106
|
-
break;
|
|
107
|
-
case 'object':
|
|
108
|
-
if (Array.isArray(value)) {
|
|
109
|
-
rv = value.join(', ');
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
const entity_type = value && value.__typename && value.__typename.toLowerCase();
|
|
113
|
-
rv = titleCase(value[getNormalizationKeyForEntity(entity_type)]);
|
|
114
|
-
}
|
|
115
|
-
break;
|
|
116
|
-
case 'string':
|
|
117
|
-
rv = titleCase(value);
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
return rv;
|
|
121
|
-
};
|
|
122
|
-
export function getVal(val) {
|
|
123
|
-
if (typeof val === 'number')
|
|
124
|
-
return val;
|
|
125
|
-
if (typeof val === 'string')
|
|
126
|
-
return `"${val}"`;
|
|
127
|
-
return val;
|
|
128
|
-
}
|
|
129
|
-
export const isInServer = () => typeof window === 'undefined';
|
|
130
|
-
export const isValidTimestamp = (_timestamp) => {
|
|
131
|
-
const parsedNumber = typeof _timestamp == 'string' ? parseInt(_timestamp) : _timestamp;
|
|
132
|
-
const newTimestamp = new Date(parsedNumber).getTime();
|
|
133
|
-
const rv = NumericHelper.isFloat(newTimestamp) && newTimestamp.toString().length >= 10;
|
|
134
|
-
return rv;
|
|
135
|
-
};
|
|
136
|
-
export function lineString(level, name) {
|
|
137
|
-
let str = '';
|
|
138
|
-
for (let i = 0; i < level; i++) {
|
|
139
|
-
str += ' ';
|
|
140
|
-
}
|
|
141
|
-
if (name) {
|
|
142
|
-
str += name + ': ';
|
|
143
|
-
}
|
|
144
|
-
return str;
|
|
145
|
-
}
|
|
146
|
-
export function makeString(len = 5) {
|
|
147
|
-
var text = '';
|
|
148
|
-
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
149
|
-
for (var i = 0; i < len; i++)
|
|
150
|
-
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
|
151
|
-
return text;
|
|
152
|
-
}
|
|
153
|
-
export const nest = ({ items }) => {
|
|
154
|
-
let mappedArray = Object.create(null);
|
|
155
|
-
items.forEach((item) => (mappedArray[item.id] = { ...item, children: [] }));
|
|
156
|
-
let nestedArray = [];
|
|
157
|
-
items.forEach((item) => {
|
|
158
|
-
if (item) {
|
|
159
|
-
if (item.parent)
|
|
160
|
-
mappedArray[item.parent] && mappedArray[item.parent].children.push(mappedArray[item.id]);
|
|
161
|
-
else
|
|
162
|
-
nestedArray.push(mappedArray[item.id]);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
return nestedArray;
|
|
166
|
-
};
|
|
167
|
-
export function normalizeTimestamp(timestamp, options) {
|
|
168
|
-
const { dateOnly, format: _format } = options || {};
|
|
169
|
-
const _timestamp = typeof timestamp == 'string' ? parseInt(timestamp) : timestamp;
|
|
170
|
-
const rv = format(new Date(_timestamp), _format ? _format : dateOnly ? 'dd/MM/yyyy' : 'dd/MM/yyyy hh:mm');
|
|
171
|
-
return rv;
|
|
172
|
-
}
|
|
173
|
-
export function normalizeStringBodyRaw(key, body) {
|
|
174
|
-
return typeof body[key] === 'string' && (key === 'body' || key === 'raw') ? JSON.parse(body[key]) : body[key];
|
|
175
|
-
}
|
|
176
|
-
export function titleCase(str = '') {
|
|
177
|
-
return str && toPascalCase(str.toString(), true);
|
|
178
|
-
}
|
|
179
|
-
export function toCamelCase(inputArray) {
|
|
180
|
-
let result = '';
|
|
181
|
-
for (let i = 0, len = inputArray?.length ?? 0; i < len; i++) {
|
|
182
|
-
let currentStr = inputArray?.at(i);
|
|
183
|
-
let tempStr = currentStr.toLowerCase();
|
|
184
|
-
if (i != 0) {
|
|
185
|
-
tempStr = tempStr.substr(0, 1).toUpperCase() + tempStr.substr(1);
|
|
186
|
-
}
|
|
187
|
-
result += tempStr;
|
|
188
|
-
}
|
|
189
|
-
return result;
|
|
190
|
-
}
|
|
191
|
-
export function toCamelCaseString(input) {
|
|
192
|
-
const words = toWords(input);
|
|
193
|
-
return toCamelCase(words);
|
|
194
|
-
}
|
|
195
|
-
export const toCurrency = (input) => {
|
|
196
|
-
return input ? input.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') : input;
|
|
197
|
-
};
|
|
198
|
-
export const toInitials = (str) => {
|
|
199
|
-
if (str === '')
|
|
200
|
-
return str;
|
|
201
|
-
var matches = str.match(/\b(\w)/g);
|
|
202
|
-
return matches?.join('').toUpperCase();
|
|
203
|
-
};
|
|
204
|
-
export function toPascalCase(string, title = false) {
|
|
205
|
-
return string && string.replace(/(_[a-z])?(^[a-z])?(_|\s[a-z])?/g, ($1) => $1.toUpperCase().replace('_', title ? ' ' : ''));
|
|
206
|
-
}
|
|
207
|
-
export function toWords(input) {
|
|
208
|
-
input = convertToString(input);
|
|
209
|
-
const regex = /[A-Z\xC0-\xD6\xD8-\xDE]?[a-z\xDF-\xF6\xF8-\xFF]+|[A-Z\xC0-\xD6\xD8-\xDE]+(?![a-z\xDF-\xF6\xF8-\xFF])|\d+/g;
|
|
210
|
-
return input?.match(regex);
|
|
211
|
-
}
|
|
212
|
-
export function trimRuleCode(input) {
|
|
213
|
-
const stringefied = typeof input == 'string' ? input : JSON.stringify(input);
|
|
214
|
-
let match = stringefied.substring(stringefied.indexOf('{') + 1, stringefied.lastIndexOf('}'));
|
|
215
|
-
return match ? match : '';
|
|
216
|
-
}
|
|
217
|
-
export const useStatePromisify = (_state) => {
|
|
218
|
-
const [state, setState] = useState(_state);
|
|
219
|
-
const resolverRef = useRef(null);
|
|
220
|
-
useEffect(() => {
|
|
221
|
-
if (resolverRef.current) {
|
|
222
|
-
resolverRef.current(state);
|
|
223
|
-
resolverRef.current = null;
|
|
224
|
-
}
|
|
225
|
-
}, [resolverRef.current, state]);
|
|
226
|
-
const handleSetState = useCallback((stateAction) => {
|
|
227
|
-
setState(stateAction);
|
|
228
|
-
return new Promise((resolve) => {
|
|
229
|
-
resolverRef.current = resolve;
|
|
230
|
-
});
|
|
231
|
-
}, [setState]);
|
|
232
|
-
return [state, handleSetState];
|
|
233
|
-
};
|
|
234
|
-
export const getScoreColor = (value) => {
|
|
235
|
-
if (value <= 20) {
|
|
236
|
-
return 'bad';
|
|
237
|
-
}
|
|
238
|
-
else if (value <= 40) {
|
|
239
|
-
return 'low';
|
|
240
|
-
}
|
|
241
|
-
else if (value <= 60) {
|
|
242
|
-
return 'medium';
|
|
243
|
-
}
|
|
244
|
-
else if (value <= 80) {
|
|
245
|
-
return 'high';
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
return 'excellent';
|
|
249
|
-
}
|
|
250
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export const ColumnInputTypes = {
|
|
2
|
-
Array: "array",
|
|
3
|
-
Avatar: "avatar",
|
|
4
|
-
Country: "country",
|
|
5
|
-
Currency: "currency",
|
|
6
|
-
Date: "date",
|
|
7
|
-
Done: "done",
|
|
8
|
-
ID: "id",
|
|
9
|
-
IncoTerm: "incoterm",
|
|
10
|
-
Link: "link",
|
|
11
|
-
Percentage: "percentage",
|
|
12
|
-
Price: "price",
|
|
13
|
-
Progress: "progress",
|
|
14
|
-
Score: "score",
|
|
15
|
-
Status: "status",
|
|
16
|
-
String: "string",
|
|
17
|
-
Measure: "measure",
|
|
18
|
-
};
|
|
19
|
-
export const ComponentTypes = {
|
|
20
|
-
ActionTrey: "action_trey",
|
|
21
|
-
AsyncDropdown: "async_dropdown",
|
|
22
|
-
Chip: "chip",
|
|
23
|
-
ClickableLabel: "clickable_label",
|
|
24
|
-
CollapsableDropdown: "collapsable_dropdown",
|
|
25
|
-
Container: "container",
|
|
26
|
-
DateRange: "date_range",
|
|
27
|
-
Dropdown: "dropdown",
|
|
28
|
-
Label: "label",
|
|
29
|
-
Modal: "modal",
|
|
30
|
-
RangeSlider: "range_slider",
|
|
31
|
-
TableColumn: "table_column",
|
|
32
|
-
Textfield: "textfield",
|
|
33
|
-
StaticDropdown: "static_dropdown",
|
|
34
|
-
dropdownOptions: "dropdownOptions",
|
|
35
|
-
clear: "clear",
|
|
36
|
-
};
|
|
37
|
-
export const DataTypes = {
|
|
38
|
-
CSV: "csv",
|
|
39
|
-
EDI: "edi",
|
|
40
|
-
JSON: "json",
|
|
41
|
-
PDF: "pdf",
|
|
42
|
-
XLS: "xls",
|
|
43
|
-
XML: "xml",
|
|
44
|
-
};
|
|
45
|
-
export const EntityTypes = {
|
|
46
|
-
Block: "block",
|
|
47
|
-
Charge: "charge",
|
|
48
|
-
Contract: "contract",
|
|
49
|
-
Event: "event",
|
|
50
|
-
Metadata: "metadata",
|
|
51
|
-
Notification: "notification",
|
|
52
|
-
Pricing: "pricing",
|
|
53
|
-
Service: "service",
|
|
54
|
-
Structure: "structure",
|
|
55
|
-
Transaction: "transaction",
|
|
56
|
-
Transmission: "transmission",
|
|
57
|
-
User: "user",
|
|
58
|
-
Workspace: "workspace",
|
|
59
|
-
};
|
|
60
|
-
export const FilterOperatorType = {
|
|
61
|
-
Contains: "contains",
|
|
62
|
-
NotContains: "NotContains",
|
|
63
|
-
Equals: "equals",
|
|
64
|
-
EndsWith: "endsWith",
|
|
65
|
-
IsAfter: "after",
|
|
66
|
-
IsBefore: "before",
|
|
67
|
-
Is: "is",
|
|
68
|
-
IsNot: "not",
|
|
69
|
-
In: "in",
|
|
70
|
-
NotIn: "notIn",
|
|
71
|
-
StartsWith: "startsWith",
|
|
72
|
-
GreaterThan: ">",
|
|
73
|
-
GreaterThanEqual: ">=",
|
|
74
|
-
LessThan: "<",
|
|
75
|
-
LessThanEqual: "<=",
|
|
76
|
-
};
|
|
77
|
-
export const InputTypes = {
|
|
78
|
-
Currency: "currency",
|
|
79
|
-
Date: "date",
|
|
80
|
-
Link: "link",
|
|
81
|
-
Password: "password",
|
|
82
|
-
Percent: "percent",
|
|
83
|
-
Text: "text",
|
|
84
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentTypes } from '../';
|
|
3
|
-
import { FxAsyncDropdown, FxButton, FxTextField } from '@fixefy/fixefy-ui-components';
|
|
4
|
-
export const parseInput = ({ client, fetcher, control, structure, droppedItem, state, onInputChange, classes, args, ...rest }) => {
|
|
5
|
-
const { type, children } = structure;
|
|
6
|
-
const { AsyncDropdown, Textfield, clear, dropdownOptions } = ComponentTypes;
|
|
7
|
-
switch (type) {
|
|
8
|
-
case AsyncDropdown: {
|
|
9
|
-
return <FxAsyncDropdown classes={classes} structure={structure} fetcher={fetcher} onChange={() => { }} {...rest}/>;
|
|
10
|
-
}
|
|
11
|
-
case Textfield: {
|
|
12
|
-
return <FxTextField autoFocus={true} droppedItem={droppedItem} defaultValue={args && args.data && args.data.default_value} onChange={(e) => onInputChange({ structure, value: e.target.value })} structure={structure} {...rest}/>;
|
|
13
|
-
}
|
|
14
|
-
case dropdownOptions:
|
|
15
|
-
return children.map((child) => {
|
|
16
|
-
return parseInput({
|
|
17
|
-
client,
|
|
18
|
-
control,
|
|
19
|
-
structure: child,
|
|
20
|
-
droppedItem,
|
|
21
|
-
state,
|
|
22
|
-
onInputChange,
|
|
23
|
-
classes,
|
|
24
|
-
args,
|
|
25
|
-
...rest,
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
case clear:
|
|
29
|
-
return <FxButton {...rest}>{structure.name}</FxButton>;
|
|
30
|
-
}
|
|
31
|
-
};
|
package/dist-es/files/index.jsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const convertFileSize = (fileSize) => {
|
|
2
|
-
if (fileSize < 10000) {
|
|
3
|
-
return `${(fileSize / 1000).toFixed(1)} KB`;
|
|
4
|
-
}
|
|
5
|
-
else if (fileSize < 10000000) {
|
|
6
|
-
return `${(fileSize / 1000000).toFixed(1)} MB`;
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
export const convertFileTypeToIcon = (fileType) => {
|
|
10
|
-
switch (fileType) {
|
|
11
|
-
case 'text/csv':
|
|
12
|
-
return 'uploader/file_type_csv.svg';
|
|
13
|
-
case 'text/xml':
|
|
14
|
-
return 'uploader/file_type_xml.svg';
|
|
15
|
-
case 'text/json':
|
|
16
|
-
return 'uploader/file_type_json.svg';
|
|
17
|
-
case 'text/xls':
|
|
18
|
-
return 'uploader/file_type_xls.svg';
|
|
19
|
-
default:
|
|
20
|
-
return 'uploader/file_type_csv.svg';
|
|
21
|
-
}
|
|
22
|
-
};
|