@nulogy/components 15.2.1 → 15.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/main.js +53108 -54055
- package/dist/main.module.js +8809 -9756
- package/dist/src/Alert/Alert.js +2 -14
- package/dist/src/Alert/Alert.story.d.ts +15 -19
- package/dist/src/Alert/Alert.story.js +25 -14
- package/dist/src/AppTag/components/LogoWrapper.d.ts +0 -1
- package/dist/src/AppTag/components/NulogyLogo.js +2 -14
- package/dist/src/AsyncSelect/AsyncSelect.graphql.story.js +4 -13
- package/dist/src/AsyncSelect/AsyncSelect.js +14 -16
- package/dist/src/AsyncSelect/AsyncSelectComponents.js +9 -21
- package/dist/src/AsyncSelect/fixtures.js +4 -13
- package/dist/src/Banner/Banner.js +1 -15
- package/dist/src/BottomSheet/BottomSheet.js +2 -15
- package/dist/src/BottomSheet/BottomSheet.parts.d.ts +2 -2
- package/dist/src/BottomSheet/BottomSheet.parts.js +8 -22
- package/dist/src/BottomSheet/BottomSheet.styled.d.ts +4 -5
- package/dist/src/Box/Box.d.ts +12 -4
- package/dist/src/BrandedNavBar/DesktopMenu.js +22 -36
- package/dist/src/BrandedNavBar/MenuTrigger.js +4 -16
- package/dist/src/BrandedNavBar/MenuTriggerButton.js +8 -22
- package/dist/src/BrandedNavBar/MobileMenu.js +28 -35
- package/dist/src/BrandedNavBar/NavBar.js +7 -21
- package/dist/src/BrandedNavBar/NavBar.story.d.ts +4 -6
- package/dist/src/BrandedNavBar/NavBar.story.js +12 -4
- package/dist/src/BrandedNavBar/NavBarBackground.d.ts +0 -1
- package/dist/src/BrandedNavBar/NavBarDropdownMenu.js +14 -8
- package/dist/src/BrandedNavBar/SmallNavBar.js +4 -16
- package/dist/src/BrandedNavBar/SmallNavBar.story.d.ts +5 -2
- package/dist/src/BrandedNavBar/SmallNavBar.story.js +27 -6
- package/dist/src/BrandedNavBar/SubMenuTrigger.js +4 -16
- package/dist/src/BrandedNavBar/SubMenuTriggerButton.js +2 -14
- package/dist/src/BrandedNavBar/renderSubMenuItems.js +7 -17
- package/dist/src/Branding/Branding.js +2 -14
- package/dist/src/Branding/BrandingText.d.ts +0 -1
- package/dist/src/Branding/LettermarkLogo.js +2 -14
- package/dist/src/Branding/WordmarkLogo.js +2 -14
- package/dist/src/Breadcrumbs/Breadcrumbs.js +2 -14
- package/dist/src/Breadcrumbs/BreadcrumbsList.d.ts +0 -1
- package/dist/src/Breadcrumbs/BreadcrumbsListItem.d.ts +0 -1
- package/dist/src/Button/Button.js +2 -14
- package/dist/src/Button/CloseButton.js +1 -1
- package/dist/src/Button/ControlIcon.js +2 -16
- package/dist/src/Button/DangerButton.d.ts +0 -1
- package/dist/src/Button/IconicButton.js +55 -73
- package/dist/src/Button/PrimaryButton.d.ts +0 -1
- package/dist/src/Button/QuietButton.d.ts +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.d.ts +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.js +8 -2
- package/dist/src/Card/Card.js +2 -14
- package/dist/src/Card/Card.story.js +1 -1
- package/dist/src/Card/CardSet.d.ts +0 -1
- package/dist/src/Checkbox/Checkbox.js +20 -6
- package/dist/src/Checkbox/Checkbox.story.js +4 -1
- package/dist/src/Checkbox/CheckboxGroup.js +4 -16
- package/dist/src/DatePickers/DatePicker.js +2 -14
- package/dist/src/DatePickers/MonthPicker.js +2 -14
- package/dist/src/DatePickers/WeekPicker.js +10 -17
- package/dist/src/DatePickers/custom/weekPickerStyles.d.ts +0 -1
- package/dist/src/DatePickers/shared/components/BasePicker.js +9 -15
- package/dist/src/DatePickers/shared/components/DatePickerInput.js +2 -13
- package/dist/src/DatePickers/shared/styles.d.ts +0 -1
- package/dist/src/DatePickers/shared/types.d.ts +0 -1
- package/dist/src/DatePickers/stories/DatePicker.story.d.ts +7 -3
- package/dist/src/DatePickers/stories/DatePicker.story.js +54 -22
- package/dist/src/DatePickers/stories/WeekPicker.story.js +1 -1
- package/dist/src/DateRange/DateRange.js +36 -22
- package/dist/src/DateRange/DateRangeStyles.d.ts +0 -1
- package/dist/src/DateRange/EndTime.d.ts +3 -4
- package/dist/src/DateRange/StartTime.d.ts +3 -4
- package/dist/src/Decorations/index.js +1 -1
- package/dist/src/DescriptionList/DescriptionList.js +1 -13
- package/dist/src/DescriptionList/DescriptionList.parts.d.ts +0 -1
- package/dist/src/DescriptionList/DescriptionList.parts.js +156 -77
- package/dist/src/DescriptionList/DescriptionListContext.js +1 -15
- package/dist/src/DescriptionList/lib/utils.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.column.story.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.d.ts +7 -8
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.js +15 -12
- package/dist/src/DescriptionList/stories/DescriptionList.layout.story.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.d.ts +7 -8
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.js +203 -195
- package/dist/src/DescriptionList/stories/fixtures.d.ts +2 -2
- package/dist/src/Divider/Divider.d.ts +0 -1
- package/dist/src/DropdownMenu/DropdownItem.d.ts +0 -1
- package/dist/src/DropdownMenu/DropdownMenu.js +13 -17
- package/dist/src/DropdownMenu/DropdownMenu.story.js +2 -2
- package/dist/src/DropdownMenu/DropdownMenuContainer.d.ts +0 -1
- package/dist/src/DropdownMenu/DropdownMenuContainer.js +10 -1
- package/dist/src/DropdownMenu/DropdownText.d.ts +1 -2
- package/dist/src/FieldLabel/FieldLabel.js +2 -14
- package/dist/src/FieldLabel/HelpText.d.ts +1 -2
- package/dist/src/FieldLabel/LabelText.d.ts +0 -1
- package/dist/src/FieldLabel/MaybeFieldLabel.js +1 -15
- package/dist/src/FieldLabel/RequirementText.js +1 -1
- package/dist/src/Flex/Flex.d.ts +0 -1
- package/dist/src/Flex/Flex.story.js +3 -17
- package/dist/src/Form/Field.d.ts +0 -1
- package/dist/src/Form/Fieldset.d.ts +0 -1
- package/dist/src/Form/Form.js +3 -17
- package/dist/src/Form/FormSection.js +3 -17
- package/dist/src/Icon/Icon.js +9 -24
- package/dist/src/Icon/LoadingIcon.js +2 -14
- package/dist/src/Input/Input.js +3 -15
- package/dist/src/Input/InputField.js +4 -16
- package/dist/src/Input/Prefix.js +2 -16
- package/dist/src/Input/Suffix.js +2 -14
- package/dist/src/Layout/ApplicationFrame.js +2 -14
- package/dist/src/Layout/Header.d.ts +1 -1
- package/dist/src/Layout/Header.js +4 -17
- package/dist/src/Layout/Header.story.d.ts +10 -9
- package/dist/src/Layout/Header.story.js +9 -8
- package/dist/src/Layout/Page.js +5 -19
- package/dist/src/Layout/Sidebar.js +4 -18
- package/dist/src/Layout/Sidebar.story.d.ts +4 -1
- package/dist/src/Layout/Sidebar.story.js +24 -31
- package/dist/src/Link/Link.js +13 -21
- package/dist/src/List/List.d.ts +0 -1
- package/dist/src/Modal/Modal.story.d.ts +39 -61
- package/dist/src/Modal/Modal.story.js +110 -85
- package/dist/src/Modal/ModalCloseButton.d.ts +0 -1
- package/dist/src/Modal/ModalFooter.d.ts +0 -1
- package/dist/src/Modal/ModalHeader.d.ts +0 -1
- package/dist/src/NDSProvider/ComponentVariantContext.js +1 -1
- package/dist/src/NDSProvider/GlobalStyles.d.ts +0 -1
- package/dist/src/NDSProvider/ModalStyleOverride.d.ts +0 -1
- package/dist/src/NDSProvider/Reset.d.ts +0 -1
- package/dist/src/NDSProvider/renderWithNDSProvider.spec-utils.d.ts +3 -1
- package/dist/src/NDSProvider/renderWithNDSProvider.spec-utils.js +3 -1
- package/dist/src/NavBarSearch/NavBarSearch.js +2 -14
- package/dist/src/Navigation/Navigation.js +3 -16
- package/dist/src/Navigation/components/AppSwitcher/NulogyAppSwitcher.js +6 -3
- package/dist/src/Navigation/components/AppSwitcher/parts/Item.js +1 -15
- package/dist/src/Navigation/components/AppSwitcher/parts/Link.js +2 -16
- package/dist/src/Navigation/components/AppSwitcher/parts/index.d.ts +4 -5
- package/dist/src/Navigation/components/DesktopNav/DesktopNav.js +2 -2
- package/dist/src/Navigation/components/MenuSubItem/MenuSubItem.js +4 -5
- package/dist/src/Navigation/components/MenuSubItem/parts/styled.d.ts +0 -1
- package/dist/src/Navigation/components/MenuSubItem/parts/styled.js +49 -7
- package/dist/src/Navigation/components/MobileNav/MobileNav.js +2 -2
- package/dist/src/Navigation/components/MobileNav/parts/MobileMenuItem.js +12 -21
- package/dist/src/Navigation/components/MobileNav/parts/styled.d.ts +1 -2
- package/dist/src/Navigation/components/MobileNav/parts/styled.js +35 -4
- package/dist/src/Navigation/components/NulogyLogo/SvgNulogyLogo.js +1 -1
- package/dist/src/Navigation/components/UserMenu/UserMenu.d.ts +0 -1
- package/dist/src/Navigation/components/UserMenu/parts/Header.js +1 -1
- package/dist/src/Navigation/components/UserMenu/parts/Item.js +7 -16
- package/dist/src/Navigation/components/UserMenu/parts/MobileItem.js +7 -16
- package/dist/src/Navigation/components/UserMenu/parts/styled.d.ts +0 -1
- package/dist/src/Navigation/components/UserMenu/parts/styled.js +43 -18
- package/dist/src/Navigation/components/shared/NavigationLogo.js +4 -16
- package/dist/src/Navigation/components/shared/NavigationLogoLink.js +2 -14
- package/dist/src/Navigation/components/shared/NavigationMenuContent.d.ts +0 -1
- package/dist/src/Navigation/components/shared/NavigationMenuItem.js +10 -24
- package/dist/src/Navigation/components/shared/components.d.ts +0 -1
- package/dist/src/Navigation/components/shared/components.js +29 -5
- package/dist/src/Navigation/hooks/useResponsiveMenu.d.ts +0 -1
- package/dist/src/Navigation/stories/Navigation.mobileVisibility.story.js +21 -9
- package/dist/src/Navigation/stories/fixtures/logos/CustomLogo2.js +1 -1
- package/dist/src/Navigation/stories/fixtures/logos/CustomLogo3.js +1 -1
- package/dist/src/Navigation/stories/fixtures/logos/Customlogo1.js +1 -1
- package/dist/src/Overlay/Overlay.d.ts +0 -1
- package/dist/src/Pagination/PageNumber.d.ts +0 -1
- package/dist/src/Pagination/Pagination.js +3 -16
- package/dist/src/Pagination/PaginationButton.d.ts +0 -1
- package/dist/src/Popper/Popper.js +29 -6
- package/dist/src/Primitives/index.d.ts +0 -1
- package/dist/src/Radio/Radio.js +11 -18
- package/dist/src/Radio/Radio.story.d.ts +322 -32
- package/dist/src/Radio/Radio.story.js +36 -22
- package/dist/src/Radio/RadioGroup.js +4 -16
- package/dist/src/RangeContainer/RangeContainer.js +6 -15
- package/dist/src/Select/MenuList.js +14 -19
- package/dist/src/Select/Select.d.ts +2 -2
- package/dist/src/Select/Select.js +16 -17
- package/dist/src/Select/Select.spec-utils.js +1 -0
- package/dist/src/Select/Select.story.d.ts +5 -1
- package/dist/src/Select/Select.story.fixture.js +8 -30
- package/dist/src/Select/Select.story.js +107 -31
- package/dist/src/Select/SelectComponents.js +7 -7
- package/dist/src/Select/SelectOption.js +1 -1
- package/dist/src/Select/customReactSelectStyles.js +152 -44
- package/dist/src/Select/lib.js +1 -2
- package/dist/src/SortingTable/SortingTable.js +6 -15
- package/dist/src/StatusIndicator/StatusIndicator.d.ts +0 -1
- package/dist/src/StatusIndicator/StatusIndicator.js +16 -1
- package/dist/src/Summary/Summary.js +2 -14
- package/dist/src/Summary/SummaryDivider.js +1 -1
- package/dist/src/Summary/SummaryItem.js +2 -14
- package/dist/src/Switcher/Switch.js +23 -19
- package/dist/src/Switcher/Switcher.js +4 -16
- package/dist/src/Table/BaseTable.js +2 -14
- package/dist/src/Table/StatefulTable.d.ts +1 -1
- package/dist/src/Table/StatefulTable.js +17 -9
- package/dist/src/Table/StyledTh.d.ts +0 -1
- package/dist/src/Table/StyledTh.js +11 -2
- package/dist/src/Table/Table.js +2 -14
- package/dist/src/Table/Table.types.d.ts +0 -1
- package/dist/src/Table/TableBody.js +11 -11
- package/dist/src/Table/TableFoot.js +5 -8
- package/dist/src/Table/TableHead.js +1 -4
- package/dist/src/Table/addExpandableControl.js +5 -2
- package/dist/src/Table/addSelectableControl.js +5 -2
- package/dist/src/Table/stories/BaseTable.story.d.ts +11 -7
- package/dist/src/Table/stories/BaseTable.story.js +156 -34
- package/dist/src/Table/stories/SortingColumnHeader.story.d.ts +5 -2
- package/dist/src/Table/stories/SortingColumnHeader.story.js +20 -3
- package/dist/src/Table/stories/Table.story.d.ts +7 -14
- package/dist/src/Table/stories/Table.story.js +172 -127
- package/dist/src/Table/stories/TableWithCustomSorting.story.js +4 -1
- package/dist/src/Table/stories/TableWithFiltering.story.js +8 -2
- package/dist/src/Table/stories/TableWithServerSidePagination.story.js +4 -15
- package/dist/src/Tabs/Tab.js +11 -18
- package/dist/src/Tabs/TabContainer.d.ts +0 -1
- package/dist/src/Tabs/TabScrollIndicator.js +2 -14
- package/dist/src/Tabs/Tabs.js +5 -7
- package/dist/src/Textarea/Textarea.js +3 -15
- package/dist/src/TimePicker/TimePicker.js +2 -14
- package/dist/src/TimePicker/TimePickerDropdown.d.ts +0 -1
- package/dist/src/TimePicker/TimePickerInput.d.ts +0 -1
- package/dist/src/TimePicker/TimePickerInput.js +6 -4
- package/dist/src/TimeRange/TimeRange.js +20 -20
- package/dist/src/Toast/Toast.js +4 -16
- package/dist/src/ToastContainer/ToastContainer.js +4 -16
- package/dist/src/ToastContainer/ToastContainer.story.js +1 -1
- package/dist/src/ToastContainer/ToastFunction.js +7 -19
- package/dist/src/Toggle/Toggle.js +4 -17
- package/dist/src/Toggle/ToggleButton.js +2 -14
- package/dist/src/Tooltip/Tooltip.story.d.ts +15 -52
- package/dist/src/Tooltip/Tooltip.story.js +80 -72
- package/dist/src/Tooltip/TooltipContainer.d.ts +0 -1
- package/dist/src/Tooltip/TooltipContainer.js +16 -1
- package/dist/src/Tooltip/components/TooltipComponents.js +9 -24
- package/dist/src/TopBar/TopBar.styled.d.ts +14 -7
- package/dist/src/TopBar/components/BackLink.js +2 -14
- package/dist/src/TopBar/components/Menu.js +2 -15
- package/dist/src/TopBar/components/MenuItemLink.js +2 -14
- package/dist/src/TopBar/components/PageTitle.js +2 -14
- package/dist/src/TopBar/stories/TopBar.backButton.story.js +3 -3
- package/dist/src/TopBar/stories/TopBar.menu.story.js +9 -20
- package/dist/src/TopBar/stories/TopBar.story.js +3 -3
- package/dist/src/TruncatedText/TruncatedText.js +8 -16
- package/dist/src/TruncatedText/components/MaybeTooltip.d.ts +1 -1
- package/dist/src/TruncatedText/components/TruncatedTextFillWidth.js +3 -15
- package/dist/src/TruncatedText/components/TruncatedTextMaxCharacters.js +4 -16
- package/dist/src/Type/Headings.d.ts +4 -5
- package/dist/src/Type/Text.d.ts +0 -1
- package/dist/src/Validation/InlineValidation.js +2 -14
- package/dist/src/VerticalDivider/VerticalDivider.d.ts +0 -1
- package/dist/src/VisualTests/WithSpace.story.js +18 -18
- package/dist/src/hooks/useMediaQuery/useMediaQuery.js +1 -2
- package/dist/src/i18n.js +1 -1
- package/dist/src/locale.story.js +1 -1
- package/dist/src/testing/matchers/toHaveStyle.d.ts +15 -0
- package/dist/src/testing/matchers/toHaveStyle.js +50 -0
- package/dist/src/testing/matchers/toMatchDate.d.ts +1 -0
- package/dist/src/testing/matchers/toMatchDate.js +1 -1
- package/dist/src/theme/mergeThemes.util.js +7 -1
- package/dist/src/theme/useNDSTheme.js +9 -3
- package/dist/src/utils/ClickInputLabel.d.ts +0 -1
- package/dist/src/utils/DetectOutsideClick.d.ts +3 -0
- package/dist/src/utils/DetectOutsideClick.js +3 -0
- package/dist/src/utils/PopperArrow.js +5 -1
- package/dist/src/utils/ScrollIndicators.js +1 -1
- package/dist/src/utils/generateId.d.ts +5 -0
- package/dist/src/utils/generateId.js +5 -0
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +0 -1
- package/dist/src/utils/numberFromDimension/numberFromDimension.spec.js +1 -0
- package/dist/src/utils/story/code.d.ts +0 -1
- package/dist/src/utils/story/dashed.d.ts +2 -2
- package/dist/src/utils/story/placeholder.js +1 -1
- package/dist/src/utils/story/resizable.d.ts +2 -2
- package/dist/src/utils/story/resizable.js +1 -1
- package/dist/src/utils/story/simulatedAPIRequests.js +8 -19
- package/dist/src/utils/subPx.js +1 -1
- package/dist/src/utils/testing/useConditionalAutoClick.js +3 -3
- package/dist/src/utils/testing/useUrlProps.js +1 -1
- package/dist/src/utils/ts/FocusManager.js +1 -1
- package/dist/src/utils/useWindowDimension.story.d.ts +1 -1
- package/dist/src/utils/withMenuState.js +1 -1
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +11 -0
- package/package.json +45 -85
- package/dist/src/NDSProvider/mountWithNDSProvider.spec-utils.d.ts +0 -1
- package/dist/src/NDSProvider/mountWithNDSProvider.spec-utils.js +0 -4
- package/dist/src/utils/withWindowDimensions.d.ts +0 -3
- package/dist/src/utils/withWindowDimensions.js +0 -28
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { boolean, text } from "@storybook/addon-knobs";
|
|
3
2
|
import { action } from "@storybook/addon-actions";
|
|
4
3
|
import { Box, DropdownButton, DropdownMenu, Button, Text, Flex } from "../..";
|
|
5
4
|
import { getMockRows, mockColumns } from "../Table.mock-utils";
|
|
@@ -233,12 +232,79 @@ const rowDataWithSections = [
|
|
|
233
232
|
];
|
|
234
233
|
export default {
|
|
235
234
|
title: "Components/Table/Base",
|
|
235
|
+
component: Table,
|
|
236
|
+
};
|
|
237
|
+
export const WithData = {
|
|
238
|
+
args: {
|
|
239
|
+
columns,
|
|
240
|
+
rows: rowData,
|
|
241
|
+
rowHovers: true,
|
|
242
|
+
compact: false,
|
|
243
|
+
loading: false,
|
|
244
|
+
className: "Table",
|
|
245
|
+
},
|
|
246
|
+
argTypes: {
|
|
247
|
+
rowHovers: {
|
|
248
|
+
control: { type: "boolean" },
|
|
249
|
+
},
|
|
250
|
+
compact: {
|
|
251
|
+
control: { type: "boolean" },
|
|
252
|
+
},
|
|
253
|
+
loading: {
|
|
254
|
+
control: { type: "boolean" },
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
export const WithNoData = {
|
|
259
|
+
args: {
|
|
260
|
+
columns,
|
|
261
|
+
rows: [],
|
|
262
|
+
noRowsContent: undefined,
|
|
263
|
+
loading: false,
|
|
264
|
+
},
|
|
265
|
+
argTypes: {
|
|
266
|
+
noRowsContent: {
|
|
267
|
+
control: { type: "text" },
|
|
268
|
+
},
|
|
269
|
+
loading: {
|
|
270
|
+
control: { type: "boolean" },
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
export const WithStickyHeader = {
|
|
275
|
+
render: (args) => (React.createElement(Box, { mt: "x4" },
|
|
276
|
+
React.createElement(Table, { columns: columns, rows: rowData, rowHovers: args.rowHovers, compact: args.compact, loading: args.loading, className: "Table", stickyHeader: true }))),
|
|
277
|
+
args: {
|
|
278
|
+
rowHovers: true,
|
|
279
|
+
compact: false,
|
|
280
|
+
loading: false,
|
|
281
|
+
},
|
|
282
|
+
argTypes: {
|
|
283
|
+
rowHovers: {
|
|
284
|
+
control: { type: "boolean" },
|
|
285
|
+
},
|
|
286
|
+
compact: {
|
|
287
|
+
control: { type: "boolean" },
|
|
288
|
+
},
|
|
289
|
+
loading: {
|
|
290
|
+
control: { type: "boolean" },
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
export const WithLotsOfRowsAndColumns = {
|
|
295
|
+
args: {
|
|
296
|
+
columns: mockColumns,
|
|
297
|
+
rows: getMockRows(50),
|
|
298
|
+
hasSelectableRows: true,
|
|
299
|
+
onRowSelectionChange: action("row selection changed"),
|
|
300
|
+
loading: false,
|
|
301
|
+
},
|
|
302
|
+
argTypes: {
|
|
303
|
+
loading: {
|
|
304
|
+
control: { type: "boolean" },
|
|
305
|
+
},
|
|
306
|
+
},
|
|
236
307
|
};
|
|
237
|
-
export const WithData = () => (React.createElement(Table, { columns: columns, rows: rowData, rowHovers: boolean("Show row hovers", true), compact: boolean("Show with compact styling", false), loading: boolean("Show loading state", false), className: "Table" }));
|
|
238
|
-
export const WithNoData = () => (React.createElement(Table, { columns: columns, rows: [], noRowsContent: text("Custom text", undefined), loading: boolean("Show loading state", false) }));
|
|
239
|
-
export const WithStickyHeader = () => (React.createElement(Box, { mt: "x4" },
|
|
240
|
-
React.createElement(Table, { columns: columns, rows: rowData, rowHovers: boolean("Show row hovers", true), compact: boolean("Show with compact styling", false), loading: boolean("Show loading state", false), className: "Table", stickyHeader: true })));
|
|
241
|
-
export const WithLotsOfRowsAndColumns = () => (React.createElement(Table, { columns: mockColumns, rows: getMockRows(50), hasSelectableRows: true, onRowSelectionChange: action("row selection changed"), loading: boolean("Show loading state", false) }));
|
|
242
308
|
export const WithCustomColumnWidths = () => React.createElement(Table, { columns: columnsWithWidths, rows: rowDataWithWidths });
|
|
243
309
|
export const WithACustomCellComponent = () => (React.createElement(Table, { columns: getColumnsWithCellRenderer(dropdownCellRenderer), rows: rowData }));
|
|
244
310
|
export const WithCellAlignment = () => React.createElement(Table, { columns: columnsWithAlignment, rows: rowData });
|
|
@@ -267,34 +333,90 @@ export const WithMetadata = () => (React.createElement(Table, { columns: [
|
|
|
267
333
|
},
|
|
268
334
|
], rows: rowData }));
|
|
269
335
|
export const WithFullWidthSection = () => React.createElement(Table, { columns: columns, rows: rowDataWithSections });
|
|
270
|
-
export const WithAFooter =
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
description: "This whole row is top aligned. lorem ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing",
|
|
281
|
-
expectedQuantity: "2,025 eaches",
|
|
282
|
-
verticalAlign: "top",
|
|
283
|
-
actualQuantity: "1,800 eaches",
|
|
284
|
-
id: "r1",
|
|
336
|
+
export const WithAFooter = {
|
|
337
|
+
render: (args) => (React.createElement(React.Fragment, null,
|
|
338
|
+
React.createElement(Table, { columns: columns, keyField: "date", rows: rowData, footerRows: footerRowData, loading: args.loading }),
|
|
339
|
+
React.createElement(Table, { compact: true, columns: columns, keyField: "date", rows: compactRowData, footerRows: footerRowData, loading: args.loading }))),
|
|
340
|
+
args: {
|
|
341
|
+
loading: false,
|
|
342
|
+
},
|
|
343
|
+
argTypes: {
|
|
344
|
+
loading: {
|
|
345
|
+
control: { type: "boolean" },
|
|
285
346
|
},
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
export const WithRowBorder = {
|
|
350
|
+
args: {
|
|
351
|
+
rowBorder: true,
|
|
352
|
+
columns,
|
|
353
|
+
rows: rowData,
|
|
354
|
+
rowHovers: true,
|
|
355
|
+
compact: false,
|
|
356
|
+
loading: false,
|
|
357
|
+
className: "Table",
|
|
358
|
+
},
|
|
359
|
+
argTypes: {
|
|
360
|
+
rowBorder: {
|
|
361
|
+
control: { type: "boolean" },
|
|
292
362
|
},
|
|
293
|
-
{
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
id: "r3",
|
|
363
|
+
rowHovers: {
|
|
364
|
+
control: { type: "boolean" },
|
|
365
|
+
},
|
|
366
|
+
compact: {
|
|
367
|
+
control: { type: "boolean" },
|
|
299
368
|
},
|
|
300
|
-
|
|
369
|
+
loading: {
|
|
370
|
+
control: { type: "boolean" },
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
};
|
|
374
|
+
export const WithVerticalAlignment = {
|
|
375
|
+
render: (args) => (React.createElement(Table, { rowBorder: args.rowBorder, columns: [
|
|
376
|
+
{ label: "Description", dataKey: "description", width: "50%" },
|
|
377
|
+
{ label: "Expected Quantity", dataKey: "expectedQuantity" },
|
|
378
|
+
{ label: "Actual Quantity", dataKey: "actualQuantity" },
|
|
379
|
+
], rows: [
|
|
380
|
+
{
|
|
381
|
+
description: "This whole row is top aligned. lorem ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing",
|
|
382
|
+
expectedQuantity: "2,025 eaches",
|
|
383
|
+
verticalAlign: "top",
|
|
384
|
+
actualQuantity: "1,800 eaches",
|
|
385
|
+
id: "r1",
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
description: "This whole row is middle aligned. lorem ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing",
|
|
389
|
+
expectedQuantity: "2,475 eaches",
|
|
390
|
+
verticalAlign: "middle",
|
|
391
|
+
actualQuantity: "2,250 eaches",
|
|
392
|
+
id: "r2",
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
description: "This whole row is bottom aligned. lorem ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing",
|
|
396
|
+
expectedQuantity: "2,475 eaches",
|
|
397
|
+
verticalAlign: "bottom",
|
|
398
|
+
actualQuantity: "1,425 eaches",
|
|
399
|
+
id: "r3",
|
|
400
|
+
},
|
|
401
|
+
], rowHovers: args.rowHovers, compact: args.compact, loading: args.loading })),
|
|
402
|
+
args: {
|
|
403
|
+
rowBorder: true,
|
|
404
|
+
rowHovers: true,
|
|
405
|
+
compact: false,
|
|
406
|
+
loading: false,
|
|
407
|
+
},
|
|
408
|
+
argTypes: {
|
|
409
|
+
rowBorder: {
|
|
410
|
+
control: { type: "boolean" },
|
|
411
|
+
},
|
|
412
|
+
rowHovers: {
|
|
413
|
+
control: { type: "boolean" },
|
|
414
|
+
},
|
|
415
|
+
compact: {
|
|
416
|
+
control: { type: "boolean" },
|
|
417
|
+
},
|
|
418
|
+
loading: {
|
|
419
|
+
control: { type: "boolean" },
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import { Table } from "../../index";
|
|
2
3
|
declare const _default: {
|
|
3
4
|
title: string;
|
|
5
|
+
component: typeof import("../SortingColumnHeader").default;
|
|
4
6
|
};
|
|
5
7
|
export default _default;
|
|
6
|
-
|
|
8
|
+
type Story = StoryObj<typeof Table.SortingHeader>;
|
|
9
|
+
export declare const _SortingHeader: Story;
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { action } from "@storybook/addon-actions";
|
|
3
|
-
import { text, boolean } from "@storybook/addon-knobs";
|
|
4
2
|
import { Table } from "../../index";
|
|
5
3
|
export default {
|
|
6
4
|
title: "Components/Table/Headers",
|
|
5
|
+
component: Table.SortingHeader,
|
|
6
|
+
};
|
|
7
|
+
export const _SortingHeader = {
|
|
8
|
+
args: {
|
|
9
|
+
onChange: action("sort change"),
|
|
10
|
+
label: "Header Label",
|
|
11
|
+
ascending: false,
|
|
12
|
+
active: false,
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
label: {
|
|
16
|
+
control: { type: "text" },
|
|
17
|
+
},
|
|
18
|
+
ascending: {
|
|
19
|
+
control: { type: "boolean" },
|
|
20
|
+
},
|
|
21
|
+
active: {
|
|
22
|
+
control: { type: "boolean" },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
7
25
|
};
|
|
8
|
-
export const _SortingHeader = () => (React.createElement(Table.SortingHeader, { onChange: action("sort change"), label: text("Label", "Header Label"), ascending: boolean("Ascending", false), active: boolean("Active", false) }));
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import { Table } from "..";
|
|
2
3
|
declare const _default: {
|
|
3
4
|
title: string;
|
|
5
|
+
component: typeof Table;
|
|
4
6
|
};
|
|
5
7
|
export default _default;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export declare const WithEverything: {
|
|
13
|
-
(): React.JSX.Element;
|
|
14
|
-
story: {
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export declare const WithOnHoverActions: () => React.JSX.Element;
|
|
8
|
+
type Story = StoryObj<typeof Table>;
|
|
9
|
+
export declare const WithPagination: Story;
|
|
10
|
+
export declare const WithEverything: Story;
|
|
11
|
+
export declare const WithOnHoverActions: Story;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { action } from "@storybook/addon-actions";
|
|
3
|
-
import { boolean, number } from "@storybook/addon-knobs";
|
|
4
3
|
import { useState } from "react";
|
|
5
4
|
import { Box, DropdownButton, DropdownMenu, Text } from "../..";
|
|
6
5
|
import { Table } from "..";
|
|
@@ -166,137 +165,183 @@ const footerRowData = [
|
|
|
166
165
|
];
|
|
167
166
|
export default {
|
|
168
167
|
title: "Components/Table",
|
|
168
|
+
component: Table,
|
|
169
169
|
};
|
|
170
|
-
export const WithPagination =
|
|
171
|
-
|
|
170
|
+
export const WithPagination = {
|
|
171
|
+
args: {
|
|
172
|
+
columns,
|
|
173
|
+
rows: rowData,
|
|
174
|
+
rowsPerPage: 1,
|
|
175
|
+
onPageChange: action("page changed"),
|
|
176
|
+
className: "Table",
|
|
177
|
+
},
|
|
178
|
+
argTypes: {
|
|
179
|
+
rowsPerPage: {
|
|
180
|
+
control: { type: "number" },
|
|
181
|
+
},
|
|
182
|
+
},
|
|
172
183
|
name: "with pagination",
|
|
173
184
|
};
|
|
174
|
-
export const WithEverything =
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
{
|
|
193
|
-
date: "2019-10-02",
|
|
194
|
-
expectedQuantity: "2,475 eaches",
|
|
195
|
-
actualQuantity: "2,250 eaches",
|
|
196
|
-
id: "r3",
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
date: "2019-10-03",
|
|
200
|
-
expectedQuantity: "2,475 eaches",
|
|
201
|
-
actualQuantity: "1,425 eaches",
|
|
202
|
-
id: "r4",
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
date: "2019-10-04",
|
|
206
|
-
expectedQuantity: "2,475 eaches",
|
|
207
|
-
actualQuantity: "675 eaches",
|
|
208
|
-
note: "1c Other Plant-related issue, equipment issues",
|
|
209
|
-
id: "r5",
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
date: "2019-10-07",
|
|
213
|
-
expectedQuantity: "2,475 eaches",
|
|
214
|
-
actualQuantity: "1,575 eaches",
|
|
215
|
-
id: "r6",
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
date: "2019-10-22",
|
|
219
|
-
expectedQuantity: "1,725 eaches",
|
|
220
|
-
actualQuantity: "-",
|
|
221
|
-
id: "r7",
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
date: "2019-10-23",
|
|
225
|
-
expectedQuantity: "2,475 eaches",
|
|
226
|
-
actualQuantity: "-",
|
|
227
|
-
id: "r8",
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
date: "2019-10-23",
|
|
231
|
-
expectedQuantity: "2,475 eaches",
|
|
232
|
-
actualQuantity: "-",
|
|
233
|
-
id: "r9",
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
date: "2019-10-24",
|
|
237
|
-
expectedQuantity: "2,475 eaches",
|
|
238
|
-
actualQuantity: "-",
|
|
239
|
-
id: "r10",
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
date: "2019-10-23",
|
|
243
|
-
expectedQuantity: "2,475 eaches",
|
|
244
|
-
actualQuantity: "-",
|
|
245
|
-
id: "r11",
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
date: "2019-10-23",
|
|
249
|
-
expectedQuantity: "2,475 eaches",
|
|
250
|
-
actualQuantity: "-",
|
|
251
|
-
id: "r12",
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
date: "2019-10-24",
|
|
255
|
-
expectedQuantity: "2,475 eaches",
|
|
256
|
-
actualQuantity: "-",
|
|
257
|
-
id: "r13",
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
date: "2019-10-24",
|
|
261
|
-
expectedQuantity: "2,475 eaches",
|
|
262
|
-
actualQuantity: "-",
|
|
263
|
-
id: "r14",
|
|
185
|
+
export const WithEverything = {
|
|
186
|
+
args: {
|
|
187
|
+
columns: columnsWithEverything,
|
|
188
|
+
rows: rowDataWithEverything,
|
|
189
|
+
footerRows: footerRowData,
|
|
190
|
+
rowsPerPage: 5,
|
|
191
|
+
hasExpandableRows: true,
|
|
192
|
+
onRowExpansionChange: action("toggled expand"),
|
|
193
|
+
hasSelectableRows: true,
|
|
194
|
+
onRowSelectionChange: action("row selection changed"),
|
|
195
|
+
onPageChange: action("page changed"),
|
|
196
|
+
className: "Table",
|
|
197
|
+
onRowMouseEnter: action("row mouse enter"),
|
|
198
|
+
onRowMouseLeave: action("row mouse leave"),
|
|
199
|
+
},
|
|
200
|
+
argTypes: {
|
|
201
|
+
rowsPerPage: {
|
|
202
|
+
control: { type: "number" },
|
|
264
203
|
},
|
|
265
|
-
{
|
|
266
|
-
|
|
267
|
-
expectedQuantity: "2,475 eaches",
|
|
268
|
-
actualQuantity: "-",
|
|
269
|
-
id: "r15",
|
|
204
|
+
hasExpandableRows: {
|
|
205
|
+
control: { type: "boolean" },
|
|
270
206
|
},
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return (React.createElement(Box, { textAlign: "right", pr: "x3", width: "40px" }, row.id === hoveredRow && (React.createElement(DropdownMenu, null,
|
|
274
|
-
React.createElement(DropdownButton, { onClick: action(cellData) }, "Edit"),
|
|
275
|
-
React.createElement(DropdownButton, { onClick: action(cellData) }, "Delete")))));
|
|
276
|
-
};
|
|
277
|
-
const columnsWithHovers = [
|
|
278
|
-
{
|
|
279
|
-
label: "Date",
|
|
280
|
-
dataKey: "date",
|
|
281
|
-
cellFormatter: dateToString,
|
|
282
|
-
width: "15%",
|
|
207
|
+
hasSelectableRows: {
|
|
208
|
+
control: { type: "boolean" },
|
|
283
209
|
},
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
210
|
+
},
|
|
211
|
+
name: "with everything",
|
|
212
|
+
};
|
|
213
|
+
export const WithOnHoverActions = {
|
|
214
|
+
render: (args) => {
|
|
215
|
+
const rowDataWithHovers = [
|
|
216
|
+
{
|
|
217
|
+
date: "2019-10-01",
|
|
218
|
+
expectedQuantity: "2,025 eaches",
|
|
219
|
+
actualQuantity: "1,800 eaches",
|
|
220
|
+
id: "r1",
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
date: "2019-10-01",
|
|
224
|
+
expectedQuantity: "2,025 eaches",
|
|
225
|
+
actualQuantity: "1,800 eaches",
|
|
226
|
+
id: "r2",
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
date: "2019-10-02",
|
|
230
|
+
expectedQuantity: "2,475 eaches",
|
|
231
|
+
actualQuantity: "2,250 eaches",
|
|
232
|
+
id: "r3",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
date: "2019-10-03",
|
|
236
|
+
expectedQuantity: "2,475 eaches",
|
|
237
|
+
actualQuantity: "1,425 eaches",
|
|
238
|
+
id: "r4",
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
date: "2019-10-04",
|
|
242
|
+
expectedQuantity: "2,475 eaches",
|
|
243
|
+
actualQuantity: "675 eaches",
|
|
244
|
+
note: "1c Other Plant-related issue, equipment issues",
|
|
245
|
+
id: "r5",
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
date: "2019-10-07",
|
|
249
|
+
expectedQuantity: "2,475 eaches",
|
|
250
|
+
actualQuantity: "1,575 eaches",
|
|
251
|
+
id: "r6",
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
date: "2019-10-22",
|
|
255
|
+
expectedQuantity: "1,725 eaches",
|
|
256
|
+
actualQuantity: "-",
|
|
257
|
+
id: "r7",
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
date: "2019-10-23",
|
|
261
|
+
expectedQuantity: "2,475 eaches",
|
|
262
|
+
actualQuantity: "-",
|
|
263
|
+
id: "r8",
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
date: "2019-10-23",
|
|
267
|
+
expectedQuantity: "2,475 eaches",
|
|
268
|
+
actualQuantity: "-",
|
|
269
|
+
id: "r9",
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
date: "2019-10-24",
|
|
273
|
+
expectedQuantity: "2,475 eaches",
|
|
274
|
+
actualQuantity: "-",
|
|
275
|
+
id: "r10",
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
date: "2019-10-23",
|
|
279
|
+
expectedQuantity: "2,475 eaches",
|
|
280
|
+
actualQuantity: "-",
|
|
281
|
+
id: "r11",
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
date: "2019-10-23",
|
|
285
|
+
expectedQuantity: "2,475 eaches",
|
|
286
|
+
actualQuantity: "-",
|
|
287
|
+
id: "r12",
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
date: "2019-10-24",
|
|
291
|
+
expectedQuantity: "2,475 eaches",
|
|
292
|
+
actualQuantity: "-",
|
|
293
|
+
id: "r13",
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
date: "2019-10-24",
|
|
297
|
+
expectedQuantity: "2,475 eaches",
|
|
298
|
+
actualQuantity: "-",
|
|
299
|
+
id: "r14",
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
date: "2019-10-24",
|
|
303
|
+
expectedQuantity: "2,475 eaches",
|
|
304
|
+
actualQuantity: "-",
|
|
305
|
+
id: "r15",
|
|
306
|
+
},
|
|
307
|
+
];
|
|
308
|
+
const [hoveredRow, setHoveredRow] = useState(null);
|
|
309
|
+
const dropdownCellRendererWithHover = ({ cellData, row }) => {
|
|
310
|
+
return (React.createElement(Box, { textAlign: "right", pr: "x3", width: "40px" }, row.id === hoveredRow && (React.createElement(DropdownMenu, null,
|
|
311
|
+
React.createElement(DropdownButton, { onClick: action(cellData) }, "Edit"),
|
|
312
|
+
React.createElement(DropdownButton, { onClick: action(cellData) }, "Delete")))));
|
|
313
|
+
};
|
|
314
|
+
const columnsWithHovers = [
|
|
315
|
+
{
|
|
316
|
+
label: "Date",
|
|
317
|
+
dataKey: "date",
|
|
318
|
+
cellFormatter: dateToString,
|
|
319
|
+
width: "15%",
|
|
320
|
+
},
|
|
321
|
+
{ label: "Expected Quantity", dataKey: "expectedQuantity", width: "20%" },
|
|
322
|
+
{ label: "Actual Quantity", dataKey: "actualQuantity", width: "20%" },
|
|
323
|
+
{ label: "Note", dataKey: "note", width: "45%" },
|
|
324
|
+
{
|
|
325
|
+
label: "",
|
|
326
|
+
dataKey: "actions",
|
|
327
|
+
width: "100px",
|
|
328
|
+
cellRenderer: dropdownCellRendererWithHover,
|
|
329
|
+
},
|
|
330
|
+
];
|
|
331
|
+
const onMouseEnter = ({ row }) => {
|
|
332
|
+
setHoveredRow(row.id);
|
|
333
|
+
};
|
|
334
|
+
const onMouseLeave = () => {
|
|
335
|
+
setHoveredRow(null);
|
|
336
|
+
};
|
|
337
|
+
return (React.createElement(Table, { columns: columnsWithHovers, rows: rowDataWithHovers, footerRows: footerRowData, hasSelectableRows: args.hasSelectableRows, onRowSelectionChange: action("row selection changed"), className: "Table", onRowMouseEnter: onMouseEnter, onRowMouseLeave: onMouseLeave, onMouseLeave: onMouseLeave }));
|
|
338
|
+
},
|
|
339
|
+
args: {
|
|
340
|
+
hasSelectableRows: true,
|
|
341
|
+
},
|
|
342
|
+
argTypes: {
|
|
343
|
+
hasSelectableRows: {
|
|
344
|
+
control: { type: "boolean" },
|
|
292
345
|
},
|
|
293
|
-
|
|
294
|
-
const [hoveredRow, setHoveredRow] = useState(null);
|
|
295
|
-
const onMouseEnter = ({ row }) => {
|
|
296
|
-
setHoveredRow(row.id);
|
|
297
|
-
};
|
|
298
|
-
const onMouseLeave = () => {
|
|
299
|
-
setHoveredRow(null);
|
|
300
|
-
};
|
|
301
|
-
return (React.createElement(Table, { columns: columnsWithHovers, rows: rowDataWithHovers, footerRows: footerRowData, hasSelectableRows: boolean("Selectable", true), onRowSelectionChange: action("row selection changed"), className: "Table", onRowMouseEnter: onMouseEnter, onRowMouseLeave: onMouseLeave, onMouseLeave: onMouseLeave }));
|
|
346
|
+
},
|
|
302
347
|
};
|
|
@@ -46,7 +46,10 @@ const TableWithCustomSorting = () => {
|
|
|
46
46
|
};
|
|
47
47
|
const transformColumn = (column) => {
|
|
48
48
|
const isAscending = sortState.ascending && column.dataKey === sortState.sortColumn;
|
|
49
|
-
return
|
|
49
|
+
return {
|
|
50
|
+
...column,
|
|
51
|
+
headerFormatter: ({ label, dataKey }) => (React.createElement(Table.SortingHeader, { onChange: () => onSortChange(dataKey), label: label, ascending: isAscending, active: dataKey === sortState.sortColumn })),
|
|
52
|
+
};
|
|
50
53
|
};
|
|
51
54
|
const columns = COLUMNS.map((column) => transformColumn(column));
|
|
52
55
|
return React.createElement(Table, { columns: columns, rows: rows, keyField: KEY_FIELD });
|
|
@@ -17,7 +17,10 @@ const ROWS = [
|
|
|
17
17
|
{ name: "F. Scott Fitzgerald", description: "author" },
|
|
18
18
|
];
|
|
19
19
|
const transformColumn = (column, onChange) => {
|
|
20
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
...column,
|
|
22
|
+
headerFormatter: ({ label, dataKey }) => (React.createElement(ColumnHeaderWithFilter, { onChange: (e) => onChange(dataKey, e), label: label })),
|
|
23
|
+
};
|
|
21
24
|
};
|
|
22
25
|
const ColumnHeaderWithFilter = ({ onChange, label }) => (React.createElement(Input, { labelText: `Filter by ${label}`, onChange: onChange, name: label }));
|
|
23
26
|
const TableWithFilters = ({ rowsPerPage }) => {
|
|
@@ -36,7 +39,10 @@ const TableWithFilters = ({ rowsPerPage }) => {
|
|
|
36
39
|
}, [filter]);
|
|
37
40
|
const onFilterInputChange = (dataKey, e) => {
|
|
38
41
|
const filterValue = e.currentTarget.value;
|
|
39
|
-
return setFilter((state) => (
|
|
42
|
+
return setFilter((state) => ({
|
|
43
|
+
...state,
|
|
44
|
+
[dataKey]: filterValue,
|
|
45
|
+
}));
|
|
40
46
|
};
|
|
41
47
|
const columns = COLUMNS.map((column) => transformColumn(column, onFilterInputChange));
|
|
42
48
|
return React.createElement(Table, { columns: columns, rows: rows, keyField: "name", rowsPerPage: rowsPerPage });
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import { Table } from "../..";
|
|
14
3
|
import { Pagination } from "../../Pagination";
|
|
@@ -29,10 +18,10 @@ class TableWithServerSidePagination extends React.Component {
|
|
|
29
18
|
.then((json) => {
|
|
30
19
|
this.setState({
|
|
31
20
|
loading: false,
|
|
32
|
-
rows: json.map((
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}),
|
|
21
|
+
rows: json.map(({ completed, ...item }) => ({
|
|
22
|
+
...item,
|
|
23
|
+
completed: completed ? "Yes" : "-",
|
|
24
|
+
})),
|
|
36
25
|
}, callback);
|
|
37
26
|
});
|
|
38
27
|
};
|