@elliemae/ds-datagrids 2.0.0-alpha.1 → 2.0.0-alpha.13
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 +247 -244
- package/cjs/DataGridImpl.js +22 -13
- package/cjs/PaginatedDataGrid.js +11 -6
- package/cjs/blockNames.js +2 -2
- package/cjs/columns/IconColumn.js +23 -21
- package/cjs/columns/NumberColumn.js +2 -4
- package/cjs/components/BodyCell.js +23 -15
- package/cjs/components/BodyList.js +11 -4
- package/cjs/components/ColumnVisibilityMenuOption.js +12 -6
- package/cjs/components/ColumnsOptionsMenuSection.js +35 -28
- package/cjs/components/EmptyState.js +23 -21
- package/cjs/components/HeaderCell.js +17 -11
- package/cjs/components/List.js +6 -1
- package/cjs/components/ListItem.js +8 -1
- package/cjs/components/NoResults.js +8 -3
- package/cjs/components/RowsLoader.js +6 -5
- package/cjs/components/Table.js +9 -4
- package/cjs/components/TableBody.js +8 -3
- package/cjs/components/TableHeader.js +6 -1
- package/cjs/components/footer/addOptionalFooterComponents.js +6 -5
- package/cjs/components/header/PrimaryControls.js +20 -15
- package/cjs/components/header/addOptionalHeaderComponents.js +5 -4
- package/cjs/components/renderers/defaultClassedRenderers.js +35 -23
- package/cjs/components/renderers/renderRowsLoader.js +1 -1
- package/cjs/components/tableContext.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js +54 -43
- package/cjs/plugins/column-dnd/DndColumnsPlugin.js +13 -9
- package/cjs/plugins/column-dnd/decorateGridWithDndColumns.js +3 -4
- package/cjs/plugins/column-sizing/ColumnSizingPlugin.js +12 -10
- package/cjs/plugins/column-sizing/columnMeasurerTransformer.js +14 -7
- package/cjs/plugins/column-sizing/ext-points/decorateColumn.js +3 -3
- package/cjs/plugins/column-sizing/ext-points/getTableProps.js +24 -18
- package/cjs/plugins/column-sizing/useColumnSizeService.js +14 -4
- package/cjs/plugins/column-sizing/useStylesheetHelpers.js +70 -56
- package/cjs/plugins/column-sizing/utils.js +10 -6
- package/cjs/plugins/custom-cell-renderer/CustomRendererPlugin.js +2 -2
- package/cjs/plugins/custom-cell-renderer/addCustomRendererToCell.js +11 -6
- package/cjs/plugins/custom-cell-renderer/getRendererComponent.js +24 -25
- package/cjs/plugins/editable/EditableComponents/ComboBox.js +10 -7
- package/cjs/plugins/editable/EditableComponents/TextBox.js +24 -19
- package/cjs/plugins/editable/EditablePlugin.js +17 -16
- package/cjs/plugins/editable/decorateEditable.js +25 -19
- package/cjs/plugins/editable/getEditorComponent.js +46 -35
- package/cjs/plugins/expandable-grid/ExpandableColumn.js +66 -59
- package/cjs/plugins/expandable-grid/ExpandablePlugin.js +42 -30
- package/cjs/plugins/expandable-grid/ExpandedRow.js +41 -31
- package/cjs/plugins/expandable-grid/ExpandedRowExtra.js +22 -16
- package/cjs/plugins/expandable-grid/useExpandGridState.js +4 -8
- package/cjs/plugins/export-data/ExportDataPlugin.js +34 -19
- package/cjs/plugins/filterable/FilterablePlugin.js +9 -8
- package/cjs/plugins/filterable/addFilterToColumn.js +6 -1
- package/cjs/plugins/filterable/components/FilterableHeader.js +39 -30
- package/cjs/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js +52 -45
- package/cjs/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js +38 -33
- package/cjs/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js +127 -161
- package/cjs/plugins/filterable/components/filterable-menus/TextFilterMenu.js +38 -29
- package/cjs/plugins/filterable/filterableFormatter.js +16 -11
- package/cjs/plugins/filterable/filtering-helper/filterRowsByQuery.js +18 -6
- package/cjs/plugins/filterable/filtering-helper/strategiesOperators.js +11 -8
- package/cjs/plugins/filterable/helper.js +18 -8
- package/cjs/plugins/filterable/useFilterableState.js +13 -6
- package/cjs/plugins/grouping-by/GroupingByPlugin.js +4 -2
- package/cjs/plugins/grouping-grid/GroupingPlugin.js +14 -5
- package/cjs/plugins/grouping-grid/walkStrategy.js +13 -9
- package/cjs/plugins/infinite-scrolling/InfiniteScrollPlugin.js +11 -4
- package/cjs/plugins/pagination/PaginationPlugin.js +17 -10
- package/cjs/plugins/pagination/components/Pagination.js +12 -11
- package/cjs/plugins/pagination/components/Paginator.js +23 -22
- package/cjs/plugins/pagination/components/PerPageDropdown.js +24 -17
- package/cjs/plugins/pagination/helper.js +11 -8
- package/cjs/plugins/pagination/usePaginationState.js +9 -4
- package/cjs/plugins/resizable/ResizablePlugin.js +6 -5
- package/cjs/plugins/resizable/decorateResizable.js +16 -10
- package/cjs/plugins/resizable/useResizeHandle.js +21 -16
- package/cjs/plugins/resizable/utils.js +9 -6
- package/cjs/plugins/row-dnd/DndRowsPlugin.js +27 -19
- package/cjs/plugins/selectable/SelectablePlugin.js +13 -12
- package/cjs/plugins/selectable/addSelectableColumn.js +25 -17
- package/cjs/plugins/selectable/helper.js +13 -4
- package/cjs/plugins/selectable/selectableFormatter.js +83 -74
- package/cjs/plugins/selectable/useSelectableState.js +26 -12
- package/cjs/plugins/sortable/SortablePlugin.js +11 -12
- package/cjs/plugins/sortable/checkIfSortable.js +1 -1
- package/cjs/plugins/sortable/sortHeaderFormatter.js +17 -18
- package/cjs/plugins/sortable/sortTree.js +16 -8
- package/cjs/plugins/sortable/sorter.js +153 -135
- package/cjs/plugins/sortable/useSortableState.js +12 -6
- package/cjs/plugins/toolbar/RowRenderer.js +13 -7
- package/cjs/plugins/toolbar/ToolbarPlugin.js +3 -2
- package/cjs/plugins/toolbar/ToolbarTrigger.js +26 -21
- package/cjs/plugins/virtualization/AutoHeightList.js +12 -10
- package/cjs/plugins/virtualization/VirtualizationPlugin.js +35 -28
- package/cjs/plugins/virtualization/VirtualizedBody.js +23 -13
- package/cjs/plugins/virtualization/VirtualizedBodyRow.js +8 -7
- package/cjs/renders/CellWithAddons.js +23 -21
- package/cjs/renders/styled.js +7 -18
- package/cjs/utilities/getPluginsFromProps.js +5 -1
- package/cjs/utilities/getScrollbarSize.js +2 -1
- package/cjs/utilities/normalizeData.js +8 -2
- package/esm/DSDataGrid.js +246 -243
- package/esm/DataGridImpl.js +18 -9
- package/esm/PaginatedDataGrid.js +5 -0
- package/esm/blockNames.js +2 -2
- package/esm/columns/IconColumn.js +19 -17
- package/esm/columns/NumberColumn.js +2 -4
- package/esm/components/BodyCell.js +20 -12
- package/esm/components/BodyList.js +7 -0
- package/esm/components/ColumnVisibilityMenuOption.js +12 -6
- package/esm/components/ColumnsOptionsMenuSection.js +35 -28
- package/esm/components/EmptyState.js +18 -15
- package/esm/components/HeaderCell.js +15 -9
- package/esm/components/List.js +5 -0
- package/esm/components/ListItem.js +7 -0
- package/esm/components/NoResults.js +5 -0
- package/esm/components/RowsLoader.js +5 -4
- package/esm/components/Table.js +5 -0
- package/esm/components/TableBody.js +5 -0
- package/esm/components/TableHeader.js +5 -0
- package/esm/components/footer/addOptionalFooterComponents.js +5 -4
- package/esm/components/header/PrimaryControls.js +20 -14
- package/esm/components/header/addOptionalHeaderComponents.js +4 -3
- package/esm/components/renderers/defaultClassedRenderers.js +35 -23
- package/esm/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js +50 -39
- package/esm/plugins/column-dnd/DndColumnsPlugin.js +8 -4
- package/esm/plugins/column-dnd/decorateGridWithDndColumns.js +1 -1
- package/esm/plugins/column-sizing/ColumnSizingPlugin.js +10 -8
- package/esm/plugins/column-sizing/columnMeasurerTransformer.js +12 -5
- package/esm/plugins/column-sizing/ext-points/decorateColumn.js +1 -1
- package/esm/plugins/column-sizing/ext-points/getTableProps.js +22 -15
- package/esm/plugins/column-sizing/useColumnSizeService.js +13 -3
- package/esm/plugins/column-sizing/useStylesheetHelpers.js +67 -51
- package/esm/plugins/column-sizing/utils.js +8 -4
- package/esm/plugins/custom-cell-renderer/addCustomRendererToCell.js +6 -1
- package/esm/plugins/custom-cell-renderer/getRendererComponent.js +15 -11
- package/esm/plugins/editable/EditableComponents/ComboBox.js +8 -4
- package/esm/plugins/editable/EditableComponents/TextBox.js +21 -15
- package/esm/plugins/editable/EditablePlugin.js +14 -12
- package/esm/plugins/editable/decorateEditable.js +18 -9
- package/esm/plugins/editable/getEditorComponent.js +49 -38
- package/esm/plugins/expandable-grid/ExpandableColumn.js +59 -50
- package/esm/plugins/expandable-grid/ExpandablePlugin.js +34 -20
- package/esm/plugins/expandable-grid/ExpandedRow.js +27 -17
- package/esm/plugins/expandable-grid/ExpandedRowExtra.js +17 -11
- package/esm/plugins/expandable-grid/useExpandGridState.js +2 -2
- package/esm/plugins/export-data/ExportDataPlugin.js +31 -16
- package/esm/plugins/filterable/FilterablePlugin.js +5 -4
- package/esm/plugins/filterable/addFilterToColumn.js +5 -0
- package/esm/plugins/filterable/components/FilterableHeader.js +32 -22
- package/esm/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js +41 -33
- package/esm/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js +28 -22
- package/esm/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js +121 -154
- package/esm/plugins/filterable/components/filterable-menus/TextFilterMenu.js +28 -18
- package/esm/plugins/filterable/filterableFormatter.js +15 -10
- package/esm/plugins/filterable/filtering-helper/filterRowsByQuery.js +14 -2
- package/esm/plugins/filterable/filtering-helper/strategiesOperators.js +7 -4
- package/esm/plugins/filterable/helper.js +11 -1
- package/esm/plugins/filterable/useFilterableState.js +12 -5
- package/esm/plugins/grouping-by/GroupingByPlugin.js +3 -1
- package/esm/plugins/grouping-grid/GroupingPlugin.js +10 -1
- package/esm/plugins/grouping-grid/walkStrategy.js +13 -9
- package/esm/plugins/infinite-scrolling/InfiniteScrollPlugin.js +8 -1
- package/esm/plugins/pagination/PaginationPlugin.js +8 -1
- package/esm/plugins/pagination/components/Pagination.js +10 -9
- package/esm/plugins/pagination/components/Paginator.js +20 -19
- package/esm/plugins/pagination/components/PerPageDropdown.js +17 -9
- package/esm/plugins/pagination/helper.js +10 -7
- package/esm/plugins/pagination/usePaginationState.js +7 -1
- package/esm/plugins/resizable/ResizablePlugin.js +4 -3
- package/esm/plugins/resizable/decorateResizable.js +14 -8
- package/esm/plugins/resizable/useResizeHandle.js +21 -16
- package/esm/plugins/resizable/utils.js +7 -4
- package/esm/plugins/row-dnd/DndRowsPlugin.js +22 -13
- package/esm/plugins/selectable/SelectablePlugin.js +10 -9
- package/esm/plugins/selectable/addSelectableColumn.js +24 -16
- package/esm/plugins/selectable/helper.js +10 -1
- package/esm/plugins/selectable/selectableFormatter.js +79 -68
- package/esm/plugins/selectable/useSelectableState.js +20 -5
- package/esm/plugins/sortable/SortablePlugin.js +5 -4
- package/esm/plugins/sortable/sortHeaderFormatter.js +12 -11
- package/esm/plugins/sortable/sortTree.js +13 -3
- package/esm/plugins/sortable/sorter.js +152 -134
- package/esm/plugins/sortable/useSortableState.js +8 -0
- package/esm/plugins/toolbar/RowRenderer.js +8 -2
- package/esm/plugins/toolbar/ToolbarPlugin.js +1 -0
- package/esm/plugins/toolbar/ToolbarTrigger.js +17 -11
- package/esm/plugins/virtualization/AutoHeightList.js +6 -3
- package/esm/plugins/virtualization/VirtualizationPlugin.js +31 -24
- package/esm/plugins/virtualization/VirtualizedBody.js +16 -6
- package/esm/plugins/virtualization/VirtualizedBodyRow.js +8 -7
- package/esm/renders/CellWithAddons.js +15 -14
- package/esm/renders/styled.js +3 -15
- package/esm/utilities/getPluginsFromProps.js +5 -1
- package/esm/utilities/getScrollbarSize.js +2 -1
- package/esm/utilities/normalizeData.js +7 -1
- package/package.json +27 -18
- package/types/DSDataGrid.d.ts +744 -105
- package/types/components/BodyCell.d.ts +1 -1
- package/types/components/HeaderCell.d.ts +1 -1
- package/types/plugins/column-sizing/columnMeasurerTransformer.d.ts +1 -1
- package/types/plugins/column-sizing/ext-points/getTableProps.d.ts +1 -1
- package/types/plugins/expandable-grid/ExpandedRowExtra.d.ts +1 -1
- package/types/plugins/expandable-grid/useExpandGridState.d.ts +4 -4
- package/types/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.d.ts +1 -1
- package/types/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.d.ts +1 -1
- package/types/plugins/filterable/components/filterable-menus/TextFilterMenu.d.ts +1 -1
- package/types/plugins/filterable/helper.d.ts +15 -3
- package/types/plugins/pagination/components/Paginator.d.ts +1 -1
- package/types/plugins/pagination/components/PerPageDropdown.d.ts +1 -1
- package/types/plugins/sortable/sorter.d.ts +1 -1
- package/types/renders/styled.d.ts +3 -3
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import { useState, useCallback, useEffect } from 'react';
|
|
2
3
|
import cx from 'obj-str';
|
|
3
|
-
import { isFunction } from '@elliemae/ds-utilities
|
|
4
|
+
import { isFunction } from '@elliemae/ds-utilities';
|
|
4
5
|
import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';
|
|
5
6
|
import { selectionColumnCreator } from './addSelectableColumn.js';
|
|
6
7
|
import { useSelectableState } from './useSelectableState.js';
|
|
7
8
|
import { selectMultipleRow, selectSingleRow } from './helper.js';
|
|
8
9
|
|
|
9
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
10
|
-
|
|
11
10
|
const decorateColumns = (columns, grid) => {
|
|
12
11
|
const {
|
|
13
12
|
props: {
|
|
@@ -49,9 +48,10 @@ const decorateColumns = (columns, grid) => {
|
|
|
49
48
|
return columns;
|
|
50
49
|
};
|
|
51
50
|
|
|
52
|
-
const getRowProps = (rowProps, grid, {
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const getRowProps = (rowProps, grid, _ref) => {
|
|
52
|
+
let {
|
|
53
|
+
rowData
|
|
54
|
+
} = _ref;
|
|
55
55
|
const {
|
|
56
56
|
props: {
|
|
57
57
|
showSelectHighlight,
|
|
@@ -151,9 +151,10 @@ const SelectablePlugin = createInstancePlugin('selectable', {
|
|
|
151
151
|
registerHotKeys(grid) {
|
|
152
152
|
return [{
|
|
153
153
|
key: 'space',
|
|
154
|
-
handler:
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
handler: _ref2 => {
|
|
155
|
+
let {
|
|
156
|
+
rowIndex
|
|
157
|
+
} = _ref2;
|
|
157
158
|
const {
|
|
158
159
|
composedRows,
|
|
159
160
|
props: {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
8
|
import { appendCellFormatter, appendHeaderFormatter } from '@elliemae/ds-shared/useDataGrid/initColumnDefinition';
|
|
@@ -8,26 +13,29 @@ const _excluded = ["visible", "isDataColumn", "width", "minWidth", "cellRenderer
|
|
|
8
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
9
14
|
|
|
10
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
11
|
-
function selectionColumnCreator({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
function selectionColumnCreator(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
grid,
|
|
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
|
|
23
29
|
|
|
24
|
-
}
|
|
30
|
+
} = _ref;
|
|
25
31
|
const {
|
|
26
32
|
props: {
|
|
27
33
|
rowKey
|
|
28
34
|
}
|
|
29
35
|
} = grid;
|
|
30
|
-
return (
|
|
36
|
+
return function () {
|
|
37
|
+
let _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
38
|
+
|
|
31
39
|
let {
|
|
32
40
|
visible = true,
|
|
33
41
|
isDataColumn = false,
|
|
@@ -37,8 +45,8 @@ function selectionColumnCreator({
|
|
|
37
45
|
headerCellRenderer,
|
|
38
46
|
customRenderer,
|
|
39
47
|
header
|
|
40
|
-
} =
|
|
41
|
-
column = _objectWithoutProperties(
|
|
48
|
+
} = _ref2,
|
|
49
|
+
column = _objectWithoutProperties(_ref2, _excluded);
|
|
42
50
|
|
|
43
51
|
let selectionColumn = _objectSpread(_objectSpread({}, column), {}, {
|
|
44
52
|
property: 'metaData.selected',
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
5
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import
|
|
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';
|
|
3
12
|
|
|
4
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5
14
|
|
|
@@ -1,31 +1,39 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import React, { useRef, useEffect, forwardRef } from 'react';
|
|
4
|
-
import { isFunction } from '@elliemae/ds-utilities
|
|
5
|
-
import DSCheckbox from '@elliemae/ds-
|
|
6
|
-
import DSRadio from '@elliemae/ds-basic/form/Radio';
|
|
9
|
+
import { isFunction } from '@elliemae/ds-utilities';
|
|
10
|
+
import { DSCheckbox, DSRadio } from '@elliemae/ds-form';
|
|
7
11
|
import { jsx } from 'react/jsx-runtime';
|
|
8
12
|
|
|
9
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
10
14
|
|
|
11
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
12
16
|
|
|
13
|
-
const SelectableWrapper =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
};
|
|
20
27
|
|
|
21
|
-
const SelectableComponent = /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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;
|
|
29
37
|
const SelectComponent = isMultiSelect || isHeader ? DSCheckbox : DSRadio;
|
|
30
38
|
return /*#__PURE__*/_jsx(SelectableWrapper, {
|
|
31
39
|
className: className
|
|
@@ -39,58 +47,61 @@ const SelectableComponent = /*#__PURE__*/React.memo( /*#__PURE__*/forwardRef(({
|
|
|
39
47
|
}));
|
|
40
48
|
}, (prev, next) => next.isScrolling));
|
|
41
49
|
|
|
42
|
-
const selectableFormatter = ({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
const selectableFormatter = (_ref3, grid) => {
|
|
51
|
+
let {
|
|
52
|
+
isMultiSelect = false,
|
|
53
|
+
renderer,
|
|
54
|
+
className,
|
|
55
|
+
isHeader,
|
|
56
|
+
onSelect
|
|
57
|
+
} = _ref3;
|
|
58
|
+
return (valueRender, extraParams) => {
|
|
59
|
+
const {
|
|
60
|
+
registerFocus
|
|
61
|
+
} = extraParams;
|
|
62
|
+
const ref = useRef();
|
|
63
|
+
const {
|
|
64
|
+
props: {
|
|
65
|
+
rowKey
|
|
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);
|
|
72
82
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
+
}
|
|
84
94
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
+
};
|
|
94
105
|
};
|
|
95
106
|
|
|
96
107
|
export { selectableFormatter as default };
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
3
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.some.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.some.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
12
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
13
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
14
|
+
import { useDerivedStateFromProps, hashArray, toggleInObject, omit } from '@elliemae/ds-utilities';
|
|
4
15
|
import { toggleSelectAll, checkAllRowsSelected, toggleSingleSelectable } from './helper.js';
|
|
5
16
|
|
|
6
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -8,7 +19,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
20
|
|
|
10
21
|
function deriveSelectedStateFromPropsOnUpdate(rows) {
|
|
11
|
-
return (
|
|
22
|
+
return function () {
|
|
23
|
+
let nextProp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
24
|
+
let prevProp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25
|
+
|
|
12
26
|
if (nextProp.selectAll !== prevProp.selectAll) {
|
|
13
27
|
const nextSelectedRows = nextProp.selectAll ? toggleSelectAll(rows, true) : hashArray(nextProp.selectedRows || []);
|
|
14
28
|
return {
|
|
@@ -45,8 +59,9 @@ function useSelectableState(grid) {
|
|
|
45
59
|
onUpdate: deriveSelectedStateFromPropsOnUpdate(rows)
|
|
46
60
|
}); // ACTIONS
|
|
47
61
|
|
|
48
|
-
const handleSelectRow = (id, index
|
|
49
|
-
|
|
62
|
+
const handleSelectRow = function (id, index) {
|
|
63
|
+
let shift = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
64
|
+
let lastSelectedRow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
50
65
|
setSelectedRowsState(prevState => {
|
|
51
66
|
const {
|
|
52
67
|
rows: nextRows
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as sortabular from 'sortabular';
|
|
2
|
-
import { compose, isEmpty, orderBy } from '@elliemae/ds-utilities
|
|
2
|
+
import { compose, isEmpty, orderBy } from '@elliemae/ds-utilities';
|
|
3
3
|
import { appendHeaderFormatter, mergeClassNameToColumnHeader } from '@elliemae/ds-shared/useDataGrid/initColumnDefinition';
|
|
4
4
|
import createInstancePlugin from '@elliemae/ds-shared/createDataInstance/createInstancePlugin';
|
|
5
5
|
import sortHeaderFormatter from './sortHeaderFormatter.js';
|
|
@@ -60,9 +60,10 @@ const SortablePlugin = createInstancePlugin('sortable', {
|
|
|
60
60
|
registerHotKeys(grid) {
|
|
61
61
|
return {
|
|
62
62
|
key: 'ctrl+s',
|
|
63
|
-
handler:
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
handler: _ref => {
|
|
64
|
+
let {
|
|
65
|
+
cellIndex
|
|
66
|
+
} = _ref;
|
|
66
67
|
const {
|
|
67
68
|
actions: {
|
|
68
69
|
sort
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
4
|
-
import ArrowheadDown from '@elliemae/ds-icons
|
|
5
|
-
import ArrowheadUp from '@elliemae/ds-icons/ArrowheadUp';
|
|
4
|
+
import { ArrowheadUp, ArrowheadDown } from '@elliemae/ds-icons';
|
|
6
5
|
|
|
7
6
|
var _ArrowheadUp, _ArrowheadDown;
|
|
8
7
|
const blockName = 'data-grid-sort-header';
|
|
9
8
|
const SortHeaderContainer = aggregatedClasses('div')(blockName);
|
|
10
9
|
const iconColor = ['brand-primary', 800];
|
|
11
|
-
const SortHeader = /*#__PURE__*/React.memo(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const SortHeader = /*#__PURE__*/React.memo(_ref => {
|
|
11
|
+
let {
|
|
12
|
+
value,
|
|
13
|
+
onClick,
|
|
14
|
+
sortState
|
|
15
|
+
} = _ref;
|
|
16
16
|
const sortIndicator = sortState === 'asc' ? _ArrowheadUp || (_ArrowheadUp = /*#__PURE__*/_jsx(ArrowheadUp, {
|
|
17
17
|
color: iconColor
|
|
18
18
|
})) : _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx(ArrowheadDown, {
|
|
@@ -25,10 +25,11 @@ const SortHeader = /*#__PURE__*/React.memo(({
|
|
|
25
25
|
}, void 0, value), sortState && sortIndicator);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
const sortHeaderFormatter = (sortable, grid) => (value, {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const sortHeaderFormatter = (sortable, grid) => (value, _ref2) => {
|
|
29
|
+
let {
|
|
30
|
+
columnIndex,
|
|
31
|
+
property
|
|
32
|
+
} = _ref2;
|
|
32
33
|
const {
|
|
33
34
|
state: {
|
|
34
35
|
sortingColumns
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
2
9
|
import * as sortabular from 'sortabular';
|
|
3
10
|
|
|
4
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5
12
|
|
|
6
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
14
|
|
|
8
|
-
const deepSorting =
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
const deepSorting = function (sortConfig) {
|
|
16
|
+
let rows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
17
|
+
return sortabular.sorter(sortConfig)(rows.map(row => row.children && row.children.length ? _objectSpread(_objectSpread({}, row), {}, {
|
|
18
|
+
children: deepSorting(sortConfig, row.children)
|
|
19
|
+
}) : row));
|
|
20
|
+
};
|
|
11
21
|
|
|
12
22
|
function sortTree(sortConfig) {
|
|
13
23
|
return rows => deepSorting(sortConfig, rows);
|