@elliemae/ds-datagrids 2.0.0-next.7 → 2.0.0-rc.2
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 +246 -243
- package/cjs/DataGridImpl.js +16 -8
- package/cjs/PaginatedDataGrid.js +5 -0
- package/cjs/columns/IconColumn.js +19 -17
- package/cjs/columns/NumberColumn.js +2 -4
- package/cjs/components/BodyCell.js +17 -10
- package/cjs/components/BodyList.js +7 -0
- package/cjs/components/ColumnVisibilityMenuOption.js +10 -6
- package/cjs/components/ColumnsOptionsMenuSection.js +34 -28
- package/cjs/components/EmptyState.js +19 -17
- package/cjs/components/HeaderCell.js +14 -8
- package/cjs/components/List.js +5 -0
- package/cjs/components/ListItem.js +7 -0
- package/cjs/components/NoResults.js +5 -0
- package/cjs/components/RowsLoader.js +5 -4
- package/cjs/components/Table.js +5 -0
- package/cjs/components/TableBody.js +5 -0
- package/cjs/components/TableHeader.js +5 -0
- package/cjs/components/footer/addOptionalFooterComponents.js +5 -4
- package/cjs/components/header/PrimaryControls.js +20 -15
- package/cjs/components/header/addOptionalHeaderComponents.js +4 -3
- package/cjs/components/renderers/defaultClassedRenderers.js +33 -21
- package/cjs/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js +46 -35
- package/cjs/plugins/column-dnd/DndColumnsPlugin.js +9 -5
- package/cjs/plugins/column-dnd/decorateGridWithDndColumns.js +2 -3
- package/cjs/plugins/column-sizing/ColumnSizingPlugin.js +10 -8
- package/cjs/plugins/column-sizing/columnMeasurerTransformer.js +13 -6
- package/cjs/plugins/column-sizing/ext-points/decorateColumn.js +3 -3
- package/cjs/plugins/column-sizing/ext-points/getTableProps.js +22 -17
- package/cjs/plugins/column-sizing/useColumnSizeService.js +9 -0
- package/cjs/plugins/column-sizing/useStylesheetHelpers.js +56 -40
- package/cjs/plugins/column-sizing/utils.js +10 -6
- package/cjs/plugins/custom-cell-renderer/addCustomRendererToCell.js +9 -4
- package/cjs/plugins/custom-cell-renderer/getRendererComponent.js +20 -21
- package/cjs/plugins/editable/EditableComponents/ComboBox.js +7 -3
- package/cjs/plugins/editable/EditableComponents/TextBox.js +20 -14
- package/cjs/plugins/editable/EditablePlugin.js +15 -15
- package/cjs/plugins/editable/decorateEditable.js +18 -11
- package/cjs/plugins/editable/getEditorComponent.js +45 -34
- package/cjs/plugins/expandable-grid/ExpandableColumn.js +57 -50
- package/cjs/plugins/expandable-grid/ExpandablePlugin.js +37 -26
- package/cjs/plugins/expandable-grid/ExpandedRow.js +28 -18
- package/cjs/plugins/expandable-grid/ExpandedRowExtra.js +16 -10
- package/cjs/plugins/expandable-grid/useExpandGridState.js +3 -8
- package/cjs/plugins/export-data/ExportDataPlugin.js +23 -10
- package/cjs/plugins/filterable/FilterablePlugin.js +7 -6
- package/cjs/plugins/filterable/addFilterToColumn.js +5 -0
- package/cjs/plugins/filterable/components/FilterableHeader.js +35 -27
- package/cjs/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js +38 -32
- package/cjs/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js +26 -22
- package/cjs/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js +119 -154
- package/cjs/plugins/filterable/components/filterable-menus/TextFilterMenu.js +28 -20
- package/cjs/plugins/filterable/filterableFormatter.js +15 -10
- package/cjs/plugins/filterable/filtering-helper/filterRowsByQuery.js +16 -4
- package/cjs/plugins/filterable/filtering-helper/strategiesOperators.js +7 -4
- package/cjs/plugins/filterable/helper.js +16 -7
- package/cjs/plugins/filterable/useFilterableState.js +11 -5
- package/cjs/plugins/grouping-by/GroupingByPlugin.js +2 -0
- package/cjs/plugins/grouping-grid/GroupingPlugin.js +9 -0
- package/cjs/plugins/grouping-grid/walkStrategy.js +11 -9
- package/cjs/plugins/infinite-scrolling/InfiniteScrollPlugin.js +7 -1
- package/cjs/plugins/pagination/PaginationPlugin.js +9 -2
- package/cjs/plugins/pagination/components/Pagination.js +10 -9
- package/cjs/plugins/pagination/components/Paginator.js +8 -7
- package/cjs/plugins/pagination/components/PerPageDropdown.js +20 -13
- package/cjs/plugins/pagination/helper.js +10 -7
- package/cjs/plugins/pagination/usePaginationState.js +7 -3
- package/cjs/plugins/resizable/ResizablePlugin.js +5 -4
- package/cjs/plugins/resizable/decorateResizable.js +14 -8
- package/cjs/plugins/resizable/useResizeHandle.js +21 -16
- package/cjs/plugins/resizable/utils.js +8 -5
- package/cjs/plugins/row-dnd/DndRowsPlugin.js +23 -16
- package/cjs/plugins/selectable/SelectablePlugin.js +10 -8
- package/cjs/plugins/selectable/addSelectableColumn.js +24 -16
- package/cjs/plugins/selectable/helper.js +12 -3
- package/cjs/plugins/selectable/selectableFormatter.js +80 -71
- package/cjs/plugins/selectable/useSelectableState.js +24 -11
- package/cjs/plugins/sortable/SortablePlugin.js +8 -7
- package/cjs/plugins/sortable/sortHeaderFormatter.js +14 -15
- package/cjs/plugins/sortable/sortTree.js +13 -3
- package/cjs/plugins/sortable/sorter.js +151 -134
- package/cjs/plugins/sortable/useSortableState.js +7 -0
- package/cjs/plugins/toolbar/RowRenderer.js +7 -2
- package/cjs/plugins/toolbar/ToolbarTrigger.js +15 -10
- package/cjs/plugins/virtualization/AutoHeightList.js +10 -8
- package/cjs/plugins/virtualization/VirtualizationPlugin.js +32 -25
- package/cjs/plugins/virtualization/VirtualizedBody.js +18 -9
- package/cjs/plugins/virtualization/VirtualizedBodyRow.js +8 -7
- package/cjs/renders/CellWithAddons.js +20 -18
- package/cjs/renders/styled.js +3 -2
- package/cjs/utilities/getPluginsFromProps.js +5 -1
- package/cjs/utilities/getScrollbarSize.js +2 -1
- package/cjs/utilities/normalizeData.js +7 -1
- package/esm/DSDataGrid.js +246 -243
- package/esm/DataGridImpl.js +16 -8
- package/esm/PaginatedDataGrid.js +5 -0
- package/esm/columns/IconColumn.js +18 -16
- package/esm/columns/NumberColumn.js +2 -4
- package/esm/components/BodyCell.js +17 -10
- package/esm/components/BodyList.js +7 -0
- package/esm/components/ColumnVisibilityMenuOption.js +10 -6
- package/esm/components/ColumnsOptionsMenuSection.js +34 -28
- package/esm/components/EmptyState.js +18 -15
- package/esm/components/HeaderCell.js +14 -8
- 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 +33 -21
- package/esm/plugins/body-header-scroll-sync/BodyHeaderScrollSyncPlugin.js +46 -35
- package/esm/plugins/column-dnd/DndColumnsPlugin.js +6 -2
- package/esm/plugins/column-dnd/decorateGridWithDndColumns.js +1 -1
- package/esm/plugins/column-sizing/ColumnSizingPlugin.js +9 -7
- 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 +21 -15
- package/esm/plugins/column-sizing/useColumnSizeService.js +9 -0
- package/esm/plugins/column-sizing/useStylesheetHelpers.js +54 -38
- 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 +6 -1
- package/esm/plugins/editable/EditableComponents/TextBox.js +19 -12
- package/esm/plugins/editable/EditablePlugin.js +13 -12
- package/esm/plugins/editable/decorateEditable.js +16 -8
- package/esm/plugins/editable/getEditorComponent.js +49 -38
- package/esm/plugins/expandable-grid/ExpandableColumn.js +56 -47
- package/esm/plugins/expandable-grid/ExpandablePlugin.js +33 -20
- package/esm/plugins/expandable-grid/ExpandedRow.js +27 -17
- package/esm/plugins/expandable-grid/ExpandedRowExtra.js +15 -9
- package/esm/plugins/expandable-grid/useExpandGridState.js +1 -2
- package/esm/plugins/export-data/ExportDataPlugin.js +22 -9
- package/esm/plugins/filterable/FilterablePlugin.js +5 -4
- package/esm/plugins/filterable/addFilterToColumn.js +5 -0
- package/esm/plugins/filterable/components/FilterableHeader.js +31 -22
- package/esm/plugins/filterable/components/filterable-menus/DateRangeFilterMenu.js +38 -31
- package/esm/plugins/filterable/components/filterable-menus/SingleDateFilterMenu.js +26 -21
- package/esm/plugins/filterable/components/filterable-menus/SingleRangeSwitcherMenu.js +118 -152
- package/esm/plugins/filterable/components/filterable-menus/TextFilterMenu.js +27 -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 +10 -1
- package/esm/plugins/filterable/useFilterableState.js +11 -5
- package/esm/plugins/grouping-by/GroupingByPlugin.js +2 -0
- package/esm/plugins/grouping-grid/GroupingPlugin.js +9 -0
- package/esm/plugins/grouping-grid/walkStrategy.js +11 -9
- package/esm/plugins/infinite-scrolling/InfiniteScrollPlugin.js +7 -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 +8 -7
- package/esm/plugins/pagination/components/PerPageDropdown.js +17 -9
- package/esm/plugins/pagination/helper.js +10 -7
- package/esm/plugins/pagination/usePaginationState.js +6 -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 +6 -3
- package/esm/plugins/row-dnd/DndRowsPlugin.js +21 -13
- package/esm/plugins/selectable/SelectablePlugin.js +9 -7
- 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 +19 -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 +151 -134
- package/esm/plugins/sortable/useSortableState.js +7 -0
- package/esm/plugins/toolbar/RowRenderer.js +6 -1
- package/esm/plugins/toolbar/ToolbarTrigger.js +14 -8
- package/esm/plugins/virtualization/AutoHeightList.js +6 -3
- package/esm/plugins/virtualization/VirtualizationPlugin.js +31 -24
- package/esm/plugins/virtualization/VirtualizedBody.js +14 -5
- package/esm/plugins/virtualization/VirtualizedBodyRow.js +8 -7
- package/esm/renders/CellWithAddons.js +15 -14
- package/esm/renders/styled.js +1 -1
- package/esm/utilities/getPluginsFromProps.js +5 -1
- package/esm/utilities/getScrollbarSize.js +2 -1
- package/esm/utilities/normalizeData.js +7 -1
- package/package.json +19 -18
- 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/PerPageDropdown.d.ts +1 -1
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
3
8
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
9
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
10
|
var React = require('react');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var DSRadio = require('@elliemae/ds-basic/form/Radio');
|
|
11
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
12
|
+
var dsForm = require('@elliemae/ds-form');
|
|
9
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
14
|
|
|
11
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -13,30 +17,32 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
17
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
14
18
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
19
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
|
-
var DSCheckbox__default = /*#__PURE__*/_interopDefaultLegacy(DSCheckbox);
|
|
17
|
-
var DSRadio__default = /*#__PURE__*/_interopDefaultLegacy(DSRadio);
|
|
18
20
|
|
|
19
21
|
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; }
|
|
20
22
|
|
|
21
23
|
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__default["default"](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; }
|
|
22
24
|
|
|
23
|
-
const SelectableWrapper =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const SelectableWrapper = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
className,
|
|
28
|
+
children
|
|
29
|
+
} = _ref;
|
|
30
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
31
|
+
className: className,
|
|
32
|
+
onClick: e => e.stopPropagation()
|
|
33
|
+
}, void 0, children);
|
|
34
|
+
};
|
|
30
35
|
|
|
31
|
-
const SelectableComponent = /*#__PURE__*/React__default["default"].memo( /*#__PURE__*/React.forwardRef(({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const SelectableComponent = /*#__PURE__*/React__default["default"].memo( /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
37
|
+
let {
|
|
38
|
+
className,
|
|
39
|
+
isMultiSelect,
|
|
40
|
+
isHeader,
|
|
41
|
+
onSelect,
|
|
42
|
+
isSelected,
|
|
43
|
+
value
|
|
44
|
+
} = _ref2;
|
|
45
|
+
const SelectComponent = isMultiSelect || isHeader ? dsForm.DSCheckbox : dsForm.DSRadio;
|
|
40
46
|
return /*#__PURE__*/_jsx__default["default"](SelectableWrapper, {
|
|
41
47
|
className: className
|
|
42
48
|
}, void 0, /*#__PURE__*/_jsx__default["default"](SelectComponent, {
|
|
@@ -49,58 +55,61 @@ const SelectableComponent = /*#__PURE__*/React__default["default"].memo( /*#__PU
|
|
|
49
55
|
}));
|
|
50
56
|
}, (prev, next) => next.isScrolling));
|
|
51
57
|
|
|
52
|
-
const selectableFormatter = ({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
58
|
+
const selectableFormatter = (_ref3, grid) => {
|
|
59
|
+
let {
|
|
60
|
+
isMultiSelect = false,
|
|
61
|
+
renderer,
|
|
62
|
+
className,
|
|
63
|
+
isHeader,
|
|
64
|
+
onSelect
|
|
65
|
+
} = _ref3;
|
|
66
|
+
return (valueRender, extraParams) => {
|
|
67
|
+
const {
|
|
68
|
+
registerFocus
|
|
69
|
+
} = extraParams;
|
|
70
|
+
const ref = React.useRef();
|
|
71
|
+
const {
|
|
72
|
+
props: {
|
|
73
|
+
rowKey
|
|
74
|
+
},
|
|
75
|
+
state: {
|
|
76
|
+
selection
|
|
77
|
+
},
|
|
78
|
+
shiftPressed,
|
|
79
|
+
lastSelectedRow
|
|
80
|
+
} = grid.getInstance();
|
|
81
|
+
const {
|
|
82
|
+
rowData,
|
|
83
|
+
isScrolling
|
|
84
|
+
} = extraParams;
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
if (registerFocus) registerFocus(ref.current);
|
|
87
|
+
}, [ref.current]);
|
|
88
|
+
const isSelected = isHeader ? selection.selectAll : !!selection.selectedRows[rowData[rowKey]];
|
|
89
|
+
const handleSelect = isHeader ? () => onSelect(!isSelected) : () => onSelect(rowData[rowKey], extraParams.rowIndex, shiftPressed, lastSelectedRow);
|
|
82
90
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
if (dsUtilities.isFunction(renderer)) {
|
|
92
|
+
return /*#__PURE__*/_jsx__default["default"](SelectableWrapper, {
|
|
93
|
+
className: className
|
|
94
|
+
}, void 0, renderer(_objectSpread(_objectSpread({
|
|
95
|
+
rowData: {}
|
|
96
|
+
}, extraParams), {}, {
|
|
97
|
+
value: isSelected,
|
|
98
|
+
isHeader,
|
|
99
|
+
onSelect: handleSelect
|
|
100
|
+
})));
|
|
101
|
+
}
|
|
94
102
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
return /*#__PURE__*/jsxRuntime.jsx(SelectableComponent, {
|
|
104
|
+
ref: ref,
|
|
105
|
+
className: className,
|
|
106
|
+
isMultiSelect: isMultiSelect,
|
|
107
|
+
isScrolling: isScrolling,
|
|
108
|
+
isSelected: isSelected,
|
|
109
|
+
onSelect: handleSelect,
|
|
110
|
+
value: !isHeader ? rowData[rowKey] : 'header-select-all'
|
|
111
|
+
});
|
|
112
|
+
};
|
|
104
113
|
};
|
|
105
114
|
|
|
106
115
|
module.exports = selectableFormatter;
|
|
@@ -4,23 +4,35 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
6
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.some.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.some.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
14
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
15
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
16
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
17
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
18
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
9
19
|
var helper = require('./helper.js');
|
|
10
20
|
|
|
11
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
22
|
|
|
13
23
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
14
|
-
var useDerivedStateFromProps__default = /*#__PURE__*/_interopDefaultLegacy(useDerivedStateFromProps);
|
|
15
24
|
|
|
16
25
|
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; }
|
|
17
26
|
|
|
18
27
|
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__default["default"](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; }
|
|
19
28
|
|
|
20
29
|
function deriveSelectedStateFromPropsOnUpdate(rows) {
|
|
21
|
-
return (
|
|
30
|
+
return function () {
|
|
31
|
+
let nextProp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
|
+
let prevProp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
33
|
+
|
|
22
34
|
if (nextProp.selectAll !== prevProp.selectAll) {
|
|
23
|
-
const nextSelectedRows = nextProp.selectAll ? helper.toggleSelectAll(rows, true) :
|
|
35
|
+
const nextSelectedRows = nextProp.selectAll ? helper.toggleSelectAll(rows, true) : dsUtilities.hashArray(nextProp.selectedRows || []);
|
|
24
36
|
return {
|
|
25
37
|
selectedRows: nextSelectedRows,
|
|
26
38
|
selectAll: helper.checkAllRowsSelected(rows, Object.keys(nextSelectedRows))
|
|
@@ -28,7 +40,7 @@ function deriveSelectedStateFromPropsOnUpdate(rows) {
|
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
return {
|
|
31
|
-
selectedRows:
|
|
43
|
+
selectedRows: dsUtilities.hashArray(nextProp.selectedRows || []),
|
|
32
44
|
selectAll: helper.checkAllRowsSelected(rows, Object.keys(nextProp.selectedRows))
|
|
33
45
|
};
|
|
34
46
|
};
|
|
@@ -48,15 +60,16 @@ function useSelectableState(grid) {
|
|
|
48
60
|
setLastSelectedRow
|
|
49
61
|
} = grid.getInstance();
|
|
50
62
|
const multiple = selectable === 'multi';
|
|
51
|
-
const [selection, setSelectedRowsState] =
|
|
63
|
+
const [selection, setSelectedRowsState] = dsUtilities.useDerivedStateFromProps({
|
|
52
64
|
selectedRows,
|
|
53
65
|
selectAll
|
|
54
66
|
}, {
|
|
55
67
|
onUpdate: deriveSelectedStateFromPropsOnUpdate(rows)
|
|
56
68
|
}); // ACTIONS
|
|
57
69
|
|
|
58
|
-
const handleSelectRow = (id, index
|
|
59
|
-
|
|
70
|
+
const handleSelectRow = function (id, index) {
|
|
71
|
+
let shift = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
72
|
+
let lastSelectedRow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
60
73
|
setSelectedRowsState(prevState => {
|
|
61
74
|
const {
|
|
62
75
|
rows: nextRows
|
|
@@ -64,7 +77,7 @@ function useSelectableState(grid) {
|
|
|
64
77
|
const wasSelected = Object.keys(prevState.selectedRows).some( // we need to match softly as the id may be a number
|
|
65
78
|
// eslint-disable-next-line eqeqeq
|
|
66
79
|
elem => elem == id);
|
|
67
|
-
let nextSelectedRows = multiple ?
|
|
80
|
+
let nextSelectedRows = multiple ? dsUtilities.toggleInObject(prevState.selectedRows, id, true) : helper.toggleSingleSelectable(prevState.selectedRows, id);
|
|
68
81
|
setLastSelectedRow({
|
|
69
82
|
index,
|
|
70
83
|
mode: wasSelected ? 'deselect' : 'select'
|
|
@@ -77,7 +90,7 @@ function useSelectableState(grid) {
|
|
|
77
90
|
const rowSegment = nextRows.slice(sliceStart, sliceEnd).map(row => row[rowKey]);
|
|
78
91
|
|
|
79
92
|
if (lastSelectedRow.mode === 'deselect') {
|
|
80
|
-
nextSelectedRows =
|
|
93
|
+
nextSelectedRows = dsUtilities.omit(prevState.selectedRows, rowSegment);
|
|
81
94
|
} else {
|
|
82
95
|
const selectedSegment = rowSegment.reduce((o, key) => _objectSpread(_objectSpread({}, o), {}, {
|
|
83
96
|
[key]: true
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var sortabular = require('sortabular');
|
|
6
|
-
var
|
|
6
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
7
7
|
var initColumnDefinition = require('@elliemae/ds-shared/useDataGrid/initColumnDefinition');
|
|
8
8
|
var createInstancePlugin = require('@elliemae/ds-shared/createDataInstance/createInstancePlugin');
|
|
9
9
|
var sortHeaderFormatter = require('./sortHeaderFormatter.js');
|
|
@@ -47,7 +47,7 @@ const decorateColumn = (column, grid) => {
|
|
|
47
47
|
onSort: grid.actions.sort,
|
|
48
48
|
strategy: sortabular__namespace.strategies.byProperty
|
|
49
49
|
}), grid);
|
|
50
|
-
return
|
|
50
|
+
return dsUtilities.compose(initColumnDefinition.appendHeaderFormatter(formatter), initColumnDefinition.mergeClassNameToColumnHeader('with-sortable'))(column);
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
const composeRows = (rows, grid) => {
|
|
@@ -67,8 +67,8 @@ const composeRows = (rows, grid) => {
|
|
|
67
67
|
} = grid.getInstance();
|
|
68
68
|
const sortingConfig = {
|
|
69
69
|
columns: decoratedColumns,
|
|
70
|
-
sortingColumns: !
|
|
71
|
-
sort:
|
|
70
|
+
sortingColumns: !dsUtilities.isEmpty(sortingColumns) && sortingColumns,
|
|
71
|
+
sort: dsUtilities.orderBy,
|
|
72
72
|
emptyLast: sortEmptyLast
|
|
73
73
|
}; // TODO: 1572 FIX
|
|
74
74
|
|
|
@@ -87,9 +87,10 @@ const SortablePlugin = createInstancePlugin__default["default"]('sortable', {
|
|
|
87
87
|
registerHotKeys(grid) {
|
|
88
88
|
return {
|
|
89
89
|
key: 'ctrl+s',
|
|
90
|
-
handler:
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
handler: _ref => {
|
|
91
|
+
let {
|
|
92
|
+
cellIndex
|
|
93
|
+
} = _ref;
|
|
93
94
|
const {
|
|
94
95
|
actions: {
|
|
95
96
|
sort
|
|
@@ -3,28 +3,26 @@
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
6
|
-
var
|
|
7
|
-
var ArrowheadUp = require('@elliemae/ds-icons/ArrowheadUp');
|
|
6
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
8
7
|
|
|
9
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
9
|
|
|
11
10
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
-
var ArrowheadDown__default = /*#__PURE__*/_interopDefaultLegacy(ArrowheadDown);
|
|
14
|
-
var ArrowheadUp__default = /*#__PURE__*/_interopDefaultLegacy(ArrowheadUp);
|
|
15
12
|
|
|
16
13
|
var _ArrowheadUp, _ArrowheadDown;
|
|
17
14
|
const blockName = 'data-grid-sort-header';
|
|
18
15
|
const SortHeaderContainer = dsClassnames.aggregatedClasses('div')(blockName);
|
|
19
16
|
const iconColor = ['brand-primary', 800];
|
|
20
|
-
const SortHeader = /*#__PURE__*/React__default["default"].memo(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
const SortHeader = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
18
|
+
let {
|
|
19
|
+
value,
|
|
20
|
+
onClick,
|
|
21
|
+
sortState
|
|
22
|
+
} = _ref;
|
|
23
|
+
const sortIndicator = sortState === 'asc' ? _ArrowheadUp || (_ArrowheadUp = /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadUp, {
|
|
26
24
|
color: iconColor
|
|
27
|
-
})) : _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx__default["default"](
|
|
25
|
+
})) : _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadDown, {
|
|
28
26
|
color: iconColor
|
|
29
27
|
}));
|
|
30
28
|
return /*#__PURE__*/_jsx__default["default"](SortHeaderContainer, {
|
|
@@ -34,10 +32,11 @@ const SortHeader = /*#__PURE__*/React__default["default"].memo(({
|
|
|
34
32
|
}, void 0, value), sortState && sortIndicator);
|
|
35
33
|
});
|
|
36
34
|
|
|
37
|
-
const sortHeaderFormatter = (sortable, grid) => (value, {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
const sortHeaderFormatter = (sortable, grid) => (value, _ref2) => {
|
|
36
|
+
let {
|
|
37
|
+
columnIndex,
|
|
38
|
+
property
|
|
39
|
+
} = _ref2;
|
|
41
40
|
const {
|
|
42
41
|
state: {
|
|
43
42
|
sortingColumns
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
4
11
|
var sortabular = require('sortabular');
|
|
5
12
|
|
|
6
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -30,9 +37,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
30
37
|
|
|
31
38
|
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__default["default"](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; }
|
|
32
39
|
|
|
33
|
-
const deepSorting =
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
const deepSorting = function (sortConfig) {
|
|
41
|
+
let rows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
42
|
+
return sortabular__namespace.sorter(sortConfig)(rows.map(row => row.children && row.children.length ? _objectSpread(_objectSpread({}, row), {}, {
|
|
43
|
+
children: deepSorting(sortConfig, row.children)
|
|
44
|
+
}) : row));
|
|
45
|
+
};
|
|
36
46
|
|
|
37
47
|
function sortTree(sortConfig) {
|
|
38
48
|
return rows => deepSorting(sortConfig, rows);
|