@fixefy/fixefy-ui-utils 0.0.8 → 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.
Files changed (84) hide show
  1. package/dist-cjs/index.js +39 -17
  2. package/dist-cjs/index.js.map +1 -0
  3. package/{dist-types → dist-cjs/types}/index.d.ts +0 -3
  4. package/{dist-types → dist-cjs/types}/types/index.d.ts +5 -5
  5. package/dist-es/index.js +39 -14
  6. package/dist-es/index.js.map +1 -0
  7. package/dist-es/types/auth/index.d.ts +2 -0
  8. package/dist-es/types/aws/data_models.d.ts +21 -0
  9. package/dist-es/types/commander/index.d.ts +33 -0
  10. package/dist-es/types/constants/index.d.ts +6 -0
  11. package/dist-es/types/files/index.d.ts +2 -0
  12. package/dist-es/types/graphql/index.d.ts +38 -0
  13. package/dist-es/types/headers/index.d.ts +12 -0
  14. package/dist-es/types/images/index.d.ts +4 -0
  15. package/dist-es/types/index.d.ts +11 -0
  16. package/dist-es/types/json/index.d.ts +7 -0
  17. package/dist-es/types/page_context/index.d.ts +248 -0
  18. package/dist-es/types/redirect/index.d.ts +2 -0
  19. package/dist-es/types/resolvers/index.d.ts +11 -0
  20. package/dist-es/types/transform/index.d.ts +2 -0
  21. package/dist-es/types/types/index.d.ts +39 -0
  22. package/dist-es/types/validate/index.d.ts +5 -0
  23. package/package.json +71 -64
  24. package/dist-cjs/auth/index.js +0 -13
  25. package/dist-cjs/aws/aws_lambda_helper.js +0 -49
  26. package/dist-cjs/aws/aws_s3_helper.js +0 -1
  27. package/dist-cjs/aws/data_models.js +0 -2
  28. package/dist-cjs/aws/index.js +0 -4
  29. package/dist-cjs/commander/index.jsx +0 -280
  30. package/dist-cjs/constants/index.js +0 -87
  31. package/dist-cjs/contents/index.jsx +0 -32
  32. package/dist-cjs/files/index.js +0 -27
  33. package/dist-cjs/graphql/index.js +0 -217
  34. package/dist-cjs/headers/index.js +0 -68
  35. package/dist-cjs/images/index.js +0 -13
  36. package/dist-cjs/json/index.js +0 -135
  37. package/dist-cjs/package.json +0 -3
  38. package/dist-cjs/page_context/index.js +0 -494
  39. package/dist-cjs/redirect/index.js +0 -15
  40. package/dist-cjs/renderer/index.jsx +0 -66
  41. package/dist-cjs/resolvers/index.js +0 -35
  42. package/dist-cjs/transform/index.js +0 -40
  43. package/dist-cjs/types/index.js +0 -2
  44. package/dist-cjs/validate/index.js +0 -48
  45. package/dist-es/auth/index.js +0 -11
  46. package/dist-es/aws/aws_lambda_helper.js +0 -41
  47. package/dist-es/aws/aws_s3_helper.js +0 -1
  48. package/dist-es/aws/data_models.js +0 -1
  49. package/dist-es/commander/index.jsx +0 -250
  50. package/dist-es/constants/index.js +0 -84
  51. package/dist-es/contents/index.jsx +0 -31
  52. package/dist-es/files/index.js +0 -22
  53. package/dist-es/graphql/index.js +0 -235
  54. package/dist-es/headers/index.js +0 -57
  55. package/dist-es/images/index.js +0 -9
  56. package/dist-es/json/index.js +0 -125
  57. package/dist-es/package.json +0 -3
  58. package/dist-es/page_context/index.js +0 -511
  59. package/dist-es/redirect/index.js +0 -12
  60. package/dist-es/renderer/index.jsx +0 -60
  61. package/dist-es/resolvers/index.js +0 -31
  62. package/dist-es/transform/index.js +0 -35
  63. package/dist-es/types/index.js +0 -1
  64. package/dist-es/validate/index.js +0 -40
  65. package/dist-types/aws/aws_lambda_helper.d.ts +0 -5
  66. package/dist-types/aws/aws_s3_helper.d.ts +0 -0
  67. package/dist-types/contents/index.d.ts +0 -3
  68. package/dist-types/renderer/index.d.ts +0 -9
  69. /package/{dist-types → dist-cjs/types}/auth/index.d.ts +0 -0
  70. /package/{dist-types → dist-cjs/types}/aws/data_models.d.ts +0 -0
  71. /package/{dist-types → dist-cjs/types}/aws/index.d.ts +0 -0
  72. /package/{dist-types → dist-cjs/types}/commander/index.d.ts +0 -0
  73. /package/{dist-types → dist-cjs/types}/constants/index.d.ts +0 -0
  74. /package/{dist-types → dist-cjs/types}/files/index.d.ts +0 -0
  75. /package/{dist-types → dist-cjs/types}/graphql/index.d.ts +0 -0
  76. /package/{dist-types → dist-cjs/types}/headers/index.d.ts +0 -0
  77. /package/{dist-types → dist-cjs/types}/images/index.d.ts +0 -0
  78. /package/{dist-types → dist-cjs/types}/json/index.d.ts +0 -0
  79. /package/{dist-types → dist-cjs/types}/page_context/index.d.ts +0 -0
  80. /package/{dist-types → dist-cjs/types}/redirect/index.d.ts +0 -0
  81. /package/{dist-types → dist-cjs/types}/resolvers/index.d.ts +0 -0
  82. /package/{dist-types → dist-cjs/types}/transform/index.d.ts +0 -0
  83. /package/{dist-types → dist-cjs/types}/validate/index.d.ts +0 -0
  84. /package/dist-es/{aws/index.js → types/aws/index.d.ts} +0 -0
