@terraware/web-components 3.5.12-rc.7 → 3.5.12
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 +27 -0
- package/components/AntSwitch/styles.scss +66 -0
- package/components/Autocomplete/Autocomplete.js +131 -0
- package/components/Autocomplete/styles.scss +155 -0
- package/components/Badge/index.js +32 -0
- package/components/BusySpinner/index.js +49 -0
- package/components/Button/Button.js +51 -0
- package/components/Button/button.test.js +25 -0
- package/components/Button/styles.scss +453 -0
- package/components/Checkbox.js +70 -0
- package/components/Confirm/index.js +94 -0
- package/components/DatePicker/DatePicker.js +150 -0
- package/components/DatePicker/styles.scss +95 -0
- package/components/DialogBox/DialogBox.js +91 -0
- package/components/DialogBox/styles.scss +165 -0
- package/components/Divisor.js +21 -0
- package/components/Dropdown.js +102 -0
- package/components/ErrorBox/ErrorBox.js +47 -0
- package/components/ErrorBox/styles.scss +63 -0
- package/components/FileChooser/index.js +137 -0
- package/components/FormBottomBar/index.js +90 -0
- package/components/Icon/Icon.js +25 -0
- package/components/Icon/icons/index.js +241 -0
- package/components/Icon/styles.scss +41 -0
- package/components/IconTooltip/index.js +61 -0
- package/components/Map/MapBox.d.ts.map +1 -1
- package/components/Map/MapBox.js +479 -0
- package/components/Map/MapContainer.js +30 -0
- package/components/Map/MapDateSliderControl.js +66 -0
- package/components/Map/MapDrawer.js +45 -0
- package/components/Map/MapLegend.js +172 -0
- package/components/Map/MapViewStyleControl.js +74 -0
- package/components/Map/ReactMapboxWrapper.d.ts +3 -0
- package/components/Map/ReactMapboxWrapper.d.ts.map +1 -0
- package/components/Map/ReactMapboxWrapper.js +9 -0
- package/components/Map/index.js +190 -0
- package/components/Map/styles.scss +130 -0
- package/components/Map/types.js +24 -0
- package/components/Map/useMaintainLayerOrder.js +32 -0
- package/components/Message/Message.js +67 -0
- package/components/Message/styles.scss +202 -0
- package/components/MultiSelect/MultiSelect.test.js +75 -0
- package/components/MultiSelect/index.js +120 -0
- package/components/MultiSelect/styles.scss +180 -0
- package/components/Navbar/NavFooter.js +17 -0
- package/components/Navbar/NavItem.js +73 -0
- package/components/Navbar/NavSection.js +22 -0
- package/components/Navbar/Navbar.js +46 -0
- package/components/Navbar/SubNavbar.js +17 -0
- package/components/Navbar/styles.scss +155 -0
- package/components/Note.js +25 -0
- package/components/PageForm/index.js +43 -0
- package/components/PhotoChooser/index.js +137 -0
- package/components/Pill/index.js +46 -0
- package/components/Pill/styles.scss +50 -0
- package/components/PillList/index.js +29 -0
- package/components/PillList/styles.scss +12 -0
- package/components/PlacementWrapper/index.js +63 -0
- package/components/PopoverMenu/Popover.js +88 -0
- package/components/PopoverMenu/index.js +59 -0
- package/components/PopoverMultiSelect/index.js +62 -0
- package/components/PopoverMultiSelect/styles.scss +10 -0
- package/components/ProgressCircle/ProgressCircle.js +34 -0
- package/components/ProgressCircle/styles.scss +87 -0
- package/components/RadioButton.js +25 -0
- package/components/Select/Select.js +19 -0
- package/components/Select/SelectT.js +245 -0
- package/components/Select/styles.scss +307 -0
- package/components/Separator/index.js +21 -0
- package/components/Size.js +5 -0
- package/components/Slider/index.js +60 -0
- package/components/SummaryBox.js +73 -0
- package/components/Tabs/index.js +111 -0
- package/components/TextTruncated/index.js +146 -0
- package/components/Textfield/Textfield.js +172 -0
- package/components/Textfield/TruncatedTextArea.js +71 -0
- package/components/Textfield/styles.scss +271 -0
- package/components/Tooltip/Tooltip.js +54 -0
- package/components/ViewPhotosDialog/index.js +136 -0
- package/components/ViewPhotosDialog/styles.scss +18 -0
- package/components/svg/BlobbyGrayIconImage.js +39 -0
- package/components/svg/BlobbyGrayIconImport.js +39 -0
- package/components/svg/BlobbyGrayIconUploadToTheCloud.js +39 -0
- package/components/svg/BlobbyIconCloudChecked.js +156 -0
- package/components/svg/BlobbyIconExportOrUploadPhoto.js +156 -0
- package/components/svg/BlobbyIconFolder.js +156 -0
- package/components/svg/BlobbyIconGraphReport.js +156 -0
- package/components/svg/BlobbyIconHappy.js +156 -0
- package/components/svg/BlobbyIconHeartMonitor.js +156 -0
- package/components/svg/BlobbyIconLeaf.js +156 -0
- package/components/svg/BlobbyIconLibrary.js +156 -0
- package/components/svg/BlobbyIconNursery.js +158 -0
- package/components/svg/BlobbyIconOrganization.js +156 -0
- package/components/svg/BlobbyIconParchment.js +156 -0
- package/components/svg/BlobbyIconPeople.js +156 -0
- package/components/svg/BlobbyIconSeedBank.js +156 -0
- package/components/svg/BlobbyIconSeedling.js +156 -0
- package/components/svg/BlobbyIconSeeds.js +156 -0
- package/components/svg/BlobbyIconSite.js +159 -0
- package/components/svg/BlobbyIconSparkles.js +156 -0
- package/components/svg/BlobbyIconWrench.js +156 -0
- package/components/svg/Bug.js +25 -0
- package/components/svg/Calendar.js +25 -0
- package/components/svg/CaretDown.js +25 -0
- package/components/svg/CaretLeft.js +25 -0
- package/components/svg/CaretRight.js +25 -0
- package/components/svg/CaretUp.js +25 -0
- package/components/svg/ChevronDown.js +25 -0
- package/components/svg/ChevronUp.js +25 -0
- package/components/svg/Close.js +25 -0
- package/components/svg/Critical.js +25 -0
- package/components/svg/Edit.js +156 -0
- package/components/svg/Error.js +25 -0
- package/components/svg/Filter.js +25 -0
- package/components/svg/Folder.js +25 -0
- package/components/svg/Help.js +25 -0
- package/components/svg/Home.js +25 -0
- package/components/svg/IconAdd.js +25 -0
- package/components/svg/IconArrowRight.js +27 -0
- package/components/svg/IconBusinessNetwork.js +25 -0
- package/components/svg/IconCancel.js +25 -0
- package/components/svg/IconChargingBattery.js +25 -0
- package/components/svg/IconCheckmark.js +25 -0
- package/components/svg/IconCoinInHand.js +25 -0
- package/components/svg/IconColumns.js +25 -0
- package/components/svg/IconComment.js +26 -0
- package/components/svg/IconDashboard.js +25 -0
- package/components/svg/IconDataMigration.js +25 -0
- package/components/svg/IconEdit.js +27 -0
- package/components/svg/IconExport.js +25 -0
- package/components/svg/IconExternalLink.js +25 -0
- package/components/svg/IconEye.js +25 -0
- package/components/svg/IconEyeOff.js +25 -0
- package/components/svg/IconFile.js +25 -0
- package/components/svg/IconFolder.js +25 -0
- package/components/svg/IconFullScreen.js +26 -0
- package/components/svg/IconFutures.js +25 -0
- package/components/svg/IconGraphReport.js +25 -0
- package/components/svg/IconHeartMonitor.js +25 -0
- package/components/svg/IconHelp.js +27 -0
- package/components/svg/IconHistory.js +25 -0
- package/components/svg/IconImport.js +25 -0
- package/components/svg/IconIndex.js +25 -0
- package/components/svg/IconLayers.js +25 -0
- package/components/svg/IconLibrary.js +26 -0
- package/components/svg/IconList.js +25 -0
- package/components/svg/IconLivePlant.js +25 -0
- package/components/svg/IconLocations.js +25 -0
- package/components/svg/IconMail.js +25 -0
- package/components/svg/IconManager.js +25 -0
- package/components/svg/IconMarker.js +25 -0
- package/components/svg/IconMenu.js +25 -0
- package/components/svg/IconMenuHorizontal.js +25 -0
- package/components/svg/IconModule.js +25 -0
- package/components/svg/IconMyLocation.js +25 -0
- package/components/svg/IconNote.js +27 -0
- package/components/svg/IconNursery.js +27 -0
- package/components/svg/IconOrg.js +25 -0
- package/components/svg/IconParchment.js +25 -0
- package/components/svg/IconPhoto.js +25 -0
- package/components/svg/IconRedo.js +25 -0
- package/components/svg/IconRestorationSite.js +25 -0
- package/components/svg/IconSeedBank.js +25 -0
- package/components/svg/IconSeedling.js +25 -0
- package/components/svg/IconSettings.js +25 -0
- package/components/svg/IconSlice.js +25 -0
- package/components/svg/IconSubmit.js +25 -0
- package/components/svg/IconSubtract.js +27 -0
- package/components/svg/IconSynced.js +25 -0
- package/components/svg/IconTrashCan.js +25 -0
- package/components/svg/IconTreasureMap.js +25 -0
- package/components/svg/IconUndo.js +25 -0
- package/components/svg/IconVariable.js +25 -0
- package/components/svg/IconWifi.js +25 -0
- package/components/svg/Info.js +25 -0
- package/components/svg/Key.js +25 -0
- package/components/svg/Leaf.js +25 -0
- package/components/svg/Lock.js +25 -0
- package/components/svg/Logo.js +43 -0
- package/components/svg/MenuVertical.js +25 -0
- package/components/svg/Notification.js +25 -0
- package/components/svg/Person.js +25 -0
- package/components/svg/Plus.js +25 -0
- package/components/svg/RestorationSite.js +25 -0
- package/components/svg/Search.js +25 -0
- package/components/svg/Seeds.js +25 -0
- package/components/svg/Site.js +25 -0
- package/components/svg/Sparkles.js +25 -0
- package/components/svg/Species.js +25 -0
- package/components/svg/Species2.js +156 -0
- package/components/svg/Spinner.js +52 -0
- package/components/svg/Success.js +25 -0
- package/components/svg/SuccessFilled.js +25 -0
- package/components/svg/TerrawareLogoDesktop.js +49 -0
- package/components/svg/TerrawareLogoMobile.js +30 -0
- package/components/svg/Touchscreen.js +25 -0
- package/components/svg/UploadCloud.js +156 -0
- package/components/svg/Warning.js +25 -0
- package/components/svg/WelcomeClipboard.js +133 -0
- package/components/svg/index.js +832 -0
- package/components/table/EnhancedTableToolbar.js +76 -0
- package/components/table/EnhancedTableToolbarV2.js +49 -0
- package/components/table/TableCellRenderer.js +244 -0
- package/components/table/TableHeader.js +75 -0
- package/components/table/TableHeaderItem.js +100 -0
- package/components/table/density.js +28 -0
- package/components/table/index.js +346 -0
- package/components/table/sort.js +72 -0
- package/components/table/sort.test.js +37 -0
- package/components/table/types.js +5 -0
- package/components/types/index.js +5 -0
- package/fonts/Inter.ttf +0 -0
- package/index.css +11 -0
- package/index.js +377 -0
- package/package.json +2 -5
- package/setupTests.js +5 -0
- package/style-dictionary-dist/TerrawareTheme.js +193 -0
- package/style-dictionary-dist/terraware.scss +414 -0
- package/theme.js +86 -0
- package/utils/date.js +124 -0
- package/utils/date.test.js +87 -0
- package/utils/index.js +53 -0
- package/utils/preventDefaultEvent.js +8 -0
- package/utils/text.js +17 -0
- package/utils/text.test.js +23 -0
- package/utils/useDeviceInfo.js +85 -0
- package/index.cjs.js +0 -88606
- package/index.cjs.js.map +0 -1
- package/index.esm.js +0 -88533
- package/index.esm.js.map +0 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = EnhancedTableToolbar;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _ = require(".");
|
|
12
|
+
var _Button = _interopRequireDefault(require("../Button/Button"));
|
|
13
|
+
var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
|
|
14
|
+
function EnhancedTableToolbar(props) {
|
|
15
|
+
const {
|
|
16
|
+
isAllSelected,
|
|
17
|
+
numSelected,
|
|
18
|
+
renderNumSelectedText,
|
|
19
|
+
topBarButtons,
|
|
20
|
+
topBarSelectionConfig
|
|
21
|
+
} = props;
|
|
22
|
+
const theme = (0, _material.useTheme)();
|
|
23
|
+
const selectLinkStyles = {
|
|
24
|
+
color: theme.palette.TwClrTxtBrand,
|
|
25
|
+
cursor: 'pointer'
|
|
26
|
+
};
|
|
27
|
+
const topBarSelection = (0, _react.useMemo)(() => {
|
|
28
|
+
if (!renderNumSelectedText) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
if (!topBarSelectionConfig) {
|
|
32
|
+
return renderNumSelectedText(numSelected);
|
|
33
|
+
}
|
|
34
|
+
const {
|
|
35
|
+
handleSelectAll,
|
|
36
|
+
handleSelectNone,
|
|
37
|
+
renderSelectAllText,
|
|
38
|
+
renderSelectNoneText,
|
|
39
|
+
renderEnhancedNumSelectedText
|
|
40
|
+
} = topBarSelectionConfig;
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderEnhancedNumSelectedText ? renderEnhancedNumSelectedText() : renderNumSelectedText(numSelected), ' ', !isAllSelected && handleSelectAll && renderSelectAllText && /*#__PURE__*/_react.default.createElement(_material.Link, {
|
|
42
|
+
onClick: handleSelectAll,
|
|
43
|
+
sx: selectLinkStyles
|
|
44
|
+
}, renderSelectAllText()), isAllSelected && handleSelectNone && renderSelectNoneText && /*#__PURE__*/_react.default.createElement(_material.Link, {
|
|
45
|
+
onClick: handleSelectNone,
|
|
46
|
+
sx: selectLinkStyles
|
|
47
|
+
}, renderSelectNoneText()));
|
|
48
|
+
}, [renderNumSelectedText, topBarSelectionConfig, numSelected]);
|
|
49
|
+
return renderNumSelectedText && numSelected > 0 ? /*#__PURE__*/_react.default.createElement(_material.Toolbar, {
|
|
50
|
+
sx: {
|
|
51
|
+
background: theme.palette.TwClrBgSecondary,
|
|
52
|
+
borderRadius: theme.spacing(0.5)
|
|
53
|
+
}
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
55
|
+
color: "inherit",
|
|
56
|
+
variant: "subtitle1",
|
|
57
|
+
component: "div",
|
|
58
|
+
sx: {
|
|
59
|
+
flex: '1 1 auto'
|
|
60
|
+
}
|
|
61
|
+
}, topBarSelection), topBarButtons === null || topBarButtons === void 0 ? void 0 : topBarButtons.map((tbButton, index) => (0, _.isTopBarButton)(tbButton) ? /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
62
|
+
title: tbButton.tooltipTitle,
|
|
63
|
+
key: index
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
65
|
+
key: tbButton.buttonText,
|
|
66
|
+
label: tbButton.buttonText,
|
|
67
|
+
priority: "secondary",
|
|
68
|
+
type: tbButton.buttonType,
|
|
69
|
+
onClick: tbButton.onButtonClick,
|
|
70
|
+
icon: tbButton.icon,
|
|
71
|
+
disabled: tbButton.disabled,
|
|
72
|
+
sx: {
|
|
73
|
+
marginLeft: theme.spacing(1)
|
|
74
|
+
}
|
|
75
|
+
})) : tbButton)) : null;
|
|
76
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _EnhancedTableToolbar = _interopRequireDefault(require("./EnhancedTableToolbar"));
|
|
11
|
+
const EnhancedTableToolbarV2 = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
selectedRowsCount,
|
|
14
|
+
pagesCount,
|
|
15
|
+
renderNumSelectedText,
|
|
16
|
+
rowsCount,
|
|
17
|
+
topBarButtons,
|
|
18
|
+
topBarSelectionConfig
|
|
19
|
+
} = _ref;
|
|
20
|
+
const _topBarSelectionConfig = (0, _react.useMemo)(() => {
|
|
21
|
+
if (!topBarSelectionConfig) {
|
|
22
|
+
return topBarSelectionConfig;
|
|
23
|
+
}
|
|
24
|
+
const {
|
|
25
|
+
renderEnhancedNumSelectedText,
|
|
26
|
+
renderSelectAllText
|
|
27
|
+
} = topBarSelectionConfig;
|
|
28
|
+
return {
|
|
29
|
+
...topBarSelectionConfig,
|
|
30
|
+
renderEnhancedNumSelectedText: () => renderEnhancedNumSelectedText && renderEnhancedNumSelectedText(selectedRowsCount || 0, pagesCount) || '',
|
|
31
|
+
renderSelectAllText: () => renderSelectAllText && renderSelectAllText(rowsCount) || ''
|
|
32
|
+
};
|
|
33
|
+
}, [topBarSelectionConfig, selectedRowsCount, rowsCount, pagesCount]);
|
|
34
|
+
if (topBarSelectionConfig) {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_EnhancedTableToolbar.default, {
|
|
36
|
+
numSelected: selectedRowsCount,
|
|
37
|
+
topBarButtons: topBarButtons,
|
|
38
|
+
topBarSelectionConfig: _topBarSelectionConfig,
|
|
39
|
+
isAllSelected: rowsCount === selectedRowsCount,
|
|
40
|
+
renderNumSelectedText: renderNumSelectedText
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_EnhancedTableToolbar.default, {
|
|
44
|
+
numSelected: selectedRowsCount,
|
|
45
|
+
renderNumSelectedText: renderNumSelectedText,
|
|
46
|
+
topBarButtons: topBarButtons
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var _default = exports.default = EnhancedTableToolbarV2;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CellBooleanRenderer = CellBooleanRenderer;
|
|
8
|
+
exports.CellDateRenderer = CellDateRenderer;
|
|
9
|
+
exports.CellEditRenderer = CellEditRenderer;
|
|
10
|
+
exports.CellNotesRenderer = CellNotesRenderer;
|
|
11
|
+
exports.CellTextRenderer = CellTextRenderer;
|
|
12
|
+
exports.cellDateFormatter = void 0;
|
|
13
|
+
exports.default = CellRenderer;
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _iconsMaterial = require("@mui/icons-material");
|
|
16
|
+
var _material = require("@mui/material");
|
|
17
|
+
var _utils = require("../../utils");
|
|
18
|
+
const defaultStyles = theme => ({
|
|
19
|
+
'&.MuiTableCell-root': {
|
|
20
|
+
paddingTop: '0px',
|
|
21
|
+
paddingBottom: '0px',
|
|
22
|
+
borderBottom: "1px solid ".concat(theme.palette.TwClrBgSecondary),
|
|
23
|
+
fontVariantNumeric: 'tabular-nums'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
function CellRenderer(props) {
|
|
27
|
+
const {
|
|
28
|
+
column,
|
|
29
|
+
value,
|
|
30
|
+
onRowClick,
|
|
31
|
+
index,
|
|
32
|
+
className,
|
|
33
|
+
booleanFalseText,
|
|
34
|
+
booleanTrueText,
|
|
35
|
+
editText,
|
|
36
|
+
style,
|
|
37
|
+
sx,
|
|
38
|
+
title,
|
|
39
|
+
component
|
|
40
|
+
} = props;
|
|
41
|
+
const id = "row".concat(index, "-").concat(column.key);
|
|
42
|
+
if (column.type === 'date' && typeof value === 'string' && value) {
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(CellDateRenderer, {
|
|
44
|
+
id: id,
|
|
45
|
+
value: value,
|
|
46
|
+
className: className,
|
|
47
|
+
alignment: column.alignment,
|
|
48
|
+
style: style,
|
|
49
|
+
sx: sx,
|
|
50
|
+
title: title
|
|
51
|
+
});
|
|
52
|
+
} else if (column.type === 'notes' && value && typeof value === 'string') {
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(CellNotesRenderer, {
|
|
54
|
+
id: id,
|
|
55
|
+
value: value,
|
|
56
|
+
className: className,
|
|
57
|
+
alignment: column.alignment,
|
|
58
|
+
style: style,
|
|
59
|
+
sx: sx,
|
|
60
|
+
title: title
|
|
61
|
+
});
|
|
62
|
+
} else if (column.type === 'boolean') {
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(CellBooleanRenderer, {
|
|
64
|
+
id: id,
|
|
65
|
+
value: value,
|
|
66
|
+
className: className,
|
|
67
|
+
booleanFalseText: booleanFalseText,
|
|
68
|
+
booleanTrueText: booleanTrueText,
|
|
69
|
+
alignment: column.alignment,
|
|
70
|
+
style: style,
|
|
71
|
+
sx: sx,
|
|
72
|
+
title: title
|
|
73
|
+
});
|
|
74
|
+
} else if (column.type === 'edit') {
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement(CellEditRenderer, {
|
|
76
|
+
id: id,
|
|
77
|
+
onRowClick: onRowClick,
|
|
78
|
+
className: className,
|
|
79
|
+
editText: editText,
|
|
80
|
+
alignment: column.alignment,
|
|
81
|
+
style: style,
|
|
82
|
+
sx: sx,
|
|
83
|
+
title: title
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(CellTextRenderer, {
|
|
87
|
+
id: id,
|
|
88
|
+
value: value,
|
|
89
|
+
className: className,
|
|
90
|
+
alignment: column.alignment,
|
|
91
|
+
style: style,
|
|
92
|
+
sx: sx,
|
|
93
|
+
title: title,
|
|
94
|
+
component: component
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const cellDateFormatter = value => {
|
|
98
|
+
if (value) {
|
|
99
|
+
return (0, _utils.getDateDisplayValue)(value);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
exports.cellDateFormatter = cellDateFormatter;
|
|
103
|
+
function CellDateRenderer(_ref) {
|
|
104
|
+
let {
|
|
105
|
+
id,
|
|
106
|
+
value,
|
|
107
|
+
className,
|
|
108
|
+
alignment,
|
|
109
|
+
style,
|
|
110
|
+
sx,
|
|
111
|
+
title
|
|
112
|
+
} = _ref;
|
|
113
|
+
const theme = (0, _material.useTheme)();
|
|
114
|
+
return /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
115
|
+
id: id,
|
|
116
|
+
align: alignment || 'left',
|
|
117
|
+
className: className,
|
|
118
|
+
sx: [defaultStyles(theme), {
|
|
119
|
+
whiteSpace: 'nowrap'
|
|
120
|
+
}, style, ...(Array.isArray(sx) ? sx : [sx])],
|
|
121
|
+
title: title
|
|
122
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
123
|
+
component: "p",
|
|
124
|
+
variant: "body1",
|
|
125
|
+
fontSize: "16px"
|
|
126
|
+
}, cellDateFormatter(value)));
|
|
127
|
+
}
|
|
128
|
+
function CellTextRenderer(_ref2) {
|
|
129
|
+
let {
|
|
130
|
+
id,
|
|
131
|
+
value,
|
|
132
|
+
className,
|
|
133
|
+
alignment,
|
|
134
|
+
style,
|
|
135
|
+
sx,
|
|
136
|
+
title,
|
|
137
|
+
component
|
|
138
|
+
} = _ref2;
|
|
139
|
+
const theme = (0, _material.useTheme)();
|
|
140
|
+
return /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
141
|
+
id: id,
|
|
142
|
+
align: alignment || 'left',
|
|
143
|
+
title: title ? title : typeof value === 'string' ? value : '',
|
|
144
|
+
className: className,
|
|
145
|
+
sx: [defaultStyles(theme), style, ...(Array.isArray(sx) ? sx : [sx])]
|
|
146
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
147
|
+
component: component || 'p',
|
|
148
|
+
variant: "body1",
|
|
149
|
+
noWrap: true,
|
|
150
|
+
fontSize: "16px",
|
|
151
|
+
sx: {
|
|
152
|
+
maxWidth: 400
|
|
153
|
+
}
|
|
154
|
+
}, value));
|
|
155
|
+
}
|
|
156
|
+
function CellBooleanRenderer(_ref3) {
|
|
157
|
+
let {
|
|
158
|
+
id,
|
|
159
|
+
value,
|
|
160
|
+
className,
|
|
161
|
+
booleanFalseText,
|
|
162
|
+
booleanTrueText,
|
|
163
|
+
alignment,
|
|
164
|
+
style,
|
|
165
|
+
sx,
|
|
166
|
+
title
|
|
167
|
+
} = _ref3;
|
|
168
|
+
const theme = (0, _material.useTheme)();
|
|
169
|
+
return /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
170
|
+
id: id,
|
|
171
|
+
align: alignment || 'left',
|
|
172
|
+
className: className,
|
|
173
|
+
sx: [defaultStyles(theme), style, ...(Array.isArray(sx) ? sx : [sx])],
|
|
174
|
+
title: title
|
|
175
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
176
|
+
component: "p",
|
|
177
|
+
variant: "body1",
|
|
178
|
+
fontSize: "16px"
|
|
179
|
+
}, (value === null || value === void 0 ? void 0 : value.toString()) === 'true' ? booleanTrueText : booleanFalseText));
|
|
180
|
+
}
|
|
181
|
+
function CellNotesRenderer(_ref4) {
|
|
182
|
+
let {
|
|
183
|
+
id,
|
|
184
|
+
value,
|
|
185
|
+
className,
|
|
186
|
+
alignment,
|
|
187
|
+
style,
|
|
188
|
+
sx,
|
|
189
|
+
title
|
|
190
|
+
} = _ref4;
|
|
191
|
+
const theme = (0, _material.useTheme)();
|
|
192
|
+
return /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
193
|
+
id: id,
|
|
194
|
+
align: alignment || 'left',
|
|
195
|
+
className: className,
|
|
196
|
+
sx: [defaultStyles(theme), style, ...(Array.isArray(sx) ? sx : [sx])],
|
|
197
|
+
title: title
|
|
198
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
199
|
+
id: id,
|
|
200
|
+
component: "p",
|
|
201
|
+
variant: "body1",
|
|
202
|
+
fontSize: "16px"
|
|
203
|
+
}, value && value.length > 0 ? /*#__PURE__*/_react.default.createElement(_iconsMaterial.Notes, null) : ''));
|
|
204
|
+
}
|
|
205
|
+
function CellEditRenderer(_ref5) {
|
|
206
|
+
let {
|
|
207
|
+
id,
|
|
208
|
+
onRowClick,
|
|
209
|
+
className,
|
|
210
|
+
editText,
|
|
211
|
+
alignment,
|
|
212
|
+
style,
|
|
213
|
+
sx,
|
|
214
|
+
title
|
|
215
|
+
} = _ref5;
|
|
216
|
+
const theme = (0, _material.useTheme)();
|
|
217
|
+
return /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
218
|
+
id: id,
|
|
219
|
+
align: alignment || 'left',
|
|
220
|
+
className: className,
|
|
221
|
+
sx: [defaultStyles(theme), style, ...(Array.isArray(sx) ? sx : [sx])],
|
|
222
|
+
title: title
|
|
223
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Link, {
|
|
224
|
+
id: "".concat(id, "-button"),
|
|
225
|
+
href: "#",
|
|
226
|
+
onClick: event => {
|
|
227
|
+
(0, _utils.preventDefaultEvent)(event);
|
|
228
|
+
if (onRowClick) {
|
|
229
|
+
onRowClick();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
233
|
+
display: "flex"
|
|
234
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
235
|
+
component: "p",
|
|
236
|
+
variant: "body1",
|
|
237
|
+
fontSize: "16px"
|
|
238
|
+
}, editText), /*#__PURE__*/_react.default.createElement(_iconsMaterial.Edit, {
|
|
239
|
+
fontSize: "small",
|
|
240
|
+
sx: {
|
|
241
|
+
marginLeft: theme.spacing(1)
|
|
242
|
+
}
|
|
243
|
+
}))));
|
|
244
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = EnhancedTableHead;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _sortable = require("@dnd-kit/sortable");
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _text = require("../../utils/text");
|
|
12
|
+
var _Checkbox = require("../Checkbox");
|
|
13
|
+
var _TableHeaderItem = _interopRequireDefault(require("./TableHeaderItem"));
|
|
14
|
+
var _density = require("./density");
|
|
15
|
+
function EnhancedTableHead(props) {
|
|
16
|
+
const theme = (0, _material.useTheme)();
|
|
17
|
+
const {
|
|
18
|
+
order,
|
|
19
|
+
orderBy,
|
|
20
|
+
onRequestSort,
|
|
21
|
+
numSelected,
|
|
22
|
+
rowCount,
|
|
23
|
+
onSelectAllClick,
|
|
24
|
+
density = 'comfortable'
|
|
25
|
+
} = props;
|
|
26
|
+
const headerCellStyles = {
|
|
27
|
+
'&.MuiTableCell-root': {
|
|
28
|
+
borderBottom: "2px solid ".concat(theme.palette.TwClrBrdrSecondary)
|
|
29
|
+
},
|
|
30
|
+
paddingTop: '0px',
|
|
31
|
+
paddingBottom: '0px'
|
|
32
|
+
};
|
|
33
|
+
_react.default.useEffect(() => {
|
|
34
|
+
setHeadCells(columnsToHeadCells(props.columns));
|
|
35
|
+
}, [props.columns]);
|
|
36
|
+
function columnsToHeadCells(columns) {
|
|
37
|
+
return columns.map(c => ({
|
|
38
|
+
id: c.key,
|
|
39
|
+
disablePadding: false,
|
|
40
|
+
className: c.className,
|
|
41
|
+
label: typeof c.name === 'string' && c.name.length > 0 ? (0, _text.titleCase)(c.name) : c.name,
|
|
42
|
+
tooltipTitle: c.tooltipTitle,
|
|
43
|
+
alignment: c.alignment,
|
|
44
|
+
sx: [headerCellStyles, ...(Array.isArray(c.sx) ? c.sx : [c.sx])]
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
const [headCells, setHeadCells] = _react.default.useState(columnsToHeadCells(props.columns));
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_material.TableHead, null, /*#__PURE__*/_react.default.createElement(_material.TableRow, {
|
|
49
|
+
id: "table-header",
|
|
50
|
+
sx: {
|
|
51
|
+
height: (0, _density.getTableRowHeight)(density)
|
|
52
|
+
}
|
|
53
|
+
}, numSelected !== undefined && rowCount !== undefined && rowCount > 0 && onSelectAllClick && /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
54
|
+
padding: "checkbox",
|
|
55
|
+
sx: headerCellStyles
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Checkbox, {
|
|
57
|
+
disableRipple: true,
|
|
58
|
+
sx: (0, _Checkbox.CheckboxStyle)(theme),
|
|
59
|
+
color: "primary",
|
|
60
|
+
indeterminate: numSelected > 0 && numSelected < rowCount,
|
|
61
|
+
checked: rowCount > 0 && numSelected === rowCount,
|
|
62
|
+
onChange: onSelectAllClick
|
|
63
|
+
})), /*#__PURE__*/_react.default.createElement(_sortable.SortableContext, {
|
|
64
|
+
items: headCells
|
|
65
|
+
}, headCells.map((headCell, i) => {
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(_TableHeaderItem.default, {
|
|
67
|
+
headCell: headCell,
|
|
68
|
+
order: order,
|
|
69
|
+
orderBy: orderBy,
|
|
70
|
+
onRequestSort: onRequestSort,
|
|
71
|
+
i: i,
|
|
72
|
+
key: i
|
|
73
|
+
});
|
|
74
|
+
}))));
|
|
75
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = TableHeaderItem;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _sortable = require("@dnd-kit/sortable");
|
|
10
|
+
var _utilities = require("@dnd-kit/utilities");
|
|
11
|
+
var _iconsMaterial = require("@mui/icons-material");
|
|
12
|
+
var _material = require("@mui/material");
|
|
13
|
+
var _IconTooltip = _interopRequireDefault(require("../IconTooltip"));
|
|
14
|
+
function TableHeaderItem(props) {
|
|
15
|
+
const {
|
|
16
|
+
headCell,
|
|
17
|
+
order,
|
|
18
|
+
orderBy,
|
|
19
|
+
onRequestSort,
|
|
20
|
+
i
|
|
21
|
+
} = props;
|
|
22
|
+
const {
|
|
23
|
+
attributes,
|
|
24
|
+
listeners,
|
|
25
|
+
setNodeRef,
|
|
26
|
+
transform,
|
|
27
|
+
transition,
|
|
28
|
+
isDragging
|
|
29
|
+
} = (0, _sortable.useSortable)({
|
|
30
|
+
id: headCell.id
|
|
31
|
+
});
|
|
32
|
+
const theme = (0, _material.useTheme)();
|
|
33
|
+
const style = {
|
|
34
|
+
transform: _utilities.CSS.Transform.toString(transform),
|
|
35
|
+
transition,
|
|
36
|
+
opacity: isDragging ? 0.5 : 1
|
|
37
|
+
};
|
|
38
|
+
const createSortHandler = property => event => {
|
|
39
|
+
onRequestSort(event, property);
|
|
40
|
+
};
|
|
41
|
+
return headCell.alignment === 'right' ? /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
42
|
+
ref: setNodeRef,
|
|
43
|
+
id: "table-header-".concat(headCell.id),
|
|
44
|
+
key: headCell.id,
|
|
45
|
+
align: 'right',
|
|
46
|
+
padding: headCell.disablePadding ? 'none' : 'normal',
|
|
47
|
+
sortDirection: orderBy === headCell.id ? order : false,
|
|
48
|
+
style: style,
|
|
49
|
+
className: headCell.className || '',
|
|
50
|
+
sx: headCell.sx
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
52
|
+
display: "flex",
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
flexDirection: "row-reverse"
|
|
55
|
+
}, headCell.label && /*#__PURE__*/_react.default.createElement(_material.TableSortLabel, {
|
|
56
|
+
sx: {
|
|
57
|
+
flexDirection: 'row-reverse'
|
|
58
|
+
},
|
|
59
|
+
active: orderBy === headCell.id,
|
|
60
|
+
direction: orderBy === headCell.id ? order : 'asc',
|
|
61
|
+
onClick: createSortHandler(headCell.id)
|
|
62
|
+
}, headCell.tooltipTitle && /*#__PURE__*/_react.default.createElement(_IconTooltip.default, {
|
|
63
|
+
title: headCell.tooltipTitle,
|
|
64
|
+
disableRightMargin: true
|
|
65
|
+
}), headCell.label), i > 0 && /*#__PURE__*/_react.default.createElement(_iconsMaterial.DragHandle, Object.assign({}, attributes, listeners, {
|
|
66
|
+
sx: {
|
|
67
|
+
verticalAlign: 'middle',
|
|
68
|
+
display: 'inline-flex',
|
|
69
|
+
marginLeft: headCell.alignment === 'right' ? '0px' : '-20px',
|
|
70
|
+
color: theme.palette.common.white,
|
|
71
|
+
'&:hover': {
|
|
72
|
+
color: theme.palette.neutral[600]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
})))) : /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
76
|
+
ref: setNodeRef,
|
|
77
|
+
id: "table-header-".concat(headCell.id),
|
|
78
|
+
key: headCell.id,
|
|
79
|
+
align: 'left',
|
|
80
|
+
padding: headCell.disablePadding ? 'none' : 'normal',
|
|
81
|
+
sortDirection: orderBy === headCell.id ? order : false,
|
|
82
|
+
style: style,
|
|
83
|
+
className: headCell.className || '',
|
|
84
|
+
sx: headCell.sx
|
|
85
|
+
}, headCell.label && /*#__PURE__*/_react.default.createElement(_material.TableSortLabel, {
|
|
86
|
+
active: orderBy === headCell.id,
|
|
87
|
+
direction: orderBy === headCell.id ? order : 'asc',
|
|
88
|
+
onClick: createSortHandler(headCell.id)
|
|
89
|
+
}, i > 0 && /*#__PURE__*/_react.default.createElement(_iconsMaterial.DragHandle, Object.assign({}, attributes, listeners, {
|
|
90
|
+
sx: {
|
|
91
|
+
marginLeft: '-20px',
|
|
92
|
+
color: theme.palette.common.white,
|
|
93
|
+
'&:hover': {
|
|
94
|
+
color: theme.palette.neutral[600]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
})), headCell.label, headCell.tooltipTitle && /*#__PURE__*/_react.default.createElement(_IconTooltip.default, {
|
|
98
|
+
title: headCell.tooltipTitle
|
|
99
|
+
})));
|
|
100
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTableRowHeight = exports.getTableCellPaddingY = void 0;
|
|
7
|
+
const getTableCellPaddingY = tableDensity => {
|
|
8
|
+
switch (tableDensity) {
|
|
9
|
+
case 'comfortable':
|
|
10
|
+
return '16px';
|
|
11
|
+
case 'compact':
|
|
12
|
+
return '12px';
|
|
13
|
+
case 'roomy':
|
|
14
|
+
return '20px';
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.getTableCellPaddingY = getTableCellPaddingY;
|
|
18
|
+
const getTableRowHeight = tableDensity => {
|
|
19
|
+
switch (tableDensity) {
|
|
20
|
+
case 'comfortable':
|
|
21
|
+
return '52px';
|
|
22
|
+
case 'compact':
|
|
23
|
+
return '36px';
|
|
24
|
+
case 'roomy':
|
|
25
|
+
return '60px';
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.getTableRowHeight = getTableRowHeight;
|