@xaypay/tui 0.0.76 → 0.0.77

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/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.76",
3
+ "version": "0.0.77",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
- "storybook": "STORYBOOK_PATH=../../tui.config.js start-storybook -p 6006",
9
+ "storybook": "STORYBOOK_PATH=../../tui.config.js start-storybook -p 6006",
10
10
  "build-storybook": "STORYBOOK_PATH=../../tui.config.js build-storybook",
11
- "build-lib": "STORYBOOK_PATH=../tui.config.js rollup --config rollup.config.js",
11
+ "build-lib": "STORYBOOK_PATH=../tui.config.js STORYBOOK_CONFIG_PATH=../../../../tui.config.js rollup --config rollup.config.js",
12
12
  "svgr": "svgr --icon --title-prop -d src/components/icon -- src/assets/icons"
13
13
  },
14
14
  "author": "",
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M11.8744 20H8.12436C7.87436 20 7.65769 19.9167 7.47436 19.75C7.29103 19.5833 7.18269 19.375 7.14936 19.125L6.84936 16.8C6.63269 16.7167 6.42869 16.6167 6.23736 16.5C6.04536 16.3833 5.85769 16.2583 5.67436 16.125L3.49936 17.025C3.26603 17.1083 3.03269 17.1167 2.79936 17.05C2.56603 16.9833 2.38269 16.8417 2.24936 16.625L0.399361 13.4C0.266027 13.1833 0.224361 12.95 0.274361 12.7C0.324361 12.45 0.449361 12.25 0.649361 12.1L2.52436 10.675C2.50769 10.5583 2.49936 10.4457 2.49936 10.337V9.662C2.49936 9.554 2.50769 9.44167 2.52436 9.325L0.649361 7.9C0.449361 7.75 0.324361 7.55 0.274361 7.3C0.224361 7.05 0.266027 6.81667 0.399361 6.6L2.24936 3.375C2.36603 3.14167 2.54503 2.99567 2.78636 2.937C3.02836 2.879 3.26603 2.89167 3.49936 2.975L5.67436 3.875C5.85769 3.74167 6.04936 3.61667 6.24936 3.5C6.44936 3.38333 6.64936 3.28333 6.84936 3.2L7.14936 0.875C7.18269 0.625 7.29103 0.416667 7.47436 0.25C7.65769 0.0833333 7.87436 0 8.12436 0H11.8744C12.1244 0 12.341 0.0833333 12.5244 0.25C12.7077 0.416667 12.816 0.625 12.8494 0.875L13.1494 3.2C13.366 3.28333 13.5704 3.38333 13.7624 3.5C13.9537 3.61667 14.141 3.74167 14.3244 3.875L16.4994 2.975C16.7327 2.89167 16.966 2.88333 17.1994 2.95C17.4327 3.01667 17.616 3.15833 17.7494 3.375L19.5994 6.6C19.7327 6.81667 19.7744 7.05 19.7244 7.3C19.6744 7.55 19.5494 7.75 19.3494 7.9L17.4744 9.325C17.491 9.44167 17.4994 9.554 17.4994 9.662V10.337C17.4994 10.4457 17.4827 10.5583 17.4494 10.675L19.3244 12.1C19.5244 12.25 19.6494 12.45 19.6994 12.7C19.7494 12.95 19.7077 13.1833 19.5744 13.4L17.7244 16.6C17.591 16.8167 17.4037 16.9627 17.1624 17.038C16.9204 17.1127 16.6827 17.1083 16.4494 17.025L14.3244 16.125C14.141 16.2583 13.9494 16.3833 13.7494 16.5C13.5494 16.6167 13.3494 16.7167 13.1494 16.8L12.8494 19.125C12.816 19.375 12.7077 19.5833 12.5244 19.75C12.341 19.9167 12.1244 20 11.8744 20ZM10.0494 13.5C11.016 13.5 11.841 13.1583 12.5244 12.475C13.2077 11.7917 13.5494 10.9667 13.5494 10C13.5494 9.03333 13.2077 8.20833 12.5244 7.525C11.841 6.84167 11.016 6.5 10.0494 6.5C9.06603 6.5 8.23669 6.84167 7.56136 7.525C6.88669 8.20833 6.54936 9.03333 6.54936 10C6.54936 10.9667 6.88669 11.7917 7.56136 12.475C8.23669 13.1583 9.06603 13.5 10.0494 13.5Z" fill="white"/>
3
+ </svg>
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
- import {Button} from './index';
2
+ import { Button } from './index';
3
+
4
+ import { ReactComponent as ReactSVG } from './../../assets/range-arrow-default.svg';
3
5
 
