imbric-theme 0.3.2 → 0.3.5
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/.storybook/main.js +1 -1
- package/atoms/AlertModal/AlertModal.js +77 -0
- package/atoms/AlertModal/AlertModal.module.css +3 -0
- package/atoms/AlertModal/AlertModal.stories.js +30 -0
- package/atoms/AlertModal/constants.js +4 -0
- package/atoms/AlertModal/index.js +3 -0
- package/atoms/Button/Button.js +5 -2
- package/atoms/Button/Button.module.css +6 -3
- package/atoms/Checkbox/Checkbox.js +49 -0
- package/atoms/Checkbox/Checkbox.module.css +3 -0
- package/atoms/Checkbox/Checkbox.stories.js +28 -0
- package/atoms/Checkbox/constants.js +1 -0
- package/atoms/Checkbox/index.js +3 -0
- package/atoms/Heading/Heading.js +1 -1
- package/atoms/Heading/Heading.module.css +4 -0
- package/atoms/Heading/constants.js +1 -1
- package/atoms/Icon/constants.js +30 -6
- package/atoms/Input/Input.js +21 -5
- package/atoms/Input/Input.module.css +26 -6
- package/atoms/Input/Input.stories.js +8 -2
- package/atoms/Input/__snapshots__/Input.stories.js.snap +5 -5
- package/atoms/Input/constants.js +1 -1
- package/atoms/Label/Label.js +31 -0
- package/atoms/Label/Label.module.css +38 -0
- package/atoms/Label/Label.stories.js +26 -0
- package/atoms/Label/constants.js +1 -0
- package/atoms/Label/index.js +3 -0
- package/atoms/Paragraph/Paragraph.module.css +4 -0
- package/hook/useAddColumn.js +40 -0
- package/hook/useStateDate.js +25 -0
- package/hook/useTable.js +45 -0
- package/index.js +22 -1
- package/jest.config.js +1 -1
- package/layout/DynamicTable/DynamicTable.js +172 -0
- package/layout/DynamicTable/DynamicTable.module.css +63 -0
- package/layout/DynamicTable/DynamicTable.stories.js +77 -0
- package/layout/DynamicTable/constants.js +323 -0
- package/layout/DynamicTable/index.js +3 -0
- package/layout/Navbar/Navbar.js +19 -11
- package/layout/Navbar/Navbar.module.css +4 -2
- package/layout/Navbar/Navbar.stories.js +2 -1
- package/layout/Sidebar/Sidebar.js +6 -3
- package/layout/Sidebar/Sidebar.module.css +1 -10
- package/layout/Sidebar/Sidebar.stories.js +1 -1
- package/layout/Sidebar/constants.js +228 -205
- package/molecules/CheckList/CheckList.js +135 -0
- package/molecules/CheckList/CheckList.module.css +94 -0
- package/molecules/CheckList/CheckList.stories.js +25 -0
- package/molecules/CheckList/constants.js +23 -0
- package/molecules/CheckList/index.js +3 -0
- package/molecules/ColumnTable/ColumnTable.js +124 -0
- package/molecules/ColumnTable/ColumnTable.module.css +22 -0
- package/molecules/ColumnTable/ColumnTable.stories.js +26 -0
- package/molecules/ColumnTable/constants.js +111 -0
- package/molecules/ColumnTable/index.js +3 -0
- package/molecules/DatePicker/DatePicker.js +236 -0
- package/molecules/DatePicker/DatePicker.module.css +38 -0
- package/molecules/DatePicker/DatePicker.stories.js +23 -0
- package/molecules/DatePicker/constants.js +3 -0
- package/molecules/DatePicker/index.js +3 -0
- package/molecules/Dropdown/Dropdown.js +25 -22
- package/molecules/Dropdown/Dropdown.module.css +21 -3
- package/molecules/DynamicSelect/DynamicSelect.js +109 -0
- package/molecules/DynamicSelect/DynamicSelect.module.css +10 -0
- package/molecules/DynamicSelect/DynamicSelect.stories.js +32 -0
- package/molecules/DynamicSelect/constants.js +7 -0
- package/molecules/DynamicSelect/index.js +3 -0
- package/molecules/Error/Error.js +2 -2
- package/molecules/Error/Error.module.css +3 -2
- package/molecules/FooterTable/FooterTable.js +47 -0
- package/molecules/FooterTable/FooterTable.module.css +37 -0
- package/molecules/FooterTable/FooterTable.stories.js +23 -0
- package/molecules/FooterTable/constants.js +1 -0
- package/molecules/FooterTable/index.js +3 -0
- package/molecules/ItemMenu/ItemMenu.js +35 -24
- package/molecules/ItemMenu/ItemMenu.module.css +13 -4
- package/molecules/ItemMenu/ItemMenu.stories.js +2 -0
- package/molecules/ItemMenu/constants.js +3 -0
- package/molecules/RowTable/RowTable.js +68 -0
- package/molecules/RowTable/RowTable.module.css +22 -0
- package/molecules/RowTable/RowTable.stories.js +26 -0
- package/molecules/RowTable/constants.js +305 -0
- package/molecules/RowTable/index.js +3 -0
- package/package.json +11 -2
- package/pages/Login/Login.js +102 -0
- package/pages/Login/Login.module.css +5 -0
- package/pages/Login/Login.stories.js +23 -0
- package/pages/Login/constants.js +1 -0
- package/pages/Login/index.js +3 -0
- package/pages/Login/validation/loginSchema.js +5 -0
- package/public/static/logologin.svg +16 -0
- package/scripts/create-component.js +2 -1
- package/storybook-static/0.263f852f.iframe.bundle.js +1 -0
- package/storybook-static/0.91dbd3f3aa2099d25061.manager.bundle.js +1 -0
- package/storybook-static/1.17e9ac7e.iframe.bundle.js +3 -0
- package/storybook-static/1.17e9ac7e.iframe.bundle.js.LICENSE.txt +8 -0
- package/storybook-static/1.17e9ac7e.iframe.bundle.js.map +1 -0
- package/storybook-static/2.cc4000c2.iframe.bundle.js +1 -0
- package/storybook-static/3.e9f95d01.iframe.bundle.js +1 -0
- package/storybook-static/4.be0a752c9f5176d6eec1.manager.bundle.js +2 -0
- package/storybook-static/4.be0a752c9f5176d6eec1.manager.bundle.js.LICENSE.txt +8 -0
- package/storybook-static/5.8efdde123acaf8fbb100.manager.bundle.js +1 -0
- package/storybook-static/6.2f82294ae0b087aecb24.manager.bundle.js +2 -0
- package/storybook-static/6.2f82294ae0b087aecb24.manager.bundle.js.LICENSE.txt +12 -0
- package/storybook-static/7.97068037.iframe.bundle.js +1 -0
- package/storybook-static/7.fa9452d2609e8a00f314.manager.bundle.js +1 -0
- package/storybook-static/8.66f5ef1c66fc4628f127.manager.bundle.js +1 -0
- package/storybook-static/8.b545d602.iframe.bundle.js +3 -0
- package/storybook-static/8.b545d602.iframe.bundle.js.LICENSE.txt +12 -0
- package/storybook-static/8.b545d602.iframe.bundle.js.map +1 -0
- package/storybook-static/9.269ed917.iframe.bundle.js +1 -0
- package/storybook-static/favicon.ico +0 -0
- package/storybook-static/iframe.html +348 -0
- package/storybook-static/index.html +59 -0
- package/storybook-static/main.157061c9.iframe.bundle.js +1 -0
- package/storybook-static/main.5a07347846ccf2d7e5dc.manager.bundle.js +1 -0
- package/storybook-static/runtime~main.a14e6e62.iframe.bundle.js +1 -0
- package/storybook-static/runtime~main.f78c3fae275fc212c109.manager.bundle.js +1 -0
- package/storybook-static/static/logo.svg +19 -0
- package/storybook-static/static/logologin.svg +16 -0
- package/storybook-static/static/logotipo.svg +50 -0
- package/storybook-static/static/logotipoS.svg +26 -0
- package/storybook-static/vendors~main.720e76f4.iframe.bundle.js +3 -0
- package/storybook-static/vendors~main.720e76f4.iframe.bundle.js.LICENSE.txt +110 -0
- package/storybook-static/vendors~main.720e76f4.iframe.bundle.js.map +1 -0
- package/storybook-static/vendors~main.fcd0b2a3431ddf75f5f7.manager.bundle.js +2 -0
- package/storybook-static/vendors~main.fcd0b2a3431ddf75f5f7.manager.bundle.js.LICENSE.txt +101 -0
- package/styles/globals.css +592 -0
- package/styles/tokens.css +2 -1
- package/tokens/index.js +2 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const useAddColumn = (event) => {
|
|
2
|
+
|
|
3
|
+
let listKeyColumnOrder = []
|
|
4
|
+
|
|
5
|
+
event.forEach(element => {
|
|
6
|
+
listKeyColumnOrder[element.value] = true
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
for (const itemAddColumns of addColumsData) {
|
|
10
|
+
if (listKeyColumnOrder[itemAddColumns.value]) {
|
|
11
|
+
itemAddColumns.activeView = true
|
|
12
|
+
} else {
|
|
13
|
+
itemAddColumns.activeView = false
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
for (const itemEvent of addColumsData) {
|
|
19
|
+
|
|
20
|
+
for (const itemColumns of columnsData) {
|
|
21
|
+
|
|
22
|
+
if (itemColumns.accessor === itemEvent.value) {
|
|
23
|
+
|
|
24
|
+
if (itemEvent.activeView) {
|
|
25
|
+
itemColumns.activeView = true
|
|
26
|
+
} else {
|
|
27
|
+
itemColumns.activeView = false
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
setColumnsData([])
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default useAddColumn
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
addDays,
|
|
4
|
+
} from "date-fns";
|
|
5
|
+
|
|
6
|
+
const useStateDate = () => {
|
|
7
|
+
|
|
8
|
+
const [state, setState] = useState([
|
|
9
|
+
{
|
|
10
|
+
startDate: addDays(new Date(), -59),
|
|
11
|
+
endDate: new Date(),
|
|
12
|
+
key: 'selection',
|
|
13
|
+
}
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
|
|
19
|
+
}, [state]);
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
return { state, setState }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default useStateDate
|
package/hook/useTable.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
const calculateRange = (data, rowsPerPage) => {
|
|
4
|
+
const range = []
|
|
5
|
+
if (!data) {
|
|
6
|
+
var num = Math.ceil(1);
|
|
7
|
+
} else {
|
|
8
|
+
num = Math.ceil(data.length / rowsPerPage);
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// const num = Math.ceil(data.length / rowsPerPage);
|
|
13
|
+
|
|
14
|
+
// let i = 1;
|
|
15
|
+
for (let i = 1; i <= num; i++) {
|
|
16
|
+
range.push(i);
|
|
17
|
+
}
|
|
18
|
+
return range;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const sliceData = (data, page, rowsPerPage) => {
|
|
22
|
+
|
|
23
|
+
if (!data) {
|
|
24
|
+
return data = [];
|
|
25
|
+
} else {
|
|
26
|
+
return data.slice((page - 1) * rowsPerPage, page * rowsPerPage);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const useTable = (data, page, rowsPerPage) => {
|
|
31
|
+
const [tableRange, setTableRange] = useState([]);
|
|
32
|
+
const [slice, setSlice] = useState([]);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const range = calculateRange(data, rowsPerPage);
|
|
36
|
+
setTableRange([...range]);
|
|
37
|
+
|
|
38
|
+
const slice = sliceData(data, page, rowsPerPage);
|
|
39
|
+
setSlice([...slice]);
|
|
40
|
+
}, [data, setTableRange, page, setSlice, rowsPerPage]);
|
|
41
|
+
|
|
42
|
+
return { slice, range: tableRange };
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default useTable;
|
package/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Pages
|
|
2
|
+
export { default as Login } from './pages/Login'
|
|
3
|
+
|
|
1
4
|
// Layout
|
|
2
5
|
export { default as CenteredContent } from './layout/CenteredContent'
|
|
3
6
|
export { default as Container } from './layout/Container'
|
|
@@ -6,16 +9,21 @@ export { default as FlexColumnContent } from './layout/FlexColumnContent'
|
|
|
6
9
|
export { default as Spacer } from './layout/Spacer'
|
|
7
10
|
export { default as Sidebar } from './layout/Sidebar'
|
|
8
11
|
export { default as Navbar } from './layout/Navbar'
|
|
12
|
+
export { default as DynamicTable } from './layout/DynamicTable'
|
|
13
|
+
|
|
9
14
|
|
|
10
15
|
// Atoms
|
|
16
|
+
export { default as AlertModal } from './atoms/AlertModal'
|
|
11
17
|
export { default as Avatar } from './atoms/Avatar'
|
|
12
18
|
export { default as Button } from './atoms/Button'
|
|
13
19
|
export { default as Card } from './atoms/Card'
|
|
14
20
|
export { default as Check } from './atoms/Check'
|
|
21
|
+
export { default as Checkbox } from './atoms/Checkbox'
|
|
15
22
|
export { default as Divider } from './atoms/Divider'
|
|
16
23
|
export { default as Heading } from './atoms/Heading'
|
|
17
24
|
export { default as Icon } from './atoms/Icon'
|
|
18
25
|
export { default as Input } from './atoms/Input'
|
|
26
|
+
export { default as Label } from './atoms/Label'
|
|
19
27
|
export { default as Link } from './atoms/Link'
|
|
20
28
|
export { default as Modal } from './atoms/Modal'
|
|
21
29
|
export { default as Paragraph } from './atoms/Paragraph'
|
|
@@ -23,6 +31,7 @@ export { default as Picture } from './atoms/Picture'
|
|
|
23
31
|
export { default as Textarea } from './atoms/Textarea'
|
|
24
32
|
export { default as Tab } from './atoms/Tab'
|
|
25
33
|
|
|
34
|
+
|
|
26
35
|
// Molecules
|
|
27
36
|
export { default as Accordion } from './molecules/Accordion'
|
|
28
37
|
export { default as AddButton } from './molecules/AddButton'
|
|
@@ -33,4 +42,16 @@ export { default as Score } from './molecules/Score'
|
|
|
33
42
|
export { default as Task } from './molecules/Task'
|
|
34
43
|
export { default as TaskCounter } from './molecules/TaskCounter'
|
|
35
44
|
export { default as IconLabel } from './molecules/IconLabel'
|
|
36
|
-
export { default as ItemMenu } from './molecules/ItemMenu'
|
|
45
|
+
export { default as ItemMenu } from './molecules/ItemMenu'
|
|
46
|
+
export { default as CheckList } from './molecules/CheckList'
|
|
47
|
+
export { default as ColumnTable } from './molecules/ColumnTable'
|
|
48
|
+
export { default as RowTable } from './molecules/RowTable'
|
|
49
|
+
export { default as FooterTable } from './molecules/FooterTable'
|
|
50
|
+
export { default as DynamicSelect } from './molecules/DynamicSelect'
|
|
51
|
+
export { default as DatePicker } from './molecules/DynamicSelect'
|
|
52
|
+
|
|
53
|
+
export { default as useTable } from './hook/useTable'
|
|
54
|
+
export { default as useStateDate } from './hook/useStateDate'
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
package/jest.config.js
CHANGED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useEffect, useState } from 'react'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import styles from './DynamicTable.module.css'
|
|
5
|
+
import withStyles from '../../hocs/withStyles'
|
|
6
|
+
import DynamicSelect from '../../molecules/DynamicSelect'
|
|
7
|
+
import DatePicker from '../../molecules/DatePicker'
|
|
8
|
+
import Label from '../../atoms/Label'
|
|
9
|
+
import Icon from '../../atoms/Icon'
|
|
10
|
+
import { Horizontal, Vertical } from '../../layout/Spacer/components'
|
|
11
|
+
import LoadingError from '../../molecules/LoadingError'
|
|
12
|
+
// import ColumnTable from '../../molecules/ColumnTable'
|
|
13
|
+
// import RowTable from '../../molecules/RowTable'
|
|
14
|
+
// import FooterTable from '../../molecules/FooterTable'
|
|
15
|
+
// import useTable from '../../hook/useTable'
|
|
16
|
+
// import useStateDate from '../../hook/useStateDate';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns, isLayoutDate, isViewRange, isViewAddColumn, isViewDownloadDoc, handleAddColumn, handleSelectRange, handleDownloadExcel }) => {
|
|
20
|
+
|
|
21
|
+
const [tableData, setTableData] = useState(optionsData);
|
|
22
|
+
const [columnsData, setColumnsData] = useState(opColumns);
|
|
23
|
+
const [addColumsData, setAddColumsData] = useState(opAddColumns);
|
|
24
|
+
|
|
25
|
+
// const handleSelectRange = (item) => {
|
|
26
|
+
// setState([item.selection])
|
|
27
|
+
// }
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setColumnsData(opColumns);
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const handleSorting = (sortField, sortOrder) => {
|
|
34
|
+
if (sortField) {
|
|
35
|
+
const sorted = [...tableData].sort((a, b) => {
|
|
36
|
+
if (a[sortField] === null) return 1;
|
|
37
|
+
if (b[sortField] === null) return -1;
|
|
38
|
+
if (a[sortField] === null && b[sortField] === null) return 0;
|
|
39
|
+
return (
|
|
40
|
+
a[sortField].toString().localeCompare(b[sortField].toString(), "en", {
|
|
41
|
+
numeric: true,
|
|
42
|
+
}) * (sortOrder === "asc" ? 1 : -1)
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
setTableData(sorted);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// const handleAddColumn = (event) => {
|
|
50
|
+
|
|
51
|
+
// let listKeyColumnOrder = []
|
|
52
|
+
|
|
53
|
+
// event.forEach(element => {
|
|
54
|
+
// listKeyColumnOrder[element.value] = true
|
|
55
|
+
// });
|
|
56
|
+
|
|
57
|
+
// for (const itemAddColumns of addColumsData) {
|
|
58
|
+
// if (listKeyColumnOrder[itemAddColumns.value]) {
|
|
59
|
+
// itemAddColumns.activeView = true
|
|
60
|
+
// } else {
|
|
61
|
+
// itemAddColumns.activeView = false
|
|
62
|
+
// }
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
// for (const itemEvent of addColumsData) {
|
|
66
|
+
|
|
67
|
+
// for (const itemColumns of columnsData) {
|
|
68
|
+
|
|
69
|
+
// if (itemColumns.accessor === itemEvent.value) {
|
|
70
|
+
|
|
71
|
+
// if (itemEvent.activeView) {
|
|
72
|
+
// itemColumns.activeView = true
|
|
73
|
+
// } else {
|
|
74
|
+
// itemColumns.activeView = false
|
|
75
|
+
// }
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
// }
|
|
79
|
+
// }
|
|
80
|
+
|
|
81
|
+
// }
|
|
82
|
+
|
|
83
|
+
// setColumnsData([])
|
|
84
|
+
|
|
85
|
+
// }
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
<div className={getStyles('opFunction')}>
|
|
91
|
+
|
|
92
|
+
{isViewRange ? (
|
|
93
|
+
<div className={getStyles('opFunctionBox1')}>
|
|
94
|
+
<DatePicker
|
|
95
|
+
isLayoutDate={isLayoutDate}
|
|
96
|
+
onChangeRange={handleSelectRange}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
) : null}
|
|
100
|
+
|
|
101
|
+
<div className={getStyles('opFunctionBox2')}>
|
|
102
|
+
|
|
103
|
+
{isViewAddColumn ? (
|
|
104
|
+
<div className={getStyles('opFunctionBox3')}>
|
|
105
|
+
<Label>Mostrar u ocultar columnas</Label>
|
|
106
|
+
<DynamicSelect
|
|
107
|
+
isMulti
|
|
108
|
+
isInline
|
|
109
|
+
onChange={handleAddColumn}
|
|
110
|
+
optionsSelect={addColumsData}
|
|
111
|
+
placeholder='Seleccionar columnas'
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
) : null}
|
|
115
|
+
<Horizontal size="md" />
|
|
116
|
+
{isViewDownloadDoc ? (
|
|
117
|
+
<div className={getStyles('opFunctionBox3')}>
|
|
118
|
+
<Icon
|
|
119
|
+
key="fileDownload"
|
|
120
|
+
background="inverted"
|
|
121
|
+
name="fileDownload"
|
|
122
|
+
onClick={handleDownloadExcel}
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
) : null}
|
|
126
|
+
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
// <ColumnTable
|
|
132
|
+
// handleSorting={handleSorting}
|
|
133
|
+
// onChangeInput={onChangeInput}
|
|
134
|
+
// columnsData={columnsData}
|
|
135
|
+
// >
|
|
136
|
+
// {item.title}
|
|
137
|
+
// </ColumnTable>
|
|
138
|
+
|
|
139
|
+
// <RowTable slice={slice} columnsData={columnsData}></RowTable>
|
|
140
|
+
|
|
141
|
+
// <FooterTable range={range} slice={slice} setPage={setPage} page={page} />
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
DynamicTable.propTypes = {
|
|
148
|
+
// children: PropTypes.node.isRequired,
|
|
149
|
+
getStyles: PropTypes.func.isRequired,
|
|
150
|
+
isViewRange: PropTypes.bool,
|
|
151
|
+
isViewAddColumn: PropTypes.bool,
|
|
152
|
+
isViewDownloadDoc: PropTypes.bool,
|
|
153
|
+
onChangeInput: PropTypes.func,
|
|
154
|
+
handleAddColumn: PropTypes.func,
|
|
155
|
+
isError: PropTypes.string,
|
|
156
|
+
isLayoutDate: PropTypes.string,
|
|
157
|
+
handleSelectRange: PropTypes.func,
|
|
158
|
+
handleDownloadExcel: PropTypes.func,
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
DynamicTable.defaultProps = {
|
|
162
|
+
getStyles: () => { },
|
|
163
|
+
handleAddColumn: () => { },
|
|
164
|
+
isViewRange: true,
|
|
165
|
+
isViewAddColumn: true,
|
|
166
|
+
isViewDownloadDoc: true,
|
|
167
|
+
isLayoutDate: 'DateRangePicker',
|
|
168
|
+
handleSelectRange: () => { },
|
|
169
|
+
handleDownloadExcel: () => { },
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export default withStyles(styles)(DynamicTable)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.opFunction {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* .opFunctionBox1 {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
} */
|
|
11
|
+
|
|
12
|
+
.opFunctionBox2 {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: flex-end;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.dynamic-table {
|
|
18
|
+
box-shadow: 0px 3px 1px -2px rgb(0 0 0 / 7%), 0px 2px 2px 0px rgb(0 0 0 / 7%), 0px 1px 5px 0px rgb(0 0 0 / 6%);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.table {
|
|
22
|
+
width: 100%;
|
|
23
|
+
table-layout: fixed;
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.tbl-header {
|
|
28
|
+
/* background-color: rgba(255, 255, 255, 0.3); */
|
|
29
|
+
/* background-color: -webkit-linear-gradient(left, #25c481, #25b7c4);
|
|
30
|
+
background-color: linear-gradient(to right, #25c481, #25b7c4); */
|
|
31
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.tbl-content {
|
|
35
|
+
height: max-content;
|
|
36
|
+
overflow-x: auto;
|
|
37
|
+
margin-top: 0px;
|
|
38
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.td {
|
|
42
|
+
padding: 15px;
|
|
43
|
+
text-align: left;
|
|
44
|
+
vertical-align: middle;
|
|
45
|
+
font-weight: 300;
|
|
46
|
+
font-size: 12px;
|
|
47
|
+
color: var(--color-font-base);
|
|
48
|
+
border-bottom: solid 1px rgba(0, 0, 0, 0.1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* for custom scrollbar for webkit browser*/
|
|
52
|
+
|
|
53
|
+
/* ::-webkit-scrollbar {
|
|
54
|
+
width: 6px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
::-webkit-scrollbar-track {
|
|
58
|
+
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
::-webkit-scrollbar-thumb {
|
|
62
|
+
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
|
63
|
+
} */
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { DynamicTable, styles, options } from '.'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
getTemplate,
|
|
5
|
+
getListTemplate,
|
|
6
|
+
getOptionsArgTypes,
|
|
7
|
+
} from '../../helpers/storybook'
|
|
8
|
+
import ColumnTable from '../../molecules/ColumnTable'
|
|
9
|
+
import Heading from '../../atoms/Heading';
|
|
10
|
+
import { Vertical } from '../Spacer/components';
|
|
11
|
+
import RowTable from '../../molecules/RowTable';
|
|
12
|
+
import FooterTable from '../../molecules/FooterTable';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const Template = getTemplate(DynamicTable, styles)
|
|
16
|
+
const ListTemplate = getListTemplate(DynamicTable, styles)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
title: 'Layout/DynamicTable',
|
|
22
|
+
component: DynamicTable,
|
|
23
|
+
args: {
|
|
24
|
+
optionsData: options.bookings,
|
|
25
|
+
opColumns: options.columns,
|
|
26
|
+
opAddColumns: options.opAddColumns,
|
|
27
|
+
isViewRange: true,
|
|
28
|
+
isViewAddColumn: true,
|
|
29
|
+
isViewDownloadDoc: true,
|
|
30
|
+
},
|
|
31
|
+
argTypes: {
|
|
32
|
+
// types: getOptionsArgTypes(options.types),
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const Default = Template.bind({})
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export const TableTotal = () =>
|
|
40
|
+
<div>
|
|
41
|
+
|
|
42
|
+
{/* Title - Optional */}
|
|
43
|
+
<Heading color='black' size='lg' weight='normal'>
|
|
44
|
+
Servicios de traslados
|
|
45
|
+
</Heading>
|
|
46
|
+
|
|
47
|
+
<Vertical size='sm' />
|
|
48
|
+
|
|
49
|
+
{/* Dynamic Table */}
|
|
50
|
+
<Default></Default>
|
|
51
|
+
|
|
52
|
+
<Vertical size='sm' />
|
|
53
|
+
|
|
54
|
+
{/* Column Table */}
|
|
55
|
+
<ColumnTable columnsData={options.columns}> </ColumnTable>
|
|
56
|
+
|
|
57
|
+
<Vertical size='sm' />
|
|
58
|
+
|
|
59
|
+
{/* Row Table */}
|
|
60
|
+
<RowTable slice={options.bookings} columnsData={options.columns}></RowTable>
|
|
61
|
+
|
|
62
|
+
{/* Footer Table */}
|
|
63
|
+
<FooterTable range={[]} slice={options.bookings} setPage={4} page={1} />
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
// TableTotal.args = { isInline: true }
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
{/* <Canvas>
|
|
72
|
+
<Story name="Basic">
|
|
73
|
+
</Story>
|
|
74
|
+
</Canvas> */}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|