@cashub/ui-elv 1.0.1 → 1.0.3
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/chart/BarChart.js +8 -2
- package/chart/DoughnutChart.js +2 -1
- package/chart/LineChart.js +2 -1
- package/chart/utils/customTooltip.js +3 -7
- package/chart/utils/customTooltipLifecyclePlugin.js +21 -0
- package/chart/utils/tooltipElement.js +25 -0
- package/chart/utils/xAxisLabelTooltipPlugin.js +107 -0
- package/datetimePicker/index.js +2 -37
- package/esm/Tab/Tab.js +21 -0
- package/esm/Tab/TabList.js +160 -0
- package/esm/Tab/TabPanel.js +42 -0
- package/esm/Tab/TabTab.js +98 -0
- package/esm/Tab/index.js +23 -0
- package/esm/Tab/subComponent/TabContext.js +3 -0
- package/esm/Tab/subComponent/TabListV2.js +18 -0
- package/esm/Tab/subComponent/TabPanelV2.js +45 -0
- package/esm/Tab/subComponent/TabTabV2.js +56 -0
- package/esm/VerticalTab/TabList.js +20 -0
- package/esm/VerticalTab/TabPanel.js +45 -0
- package/esm/VerticalTab/TabTab.js +63 -0
- package/esm/VerticalTab/VerticalTab.js +34 -0
- package/esm/VerticalTab/index.js +9 -0
- package/esm/VerticalTab/subComponent/TabContext.js +3 -0
- package/esm/alert/Alert.js +22 -0
- package/esm/alert/index.js +1 -0
- package/esm/animate/Collapse.js +65 -0
- package/esm/animate/Loader.js +51 -0
- package/esm/animate/NumberCounter.js +45 -0
- package/esm/animate/PulseRing.js +26 -0
- package/esm/animate/Spinner.js +11 -0
- package/esm/animate/index.js +5 -0
- package/esm/assets/css/autocomplete.css +16 -0
- package/esm/assets/css/font.css +4 -0
- package/esm/assets/css/global.css +2 -0
- package/esm/assets/font/helvetica/Helvetica.ttf +0 -0
- package/esm/assets/font/nanumGothic/NanumGothic-Bold.ttf +0 -0
- package/esm/assets/font/nanumGothic/NanumGothic-ExtraBold.ttf +0 -0
- package/esm/assets/font/nanumGothic/NanumGothic-Regular.ttf +0 -0
- package/esm/assets/icons/app-management.png +0 -0
- package/esm/assets/icons/burger-black.png +0 -0
- package/esm/assets/icons/burger-white.png +0 -0
- package/esm/assets/icons/burger.png +0 -0
- package/esm/assets/icons/file.svg +1 -0
- package/esm/assets/icons/map_icon1.png +0 -0
- package/esm/assets/icons/map_icon4.png +0 -0
- package/esm/assets/images/bg-aside.png +0 -0
- package/esm/assets/images/bg-chart-circle.png +0 -0
- package/esm/assets/images/bg-chart-triangle.png +0 -0
- package/esm/assets/images/cashub-logo-only.png +0 -0
- package/esm/assets/images/default-user.jpg +0 -0
- package/esm/assets/images/logo-cashub.png +0 -0
- package/esm/assets/images/map.png +0 -0
- package/esm/assets/images/qrcode.png +0 -0
- package/esm/backdrop/BaseBackdrop.js +11 -0
- package/esm/backdrop/LoadingBackdrop.js +10 -0
- package/esm/backdrop/ModalBackdrop.js +8 -0
- package/esm/backdrop/index.js +3 -0
- package/esm/badge/Badge.js +19 -0
- package/esm/badge/BadgeDot.js +11 -0
- package/esm/badge/BadgeFill.js +42 -0
- package/esm/badge/BadgeFillTriangle.js +138 -0
- package/esm/badge/BadgeWithText.js +24 -0
- package/esm/badge/index.js +5 -0
- package/esm/billing/BarChart.js +45 -0
- package/esm/billing/Grid.js +38 -0
- package/esm/billing/Header2.js +19 -0
- package/esm/billing/Header3.js +31 -0
- package/esm/billing/Paragraph.js +27 -0
- package/esm/billing/ParagraphGroup.js +16 -0
- package/esm/billing/ParagraphText.js +20 -0
- package/esm/billing/Section.js +44 -0
- package/esm/billing/SectionBody.js +11 -0
- package/esm/billing/SectionHeader.js +20 -0
- package/esm/billing/__stories__/BarChart.stories.js_bak +46 -0
- package/esm/billing/__stories__/Grid.stories.js_bak +57 -0
- package/esm/billing/__stories__/Header2.stories.js_bak +62 -0
- package/esm/billing/__stories__/Header3.stories.js_bak +69 -0
- package/esm/billing/__stories__/Paragraph.stories.js_bak +84 -0
- package/esm/billing/__stories__/ParagraphGroup.stories.js_bak +68 -0
- package/esm/billing/__stories__/ParagraphText.stories.js_bak +64 -0
- package/esm/billing/__stories__/Section.stories.js_bak +115 -0
- package/esm/billing/__stories__/SectionBody.stories.js_bak +62 -0
- package/esm/billing/__stories__/SectionHeader.stories.js-bak +68 -0
- package/esm/breadcrumb/Breadcrumb.js +71 -0
- package/esm/breadcrumb/index.js +1 -0
- package/esm/button/Button.js +145 -0
- package/esm/button/ButtonGroup.js +54 -0
- package/esm/button/IconButton.js +64 -0
- package/esm/button/ScrollToTopButton.js +47 -0
- package/esm/button/index.js +4 -0
- package/esm/callout/Callout.js +45 -0
- package/esm/callout/index.js +1 -0
- package/esm/chart/BarChart.js +147 -0
- package/esm/chart/DoughnutChart.js +110 -0
- package/esm/chart/LineChart.js +140 -0
- package/esm/chart/SingleBarChart.js +35 -0
- package/esm/chart/index.js +5 -0
- package/esm/chart/utils/centerTextPlugin.js +56 -0
- package/esm/chart/utils/customTooltip.js +84 -0
- package/esm/chart/utils/customTooltipLifecyclePlugin.js +16 -0
- package/esm/chart/utils/htmlLegendPlugin.js +83 -0
- package/esm/chart/utils/index.js +3 -0
- package/esm/chart/utils/padEmptyChartBar.js +47 -0
- package/esm/chart/utils/tooltipElement.js +17 -0
- package/esm/chart/utils/xAxisLabelTooltipPlugin.js +101 -0
- package/esm/chart/utils/yAxisTopTitlePlugin.js +43 -0
- package/esm/container/FlexContainer.js +33 -0
- package/esm/container/index.js +1 -0
- package/esm/cropper/Cropper.js +47 -0
- package/esm/cropper/CropperModalHandler.js +34 -0
- package/esm/cropper/index.js +2 -0
- package/esm/cropper/subComponent/CropImageModal.js +72 -0
- package/{datetimePicker/DatetimePicker.js → esm/datetimePicker/DatetimePickerV3.js} +63 -31
- package/esm/datetimePicker/TimeInput.js +49 -0
- package/esm/datetimePicker/TimePickerStyle.js +58 -0
- package/esm/datetimePicker/TimePickerV2.js +199 -0
- package/esm/datetimePicker/accordion/Month.js +245 -0
- package/esm/datetimePicker/accordion/Year.js +275 -0
- package/esm/datetimePicker/index.js +4 -0
- package/esm/datetimePicker/provider/constant.js +38 -0
- package/esm/datetimePicker/subComponent/DateTimePickerContext.js +3 -0
- package/esm/datetimePicker/utils/GMTDate.js +9 -0
- package/esm/datetimePicker/utils/pad.js +7 -0
- package/esm/datetimePicker/utils/toUTC0.js +7 -0
- package/esm/descriptionList/DescriptionDetail.js +21 -0
- package/esm/descriptionList/DescriptionList.js +18 -0
- package/esm/descriptionList/DescriptionTerm.js +7 -0
- package/esm/descriptionList/index.js +3 -0
- package/esm/divider/Divider.js +24 -0
- package/esm/divider/index.js +1 -0
- package/esm/dropdown/Dropdown.js +48 -0
- package/esm/dropdown/DropdownButtonOption.js +36 -0
- package/esm/dropdown/DropdownContent.js +83 -0
- package/esm/dropdown/DropdownDivOption.js +19 -0
- package/esm/dropdown/DropdownItem.js +19 -0
- package/esm/dropdown/DropdownLinkOption.js +17 -0
- package/esm/dropdown/DropdownToggle.js +31 -0
- package/esm/dropdown/index.js +11 -0
- package/esm/dropdown/subComponent/DropdownContext.js +3 -0
- package/esm/dropzone/FileDropzone.js +472 -0
- package/esm/dropzone/ImageDropzone.js +327 -0
- package/esm/dropzone/index.js +2 -0
- package/esm/dropzone/subComponent/Message.js +19 -0
- package/esm/figure/IconFigure.js +35 -0
- package/esm/figure/ImageFigure.js +31 -0
- package/esm/figure/index.js +2 -0
- package/esm/file/HiddenFileInput.js +8 -0
- package/esm/file/index.js +1 -0
- package/esm/form/Checkbox.js +157 -0
- package/esm/form/Fieldset.js +11 -0
- package/esm/form/FormItem.js +15 -0
- package/esm/form/Input.js +59 -0
- package/esm/form/Label.js +54 -0
- package/esm/form/MutedText.js +14 -0
- package/esm/form/PasswordInput.js +40 -0
- package/esm/form/RadioButton.js +94 -0
- package/esm/form/SearchSelect.js +174 -0
- package/esm/form/Searchbox.js +91 -0
- package/esm/form/Slider.js +39 -0
- package/esm/form/SwitchButton.js +97 -0
- package/esm/form/Textarea.js +34 -0
- package/esm/form/TreeView.js +66 -0
- package/esm/form/index.js +14 -0
- package/esm/grid/Column.js +39 -0
- package/esm/grid/Grid.js +28 -0
- package/esm/grid/index.js +2 -0
- package/esm/heading/Heading1.js +14 -0
- package/esm/heading/Heading2.js +21 -0
- package/esm/heading/Heading3.js +42 -0
- package/esm/heading/index.js +3 -0
- package/esm/helmet/Helmet.js +17 -0
- package/esm/helmet/index.js +2 -0
- package/esm/iconbox/ApplicationIconBox.js +74 -0
- package/esm/iconbox/IconBox.js +60 -0
- package/esm/iconbox/IconBoxV2.js +63 -0
- package/esm/iconbox/index.js +3 -0
- package/esm/iconbox/subComponent/IconBoxFigure.js +43 -0
- package/esm/iconbox/subComponent/IconBoxImage.js +35 -0
- package/esm/image/ImageFluid.js +10 -0
- package/esm/image/UploadImage.js +243 -0
- package/esm/image/index.js +2 -0
- package/esm/index.js +47 -0
- package/esm/keyframe/Pulse.js +15 -0
- package/esm/keyframe/Spin.js +7 -0
- package/esm/layout/Aside.js +39 -0
- package/esm/layout/AsideHeader.jsx +27 -0
- package/esm/layout/Backdrop.js +16 -0
- package/esm/layout/Container.js +30 -0
- package/esm/layout/Footer.js +36 -0
- package/esm/layout/Header.jsx +55 -0
- package/esm/layout/Layout.jsx +84 -0
- package/esm/layout/Logo.jsx +17 -0
- package/esm/layout/MenuIcon.jsx +27 -0
- package/esm/layout/Sidebar.jsx +271 -0
- package/esm/layout/index.js +1 -0
- package/esm/link/LinkSpan.js +62 -0
- package/esm/link/index.js +1 -0
- package/esm/map/GoogleMap.js +439 -0
- package/esm/map/GoogleReverseGeolocation.js +193 -0
- package/esm/map/LeafletMap.js +224 -0
- package/esm/map/LeafletReverseGeolocation.js +94 -0
- package/esm/map/index.js +4 -0
- package/esm/map/subComponent/BasicLeafletMap.js +27 -0
- package/esm/map/subComponent/GoogleMapContainer.js +22 -0
- package/esm/map/subComponent/GoogleMapPopup.js +103 -0
- package/esm/map/subComponent/GoogleMapWrapper.js +34 -0
- package/esm/map/subComponent/LeafletDrawControl.js +116 -0
- package/esm/map/subComponent/LeafletMapContainer.js +166 -0
- package/esm/map/subComponent/MapSearchBoxControl.js +47 -0
- package/esm/modal/StateModal.js +169 -0
- package/esm/modal/TitleModal.js +241 -0
- package/esm/modal/index.js +2 -0
- package/esm/page/Disclaimer.js +121 -0
- package/esm/page/index.js +1 -0
- package/esm/paginate/Paginate.js +129 -0
- package/esm/paginate/index.js +1 -0
- package/esm/popover/Popover.js +82 -0
- package/esm/popover/index.js +1 -0
- package/esm/qrcode/QRCode.js +51 -0
- package/esm/qrcode/QRCodeContainter.js +27 -0
- package/esm/qrcode/index.js +2 -0
- package/esm/ribbon/Ribbon.js +35 -0
- package/esm/ribbon/index.js +1 -0
- package/esm/section/Section.js +126 -0
- package/esm/section/SectionBody.js +43 -0
- package/esm/section/SectionHeader.js +61 -0
- package/esm/section/SectionToolbar.js +11 -0
- package/esm/section/SectionToolbarItem.js +10 -0
- package/esm/section/index.js +5 -0
- package/esm/select/InputSelect.js +263 -0
- package/esm/select/Select.js +811 -0
- package/esm/select/index.js +2 -0
- package/esm/select/subComponent/Checkbox.js +40 -0
- package/esm/select/subComponent/Footer.js +6 -0
- package/esm/select/subComponent/ListBox.js +23 -0
- package/esm/select/subComponent/Option.js +37 -0
- package/esm/select/subComponent/OptionGroup.js +16 -0
- package/esm/select/subComponent/Options.js +25 -0
- package/esm/select/subComponent/SearchBox.js +51 -0
- package/esm/select/subComponent/SelectedMultipleCount.js +32 -0
- package/esm/select/subComponent/SelectedMultipleTags.js +47 -0
- package/esm/select/subComponent/SelectedMultipleText.js +63 -0
- package/esm/select/subComponent/SelectedSingle.js +10 -0
- package/esm/styles/GlobalStyle.js +328 -0
- package/esm/styles/config/breakpoint.style.js +7 -0
- package/esm/styles/config/header.style.js +4 -0
- package/esm/styles/config/sidebar.style.js +11 -0
- package/esm/styles/index.js +2 -0
- package/esm/styles/mixin/backgroundColor.js +38 -0
- package/esm/styles/mixin/borderColor.js +31 -0
- package/esm/styles/mixin/color.js +31 -0
- package/esm/styles/mixin/colorOnBackground.js +31 -0
- package/esm/styles/mixin/inputPlaceholder.js +24 -0
- package/esm/styles/mixin/media.js +15 -0
- package/esm/styles/mixin/rounded.js +24 -0
- package/esm/styles/mixin/scrollbar.js +26 -0
- package/esm/styles/theme/dark.theme.js +91 -0
- package/esm/styles/theme/light.theme.js +91 -0
- package/esm/styles/theme/white.theme.js +91 -0
- package/esm/styles/themes.js +9 -0
- package/esm/table/GridTable.js +329 -0
- package/esm/table/ImageBox.js +38 -0
- package/esm/table/InfiniteGridTable.js +396 -0
- package/esm/table/PermissionTable.js +57 -0
- package/esm/table/SimpleGridTable.js +136 -0
- package/esm/table/Table.js +559 -0
- package/esm/table/__mock__/columns.js +64 -0
- package/esm/table/__mock__/data.js +530 -0
- package/esm/table/hooks/index.js +2 -0
- package/esm/table/hooks/useCalculateDataRange.js +22 -0
- package/esm/table/hooks/useGenerateSort.js +32 -0
- package/esm/table/index.js +6 -0
- package/esm/table/subComponent/BaseTableHeadCell.js +54 -0
- package/esm/table/subComponent/GridTableFooter.js +17 -0
- package/esm/table/subComponent/GridTableHeadCell.js +13 -0
- package/esm/table/subComponent/Resizer.js +70 -0
- package/esm/table/subComponent/TableFooter.js +24 -0
- package/esm/table/subComponent/TableFooterInfo.js +6 -0
- package/esm/table/subComponent/TableFooterPager.js +26 -0
- package/esm/table/subComponent/TableHeadCell.js +12 -0
- package/esm/table/subComponent/TableSort.js +31 -0
- package/esm/tagify/TagifyStyle.js +54 -0
- package/esm/tagify/Tags.js +49 -0
- package/esm/tagify/index.js +3 -0
- package/esm/tagify/templates/getCreateButtonTemplate.js +12 -0
- package/esm/text/Paragraph.js +79 -0
- package/esm/text/index.js +1 -0
- package/esm/timeline/Timeline.js +132 -0
- package/esm/timeline/index.js +1 -0
- package/esm/toast/CustomToastContainer.js +38 -0
- package/esm/toast/MessageContainer.js +44 -0
- package/esm/toast/index.js +3 -0
- package/esm/toast/show.js +29 -0
- package/esm/toast/style.css +1 -0
- package/esm/tooltip/Tooltip.js +133 -0
- package/esm/tooltip/index.js +1 -0
- package/esm/treeView/TreeViewV2.js +32 -0
- package/esm/treeView/TreeflexStyle.js +43 -0
- package/esm/treeView/index.js +2 -0
- package/esm/wizard/Wizard.js +244 -0
- package/esm/wizard/index.js +1 -0
- package/index.js +0 -12
- package/layout/Sidebar.jsx +1 -1
- package/package.json +5 -4
- package/datetimePicker/DatePicker.js +0 -363
- package/datetimePicker/DatePickerV2.js +0 -407
- package/datetimePicker/DatetimePickerV2.js +0 -395
- package/datetimePicker/TimePicker.js +0 -317
- package/datetimePicker/hooks/index.js +0 -27
- package/datetimePicker/hooks/useChangeNumber.js +0 -42
- package/datetimePicker/hooks/useDecrease.js +0 -38
- package/datetimePicker/hooks/useIncrease.js +0 -38
- package/datetimePicker/subComponent/Accordion.js +0 -373
- package/datetimePicker/subComponent/CustomTimeInput.js +0 -47
- package/jsoneditor/JsonEditor.js +0 -142
- package/jsoneditor/index.js +0 -13
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { useRef, useState, useMemo, useCallback, useEffect } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { useCalculateDataRange, useGenerateSort } from './hooks';
|
|
4
|
+
import scrollbar from '../styles/mixin/scrollbar';
|
|
5
|
+
import TH from './subComponent/GridTableHeadCell';
|
|
6
|
+
import Resizer from './subComponent/Resizer';
|
|
7
|
+
import GridTableFooter from './subComponent/GridTableFooter';
|
|
8
|
+
import TableFooterInfo from './subComponent/TableFooterInfo';
|
|
9
|
+
import TableFooterPager from './subComponent/TableFooterPager';
|
|
10
|
+
import Paginate from '../paginate/Paginate';
|
|
11
|
+
import Select from '../select/Select';
|
|
12
|
+
import Popover from '../popover/Popover';
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
const GridTable = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
columns,
|
|
17
|
+
data,
|
|
18
|
+
currentPage,
|
|
19
|
+
limit,
|
|
20
|
+
total,
|
|
21
|
+
onPageChange,
|
|
22
|
+
onLimitChange,
|
|
23
|
+
sortColumn,
|
|
24
|
+
sortType,
|
|
25
|
+
onSortChange,
|
|
26
|
+
backgroundReverse,
|
|
27
|
+
translation
|
|
28
|
+
} = _ref;
|
|
29
|
+
const wrapperRef = useRef(null);
|
|
30
|
+
const tableRef = useRef(null);
|
|
31
|
+
const {
|
|
32
|
+
start,
|
|
33
|
+
end
|
|
34
|
+
} = useCalculateDataRange(currentPage, limit, total);
|
|
35
|
+
const [tableWidth, setTableWidth] = useState(0);
|
|
36
|
+
const [restWidth, setRestWidth] = useState(0);
|
|
37
|
+
const texts = useMemo(() => {
|
|
38
|
+
const defaultTexts = {
|
|
39
|
+
info: 'Showing _START_ to _END_ of _TOTAL_ entries',
|
|
40
|
+
empty: 'No data available in table'
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
...defaultTexts,
|
|
44
|
+
...translation
|
|
45
|
+
};
|
|
46
|
+
}, [translation]);
|
|
47
|
+
const handleSortChange = useCallback(columnName => {
|
|
48
|
+
if (onSortChange) {
|
|
49
|
+
onSortChange(columnName);
|
|
50
|
+
}
|
|
51
|
+
}, [onSortChange]);
|
|
52
|
+
const handleResize = useCallback(() => {
|
|
53
|
+
setTableWidth(tableRef.current.offsetWidth);
|
|
54
|
+
setRestWidth(previousWidth => {
|
|
55
|
+
const containerWidth = wrapperRef.current.offsetWidth;
|
|
56
|
+
const tableWidth = tableRef.current.offsetWidth - previousWidth;
|
|
57
|
+
if (containerWidth > tableWidth) {
|
|
58
|
+
return containerWidth - tableWidth;
|
|
59
|
+
}
|
|
60
|
+
return 0;
|
|
61
|
+
});
|
|
62
|
+
}, []);
|
|
63
|
+
const handleScroll = useCallback(event => {
|
|
64
|
+
const {
|
|
65
|
+
target
|
|
66
|
+
} = event;
|
|
67
|
+
wrapperRef.current.scrollLeft = target.scrollLeft;
|
|
68
|
+
}, []);
|
|
69
|
+
const showFullValue = useCallback(event => {
|
|
70
|
+
let {
|
|
71
|
+
id
|
|
72
|
+
} = event.target;
|
|
73
|
+
if (!id) {
|
|
74
|
+
({
|
|
75
|
+
id
|
|
76
|
+
} = event.currentTarget);
|
|
77
|
+
event.target.id = id;
|
|
78
|
+
}
|
|
79
|
+
const {
|
|
80
|
+
offsetWidth,
|
|
81
|
+
scrollWidth,
|
|
82
|
+
innerText
|
|
83
|
+
} = event.target;
|
|
84
|
+
if (scrollWidth >= offsetWidth && innerText) {
|
|
85
|
+
event.stopPropagation();
|
|
86
|
+
Popover({
|
|
87
|
+
id,
|
|
88
|
+
target: event.target,
|
|
89
|
+
content: innerText,
|
|
90
|
+
boundary: tableRef.current
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, []);
|
|
94
|
+
|
|
95
|
+
// generate sort icon area
|
|
96
|
+
const generateSort = useGenerateSort(sortColumn, sortType);
|
|
97
|
+
const tableHeads = useMemo(() => {
|
|
98
|
+
const tableHeads = columns.map((column, index) => {
|
|
99
|
+
const {
|
|
100
|
+
title,
|
|
101
|
+
fieldName,
|
|
102
|
+
width,
|
|
103
|
+
sortable,
|
|
104
|
+
align
|
|
105
|
+
} = column;
|
|
106
|
+
return /*#__PURE__*/_jsxs(TH, {
|
|
107
|
+
width: width,
|
|
108
|
+
align: align,
|
|
109
|
+
backgroundReverse: backgroundReverse,
|
|
110
|
+
sortable: sortable,
|
|
111
|
+
onClick: () => {
|
|
112
|
+
sortable && handleSortChange(fieldName);
|
|
113
|
+
},
|
|
114
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
115
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
116
|
+
id: fieldName,
|
|
117
|
+
onClick: showFullValue,
|
|
118
|
+
children: title
|
|
119
|
+
}), sortable && generateSort(fieldName)]
|
|
120
|
+
}), /*#__PURE__*/_jsx(Resizer, {
|
|
121
|
+
onResize: handleResize
|
|
122
|
+
})]
|
|
123
|
+
}, `TH${index}`);
|
|
124
|
+
});
|
|
125
|
+
tableHeads.push(/*#__PURE__*/_jsx(TH, {
|
|
126
|
+
role: "presentation",
|
|
127
|
+
width: restWidth,
|
|
128
|
+
backgroundReverse: backgroundReverse
|
|
129
|
+
}, 'rest'));
|
|
130
|
+
return tableHeads;
|
|
131
|
+
}, [backgroundReverse, columns, handleSortChange, generateSort, showFullValue, handleResize, restWidth]);
|
|
132
|
+
const tableRows = useMemo(() => {
|
|
133
|
+
if (data.length === 0) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
return data.map((row, rowIndex) => {
|
|
137
|
+
const tds = columns.map((column, columnIndex) => {
|
|
138
|
+
const {
|
|
139
|
+
title,
|
|
140
|
+
fieldName,
|
|
141
|
+
render,
|
|
142
|
+
custom,
|
|
143
|
+
...props
|
|
144
|
+
} = column;
|
|
145
|
+
const key = rowIndex + columnIndex.toString();
|
|
146
|
+
let renderedData = null;
|
|
147
|
+
if (custom && render) {
|
|
148
|
+
// call render function to get custom data(fully)
|
|
149
|
+
renderedData = render(row);
|
|
150
|
+
} else {
|
|
151
|
+
// call render function to get custom data(part)
|
|
152
|
+
renderedData = /*#__PURE__*/_jsx("span", {
|
|
153
|
+
id: key,
|
|
154
|
+
onClick: showFullValue,
|
|
155
|
+
children: render ? render(row[fieldName], row) : String(row[fieldName])
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return /*#__PURE__*/_jsx(TD, {
|
|
159
|
+
"data-label": title,
|
|
160
|
+
backgroundReverse: backgroundReverse,
|
|
161
|
+
...props,
|
|
162
|
+
children: renderedData
|
|
163
|
+
}, columnIndex);
|
|
164
|
+
});
|
|
165
|
+
tds.push(/*#__PURE__*/_jsx(TD, {
|
|
166
|
+
role: "presentation",
|
|
167
|
+
backgroundReverse: backgroundReverse
|
|
168
|
+
}, 'rest'));
|
|
169
|
+
return /*#__PURE__*/_jsx("tr", {
|
|
170
|
+
children: tds
|
|
171
|
+
}, rowIndex);
|
|
172
|
+
});
|
|
173
|
+
}, [backgroundReverse, columns, data, showFullValue]);
|
|
174
|
+
const generateEmptyMessage = useCallback(() => {
|
|
175
|
+
return /*#__PURE__*/_jsx("tr", {
|
|
176
|
+
children: /*#__PURE__*/_jsx(TD, {
|
|
177
|
+
center: true,
|
|
178
|
+
colSpan: columns.length,
|
|
179
|
+
backgroundReverse: backgroundReverse,
|
|
180
|
+
children: texts.empty
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
}, [backgroundReverse, columns, texts]);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
handleResize();
|
|
186
|
+
}, [columns, handleResize]);
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
window.addEventListener('resize', handleResize);
|
|
189
|
+
return () => {
|
|
190
|
+
window.removeEventListener('resize', handleResize);
|
|
191
|
+
};
|
|
192
|
+
}, [handleResize]);
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
if (tableRef.current) {
|
|
195
|
+
setTableWidth(tableRef.current.offsetWidth);
|
|
196
|
+
}
|
|
197
|
+
}, [columns]);
|
|
198
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
199
|
+
children: [/*#__PURE__*/_jsx(TableWrapper, {
|
|
200
|
+
ref: wrapperRef,
|
|
201
|
+
backgroundReverse: backgroundReverse,
|
|
202
|
+
children: /*#__PURE__*/_jsxs(ResponsiveTable, {
|
|
203
|
+
ref: tableRef,
|
|
204
|
+
children: [/*#__PURE__*/_jsx("thead", {
|
|
205
|
+
children: /*#__PURE__*/_jsx("tr", {
|
|
206
|
+
children: tableHeads
|
|
207
|
+
})
|
|
208
|
+
}), /*#__PURE__*/_jsx("tbody", {
|
|
209
|
+
children: tableRows || generateEmptyMessage()
|
|
210
|
+
})]
|
|
211
|
+
})
|
|
212
|
+
}), /*#__PURE__*/_jsx(Scrollbar, {
|
|
213
|
+
backgroundReverse: backgroundReverse,
|
|
214
|
+
width: tableWidth,
|
|
215
|
+
onScroll: handleScroll
|
|
216
|
+
}), /*#__PURE__*/_jsxs(GridTableFooter, {
|
|
217
|
+
backgroundReverse: backgroundReverse,
|
|
218
|
+
children: [/*#__PURE__*/_jsx(TableFooterInfo, {
|
|
219
|
+
children: texts.info.replace('_START_', start).replace('_END_', end).replace('_TOTAL_', total)
|
|
220
|
+
}), /*#__PURE__*/_jsxs(TableFooterPager, {
|
|
221
|
+
children: [/*#__PURE__*/_jsx(Paginate, {
|
|
222
|
+
currentPage: currentPage,
|
|
223
|
+
totalCount: total,
|
|
224
|
+
pageSize: limit,
|
|
225
|
+
onPageChange: onPageChange
|
|
226
|
+
}), /*#__PURE__*/_jsx(Select, {
|
|
227
|
+
fill: true,
|
|
228
|
+
fillReverse: !backgroundReverse,
|
|
229
|
+
allowSearch: false,
|
|
230
|
+
options: [{
|
|
231
|
+
id: 10,
|
|
232
|
+
text: '10'
|
|
233
|
+
}, {
|
|
234
|
+
id: 20,
|
|
235
|
+
text: '20'
|
|
236
|
+
}, {
|
|
237
|
+
id: 30,
|
|
238
|
+
text: '30'
|
|
239
|
+
}, {
|
|
240
|
+
id: 40,
|
|
241
|
+
text: '40'
|
|
242
|
+
}, {
|
|
243
|
+
id: 50,
|
|
244
|
+
text: '50'
|
|
245
|
+
}],
|
|
246
|
+
selected: limit,
|
|
247
|
+
onSelect: onLimitChange
|
|
248
|
+
})]
|
|
249
|
+
})]
|
|
250
|
+
})]
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
const TableWrapper = styled.div`
|
|
254
|
+
overflow: hidden;
|
|
255
|
+
background: ${_ref2 => {
|
|
256
|
+
let {
|
|
257
|
+
backgroundReverse
|
|
258
|
+
} = _ref2;
|
|
259
|
+
return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
|
|
260
|
+
}};
|
|
261
|
+
`;
|
|
262
|
+
const ResponsiveTable = styled.table`
|
|
263
|
+
/* make fixed width work */
|
|
264
|
+
width: 0px;
|
|
265
|
+
color: var(--font-on-background);
|
|
266
|
+
table-layout: fixed;
|
|
267
|
+
border-collapse: collapse;
|
|
268
|
+
`;
|
|
269
|
+
const TD = styled.td`
|
|
270
|
+
height: 48px;
|
|
271
|
+
padding: 0 var(--spacing-xs);
|
|
272
|
+
border-top: 1px solid var(--border-color);
|
|
273
|
+
border-right: 1px solid var(--border-color);
|
|
274
|
+
border-bottom: 1px solid var(--border-color);
|
|
275
|
+
text-align: ${_ref3 => {
|
|
276
|
+
let {
|
|
277
|
+
center
|
|
278
|
+
} = _ref3;
|
|
279
|
+
return center ? 'center' : 'left';
|
|
280
|
+
}};
|
|
281
|
+
background: ${_ref4 => {
|
|
282
|
+
let {
|
|
283
|
+
backgroundReverse
|
|
284
|
+
} = _ref4;
|
|
285
|
+
return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
|
|
286
|
+
}};
|
|
287
|
+
|
|
288
|
+
&:last-child {
|
|
289
|
+
border-right: none;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
> span {
|
|
293
|
+
display: inline-block;
|
|
294
|
+
width: 100%;
|
|
295
|
+
padding: 0 2px;
|
|
296
|
+
overflow: hidden;
|
|
297
|
+
white-space: pre;
|
|
298
|
+
text-overflow: ellipsis;
|
|
299
|
+
}
|
|
300
|
+
`;
|
|
301
|
+
const Scrollbar = styled.div`
|
|
302
|
+
position: sticky;
|
|
303
|
+
bottom: 48px;
|
|
304
|
+
width: 100%;
|
|
305
|
+
overflow: auto;
|
|
306
|
+
background: ${_ref5 => {
|
|
307
|
+
let {
|
|
308
|
+
backgroundReverse
|
|
309
|
+
} = _ref5;
|
|
310
|
+
return backgroundReverse ? 'var(--color-background1)' : 'var(--color-background2)';
|
|
311
|
+
}};
|
|
312
|
+
|
|
313
|
+
::before {
|
|
314
|
+
display: block;
|
|
315
|
+
content: '';
|
|
316
|
+
width: ${_ref6 => {
|
|
317
|
+
let {
|
|
318
|
+
width
|
|
319
|
+
} = _ref6;
|
|
320
|
+
return `${width}px`;
|
|
321
|
+
}};
|
|
322
|
+
height: 1px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
${scrollbar({
|
|
326
|
+
size: 'large'
|
|
327
|
+
})}
|
|
328
|
+
`;
|
|
329
|
+
export default GridTable;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import IconFigure from '../figure/IconFigure';
|
|
3
|
+
import ImageFluid from '../image/ImageFluid';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
const ImageBox = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
image,
|
|
8
|
+
text
|
|
9
|
+
} = _ref;
|
|
10
|
+
return /*#__PURE__*/_jsxs(Wrapper, {
|
|
11
|
+
children: [/*#__PURE__*/_jsx(IconFigure, {
|
|
12
|
+
size: "large",
|
|
13
|
+
children: /*#__PURE__*/_jsx(ImageFluid, {
|
|
14
|
+
crossOrigin: "anonymous",
|
|
15
|
+
src: image,
|
|
16
|
+
alt: `${text}'s pic`,
|
|
17
|
+
roundedCircle: true
|
|
18
|
+
})
|
|
19
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
20
|
+
children: text
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const Wrapper = styled.div`
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
|
|
28
|
+
> figure {
|
|
29
|
+
flex: 0 0 auto;
|
|
30
|
+
margin-right: var(--spacing-xs);
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
const Text = styled.span`
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
text-overflow: ellipsis;
|
|
37
|
+
`;
|
|
38
|
+
export default ImageBox;
|