@oliasoft-open-source/react-ui-library 3.12.0-beta-20 → 3.12.0-beta-21
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/dist/common-enum.d.ts +73 -0
- package/dist/common-enum.js +81 -0
- package/dist/components/accordion/accordion.d.ts +4 -0
- package/dist/components/accordion/accordion.interface.d.ts +17 -0
- package/dist/components/accordion/accordion.interface.js +1 -0
- package/dist/components/accordion/accordion.js +17 -0
- package/dist/components/accordion/accordion.stories.d.ts +11 -0
- package/dist/components/accordion/accordion.stories.js +140 -0
- package/dist/components/accordion/chevron/chevron.d.ts +5 -0
- package/dist/components/accordion/chevron/chevron.js +8 -0
- package/dist/components/accordion/enum.d.ts +4 -0
- package/dist/components/accordion/enum.js +5 -0
- package/dist/components/accordion/helpers/accordion-with-default-toggle.d.ts +12 -0
- package/dist/components/accordion/helpers/accordion-with-default-toggle.js +35 -0
- package/dist/components/actions/actions.d.ts +14 -0
- package/dist/components/actions/actions.interface.d.ts +25 -0
- package/dist/components/actions/actions.interface.js +1 -0
- package/dist/components/actions/actions.js +66 -0
- package/dist/components/actions/actions.stories.d.ts +25 -0
- package/dist/components/actions/actions.stories.js +67 -0
- package/dist/components/badge/badge.d.ts +10 -0
- package/dist/components/badge/badge.js +21 -0
- package/dist/components/badge/badge.stories.d.ts +7 -0
- package/dist/components/badge/badge.stories.js +21 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +6 -0
- package/dist/components/breadcrumb/breadcrumb.js +11 -0
- package/dist/components/breadcrumb/breadcrumb.stories.d.ts +5 -0
- package/dist/components/breadcrumb/breadcrumb.stories.js +36 -0
- package/dist/components/breadcrumb/enum.d.ts +5 -0
- package/dist/components/breadcrumb/enum.js +6 -0
- package/dist/components/breadcrumb/link.d.ts +12 -0
- package/dist/components/breadcrumb/link.js +12 -0
- package/dist/components/button/button.d.ts +31 -0
- package/dist/components/button/button.js +52 -0
- package/dist/components/button/button.stories.d.ts +13 -0
- package/dist/components/button/button.stories.js +63 -0
- package/dist/components/button/enum.d.ts +5 -0
- package/dist/components/button/enum.js +6 -0
- package/dist/components/button-group/button-group.d.ts +38 -0
- package/dist/components/button-group/button-group.js +83 -0
- package/dist/components/button-group/button-group.stories-data.d.ts +6 -0
- package/dist/components/button-group/button-group.stories-data.js +61 -0
- package/dist/components/button-group/button-group.stories.d.ts +9 -0
- package/dist/components/button-group/button-group.stories.js +51 -0
- package/dist/components/card/card.d.ts +10 -0
- package/dist/components/card/card.js +6 -0
- package/dist/components/card/card.stories.d.ts +8 -0
- package/dist/components/card/card.stories.js +27 -0
- package/dist/components/check-box/check-box.d.ts +19 -0
- package/dist/components/check-box/check-box.js +19 -0
- package/dist/components/check-box/check-box.stories.d.ts +6 -0
- package/dist/components/check-box/check-box.stories.js +29 -0
- package/dist/components/color/color.stories-data.d.ts +9 -0
- package/dist/components/color/color.stories-data.js +55 -0
- package/dist/components/dialog/dialog.d.ts +17 -0
- package/dist/components/dialog/dialog.js +18 -0
- package/dist/components/divider/divider.d.ts +9 -0
- package/dist/components/divider/divider.js +19 -0
- package/dist/components/divider/divider.stories.d.ts +7 -0
- package/dist/components/divider/divider.stories.js +41 -0
- package/dist/components/drawer/drawer-resize-wrapper.d.ts +2 -0
- package/dist/components/drawer/drawer-resize-wrapper.js +33 -0
- package/dist/components/drawer/drawer-tabs.d.ts +2 -0
- package/dist/components/drawer/drawer-tabs.js +15 -0
- package/dist/components/drawer/drawer.constants.d.ts +2 -0
- package/dist/components/drawer/drawer.constants.js +2 -0
- package/dist/components/drawer/drawer.d.ts +2 -0
- package/dist/components/drawer/drawer.interface.d.ts +55 -0
- package/dist/components/drawer/drawer.interface.js +1 -0
- package/dist/components/drawer/drawer.js +80 -0
- package/dist/components/drawer/drawer.stories.d.ts +40 -0
- package/dist/components/drawer/drawer.stories.js +176 -0
- package/dist/components/empty/empty.d.ts +8 -0
- package/dist/components/empty/empty.js +6 -0
- package/dist/components/empty/empty.stories.d.ts +5 -0
- package/dist/components/empty/empty.stories.js +19 -0
- package/dist/components/file-input/enum.d.ts +6 -0
- package/dist/components/file-input/enum.js +7 -0
- package/dist/components/file-input/file-input.d.ts +18 -0
- package/dist/components/file-input/file-input.js +47 -0
- package/dist/components/file-input/file-input.stories.d.ts +7 -0
- package/dist/components/file-input/file-input.stories.js +65 -0
- package/dist/components/form/field.d.ts +16 -0
- package/dist/components/form/field.js +13 -0
- package/dist/components/form/field.stories.d.ts +12 -0
- package/dist/components/form/field.stories.js +51 -0
- package/dist/components/form/form.stories.d.ts +27 -0
- package/dist/components/form/form.stories.js +76 -0
- package/dist/components/heading/heading.d.ts +19 -0
- package/dist/components/heading/heading.js +9 -0
- package/dist/components/heading/heading.stories.d.ts +10 -0
- package/dist/components/heading/heading.stories.js +46 -0
- package/dist/components/help-icon/help-icon.d.ts +10 -0
- package/dist/components/help-icon/help-icon.js +19 -0
- package/dist/components/help-icon/help-icon.stories.d.ts +10 -0
- package/dist/components/help-icon/help-icon.stories.js +37 -0
- package/dist/components/icon/icon.d.ts +16 -0
- package/dist/components/icon/icon.js +31 -0
- package/dist/components/icon/icon.stories.d.ts +25 -0
- package/dist/components/icon/icon.stories.js +37 -0
- package/dist/components/icon/named-icon.d.ts +6 -0
- package/dist/components/icon/named-icon.js +418 -0
- package/dist/components/input/input.d.ts +26 -0
- package/dist/components/input/input.js +40 -0
- package/dist/components/input/input.stories.d.ts +5 -0
- package/dist/components/input/input.stories.js +22 -0
- package/dist/components/input-group/input-group-addon/input-group-addon.d.ts +8 -0
- package/dist/components/input-group/input-group-addon/input-group-addon.js +20 -0
- package/dist/components/input-group/input-group.d.ts +7 -0
- package/dist/components/input-group/input-group.js +27 -0
- package/dist/components/input-group/input-group.stories.d.ts +8 -0
- package/dist/components/input-group/input-group.stories.js +65 -0
- package/dist/components/label/label.d.ts +24 -0
- package/dist/components/label/label.js +14 -0
- package/dist/components/label/label.stories.d.ts +10 -0
- package/dist/components/label/label.stories.js +42 -0
- package/dist/components/layout/column/column.d.ts +18 -0
- package/dist/components/layout/column/column.js +13 -0
- package/dist/components/layout/column/styles.d.ts +15 -0
- package/dist/components/layout/column/styles.js +41 -0
- package/dist/components/layout/column.stories.d.ts +20 -0
- package/dist/components/layout/column.stories.js +53 -0
- package/dist/components/layout/flex/flex.d.ts +11 -0
- package/dist/components/layout/flex/flex.js +18 -0
- package/dist/components/layout/flex/flex.stories.d.ts +10 -0
- package/dist/components/layout/flex/flex.stories.js +52 -0
- package/dist/components/layout/form-row/form-row.d.ts +5 -0
- package/dist/components/layout/form-row/form-row.js +5 -0
- package/dist/components/layout/grid/grid.d.ts +11 -0
- package/dist/components/layout/grid/grid.js +41 -0
- package/dist/components/layout/grid/grid.stories.d.ts +9 -0
- package/dist/components/layout/grid/grid.stories.js +48 -0
- package/dist/components/layout/page/page.d.ts +9 -0
- package/dist/components/layout/page/page.js +11 -0
- package/dist/components/layout/page.stories.d.ts +9 -0
- package/dist/components/layout/page.stories.js +32 -0
- package/dist/components/layout/placeholder.d.ts +1 -0
- package/dist/components/layout/placeholder.js +1 -0
- package/dist/components/layout/print-header/print-header.d.ts +7 -0
- package/dist/components/layout/print-header/print-header.js +3 -0
- package/dist/components/layout/row/row.d.ts +15 -0
- package/dist/components/layout/row/row.js +24 -0
- package/dist/components/layout/spacer/spacer.d.ts +6 -0
- package/dist/components/layout/spacer/spacer.js +8 -0
- package/dist/components/list/list-row/item-content.d.ts +2 -0
- package/dist/components/list/list-row/item-content.js +9 -0
- package/dist/components/list/list-row/label.d.ts +2 -0
- package/dist/components/list/list-row/label.js +6 -0
- package/dist/components/list/list-row/list-heading.d.ts +3 -0
- package/dist/components/list/list-row/list-heading.js +10 -0
- package/dist/components/list/list-row/list-row.d.ts +3 -0
- package/dist/components/list/list-row/list-row.interface.d.ts +105 -0
- package/dist/components/list/list-row/list-row.interface.js +1 -0
- package/dist/components/list/list-row/list-row.js +56 -0
- package/dist/components/list/list-row/list-subheading.d.ts +3 -0
- package/dist/components/list/list-row/list-subheading.js +27 -0
- package/dist/components/list/list-row/meta-content.d.ts +2 -0
- package/dist/components/list/list-row/meta-content.js +12 -0
- package/dist/components/list/list-row/meta-count.d.ts +2 -0
- package/dist/components/list/list-row/meta-count.js +5 -0
- package/dist/components/list/list-row/name.d.ts +3 -0
- package/dist/components/list/list-row/name.js +12 -0
- package/dist/components/list/list.d.ts +2 -0
- package/dist/components/list/list.interface.d.ts +55 -0
- package/dist/components/list/list.interface.js +1 -0
- package/dist/components/list/list.js +86 -0
- package/dist/components/list/list.stories-data.d.ts +310 -0
- package/dist/components/list/list.stories-data.js +270 -0
- package/dist/components/list/list.stories.d.ts +22 -0
- package/dist/components/list/list.stories.js +411 -0
- package/dist/components/list/toggle-narrow.d.ts +2 -0
- package/dist/components/list/toggle-narrow.js +7 -0
- package/dist/components/loader/loader.d.ts +14 -0
- package/dist/components/loader/loader.js +15 -0
- package/dist/components/loader/loader.stories.d.ts +32 -0
- package/dist/components/loader/loader.stories.js +92 -0
- package/dist/components/menu/enum.d.ts +11 -0
- package/dist/components/menu/enum.js +13 -0
- package/dist/components/menu/index.d.ts +4 -0
- package/dist/components/menu/index.js +8 -0
- package/dist/components/menu/layer/divider.d.ts +1 -0
- package/dist/components/menu/layer/divider.js +3 -0
- package/dist/components/menu/layer/heading.d.ts +8 -0
- package/dist/components/menu/layer/heading.js +3 -0
- package/dist/components/menu/layer/layer.d.ts +15 -0
- package/dist/components/menu/layer/layer.js +47 -0
- package/dist/components/menu/layer/option.d.ts +19 -0
- package/dist/components/menu/layer/option.js +22 -0
- package/dist/components/menu/layer/path.d.ts +5 -0
- package/dist/components/menu/layer/path.js +30 -0
- package/dist/components/menu/layer/placementOptions.d.ts +3 -0
- package/dist/components/menu/layer/placementOptions.js +6 -0
- package/dist/components/menu/layer/section.d.ts +10 -0
- package/dist/components/menu/layer/section.js +23 -0
- package/dist/components/menu/menu.d.ts +3 -0
- package/dist/components/menu/menu.interface.d.ts +82 -0
- package/dist/components/menu/menu.interface.js +1 -0
- package/dist/components/menu/menu.js +92 -0
- package/dist/components/menu/menu.stories-data.d.ts +101 -0
- package/dist/components/menu/menu.stories-data.js +182 -0
- package/dist/components/menu/menu.stories.d.ts +31 -0
- package/dist/components/menu/menu.stories.js +104 -0
- package/dist/components/menu/menu.test.d.ts +1 -0
- package/dist/components/menu/menu.test.js +46 -0
- package/dist/components/menu/trigger/button.d.ts +14 -0
- package/dist/components/menu/trigger/button.js +13 -0
- package/dist/components/menu/trigger/component.d.ts +8 -0
- package/dist/components/menu/trigger/component.js +6 -0
- package/dist/components/menu/trigger/text.d.ts +10 -0
- package/dist/components/menu/trigger/text.js +9 -0
- package/dist/components/menu/trigger/trigger.d.ts +27 -0
- package/dist/components/menu/trigger/trigger.js +35 -0
- package/dist/components/message/dismiss.d.ts +8 -0
- package/dist/components/message/dismiss.js +17 -0
- package/dist/components/message/enum.d.ts +9 -0
- package/dist/components/message/enum.js +11 -0
- package/dist/components/message/message.d.ts +19 -0
- package/dist/components/message/message.js +49 -0
- package/dist/components/message/message.stories.d.ts +11 -0
- package/dist/components/message/message.stories.js +82 -0
- package/dist/components/modal/modal.d.ts +8 -0
- package/dist/components/modal/modal.js +7 -0
- package/dist/components/modal/modal.stories.d.ts +12 -0
- package/dist/components/modal/modal.stories.js +107 -0
- package/dist/components/number-input/number-input.d.ts +26 -0
- package/dist/components/number-input/number-input.js +66 -0
- package/dist/components/number-input/number-input.stories.d.ts +13 -0
- package/dist/components/number-input/number-input.stories.js +43 -0
- package/dist/components/option-dropdown/enum.d.ts +5 -0
- package/dist/components/option-dropdown/enum.js +6 -0
- package/dist/components/option-dropdown/heading.d.ts +4 -0
- package/dist/components/option-dropdown/heading.js +3 -0
- package/dist/components/option-dropdown/layer.d.ts +16 -0
- package/dist/components/option-dropdown/layer.js +43 -0
- package/dist/components/option-dropdown/option-dropdown.d.ts +19 -0
- package/dist/components/option-dropdown/option-dropdown.js +17 -0
- package/dist/components/option-dropdown/option-dropdown.stories.d.ts +5 -0
- package/dist/components/option-dropdown/option-dropdown.stories.js +35 -0
- package/dist/components/option-dropdown/option.d.ts +10 -0
- package/dist/components/option-dropdown/option.js +7 -0
- package/dist/components/pagination/pagination.d.ts +13 -0
- package/dist/components/pagination/pagination.interface.d.ts +15 -0
- package/dist/components/pagination/pagination.interface.js +1 -0
- package/dist/components/pagination/pagination.js +33 -0
- package/dist/components/pagination/pagination.stories.d.ts +7 -0
- package/dist/components/pagination/pagination.stories.js +62 -0
- package/dist/components/pagination/pagination.test.d.ts +1 -0
- package/dist/components/pagination/pagination.test.js +84 -0
- package/dist/components/pagination/pagination.viewdata.d.ts +17 -0
- package/dist/components/pagination/pagination.viewdata.js +53 -0
- package/dist/components/pop-confirm/content.d.ts +9 -0
- package/dist/components/pop-confirm/content.js +5 -0
- package/dist/components/pop-confirm/pop-confirm.d.ts +14 -0
- package/dist/components/pop-confirm/pop-confirm.js +7 -0
- package/dist/components/pop-confirm/pop-confirm.stories.d.ts +4 -0
- package/dist/components/pop-confirm/pop-confirm.stories.js +43 -0
- package/dist/components/popover/popover.d.ts +14 -0
- package/dist/components/popover/popover.js +39 -0
- package/dist/components/popover/popover.stories.d.ts +7 -0
- package/dist/components/popover/popover.stories.js +43 -0
- package/dist/components/portal/portal.d.ts +6 -0
- package/dist/components/portal/portal.js +11 -0
- package/dist/components/portal/portal.stories.d.ts +7 -0
- package/dist/components/portal/portal.stories.js +51 -0
- package/dist/components/progress-bar/progress-bar.d.ts +9 -0
- package/dist/components/progress-bar/progress-bar.js +21 -0
- package/dist/components/progress-bar/progress-bar.stories.d.ts +4 -0
- package/dist/components/progress-bar/progress-bar.stories.js +16 -0
- package/dist/components/radio-button/radio-button.d.ts +27 -0
- package/dist/components/radio-button/radio-button.js +45 -0
- package/dist/components/radio-button/radio-button.stories.d.ts +5 -0
- package/dist/components/radio-button/radio-button.stories.js +45 -0
- package/dist/components/radio-button/radio-input.d.ts +16 -0
- package/dist/components/radio-button/radio-input.js +9 -0
- package/dist/components/rich-text-input/rich-text-input.d.ts +10 -0
- package/dist/components/rich-text-input/rich-text-input.js +35 -0
- package/dist/components/rich-text-input/rich-text-input.stories.d.ts +9 -0
- package/dist/components/rich-text-input/rich-text-input.stories.js +60 -0
- package/dist/components/rich-text-input/rich-text-toolbar/enum.d.ts +7 -0
- package/dist/components/rich-text-input/rich-text-toolbar/enum.js +8 -0
- package/dist/components/rich-text-input/rich-text-toolbar/rich-text-toolbar.d.ts +7 -0
- package/dist/components/rich-text-input/rich-text-toolbar/rich-text-toolbar.js +42 -0
- package/dist/components/select/custom-select/custom-select.d.ts +2 -0
- package/dist/components/select/custom-select/custom-select.interface.d.ts +47 -0
- package/dist/components/select/custom-select/custom-select.interface.js +1 -0
- package/dist/components/select/custom-select/custom-select.js +51 -0
- package/dist/components/select/custom-select/custom-select.reducer.d.ts +6 -0
- package/dist/components/select/custom-select/custom-select.reducer.js +140 -0
- package/dist/components/select/custom-select/enum.d.ts +11 -0
- package/dist/components/select/custom-select/enum.js +12 -0
- package/dist/components/select/custom-select/helper.d.ts +3 -0
- package/dist/components/select/custom-select/helper.js +55 -0
- package/dist/components/select/custom-select/hooks/enum.d.ts +20 -0
- package/dist/components/select/custom-select/hooks/enum.js +22 -0
- package/dist/components/select/custom-select/hooks/use-custom-select-logic.d.ts +39 -0
- package/dist/components/select/custom-select/hooks/use-custom-select-logic.js +222 -0
- package/dist/components/select/custom-select/layer/heading.d.ts +3 -0
- package/dist/components/select/custom-select/layer/heading.js +5 -0
- package/dist/components/select/custom-select/layer/layer.d.ts +17 -0
- package/dist/components/select/custom-select/layer/layer.js +25 -0
- package/dist/components/select/custom-select/layer/option.d.ts +15 -0
- package/dist/components/select/custom-select/layer/option.js +10 -0
- package/dist/components/select/custom-select/layer/placementOptions.d.ts +10 -0
- package/dist/components/select/custom-select/layer/placementOptions.js +7 -0
- package/dist/components/select/custom-select/layer/section.d.ts +15 -0
- package/dist/components/select/custom-select/layer/section.js +16 -0
- package/dist/components/select/custom-select/reducer.interface.d.ts +34 -0
- package/dist/components/select/custom-select/reducer.interface.js +1 -0
- package/dist/components/select/custom-select/trigger/input.d.ts +14 -0
- package/dist/components/select/custom-select/trigger/input.js +21 -0
- package/dist/components/select/custom-select/trigger/multi-selected-options.d.ts +8 -0
- package/dist/components/select/custom-select/trigger/multi-selected-options.js +41 -0
- package/dist/components/select/custom-select/trigger/trigger.d.ts +34 -0
- package/dist/components/select/custom-select/trigger/trigger.js +53 -0
- package/dist/components/select/native-select/native-select.d.ts +29 -0
- package/dist/components/select/native-select/native-select.js +61 -0
- package/dist/components/select/select.d.ts +2 -0
- package/dist/components/select/select.input.d.ts +21 -0
- package/dist/components/select/select.input.js +114 -0
- package/dist/components/select/select.interface.d.ts +39 -0
- package/dist/components/select/select.interface.js +1 -0
- package/dist/components/select/select.js +61 -0
- package/dist/components/select/select.stories-data.d.ts +25 -0
- package/dist/components/select/select.stories-data.js +113 -0
- package/dist/components/select/select.stories.d.ts +30 -0
- package/dist/components/select/select.stories.js +93 -0
- package/dist/components/select/select.test.d.ts +1 -0
- package/dist/components/select/select.test.js +303 -0
- package/dist/components/side-bar/link.d.ts +17 -0
- package/dist/components/side-bar/link.js +20 -0
- package/dist/components/side-bar/sections.d.ts +21 -0
- package/dist/components/side-bar/sections.js +7 -0
- package/dist/components/side-bar/side-bar.d.ts +26 -0
- package/dist/components/side-bar/side-bar.js +28 -0
- package/dist/components/side-bar/side-bar.stories.d.ts +5 -0
- package/dist/components/side-bar/side-bar.stories.js +90 -0
- package/dist/components/slider/slider-tooltip.d.ts +5 -0
- package/dist/components/slider/slider-tooltip.js +13 -0
- package/dist/components/slider/slider.d.ts +37 -0
- package/dist/components/slider/slider.js +57 -0
- package/dist/components/slider/slider.stories.d.ts +16 -0
- package/dist/components/slider/slider.stories.js +85 -0
- package/dist/components/spinner/spinner.d.ts +7 -0
- package/dist/components/spinner/spinner.js +6 -0
- package/dist/components/spinner/spinner.stories.d.ts +4 -0
- package/dist/components/spinner/spinner.stories.js +14 -0
- package/dist/components/table/cell/cell-types/action-cell.d.ts +5 -0
- package/dist/components/table/cell/cell-types/action-cell.js +5 -0
- package/dist/components/table/cell/cell-types/cell-help-icon.d.ts +5 -0
- package/dist/components/table/cell/cell-types/cell-help-icon.js +7 -0
- package/dist/components/table/cell/cell-types/cell-library-icon.d.ts +5 -0
- package/dist/components/table/cell/cell-types/cell-library-icon.js +8 -0
- package/dist/components/table/cell/cell-types/cell-types.interface.d.ts +150 -0
- package/dist/components/table/cell/cell-types/cell-types.interface.js +1 -0
- package/dist/components/table/cell/cell-types/check-box-cell.d.ts +7 -0
- package/dist/components/table/cell/cell-types/check-box-cell.js +5 -0
- package/dist/components/table/cell/cell-types/icon-cell.d.ts +5 -0
- package/dist/components/table/cell/cell-types/icon-cell.js +9 -0
- package/dist/components/table/cell/cell-types/input-cell.d.ts +8 -0
- package/dist/components/table/cell/cell-types/input-cell.js +6 -0
- package/dist/components/table/cell/cell-types/link-cell.d.ts +7 -0
- package/dist/components/table/cell/cell-types/link-cell.js +23 -0
- package/dist/components/table/cell/cell-types/number-input-cell.d.ts +7 -0
- package/dist/components/table/cell/cell-types/number-input-cell.js +5 -0
- package/dist/components/table/cell/cell-types/popover-cell.d.ts +6 -0
- package/dist/components/table/cell/cell-types/popover-cell.js +8 -0
- package/dist/components/table/cell/cell-types/select-cell.d.ts +8 -0
- package/dist/components/table/cell/cell-types/select-cell.js +6 -0
- package/dist/components/table/cell/cell-types/slider-cell.d.ts +6 -0
- package/dist/components/table/cell/cell-types/slider-cell.js +6 -0
- package/dist/components/table/cell/cell-types/sort-cell.d.ts +5 -0
- package/dist/components/table/cell/cell-types/sort-cell.js +9 -0
- package/dist/components/table/cell/cell-types/static-cell.d.ts +7 -0
- package/dist/components/table/cell/cell-types/static-cell.js +16 -0
- package/dist/components/table/cell/cell-wrapper.d.ts +8 -0
- package/dist/components/table/cell/cell-wrapper.js +33 -0
- package/dist/components/table/cell/cell.d.ts +12 -0
- package/dist/components/table/cell/cell.js +45 -0
- package/dist/components/table/cell/cell.stories.d.ts +21 -0
- package/dist/components/table/cell/cell.stories.js +209 -0
- package/dist/components/table/cell/input-cell-wrapper.d.ts +7 -0
- package/dist/components/table/cell/input-cell-wrapper.js +8 -0
- package/dist/components/table/enum.d.ts +9 -0
- package/dist/components/table/enum.js +10 -0
- package/dist/components/table/footer/footer.d.ts +10 -0
- package/dist/components/table/footer/footer.js +18 -0
- package/dist/components/table/footer/footer.stories.d.ts +3 -0
- package/dist/components/table/footer/footer.stories.js +19 -0
- package/dist/components/table/helper.d.ts +22 -0
- package/dist/components/table/helper.js +49 -0
- package/dist/components/table/helper.test.d.ts +1 -0
- package/dist/components/table/helper.test.js +127 -0
- package/dist/components/table/row/expanded-content-row.d.ts +7 -0
- package/dist/components/table/row/expanded-content-row.js +6 -0
- package/dist/components/table/row/row.d.ts +37 -0
- package/dist/components/table/row/row.js +46 -0
- package/dist/components/table/row/row.stories.d.ts +9 -0
- package/dist/components/table/row/row.stories.js +132 -0
- package/dist/components/table/table-scroll-wrapper.d.ts +13 -0
- package/dist/components/table/table-scroll-wrapper.js +24 -0
- package/dist/components/table/table.d.ts +34 -0
- package/dist/components/table/table.js +91 -0
- package/dist/components/table/table.stories-data.d.ts +1970 -0
- package/dist/components/table/table.stories-data.js +996 -0
- package/dist/components/table/table.stories.d.ts +17 -0
- package/dist/components/table/table.stories.js +521 -0
- package/dist/components/table/table.test.d.ts +1 -0
- package/dist/components/table/table.test.js +27 -0
- package/dist/components/table/table.viewdata.d.ts +16 -0
- package/dist/components/table/table.viewdata.js +17 -0
- package/dist/components/table/title/title.d.ts +8 -0
- package/dist/components/table/title/title.js +22 -0
- package/dist/components/table/title/title.stories.d.ts +11 -0
- package/dist/components/table/title/title.stories.js +53 -0
- package/dist/components/tabs/content.d.ts +7 -0
- package/dist/components/tabs/content.js +6 -0
- package/dist/components/tabs/label.d.ts +14 -0
- package/dist/components/tabs/label.js +8 -0
- package/dist/components/tabs/tabs.d.ts +33 -0
- package/dist/components/tabs/tabs.js +64 -0
- package/dist/components/tabs/tabs.stories.d.ts +10 -0
- package/dist/components/tabs/tabs.stories.js +86 -0
- package/dist/components/text/text.d.ts +15 -0
- package/dist/components/text/text.js +6 -0
- package/dist/components/text/text.stories.d.ts +6 -0
- package/dist/components/text/text.stories.js +22 -0
- package/dist/components/text-link/text-link.d.ts +9 -0
- package/dist/components/text-link/text-link.js +5 -0
- package/dist/components/text-link/text-link.stories.d.ts +5 -0
- package/dist/components/text-link/text-link.stories.js +17 -0
- package/dist/components/textarea/textarea.d.ts +22 -0
- package/dist/components/textarea/textarea.js +15 -0
- package/dist/components/textarea/textarea.stories.d.ts +4 -0
- package/dist/components/textarea/textarea.stories.js +18 -0
- package/dist/components/toaster/toaster.d.ts +19 -0
- package/dist/components/toaster/toaster.js +51 -0
- package/dist/components/toaster/toaster.stories.d.ts +15 -0
- package/dist/components/toaster/toaster.stories.js +84 -0
- package/dist/components/toggle/toggle.d.ts +14 -0
- package/dist/components/toggle/toggle.js +17 -0
- package/dist/components/toggle/toggle.stories.d.ts +10 -0
- package/dist/components/toggle/toggle.stories.js +41 -0
- package/dist/components/tooltip/tooltip-layer.d.ts +16 -0
- package/dist/components/tooltip/tooltip-layer.js +19 -0
- package/dist/components/tooltip/tooltip.d.ts +19 -0
- package/dist/components/tooltip/tooltip.js +31 -0
- package/dist/components/tooltip/tooltip.stories.d.ts +11 -0
- package/dist/components/tooltip/tooltip.stories.js +50 -0
- package/dist/components/tooltip/tooltip.test-case.stories.d.ts +4 -0
- package/dist/components/tooltip/tooltip.test-case.stories.js +20 -0
- package/dist/components/top-bar/element/element.d.ts +32 -0
- package/dist/components/top-bar/element/element.js +28 -0
- package/dist/components/top-bar/element/enum.d.ts +6 -0
- package/dist/components/top-bar/element/enum.js +7 -0
- package/dist/components/top-bar/element/link.d.ts +11 -0
- package/dist/components/top-bar/element/link.js +15 -0
- package/dist/components/top-bar/title.d.ts +9 -0
- package/dist/components/top-bar/title.js +7 -0
- package/dist/components/top-bar/top-bar.d.ts +11 -0
- package/dist/components/top-bar/top-bar.js +19 -0
- package/dist/components/top-bar/top-bar.stories.d.ts +6 -0
- package/dist/components/top-bar/top-bar.stories.js +124 -0
- package/dist/components/top-bar/top-bar.testcase.stories.d.ts +5 -0
- package/dist/components/top-bar/top-bar.testcase.stories.js +53 -0
- package/dist/components/top-bar/warning.d.ts +5 -0
- package/dist/components/top-bar/warning.js +5 -0
- package/dist/components/tree/tree-item.d.ts +10 -0
- package/dist/components/tree/tree-item.js +27 -0
- package/dist/components/tree/tree-placeholder.d.ts +4 -0
- package/dist/components/tree/tree-placeholder.js +3 -0
- package/dist/components/tree/tree.d.ts +42 -0
- package/dist/components/tree/tree.js +50 -0
- package/dist/components/tree/tree.stories-data.d.ts +126 -0
- package/dist/components/tree/tree.stories-data.js +83 -0
- package/dist/components/tree/tree.stories.d.ts +11 -0
- package/dist/components/tree/tree.stories.js +98 -0
- package/dist/helpers/disabled-context.d.ts +2 -0
- package/dist/helpers/disabled-context.js +2 -0
- package/dist/helpers/text.d.ts +1 -0
- package/dist/helpers/text.js +9 -0
- package/dist/helpers/types.d.ts +3 -0
- package/dist/helpers/types.js +8 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-focus.d.ts +4 -0
- package/dist/hooks/use-focus.js +10 -0
- package/dist/hooks/use-fonts-ready.d.ts +1 -0
- package/dist/hooks/use-fonts-ready.js +13 -0
- package/dist/hooks/use-keyboard-event.d.ts +2 -0
- package/dist/hooks/use-keyboard-event.js +14 -0
- package/dist/hooks/use-window-width.d.ts +1 -0
- package/dist/hooks/use-window-width.js +16 -0
- package/dist/index.d.ts +79 -1467
- package/dist/index.js +86 -72363
- package/dist/my-dummy.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { ExpandedContentRow } from './expanded-content-row';
|
|
5
|
+
import { getHeaderAlignment } from '../helper';
|
|
6
|
+
import styles from './row.module.less';
|
|
7
|
+
import { Cell } from '../cell/cell';
|
|
8
|
+
import { Icon } from '../../icon/icon';
|
|
9
|
+
import { CellType } from "../enum";
|
|
10
|
+
import { IconType } from "../../../common-enum";
|
|
11
|
+
export const Row = ({ row, rowIndex, isHeader = false, columnCount, colSpan, columnHeaderAlignments = [], columnAlignment = [], hasRowActions, draggableTable = false, snapshot = null, provided = null, width, columnWidths, testId, }) => {
|
|
12
|
+
const targetRef = useRef(null);
|
|
13
|
+
const columnHeaderAlignment = getHeaderAlignment(columnHeaderAlignments, isHeader, rowIndex);
|
|
14
|
+
const { onRowClick, onRowFocus, onRowMouseEnter, onRowMouseLeave, expandedContent, active, } = row;
|
|
15
|
+
const cells = row.cells.map((c, i) => {
|
|
16
|
+
const key = `${isHeader ? 0 : 1}_${rowIndex}_${i}`;
|
|
17
|
+
return (_jsx(Cell, { cell: c, isHeader: isHeader, columnAlignment: columnAlignment[i], columnHeaderAlignment: columnHeaderAlignment[i], width: columnWidths ? columnWidths[i] : undefined, snapshot: snapshot, testId: c.testId }, key));
|
|
18
|
+
});
|
|
19
|
+
const rowActions = hasRowActions && (_jsx(Cell, { cell: {
|
|
20
|
+
type: CellType.ACTIONS,
|
|
21
|
+
actions: row.actions,
|
|
22
|
+
}, isHeader: isHeader }, columnCount));
|
|
23
|
+
const getItemStyle = (isDragging, draggableStyle) => {
|
|
24
|
+
return {
|
|
25
|
+
minWidth: isDragging && `${width}px`,
|
|
26
|
+
width: isDragging && '100%',
|
|
27
|
+
display: isDragging && 'table',
|
|
28
|
+
background: isDragging && 'var(--color-background-listitem-active)',
|
|
29
|
+
border: isDragging && 'var(--color-border)',
|
|
30
|
+
borderTop: isDragging && 0,
|
|
31
|
+
opacity: isDragging && 0.1,
|
|
32
|
+
...draggableStyle,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const getDragItem = () => {
|
|
36
|
+
if (row.noDrag) {
|
|
37
|
+
return _jsx("td", { "aria-labelledby": "unique-label-id" });
|
|
38
|
+
}
|
|
39
|
+
return (_jsx("td", { className: styles.dragIconCell, children: _jsx("div", { ...provided.dragHandleProps, className: styles.dragIcon, children: _jsx(Icon, { icon: IconType.DRAG }) }) }));
|
|
40
|
+
};
|
|
41
|
+
return isHeader ? (_jsxs(_Fragment, { children: [_jsxs("tr", { ref: targetRef, onClick: onRowClick, onMouseEnter: onRowMouseEnter, onMouseLeave: onRowMouseLeave, onFocus: onRowFocus, className: cx(onRowClick ? styles.clickableRow : null, onRowMouseEnter ? styles.hoverableRow : null), children: [draggableTable ? _jsx(Cell, { isHeader: true }) : null, cells, rowActions] }, rowIndex), expandedContent && expandedContent.content ? (_jsx(ExpandedContentRow, { colSpan: colSpan, flush: expandedContent.flush === true, children: expandedContent.content }, `${rowIndex}_expanded_content`)) : null] })) : (_jsxs(_Fragment, { children: [_jsxs("tr", { onClick: onRowClick, onMouseEnter: onRowMouseEnter, onMouseLeave: onRowMouseLeave, onFocus: onRowFocus, className: cx(onRowClick && !onRowClick.noStyle ? styles.clickableRow : null, onRowMouseEnter && !onRowMouseEnter.noStyle
|
|
42
|
+
? styles.hoverableRow
|
|
43
|
+
: null, active ? styles.rowActive : null), ref: provided?.innerRef || null, ...(provided?.draggableProps || null), style: snapshot && provided
|
|
44
|
+
? getItemStyle(snapshot.isDragging, provided.draggableProps.style)
|
|
45
|
+
: null, children: [draggableTable ? getDragItem() : null, cells, rowActions] }, rowIndex), expandedContent && expandedContent.content ? (_jsx(ExpandedContentRow, { colSpan: colSpan, flush: expandedContent.flush === true, children: expandedContent.content }, `${rowIndex}_expanded_content`)) : null] }));
|
|
46
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StoryFn } from '@storybook/react';
|
|
2
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, import("@storybook/types").Args>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export declare const ActiveRow: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
5
|
+
export declare const RowFocusEvent: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
6
|
+
export declare const NotStriped: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, any>;
|
|
7
|
+
export declare const Expandable: StoryFn<any>;
|
|
8
|
+
export declare const DragAndDrop: StoryFn<any>;
|
|
9
|
+
export declare const OnRowEnter: StoryFn<any>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Table } from '../table';
|
|
4
|
+
import { Text } from '../../text/text';
|
|
5
|
+
import * as storyData from '../table.stories-data';
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Basic/Table/Row',
|
|
8
|
+
component: Table,
|
|
9
|
+
args: {
|
|
10
|
+
table: {
|
|
11
|
+
...storyData.table,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
const Template = (args) => {
|
|
16
|
+
return (_jsx(Table
|
|
17
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
18
|
+
, { ...args }));
|
|
19
|
+
};
|
|
20
|
+
export const ActiveRow = Template.bind({});
|
|
21
|
+
ActiveRow.args = {
|
|
22
|
+
table: storyData.tableActiveRow,
|
|
23
|
+
};
|
|
24
|
+
export const RowFocusEvent = Template.bind({});
|
|
25
|
+
RowFocusEvent.args = {
|
|
26
|
+
table: storyData.tableRowFocus,
|
|
27
|
+
};
|
|
28
|
+
export const NotStriped = Template.bind({});
|
|
29
|
+
NotStriped.args = {
|
|
30
|
+
table: {
|
|
31
|
+
...storyData.table,
|
|
32
|
+
striped: false,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
NotStriped.parameters = {
|
|
36
|
+
docs: {
|
|
37
|
+
description: {
|
|
38
|
+
story: '`striped: false` removes tinted background on alternative rows.',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const Expandable = () => {
|
|
43
|
+
const [expandedRow, setExpandedRow] = useState(null);
|
|
44
|
+
const toggleExpandedRow = (rowIndex) => expandedRow === rowIndex ? setExpandedRow(null) : setExpandedRow(rowIndex);
|
|
45
|
+
return (_jsx(Table, { table: {
|
|
46
|
+
...storyData.table,
|
|
47
|
+
striped: false,
|
|
48
|
+
rows: storyData.table.rows.map((row, index) => ({
|
|
49
|
+
...row,
|
|
50
|
+
onRowClick: () => toggleExpandedRow(index),
|
|
51
|
+
expandedContent: {
|
|
52
|
+
content: expandedRow === index ? (_jsx("div", { children: "Example expanded content" })) : null,
|
|
53
|
+
},
|
|
54
|
+
})),
|
|
55
|
+
} }));
|
|
56
|
+
};
|
|
57
|
+
export const DragAndDrop = () => {
|
|
58
|
+
const withDragAndDrop = {
|
|
59
|
+
draggable: true,
|
|
60
|
+
headers: [
|
|
61
|
+
{
|
|
62
|
+
cells: [
|
|
63
|
+
{ value: 'Name' },
|
|
64
|
+
{ value: 'Weight (kg)' },
|
|
65
|
+
{ value: 'Energy (kcal / 100g)' },
|
|
66
|
+
{ value: 'Origin' },
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
rows: [
|
|
71
|
+
{
|
|
72
|
+
noDrag: true,
|
|
73
|
+
cells: [
|
|
74
|
+
{ value: 'Undraggable' },
|
|
75
|
+
{ value: 100 },
|
|
76
|
+
{ value: 361 },
|
|
77
|
+
{ value: 'Vietnam' },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
cells: [
|
|
82
|
+
{ value: 'Buckwheat' },
|
|
83
|
+
{ value: 50 },
|
|
84
|
+
{ value: 358 },
|
|
85
|
+
{ value: 'Poland' },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
cells: [
|
|
90
|
+
{ value: 'Couscous' },
|
|
91
|
+
{ value: 10 },
|
|
92
|
+
{ value: 368 },
|
|
93
|
+
{ value: 'France' },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
const arraymove = (arr, from, to) => {
|
|
99
|
+
const copy = [...arr];
|
|
100
|
+
if (arr[to].noDrag) {
|
|
101
|
+
return arr;
|
|
102
|
+
}
|
|
103
|
+
copy.splice(to, 0, copy.splice(from, 1)[0]);
|
|
104
|
+
return copy;
|
|
105
|
+
};
|
|
106
|
+
const [rows, setRows] = useState(withDragAndDrop.rows);
|
|
107
|
+
const onListReorder = (reorderData) => {
|
|
108
|
+
const { to, from } = reorderData;
|
|
109
|
+
arraymove(rows, from, to);
|
|
110
|
+
setRows(arraymove(rows, from, to));
|
|
111
|
+
};
|
|
112
|
+
return (_jsx(Table, { table: { ...withDragAndDrop, rows }, onListReorder: onListReorder }));
|
|
113
|
+
};
|
|
114
|
+
export const OnRowEnter = () => {
|
|
115
|
+
const [displayText, setDisplayText] = useState('Hover any row!');
|
|
116
|
+
const rows = [1, 2, 3, 4, 5].map((val) => ({
|
|
117
|
+
cells: [{ value: `Row ${val}` }, { value: `${val ** 2}` }],
|
|
118
|
+
onRowMouseEnter: () => setDisplayText(`Hovering row ${val}`),
|
|
119
|
+
onRowMouseLeave: () => setDisplayText('Not hovering any row...'),
|
|
120
|
+
}));
|
|
121
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: displayText }), _jsx(Table, { table: {
|
|
122
|
+
fixedWidth: '100%',
|
|
123
|
+
headers: [
|
|
124
|
+
{
|
|
125
|
+
cells: [{ value: 'Description' }, { value: 'Value' }],
|
|
126
|
+
onRowMouseEnter: () => setDisplayText(`Hovering header row`),
|
|
127
|
+
onRowMouseLeave: () => setDisplayText('Not hovering any row...'),
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
rows,
|
|
131
|
+
} })] }));
|
|
132
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface ITableProps {
|
|
3
|
+
rows: any[];
|
|
4
|
+
infiniteScroll?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface ITableScrollWrapperProps {
|
|
7
|
+
table: ITableProps;
|
|
8
|
+
children: (props: {
|
|
9
|
+
visibleRows: number;
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const TableScrollWrapper: ({ table, children, }: ITableScrollWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
4
|
+
import styles from './table.module.less';
|
|
5
|
+
export const TableScrollWrapper = ({ table, children, }) => {
|
|
6
|
+
const { rows, infiniteScroll } = table;
|
|
7
|
+
const pageSize = Math.ceil(window.innerHeight / 32); // The highest number of rows that will fit on screen
|
|
8
|
+
const [visibleRows, setVisibleRows] = infiniteScroll
|
|
9
|
+
? useState(pageSize)
|
|
10
|
+
: [rows.length, null];
|
|
11
|
+
const [hasMore, setHasMore] = infiniteScroll
|
|
12
|
+
? useState(visibleRows < rows.length)
|
|
13
|
+
: [false, null];
|
|
14
|
+
const loadMoreItems = () => {
|
|
15
|
+
if (visibleRows >= rows.length && setHasMore) {
|
|
16
|
+
setHasMore(false);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (setVisibleRows) {
|
|
20
|
+
setVisibleRows(visibleRows + pageSize);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return (_jsx("div", { id: "scrollWrapper", className: styles.scroll, children: infiniteScroll ? (_jsx(InfiniteScroll, { dataLength: Math.min(rows.length, visibleRows + pageSize), next: loadMoreItems, hasMore: hasMore, scrollableTarget: "scrollWrapper", style: { overflow: 'initial' }, loader: null, children: children({ visibleRows }) })) : (children({ visibleRows })) }));
|
|
24
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { IFooterProps } from "./footer/footer";
|
|
3
|
+
import { TRowsType } from "./table.viewdata";
|
|
4
|
+
import { Align } from "../../common-enum";
|
|
5
|
+
interface ITableProps {
|
|
6
|
+
onListReorder?: (obj: {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
}) => void;
|
|
10
|
+
table: {
|
|
11
|
+
name?: string | number | ReactNode;
|
|
12
|
+
actionsRight?: boolean;
|
|
13
|
+
fixedWidth?: string | number;
|
|
14
|
+
maxHeight?: string | number;
|
|
15
|
+
columnWidths?: string[];
|
|
16
|
+
className?: string;
|
|
17
|
+
columnHeaderAlignments?: Array<Align>;
|
|
18
|
+
columnAlignment?: Array<Align>;
|
|
19
|
+
infiniteScroll?: boolean;
|
|
20
|
+
headers?: any[];
|
|
21
|
+
rows?: TRowsType;
|
|
22
|
+
footer?: IFooterProps;
|
|
23
|
+
draggable?: boolean;
|
|
24
|
+
bordered?: boolean;
|
|
25
|
+
striped?: boolean;
|
|
26
|
+
testId?: string;
|
|
27
|
+
onAddRow?: any;
|
|
28
|
+
defaultEmptyRow?: any;
|
|
29
|
+
stickyHeaders?: string | boolean;
|
|
30
|
+
actions?: any;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export declare const Table: (props: ITableProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import { DragDropContext, Draggable, Droppable } from "react-beautiful-dnd";
|
|
5
|
+
import { get } from "lodash";
|
|
6
|
+
import styles from "./table.module.less";
|
|
7
|
+
import { Title } from "./title/title";
|
|
8
|
+
import { Footer } from "./footer/footer";
|
|
9
|
+
import { getColumnCount, hasRowActions } from "./table.viewdata";
|
|
10
|
+
import { TableScrollWrapper } from "./table-scroll-wrapper";
|
|
11
|
+
import { Row } from "./row/row";
|
|
12
|
+
export const Table = (props) => {
|
|
13
|
+
const { onListReorder = () => { }, table: propTable } = props;
|
|
14
|
+
const { columnWidths, footer, name, rows: propRows = [], actions, actionsRight, columnHeaderAlignments, columnAlignment, striped = true, testId, draggable, defaultEmptyRow = null, onAddRow = null, bordered = true, maxHeight, fixedWidth: width, } = propTable;
|
|
15
|
+
const targetRef = useRef(null);
|
|
16
|
+
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (targetRef.current) {
|
|
19
|
+
setDimensions({
|
|
20
|
+
width: targetRef.current.offsetWidth,
|
|
21
|
+
height: targetRef.current.offsetHeight,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}, []);
|
|
25
|
+
const headers = get(props, 'table.headers', []);
|
|
26
|
+
const columnCount = getColumnCount(propRows, headers);
|
|
27
|
+
const rowActions = hasRowActions(propRows, headers);
|
|
28
|
+
const colSpan = columnCount + (rowActions ? 1 : 0);
|
|
29
|
+
const isLastPage = footer
|
|
30
|
+
? footer?.pagination?.rowsPerPage?.value === 0 ||
|
|
31
|
+
Number(footer?.pagination?.selectedPage) >=
|
|
32
|
+
Number(footer?.pagination?.rowCount) /
|
|
33
|
+
Number(footer?.pagination?.rowsPerPage?.value)
|
|
34
|
+
: true;
|
|
35
|
+
const addEmptyTempRow = defaultEmptyRow?.cells?.length && onAddRow && isLastPage;
|
|
36
|
+
const tempEmptyCells = addEmptyTempRow
|
|
37
|
+
? defaultEmptyRow.cells.map((cell, i) => {
|
|
38
|
+
if (cell?.type === 'Input') {
|
|
39
|
+
return {
|
|
40
|
+
...cell,
|
|
41
|
+
onChange: (evt) => {
|
|
42
|
+
const value = evt?.target?.value;
|
|
43
|
+
const newRow = {
|
|
44
|
+
...defaultEmptyRow,
|
|
45
|
+
cells: defaultEmptyRow.cells.map((cell, cellIndex) => {
|
|
46
|
+
return {
|
|
47
|
+
...cell,
|
|
48
|
+
value: cellIndex === i ? value : cell?.value,
|
|
49
|
+
};
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
onAddRow({ newRow });
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
...cell,
|
|
58
|
+
disabled: true, // Just input cell would be editable
|
|
59
|
+
};
|
|
60
|
+
})
|
|
61
|
+
: null;
|
|
62
|
+
const newEmptyRow = {
|
|
63
|
+
cells: tempEmptyCells,
|
|
64
|
+
testId: testId ? `${testId}-last-empty-row` : undefined,
|
|
65
|
+
};
|
|
66
|
+
const rows = addEmptyTempRow ? propRows.concat(newEmptyRow) : propRows;
|
|
67
|
+
const table = {
|
|
68
|
+
...propTable,
|
|
69
|
+
rows,
|
|
70
|
+
};
|
|
71
|
+
const wrapperClass = cx(styles.wrapper, bordered ? styles.bordered : '');
|
|
72
|
+
const wrapperStyles = {
|
|
73
|
+
maxHeight,
|
|
74
|
+
width,
|
|
75
|
+
// Collapse width if width = auto
|
|
76
|
+
display: width === 'auto' ? 'inline-flex' : 'flex',
|
|
77
|
+
};
|
|
78
|
+
return draggable ? (_jsxs("div", { ref: targetRef, className: wrapperClass, style: wrapperStyles, children: [_jsx(Title, { actions: actions, actionsRight: actionsRight, name: name, testId: testId && `${testId}-title` }), _jsx(DragDropContext, { onDragEnd: (result) => {
|
|
79
|
+
const from = result?.source?.index;
|
|
80
|
+
const to = result?.destination?.index;
|
|
81
|
+
if (typeof from === 'number' && typeof to === 'number') {
|
|
82
|
+
onListReorder({ from, to });
|
|
83
|
+
}
|
|
84
|
+
}, children: _jsx(Droppable, { droppableId: "droppable", children: (provided) => {
|
|
85
|
+
return (_jsx(TableScrollWrapper, { table: table, children: ({ visibleRows }) => (_jsxs("table", { className: cx(styles.table, striped ? styles.striped : ''), "data-testid": testId, ref: provided.innerRef, children: [_jsx("thead", { children: headers.map((row, rowIndex) => {
|
|
86
|
+
return (_jsx(Row, { rowIndex: rowIndex, isHeader: true, row: row, columnCount: columnCount, columnWidths: columnWidths, colSpan: colSpan, hasRowActions: rowActions, columnAlignment: columnAlignment, columnHeaderAlignments: columnHeaderAlignments, draggableTable: draggable }, `0_${rowIndex}`));
|
|
87
|
+
}) }), _jsxs("tbody", { children: [rows.slice(0, visibleRows).map((row, rowIndex) => (_jsx(Draggable, { draggableId: rowIndex + '', index: rowIndex, isDragDisabled: row.noDrag, children: (provided, snapshot) => (_jsx(Row, { rowIndex: rowIndex, row: row, columnCount: columnCount, columnWidths: columnWidths, colSpan: colSpan, hasRowActions: rowActions, columnAlignment: columnAlignment, provided: provided, snapshot: snapshot, draggableTable: draggable, width: dimensions.width }, `1_${rowIndex}`)) }, `index_${rowIndex}`))), provided.placeholder] })] })) }));
|
|
88
|
+
} }) }), footer && (_jsx(Footer, { pagination: footer.pagination, actions: footer.actions, content: footer.content }))] })) : (_jsxs("div", { className: wrapperClass, style: wrapperStyles, children: [_jsx(Title, { actions: actions, actionsRight: actionsRight, name: name, testId: testId && `${testId}-title` }), _jsx(TableScrollWrapper, { table: table, children: ({ visibleRows }) => (_jsxs("table", { className: cx(styles.table, striped ? styles.striped : ''), "data-testid": testId, children: [_jsx("thead", { children: headers.map((row, rowIndex) => {
|
|
89
|
+
return (_jsx(Row, { rowIndex: rowIndex, isHeader: true, row: row, columnCount: columnCount, columnWidths: columnWidths, colSpan: colSpan, hasRowActions: rowActions, columnAlignment: columnAlignment, columnHeaderAlignments: columnHeaderAlignments }, `0_${rowIndex}`));
|
|
90
|
+
}) }), _jsx("tbody", { children: rows.slice(0, visibleRows).map((row, rowIndex) => (_jsx(Row, { rowIndex: rowIndex, row: row, columnCount: columnCount, columnWidths: columnWidths, colSpan: colSpan, hasRowActions: rowActions, columnAlignment: columnAlignment }, `1_${rowIndex}`))) })] })) }), footer && (_jsx(Footer, { colSpan: colSpan, pagination: footer.pagination, actions: footer.actions, content: footer.content }))] }));
|
|
91
|
+
};
|