@elliemae/ds-datagrids 2.2.0 → 2.3.0-alpha.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/cjs/DSDataGrid.js +395 -635
- package/cjs/DSDataGrid.js.map +7 -0
- package/cjs/DataGridImpl.js +103 -128
- package/cjs/DataGridImpl.js.map +7 -0
- package/cjs/PaginatedDataGrid.js +68 -68
- package/cjs/PaginatedDataGrid.js.map +7 -0
- package/cjs/blockNames.js +39 -11
- package/cjs/blockNames.js.map +7 -0
- package/cjs/columns/IconColumn.js +78 -62
- package/cjs/columns/IconColumn.js.map +7 -0
- package/cjs/columns/NumberColumn.js +35 -5
- package/cjs/columns/NumberColumn.js.map +7 -0
- package/cjs/components/BodyCell.js +83 -80
- package/cjs/components/BodyCell.js.map +7 -0
- package/cjs/components/BodyList.js +52 -52
- package/cjs/components/BodyList.js.map +7 -0
- package/cjs/components/ColumnVisibilityMenuOption.js +53 -31
- package/cjs/components/ColumnVisibilityMenuOption.js.map +7 -0
- package/cjs/components/ColumnsOptionsMenuSection.js +59 -44
- package/cjs/components/ColumnsOptionsMenuSection.js.map +7 -0
- package/cjs/components/EmptyState.js +81 -50
- package/cjs/components/EmptyState.js.map +7 -0
- package/cjs/components/HeaderCell.js +64 -58
- package/cjs/components/HeaderCell.js.map +7 -0
- package/cjs/components/List.js +41 -29
- package/cjs/components/List.js.map +7 -0
- package/cjs/components/ListItem.js +43 -36
- package/cjs/components/ListItem.js.map +7 -0
- package/cjs/components/NoResults.js +55 -51
- package/cjs/components/NoResults.js.map +7 -0
- package/cjs/components/RowsLoader.js +42 -22
- package/cjs/components/RowsLoader.js.map +7 -0
- package/cjs/components/Table.js +78 -87
- package/cjs/components/Table.js.map +7 -0
- package/cjs/components/TableBody.js +61 -60
- package/cjs/components/TableBody.js.map +7 -0
- package/cjs/components/TableHeader.js +47 -30
- package/cjs/components/TableHeader.js.map +7 -0
- package/cjs/components/footer/addOptionalFooterComponents.js +53 -43
- package/cjs/components/footer/addOptionalFooterComponents.js.map +7 -0
- package/cjs/components/header/PrimaryControls.js +49 -35
- package/cjs/components/header/PrimaryControls.js.map +7 -0
- package/cjs/components/header/addOptionalHeaderComponents.js +54 -43
- package/cjs/components/header/addOptionalHeaderComponents.js.map +7 -0
- package/cjs/components/index.js +43 -17
- package/cjs/components/index.js.map +7 -0
- package/cjs/components/renderers/defaultClassedRenderers.js +64 -57
- package/cjs/components/renderers/defaultClassedRenderers.js.map +7 -0
- package/cjs/components/renderers/index.js +44 -17
- package/cjs/components/renderers/index.js.map +7 -0
- package/cjs/components/renderers/renderRowsLoader.js +39 -18
- package/cjs/components/renderers/renderRowsLoader.js.map +7 -0
- package/cjs/components/tableContext.js +36 -13
- package/cjs/components/tableContext.js.map +7 -0
- package/cjs/defaultPlugins.js +44 -12
- package/cjs/defaultPlugins.js.map +7 -0
- package/cjs/index.js +72 -67
- package/cjs/index.js.map +7 -0
- package/cjs/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js +102 -114
- package/cjs/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js.map +7 -0
- package/cjs/plugins/body-header-scroll-sync/index.js +35 -9
- package/cjs/plugins/body-header-scroll-sync/index.js.map +7 -0
- package/cjs/plugins/column-dnd/DndColumnsPlugin.js +107 -86
- package/cjs/plugins/column-dnd/DndColumnsPlugin.js.map +7 -0
- package/cjs/plugins/column-dnd/decorateGridWithDndColumns.js +43 -27
- package/cjs/plugins/column-dnd/decorateGridWithDndColumns.js.map +7 -0
- package/cjs/plugins/column-dnd/index.js +35 -9
- package/cjs/plugins/column-dnd/index.js.map +7 -0
- package/cjs/plugins/column-sizing/ColumnSizingPlugin.js +59 -55
- package/cjs/plugins/column-sizing/ColumnSizingPlugin.js.map +7 -0
- package/cjs/plugins/column-sizing/columnMeasurerTransformer.js +48 -53
- package/cjs/plugins/column-sizing/columnMeasurerTransformer.js.map +7 -0
- package/cjs/plugins/column-sizing/ext-points/decorateColumn.js +40 -13
- package/cjs/plugins/column-sizing/ext-points/decorateColumn.js.map +7 -0
- package/cjs/plugins/column-sizing/ext-points/getTableProps.js +55 -54
- package/cjs/plugins/column-sizing/ext-points/getTableProps.js.map +7 -0
- package/cjs/plugins/column-sizing/getColumnNameFromProperty.js +37 -9
- package/cjs/plugins/column-sizing/getColumnNameFromProperty.js.map +7 -0
- package/cjs/plugins/column-sizing/index.js +35 -9
- package/cjs/plugins/column-sizing/index.js.map +7 -0
- package/cjs/plugins/column-sizing/useColumnSizeService.js +72 -86
- package/cjs/plugins/column-sizing/useColumnSizeService.js.map +7 -0
- package/cjs/plugins/column-sizing/useStylesheetHelpers.js +96 -199
- package/cjs/plugins/column-sizing/useStylesheetHelpers.js.map +7 -0
- package/cjs/plugins/column-sizing/utils.js +52 -29
- package/cjs/plugins/column-sizing/utils.js.map +7 -0
- package/cjs/plugins/custom-cell-renderer/CustomRendererPlugin.js +38 -16
- package/cjs/plugins/custom-cell-renderer/CustomRendererPlugin.js.map +7 -0
- package/cjs/plugins/custom-cell-renderer/addCustomRendererToCell.js +61 -56
- package/cjs/plugins/custom-cell-renderer/addCustomRendererToCell.js.map +7 -0
- package/cjs/plugins/custom-cell-renderer/getRendererComponent.js +58 -60
- package/cjs/plugins/custom-cell-renderer/getRendererComponent.js.map +7 -0
- package/cjs/plugins/custom-cell-renderer/index.js +35 -9
- package/cjs/plugins/custom-cell-renderer/index.js.map +7 -0
- package/cjs/plugins/editable/EditableComponents/ComboBox.js +50 -53
- package/cjs/plugins/editable/EditableComponents/ComboBox.js.map +7 -0
- package/cjs/plugins/editable/EditableComponents/TextBox.js +56 -76
- package/cjs/plugins/editable/EditableComponents/TextBox.js.map +7 -0
- package/cjs/plugins/editable/EditableComponents/index.js +37 -11
- package/cjs/plugins/editable/EditableComponents/index.js.map +7 -0
- package/cjs/plugins/editable/EditablePlugin.js +60 -75
- package/cjs/plugins/editable/EditablePlugin.js.map +7 -0
- package/cjs/plugins/editable/decorateEditable.js +61 -98
- package/cjs/plugins/editable/decorateEditable.js.map +7 -0
- package/cjs/plugins/editable/getEditorComponent.js +70 -76
- package/cjs/plugins/editable/getEditorComponent.js.map +7 -0
- package/cjs/plugins/editable/index.js +38 -13
- package/cjs/plugins/editable/index.js.map +7 -0
- package/cjs/plugins/expandable-grid/ExpandableColumn.js +112 -144
- package/cjs/plugins/expandable-grid/ExpandableColumn.js.map +7 -0
- package/cjs/plugins/expandable-grid/ExpandablePlugin.js +118 -180
- package/cjs/plugins/expandable-grid/ExpandablePlugin.js.map +7 -0
- package/cjs/plugins/expandable-grid/ExpandedRow.js +117 -139
- package/cjs/plugins/expandable-grid/ExpandedRow.js.map +7 -0
- package/cjs/plugins/expandable-grid/ExpandedRowExtra.js +54 -52
- package/cjs/plugins/expandable-grid/ExpandedRowExtra.js.map +7 -0
- package/cjs/plugins/expandable-grid/index.js +37 -11
- package/cjs/plugins/expandable-grid/index.js.map +7 -0
- package/cjs/plugins/expandable-grid/useExpandGridState.js +45 -31
- package/cjs/plugins/expandable-grid/useExpandGridState.js.map +7 -0
- package/cjs/plugins/export-data/ExportDataPlugin.js +82 -116
- package/cjs/plugins/export-data/ExportDataPlugin.js.map +7 -0
- package/cjs/plugins/export-data/index.js +35 -12
- package/cjs/plugins/export-data/index.js.map +7 -0
- package/cjs/plugins/filterable/FilterablePlugin.js +54 -55
- package/cjs/plugins/filterable/FilterablePlugin.js.map +7 -0
- package/cjs/plugins/filterable/addFilterToColumn.js +40 -28
- package/cjs/plugins/filterable/addFilterToColumn.js.map +7 -0
- package/cjs/plugins/filterable/components/FilterableHeader.js +119 -107
- package/cjs/plugins/filterable/components/FilterableHeader.js.map +7 -0
- package/cjs/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js +116 -116
- package/cjs/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js.map +7 -0
- package/cjs/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js +97 -73
- package/cjs/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js.map +7 -0
- package/cjs/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js +138 -132
- package/cjs/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js.map +7 -0
- package/cjs/plugins/filterable/components/filterable-menus/TextFilterMenu.js +115 -119
- package/cjs/plugins/filterable/components/filterable-menus/TextFilterMenu.js.map +7 -0
- package/cjs/plugins/filterable/components/filterable-menus/defaultDateFormat.js +35 -7
- package/cjs/plugins/filterable/components/filterable-menus/defaultDateFormat.js.map +7 -0
- package/cjs/plugins/filterable/components/filterable-menus/getFilterMenuByType.js +46 -15
- package/cjs/plugins/filterable/components/filterable-menus/getFilterMenuByType.js.map +7 -0
- package/cjs/plugins/filterable/filterableFormatter.js +61 -51
- package/cjs/plugins/filterable/filterableFormatter.js.map +7 -0
- package/cjs/plugins/filterable/filtering-helper/filterRowsByQuery.js +60 -55
- package/cjs/plugins/filterable/filtering-helper/filterRowsByQuery.js.map +7 -0
- package/cjs/plugins/filterable/filtering-helper/strategiesOperators.js +43 -22
- package/cjs/plugins/filterable/filtering-helper/strategiesOperators.js.map +7 -0
- package/cjs/plugins/filterable/helper.js +68 -79
- package/cjs/plugins/filterable/helper.js.map +7 -0
- package/cjs/plugins/filterable/index.js +35 -9
- package/cjs/plugins/filterable/index.js.map +7 -0
- package/cjs/plugins/filterable/useFilterableState.js +62 -66
- package/cjs/plugins/filterable/useFilterableState.js.map +7 -0
- package/cjs/plugins/grouping-by/GroupingByPlugin.js +40 -23
- package/cjs/plugins/grouping-by/GroupingByPlugin.js.map +7 -0
- package/cjs/plugins/grouping-grid/GroupingPlugin.js +86 -109
- package/cjs/plugins/grouping-grid/GroupingPlugin.js.map +7 -0
- package/cjs/plugins/grouping-grid/walkStrategy.js +46 -26
- package/cjs/plugins/grouping-grid/walkStrategy.js.map +7 -0
- package/cjs/plugins/index.js +68 -48
- package/cjs/plugins/index.js.map +7 -0
- package/cjs/plugins/infinite-scrolling/InfiniteScrollPlugin.js +64 -88
- package/cjs/plugins/infinite-scrolling/InfiniteScrollPlugin.js.map +7 -0
- package/cjs/plugins/infinite-scrolling/index.js +35 -9
- package/cjs/plugins/infinite-scrolling/index.js.map +7 -0
- package/cjs/plugins/pagination/PaginationPlugin.js +73 -90
- package/cjs/plugins/pagination/PaginationPlugin.js.map +7 -0
- package/cjs/plugins/pagination/components/Pagination.js +54 -35
- package/cjs/plugins/pagination/components/Pagination.js.map +7 -0
- package/cjs/plugins/pagination/components/Paginator.js +59 -44
- package/cjs/plugins/pagination/components/Paginator.js.map +7 -0
- package/cjs/plugins/pagination/components/PerPageDropdown.js +51 -63
- package/cjs/plugins/pagination/components/PerPageDropdown.js.map +7 -0
- package/cjs/plugins/pagination/helper.js +45 -24
- package/cjs/plugins/pagination/helper.js.map +7 -0
- package/cjs/plugins/pagination/index.js +35 -9
- package/cjs/plugins/pagination/index.js.map +7 -0
- package/cjs/plugins/pagination/usePaginationState.js +46 -38
- package/cjs/plugins/pagination/usePaginationState.js.map +7 -0
- package/cjs/plugins/resizable/ResizablePlugin.js +51 -55
- package/cjs/plugins/resizable/ResizablePlugin.js.map +7 -0
- package/cjs/plugins/resizable/decorateResizable.js +49 -53
- package/cjs/plugins/resizable/decorateResizable.js.map +7 -0
- package/cjs/plugins/resizable/index.js +35 -9
- package/cjs/plugins/resizable/index.js.map +7 -0
- package/cjs/plugins/resizable/useResizeHandle.js +56 -50
- package/cjs/plugins/resizable/useResizeHandle.js.map +7 -0
- package/cjs/plugins/resizable/utils.js +49 -28
- package/cjs/plugins/resizable/utils.js.map +7 -0
- package/cjs/plugins/row-dnd/DndRowsPlugin.js +103 -82
- package/cjs/plugins/row-dnd/DndRowsPlugin.js.map +7 -0
- package/cjs/plugins/row-dnd/index.js +35 -9
- package/cjs/plugins/row-dnd/index.js.map +7 -0
- package/cjs/plugins/selectable/SelectablePlugin.js +101 -134
- package/cjs/plugins/selectable/SelectablePlugin.js.map +7 -0
- package/cjs/plugins/selectable/addSelectableColumn.js +67 -68
- package/cjs/plugins/selectable/addSelectableColumn.js.map +7 -0
- package/cjs/plugins/selectable/helper.js +50 -39
- package/cjs/plugins/selectable/helper.js.map +7 -0
- package/cjs/plugins/selectable/index.js +35 -9
- package/cjs/plugins/selectable/index.js.map +7 -0
- package/cjs/plugins/selectable/selectableFormatter.js +83 -105
- package/cjs/plugins/selectable/selectableFormatter.js.map +7 -0
- package/cjs/plugins/selectable/useSelectableState.js +67 -94
- package/cjs/plugins/selectable/useSelectableState.js.map +7 -0
- package/cjs/plugins/sortable/SortablePlugin.js +62 -76
- package/cjs/plugins/sortable/SortablePlugin.js.map +7 -0
- package/cjs/plugins/sortable/checkIfSortable.js +37 -14
- package/cjs/plugins/sortable/checkIfSortable.js.map +7 -0
- package/cjs/plugins/sortable/index.js +35 -9
- package/cjs/plugins/sortable/index.js.map +7 -0
- package/cjs/plugins/sortable/sortHeaderFormatter.js +56 -50
- package/cjs/plugins/sortable/sortHeaderFormatter.js.map +7 -0
- package/cjs/plugins/sortable/sortTree.js +40 -47
- package/cjs/plugins/sortable/sortTree.js.map +7 -0
- package/cjs/plugins/sortable/sorter.js +140 -172
- package/cjs/plugins/sortable/sorter.js.map +7 -0
- package/cjs/plugins/sortable/useSortableState.js +53 -79
- package/cjs/plugins/sortable/useSortableState.js.map +7 -0
- package/cjs/plugins/toolbar/RowRenderer.js +75 -76
- package/cjs/plugins/toolbar/RowRenderer.js.map +7 -0
- package/cjs/plugins/toolbar/ToolbarPlugin.js +49 -33
- package/cjs/plugins/toolbar/ToolbarPlugin.js.map +7 -0
- package/cjs/plugins/toolbar/ToolbarTrigger.js +89 -70
- package/cjs/plugins/toolbar/ToolbarTrigger.js.map +7 -0
- package/cjs/plugins/toolbar/index.js +35 -9
- package/cjs/plugins/toolbar/index.js.map +7 -0
- package/cjs/plugins/virtualization/AutoHeightList.js +64 -52
- package/cjs/plugins/virtualization/AutoHeightList.js.map +7 -0
- package/cjs/plugins/virtualization/VirtualizationPlugin.js +86 -97
- package/cjs/plugins/virtualization/VirtualizationPlugin.js.map +7 -0
- package/cjs/plugins/virtualization/VirtualizedBody.js +139 -155
- package/cjs/plugins/virtualization/VirtualizedBody.js.map +7 -0
- package/cjs/plugins/virtualization/VirtualizedBodyRow.js +39 -17
- package/cjs/plugins/virtualization/VirtualizedBodyRow.js.map +7 -0
- package/cjs/plugins/virtualization/helper.js +35 -7
- package/cjs/plugins/virtualization/helper.js.map +7 -0
- package/cjs/plugins/virtualization/index.js +35 -9
- package/cjs/plugins/virtualization/index.js.map +7 -0
- package/cjs/renders/CellWithAddons.js +98 -50
- package/cjs/renders/CellWithAddons.js.map +7 -0
- package/cjs/renders/index.js +37 -11
- package/cjs/renders/index.js.map +7 -0
- package/cjs/renders/styled.js +78 -27
- package/cjs/renders/styled.js.map +7 -0
- package/cjs/rowSizes.js +44 -12
- package/cjs/rowSizes.js.map +7 -0
- package/cjs/utilities/DataGridUtilities.json +1315 -0
- package/cjs/utilities/getPluginsFromProps.js +67 -39
- package/cjs/utilities/getPluginsFromProps.js.map +7 -0
- package/cjs/utilities/getScrollbarSize.js +44 -25
- package/cjs/utilities/getScrollbarSize.js.map +7 -0
- package/cjs/utilities/normalizeData.js +44 -34
- package/cjs/utilities/normalizeData.js.map +7 -0
- package/esm/DSDataGrid.js +337 -597
- package/esm/DSDataGrid.js.map +7 -0
- package/esm/DataGridImpl.js +68 -113
- package/esm/DataGridImpl.js.map +7 -0
- package/esm/PaginatedDataGrid.js +39 -59
- package/esm/PaginatedDataGrid.js.map +7 -0
- package/esm/blockNames.js +10 -5
- package/esm/blockNames.js.map +7 -0
- package/esm/columns/IconColumn.js +49 -54
- package/esm/columns/IconColumn.js.map +7 -0
- package/esm/columns/NumberColumn.js +6 -3
- package/esm/columns/NumberColumn.js.map +7 -0
- package/esm/components/BodyCell.js +51 -68
- package/esm/components/BodyCell.js.map +7 -0
- package/esm/components/BodyList.js +23 -43
- package/esm/components/BodyList.js.map +7 -0
- package/esm/components/ColumnVisibilityMenuOption.js +24 -27
- package/esm/components/ColumnVisibilityMenuOption.js.map +7 -0
- package/esm/components/ColumnsOptionsMenuSection.js +30 -38
- package/esm/components/ColumnsOptionsMenuSection.js.map +7 -0
- package/esm/components/EmptyState.js +52 -40
- package/esm/components/EmptyState.js.map +7 -0
- package/esm/components/HeaderCell.js +33 -48
- package/esm/components/HeaderCell.js.map +7 -0
- package/esm/components/List.js +12 -23
- package/esm/components/List.js.map +7 -0
- package/esm/components/ListItem.js +14 -30
- package/esm/components/ListItem.js.map +7 -0
- package/esm/components/NoResults.js +26 -43
- package/esm/components/NoResults.js.map +7 -0
- package/esm/components/RowsLoader.js +13 -15
- package/esm/components/RowsLoader.js.map +7 -0
- package/esm/components/Table.js +45 -76
- package/esm/components/Table.js.map +7 -0
- package/esm/components/TableBody.js +32 -52
- package/esm/components/TableBody.js.map +7 -0
- package/esm/components/TableHeader.js +17 -23
- package/esm/components/TableHeader.js.map +7 -0
- package/esm/components/footer/addOptionalFooterComponents.js +24 -37
- package/esm/components/footer/addOptionalFooterComponents.js.map +7 -0
- package/esm/components/header/PrimaryControls.js +20 -29
- package/esm/components/header/PrimaryControls.js.map +7 -0
- package/esm/components/header/addOptionalHeaderComponents.js +25 -36
- package/esm/components/header/addOptionalHeaderComponents.js.map +7 -0
- package/esm/components/index.js +14 -5
- package/esm/components/index.js.map +7 -0
- package/esm/components/renderers/defaultClassedRenderers.js +41 -46
- package/esm/components/renderers/defaultClassedRenderers.js.map +7 -0
- package/esm/components/renderers/index.js +16 -5
- package/esm/components/renderers/index.js.map +7 -0
- package/esm/components/renderers/renderRowsLoader.js +10 -10
- package/esm/components/renderers/renderRowsLoader.js.map +7 -0
- package/esm/components/tableContext.js +7 -5
- package/esm/components/tableContext.js.map +7 -0
- package/esm/defaultPlugins.js +15 -8
- package/esm/defaultPlugins.js.map +7 -0
- package/esm/index.js +63 -27
- package/esm/index.js.map +7 -0
- package/esm/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js +71 -101
- package/esm/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js.map +7 -0
- package/esm/plugins/body-header-scroll-sync/index.js +6 -1
- package/esm/plugins/body-header-scroll-sync/index.js.map +7 -0
- package/esm/plugins/column-dnd/DndColumnsPlugin.js +69 -68
- package/esm/plugins/column-dnd/DndColumnsPlugin.js.map +7 -0
- package/esm/plugins/column-dnd/decorateGridWithDndColumns.js +16 -18
- package/esm/plugins/column-dnd/decorateGridWithDndColumns.js.map +7 -0
- package/esm/plugins/column-dnd/index.js +6 -1
- package/esm/plugins/column-dnd/index.js.map +7 -0
- package/esm/plugins/column-sizing/ColumnSizingPlugin.js +20 -37
- package/esm/plugins/column-sizing/ColumnSizingPlugin.js.map +7 -0
- package/esm/plugins/column-sizing/columnMeasurerTransformer.js +16 -42
- package/esm/plugins/column-sizing/columnMeasurerTransformer.js.map +7 -0
- package/esm/plugins/column-sizing/ext-points/decorateColumn.js +9 -7
- package/esm/plugins/column-sizing/ext-points/decorateColumn.js.map +7 -0
- package/esm/plugins/column-sizing/ext-points/getTableProps.js +23 -43
- package/esm/plugins/column-sizing/ext-points/getTableProps.js.map +7 -0
- package/esm/plugins/column-sizing/getColumnNameFromProperty.js +8 -7
- package/esm/plugins/column-sizing/getColumnNameFromProperty.js.map +7 -0
- package/esm/plugins/column-sizing/index.js +6 -1
- package/esm/plugins/column-sizing/index.js.map +7 -0
- package/esm/plugins/column-sizing/useColumnSizeService.js +34 -71
- package/esm/plugins/column-sizing/useColumnSizeService.js.map +7 -0
- package/esm/plugins/column-sizing/useStylesheetHelpers.js +64 -171
- package/esm/plugins/column-sizing/useStylesheetHelpers.js.map +7 -0
- package/esm/plugins/column-sizing/utils.js +23 -21
- package/esm/plugins/column-sizing/utils.js.map +7 -0
- package/esm/plugins/custom-cell-renderer/CustomRendererPlugin.js +8 -7
- package/esm/plugins/custom-cell-renderer/CustomRendererPlugin.js.map +7 -0
- package/esm/plugins/custom-cell-renderer/addCustomRendererToCell.js +28 -43
- package/esm/plugins/custom-cell-renderer/addCustomRendererToCell.js.map +7 -0
- package/esm/plugins/custom-cell-renderer/getRendererComponent.js +22 -44
- package/esm/plugins/custom-cell-renderer/getRendererComponent.js.map +7 -0
- package/esm/plugins/custom-cell-renderer/index.js +6 -1
- package/esm/plugins/custom-cell-renderer/index.js.map +7 -0
- package/esm/plugins/editable/EditableComponents/ComboBox.js +20 -46
- package/esm/plugins/editable/EditableComponents/ComboBox.js.map +7 -0
- package/esm/plugins/editable/EditableComponents/TextBox.js +26 -68
- package/esm/plugins/editable/EditableComponents/TextBox.js.map +7 -0
- package/esm/plugins/editable/EditableComponents/index.js +8 -2
- package/esm/plugins/editable/EditableComponents/index.js.map +7 -0
- package/esm/plugins/editable/EditablePlugin.js +27 -63
- package/esm/plugins/editable/EditablePlugin.js.map +7 -0
- package/esm/plugins/editable/decorateEditable.js +32 -68
- package/esm/plugins/editable/decorateEditable.js.map +7 -0
- package/esm/plugins/editable/getEditorComponent.js +39 -66
- package/esm/plugins/editable/getEditorComponent.js.map +7 -0
- package/esm/plugins/editable/index.js +9 -3
- package/esm/plugins/editable/index.js.map +7 -0
- package/esm/plugins/expandable-grid/ExpandableColumn.js +82 -133
- package/esm/plugins/expandable-grid/ExpandableColumn.js.map +7 -0
- package/esm/plugins/expandable-grid/ExpandablePlugin.js +81 -160
- package/esm/plugins/expandable-grid/ExpandablePlugin.js.map +7 -0
- package/esm/plugins/expandable-grid/ExpandedRow.js +86 -124
- package/esm/plugins/expandable-grid/ExpandedRow.js.map +7 -0
- package/esm/plugins/expandable-grid/ExpandedRowExtra.js +25 -44
- package/esm/plugins/expandable-grid/ExpandedRowExtra.js.map +7 -0
- package/esm/plugins/expandable-grid/index.js +8 -2
- package/esm/plugins/expandable-grid/index.js.map +7 -0
- package/esm/plugins/expandable-grid/useExpandGridState.js +14 -25
- package/esm/plugins/expandable-grid/useExpandGridState.js.map +7 -0
- package/esm/plugins/export-data/ExportDataPlugin.js +52 -103
- package/esm/plugins/export-data/ExportDataPlugin.js.map +7 -0
- package/esm/plugins/export-data/index.js +6 -1
- package/esm/plugins/export-data/index.js.map +7 -0
- package/esm/plugins/filterable/FilterablePlugin.js +22 -44
- package/esm/plugins/filterable/FilterablePlugin.js.map +7 -0
- package/esm/plugins/filterable/addFilterToColumn.js +11 -20
- package/esm/plugins/filterable/addFilterToColumn.js.map +7 -0
- package/esm/plugins/filterable/components/FilterableHeader.js +85 -95
- package/esm/plugins/filterable/components/FilterableHeader.js.map +7 -0
- package/esm/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js +83 -103
- package/esm/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js.map +7 -0
- package/esm/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js +68 -63
- package/esm/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js.map +7 -0
- package/esm/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js +108 -116
- package/esm/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js.map +7 -0
- package/esm/plugins/filterable/components/filterable-menus/TextFilterMenu.js +84 -106
- package/esm/plugins/filterable/components/filterable-menus/TextFilterMenu.js.map +7 -0
- package/esm/plugins/filterable/components/filterable-menus/defaultDateFormat.js +6 -3
- package/esm/plugins/filterable/components/filterable-menus/defaultDateFormat.js.map +7 -0
- package/esm/plugins/filterable/components/filterable-menus/getFilterMenuByType.js +16 -12
- package/esm/plugins/filterable/components/filterable-menus/getFilterMenuByType.js.map +7 -0
- package/esm/plugins/filterable/filterableFormatter.js +32 -45
- package/esm/plugins/filterable/filterableFormatter.js.map +7 -0
- package/esm/plugins/filterable/filtering-helper/filterRowsByQuery.js +29 -44
- package/esm/plugins/filterable/filtering-helper/filterRowsByQuery.js.map +7 -0
- package/esm/plugins/filterable/filtering-helper/strategiesOperators.js +11 -13
- package/esm/plugins/filterable/filtering-helper/strategiesOperators.js.map +7 -0
- package/esm/plugins/filterable/helper.js +42 -62
- package/esm/plugins/filterable/helper.js.map +7 -0
- package/esm/plugins/filterable/index.js +6 -1
- package/esm/plugins/filterable/index.js.map +7 -0
- package/esm/plugins/filterable/useFilterableState.js +33 -54
- package/esm/plugins/filterable/useFilterableState.js.map +7 -0
- package/esm/plugins/grouping-by/GroupingByPlugin.js +10 -14
- package/esm/plugins/grouping-by/GroupingByPlugin.js.map +7 -0
- package/esm/plugins/grouping-grid/GroupingPlugin.js +53 -94
- package/esm/plugins/grouping-grid/GroupingPlugin.js.map +7 -0
- package/esm/plugins/grouping-grid/walkStrategy.js +17 -22
- package/esm/plugins/grouping-grid/walkStrategy.js.map +7 -0
- package/esm/plugins/index.js +39 -19
- package/esm/plugins/index.js.map +7 -0
- package/esm/plugins/infinite-scrolling/InfiniteScrollPlugin.js +31 -74
- package/esm/plugins/infinite-scrolling/InfiniteScrollPlugin.js.map +7 -0
- package/esm/plugins/infinite-scrolling/index.js +6 -1
- package/esm/plugins/infinite-scrolling/index.js.map +7 -0
- package/esm/plugins/pagination/PaginationPlugin.js +42 -75
- package/esm/plugins/pagination/PaginationPlugin.js.map +7 -0
- package/esm/plugins/pagination/components/Pagination.js +25 -27
- package/esm/plugins/pagination/components/Pagination.js.map +7 -0
- package/esm/plugins/pagination/components/Paginator.js +29 -35
- package/esm/plugins/pagination/components/Paginator.js.map +7 -0
- package/esm/plugins/pagination/components/PerPageDropdown.js +22 -54
- package/esm/plugins/pagination/components/PerPageDropdown.js.map +7 -0
- package/esm/plugins/pagination/helper.js +16 -19
- package/esm/plugins/pagination/helper.js.map +7 -0
- package/esm/plugins/pagination/index.js +6 -1
- package/esm/plugins/pagination/index.js.map +7 -0
- package/esm/plugins/pagination/usePaginationState.js +15 -28
- package/esm/plugins/pagination/usePaginationState.js.map +7 -0
- package/esm/plugins/resizable/ResizablePlugin.js +20 -45
- package/esm/plugins/resizable/ResizablePlugin.js.map +7 -0
- package/esm/plugins/resizable/decorateResizable.js +19 -41
- package/esm/plugins/resizable/decorateResizable.js.map +7 -0
- package/esm/plugins/resizable/index.js +6 -1
- package/esm/plugins/resizable/index.js.map +7 -0
- package/esm/plugins/resizable/useResizeHandle.js +24 -39
- package/esm/plugins/resizable/useResizeHandle.js.map +7 -0
- package/esm/plugins/resizable/utils.js +20 -18
- package/esm/plugins/resizable/utils.js.map +7 -0
- package/esm/plugins/row-dnd/DndRowsPlugin.js +73 -71
- package/esm/plugins/row-dnd/DndRowsPlugin.js.map +7 -0
- package/esm/plugins/row-dnd/index.js +6 -1
- package/esm/plugins/row-dnd/index.js.map +7 -0
- package/esm/plugins/selectable/SelectablePlugin.js +64 -117
- package/esm/plugins/selectable/SelectablePlugin.js.map +7 -0
- package/esm/plugins/selectable/addSelectableColumn.js +39 -57
- package/esm/plugins/selectable/addSelectableColumn.js.map +7 -0
- package/esm/plugins/selectable/helper.js +19 -25
- package/esm/plugins/selectable/helper.js.map +7 -0
- package/esm/plugins/selectable/index.js +6 -1
- package/esm/plugins/selectable/index.js.map +7 -0
- package/esm/plugins/selectable/selectableFormatter.js +54 -97
- package/esm/plugins/selectable/selectableFormatter.js.map +7 -0
- package/esm/plugins/selectable/useSelectableState.js +34 -78
- package/esm/plugins/selectable/useSelectableState.js.map +7 -0
- package/esm/plugins/sortable/SortablePlugin.js +30 -43
- package/esm/plugins/sortable/SortablePlugin.js.map +7 -0
- package/esm/plugins/sortable/checkIfSortable.js +8 -9
- package/esm/plugins/sortable/checkIfSortable.js.map +7 -0
- package/esm/plugins/sortable/index.js +6 -1
- package/esm/plugins/sortable/index.js.map +7 -0
- package/esm/plugins/sortable/sortHeaderFormatter.js +27 -43
- package/esm/plugins/sortable/sortHeaderFormatter.js.map +7 -0
- package/esm/plugins/sortable/sortTree.js +13 -24
- package/esm/plugins/sortable/sortTree.js.map +7 -0
- package/esm/plugins/sortable/sorter.js +112 -163
- package/esm/plugins/sortable/sorter.js.map +7 -0
- package/esm/plugins/sortable/useSortableState.js +22 -49
- package/esm/plugins/sortable/useSortableState.js.map +7 -0
- package/esm/plugins/toolbar/RowRenderer.js +40 -61
- package/esm/plugins/toolbar/RowRenderer.js.map +7 -0
- package/esm/plugins/toolbar/ToolbarPlugin.js +19 -23
- package/esm/plugins/toolbar/ToolbarPlugin.js.map +7 -0
- package/esm/plugins/toolbar/ToolbarTrigger.js +59 -57
- package/esm/plugins/toolbar/ToolbarTrigger.js.map +7 -0
- package/esm/plugins/toolbar/index.js +6 -1
- package/esm/plugins/toolbar/index.js.map +7 -0
- package/esm/plugins/virtualization/AutoHeightList.js +30 -40
- package/esm/plugins/virtualization/AutoHeightList.js.map +7 -0
- package/esm/plugins/virtualization/VirtualizationPlugin.js +55 -84
- package/esm/plugins/virtualization/VirtualizationPlugin.js.map +7 -0
- package/esm/plugins/virtualization/VirtualizedBody.js +94 -132
- package/esm/plugins/virtualization/VirtualizedBody.js.map +7 -0
- package/esm/plugins/virtualization/VirtualizedBodyRow.js +10 -15
- package/esm/plugins/virtualization/VirtualizedBodyRow.js.map +7 -0
- package/esm/plugins/virtualization/helper.js +6 -3
- package/esm/plugins/virtualization/helper.js.map +7 -0
- package/esm/plugins/virtualization/index.js +6 -1
- package/esm/plugins/virtualization/index.js.map +7 -0
- package/esm/renders/CellWithAddons.js +69 -40
- package/esm/renders/CellWithAddons.js.map +7 -0
- package/esm/renders/index.js +8 -2
- package/esm/renders/index.js.map +7 -0
- package/esm/renders/styled.js +49 -16
- package/esm/renders/styled.js.map +7 -0
- package/esm/rowSizes.js +15 -6
- package/esm/rowSizes.js.map +7 -0
- package/esm/utilities/DataGridUtilities.json +1315 -0
- package/esm/utilities/getPluginsFromProps.js +25 -24
- package/esm/utilities/getPluginsFromProps.js.map +7 -0
- package/esm/utilities/getScrollbarSize.js +15 -21
- package/esm/utilities/getScrollbarSize.js.map +7 -0
- package/esm/utilities/normalizeData.js +15 -24
- package/esm/utilities/normalizeData.js.map +7 -0
- package/package.json +20 -20
- package/types/DSDataGrid.d.ts +1 -1
- package/types/DataGridImpl.d.ts +3 -2
- package/types/PaginatedDataGrid.d.ts +1 -2
- package/types/columns/IconColumn.d.ts +3 -2
- package/types/components/BodyCell.d.ts +13 -12
- package/types/components/ColumnVisibilityMenuOption.d.ts +2 -2
- package/types/components/ColumnsOptionsMenuSection.d.ts +1 -0
- package/types/components/HeaderCell.d.ts +10 -10
- package/types/components/NoResults.d.ts +2 -2
- package/types/components/RowsLoader.d.ts +2 -2
- package/types/components/Table.d.ts +6 -11
- package/types/components/TableBody.d.ts +3 -8
- package/types/components/TableHeader.d.ts +2 -1
- package/types/components/footer/addOptionalFooterComponents.d.ts +1 -0
- package/types/components/header/PrimaryControls.d.ts +1 -0
- package/types/components/header/addOptionalHeaderComponents.d.ts +1 -1
- package/types/components/renderers/index.d.ts +1 -1
- package/types/components/renderers/renderRowsLoader.d.ts +1 -1
- package/types/index.d.ts +7 -8
- package/types/plugins/body-header-scroll-sync/index.d.ts +1 -1
- package/types/plugins/column-dnd/index.d.ts +1 -1
- package/types/plugins/column-sizing/getColumnNameFromProperty.d.ts +2 -1
- package/types/plugins/column-sizing/index.d.ts +1 -1
- package/types/plugins/column-sizing/useColumnSizeService.d.ts +2 -1
- package/types/plugins/custom-cell-renderer/addCustomRendererToCell.d.ts +1 -0
- package/types/plugins/custom-cell-renderer/getRendererComponent.d.ts +1 -0
- package/types/plugins/custom-cell-renderer/index.d.ts +1 -1
- package/types/plugins/editable/EditableComponents/ComboBox.d.ts +3 -1
- package/types/plugins/editable/EditableComponents/TextBox.d.ts +3 -1
- package/types/plugins/editable/getEditorComponent.d.ts +1 -0
- package/types/plugins/editable/index.d.ts +2 -2
- package/types/plugins/expandable-grid/ExpandableColumn.d.ts +3 -2
- package/types/plugins/expandable-grid/ExpandedRow.d.ts +1 -0
- package/types/plugins/expandable-grid/ExpandedRowExtra.d.ts +1 -0
- package/types/plugins/expandable-grid/index.d.ts +2 -2
- package/types/plugins/export-data/index.d.ts +1 -1
- package/types/plugins/filterable/components/FilterableHeader.d.ts +15 -15
- package/types/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.d.ts +1 -0
- package/types/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.d.ts +1 -0
- package/types/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.d.ts +2 -1
- package/types/plugins/filterable/components/filterable-menus/TextFilterMenu.d.ts +1 -0
- package/types/plugins/filterable/components/filterable-menus/getFilterMenuByType.d.ts +2 -1
- package/types/plugins/filterable/filterableFormatter.d.ts +3 -2
- package/types/plugins/filterable/filtering-helper/filterRowsByQuery.d.ts +2 -1
- package/types/plugins/filterable/filtering-helper/strategiesOperators.d.ts +2 -2
- package/types/plugins/filterable/index.d.ts +1 -1
- package/types/plugins/index.d.ts +16 -16
- package/types/plugins/infinite-scrolling/index.d.ts +1 -1
- package/types/plugins/pagination/components/Paginator.d.ts +1 -0
- package/types/plugins/pagination/components/PerPageDropdown.d.ts +1 -0
- package/types/plugins/pagination/helper.d.ts +3 -2
- package/types/plugins/pagination/index.d.ts +1 -1
- package/types/plugins/resizable/index.d.ts +1 -1
- package/types/plugins/row-dnd/index.d.ts +1 -1
- package/types/plugins/selectable/index.d.ts +1 -1
- package/types/plugins/selectable/selectableFormatter.d.ts +1 -0
- package/types/plugins/sortable/index.d.ts +1 -1
- package/types/plugins/sortable/sortHeaderFormatter.d.ts +1 -0
- package/types/plugins/sortable/sortTree.d.ts +1 -0
- package/types/plugins/sortable/sorter.d.ts +1 -1
- package/types/plugins/toolbar/index.d.ts +1 -1
- package/types/plugins/virtualization/AutoHeightList.d.ts +1 -1
- package/types/plugins/virtualization/VirtualizedBody.d.ts +1 -0
- package/types/plugins/virtualization/VirtualizedBodyRow.d.ts +2 -2
- package/types/plugins/virtualization/index.d.ts +1 -1
- package/types/utilities/getPluginsFromProps.d.ts +2 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState, useCallback
|
|
3
|
-
import cx from
|
|
4
|
-
import { isFunction } from
|
|
5
|
-
import createInstancePlugin from
|
|
6
|
-
import { selectionColumnCreator } from
|
|
7
|
-
import { useSelectableState } from
|
|
8
|
-
import { selectMultipleRow, selectSingleRow } from
|
|
9
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useEffect, useState, useCallback } from "react";
|
|
3
|
+
import cx from "obj-str";
|
|
4
|
+
import { isFunction } from "@elliemae/ds-utilities";
|
|
5
|
+
import { createInstancePlugin } from "@elliemae/ds-shared/createDataInstance/createInstancePlugin";
|
|
6
|
+
import { selectionColumnCreator } from "./addSelectableColumn";
|
|
7
|
+
import { useSelectableState } from "./useSelectableState";
|
|
8
|
+
import { selectMultipleRow, selectSingleRow } from "./helper";
|
|
10
9
|
const decorateColumns = (columns, grid) => {
|
|
11
10
|
const {
|
|
12
11
|
props: {
|
|
@@ -16,17 +15,12 @@ const decorateColumns = (columns, grid) => {
|
|
|
16
15
|
multiSelectFilterLabels,
|
|
17
16
|
multiSelectComponent
|
|
18
17
|
},
|
|
19
|
-
actions: {
|
|
20
|
-
|
|
21
|
-
selectRow: handleSelectRow
|
|
22
|
-
},
|
|
23
|
-
state: {
|
|
24
|
-
selection
|
|
25
|
-
}
|
|
18
|
+
actions: { selectAll: handleSelectAll, selectRow: handleSelectRow },
|
|
19
|
+
state: { selection }
|
|
26
20
|
} = grid;
|
|
27
21
|
const createSelectionColumn = selectionColumnCreator({
|
|
28
22
|
grid,
|
|
29
|
-
multiple: selectable ===
|
|
23
|
+
multiple: selectable === "multi",
|
|
30
24
|
selectAll: selection.selectAll,
|
|
31
25
|
onSelectAll: handleSelectAll,
|
|
32
26
|
onSelectRow: handleSelectRow,
|
|
@@ -35,102 +29,63 @@ const decorateColumns = (columns, grid) => {
|
|
|
35
29
|
multiSelectFilterLabels,
|
|
36
30
|
multiSelectComponent
|
|
37
31
|
});
|
|
38
|
-
const {
|
|
39
|
-
showSelectColumn,
|
|
40
|
-
selectionColumnDefinition
|
|
41
|
-
} = grid.props;
|
|
42
|
-
|
|
32
|
+
const { showSelectColumn, selectionColumnDefinition } = grid.props;
|
|
43
33
|
if (showSelectColumn) {
|
|
44
34
|
const selectionColumn = createSelectionColumn(selectionColumnDefinition);
|
|
45
35
|
return [selectionColumn, ...columns];
|
|
46
36
|
}
|
|
47
|
-
|
|
48
37
|
return columns;
|
|
49
38
|
};
|
|
50
|
-
|
|
51
|
-
const getRowProps = (rowProps, grid, _ref) => {
|
|
52
|
-
let {
|
|
53
|
-
rowData
|
|
54
|
-
} = _ref;
|
|
39
|
+
const getRowProps = (rowProps, grid, { rowData }) => {
|
|
55
40
|
const {
|
|
56
|
-
props: {
|
|
57
|
-
|
|
58
|
-
showSelectColumn,
|
|
59
|
-
rowKey
|
|
60
|
-
},
|
|
61
|
-
actions: {
|
|
62
|
-
selectRow
|
|
63
|
-
}
|
|
41
|
+
props: { showSelectHighlight, showSelectColumn, rowKey },
|
|
42
|
+
actions: { selectRow }
|
|
64
43
|
} = grid.getInstance();
|
|
65
|
-
const {
|
|
66
|
-
|
|
67
|
-
} = rowData;
|
|
68
|
-
const isSelected = rowData['metaData.selected'];
|
|
69
|
-
|
|
44
|
+
const { _index } = rowData;
|
|
45
|
+
const isSelected = rowData["metaData.selected"];
|
|
70
46
|
if (!showSelectColumn) {
|
|
71
47
|
rowProps.onClick = () => selectRow(rowData[rowKey], _index);
|
|
72
48
|
}
|
|
73
|
-
|
|
74
49
|
rowProps.className = cx({
|
|
75
50
|
[rowProps.className]: true,
|
|
76
51
|
selected: isSelected,
|
|
77
|
-
|
|
52
|
+
"select-highlight": showSelectHighlight && isSelected
|
|
78
53
|
});
|
|
79
54
|
return rowProps;
|
|
80
55
|
};
|
|
81
|
-
|
|
82
56
|
const composeRows = (rows, grid) => {
|
|
83
57
|
const {
|
|
84
|
-
props: {
|
|
85
|
-
|
|
86
|
-
multiple,
|
|
87
|
-
rowKey
|
|
88
|
-
},
|
|
89
|
-
state: {
|
|
90
|
-
selection
|
|
91
|
-
}
|
|
58
|
+
props: { isRowSelected, multiple, rowKey },
|
|
59
|
+
state: { selection }
|
|
92
60
|
} = grid.getInstance();
|
|
93
|
-
|
|
94
|
-
const selectionPredicate = row => isFunction(isRowSelected) ? isRowSelected(row) : !!selection.selectedRows[row[rowKey]];
|
|
95
|
-
|
|
61
|
+
const selectionPredicate = (row) => isFunction(isRowSelected) ? isRowSelected(row) : !!selection.selectedRows[row[rowKey]];
|
|
96
62
|
return multiple ? selectMultipleRow(rows, selectionPredicate) : selectSingleRow(rows, selectionPredicate);
|
|
97
63
|
};
|
|
98
|
-
|
|
99
|
-
const decorateGrid = grid => {
|
|
100
|
-
// const handler = useRef();
|
|
64
|
+
const decorateGrid = (grid) => {
|
|
101
65
|
const {
|
|
102
|
-
props: {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
actions: {
|
|
107
|
-
selectRow
|
|
108
|
-
},
|
|
109
|
-
state: {
|
|
110
|
-
selection
|
|
111
|
-
}
|
|
66
|
+
props: { isRowSelected, rowKey },
|
|
67
|
+
actions: { selectRow },
|
|
68
|
+
state: { selection }
|
|
112
69
|
} = grid.getInstance();
|
|
113
70
|
const [shiftPressed, setShiftPressed] = useState(false);
|
|
114
71
|
const [lastSelectedRow, setLastSelectedRow] = useState(null);
|
|
115
72
|
const selectRowHandler = useCallback((rowData, index) => () => selectRow(rowData[rowKey], index, shiftPressed), [isRowSelected, selection, shiftPressed]);
|
|
116
73
|
useEffect(() => {
|
|
117
|
-
const keyDownListener = event => {
|
|
118
|
-
if (event.key ===
|
|
74
|
+
const keyDownListener = (event) => {
|
|
75
|
+
if (event.key === "Shift" && event.target.tagName.toLowerCase() !== "input" && event.target.parentNode.className !== "em-ds-combobox__input") {
|
|
119
76
|
setShiftPressed(true);
|
|
120
77
|
}
|
|
121
78
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (event.key === 'Shift' && event.target.tagName.toLowerCase() !== 'input' && event.target.parentNode.className !== 'em-ds-combobox__input') {
|
|
79
|
+
const keyUpListener = (event) => {
|
|
80
|
+
if (event.key === "Shift" && event.target.tagName.toLowerCase() !== "input" && event.target.parentNode.className !== "em-ds-combobox__input") {
|
|
125
81
|
setShiftPressed(false);
|
|
126
82
|
}
|
|
127
83
|
};
|
|
128
|
-
|
|
129
|
-
window.addEventListener(
|
|
130
|
-
window.addEventListener('keyup', keyUpListener);
|
|
84
|
+
window.addEventListener("keydown", keyDownListener);
|
|
85
|
+
window.addEventListener("keyup", keyUpListener);
|
|
131
86
|
return () => {
|
|
132
|
-
window.removeEventListener(
|
|
133
|
-
window.removeEventListener(
|
|
87
|
+
window.removeEventListener("keydown", keyDownListener);
|
|
88
|
+
window.removeEventListener("keyup", keyUpListener);
|
|
134
89
|
};
|
|
135
90
|
});
|
|
136
91
|
return {
|
|
@@ -140,51 +95,43 @@ const decorateGrid = grid => {
|
|
|
140
95
|
lastSelectedRow
|
|
141
96
|
};
|
|
142
97
|
};
|
|
143
|
-
|
|
144
|
-
const SelectablePlugin = createInstancePlugin('selectable', {
|
|
98
|
+
const SelectablePlugin = createInstancePlugin("selectable", {
|
|
145
99
|
decorateGrid,
|
|
146
100
|
registerStateHook: useSelectableState,
|
|
147
101
|
decorateColumns,
|
|
148
102
|
getRowProps,
|
|
149
103
|
composeRows,
|
|
150
|
-
|
|
151
104
|
registerHotKeys(grid) {
|
|
152
|
-
return [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
selection
|
|
178
|
-
},
|
|
179
|
-
actions: {
|
|
180
|
-
selectAll
|
|
181
|
-
}
|
|
182
|
-
} = grid.getInstance();
|
|
183
|
-
selectAll(!selection.selectAll);
|
|
105
|
+
return [
|
|
106
|
+
{
|
|
107
|
+
key: "space",
|
|
108
|
+
handler: ({ rowIndex }) => {
|
|
109
|
+
const {
|
|
110
|
+
composedRows,
|
|
111
|
+
props: { rowKey },
|
|
112
|
+
actions: { selectRow }
|
|
113
|
+
} = grid.getInstance();
|
|
114
|
+
const rows = composedRows.rows || composedRows;
|
|
115
|
+
const row = rows[rowIndex];
|
|
116
|
+
if (!row)
|
|
117
|
+
return;
|
|
118
|
+
selectRow(row[rowKey], rowIndex);
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: "ctrl+a",
|
|
123
|
+
handler: () => {
|
|
124
|
+
const {
|
|
125
|
+
state: { selection },
|
|
126
|
+
actions: { selectAll }
|
|
127
|
+
} = grid.getInstance();
|
|
128
|
+
selectAll(!selection.selectAll);
|
|
129
|
+
}
|
|
184
130
|
}
|
|
185
|
-
|
|
131
|
+
];
|
|
186
132
|
}
|
|
187
|
-
|
|
188
133
|
});
|
|
189
|
-
|
|
190
|
-
|
|
134
|
+
export {
|
|
135
|
+
SelectablePlugin
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=SelectablePlugin.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/plugins/selectable/SelectablePlugin.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react-hooks/rules-of-hooks */\n/* eslint-disable max-lines */\nimport { useEffect, useState, useCallback } from 'react';\nimport cx from 'obj-str';\nimport { isFunction } from '@elliemae/ds-utilities';\nimport { createInstancePlugin } from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';\nimport { selectionColumnCreator } from './addSelectableColumn';\nimport { useSelectableState } from './useSelectableState';\nimport { selectMultipleRow, selectSingleRow } from './helper';\n\n// DECORATORS\nconst decorateColumns = (columns, grid) => {\n const {\n props: {\n selectable,\n multiSelectFilterLabel,\n multiSelectFilterOptions,\n multiSelectFilterLabels,\n multiSelectComponent,\n },\n actions: { selectAll: handleSelectAll, selectRow: handleSelectRow },\n state: { selection },\n } = grid;\n\n const createSelectionColumn = selectionColumnCreator({\n grid,\n multiple: selectable === 'multi',\n selectAll: selection.selectAll,\n onSelectAll: handleSelectAll,\n onSelectRow: handleSelectRow,\n multiSelectFilterLabel,\n multiSelectFilterOptions,\n multiSelectFilterLabels,\n multiSelectComponent,\n });\n\n const { showSelectColumn, selectionColumnDefinition } = grid.props;\n\n if (showSelectColumn) {\n const selectionColumn = createSelectionColumn(selectionColumnDefinition);\n return [selectionColumn, ...columns];\n }\n return columns;\n};\n\nconst getRowProps = (rowProps, grid, { rowData }) => {\n const {\n props: { showSelectHighlight, showSelectColumn, rowKey },\n actions: { selectRow },\n } = grid.getInstance();\n\n const { _index } = rowData;\n const isSelected = rowData['metaData.selected'];\n\n if (!showSelectColumn) {\n rowProps.onClick = () => selectRow(rowData[rowKey], _index);\n }\n\n rowProps.className = cx({\n [rowProps.className]: true,\n selected: isSelected,\n 'select-highlight': showSelectHighlight && isSelected,\n });\n\n return rowProps;\n};\n\nconst composeRows = (rows, grid) => {\n const {\n props: { isRowSelected, multiple, rowKey },\n state: { selection },\n } = grid.getInstance();\n\n const selectionPredicate = (row) =>\n isFunction(isRowSelected) ? isRowSelected(row) : !!selection.selectedRows[row[rowKey]];\n\n return multiple ? selectMultipleRow(rows, selectionPredicate) : selectSingleRow(rows, selectionPredicate);\n};\n\nconst decorateGrid = (grid) => {\n // const handler = useRef();\n const {\n props: { isRowSelected, rowKey },\n actions: { selectRow },\n state: { selection },\n } = grid.getInstance();\n const [shiftPressed, setShiftPressed] = useState(false);\n const [lastSelectedRow, setLastSelectedRow] = useState(null);\n\n const selectRowHandler = useCallback(\n (rowData, index) => () => selectRow(rowData[rowKey], index, shiftPressed),\n [isRowSelected, selection, shiftPressed],\n );\n\n useEffect(() => {\n const keyDownListener = (event) => {\n if (\n event.key === 'Shift' &&\n event.target.tagName.toLowerCase() !== 'input' &&\n event.target.parentNode.className !== 'em-ds-combobox__input'\n ) {\n setShiftPressed(true);\n }\n };\n const keyUpListener = (event) => {\n if (\n event.key === 'Shift' &&\n event.target.tagName.toLowerCase() !== 'input' &&\n event.target.parentNode.className !== 'em-ds-combobox__input'\n ) {\n setShiftPressed(false);\n }\n };\n window.addEventListener('keydown', keyDownListener);\n window.addEventListener('keyup', keyUpListener);\n return () => {\n window.removeEventListener('keydown', keyDownListener);\n window.removeEventListener('keyup', keyUpListener);\n };\n });\n\n return {\n shiftPressed,\n selectRowHandler,\n setLastSelectedRow,\n lastSelectedRow,\n };\n};\n\nexport const SelectablePlugin = createInstancePlugin('selectable', {\n decorateGrid,\n registerStateHook: useSelectableState,\n decorateColumns,\n getRowProps,\n composeRows,\n registerHotKeys(grid) {\n return [\n {\n key: 'space',\n handler: ({ rowIndex }) => {\n const {\n composedRows,\n props: { rowKey },\n actions: { selectRow },\n } = grid.getInstance();\n const rows = composedRows.rows || composedRows;\n const row = rows[rowIndex];\n if (!row) return;\n selectRow(row[rowKey], rowIndex);\n },\n },\n {\n key: 'ctrl+a',\n handler: () => {\n const {\n state: { selection },\n actions: { selectAll },\n } = grid.getInstance();\n\n selectAll(!selection.selectAll);\n },\n },\n ];\n },\n});\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAM,kBAAkB,CAAC,SAAS,SAAS;AACzC,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAEF,SAAS,EAAE,WAAW,iBAAiB,WAAW;AAAA,IAClD,OAAO,EAAE;AAAA,MACP;AAEJ,QAAM,wBAAwB,uBAAuB;AAAA,IACnD;AAAA,IACA,UAAU,eAAe;AAAA,IACzB,WAAW,UAAU;AAAA,IACrB,aAAa;AAAA,IACb,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGF,QAAM,EAAE,kBAAkB,8BAA8B,KAAK;AAE7D,MAAI,kBAAkB;AACpB,UAAM,kBAAkB,sBAAsB;AAC9C,WAAO,CAAC,iBAAiB,GAAG;AAAA;AAE9B,SAAO;AAAA;AAGT,MAAM,cAAc,CAAC,UAAU,MAAM,EAAE,cAAc;AACnD,QAAM;AAAA,IACJ,OAAO,EAAE,qBAAqB,kBAAkB;AAAA,IAChD,SAAS,EAAE;AAAA,MACT,KAAK;AAET,QAAM,EAAE,WAAW;AACnB,QAAM,aAAa,QAAQ;AAE3B,MAAI,CAAC,kBAAkB;AACrB,aAAS,UAAU,MAAM,UAAU,QAAQ,SAAS;AAAA;AAGtD,WAAS,YAAY,GAAG;AAAA,KACrB,SAAS,YAAY;AAAA,IACtB,UAAU;AAAA,IACV,oBAAoB,uBAAuB;AAAA;AAG7C,SAAO;AAAA;AAGT,MAAM,cAAc,CAAC,MAAM,SAAS;AAClC,QAAM;AAAA,IACJ,OAAO,EAAE,eAAe,UAAU;AAAA,IAClC,OAAO,EAAE;AAAA,MACP,KAAK;AAET,QAAM,qBAAqB,CAAC,QAC1B,WAAW,iBAAiB,cAAc,OAAO,CAAC,CAAC,UAAU,aAAa,IAAI;AAEhF,SAAO,WAAW,kBAAkB,MAAM,sBAAsB,gBAAgB,MAAM;AAAA;AAGxF,MAAM,eAAe,CAAC,SAAS;AAE7B,QAAM;AAAA,IACJ,OAAO,EAAE,eAAe;AAAA,IACxB,SAAS,EAAE;AAAA,IACX,OAAO,EAAE;AAAA,MACP,KAAK;AACT,QAAM,CAAC,cAAc,mBAAmB,SAAS;AACjD,QAAM,CAAC,iBAAiB,sBAAsB,SAAS;AAEvD,QAAM,mBAAmB,YACvB,CAAC,SAAS,UAAU,MAAM,UAAU,QAAQ,SAAS,OAAO,eAC5D,CAAC,eAAe,WAAW;AAG7B,YAAU,MAAM;AACd,UAAM,kBAAkB,CAAC,UAAU;AACjC,UACE,MAAM,QAAQ,WACd,MAAM,OAAO,QAAQ,kBAAkB,WACvC,MAAM,OAAO,WAAW,cAAc,yBACtC;AACA,wBAAgB;AAAA;AAAA;AAGpB,UAAM,gBAAgB,CAAC,UAAU;AAC/B,UACE,MAAM,QAAQ,WACd,MAAM,OAAO,QAAQ,kBAAkB,WACvC,MAAM,OAAO,WAAW,cAAc,yBACtC;AACA,wBAAgB;AAAA;AAAA;AAGpB,WAAO,iBAAiB,WAAW;AACnC,WAAO,iBAAiB,SAAS;AACjC,WAAO,MAAM;AACX,aAAO,oBAAoB,WAAW;AACtC,aAAO,oBAAoB,SAAS;AAAA;AAAA;AAIxC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAIG,MAAM,mBAAmB,qBAAqB,cAAc;AAAA,EACjE;AAAA,EACA,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB,MAAM;AACpB,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,SAAS,CAAC,EAAE,eAAe;AACzB,gBAAM;AAAA,YACJ;AAAA,YACA,OAAO,EAAE;AAAA,YACT,SAAS,EAAE;AAAA,cACT,KAAK;AACT,gBAAM,OAAO,aAAa,QAAQ;AAClC,gBAAM,MAAM,KAAK;AACjB,cAAI,CAAC;AAAK;AACV,oBAAU,IAAI,SAAS;AAAA;AAAA;AAAA,MAG3B;AAAA,QACE,KAAK;AAAA,QACL,SAAS,MAAM;AACb,gBAAM;AAAA,YACJ,OAAO,EAAE;AAAA,YACT,SAAS,EAAE;AAAA,cACT,KAAK;AAET,oBAAU,CAAC,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,55 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
selectAll,
|
|
20
|
-
selectionComponent,
|
|
21
|
-
onSelectRow,
|
|
22
|
-
onSelectAll,
|
|
23
|
-
multiple,
|
|
24
|
-
// backward compatibility: later this needed to be passed through column definition
|
|
25
|
-
multiSelectFilterLabel,
|
|
26
|
-
multiSelectFilterOptions,
|
|
27
|
-
multiSelectFilterLabels,
|
|
28
|
-
multiSelectComponent // favor selectionComponent
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
3
|
+
appendCellFormatter,
|
|
4
|
+
appendHeaderFormatter
|
|
5
|
+
} from "@elliemae/ds-shared/useDataGrid/initColumnDefinition";
|
|
6
|
+
import { selectableFormatter } from "./selectableFormatter";
|
|
7
|
+
function selectionColumnCreator({
|
|
8
|
+
grid,
|
|
9
|
+
selectAll,
|
|
10
|
+
selectionComponent,
|
|
11
|
+
onSelectRow,
|
|
12
|
+
onSelectAll,
|
|
13
|
+
multiple,
|
|
14
|
+
multiSelectFilterLabel,
|
|
15
|
+
multiSelectFilterOptions,
|
|
16
|
+
multiSelectFilterLabels,
|
|
17
|
+
multiSelectComponent
|
|
18
|
+
}) {
|
|
31
19
|
const {
|
|
32
|
-
props: {
|
|
33
|
-
rowKey
|
|
34
|
-
}
|
|
20
|
+
props: { rowKey }
|
|
35
21
|
} = grid;
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
let selectionColumn = _objectSpread(_objectSpread({}, column), {}, {
|
|
52
|
-
property: 'metaData.selected',
|
|
22
|
+
return ({
|
|
23
|
+
visible = true,
|
|
24
|
+
isDataColumn = false,
|
|
25
|
+
width = 40,
|
|
26
|
+
minWidth,
|
|
27
|
+
cellRenderer,
|
|
28
|
+
headerCellRenderer,
|
|
29
|
+
customRenderer,
|
|
30
|
+
header,
|
|
31
|
+
...column
|
|
32
|
+
} = {}) => {
|
|
33
|
+
let selectionColumn = {
|
|
34
|
+
...column,
|
|
35
|
+
property: "metaData.selected",
|
|
53
36
|
filterLabel: multiSelectFilterLabel,
|
|
54
37
|
filterOptions: multiSelectFilterOptions,
|
|
55
38
|
filterLabels: multiSelectFilterLabels,
|
|
@@ -57,28 +40,27 @@ function selectionColumnCreator(_ref) {
|
|
|
57
40
|
width,
|
|
58
41
|
minWidth: minWidth || width,
|
|
59
42
|
isDataColumn
|
|
60
|
-
}
|
|
61
|
-
|
|
43
|
+
};
|
|
62
44
|
selectionColumn = appendCellFormatter(selectableFormatter({
|
|
63
45
|
isMultiSelect: multiple,
|
|
64
46
|
renderer: selectionComponent || multiSelectComponent,
|
|
65
47
|
onSelect: onSelectRow
|
|
66
48
|
}, grid))(selectionColumn);
|
|
67
|
-
|
|
68
49
|
if (multiple) {
|
|
69
50
|
selectionColumn = appendHeaderFormatter(selectableFormatter({
|
|
70
51
|
rowKey,
|
|
71
52
|
selectAll,
|
|
72
53
|
isMultiSelect: true,
|
|
73
54
|
isHeader: true,
|
|
74
|
-
className:
|
|
55
|
+
className: "multi-select-wrapper",
|
|
75
56
|
renderer: selectionComponent || multiSelectComponent,
|
|
76
57
|
onSelect: onSelectAll
|
|
77
58
|
}, grid))(selectionColumn);
|
|
78
59
|
}
|
|
79
|
-
|
|
80
60
|
return selectionColumn;
|
|
81
61
|
};
|
|
82
62
|
}
|
|
83
|
-
|
|
84
|
-
|
|
63
|
+
export {
|
|
64
|
+
selectionColumnCreator
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=addSelectableColumn.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/plugins/selectable/addSelectableColumn.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {\n appendCellFormatter,\n appendHeaderFormatter,\n} from '@elliemae/ds-shared/useDataGrid/initColumnDefinition';\nimport { selectableFormatter } from './selectableFormatter';\n\nexport function selectionColumnCreator({\n grid,\n selectAll,\n selectionComponent,\n onSelectRow,\n onSelectAll,\n multiple,\n\n // backward compatibility: later this needed to be passed through column definition\n multiSelectFilterLabel,\n multiSelectFilterOptions,\n multiSelectFilterLabels,\n multiSelectComponent, // favor selectionComponent\n}) {\n const {\n props: { rowKey },\n } = grid;\n\n return ({\n visible = true,\n isDataColumn = false,\n width = 40,\n minWidth,\n cellRenderer,\n headerCellRenderer,\n customRenderer,\n header,\n ...column\n } = {}) => {\n let selectionColumn = {\n ...column,\n property: 'metaData.selected',\n filterLabel: multiSelectFilterLabel,\n filterOptions: multiSelectFilterOptions,\n filterLabels: multiSelectFilterLabels,\n visible,\n width,\n minWidth: minWidth || width,\n isDataColumn,\n };\n selectionColumn = appendCellFormatter(\n selectableFormatter(\n {\n isMultiSelect: multiple,\n renderer: selectionComponent || multiSelectComponent,\n onSelect: onSelectRow,\n },\n grid,\n ),\n )(selectionColumn);\n\n if (multiple) {\n selectionColumn = appendHeaderFormatter(\n selectableFormatter(\n {\n rowKey,\n selectAll,\n isMultiSelect: true,\n isHeader: true,\n className: 'multi-select-wrapper',\n renderer: selectionComponent || multiSelectComponent,\n onSelect: onSelectAll,\n },\n grid,\n ),\n )(selectionColumn);\n }\n return selectionColumn;\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAAA;AAAA;AAAA;AAIA;AAEO,gCAAgC;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GACC;AACD,QAAM;AAAA,IACJ,OAAO,EAAE;AAAA,MACP;AAEJ,SAAO,CAAC;AAAA,IACN,UAAU;AAAA,IACV,eAAe;AAAA,IACf,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,OACG;AAAA,MACD,OAAO;AACT,QAAI,kBAAkB;AAAA,SACjB;AAAA,MACH,UAAU;AAAA,MACV,aAAa;AAAA,MACb,eAAe;AAAA,MACf,cAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA,UAAU,YAAY;AAAA,MACtB;AAAA;AAEF,sBAAkB,oBAChB,oBACE;AAAA,MACE,eAAe;AAAA,MACf,UAAU,sBAAsB;AAAA,MAChC,UAAU;AAAA,OAEZ,OAEF;AAEF,QAAI,UAAU;AACZ,wBAAkB,sBAChB,oBACE;AAAA,QACE;AAAA,QACA;AAAA,QACA,eAAe;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU,sBAAsB;AAAA,QAChC,UAAU;AAAA,SAEZ,OAEF;AAAA;AAEJ,WAAO;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
5
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
6
|
-
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
7
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
-
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
9
|
-
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
10
|
-
import 'core-js/modules/esnext.iterator.map.js';
|
|
11
|
-
import { toggleInObject } from '@elliemae/ds-utilities';
|
|
12
|
-
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { toggleInObject } from "@elliemae/ds-utilities";
|
|
16
3
|
const checkAllRowsSelected = (rows, selectedRows) => {
|
|
17
|
-
if (rows.length && selectedRows.length === rows.length)
|
|
18
|
-
|
|
4
|
+
if (rows.length && selectedRows.length === rows.length)
|
|
5
|
+
return true;
|
|
6
|
+
if (selectedRows.length)
|
|
7
|
+
return "mixed";
|
|
19
8
|
return false;
|
|
20
9
|
};
|
|
21
10
|
const toggleSelectAll = (rows, checked) => !checked ? {} : rows.reduce((nextSelRows, row) => toggleInObject(nextSelRows, row.id, true), {});
|
|
22
11
|
const toggleSingleSelectable = (selectedRows, id) => !selectedRows[id] ? toggleInObject({}, id, true) : {};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
const mergeSelectedToMetaData = (selected) => (row) => ({
|
|
13
|
+
...row,
|
|
14
|
+
"metaData.selected": selected
|
|
26
15
|
});
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
const selectSingleRow = (rows, filter) => rows.map((row) => mergeSelectedToMetaData(filter(row))(row));
|
|
17
|
+
const selectMultipleRow = (rows, isRowSelectedPredicate) => rows.map((row) => mergeSelectedToMetaData(isRowSelectedPredicate(row))(row));
|
|
18
|
+
export {
|
|
19
|
+
checkAllRowsSelected,
|
|
20
|
+
selectMultipleRow,
|
|
21
|
+
selectSingleRow,
|
|
22
|
+
toggleSelectAll,
|
|
23
|
+
toggleSingleSelectable
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/plugins/selectable/helper.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { toggleInObject } from '@elliemae/ds-utilities';\n\nexport const checkAllRowsSelected = (rows, selectedRows) => {\n if (rows.length && selectedRows.length === rows.length) return true;\n if (selectedRows.length) return 'mixed';\n return false;\n};\n\nexport const toggleSelectAll = (rows, checked) =>\n !checked ? {} : rows.reduce((nextSelRows, row) => toggleInObject(nextSelRows, row.id, true), {});\n\nexport const toggleSingleSelectable = (selectedRows, id) => (!selectedRows[id] ? toggleInObject({}, id, true) : {});\n\nconst mergeSelectedToMetaData = (selected) => (row) => ({\n ...row,\n 'metaData.selected': selected,\n});\n\nexport const selectSingleRow = (rows, filter) => rows.map((row) => mergeSelectedToMetaData(filter(row))(row));\n\nexport const selectMultipleRow = (rows, isRowSelectedPredicate) =>\n rows.map((row) => mergeSelectedToMetaData(isRowSelectedPredicate(row))(row));\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEO,MAAM,uBAAuB,CAAC,MAAM,iBAAiB;AAC1D,MAAI,KAAK,UAAU,aAAa,WAAW,KAAK;AAAQ,WAAO;AAC/D,MAAI,aAAa;AAAQ,WAAO;AAChC,SAAO;AAAA;AAGF,MAAM,kBAAkB,CAAC,MAAM,YACpC,CAAC,UAAU,KAAK,KAAK,OAAO,CAAC,aAAa,QAAQ,eAAe,aAAa,IAAI,IAAI,OAAO;AAExF,MAAM,yBAAyB,CAAC,cAAc,OAAQ,CAAC,aAAa,MAAM,eAAe,IAAI,IAAI,QAAQ;AAEhH,MAAM,0BAA0B,CAAC,aAAa,CAAC,QAAS;AAAA,KACnD;AAAA,EACH,qBAAqB;AAAA;AAGhB,MAAM,kBAAkB,CAAC,MAAM,WAAW,KAAK,IAAI,CAAC,QAAQ,wBAAwB,OAAO,MAAM;AAEjG,MAAM,oBAAoB,CAAC,MAAM,2BACtC,KAAK,IAAI,CAAC,QAAQ,wBAAwB,uBAAuB,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/plugins/selectable/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { SelectablePlugin } from './SelectablePlugin';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,107 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { DSCheckbox, DSRadio } from '@elliemae/ds-form';
|
|
11
|
-
import { jsx } from 'react/jsx-runtime';
|
|
12
|
-
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
-
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
|
|
17
|
-
const SelectableWrapper = _ref => {
|
|
18
|
-
let {
|
|
19
|
-
className,
|
|
20
|
-
children
|
|
21
|
-
} = _ref;
|
|
22
|
-
return /*#__PURE__*/_jsx("div", {
|
|
23
|
-
className: className,
|
|
24
|
-
onClick: e => e.stopPropagation()
|
|
25
|
-
}, void 0, children);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const SelectableComponent = /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
29
|
-
let {
|
|
30
|
-
className,
|
|
31
|
-
isMultiSelect,
|
|
32
|
-
isHeader,
|
|
33
|
-
onSelect,
|
|
34
|
-
isSelected,
|
|
35
|
-
value
|
|
36
|
-
} = _ref2;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { forwardRef, useEffect, useRef } from "react";
|
|
3
|
+
import { isFunction } from "@elliemae/ds-utilities";
|
|
4
|
+
import { DSCheckbox, DSRadio } from "@elliemae/ds-form";
|
|
5
|
+
const SelectableWrapper = ({ className, children }) => /* @__PURE__ */ React2.createElement("div", {
|
|
6
|
+
className,
|
|
7
|
+
onClick: (e) => e.stopPropagation()
|
|
8
|
+
}, children);
|
|
9
|
+
const SelectableComponent = React2.memo(forwardRef(({ className, isMultiSelect, isHeader, onSelect, isSelected, value }, ref) => {
|
|
37
10
|
const SelectComponent = isMultiSelect || isHeader ? DSCheckbox : DSRadio;
|
|
38
|
-
return
|
|
39
|
-
className
|
|
40
|
-
},
|
|
11
|
+
return /* @__PURE__ */ React2.createElement(SelectableWrapper, {
|
|
12
|
+
className
|
|
13
|
+
}, /* @__PURE__ */ React2.createElement(SelectComponent, {
|
|
41
14
|
checked: isSelected,
|
|
42
15
|
"data-testid": "column-selectable-component",
|
|
43
16
|
innerRef: ref,
|
|
44
17
|
onChange: onSelect,
|
|
45
18
|
tabIndex: -1,
|
|
46
|
-
value
|
|
19
|
+
value
|
|
47
20
|
}));
|
|
48
21
|
}, (prev, next) => next.isScrolling));
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
22
|
+
const selectableFormatter = ({ isMultiSelect = false, renderer, className, isHeader, onSelect }, grid) => (valueRender, extraParams) => {
|
|
23
|
+
const { registerFocus } = extraParams;
|
|
24
|
+
const ref = useRef();
|
|
25
|
+
const {
|
|
26
|
+
props: { rowKey },
|
|
27
|
+
state: { selection },
|
|
28
|
+
shiftPressed,
|
|
29
|
+
lastSelectedRow
|
|
30
|
+
} = grid.getInstance();
|
|
31
|
+
const { rowData, isScrolling } = extraParams;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (registerFocus)
|
|
34
|
+
registerFocus(ref.current);
|
|
35
|
+
}, [ref.current]);
|
|
36
|
+
const isSelected = isHeader ? selection.selectAll : !!selection.selectedRows[rowData[rowKey]];
|
|
37
|
+
const handleSelect = isHeader ? () => onSelect(!isSelected) : () => onSelect(rowData[rowKey], extraParams.rowIndex, shiftPressed, lastSelectedRow);
|
|
38
|
+
if (isFunction(renderer)) {
|
|
39
|
+
return /* @__PURE__ */ React2.createElement(SelectableWrapper, {
|
|
40
|
+
className
|
|
41
|
+
}, renderer({
|
|
42
|
+
rowData: {},
|
|
43
|
+
...extraParams,
|
|
44
|
+
value: isSelected,
|
|
45
|
+
isHeader,
|
|
46
|
+
onSelect: handleSelect
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ React2.createElement(SelectableComponent, {
|
|
50
|
+
ref,
|
|
54
51
|
className,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
state: {
|
|
68
|
-
selection
|
|
69
|
-
},
|
|
70
|
-
shiftPressed,
|
|
71
|
-
lastSelectedRow
|
|
72
|
-
} = grid.getInstance();
|
|
73
|
-
const {
|
|
74
|
-
rowData,
|
|
75
|
-
isScrolling
|
|
76
|
-
} = extraParams;
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
if (registerFocus) registerFocus(ref.current);
|
|
79
|
-
}, [ref.current]);
|
|
80
|
-
const isSelected = isHeader ? selection.selectAll : !!selection.selectedRows[rowData[rowKey]];
|
|
81
|
-
const handleSelect = isHeader ? () => onSelect(!isSelected) : () => onSelect(rowData[rowKey], extraParams.rowIndex, shiftPressed, lastSelectedRow);
|
|
82
|
-
|
|
83
|
-
if (isFunction(renderer)) {
|
|
84
|
-
return /*#__PURE__*/_jsx(SelectableWrapper, {
|
|
85
|
-
className: className
|
|
86
|
-
}, void 0, renderer(_objectSpread(_objectSpread({
|
|
87
|
-
rowData: {}
|
|
88
|
-
}, extraParams), {}, {
|
|
89
|
-
value: isSelected,
|
|
90
|
-
isHeader,
|
|
91
|
-
onSelect: handleSelect
|
|
92
|
-
})));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return /*#__PURE__*/jsx(SelectableComponent, {
|
|
96
|
-
ref: ref,
|
|
97
|
-
className: className,
|
|
98
|
-
isMultiSelect: isMultiSelect,
|
|
99
|
-
isScrolling: isScrolling,
|
|
100
|
-
isSelected: isSelected,
|
|
101
|
-
onSelect: handleSelect,
|
|
102
|
-
value: !isHeader ? rowData[rowKey] : 'header-select-all'
|
|
103
|
-
});
|
|
104
|
-
};
|
|
52
|
+
isMultiSelect,
|
|
53
|
+
isScrolling,
|
|
54
|
+
isSelected,
|
|
55
|
+
onSelect: handleSelect,
|
|
56
|
+
value: !isHeader ? rowData[rowKey] : "header-select-all"
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
var selectableFormatter_default = selectableFormatter;
|
|
60
|
+
export {
|
|
61
|
+
selectableFormatter_default as default,
|
|
62
|
+
selectableFormatter
|
|
105
63
|
};
|
|
106
|
-
|
|
107
|
-
export { selectableFormatter as default };
|
|
64
|
+
//# sourceMappingURL=selectableFormatter.js.map
|