@terraware/web-components 4.2.12 → 4.2.14-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/components/AntSwitch/index.js +8 -14
- package/components/Autocomplete/Autocomplete.js +67 -70
- package/components/Badge/index.js +16 -20
- package/components/BusySpinner/index.js +30 -35
- package/components/Button/Button.js +23 -27
- package/components/Button/button.test.js +8 -10
- package/components/Checkbox.js +10 -19
- package/components/Confirm/index.js +44 -51
- package/components/DatePicker/DatePicker.js +116 -117
- package/components/DialogBox/DialogBox.js +76 -66
- package/components/Divisor.js +15 -20
- package/components/Dropdown.js +54 -61
- package/components/EditableTable/index.js +129 -135
- package/components/ErrorBox/ErrorBox.js +37 -36
- package/components/FileChooser/index.js +73 -77
- package/components/FormBottomBar/index.js +63 -69
- package/components/Icon/Icon.js +14 -21
- package/components/Icon/icons/index.d.ts +1 -1
- package/components/Icon/icons/index.d.ts.map +1 -1
- package/components/Icon/icons/index.js +251 -255
- package/components/IconTooltip/index.js +29 -34
- package/components/Map/MapBox.js +199 -220
- package/components/Map/MapContainer.js +14 -18
- package/components/Map/MapDateSliderControl.js +44 -46
- package/components/Map/MapDrawer.js +32 -33
- package/components/Map/MapLegend.js +96 -95
- package/components/Map/MapViewStyleControl.js +38 -48
- package/components/Map/ReactMapboxWrapper.js +2 -9
- package/components/Map/index.js +47 -55
- package/components/Map/types.js +2 -8
- package/components/Map/useMaintainLayerOrder.js +4 -11
- package/components/Markdown/index.js +14 -21
- package/components/Message/Message.js +59 -51
- package/components/MultiSelect/MultiSelect.test.js +22 -24
- package/components/MultiSelect/index.js +73 -69
- package/components/Navbar/NavFooter.js +8 -13
- package/components/Navbar/NavItem.js +43 -37
- package/components/Navbar/NavSection.js +13 -17
- package/components/Navbar/Navbar.js +35 -38
- package/components/Navbar/SubNavbar.js +8 -13
- package/components/Note.js +14 -19
- package/components/OverlayModal/OverlayModal.js +36 -37
- package/components/PageForm/index.js +30 -35
- package/components/PhotoChooser/index.js +93 -98
- package/components/Pill/index.js +29 -31
- package/components/PillList/index.js +16 -22
- package/components/PlacementWrapper/index.js +20 -25
- package/components/PopoverMenu/Popover.js +33 -37
- package/components/PopoverMenu/index.js +41 -46
- package/components/PopoverMultiSelect/index.js +18 -21
- package/components/ProgressCircle/ProgressCircle.js +23 -26
- package/components/RadioButton.js +7 -14
- package/components/Select/Select.js +8 -13
- package/components/Select/SelectT.js +110 -108
- package/components/Separator/index.js +8 -14
- package/components/Size.js +1 -5
- package/components/Slider/index.js +7 -13
- package/components/SummaryBox.js +36 -39
- package/components/Tabs/index.js +75 -77
- package/components/TextTruncated/index.js +64 -65
- package/components/Textfield/Textfield.js +100 -95
- package/components/Textfield/TruncatedTextArea.js +44 -46
- package/components/TimelineSlider/TimelineMarker.js +24 -28
- package/components/TimelineSlider/TimelineRail.js +5 -11
- package/components/TimelineSlider/index.js +47 -51
- package/components/Tooltip/Tooltip.js +21 -26
- package/components/ViewPhotosDialog/index.js +58 -62
- package/components/VirtualWalkthrough/Annotation.d.ts +41 -0
- package/components/VirtualWalkthrough/Annotation.d.ts.map +1 -0
- package/components/VirtualWalkthrough/Annotation.js +197 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.d.ts +20 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AnnotationEditPane.js +136 -0
- package/components/VirtualWalkthrough/AnnotationPanel.d.ts +13 -0
- package/components/VirtualWalkthrough/AnnotationPanel.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AnnotationPanel.js +196 -0
- package/components/VirtualWalkthrough/Application.d.ts +9 -0
- package/components/VirtualWalkthrough/Application.d.ts.map +1 -0
- package/components/VirtualWalkthrough/Application.js +32 -0
- package/components/VirtualWalkthrough/AutoRotator.d.ts +109 -0
- package/components/VirtualWalkthrough/AutoRotator.d.ts.map +1 -0
- package/components/VirtualWalkthrough/AutoRotator.js +217 -0
- package/components/VirtualWalkthrough/BlockingSpinner.d.ts +3 -0
- package/components/VirtualWalkthrough/BlockingSpinner.d.ts.map +1 -0
- package/components/VirtualWalkthrough/BlockingSpinner.js +27 -0
- package/components/VirtualWalkthrough/BoundaryRing.d.ts +9 -0
- package/components/VirtualWalkthrough/BoundaryRing.d.ts.map +1 -0
- package/components/VirtualWalkthrough/BoundaryRing.js +33 -0
- package/components/VirtualWalkthrough/CameraInfo.d.ts +16 -0
- package/components/VirtualWalkthrough/CameraInfo.d.ts.map +1 -0
- package/components/VirtualWalkthrough/CameraInfo.js +88 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.d.ts +37 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/ControlsInfoPane.js +196 -0
- package/components/VirtualWalkthrough/GradientSky.d.ts +9 -0
- package/components/VirtualWalkthrough/GradientSky.d.ts.map +1 -0
- package/components/VirtualWalkthrough/GradientSky.js +73 -0
- package/components/VirtualWalkthrough/SplatControls.d.ts +50 -0
- package/components/VirtualWalkthrough/SplatControls.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatControls.js +252 -0
- package/components/VirtualWalkthrough/SplatCrop.d.ts +8 -0
- package/components/VirtualWalkthrough/SplatCrop.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatCrop.js +18 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.d.ts +8 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatFadeCrop.js +18 -0
- package/components/VirtualWalkthrough/SplatModel.d.ts +15 -0
- package/components/VirtualWalkthrough/SplatModel.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatModel.js +60 -0
- package/components/VirtualWalkthrough/SplatRevealRain.d.ts +18 -0
- package/components/VirtualWalkthrough/SplatRevealRain.d.ts.map +1 -0
- package/components/VirtualWalkthrough/SplatRevealRain.js +38 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.d.ts +110 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.d.ts.map +1 -0
- package/components/VirtualWalkthrough/TfAnnotationManager.js +368 -0
- package/components/VirtualWalkthrough/TfXrNavigation.d.ts +15 -0
- package/components/VirtualWalkthrough/TfXrNavigation.d.ts.map +1 -0
- package/components/VirtualWalkthrough/TfXrNavigation.js +24 -0
- package/components/VirtualWalkthrough/annotation-styles.css +5 -0
- package/components/VirtualWalkthrough/application-styles.css +4 -0
- package/components/VirtualWalkthrough/boundary-ring.d.ts +47 -0
- package/components/VirtualWalkthrough/boundary-ring.d.ts.map +1 -0
- package/components/VirtualWalkthrough/boundary-ring.js +125 -0
- package/components/VirtualWalkthrough/boundary-ring.test.js +109 -0
- package/components/VirtualWalkthrough/groundPlane.d.ts +14 -0
- package/components/VirtualWalkthrough/groundPlane.d.ts.map +1 -0
- package/components/VirtualWalkthrough/groundPlane.js +47 -0
- package/components/VirtualWalkthrough/groundPlane.test.js +45 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts +19 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.d.ts.map +1 -0
- package/components/VirtualWalkthrough/gsplat-fade-crop-effect.js +119 -0
- package/components/VirtualWalkthrough/walkthrough-camera.d.ts +77 -0
- package/components/VirtualWalkthrough/walkthrough-camera.d.ts.map +1 -0
- package/components/VirtualWalkthrough/walkthrough-camera.js +320 -0
- package/components/svg/BlobbyGrayIconImage.js +36 -41
- package/components/svg/BlobbyGrayIconImport.js +36 -41
- package/components/svg/BlobbyGrayIconUploadToTheCloud.js +36 -41
- package/components/svg/BlobbyIconCloudChecked.js +161 -158
- package/components/svg/BlobbyIconExportOrUploadPhoto.js +161 -158
- package/components/svg/BlobbyIconFolder.js +161 -158
- package/components/svg/BlobbyIconGraphReport.js +161 -158
- package/components/svg/BlobbyIconHappy.js +161 -158
- package/components/svg/BlobbyIconHeartMonitor.js +161 -158
- package/components/svg/BlobbyIconLeaf.js +161 -158
- package/components/svg/BlobbyIconLibrary.js +161 -158
- package/components/svg/BlobbyIconNursery.js +163 -160
- package/components/svg/BlobbyIconOrganization.js +161 -158
- package/components/svg/BlobbyIconParchment.js +161 -158
- package/components/svg/BlobbyIconPeople.js +161 -158
- package/components/svg/BlobbyIconSeedBank.js +161 -158
- package/components/svg/BlobbyIconSeedling.js +161 -158
- package/components/svg/BlobbyIconSeeds.js +161 -158
- package/components/svg/BlobbyIconSite.js +164 -161
- package/components/svg/BlobbyIconSparkles.js +161 -158
- package/components/svg/BlobbyIconWrench.js +161 -158
- package/components/svg/Bug.js +18 -27
- package/components/svg/Calendar.js +18 -27
- package/components/svg/CaretDown.js +18 -27
- package/components/svg/CaretLeft.js +18 -27
- package/components/svg/CaretRight.js +18 -27
- package/components/svg/CaretUp.js +18 -27
- package/components/svg/ChevronDown.js +18 -27
- package/components/svg/ChevronUp.js +18 -27
- package/components/svg/Close.js +18 -27
- package/components/svg/Critical.js +18 -27
- package/components/svg/Edit.js +161 -158
- package/components/svg/Error.js +18 -27
- package/components/svg/Filter.js +18 -27
- package/components/svg/Folder.js +18 -27
- package/components/svg/Help.js +18 -27
- package/components/svg/Home.js +18 -27
- package/components/svg/IconAdd.js +18 -27
- package/components/svg/IconArrowRight.js +19 -28
- package/components/svg/IconBusinessNetwork.js +18 -27
- package/components/svg/IconCalendar.d.ts +1 -1
- package/components/svg/IconCalendar.d.ts.map +1 -1
- package/components/svg/IconCalendar.js +18 -27
- package/components/svg/IconCancel.js +18 -27
- package/components/svg/IconChargingBattery.js +18 -27
- package/components/svg/IconChecklist.js +19 -28
- package/components/svg/IconCheckmark.js +18 -27
- package/components/svg/IconCoinInHand.js +18 -27
- package/components/svg/IconColumns.js +18 -27
- package/components/svg/IconComment.js +18 -27
- package/components/svg/IconDashboard.js +18 -27
- package/components/svg/IconDataMigration.js +18 -27
- package/components/svg/IconDocument.d.ts +8 -0
- package/components/svg/IconDocument.d.ts.map +1 -0
- package/components/svg/IconDocument.js +21 -0
- package/components/svg/IconDownloadFromTheCloud.js +19 -28
- package/components/svg/IconEdit.js +19 -28
- package/components/svg/IconExpand.js +19 -28
- package/components/svg/IconExport.js +18 -27
- package/components/svg/IconExternalLink.js +18 -27
- package/components/svg/IconEye.js +18 -27
- package/components/svg/IconEyeOff.js +18 -27
- package/components/svg/IconFile.js +18 -27
- package/components/svg/IconFolder.js +18 -27
- package/components/svg/IconFullScreen.js +18 -27
- package/components/svg/IconFutures.js +18 -27
- package/components/svg/IconGraphReport.js +18 -27
- package/components/svg/IconHeartMonitor.js +18 -27
- package/components/svg/IconHelp.js +19 -28
- package/components/svg/IconHistory.js +18 -27
- package/components/svg/IconImport.js +18 -27
- package/components/svg/IconIndex.js +18 -27
- package/components/svg/IconLayers.js +18 -27
- package/components/svg/IconLibrary.js +18 -27
- package/components/svg/IconList.js +18 -27
- package/components/svg/IconLivePlant.js +18 -27
- package/components/svg/IconLocations.js +18 -27
- package/components/svg/IconMail.js +18 -27
- package/components/svg/IconManager.js +18 -27
- package/components/svg/IconMarker.js +18 -27
- package/components/svg/IconMenu.js +18 -27
- package/components/svg/IconMenuHorizontal.js +18 -27
- package/components/svg/IconModule.js +18 -27
- package/components/svg/IconMyLocation.js +18 -27
- package/components/svg/IconNote.js +19 -28
- package/components/svg/IconNursery.js +18 -27
- package/components/svg/IconOrg.js +18 -27
- package/components/svg/IconParchment.js +18 -27
- package/components/svg/IconPhoto.js +18 -27
- package/components/svg/IconPlantsFilled.js +18 -27
- package/components/svg/IconRedo.js +18 -27
- package/components/svg/IconRestorationSite.js +18 -27
- package/components/svg/IconSeedBank.js +18 -27
- package/components/svg/IconSeedling.js +18 -27
- package/components/svg/IconSettings.js +18 -27
- package/components/svg/IconSlice.js +18 -27
- package/components/svg/IconSubmit.js +18 -27
- package/components/svg/IconSubtract.js +19 -28
- package/components/svg/IconSynced.js +18 -27
- package/components/svg/IconTrashCan.js +18 -27
- package/components/svg/IconTreasureMap.js +18 -27
- package/components/svg/IconUnavailable.js +18 -27
- package/components/svg/IconUndo.js +18 -27
- package/components/svg/IconVariable.js +18 -27
- package/components/svg/IconVideo.js +19 -28
- package/components/svg/IconWifi.js +18 -27
- package/components/svg/Info.js +18 -27
- package/components/svg/Key.js +18 -27
- package/components/svg/Leaf.js +18 -27
- package/components/svg/Lock.js +18 -27
- package/components/svg/Logo.js +40 -45
- package/components/svg/MenuVertical.js +18 -27
- package/components/svg/Notification.js +18 -27
- package/components/svg/Person.js +18 -27
- package/components/svg/Plus.js +18 -27
- package/components/svg/RestorationSite.js +18 -27
- package/components/svg/Search.js +18 -27
- package/components/svg/Seeds.js +18 -27
- package/components/svg/Site.js +18 -27
- package/components/svg/Sparkles.js +18 -27
- package/components/svg/Species.js +18 -27
- package/components/svg/Species2.js +161 -158
- package/components/svg/Spinner.js +27 -36
- package/components/svg/Star.js +18 -27
- package/components/svg/Success.js +18 -27
- package/components/svg/SuccessFilled.js +18 -27
- package/components/svg/TerrawareLogoDesktop.js +44 -49
- package/components/svg/TerrawareLogoMobile.js +20 -29
- package/components/svg/Touchscreen.js +18 -27
- package/components/svg/UploadCloud.js +161 -158
- package/components/svg/Warning.js +18 -27
- package/components/svg/WelcomeClipboard.js +130 -135
- package/components/svg/index.d.ts +1 -0
- package/components/svg/index.d.ts.map +1 -1
- package/components/svg/index.js +127 -888
- package/components/table/EnhancedTableToolbar.js +45 -47
- package/components/table/EnhancedTableToolbarV2.js +18 -26
- package/components/table/TableCellRenderer.js +137 -143
- package/components/table/TableHeader.js +45 -47
- package/components/table/TableHeaderItem.js +65 -64
- package/components/table/density.js +3 -11
- package/components/table/index.js +225 -218
- package/components/table/sort.js +8 -18
- package/components/table/sort.test.js +6 -8
- package/components/table/types.js +1 -5
- package/components/types/index.js +1 -5
- package/hooks/useBoolean.d.ts +4 -0
- package/hooks/useBoolean.d.ts.map +1 -0
- package/hooks/useBoolean.js +12 -0
- package/hooks/useCameraPosition.d.ts +8 -0
- package/hooks/useCameraPosition.d.ts.map +1 -0
- package/hooks/useCameraPosition.js +33 -0
- package/index.js +57 -398
- package/license-report.html +1 -1
- package/package.json +10 -3
- package/style-dictionary-dist/TerrawareTheme.js +1 -7
- package/theme.js +7 -14
- package/utils/color.d.ts +2 -0
- package/utils/color.d.ts.map +1 -0
- package/utils/color.js +14 -0
- package/utils/date.js +13 -24
- package/utils/date.test.js +40 -43
- package/utils/index.js +5 -53
- package/utils/preventDefaultEvent.js +1 -7
- package/utils/text.js +2 -9
- package/utils/text.test.js +9 -11
- package/utils/useDeviceInfo.js +10 -16
- package/virtualWalkthrough.d.ts +31 -0
- package/virtualWalkthrough.d.ts.map +1 -0
- package/virtualWalkthrough.js +28 -0
|
@@ -1,82 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { DndContext, KeyboardSensor, MouseSensor, TouchSensor, useSensor, useSensors } from '@dnd-kit/core';
|
|
3
|
+
import { sortableKeyboardCoordinates } from '@dnd-kit/sortable';
|
|
4
|
+
import { Box, Checkbox, Pagination, Table, TableBody, TableCell, TableContainer, TableRow, Typography, useTheme } from '@mui/material';
|
|
5
|
+
import { useDeviceInfo } from '../../utils';
|
|
6
|
+
import { CheckboxStyle } from '../Checkbox';
|
|
7
|
+
import EnhancedTableToolbarV2 from './EnhancedTableToolbarV2';
|
|
8
|
+
import TableCellRenderer from './TableCellRenderer';
|
|
9
|
+
import TableHeader from './TableHeader';
|
|
10
|
+
import { getTableCellPaddingY, getTableRowHeight } from './density';
|
|
11
|
+
import { descendingComparator, getComparator, stableSort } from './sort';
|
|
2
12
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = EnhancedTable;
|
|
9
|
-
exports.isTopBarButton = void 0;
|
|
10
|
-
exports.tableSort = tableSort;
|
|
11
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
12
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var _core = require("@dnd-kit/core");
|
|
14
|
-
var _sortable = require("@dnd-kit/sortable");
|
|
15
|
-
var _material = require("@mui/material");
|
|
16
|
-
var _utils = require("../../utils");
|
|
17
|
-
var _Checkbox = require("../Checkbox");
|
|
18
|
-
var _EnhancedTableToolbarV = _interopRequireDefault(require("./EnhancedTableToolbarV2"));
|
|
19
|
-
var _TableCellRenderer = _interopRequireDefault(require("./TableCellRenderer"));
|
|
20
|
-
var _TableHeader = _interopRequireDefault(require("./TableHeader"));
|
|
21
|
-
var _density = require("./density");
|
|
22
|
-
var _sort = require("./sort");
|
|
23
13
|
// Only the text related props need to be passed in by the implementer, and extra data is passed to the caller
|
|
24
|
-
|
|
25
|
-
const isTopBarButton = input => {
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
|
+
export const isTopBarButton = input => {
|
|
26
16
|
const castInput = input;
|
|
27
17
|
return !!(castInput.buttonType && castInput.onButtonClick);
|
|
28
18
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
const [
|
|
71
|
-
const [orderBy, setOrderBy] = _react.default.useState(_orderBy);
|
|
72
|
-
const [internalPage, setInternalPage] = (0, _react.useState)(1);
|
|
19
|
+
export default function EnhancedTable({
|
|
20
|
+
id,
|
|
21
|
+
columns,
|
|
22
|
+
rows,
|
|
23
|
+
order: _order = 'asc',
|
|
24
|
+
orderBy: _orderBy,
|
|
25
|
+
Renderer = TableCellRenderer,
|
|
26
|
+
onSelect,
|
|
27
|
+
onPageChange,
|
|
28
|
+
maxItemsPerPage = 100,
|
|
29
|
+
totalRowCount,
|
|
30
|
+
currentPage,
|
|
31
|
+
DetailsRenderer,
|
|
32
|
+
sortComparator = descendingComparator,
|
|
33
|
+
sortHandler,
|
|
34
|
+
isInactive,
|
|
35
|
+
isPresorted,
|
|
36
|
+
onReorderEnd,
|
|
37
|
+
isClickable,
|
|
38
|
+
emptyTableMessage,
|
|
39
|
+
showCheckbox,
|
|
40
|
+
showTopBar,
|
|
41
|
+
topBarButtons,
|
|
42
|
+
selectedRows,
|
|
43
|
+
setSelectedRows,
|
|
44
|
+
controlledOnSelect,
|
|
45
|
+
reloadData,
|
|
46
|
+
stickyHeader = true,
|
|
47
|
+
hideHeader,
|
|
48
|
+
booleanFalseText,
|
|
49
|
+
booleanTrueText,
|
|
50
|
+
editText,
|
|
51
|
+
renderNumSelectedText,
|
|
52
|
+
renderPaginationText,
|
|
53
|
+
enhancedTopBarSelectionConfig,
|
|
54
|
+
density = 'comfortable',
|
|
55
|
+
tableComments
|
|
56
|
+
}) {
|
|
57
|
+
const theme = useTheme();
|
|
58
|
+
const [order, setOrder] = React.useState(_order);
|
|
59
|
+
const [orderBy, setOrderBy] = React.useState(_orderBy);
|
|
60
|
+
const [internalPage, setInternalPage] = useState(1);
|
|
73
61
|
const {
|
|
74
62
|
isMobile
|
|
75
|
-
} =
|
|
76
|
-
const [displayColumnKeyNames, setDisplayColumnKeyNames] =
|
|
77
|
-
const [displayColumnsIndexed, setDisplayColumnsIndexed] =
|
|
78
|
-
const [displayColumnDetails, setDisplayColumnDetails] =
|
|
79
|
-
|
|
63
|
+
} = useDeviceInfo();
|
|
64
|
+
const [displayColumnKeyNames, setDisplayColumnKeyNames] = useState();
|
|
65
|
+
const [displayColumnsIndexed, setDisplayColumnsIndexed] = useState();
|
|
66
|
+
const [displayColumnDetails, setDisplayColumnDetails] = useState();
|
|
67
|
+
useEffect(() => {
|
|
80
68
|
const columnsKeyNames = columns.map(col => col.key);
|
|
81
69
|
const columnsIndexed = columns.reduce((acum, value) => {
|
|
82
70
|
acum[value.key] = value;
|
|
@@ -85,13 +73,15 @@ function EnhancedTable(_ref) {
|
|
|
85
73
|
setDisplayColumnKeyNames(columnsKeyNames);
|
|
86
74
|
setDisplayColumnsIndexed(columnsIndexed);
|
|
87
75
|
}, [columns]);
|
|
88
|
-
|
|
76
|
+
useEffect(() => {
|
|
89
77
|
if (displayColumnKeyNames && displayColumnsIndexed) {
|
|
90
|
-
const columnsDetails = displayColumnKeyNames.map(key => (
|
|
78
|
+
const columnsDetails = displayColumnKeyNames.map(key => ({
|
|
79
|
+
...displayColumnsIndexed[key]
|
|
80
|
+
}));
|
|
91
81
|
setDisplayColumnDetails(columnsDetails);
|
|
92
82
|
}
|
|
93
83
|
}, [displayColumnKeyNames, displayColumnsIndexed]);
|
|
94
|
-
|
|
84
|
+
useEffect(() => {
|
|
95
85
|
if (setSelectedRows && rows.length >= 0) {
|
|
96
86
|
setSelectedRows(currentlySelectedRows => {
|
|
97
87
|
const emptyArray = [];
|
|
@@ -102,13 +92,13 @@ function EnhancedTable(_ref) {
|
|
|
102
92
|
});
|
|
103
93
|
}
|
|
104
94
|
}, [rows, setSelectedRows]);
|
|
105
|
-
const handleChangePage =
|
|
106
|
-
onPageChange
|
|
95
|
+
const handleChangePage = useCallback((event, newPage) => {
|
|
96
|
+
onPageChange?.(newPage);
|
|
107
97
|
if (currentPage === undefined) {
|
|
108
98
|
setInternalPage(newPage);
|
|
109
99
|
}
|
|
110
100
|
}, [onPageChange, currentPage]);
|
|
111
|
-
|
|
101
|
+
useEffect(() => {
|
|
112
102
|
// this is not most elegant but we want to do this if table was sorted by some column in a presorted table
|
|
113
103
|
// but we don't know when the data changes, hence this useEffect on the data size
|
|
114
104
|
if (isPresorted && onPageChange === undefined) {
|
|
@@ -156,31 +146,30 @@ function EnhancedTable(_ref) {
|
|
|
156
146
|
setSelectedRows(newSelected);
|
|
157
147
|
}
|
|
158
148
|
};
|
|
159
|
-
const columnsToHeadCells =
|
|
149
|
+
const columnsToHeadCells = useCallback(columnsR => {
|
|
160
150
|
return columnsR.map(c => ({
|
|
161
151
|
id: c.key,
|
|
162
152
|
disablePadding: true,
|
|
163
153
|
label: typeof c.name === 'string' ? c.name.toUpperCase() : c.name,
|
|
164
154
|
sx: [{
|
|
165
|
-
paddingY:
|
|
155
|
+
paddingY: getTableCellPaddingY(density)
|
|
166
156
|
}, ...(Array.isArray(c.sx) ? c.sx : [c.sx])],
|
|
167
157
|
tooltipTitle: c.tooltipTitle
|
|
168
158
|
}));
|
|
169
159
|
}, [density]);
|
|
170
|
-
const [headCells, setHeadCells] =
|
|
171
|
-
|
|
160
|
+
const [headCells, setHeadCells] = React.useState();
|
|
161
|
+
React.useEffect(() => {
|
|
172
162
|
if (displayColumnDetails) {
|
|
173
163
|
setHeadCells(columnsToHeadCells(displayColumnDetails));
|
|
174
164
|
}
|
|
175
165
|
}, [columnsToHeadCells, displayColumnDetails]);
|
|
176
|
-
const sensors =
|
|
177
|
-
coordinateGetter:
|
|
166
|
+
const sensors = useSensors(useSensor(MouseSensor), useSensor(TouchSensor), useSensor(KeyboardSensor, {
|
|
167
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
178
168
|
}));
|
|
179
|
-
const onReorderEndHandler =
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
} = _ref2;
|
|
169
|
+
const onReorderEndHandler = useCallback(({
|
|
170
|
+
oldIndex,
|
|
171
|
+
newIndex
|
|
172
|
+
}) => {
|
|
184
173
|
if (displayColumnKeyNames) {
|
|
185
174
|
if (newIndex !== 0 && oldIndex !== 0) {
|
|
186
175
|
const newOrder = [...displayColumnKeyNames];
|
|
@@ -209,11 +198,11 @@ function EnhancedTable(_ref) {
|
|
|
209
198
|
}
|
|
210
199
|
}
|
|
211
200
|
};
|
|
212
|
-
const pageNumber =
|
|
213
|
-
const sortedPageRows =
|
|
201
|
+
const pageNumber = useMemo(() => currentPage ?? internalPage, [currentPage, internalPage]);
|
|
202
|
+
const sortedPageRows = useMemo(() => {
|
|
214
203
|
if (rows) {
|
|
215
204
|
const itemsToSkip = onPageChange ? 0 : maxItemsPerPage * (pageNumber - 1);
|
|
216
|
-
return (isPresorted ? rows :
|
|
205
|
+
return (isPresorted ? rows : stableSort(rows, getComparator(order, orderBy, sortComparator))).slice(itemsToSkip, itemsToSkip + maxItemsPerPage);
|
|
217
206
|
} else {
|
|
218
207
|
return [];
|
|
219
208
|
}
|
|
@@ -224,145 +213,163 @@ function EnhancedTable(_ref) {
|
|
|
224
213
|
* If the table is empty (rows.length === 0) override calculation and show '0 of 0'
|
|
225
214
|
* Pagination total is overridden by totalRowCount if provided.
|
|
226
215
|
*/
|
|
227
|
-
const paginationTotal =
|
|
228
|
-
const pagesCount =
|
|
229
|
-
const minRowNumber =
|
|
216
|
+
const paginationTotal = useMemo(() => totalRowCount || rows.length, [rows.length, totalRowCount]);
|
|
217
|
+
const pagesCount = useMemo(() => Math.ceil(paginationTotal / maxItemsPerPage), [maxItemsPerPage, paginationTotal]);
|
|
218
|
+
const minRowNumber = useMemo(() => {
|
|
230
219
|
if (!sortedPageRows.length) {
|
|
231
220
|
return 0;
|
|
232
221
|
}
|
|
233
222
|
return (pageNumber - 1) * maxItemsPerPage + 1;
|
|
234
223
|
}, [pageNumber, maxItemsPerPage, sortedPageRows.length]);
|
|
235
|
-
const maxRowNumber =
|
|
224
|
+
const maxRowNumber = useMemo(() => {
|
|
236
225
|
if (!sortedPageRows.length) {
|
|
237
226
|
return 0;
|
|
238
227
|
}
|
|
239
228
|
return Math.min(pageNumber * maxItemsPerPage, paginationTotal);
|
|
240
229
|
}, [pageNumber, maxItemsPerPage, paginationTotal, sortedPageRows.length]);
|
|
241
|
-
return /*#__PURE__*/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
230
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
231
|
+
children: [showTopBar && /*#__PURE__*/_jsx(EnhancedTableToolbarV2, {
|
|
232
|
+
selectedRowsCount: selectedRows?.length || 0,
|
|
233
|
+
pagesCount: pagesCount,
|
|
234
|
+
renderNumSelectedText: renderNumSelectedText,
|
|
235
|
+
rowsCount: rows.length,
|
|
236
|
+
topBarButtons: topBarButtons,
|
|
237
|
+
topBarSelectionConfig: enhancedTopBarSelectionConfig ? {
|
|
238
|
+
...enhancedTopBarSelectionConfig,
|
|
239
|
+
handleSelectAll: () => setSelectedRows && setSelectedRows(rows),
|
|
240
|
+
handleSelectNone: () => setSelectedRows && setSelectedRows([])
|
|
241
|
+
} : undefined
|
|
242
|
+
}), /*#__PURE__*/_jsx(TableContainer, {
|
|
243
|
+
id: id,
|
|
244
|
+
children: /*#__PURE__*/_jsx(DndContext, {
|
|
245
|
+
sensors: sensors,
|
|
246
|
+
onDragEnd: handleDragEnd,
|
|
247
|
+
children: /*#__PURE__*/_jsxs(Table, {
|
|
248
|
+
stickyHeader: stickyHeader,
|
|
249
|
+
"aria-labelledby": "tableTitle",
|
|
250
|
+
size: "medium",
|
|
251
|
+
"aria-label": "enhanced table",
|
|
252
|
+
sx: {
|
|
253
|
+
borderCollapse: 'initial'
|
|
254
|
+
},
|
|
255
|
+
children: [!hideHeader && /*#__PURE__*/_jsx(TableHeader, {
|
|
256
|
+
order: order,
|
|
257
|
+
orderBy: orderBy,
|
|
258
|
+
onRequestSort: handleRequestSort,
|
|
259
|
+
columns: displayColumnDetails ?? [],
|
|
260
|
+
onReorderEnd: onReorderEndHandler,
|
|
261
|
+
numSelected: showCheckbox ? selectedRows?.length : undefined,
|
|
262
|
+
onSelectAllClick: showCheckbox ? handleSelectAllClick : undefined,
|
|
263
|
+
rowCount: showCheckbox ? sortedPageRows?.length : undefined,
|
|
264
|
+
density: density
|
|
265
|
+
}), /*#__PURE__*/_jsxs(TableBody, {
|
|
266
|
+
children: [sortedPageRows.length < 1 && emptyTableMessage && /*#__PURE__*/_jsx(TableRow, {
|
|
267
|
+
children: /*#__PURE__*/_jsx(TableCell, {
|
|
268
|
+
colSpan: columns.length + 1,
|
|
269
|
+
align: "center",
|
|
270
|
+
children: /*#__PURE__*/_jsx("p", {
|
|
271
|
+
children: emptyTableMessage
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
}), sortedPageRows && sortedPageRows.map((row, index) => {
|
|
275
|
+
const onClick = onSelect && !controlledOnSelect ? () => onSelect(row) : undefined;
|
|
276
|
+
const isItemSelected = isSelected(row);
|
|
277
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
278
|
+
children: [/*#__PURE__*/_jsxs(TableRow, {
|
|
279
|
+
id: `row${index + 1}`,
|
|
280
|
+
hover: true,
|
|
281
|
+
onClick: e => {
|
|
282
|
+
e.stopPropagation();
|
|
283
|
+
if (onClick && !hasEditColumn && (isClickable ? isClickable(row) : true)) {
|
|
284
|
+
onClick();
|
|
285
|
+
}
|
|
286
|
+
if (!onClick && !hasEditColumn && (isClickable ? isClickable(row) : true)) {
|
|
287
|
+
handleClick(e, row);
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
selected: isItemSelected,
|
|
291
|
+
"aria-checked": isItemSelected,
|
|
292
|
+
sx: {
|
|
293
|
+
...(isInactive && isInactive(row) ? {
|
|
294
|
+
backgroundColor: theme.palette.neutral[50]
|
|
295
|
+
} : {}),
|
|
296
|
+
height: getTableRowHeight(density),
|
|
297
|
+
'&.MuiTableRow-root.Mui-selected': {
|
|
298
|
+
backgroundColor: theme.palette.TwClrBgSelectedTertiary
|
|
299
|
+
},
|
|
300
|
+
'&:nth-of-type(odd)': {
|
|
301
|
+
backgroundColor: theme.palette.TwClrBgSecondary
|
|
302
|
+
},
|
|
303
|
+
'&:hover': {
|
|
304
|
+
backgroundColor: theme.palette.TwClrBgSecondaryHover
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
children: [showCheckbox && /*#__PURE__*/_jsx(TableCell, {
|
|
308
|
+
padding: "checkbox",
|
|
309
|
+
sx: {
|
|
310
|
+
'&.MuiTableCell-root': {
|
|
311
|
+
borderBottom: `1px solid ${theme.palette.TwClrBgSecondary}`
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
315
|
+
disableRipple: true,
|
|
316
|
+
sx: CheckboxStyle(theme),
|
|
317
|
+
color: "primary",
|
|
318
|
+
checked: isItemSelected,
|
|
319
|
+
onClick: e => !isClickable || !isClickable(row) ? handleClick(e, row) : null
|
|
320
|
+
})
|
|
321
|
+
}), displayColumnDetails && displayColumnDetails.map(c => /*#__PURE__*/_jsx(Renderer, {
|
|
322
|
+
index: index + 1,
|
|
323
|
+
row: row,
|
|
324
|
+
column: c,
|
|
325
|
+
value: row[c.key],
|
|
326
|
+
onRowClick: onSelect && controlledOnSelect ? newValue => onSelect(row, c.key, newValue) : onClick,
|
|
327
|
+
reloadData: reloadData,
|
|
328
|
+
booleanFalseText: booleanFalseText,
|
|
329
|
+
booleanTrueText: booleanTrueText,
|
|
330
|
+
editText: editText,
|
|
331
|
+
sx: {
|
|
332
|
+
paddingY: getTableCellPaddingY(density)
|
|
333
|
+
}
|
|
334
|
+
}, c.key))]
|
|
335
|
+
}), DetailsRenderer && /*#__PURE__*/_jsx(DetailsRenderer, {
|
|
336
|
+
index: index,
|
|
337
|
+
row: row
|
|
338
|
+
})]
|
|
339
|
+
}, index);
|
|
340
|
+
})]
|
|
341
|
+
})]
|
|
342
|
+
})
|
|
309
343
|
})
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
paddingY: (0, _density.getTableCellPaddingY)(density)
|
|
336
|
-
}
|
|
337
|
-
}))), DetailsRenderer && /*#__PURE__*/_react.default.createElement(DetailsRenderer, {
|
|
338
|
-
index: index,
|
|
339
|
-
row: row
|
|
340
|
-
}));
|
|
341
|
-
}))))), tableComments && /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
342
|
-
fontWeight: 400,
|
|
343
|
-
fontSize: "14px",
|
|
344
|
-
color: theme.palette.TwClrTxtSecondary,
|
|
345
|
-
marginTop: 2
|
|
346
|
-
}, tableComments), renderPaginationText && /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
347
|
-
display: "flex",
|
|
348
|
-
alignItems: "center",
|
|
349
|
-
justifyContent: "flex-end",
|
|
350
|
-
paddingTop: "24px"
|
|
351
|
-
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
352
|
-
paddingRight: "24px",
|
|
353
|
-
fontSize: "14px"
|
|
354
|
-
}, renderPaginationText(minRowNumber, maxRowNumber, paginationTotal)), /*#__PURE__*/_react.default.createElement(_material.Pagination, {
|
|
355
|
-
count: pagesCount,
|
|
356
|
-
page: pageNumber,
|
|
357
|
-
shape: "rounded",
|
|
358
|
-
onChange: handleChangePage,
|
|
359
|
-
siblingCount: isMobile ? 0 : 1,
|
|
360
|
-
size: 'small'
|
|
361
|
-
})));
|
|
344
|
+
}), tableComments && /*#__PURE__*/_jsx(Typography, {
|
|
345
|
+
fontWeight: 400,
|
|
346
|
+
fontSize: "14px",
|
|
347
|
+
color: theme.palette.TwClrTxtSecondary,
|
|
348
|
+
marginTop: 2,
|
|
349
|
+
children: tableComments
|
|
350
|
+
}), renderPaginationText && /*#__PURE__*/_jsxs(Box, {
|
|
351
|
+
display: "flex",
|
|
352
|
+
alignItems: "center",
|
|
353
|
+
justifyContent: "flex-end",
|
|
354
|
+
paddingTop: "24px",
|
|
355
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
356
|
+
paddingRight: "24px",
|
|
357
|
+
fontSize: "14px",
|
|
358
|
+
children: renderPaginationText(minRowNumber, maxRowNumber, paginationTotal)
|
|
359
|
+
}), /*#__PURE__*/_jsx(Pagination, {
|
|
360
|
+
count: pagesCount,
|
|
361
|
+
page: pageNumber,
|
|
362
|
+
shape: "rounded",
|
|
363
|
+
onChange: handleChangePage,
|
|
364
|
+
siblingCount: isMobile ? 0 : 1,
|
|
365
|
+
size: 'small'
|
|
366
|
+
})]
|
|
367
|
+
})]
|
|
368
|
+
});
|
|
362
369
|
}
|
|
363
|
-
function tableSort(ignore, array, comparator) {
|
|
370
|
+
export function tableSort(ignore, array, comparator) {
|
|
364
371
|
if (ignore) {
|
|
365
372
|
return array;
|
|
366
373
|
}
|
|
367
|
-
return
|
|
374
|
+
return stableSort(array, comparator);
|
|
368
375
|
}
|
package/components/table/sort.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.descendingComparator = descendingComparator;
|
|
7
|
-
exports.getComparator = getComparator;
|
|
8
|
-
exports.stableSort = stableSort;
|
|
9
|
-
function descendingComparator(a, b, orderBy, order) {
|
|
10
|
-
var _b$orderBy, _a$orderBy;
|
|
1
|
+
export function descendingComparator(a, b, orderBy, order) {
|
|
11
2
|
// first attempt to parse into a numeric value and compare
|
|
12
3
|
const numCompare = descendingNumComparator(a, b, orderBy);
|
|
13
4
|
if (numCompare !== null) {
|
|
@@ -19,8 +10,8 @@ function descendingComparator(a, b, orderBy, order) {
|
|
|
19
10
|
}
|
|
20
11
|
|
|
21
12
|
// if non-numeric, compare using the javascript built-in compare for this type
|
|
22
|
-
const bValue =
|
|
23
|
-
const aValue =
|
|
13
|
+
const bValue = b[orderBy] ?? '';
|
|
14
|
+
const aValue = a[orderBy] ?? '';
|
|
24
15
|
|
|
25
16
|
// blank values at the end always (any order)
|
|
26
17
|
if (isEmptyValue(aValue.toString()) && isEmptyValue(bValue.toString())) {
|
|
@@ -41,25 +32,24 @@ function descendingComparator(a, b, orderBy, order) {
|
|
|
41
32
|
return 0;
|
|
42
33
|
}
|
|
43
34
|
function isEmptyValue(value) {
|
|
44
|
-
if (value === '' || value === null ||
|
|
35
|
+
if (value === '' || value === null || value?.toString().trim() === '' || value === undefined) {
|
|
45
36
|
return true;
|
|
46
37
|
} else {
|
|
47
38
|
return false;
|
|
48
39
|
}
|
|
49
40
|
}
|
|
50
41
|
function descendingNumComparator(a, b, orderBy) {
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
const bNumValue = Number((_b$orderBy2 = b[orderBy]) !== null && _b$orderBy2 !== void 0 ? _b$orderBy2 : '0.0');
|
|
42
|
+
const aNumValue = Number(a[orderBy] ?? '0.0');
|
|
43
|
+
const bNumValue = Number(b[orderBy] ?? '0.0');
|
|
54
44
|
if (!isNaN(aNumValue) && !isNaN(bNumValue)) {
|
|
55
45
|
return bNumValue - aNumValue;
|
|
56
46
|
}
|
|
57
47
|
return null;
|
|
58
48
|
}
|
|
59
|
-
function getComparator(order, orderBy, sorting) {
|
|
49
|
+
export function getComparator(order, orderBy, sorting) {
|
|
60
50
|
return (a, b) => sorting(a, b, orderBy, order);
|
|
61
51
|
}
|
|
62
|
-
function stableSort(array, comparator) {
|
|
52
|
+
export function stableSort(array, comparator) {
|
|
63
53
|
const stabilizedThis = array.map((el, index) => [el, index]);
|
|
64
54
|
stabilizedThis.sort((a, b) => {
|
|
65
55
|
const order = comparator(a[0], b[0]);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _sort = require("./sort");
|
|
1
|
+
import { descendingComparator } from './sort';
|
|
4
2
|
const rowA = {
|
|
5
3
|
string1: 'foo',
|
|
6
4
|
string2: 'same',
|
|
@@ -16,22 +14,22 @@ const rowB = {
|
|
|
16
14
|
number3: '1.1'
|
|
17
15
|
};
|
|
18
16
|
test('compare unequal string fields', () => {
|
|
19
|
-
const cmp =
|
|
17
|
+
const cmp = descendingComparator(rowA, rowB, 'string1', 'desc');
|
|
20
18
|
expect(cmp).toEqual(-1);
|
|
21
19
|
});
|
|
22
20
|
test('compare equal string fields', () => {
|
|
23
|
-
const cmp =
|
|
21
|
+
const cmp = descendingComparator(rowA, rowB, 'string2', 'desc');
|
|
24
22
|
expect(cmp).toEqual(0);
|
|
25
23
|
});
|
|
26
24
|
test('compare unequal number fields with same whole number digits', () => {
|
|
27
|
-
const cmp =
|
|
25
|
+
const cmp = descendingComparator(rowA, rowB, 'number1', 'desc');
|
|
28
26
|
expect(Math.sign(cmp)).toEqual(-1);
|
|
29
27
|
});
|
|
30
28
|
test('compare unequal number fields with differing whole number digits', () => {
|
|
31
|
-
const cmp =
|
|
29
|
+
const cmp = descendingComparator(rowA, rowB, 'number2', 'desc');
|
|
32
30
|
expect(Math.sign(cmp)).toEqual(1);
|
|
33
31
|
});
|
|
34
32
|
test('compare equal number fields', () => {
|
|
35
|
-
const cmp =
|
|
33
|
+
const cmp = descendingComparator(rowA, rowB, 'number3', 'desc');
|
|
36
34
|
expect(Math.sign(cmp)).toEqual(0);
|
|
37
35
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBoolean.d.ts","sourceRoot":"","sources":["../../src/hooks/useBoolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAyB,MAAM,OAAO,CAAC;AAExE,QAAA,MAAM,UAAU,GAAI,cAAc,OAAO,KAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,IAAI,EAAE,MAAM,IAAI,CAY9G,CAAC;AAEF,eAAe,UAAU,CAAC"}
|