@@ -1,511 +0,0 @@
1
- import { createTheme } from '@mui/material/styles';
2
- import { createGenerateClassName, jssPreset } from '@mui/styles';
3
- import { create, SheetsRegistry } from 'jss';
4
- const theme = createTheme({
5
- palette: {
6
- background: { paper: '#fff' },
7
- common: {
8
- black: '#323232',
9
- white: '#FFFFFF',
10
- },
11
- colors: {
12
- red: '#EB5757',
13
- lightRed: '#FEF6F6',
14
- orange: '#F2994A',
15
- lightOrange: '#FEF7F1',
16
- orangeHover: '#EC7A30',
17
- orangeFocused: '#E65C15',
18
- gold: '#C4A603',
19
- lightGold: '#FAF7E6',
20
- yellow: '#F2D74C',
21
- lightYellow: '#FEFCEE',
22
- yellowHover: '#ECC631',
23
- yellowFocused: '#E6B517',
24
- green1: '#88C00D',
25
- lightGreen1: '#F6FAEC',
26
- green2: '#27AE60',
27
- lightGreen2: '#EEF9F2',
28
- green2Hover: '#169242',
29
- green2Focused: '#067724',
30
- green3: '#6FCF97',
31
- blue: '#2D9CDB',
32
- lightBlue: '#F3F9FD',
33
- blueHover: '#2D9CDB',
34
- blueFocused: '#085FBC',
35
- blue1: '#56CCF2',
36
- lightBlue1: '#F1FBFE',
37
- blue1Hover: '#39B8EC',
38
- blue1Focused: '#1DA3E6',
39
- purple: '#BB6BD9',
40
- lightPurple: '#FBF6FD',
41
- },
42
- greyscale: {
43
- dark: '#636363',
44
- main: '#ababab',
45
- light: '#e2e2e2',
46
- contrastText: '#f7f7f7',
47
- '500': '#5C6467',
48
- '400': '#8B9092',
49
- '300': '#C5C8C9',
50
- '200': '#F0F0F0',
51
- '100': '#F7F7F7',
52
- },
53
- redscale: {
54
- main: '#EB5757',
55
- '500': '#EE6868',
56
- '400': '#F08989',
57
- '300': '#F4AAAA',
58
- '200': '#F8CCCC',
59
- '100': '#FEF6F6',
60
- },
61
- orangescale: {
62
- '700': '#E65C15',
63
- '600': '#EC7A30',
64
- main: '#F2994A',
65
- '100': '#FEF7F1',
66
- },
67
- goldscale: {
68
- main: '#C4A603',
69
- '100': '#FAF7E6',
70
- },
71
- yellowscale: {
72
- '700': '#E6B517',
73
- '600': '#ECC631',
74
- main: '#F2D74C',
75
- '100': '#FEFCEE',
76
- },
77
- purplescale: {
78
- main: '#BB6BD9',
79
- '100': '#FBF6FD',
80
- },
81
- green1scale: {
82
- main: '#88C00D',
83
- '100': '#F6FAEC',
84
- },
85
- green2scale: {
86
- '700': '#067724',
87
- '600': '#169242',
88
- main: '#27AE60',
89
- '100': '#EEF9F2',
90
- },
91
- green3scale: {
92
- main: '#6FCF97',
93
- },
94
- blue1scale: {
95
- '700': '#1DA3E6',
96
- '600': '#39B8EC',
97
- main: '#56CCF2',
98
- '100': '#F1FBFE',
99
- },
100
- blue2scale: {
101
- '700': '#085FBC',
102
- '600': '#1A7ECC',
103
- main: '#2D9CDB',
104
- '100': '#F3F9FD',
105
- },
106
- error: { main: '#f44336' },
107
- pending: { main: '#e7cc0e', dark: '#B09000' },
108
- primary: {
109
- main: '#365c65',
110
- '100': '#C6DDE2',
111
- '300': '#87ACB6',
112
- '500': '#568793',
113
- '700': '#3C636C',
114
- '800': '#2F4F57',
115
- },
116
- priority: {
117
- critical: '#EB5757',
118
- high: '#F2994A',
119
- low: '#56CCF2',
120
- medium: '#88C00D',
121
- },
122
- typography: { title: '#172326', delete: '#EB5757' },
123
- statistics: { value: '#568793', label: '#8B9092' },
124
- success: { main: '#88c00d' },
125
- uploader: {
126
- processing: { border: '', bg: '' },
127
- pause: { border: '', bg: '' },
128
- },
129
- score: {
130
- excellent: '#27AE60',
131
- high: '#88C00D',
132
- medium: '#F2C94C',
133
- low: '#F2994A',
134
- bad: '#ED323B',
135
- },
136
- status: {
137
- active: { border: '#96B5BC', background: '#F7F9FA' },
138
- approve: { border: '#88C00D', background: '#F9FCF3' },
139
- challenge: { border: '#F7C08F', background: '#FEFAF6' },
140
- challenged: { border: '#F7C08F', background: '#FEFAF6' },
141
- declined: { border: '#F48085', background: '#FEF5F5' },
142
- discrepancy: { border: '#CEBA61', background: '#FBFAF2' },
143
- duplicate: { border: '#CEBA61', background: '#FBFAF2' },
144
- duplicated: { border: '#CEBA61', background: '#FBFAF2' },
145
- gold: { border: '#C4A603', background: '#FEFDF3' },
146
- in_progress: { border: '#56CCF2', background: '#F1FBFE' },
147
- in_review: { border: '#BB6BD9', background: '#FAF6FE' },
148
- no_pricing: { border: '#BBBBBB', background: '#FAFAFA' },
149
- pending: { border: '#ECC631', background: '#FEFDF3' },
150
- },
151
- invoiceState: {
152
- approved: { border: '#27AE60', background: '#27AE60' },
153
- created: { border: '#87ACB6', background: '#87ACB6' },
154
- declined: { border: '#EB5757', background: '#EB5757' },
155
- in_dispute: { border: '#56CCF2', background: '#56CCF2' },
156
- in_progress: { border: '#56CCF2', background: '#56CCF2' },
157
- paid: { border: '#BB6BD9', background: '#BB6BD9' },
158
- closed: { border: '#8B9092', background: '#8B9092' },
159
- },
160
- reconcilationState: {
161
- created: { border: '#87ACB6', background: '#87ACB6' },
162
- in_progress: { border: '#56CCF2', background: '#56CCF2' },
163
- approved: { border: '#27AE60', background: '#27AE60' },
164
- declined: { border: '#EB5757', background: '#EB5757' },
165
- refunded: { border: '#BB6BD9', background: '#BB6BD9' },
166
- closed: { border: '#8B9092', background: '#8B9092' },
167
- },
168
- trends: {
169
- positive: '#88C00D',
170
- negative: '#F2994A',
171
- critical: '#ED323B',
172
- percent: '#56CCF2',
173
- sum: '#BB6BD9',
174
- },
175
- invoiceAnalysis: {
176
- underCharges: '#87ACB6',
177
- overCharges: '#C6DDE2',
178
- matching: '#568793',
179
- invalid: '#EB5757',
180
- },
181
- snackbar: {
182
- info: { icon: '#56CCF2', border: '#56CCF2' },
183
- success: { icon: '#27AE60', border: '#27AE60' },
184
- error: { icon: '#ED323B', border: '#ED323B' },
185
- warn: { icon: '#F7DD8D', border: '#F2C94C' },
186
- critical: { icon: '#ED323B', border: '#ED323B' },
187
- silent: { icon: '#56CCF2', border: '#56CCF2' },
188
- alert: { icon: '#56CCF2', border: '#56CCF2' },
189
- },
190
- notificationStatus: {
191
- unread: '#F7F9FA',
192
- },
193
- },
194
- components: {
195
- MuiButton: {
196
- defaultProps: {
197
- disableRipple: true,
198
- },
199
- variants: [
200
- {
201
- props: {
202
- variant: 'contained',
203
- },
204
- style: ({ theme }) => ({
205
- background: theme.palette.primary[500],
206
- color: theme.palette.common.white,
207
- boxShadow: 'none',
208
- '&:hover': {
209
- background: theme.palette.primary['700'],
210
- boxShadow: 'none',
211
- },
212
- '&:focus': {
213
- background: theme.palette.primary['800'],
214
- boxShadow: 'none',
215
- },
216
- '&:disabled': {
217
- background: theme.palette.primary[500],
218
- color: theme.palette.common.white,
219
- },
220
- }),
221
- },
222
- {
223
- props: {
224
- variant: 'contained:rounded',
225
- },
226
- style: ({ theme }) => ({
227
- borderRadius: 100,
228
- background: theme.palette.primary[500],
229
- color: theme.palette.common.white,
230
- '&:hover': {
231
- background: theme.palette.primary['700'],
232
- },
233
- '&:focus': {
234
- background: theme.palette.primary['800'],
235
- },
236
- '&:disabled': {
237
- background: theme.palette.primary[500],
238
- color: theme.palette.common.white,
239
- },
240
- }),
241
- },
242
- {
243
- props: {
244
- variant: 'outlined',
245
- },
246
- style: ({ theme }) => ({
247
- borderRadius: 100,
248
- color: theme.palette.primary[500],
249
- borderColor: theme.palette.primary[500],
250
- '&:hover': {
251
- color: theme.palette.primary['700'],
252
- borderColor: theme.palette.primary['700'],
253
- background: 'transparent',
254
- },
255
- '&:focus': {
256
- color: theme.palette.primary['800'],
257
- borderColor: theme.palette.primary['800'],
258
- background: 'transparent',
259
- },
260
- '&:disabled': {
261
- color: theme.palette.primary[500],
262
- border: `1px solid ${theme.palette.primary[500]}`,
263
- },
264
- }),
265
- },
266
- {
267
- props: {
268
- variant: 'text',
269
- },
270
- style: ({ theme }) => ({
271
- color: theme.palette.primary[500],
272
- '&:hover': {
273
- color: theme.palette.primary['700'],
274
- background: 'transparent',
275
- },
276
- '&:focus': {
277
- color: theme.palette.primary['800'],
278
- borderColor: theme.palette.primary['800'],
279
- background: 'transparent',
280
- },
281
- '&:disabled': {
282
- color: theme.palette.primary[500],
283
- },
284
- }),
285
- },
286
- ],
287
- styleOverrides: {
288
- root: {
289
- fontWeight: 600,
290
- fontSize: 12,
291
- lineHeight: '24px',
292
- letterSpacing: '0.5px',
293
- height: 40,
294
- },
295
- },
296
- },
297
- MuiInputBase: {
298
- styleOverrides: {
299
- root: ({ theme }) => ({
300
- background: theme.palette.common.white,
301
- padding: theme.spacing(1, 2),
302
- height: 40,
303
- boxSizing: 'border-box',
304
- borderRadius: 4,
305
- border: '1px solid transparent',
306
- transition: '.2s',
307
- '&:focus-within': {
308
- borderColor: theme.palette.primary[100],
309
- '& input': {
310
- caretColor: theme.palette.primary[500],
311
- },
312
- },
313
- '&.Mui-error': {
314
- borderColor: theme.palette.redscale.main,
315
- },
316
- 'label + &': {
317
- marginTop: theme.spacing(2.2),
318
- background: theme.palette.common.white,
319
- },
320
- '& input': {
321
- color: theme.palette.typography.title,
322
- '&:placeholder': {
323
- color: theme.palette.greyscale[400],
324
- },
325
- },
326
- '&.MuiInputBase-adornedStart': {
327
- '& input': {
328
- paddingLeft: theme.spacing(2),
329
- },
330
- },
331
- '&.MuiInputBase-adornedEnd': {
332
- '& input': {
333
- paddingRight: theme.spacing(2),
334
- },
335
- },
336
- }),
337
- },
338
- },
339
- },
340
- typography: {
341
- fontFamily: ['Open Sans', 'OpenSans'].join(','),
342
- body1: {
343
- fontWeight: 'normal',
344
- fontStyle: 'normal',
345
- fontSize: 14,
346
- lineHeight: '24px',
347
- letterSpacing: '0.15px',
348
- },
349
- button: {
350
- paddingLeft: 24,
351
- paddingRight: 24,
352
- color: 'white',
353
- fontWeight: 500,
354
- fontStyle: 'normal',
355
- fontSize: 14,
356
- lineHeight: '24px',
357
- letterSpacing: '0.5px',
358
- },
359
- table: {
360
- fontWeight: 'normal',
361
- fontStyle: 'normal',
362
- fontSize: 12,
363
- lineHeight: '16px',
364
- letterSpacing: '0.1px',
365
- },
366
- table2: {
367
- fontWeight: 900,
368
- fontStyle: 'normal',
369
- fontSize: 12,
370
- lineHeight: '16px',
371
- letterSpacing: '0.1px',
372
- },
373
- overLineCaption: {
374
- fontWeight: 'normal',
375
- fontStyle: 'normal',
376
- fontSize: 11,
377
- lineHeight: '16px',
378
- letterSpacing: '0.1px',
379
- },
380
- link: {
381
- fontWeight: 'normal',
382
- fontStyle: 'italic',
383
- fontSize: 12,
384
- lineHeight: '20px',
385
- letterSpacing: '0.15px',
386
- },
387
- h1: {
388
- fontWeight: 300,
389
- fontStyle: 'normal',
390
- fontSize: 59,
391
- lineHeight: '80px',
392
- letterSpacing: '-0.5px',
393
- },
394
- h2: {
395
- fontWeight: 'normal',
396
- fontStyle: 'normal',
397
- fontSize: 44,
398
- lineHeight: '64px',
399
- letterSpacing: '0px',
400
- },
401
- h3: {
402
- fontWeight: 'normal',
403
- fontStyle: 'normal',
404
- fontSize: 33,
405
- lineHeight: '48px',
406
- letterSpacing: '0.25px',
407
- },
408
- h4: {
409
- fontWeight: 'normal',
410
- fontStyle: 'normal',
411
- fontSize: 25,
412
- lineHeight: '40px',
413
- letterSpacing: '0px',
414
- },
415
- h5: {
416
- fontWeight: 500,
417
- fontStyle: 'normal',
418
- fontSize: 19,
419
- lineHeight: '28px',
420
- letterSpacing: '0.15px',
421
- },
422
- subtitle1: {
423
- fontWeight: 'normal',
424
- fontStyle: 'normal',
425
- fontSize: 16,
426
- lineHeight: '24px',
427
- letterSpacing: '0.15px',
428
- },
429
- subtitle2: {
430
- fontWeight: 500,
431
- fontStyle: 'normal',
432
- fontSize: 14,
433
- lineHeight: '24px',
434
- letterSpacing: '0.1px',
435
- },
436
- },
437
- sizes: {
438
- sideMenu: {
439
- width: 70,
440
- itemHeight: 60,
441
- logoHeight: 60,
442
- paddingTop: 20,
443
- marginBottom: 20,
444
- },
445
- hex: 80,
446
- hex_node: 60,
447
- hex_event: 60,
448
- hex_service: 60,
449
- hex_structure: 30,
450
- header: {
451
- iconTray: 200,
452
- height: 60,
453
- },
454
- },
455
- });
456
- const lightTheme = createTheme({
457
- ...theme,
458
- palette: {
459
- ...theme.palette,
460
- mode: 'light',
461
- text: {
462
- primary: 'rgba(0, 0, 0, 0.87)',
463
- secondary: 'rgba(0, 0, 0, 0.54)',
464
- disabled: 'rgba(0, 0, 0, 0.38)',
465
- },
466
- divider: '#F0F0F0',
467
- background: {
468
- paper: '#fff',
469
- default: '#fafafa',
470
- },
471
- },
472
- });
473
- const darkTheme = createTheme({
474
- ...theme,
475
- palette: {
476
- ...theme.palette,
477
- mode: 'dark',
478
- text: {
479
- primary: '#fff',
480
- secondary: 'rgba(255, 255, 255, 0.7)',
481
- disabled: 'rgba(255, 255, 255, 0.5)',
482
- },
483
- divider: 'rgba(255, 255, 255, 0.12)',
484
- background: {
485
- paper: '#323232',
486
- default: '#303030',
487
- },
488
- },
489
- });
490
- function createPageContext(darkMode = false) {
491
- return {
492
- theme: darkMode ? darkTheme : lightTheme,
493
- darkMode,
494
- sheetsManager: new Map(),
495
- jss: create({
496
- ...jssPreset(),
497
- }),
498
- sheetsRegistry: new SheetsRegistry(),
499
- generateClassName: createGenerateClassName(),
500
- };
501
- }
502
- let pageContext;
503
- export default function getPageContext(darkMode) {
504
- if (!process.browser) {
505
- return createPageContext(darkMode);
506
- }
507
- if (!pageContext) {
508
- pageContext = createPageContext(darkMode);
509
- }
510
- return pageContext;
511
- }
@@ -1,12 +0,0 @@
1
- import Router from 'next/router';
2
- const redirect = (context, target) => {
3
- if (context.res) {
4
- console.log('SERVER RESPONSE :', context.res);
5
- context.res.writeHead(303, { Location: target });
6
- context.res.end();
7
- }
8
- else {
9
- Router.replace(target);
10
- }
11
- };
12
- export default redirect;
@@ -1,60 +0,0 @@
1
- import React from 'react';
2
- import { Typography, Link } from '@mui/material';
3
- import { FxChip, FxShowMore } from '@fixefy/fixefy-ui-components';
4
- import { ComponentTypes, getJPart, titleCase, getStringValueByValueType } from '../';
5
- export const parseValue = ({ value, structure, onClick }) => {
6
- const { extended, name, type, title } = structure;
7
- const path = extended && extended.title_path;
8
- let theTruth;
9
- if (path) {
10
- theTruth = getJPart(value, path, undefined);
11
- }
12
- const _value = theTruth === undefined || theTruth === null ? value[name] : theTruth;
13
- if (_value === undefined || _value === null) {
14
- return getValueComponentByComponentValue({
15
- value: 'No Value Found',
16
- });
17
- }
18
- let rv = getStringValueByValueType({ value: _value, name });
19
- rv = getValueComponentByComponentValue({
20
- value: rv,
21
- name,
22
- title,
23
- type,
24
- onClick: (e) => onClick(e, _value),
25
- });
26
- return rv;
27
- };
28
- export const getValueComponentByComponentValue = ({ value, name, title, type, onClick }) => {
29
- let rv = null;
30
- switch (type) {
31
- case ComponentTypes.Chip:
32
- rv = <FxChip size="small" key={`${name}-Chip-3003`} style={{ marginBottom: '5px' }} status={value.toLowerCase()} label={value}/>;
33
- break;
34
- case ComponentTypes.ClickableLabel:
35
- rv = (<Typography key={`${name}-Link-2002`} sx={{
36
- marginBottom: '5px',
37
- fontSize: '14px',
38
- textDecoration: 'underline',
39
- cursor: 'pointer',
40
- }} variant="body1">
41
- <Link onClick={onClick}>{titleCase(value)}</Link>
42
- </Typography>);
43
- break;
44
- case ComponentTypes.Label:
45
- if (Array.isArray(value) && value?.length > 1) {
46
- rv = (<FxShowMore items={value} label={title ?? ''}>
47
- <Typography key={`${name}-Label-1000`} lineHeight={'20px'} sx={{ fontSize: '14px' }} variant="body1">
48
- {titleCase(value[0])}
49
- </Typography>
50
- </FxShowMore>);
51
- }
52
- break;
53
- default:
54
- rv = (<Typography key={`${name}-Label-1000`} lineHeight={'20px'} sx={{ fontSize: '14px' }} variant="body1">
55
- {titleCase(value)}
56
- </Typography>);
57
- break;
58
- }
59
- return rv;
60
- };
@@ -1,31 +0,0 @@
1
- import gql from 'graphql-tag';
2
- const CURRENT_PAGE_QUERY = gql `
3
- query CURRENT_PAGE_QUERY {
4
- currentPage @client {
5
- name
6
- path
7
- }
8
- }
9
- `;
10
- export const resolvers = {
11
- Mutation: {
12
- changePage(_, args, { cache }) {
13
- console.log(_, args, cache);
14
- const { currentPage } = cache.readQuery({
15
- query: CURRENT_PAGE_QUERY,
16
- });
17
- if (args.to !== currentPage.name) {
18
- const data = {
19
- currentPage: {
20
- name: args.to,
21
- path: '/' + args.to,
22
- __typename: 'currentPage',
23
- },
24
- };
25
- cache.writeQuery({ query: CURRENT_PAGE_QUERY, data });
26
- return data;
27
- }
28
- return null;
29
- },
30
- },
31
- };
@@ -1,35 +0,0 @@
1
- import csvtojson from 'csvtojson';
2
- import xlsToJson from 'convert-excel-to-json';
3
- import 'regenerator-runtime/runtime.js';
4
- const defaultOptions = {
5
- columns: true,
6
- skip_empty_lines: true,
7
- quote: '"',
8
- ltrim: true,
9
- rtrim: true,
10
- delimiter: ',',
11
- };
12
- export const transform = async ({ data, data_type, options = defaultOptions }) => {
13
- let rv = data;
14
- data_type = data_type.substring(data_type.lastIndexOf('/') + 1, data_type.length + 1).toLowerCase();
15
- switch (data_type) {
16
- case 'csv':
17
- rv = await _csvToJson({ csv: data, options });
18
- rv = JSON.stringify(rv).trim();
19
- break;
20
- case 'xls':
21
- rv = _xlsToJson({ xls: data });
22
- break;
23
- case 'xml':
24
- break;
25
- }
26
- return rv;
27
- };
28
- const _csvToJson = async ({ csv, options = defaultOptions }) => {
29
- const rv = await csvtojson(options).fromString(csv);
30
- return rv;
31
- };
32
- const _xlsToJson = ({ xls }) => {
33
- const rv = xlsToJson({ source: xls });
34
- return rv;
35
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,40 +0,0 @@
1
- export const isArrayValid = (arr, minLength = 1, maxLength = 0) => {
2
- let rv = Object.prototype.toString.call(arr) == '[object Array]' && isObjectValid(arr) && arr.length >= minLength;
3
- if (maxLength > 0) {
4
- rv = rv && arr.length <= maxLength;
5
- }
6
- return rv;
7
- };
8
- export const isDateValid = (date) => {
9
- return false;
10
- };
11
- export const isObjectValid = (obj, isCheckKeys = false) => {
12
- let rv = typeof obj !== 'undefined' && obj !== null;
13
- if (isCheckKeys) {
14
- rv = rv && Object.keys(obj).length > 0;
15
- }
16
- return rv;
17
- };
18
- export const isStringValid = (str, minLength = null, maxLength = null, isValidateType = true) => {
19
- if (str == null)
20
- return false;
21
- if (isValidateType && typeof str !== 'string')
22
- return false;
23
- if (str.toString().length == 0)
24
- return false;
25
- if (minLength && isNaN(minLength) === false && minLength > 0) {
26
- return str.toString().length >= minLength;
27
- }
28
- if (maxLength && isNaN(maxLength) === false && maxLength > 0) {
29
- return str.toString().length <= maxLength;
30
- }
31
- return true;
32
- };
33
- export const isObjectId = (value) => {
34
- if (isStringValid(value) === false)
35
- return false;
36
- const regex = /^[0-9a-fA-F]{24}$/;
37
- const matches = regex.exec(value);
38
- const rv = matches != null && isArrayValid(matches);
39
- return rv;
40
- };