@majoo-ui/react 2.0.1 → 2.1.0-rc.0
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/charts.esm.js +3 -1453
- package/colors/Colors.esm.js +93 -0
- package/components/accordion/Accordion.esm.js +109 -0
- package/components/alertDialog/AlertDialog.esm.js +440 -0
- package/components/avatar/Avatar.esm.js +83 -0
- package/components/badge/Badge.esm.js +255 -0
- package/components/banner/Banner.esm.js +341 -0
- package/components/barChart/BarChart.esm.js +212 -0
- package/components/breadcrumb/Breadcrumb.esm.js +65 -0
- package/components/breadcrumb/index.esm.js +19 -0
- package/components/button/Button.esm.js +331 -0
- package/components/buttonGroup/ButtonGroup.esm.js +350 -0
- package/components/card/Card.esm.js +236 -0
- package/components/chart/assets/data_kosong.png.esm.js +3 -0
- package/components/chart/lineChart/LineChart.esm.js +358 -0
- package/components/chart/lineChart/components/Comparator.esm.js +82 -0
- package/components/chart/lineChart/components/ComparatorController.esm.js +112 -0
- package/components/chart/lineChart/components/ComparatorItem.esm.js +104 -0
- package/components/chart/lineChart/components/ProductList.esm.js +78 -0
- package/components/chart/lineChart/components/TitleLegend.esm.js +107 -0
- package/components/chart/lineChart/components/Tooltip.esm.js +90 -0
- package/components/chart/utils/index.esm.js +109 -0
- package/components/checkboxTable/CheckboxTable.esm.js +287 -0
- package/components/colorPicker/ColorPicker.esm.js +342 -0
- package/components/colorPicker/InputColorPicker.esm.js +120 -0
- package/components/colorPicker/assets/img_colormap.gif.esm.js +3 -0
- package/components/colorPicker/components/ColorFields.esm.js +144 -0
- package/components/colorPicker/components/ColorMap.esm.js +1188 -0
- package/components/contentEditor/ContentEditor.esm.js +251 -0
- package/components/contentEditor/assets/Inline-code-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Link-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/List-bulleted-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/List-numbered-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Redo-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-bold-filled.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-clear-format-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-italic-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-strikethrough-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-underline-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Undo-outline.svg.esm.js +3 -0
- package/components/contextMenu/ContextMenu.esm.js +298 -0
- package/components/datePicker/AdvancedOption.esm.js +37 -0
- package/components/datePicker/CustomDatePicker.esm.js +121 -0
- package/components/datePicker/DatePicker.esm.js +244 -0
- package/components/datePicker/DatePickerMulti.esm.js +70 -0
- package/components/datePicker/InputDatePicker.esm.js +290 -0
- package/components/datePicker/InputDateRangePicker.esm.js +174 -0
- package/components/datePicker/components/Calendar.esm.js +654 -0
- package/components/datePicker/components/CalendarMulti.esm.js +407 -0
- package/components/datePicker/components/CalendarTimePicker.esm.js +104 -0
- package/components/datePicker/components/DateNumber.esm.js +89 -0
- package/components/datePicker/components/MobileCalendar.esm.js +522 -0
- package/components/datePicker/state/reducer.esm.js +286 -0
- package/components/datePicker/timePicker/InputTimePicker.esm.js +205 -0
- package/components/datePicker/timePicker/TimePicker.esm.js +481 -0
- package/components/devicePreview/DevicePreview.esm.js +631 -0
- package/components/devicePreview/deviceFrame/android-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/android-wide-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-email.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-notification.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-sms.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-whatsapp.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/desktop-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/ic-majoo-profpic.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/iphone-transparant.png.esm.js +3 -0
- package/components/dialog/Dialog.esm.js +106 -0
- package/components/drawer/Drawer.esm.js +294 -0
- package/components/dropdownMenu/DropdownMenu.esm.js +281 -0
- package/components/editableTable/EditableMobile.esm.js +361 -0
- package/components/editableTable/EditableTable.esm.js +618 -0
- package/components/editableTable/transition.esm.js +37 -0
- package/components/form/components/FormGroup/FormGroup.esm.js +142 -0
- package/components/form/components/FormHelper/Helper.esm.js +50 -0
- package/components/form/components/FormLabel/Label.esm.js +90 -0
- package/components/form/components/InputAddon/InputAddon.esm.js +105 -0
- package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +60 -0
- package/components/form/components/InputCheckbox/InputCheckbox.esm.js +129 -0
- package/components/form/components/InputCheckbox/icon/CheckOutline.esm.js +33 -0
- package/components/form/components/InputCheckbox/icon/MinusOutline.esm.js +33 -0
- package/components/form/components/InputCombobox/InputCombobox.esm.js +169 -0
- package/components/form/components/InputCounter/InputCounter.esm.js +226 -0
- package/components/form/components/InputCreatable/InputCreatable.esm.js +229 -0
- package/components/form/components/InputDateRange/InputDateRange.esm.js +46 -0
- package/components/form/components/InputElement/InputElement.esm.js +35 -0
- package/components/form/components/InputGroup/InputGroup.esm.js +188 -0
- package/components/form/components/InputLetter/InputLetter.esm.js +68 -0
- package/components/form/components/InputNumber/InputNumber.esm.js +248 -0
- package/components/form/components/InputNumber/NumberFormat.esm.js +1263 -0
- package/components/form/components/InputOTP/InputOTP.esm.js +70 -0
- package/components/form/components/InputRadio/InputRadio.esm.js +273 -0
- package/components/form/components/InputRadio/InputRadioGroup.esm.js +35 -0
- package/components/form/components/InputRadio/context.esm.js +5 -0
- package/components/form/components/InputResourceList/InputResourceList.esm.js +429 -0
- package/components/form/components/InputSearchbox/CloseFilled.esm.js +34 -0
- package/components/form/components/InputSearchbox/InputSearchbox.esm.js +90 -0
- package/components/form/components/InputSearchbox/SearchOutline.esm.js +26 -0
- package/components/form/components/InputSelect/InputSelect.esm.js +964 -0
- package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +1388 -0
- package/components/form/components/InputSelectCheck/OptionGroupItem.esm.js +39 -0
- package/components/form/components/InputSelectCheck/icon/CheckOutline.esm.js +33 -0
- package/components/form/components/InputSelectTag/InputSelectTag.esm.js +62 -0
- package/components/form/components/InputSignature/InputSignature.esm.js +122 -0
- package/components/form/components/InputSignature/SignatureModal.esm.js +67 -0
- package/components/form/components/InputSwitch/InputSwitch.esm.js +96 -0
- package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +136 -0
- package/components/form/components/InputTags/InputTags.esm.js +268 -0
- package/components/form/components/InputText/InputText.esm.js +197 -0
- package/components/form/components/InputTextArea/InputTextArea.esm.js +77 -0
- package/components/heading/Heading.esm.js +64 -0
- package/components/iconButton/IconButton.esm.js +71 -0
- package/components/image/Image.esm.js +141 -0
- package/components/link/Link.esm.js +59 -0
- package/components/loadingBar/LoadingBar.esm.js +113 -0
- package/components/mapPicker/InputMapPicker.esm.js +160 -0
- package/components/mapPicker/MapPicker.esm.js +122 -0
- package/components/mapPicker/MapPicker.styles.esm.js +70 -0
- package/components/mapPicker/assets/images/Mapsicle.png.esm.js +3 -0
- package/components/mapPicker/components/AddressCard.esm.js +25 -0
- package/components/mapPicker/components/ButtonSelect.esm.js +46 -0
- package/components/mapPicker/components/ChangeView.esm.js +20 -0
- package/components/mapPicker/components/InputSearch.esm.js +74 -0
- package/components/mapPicker/components/MarkerIcon.esm.js +22 -0
- package/components/mapPicker/components/MarkerSvg.esm.js +62 -0
- package/components/mapPicker/components/ZoomControls.esm.js +36 -0
- package/components/mapPicker/hooks/useMapSearch.esm.js +161 -0
- package/components/modalDialog/ModalDialog.esm.js +247 -0
- package/components/notificationBadge/NotificationBadge.esm.js +149 -0
- package/components/pageDialog/PageDialog.esm.js +291 -0
- package/components/pageDialog/logo.svg.esm.js +3 -0
- package/components/pagination/Pagination.esm.js +94 -0
- package/components/pagination/PaginationButton.esm.js +346 -0
- package/components/pagination/PaginationInfo.esm.js +146 -0
- package/components/paper/Paper.esm.js +76 -0
- package/components/paragraph/Paragraph.esm.js +52 -0
- package/components/pieChart/PieChart.esm.js +287 -0
- package/components/popover/Popover.esm.js +142 -0
- package/components/progress/Progress.esm.js +170 -0
- package/components/progressIndicator/ProgressIndicator.esm.js +287 -0
- package/components/scrollSync/ScrollSync.esm.js +172 -0
- package/components/scrollSync/ScrollSyncNode.esm.js +87 -0
- package/components/scrollSync/utils.esm.js +9 -0
- package/components/separator/Separator.esm.js +43 -0
- package/components/skeleton/Skeleton.esm.js +131 -0
- package/components/slider/Slider.esm.js +345 -0
- package/components/stepWizard/StepWizard.esm.js +451 -0
- package/components/stepWizard/index.esm.js +14 -0
- package/components/table/MobileTable.esm.js +415 -0
- package/components/table/Table.esm.js +1472 -0
- package/components/table/components/columns/DateColumn.esm.js +26 -0
- package/components/table/components/columns/DecimalColumn.esm.js +36 -0
- package/components/table/components/columns/PriceColumn.esm.js +57 -0
- package/components/table/components/columns/RowDraggableColumn.esm.js +24 -0
- package/components/table/components/columns/RowExpanderColumn.esm.js +32 -0
- package/components/table/components/columns/RowExpanderMultipleColumn.esm.js +24 -0
- package/components/table/components/columns/RowMenuColumn.esm.js +101 -0
- package/components/table/components/columns/RowSelectionCallbackColumn.esm.js +38 -0
- package/components/table/components/columns/RowSelectionColumn.esm.js +34 -0
- package/components/table/images/img-emptydata.webp.esm.js +3 -0
- package/components/table/images/img-emptysearchdata.webp.esm.js +3 -0
- package/components/tableOfContent/TableOfContent.esm.js +267 -0
- package/components/tableOfContent/index.esm.js +18 -0
- package/components/tableOfContent/transition.esm.js +38 -0
- package/components/tabs/Tabs.esm.js +282 -0
- package/components/tag/Tag.esm.js +161 -0
- package/components/tagList/TagList.esm.js +90 -0
- package/components/tagStatus/TagStatus.esm.js +134 -0
- package/components/text/Text.esm.js +140 -0
- package/components/toast/Toast.esm.js +297 -0
- package/components/toast/ToastContainer.esm.js +73 -0
- package/components/toast/context/ToastContext.esm.js +5 -0
- package/components/toast/context/ToastProvider.esm.js +96 -0
- package/components/tooltip/Tooltip.esm.js +175 -0
- package/components/upload/Upload.esm.js +1103 -0
- package/components/upload/utils/canvasPreview.esm.js +39 -0
- package/components/upload/utils/imgPreview.esm.js +21 -0
- package/config/stitches.config.esm.js +216 -0
- package/editor.esm.js +1 -264
- package/hooks/useListOption/useListOption.esm.js +56 -0
- package/hooks/useToggle/useToggle.esm.js +8 -0
- package/index.esm.js +106 -42293
- package/layout/box/Box.esm.js +24 -0
- package/layout/flex/Flex.esm.js +135 -0
- package/layout/grid/Grid.esm.js +270 -0
- package/layout/pageContainer/PageContainer.esm.js +60 -0
- package/majoo-provider/MajooProvider.esm.js +42 -0
- package/majoo-provider/ThemeProvider.esm.js +41 -0
- package/majoo-provider/globalStyles.esm.js +242 -0
- package/majoo-provider/styles/modern-normalize.esm.js +95 -0
- package/map.esm.js +2 -734
- package/package.json +8 -4
- package/utils/calendar.esm.js +26 -0
- package/utils/element.esm.js +21 -0
- package/utils/object.esm.js +12 -0
- package/utils/request.esm.js +74 -0
- package/utils/strings.esm.js +6 -0
- package/{useMediaQuery.esm.js → utils/useMediaQuery.esm.js} +1 -1
- package/utils/useNavigatorOnline.esm.js +19 -0
- package/utils/variant.esm.js +12 -0
- package/wrapper/ConditionalWrapper.esm.js +9 -0
- package/ModalDialog.esm.js +0 -2669
- package/Separator.esm.js +0 -3002
- package/stitches.config.esm.js +0 -2284
- package/{index.esm.css → charts.esm.css} +4 -4
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import 'core-js/modules/es.array.includes.js';
|
|
2
|
+
import 'core-js/modules/es.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/es.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/es.iterator.map.js';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
import React__default, { useCallback } from 'react';
|
|
7
|
+
import { ChevronUpOutline, ChevronDownOutline } from '@majoo-ui/icons';
|
|
8
|
+
import Heading from '../heading/Heading.esm.js';
|
|
9
|
+
import { styled } from '../../config/stitches.config.esm.js';
|
|
10
|
+
import Box from '../../layout/box/Box.esm.js';
|
|
11
|
+
import Flex from '../../layout/flex/Flex.esm.js';
|
|
12
|
+
import { TableContent, TableHead, TableHeaderCellContainer, TableHeadCellContent, TableBody, addOnCellStyle, TableFoot, TableFootRow, TableFootCell } from './Table.esm.js';
|
|
13
|
+
import Text from '../text/Text.esm.js';
|
|
14
|
+
import { ConditionalWrapper } from '../../wrapper/ConditionalWrapper.esm.js';
|
|
15
|
+
import { ContextMenuTrigger } from '../contextMenu/ContextMenu.esm.js';
|
|
16
|
+
import Paragraph from '../paragraph/Paragraph.esm.js';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
18
|
+
|
|
19
|
+
const TableContainer = styled(Flex, {
|
|
20
|
+
position: 'relative',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
width: '100%',
|
|
23
|
+
height: '100%',
|
|
24
|
+
overflowY: 'auto',
|
|
25
|
+
overflowX: 'hidden',
|
|
26
|
+
padding: '0',
|
|
27
|
+
variants: {
|
|
28
|
+
decoration: {
|
|
29
|
+
true: {
|
|
30
|
+
overflow: 'unset'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const TableHeadRow = styled('tr', {
|
|
36
|
+
borderBottom: '1pt solid $bgBorder',
|
|
37
|
+
'& th': {
|
|
38
|
+
paddingLeft: '$spacing-05'
|
|
39
|
+
},
|
|
40
|
+
'& th:first-child': {
|
|
41
|
+
padding: 0
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const TableHeadCell = styled('th', {
|
|
45
|
+
height: '48px'
|
|
46
|
+
});
|
|
47
|
+
const TableRow = styled('tr', {
|
|
48
|
+
borderBottom: '1pt solid $bgBorder',
|
|
49
|
+
'& td': {
|
|
50
|
+
paddingLeft: '$spacing-05'
|
|
51
|
+
},
|
|
52
|
+
'& td:first-child': {
|
|
53
|
+
padding: 0
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const TableCell = styled('td', {
|
|
57
|
+
height: '48px',
|
|
58
|
+
fontSize: '$short-content-regular',
|
|
59
|
+
lineHeight: '$short-content-regular',
|
|
60
|
+
letterSpacing: '$short-content-regular',
|
|
61
|
+
fontWeight: '400',
|
|
62
|
+
color: '$textPrimary'
|
|
63
|
+
});
|
|
64
|
+
const MobileTable = /*#__PURE__*/React__default.forwardRef(({
|
|
65
|
+
instance,
|
|
66
|
+
totalData,
|
|
67
|
+
customEmptyDataProps,
|
|
68
|
+
isInfiniteScroll,
|
|
69
|
+
footer,
|
|
70
|
+
infiniteScrollWrapper,
|
|
71
|
+
isLoading,
|
|
72
|
+
rowGroup,
|
|
73
|
+
hiddenColumns,
|
|
74
|
+
css,
|
|
75
|
+
customRowsStyle,
|
|
76
|
+
cellAlign,
|
|
77
|
+
renderContextMenu,
|
|
78
|
+
handleRowClick,
|
|
79
|
+
additionalExceptionIds,
|
|
80
|
+
hideHeader,
|
|
81
|
+
decoration,
|
|
82
|
+
rowVirtualizer,
|
|
83
|
+
virtualized
|
|
84
|
+
}, ref) => {
|
|
85
|
+
var _a, _b, _c, _d;
|
|
86
|
+
const {
|
|
87
|
+
t
|
|
88
|
+
} = useTranslation('MajooUI/table');
|
|
89
|
+
const {
|
|
90
|
+
getTableProps,
|
|
91
|
+
getTableBodyProps,
|
|
92
|
+
headerGroups,
|
|
93
|
+
visibleColumns,
|
|
94
|
+
page,
|
|
95
|
+
prepareRow,
|
|
96
|
+
state,
|
|
97
|
+
toggleAllRowsExpanded,
|
|
98
|
+
state: {
|
|
99
|
+
sortBy
|
|
100
|
+
}
|
|
101
|
+
} = instance;
|
|
102
|
+
const getAlign = align => {
|
|
103
|
+
switch (align) {
|
|
104
|
+
case 'top':
|
|
105
|
+
return 'start';
|
|
106
|
+
case 'bottom':
|
|
107
|
+
return 'end';
|
|
108
|
+
default:
|
|
109
|
+
return 'center';
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const getIsMobileHeader = useCallback(() => {
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
let isMobileHeader;
|
|
115
|
+
for (let i = 0; i < (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.length); i++) {
|
|
116
|
+
for (let x = 0; x < ((_b = (_a = headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups[i]) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.length); x++) {
|
|
117
|
+
const headerData = (_c = headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups[i]) === null || _c === void 0 ? void 0 : _c.headers[x];
|
|
118
|
+
if (headerData === null || headerData === void 0 ? void 0 : headerData.isMobileHeader) {
|
|
119
|
+
isMobileHeader = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return isMobileHeader;
|
|
124
|
+
}, [headerGroups]);
|
|
125
|
+
let indexDefaultHeader = 0;
|
|
126
|
+
const filterMobileHeader = (column, index) => {
|
|
127
|
+
switch (column.id) {
|
|
128
|
+
case 'selection':
|
|
129
|
+
indexDefaultHeader += 1;
|
|
130
|
+
break;
|
|
131
|
+
case 'expander':
|
|
132
|
+
indexDefaultHeader += 1;
|
|
133
|
+
break;
|
|
134
|
+
case 'multiple-expander':
|
|
135
|
+
indexDefaultHeader += 1;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
return (getIsMobileHeader() ? column.isMobileHeader : index === indexDefaultHeader) || column.id === 'selection';
|
|
139
|
+
};
|
|
140
|
+
const renderTableDecorationChild = child => {
|
|
141
|
+
return jsx(TableContent, {
|
|
142
|
+
children: jsx(TableBody, Object.assign({}, getTableBodyProps(), {
|
|
143
|
+
children: child
|
|
144
|
+
}))
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const getMultipleExpander = () => {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
let isMultipleExpander = false;
|
|
150
|
+
for (let i = 0; i < (page === null || page === void 0 ? void 0 : page.length) && !isMultipleExpander; i++) {
|
|
151
|
+
prepareRow(page[i]);
|
|
152
|
+
for (let j = 0; j < page[i].cells.length; j++) {
|
|
153
|
+
const column = (_b = (_a = page[i]) === null || _a === void 0 ? void 0 : _a.cells[j]) === null || _b === void 0 ? void 0 : _b.column;
|
|
154
|
+
if ((column === null || column === void 0 ? void 0 : column.id) === 'multiple-expander') {
|
|
155
|
+
isMultipleExpander = true;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
isMultipleExpander
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
const {
|
|
165
|
+
virtualItems: virtualRows,
|
|
166
|
+
totalSize
|
|
167
|
+
} = rowVirtualizer;
|
|
168
|
+
const paddingTop = virtualized ? virtualRows.length > 0 ? ((_a = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[0]) === null || _a === void 0 ? void 0 : _a.start) || 0 : 0 : 0;
|
|
169
|
+
const paddingBottom = virtualized ? virtualRows.length > 0 ? totalSize - (((_b = virtualRows === null || virtualRows === void 0 ? void 0 : virtualRows[virtualRows.length - 1]) === null || _b === void 0 ? void 0 : _b.end) || 0) : 0 : 0;
|
|
170
|
+
const tableRowData = virtualized ? isInfiniteScroll ? virtualRows : page : page;
|
|
171
|
+
return jsxs(TableContainer, {
|
|
172
|
+
css: css,
|
|
173
|
+
ref: ref,
|
|
174
|
+
decoration: Boolean(decoration),
|
|
175
|
+
children: [jsx(ConditionalWrapper, {
|
|
176
|
+
condition: !decoration,
|
|
177
|
+
wrapper: child => infiniteScrollWrapper(child),
|
|
178
|
+
children: jsxs(TableContent, Object.assign({}, getTableProps(), {
|
|
179
|
+
children: [jsx(TableHead, {
|
|
180
|
+
hiddenHeader: hideHeader,
|
|
181
|
+
children: headerGroups.map(headerGroup => jsx(TableHeadRow, Object.assign({}, headerGroup.getHeaderGroupProps(), {
|
|
182
|
+
children: headerGroup.headers.filter((column, index) => filterMobileHeader(column, index)).map(column => {
|
|
183
|
+
const headerRender = column.render('Header');
|
|
184
|
+
return jsx(TableHeadCell, Object.assign({}, column.getHeaderProps(!column.unsortable ? column.getSortByToggleProps({
|
|
185
|
+
title: t('sortColumnTitle', 'Urutkan') || 'Urutkan'
|
|
186
|
+
}) : {
|
|
187
|
+
onClick: column.onToggle
|
|
188
|
+
}), {
|
|
189
|
+
children: typeof headerRender === 'string' ? jsx(TableHeaderCellContainer, {
|
|
190
|
+
isMobile: true,
|
|
191
|
+
isSortedDesc: column.isSortedDesc,
|
|
192
|
+
unsortable: column.unsortable,
|
|
193
|
+
isToggleable: !!column.onToggle,
|
|
194
|
+
isToggled: column.isToggled,
|
|
195
|
+
children: jsx(TableHeadCellContent, {
|
|
196
|
+
isMobile: true,
|
|
197
|
+
heading: "headerTable",
|
|
198
|
+
color: "secondary",
|
|
199
|
+
children: headerRender.toUpperCase()
|
|
200
|
+
})
|
|
201
|
+
}) : headerRender
|
|
202
|
+
}));
|
|
203
|
+
})
|
|
204
|
+
})))
|
|
205
|
+
}), jsxs(TableBody, Object.assign({}, getTableBodyProps(), {
|
|
206
|
+
children: [isInfiniteScroll && paddingTop > 0 && jsx("tr", {
|
|
207
|
+
children: jsx("td", {
|
|
208
|
+
style: {
|
|
209
|
+
height: `${paddingTop}px`
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
}), (_c = decoration === null || decoration === void 0 ? void 0 : decoration.headerRender) === null || _c === void 0 ? void 0 : _c.call(decoration), jsx(ConditionalWrapper, {
|
|
213
|
+
condition: Boolean(decoration),
|
|
214
|
+
wrapper: child => jsx(TableRow, {
|
|
215
|
+
css: {
|
|
216
|
+
'&:hover': {
|
|
217
|
+
backgroundColor: 'unset'
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
children: jsx(TableCell, {
|
|
221
|
+
colSpan: (decoration === null || decoration === void 0 ? void 0 : decoration.colSpan) || 12,
|
|
222
|
+
children: jsx(Box, {
|
|
223
|
+
css: Object.assign({
|
|
224
|
+
height: 300,
|
|
225
|
+
overflowY: 'auto'
|
|
226
|
+
}, decoration === null || decoration === void 0 ? void 0 : decoration.css),
|
|
227
|
+
children: infiniteScrollWrapper(renderTableDecorationChild(child))
|
|
228
|
+
})
|
|
229
|
+
})
|
|
230
|
+
}),
|
|
231
|
+
children: tableRowData === null || tableRowData === void 0 ? void 0 : tableRowData.map((dataRow, i) => {
|
|
232
|
+
var _a, _b, _c;
|
|
233
|
+
const row = virtualized && isInfiniteScroll ? page === null || page === void 0 ? void 0 : page[dataRow === null || dataRow === void 0 ? void 0 : dataRow.index] : dataRow;
|
|
234
|
+
prepareRow(row);
|
|
235
|
+
let isContextMenu = Boolean((_a = row.cells.filter(cell => {
|
|
236
|
+
var _a, _b;
|
|
237
|
+
return (_b = (_a = cell.column) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.length;
|
|
238
|
+
})) === null || _a === void 0 ? void 0 : _a.length);
|
|
239
|
+
const actionCells = row.allCells.filter(cell => cell.column.id === 'menu' || cell.column.isAction);
|
|
240
|
+
let customStyle = {};
|
|
241
|
+
let hideRowMenuColumn = false;
|
|
242
|
+
if (customRowsStyle && customRowsStyle(row.values).length) {
|
|
243
|
+
for (let i = 0; i < customRowsStyle(row.values).length; i++) {
|
|
244
|
+
if (customRowsStyle(row.values)[i].predicate) {
|
|
245
|
+
const customRowCss = (_b = customRowsStyle(row.values)[i]) === null || _b === void 0 ? void 0 : _b.css;
|
|
246
|
+
customStyle = customRowCss || {};
|
|
247
|
+
if ((_c = customRowsStyle(row.original)[i]) === null || _c === void 0 ? void 0 : _c.hideRowMenuColumn) {
|
|
248
|
+
isContextMenu = false;
|
|
249
|
+
hideRowMenuColumn = true;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return jsxs(React__default.Fragment, {
|
|
255
|
+
children: [((rowGroup === null || rowGroup === void 0 ? void 0 : rowGroup.showGroupingWhenSorted) || sortBy.length <= 0) && row.original['isTopChild'] && ((rowGroup === null || rowGroup === void 0 ? void 0 : rowGroup.headerRender) ? rowGroup === null || rowGroup === void 0 ? void 0 : rowGroup.headerRender(row, {
|
|
256
|
+
getCellProps: () => ({})
|
|
257
|
+
}) : jsx(Text, {
|
|
258
|
+
variant: "contentButton",
|
|
259
|
+
children: row.cells[0].render('Cell')
|
|
260
|
+
})), jsx(TableRow, Object.assign({
|
|
261
|
+
css: customStyle
|
|
262
|
+
}, row && (row === null || row === void 0 ? void 0 : row.getRowProps) ? row === null || row === void 0 ? void 0 : row.getRowProps() : {}, {
|
|
263
|
+
children: row.cells.filter((cell, indexCell) => (getIsMobileHeader() ? cell.column.isMobileHeader : indexCell === indexDefaultHeader) || cell.column.id === 'selection').map(cell => {
|
|
264
|
+
var _a, _b;
|
|
265
|
+
const collId = (_a = cell === null || cell === void 0 ? void 0 : cell.column) === null || _a === void 0 ? void 0 : _a.id;
|
|
266
|
+
const exceptionId = (_b = ['expander', 'multiple-expander', 'selection', 'menu', 'eye'].concat(additionalExceptionIds)) === null || _b === void 0 ? void 0 : _b.includes(collId);
|
|
267
|
+
const renderCell = () => jsx(ConditionalWrapper, {
|
|
268
|
+
condition: isContextMenu && !exceptionId,
|
|
269
|
+
wrapper: children => jsx(ContextMenuTrigger, {
|
|
270
|
+
id: "context-menu-table",
|
|
271
|
+
triggerSide: "left",
|
|
272
|
+
children: jsx(Box, {
|
|
273
|
+
onClick: () => handleRowClick(row, i),
|
|
274
|
+
css: {
|
|
275
|
+
cursor: 'pointer',
|
|
276
|
+
width: 'calc(100vw - 120px)'
|
|
277
|
+
},
|
|
278
|
+
children: children
|
|
279
|
+
})
|
|
280
|
+
}),
|
|
281
|
+
children: cell.render('Cell')
|
|
282
|
+
});
|
|
283
|
+
return jsx(TableCell, Object.assign({}, cell.getCellProps(addOnCellStyle(cell.column.id)), {
|
|
284
|
+
children: cell.column.accessor ? jsxs(Flex, {
|
|
285
|
+
justify: "between",
|
|
286
|
+
align: "center",
|
|
287
|
+
css: {
|
|
288
|
+
cursor: 'pointer',
|
|
289
|
+
height: '100%'
|
|
290
|
+
},
|
|
291
|
+
children: [jsx(Flex, {
|
|
292
|
+
align: "center",
|
|
293
|
+
css: {
|
|
294
|
+
flex: 1,
|
|
295
|
+
height: '100%'
|
|
296
|
+
},
|
|
297
|
+
onClick: () => {
|
|
298
|
+
if (!exceptionId) {
|
|
299
|
+
handleRowClick(row, i);
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
children: jsx(Paragraph, {
|
|
303
|
+
css: {
|
|
304
|
+
overflowX: 'hidden',
|
|
305
|
+
textOverflow: 'ellipsis',
|
|
306
|
+
'@sm': {
|
|
307
|
+
maxWidth: 250
|
|
308
|
+
},
|
|
309
|
+
'@md': {
|
|
310
|
+
maxWidth: 'unset'
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
children: renderCell()
|
|
314
|
+
})
|
|
315
|
+
}), (() => {
|
|
316
|
+
var _a;
|
|
317
|
+
const expandable = ((_a = row.cells.filter((cell, indexCell) => (getIsMobileHeader() ? !cell.column.isMobileHeader : indexCell !== indexDefaultHeader) && cell.column.accessor)) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
318
|
+
return expandable && jsx(Box, {
|
|
319
|
+
onClick: () => {
|
|
320
|
+
if (!Object.keys(state.expanded).includes(row.id) && !getMultipleExpander().isMultipleExpander) {
|
|
321
|
+
toggleAllRowsExpanded(false);
|
|
322
|
+
}
|
|
323
|
+
row.toggleRowExpanded(!row.isExpanded);
|
|
324
|
+
},
|
|
325
|
+
children: row.isExpanded ? jsx(ChevronUpOutline, {}) : jsx(ChevronDownOutline, {})
|
|
326
|
+
});
|
|
327
|
+
})()]
|
|
328
|
+
}) : renderCell()
|
|
329
|
+
}));
|
|
330
|
+
})
|
|
331
|
+
})), ((rowGroup === null || rowGroup === void 0 ? void 0 : rowGroup.showGroupingWhenSorted) || sortBy.length <= 0) && row.original['isBottomChild'] && !!(rowGroup === null || rowGroup === void 0 ? void 0 : rowGroup.footerRender) && (rowGroup === null || rowGroup === void 0 ? void 0 : rowGroup.footerRender(row, {
|
|
332
|
+
getCellProps: () => ({})
|
|
333
|
+
})), row.isExpanded ? jsx(TableRow, {
|
|
334
|
+
children: jsxs(TableCell, {
|
|
335
|
+
colSpan: visibleColumns.length,
|
|
336
|
+
children: [jsx(Flex, {
|
|
337
|
+
direction: "column",
|
|
338
|
+
children: row.cells.filter((cell, indexCell) => (getIsMobileHeader() ? !cell.column.isMobileHeader : indexCell !== indexDefaultHeader) && cell.column.accessor).map(cell => {
|
|
339
|
+
var _a;
|
|
340
|
+
return jsxs(Flex, {
|
|
341
|
+
align: "center",
|
|
342
|
+
justify: "between",
|
|
343
|
+
gap: 5,
|
|
344
|
+
css: {
|
|
345
|
+
backgroundColor: '$bgGray',
|
|
346
|
+
padding: `$spacing-04 $spacing-05 ${'selection' in row.values ? '$spacing-04 $spacing-07' : ''}`,
|
|
347
|
+
borderBottom: '1pt solid $bgBorder',
|
|
348
|
+
alignItems: cell.column.accessor ? getAlign(cellAlign) : 'center'
|
|
349
|
+
},
|
|
350
|
+
children: [jsx(Heading, {
|
|
351
|
+
css: {
|
|
352
|
+
padding: '3px 0px'
|
|
353
|
+
},
|
|
354
|
+
heading: "headerTable",
|
|
355
|
+
color: "secondary",
|
|
356
|
+
children: typeof cell.column.Header === 'string' ? (_a = cell.column.Header) === null || _a === void 0 ? void 0 : _a.toUpperCase() : cell.render('Header')
|
|
357
|
+
}), jsx(Paragraph, {
|
|
358
|
+
css: {
|
|
359
|
+
overflowWrap: 'break-word',
|
|
360
|
+
'@sm': {
|
|
361
|
+
maxWidth: 200
|
|
362
|
+
},
|
|
363
|
+
'@md': {
|
|
364
|
+
maxWidth: 'unset'
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
children: cell.render('Cell')
|
|
368
|
+
})]
|
|
369
|
+
}, `${cell.column.id}-${row.id}`);
|
|
370
|
+
})
|
|
371
|
+
}), actionCells && !hideRowMenuColumn && actionCells.length > 0 && jsx(Flex, {
|
|
372
|
+
align: "center",
|
|
373
|
+
justify: "end",
|
|
374
|
+
gap: 3,
|
|
375
|
+
css: {
|
|
376
|
+
height: '40px',
|
|
377
|
+
backgroundColor: '$bgGray',
|
|
378
|
+
paddingRight: '$spacing-04'
|
|
379
|
+
},
|
|
380
|
+
children: actionCells.map(cell => cell.render('Cell'))
|
|
381
|
+
})]
|
|
382
|
+
})
|
|
383
|
+
}) : null]
|
|
384
|
+
}, row.id);
|
|
385
|
+
})
|
|
386
|
+
}), (_d = decoration === null || decoration === void 0 ? void 0 : decoration.footerRender) === null || _d === void 0 ? void 0 : _d.call(decoration), isInfiniteScroll && paddingBottom > 0 && jsx("tr", {
|
|
387
|
+
children: jsx("td", {
|
|
388
|
+
style: {
|
|
389
|
+
height: `${paddingBottom}px`
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
})]
|
|
393
|
+
})), !isInfiniteScroll && jsx(TableFoot, {
|
|
394
|
+
children: jsx(TableFootRow, {
|
|
395
|
+
children: jsx(TableFootCell, {
|
|
396
|
+
colSpan: 100,
|
|
397
|
+
children: totalData > 0 || isLoading ? footer : jsxs(Flex, {
|
|
398
|
+
align: "center",
|
|
399
|
+
justify: "center",
|
|
400
|
+
direction: "column",
|
|
401
|
+
gap: 1,
|
|
402
|
+
css: {
|
|
403
|
+
margin: '32px auto 100px'
|
|
404
|
+
},
|
|
405
|
+
children: [customEmptyDataProps.doodleImage, customEmptyDataProps.title, customEmptyDataProps.description]
|
|
406
|
+
})
|
|
407
|
+
})
|
|
408
|
+
})
|
|
409
|
+
})]
|
|
410
|
+
}))
|
|
411
|
+
}), renderContextMenu === null || renderContextMenu === void 0 ? void 0 : renderContextMenu()]
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
export { MobileTable as default };
|