4
6
  export default {
5
7
  component: Button,
6
8
  title: 'Components/Button',
7
9
  };
8
10
 
9
- const Template = (args) => <Button label='Button' {...args}/>;
11
+ const Template = (args) => <Button label='Button' icon={<ReactSVG />} {...args}/>;
10
12
 
11
13
  export const Default = Template.bind({});
@@ -4,6 +4,7 @@ import classnames from 'classnames';
4
4
  import { compereConfigs } from './../../utils';
5
5
 
6
6
  export const Button = ({
7
+ icon,
7
8
  size,
8
9
  type,
9
10
  font,
@@ -34,8 +35,8 @@ export const Button = ({
34
35
  const [isHover, setIsHover] = useState(false);
35
36
 
36
37
  useEffect(() => {
37
- if (!label) {
38
- alert('Button component: label prop is required, please add it!!!');
38
+ if (!label && !icon) {
39
+ alert('Add icon or label props on Button component');
39
40
  }
40
41
  }, []);
41
42
 
@@ -55,11 +56,14 @@ export const Button = ({
55
56
  return (
56
57
  <button
57
58
  style={{
59
+ display: 'flex',
60
+ alignItems: 'center',
58
61
  fontSize: size ? size : configStyles.BUTTON.size,
59
62
  fontFamily: font ? font : configStyles.BUTTON.font,
60
63
  height: height ? height : configStyles.BUTTON.height,
61
64
  fontWeight: weight ? weight : configStyles.BUTTON.weight,
62
65
  padding: padding ? padding : configStyles.BUTTON.padding,
66
+ justifyContent: icon && label? 'space-between' : 'center',
63
67
  borderRadius: radius ? radius : configStyles.BUTTON.radius,
64
68
  boxSizing: boxSizing ? boxSizing : configStyles.BUTTON.boxSizing,
65
69
  transition: transition ? transition : configStyles.BUTTON.transition,
@@ -88,7 +92,7 @@ export const Button = ({
88
92
  className={classProps}
89
93
  {...props}
90
94
  >
91
- {label}
95
+ {icon && icon} {label && label} {!icon && !label && 'Add icon or label prop on Button component'}
92
96
  </button>
93
97
  );
94
98
  };
@@ -97,10 +101,12 @@ Button.propTypes = {
97
101
  type: PropTypes.string,
98
102
  size: PropTypes.string,
99
103
  font: PropTypes.string,
104
+ icon: PropTypes.element,
100
105
  color: PropTypes.string,
101
106
  width: PropTypes.string,
102
107
  outline: PropTypes.bool,
103
108
  onClick: PropTypes.func,
109
+ label: PropTypes.string,
104
110
  weight: PropTypes.string,
105
111
  height: PropTypes.string,
106
112
  cursor: PropTypes.string,
@@ -115,7 +121,6 @@ Button.propTypes = {
115
121
  textTransform: PropTypes.string,
116
122
  disabledColor: PropTypes.string,
117
123
  backgroundColor: PropTypes.string,
118
- label: PropTypes.string.isRequired,
119
124
  disabledLineColor: PropTypes.string,
120
125
  disabledBackgroundColor: PropTypes.string
121
126
  };
@@ -45,6 +45,7 @@ export const Input = ({
45
45
  maxLength,
46
46
  labelColor,
47
47
  errorColor,
48
+ borderRight,
48
49
  placeholder,
49
50
  errorZindex,
50
51
  errorBottom,
@@ -62,9 +63,11 @@ export const Input = ({
62
63
  labelLineHeight,
63
64
  backgroundColor,
64
65
  telErrorMessage,
66
+ borderRightColor,
65
67
  labelMarginBottom,
66
68
  regexpErrorMessage,
67
69
  phoneJustifyContent,
70
+ borderRightColorHover,
68
71
  errorAnimationDuration,
69
72
  ...props
70
73
  }) => {
@@ -243,7 +246,14 @@ export const Input = ({
243
246
  borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
244
247
  borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
245
248
  display: phoneDisplay ? phoneDisplay : configStyles.INPUT.phoneDisplay,
249
+ borderRight: borderRight ? borderRight : configStyles.INPUT.borderRight,
246
250
  alignItems: phoneAlignItems ? phoneAlignItems : configStyles.INPUT.phoneAlignItems,
251
+ borderColor:
252
+ isHover
253
+ ?
254
+ borderRightColorHover ? borderRightColorHover : configStyles.INPUT.borderRightColorHover
255
+ :
256
+ borderRightColor ? borderRightColor : configStyles.INPUT.borderRightColor,
247
257
  color: innerErrorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
248
258
  justifyContent: phoneJustifyContent ? phoneJustifyContent : configStyles.INPUT.phoneJustifyContent,
249
259
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
@@ -351,6 +361,7 @@ Input.propTypes = {
351
361
  maxLength: PropTypes.number,
352
362
  errorColor: PropTypes.string,
353
363
  labelColor: PropTypes.string,
364
+ borderRight: PropTypes.string,
354
365
  placeholder: PropTypes.string,
355
366
  errorZindex: PropTypes.string,
356
367
  errorBottom: PropTypes.string,
@@ -368,10 +379,12 @@ Input.propTypes = {
368
379
  phoneAlignItems: PropTypes.string,
369
380
  errorLineHeight: PropTypes.string,
370
381
  labelLineHeight: PropTypes.string,
382
+ borderRightColor: PropTypes.string,
371
383
  labelMarginBottom: PropTypes.string,
372
384
  regexpErrorMessage: PropTypes.string,
373
385
  regexp: PropTypes.instanceOf(RegExp),
374
386
  phoneJustifyContent: PropTypes.string,
387
+ borderRightColorHover: PropTypes.string,
375
388
  errorAnimationDuration: PropTypes.string,
376
389
  leftIcon: PropTypes.arrayOf(PropTypes.element),
377
390
  rightIcon: PropTypes.arrayOf(PropTypes.element),
@@ -85,7 +85,7 @@ export const NewFile = ({
85
85
 
86
86
  const handleRemoveFile = () => {
87
87
  setImage(null);
88
- removeFile(singleFile);
88
+ removeFile && removeFile(singleFile);
89
89
  };
90
90
 
91
91
  const handleChange = (e) => {
@@ -201,7 +201,11 @@ export const NewFile = ({
201
201
  if (multiple) {
202
202
  setSingleFile(null);
203
203
  }
204
- }, [multiple, filesArray && filesArray.length, defaultData]);
204
+
205
+ if (multiple && !removeFile) {
206
+ alert('Please add removeFile prop on NewFile component, it is a require in multiple mode');
207
+ }
208
+ }, [multiple, removeFile, filesArray && filesArray.length, defaultData]);
205
209
 
206
210
  useEffect(() => {
207
211
  if (errorMessage) {
@@ -215,11 +219,7 @@ export const NewFile = ({
215
219
  if (!change) {
216
220
  alert('Please add change prop on File component');
217
221
  }
218
-
219
- if (!removeFile) {
220
- alert('Please add removeFile prop on File component');
221
- }
222
- }, [change, removeFile]);
222
+ }, [change]);
223
223
 
224
224
  return (
225
225
  <div
@@ -413,7 +413,7 @@ export const NewFile = ({
413
413
  status={item.status}
414
414
  size={item.file.size}
415
415
  name={item.file.name}
416
- removeFile={removeFile}
416
+ removeFile={removeFile ? removeFile : _ => _}
417
417
  radius={radius ? radius : configStyles.File.radius}
418
418
  fileFormat={item.file.type.split('/')[1].toLowerCase()}
419
419
  progressColor={progressColor ? progressColor : configStyles.File.progressColor}
@@ -449,6 +449,7 @@ NewFile.propTypes = {
449
449
  upload: PropTypes.string,
450
450
  weight: PropTypes.number,
451
451
  maxSize: PropTypes.number,
452
+ removeFile: PropTypes.func,
452
453
  errorSize: PropTypes.string,
453
454
  labelSize: PropTypes.string,
454
455
  labelColor: PropTypes.string,
@@ -475,7 +476,6 @@ NewFile.propTypes = {
475
476
  progressTrackColor: PropTypes.string,
476
477
  fileAreaImageWidth: PropTypes.string,
477
478
  listItemErrorColor: PropTypes.string,
478
- removeFile: PropTypes.func.isRequired,
479
479
  fileAreaImageHeight: PropTypes.string,
480
480
  progressFailedColor: PropTypes.string,
481
481
  progressSuccessColor: PropTypes.string,
@@ -489,6 +489,6 @@ NewFile.propTypes = {
489
489
  };
490
490
 
491
491
  NewFile.defaultProps = {
492
- maxSize: 50,
492
+ maxSize: 10,
493
493
  fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
494
494
  };
@@ -39,7 +39,6 @@ export const Select = ({
39
39
  selectedColor,
40
40
  selectedRadius,
41
41
  selectedMinHeight,
42
- selectedBorder,
43
42
  selectedPadding,
44
43
  selectedFontSize,
45
44
  selectedBoxSizing,
@@ -47,7 +46,6 @@ export const Select = ({
47
46
  selectedLineHeight,
48
47
  selectedHoverColor,
49
48
  selectedTransition,
50
- selectedBorderColor,
51
49
 
52
50
  optionsBoxShadow,
53
51
  optionsBorderRadius,
@@ -65,6 +63,9 @@ export const Select = ({
65
63
  optionItemMarginBottom,
66
64
  optionItemBackgroudColor,
67
65
  optionItemBackgroudColorHover,
66
+
67
+ boxShadow,
68
+ boxShadowHover
68
69
  }) => {
69
70
  const ref = useRef();
70
71
 
@@ -222,7 +223,6 @@ export const Select = ({
222
223
  style={{
223
224
  cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.SELECT.cursor,
224
225
  minHeight: selectedMinHeight ? selectedMinHeight : configStyles.SELECT.selectedMinHeight,
225
- border: selectedBorder ? selectedBorder : configStyles.SELECT.selectedBorder,
226
226
  padding: selectedPadding ? selectedPadding : configStyles.SELECT.selectedPadding,
227
227
  borderRadius: selectedRadius ? selectedRadius : configStyles.SELECT.selectedRadius,
228
228
  fontSize: selectedFontSize ? selectedFontSize : configStyles.SELECT.selectedFontSize,
@@ -230,7 +230,7 @@ export const Select = ({
230
230
  fontWeight: selectedFontWeight ? selectedFontWeight : configStyles.SELECT.selectedFontWeight,
231
231
  lineHeight: selectedLineHeight ? selectedLineHeight : configStyles.SELECT.selectedLineHeight,
232
232
  transition: selectedTransition ? selectedTransition : configStyles.SELECT.selectedTransition,
233
- borderColor: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : selectedBorderColor ? selectedBorderColor : configStyles.SELECT.selectedBorderColor
233
+ boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.SELECT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.SELECT.boxShadowHover : boxShadow ? boxShadow : configStyles.SELECT.boxShadow
234
234
  }}
235
235
  onClick={disabled ? _ => _ : _ => handleOpenClose()}
236
236
  onMouseEnter={disabled ? _ => _ : _ => handleMouseEnter()}
@@ -378,7 +378,6 @@ Select.propTypes = {
378
378
  errorSize: PropTypes.string,
379
379
  errorColor: PropTypes.string,
380
380
  selectedColor: PropTypes.string,
381
- selectedBorder: PropTypes.string,
382
381
  selectedRadius: PropTypes.string,
383
382
  selectedMinHeight: PropTypes.string,
384
383
  selectedPadding: PropTypes.string,
@@ -388,7 +387,6 @@ Select.propTypes = {
388
387
  selectedFontWeight: PropTypes.string,
389
388
  selectedLineHeight: PropTypes.string,
390
389
  selectedTransition: PropTypes.string,
391
- selectedBorderColor: PropTypes.string,
392
390
 
393
391
  optionsBoxShadow: PropTypes.string,
394
392
  optionsBorderRadius: PropTypes.string,
@@ -406,4 +404,7 @@ Select.propTypes = {
406
404
  optionItemMarginBottom: PropTypes.string,
407
405
  optionItemBackgroudColor: PropTypes.string,
408
406
  optionItemBackgroudColorHover: PropTypes.string,
407
+
408
+ boxShadow: PropTypes.string,
409
+ boxShadowHover: PropTypes.string,
409
410
  };
@@ -16,7 +16,7 @@
16
16
  position: absolute;
17
17
  width: 100%;
18
18
  left: 0px;
19
- z-index: 1;
19
+ z-index: 9;
20
20
  max-height: 0;
21
21
  overflow: hidden;
22
22
  animation: select-show 640ms linear forwards;
@@ -1,125 +1,191 @@
1
- import React, { useEffect, useState } from "react";
2
- import PropTypes from "prop-types";
3
- import classnames from "classnames";
4
- import styles from "./table.module.css";
5
- import { Checkbox } from "../checkbox";
6
-
7
- export const Table = ({
8
- className,
9
- onChange,
10
- config,
11
- jsonData,
12
- hearderData,
13
- keyNames,
14
- actions,
15
- ...props
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import { compereConfigs } from './../../utils';
5
+
6
+ const Table = ({
7
+ tableHeadItems,
8
+ tableBodyItems,
9
+
10
+ tHeadColor,
11
+ tHeadFamily,
12
+ tHeadPadding,
13
+ tHeadFontWeight,
14
+ tHeadBorderRadius,
15
+ tHeadBackgroundColor,
16
+
17
+ tBodyColor,
18
+ tBodyPadding,
19
+ tBodyFontSize,
20
+ tBodyTextAlign,
21
+ tBodyFontWeight,
22
+ tBodyFontFamily,
23
+
24
+ tBodyRowBorder,
25
+ tBodyMarginTop,
16
26
  }) => {
17
- const classProps = classnames(className);
18
- let tbodyData = jsonData.length ? JSON.parse(jsonData) : [];
19
-
20
- useEffect(()=>{
21
- tbodyData = jsonData.length ? JSON.parse(jsonData) : [];
22
- },[jsonData])
23
-
24
- const [checked,setChecked] = useState(config.isCheckbox && config.isCheckbox.checked ? config.isCheckbox.checked : []);
25
-
26
-
27
- config.isCheckbox && config.isCheckbox.showCheckbox == undefined
28
- ? (config.isCheckbox.showCheckbox = () => {
29
- return true;
30
- })
31
- : "";
32
-
33
- return (
34
- <div className={`${styles["table-wrap"]} table-wrap-rem`}>
35
- {config.isHeader &&
36
- hearderData.map((header, key) => {
37
- return (
38
- <div className={`${styles["table-top"]} table-top-rem`} key={key}>
39
- <div className={`${styles["table-items"]} table-items-rem`}>
40
- {header}
41
- </div>
42
- </div>
43
- );
44
- })}
45
- <div className={`${styles["table-bottom"]} table-bottom-rem`}>
46
- {tbodyData.map((item, key) => {
47
- return (
48
- <div className={`${styles["table-bottom-inner"]} table-bottom-inner-rem`} key={key}>
49
- {keyNames.map((keyName, keyNameKey) => {
50
- return (
51
- <div
52
- className={`${styles["table-items"]} table-items-rem`}
53
- key={keyNameKey}
54
- >
55
- {config.isCheckbox &&
56
- config.isCheckbox.showCheckbox &&
57
- config.isCheckbox.showCheckbox(
58
- item
59
- ) &&
60
- keyNameKey == 0 && (
61
- <Checkbox
62
- onClick={(e) => {
63
- const id = e.target.id;
64
- const checkedValue = e.target.checked;
65
- let ch = [...checked]
66
- checkedValue ? ch.push(Number(id)) : ch.splice(ch.indexOf(id), 1);
67
- setChecked(ch);
68
- config.isCheckbox.onChange(ch);
69
- }}
70
- jsonData={`[{"value":"", "name":"", "label":"", "id":${item.id}, "checked":${checked.indexOf(item.id) > -1 ? true : false }}]`}
71
- />
72
- )}
73
- {typeof keyName === "string" ? (
74
- item[keyName]
75
- ) : (
76
- <>
77
- <i className={keyName.icon} />
78
- {item[keyName.name]}
79
- </>
80
- )}
81
- </div>
82
- );
83
- })}
84
-
85
- {actions && (
86
- <div className={`${styles["table-items"]} table-items-rem`}>
87
- {actions.filter(a => a.show && a.show(item) || a.show === undefined).map((action, key) => {
88
- return (<div key={key}>
89
- <i className={action.icon} onClick={action.click? action.click : ()=>{}}>
90
- {action.icon}
91
- </i>
92
- </div>)
93
- })}
94
- </div>
95
- )}
96
- </div>
97
- );
98
- })}
99
- </div>
100
- </div>
101
- );
27
+
28
+ const configStyles = compereConfigs();
29
+
30
+ return (
31
+ <>
32
+ <table
33
+ style={{
34
+ borderCollapse: 'collapse'
35
+ }}
36
+ >
37
+
38
+ {
39
+ tableHeadItems && tableHeadItems.length > 0 && <thead>
40
+ <tr
41
+ style={{
42
+ color: tHeadColor ? tHeadColor : configStyles.TABLE.tHeadColor,
43
+ backgroundColor: tHeadBackgroundColor ? tHeadBackgroundColor : configStyles.TABLE.tHeadBackgroundColor
44
+ }}
45
+ >
46
+ {
47
+ tableHeadItems.map((item, index) => {
48
+ return (
49
+ <th
50
+ key={`${item}_${index}`}
51
+ style={{
52
+ padding: tHeadPadding ? tHeadPadding : configStyles.TABLE.tHeadPadding,
53
+ fontFamily: tHeadFamily ? tHeadFamily : configStyles.TABLE.tHeadFamily,
54
+ fontWeight: tHeadFontWeight ? tHeadFontWeight : configStyles.TABLE.tHeadFontWeight,
55
+ borderTopLeftRadius: index === 0 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px',
56
+ borderTopRightRadius: index === tableHeadItems.length - 1 ? tHeadBorderRadius ? tHeadBorderRadius : configStyles.TABLE.tHeadBorderRadius : '0px'
57
+ }}
58
+ >
59
+ {item}
60
+ </th>
61
+ )
62
+ })
63
+ }
64
+ </tr>
65
+ </thead>
66
+ }
67
+
68
+ {
69
+ tableBodyItems && tableBodyItems.length > 0 && <tbody
70
+ style={{
71
+ boxShadow: '0px 10px 30px rgba(0, 35, 106, 0.06)'
72
+ }}
73
+ >
74
+
75
+ {
76
+
77
+ tableBodyItems.map((item, index) => {
78
+ return (
79
+ <>
80
+ {
81
+ tBodyMarginTop ? tBodyMarginTop : configStyles.TABLE.tBodyMarginTop && index === 0 && <tr>
82
+ <td
83
+ style={{
84
+ height: tBodyMarginTop ? tBodyMarginTop : configStyles.TABLE.tBodyMarginTop
85
+ }}
86
+ >
87
+ </td>
88
+ </tr>
89
+ }
90
+
91
+ <tr
92
+ key={`${item.id}_${index}`}
93
+ style={{
94
+ borderBottom: index === tableBodyItems.length - 1 ? 'none' : tBodyRowBorder ? tBodyRowBorder : configStyles.TABLE.tBodyRowBorder
95
+ }}
96
+ >
97
+ {
98
+ Object.values(item).map((innerItem, innerIndex) => {
99
+ if (innerIndex > 0) { // TODO:
100
+ return (
101
+ <td
102
+ key={`${innerItem}_${innerIndex}`}
103
+ style={{
104
+ color: tBodyColor ? tBodyColor : configStyles.TABLE.tBodyColor,
105
+ padding: tBodyPadding ? tBodyPadding : configStyles.TABLE.tBodyPadding,
106
+ fontSize: tBodyFontSize ? tBodyFontSize : configStyles.TABLE.tBodyFontSize,
107
+ textAlign: tBodyTextAlign ? tBodyTextAlign : configStyles.TABLE.tBodyTextAlign,
108
+ fontFamily: tBodyFontFamily ? tBodyFontFamily : configStyles.TABLE.tBodyFontFamily,
109
+ fontWeight: tBodyFontWeight ? tBodyFontWeight : configStyles.TABLE.tBodyFontWeight,
110
+ borderRight: innerIndex === Object.values(item).length - 1 ? 'none' : configStyles.TABLE.tBodyRowBorder
111
+ }}
112
+ >
113
+ {
114
+ Array.isArray(innerItem)
115
+ ? innerItem.length > 0
116
+ ? innerItem.map((newItem, newIndex) => {
117
+ if (newItem && !Array.isArray(newItem) && typeof newItem === 'object') {
118
+ return Object.values(newItem).map((actionItem, actionIndex) => {
119
+ return (
120
+ <span
121
+ key={`${actionItem}_${actionIndex}`}
122
+ style={{
123
+ cursor: 'pointer'
124
+ }}
125
+ >
126
+ { actionItem }
127
+ </span>
128
+ )
129
+ })
130
+ } else {
131
+ return <span
132
+ key={`${newItem}_${newIndex}`}
133
+ >
134
+ {newItem}
135
+ </span>
136
+ }
137
+ })
138
+ : ''
139
+ : innerItem
140
+ }
141
+ </td>
142
+ )
143
+ }
144
+ })
145
+ }
146
+ </tr>
147
+ </>
148
+ )
149
+ })
150
+ }
151
+ </tbody>
152
+ }
153
+
154
+
155
+
156
+
157
+ <tfoot
158
+ style={{
159
+
160
+ }}
161
+ >
162
+
163
+ </tfoot>
164
+ </table>
165
+ </>
166
+ );
102
167
  };
103
168
 
104
169
  Table.propTypes = {
105
- className: PropTypes.string,
106
- onChange: PropTypes.func,
107
- config: PropTypes.object,
108
- actions: PropTypes.arrayOf(PropTypes.object),
109
- jsonData: PropTypes.string,
110
- keyNames: PropTypes.arrayOf(
111
- PropTypes.oneOf([PropTypes.string, PropTypes.object])
112
- ),
113
- hearderData: PropTypes.array,
114
- };
170
+ tableHeadItems: PropTypes.array,
171
+ tableBodyItems: PropTypes.array,
172
+
173
+ tHeadColor: PropTypes.string,
174
+ tHeadFamily: PropTypes.string,
175
+ tHeadPadding: PropTypes.string,
176
+ tHeadFontWeight: PropTypes.number,
177
+ tHeadBorderRadius: PropTypes.string,
178
+ tHeadBackgroundColor: PropTypes.string,
115
179
 
116
- Table.defaultProps = {
117
- className: "",
118
- onChange: undefined,
119
- errorMessage: "",
120
- config: { isHeader: true, isCheckbox: {checked:[]} },
121
- actions: [],
122
- jsonData: "",
123
- keyNames: [],
124
- hearderData: [],
180
+ tBodyColor: PropTypes.string,
181
+ tBodyPadding: PropTypes.string,
182
+ tBodyFontSize: PropTypes.string,
183
+ tBodyTextAlign: PropTypes.string,
184
+ tBodyFontWeight: PropTypes.string,
185
+ tBodyFontFamily: PropTypes.string,
186
+
187
+ tBodyRowBorder: PropTypes.string,
188
+ tBodyMarginTop: PropTypes.string
125
189
  };
190
+
191
+ export default Table;