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