@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
|
@@ -14,26 +14,27 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
14
14
|
|
|
15
15
|
const PaginationControls = dsClassnames.aggregatedClasses('div')('data-grid', 'controls-pagination');
|
|
16
16
|
|
|
17
|
-
const Pagination =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
const Pagination = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
paginated,
|
|
20
|
+
pagination = {},
|
|
21
|
+
onPerPage,
|
|
22
|
+
onPageSelect,
|
|
23
|
+
paginationStep = 5,
|
|
24
|
+
maxPerPage = 10,
|
|
25
|
+
minPerPage = 5
|
|
26
|
+
} = _ref;
|
|
26
27
|
const {
|
|
27
28
|
perPage
|
|
28
29
|
} = pagination;
|
|
29
30
|
if (pagination && pagination.conditionalPagination === true && paginated.amount === 1) return null;
|
|
30
|
-
return paginated.amount > 0 ? /*#__PURE__*/_jsx__default[
|
|
31
|
+
return paginated.amount > 0 ? /*#__PURE__*/_jsx__default["default"](PaginationControls, {}, void 0, /*#__PURE__*/_jsx__default["default"](PerPageDropdown, {
|
|
31
32
|
max: maxPerPage,
|
|
32
33
|
min: minPerPage,
|
|
33
34
|
onChange: onPerPage,
|
|
34
35
|
step: paginationStep,
|
|
35
36
|
value: perPage
|
|
36
|
-
}), /*#__PURE__*/_jsx__default[
|
|
37
|
+
}), /*#__PURE__*/_jsx__default["default"](Paginator, {
|
|
37
38
|
onSelect: onPageSelect,
|
|
38
39
|
pages: paginated.amount,
|
|
39
40
|
pagination: pagination
|
|
@@ -2,62 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
require('react');
|
|
5
|
-
var
|
|
5
|
+
var ReactPagify = require('react-pagify');
|
|
6
6
|
var segmentize = require('segmentize');
|
|
7
7
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
10
|
|
|
11
11
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
|
-
var
|
|
12
|
+
var ReactPagify__default = /*#__PURE__*/_interopDefaultLegacy(ReactPagify);
|
|
13
13
|
var segmentize__default = /*#__PURE__*/_interopDefaultLegacy(segmentize);
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _ReactPagify$Segment, _ReactPagify$Ellipsis, _ReactPagify$Segment2, _ReactPagify$Segment3, _ReactPagify$Segment4, _ReactPagify$Ellipsis2, _ReactPagify$Segment5;
|
|
16
16
|
const blockName = 'data-grid';
|
|
17
17
|
const PaginationContainer = dsClassnames.aggregatedClasses('div')(blockName, 'pagination');
|
|
18
|
-
const PagifyContext = dsClassnames.aggregatedClasses(
|
|
18
|
+
const PagifyContext = dsClassnames.aggregatedClasses(ReactPagify__default["default"] === null || ReactPagify__default["default"] === void 0 ? void 0 : ReactPagify__default["default"].Context)(blockName, 'pagify-pagination');
|
|
19
19
|
|
|
20
|
-
const Paginator =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
const Paginator = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
pagination,
|
|
23
|
+
pages,
|
|
24
|
+
onSelect,
|
|
25
|
+
labelPrevious = 'Previous',
|
|
26
|
+
labelNext = 'Next'
|
|
27
|
+
} = _ref;
|
|
27
28
|
const prevPage = pagination.page - 1;
|
|
28
29
|
const nextPage = pagination.page + 1;
|
|
29
|
-
return /*#__PURE__*/_jsx__default[
|
|
30
|
+
return /*#__PURE__*/_jsx__default["default"](PaginationContainer, {}, void 0, /*#__PURE__*/_jsx__default["default"](PagifyContext, {
|
|
30
31
|
onSelect: page => page !== pagination.page && onSelect(page),
|
|
31
|
-
segments: segmentize__default[
|
|
32
|
+
segments: segmentize__default["default"]({
|
|
32
33
|
page: pagination.page,
|
|
33
34
|
pages,
|
|
34
35
|
beginPages: 1,
|
|
35
36
|
endPages: 1,
|
|
36
37
|
sidePages: 1
|
|
37
38
|
})
|
|
38
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
39
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](ReactPagify__default["default"].Button, {
|
|
39
40
|
className: pagination.page <= 1 ? 'button-disabled' : '',
|
|
40
41
|
page: prevPage
|
|
41
|
-
}, void 0, labelPrevious),
|
|
42
|
+
}, void 0, labelPrevious), _ReactPagify$Segment || (_ReactPagify$Segment = /*#__PURE__*/_jsx__default["default"](ReactPagify__default["default"].Segment, {
|
|
42
43
|
field: "beginPages"
|
|
43
|
-
})),
|
|
44
|
+
})), _ReactPagify$Ellipsis || (_ReactPagify$Ellipsis = /*#__PURE__*/_jsx__default["default"](ReactPagify__default["default"].Ellipsis, {
|
|
44
45
|
className: "ellipsis",
|
|
45
46
|
nextField: "previousPages",
|
|
46
47
|
previousField: "beginPages"
|
|
47
|
-
})),
|
|
48
|
+
})), _ReactPagify$Segment2 || (_ReactPagify$Segment2 = /*#__PURE__*/_jsx__default["default"](ReactPagify__default["default"].Segment, {
|
|
48
49
|
field: "previousPages"
|
|
49
|
-
})),
|
|
50
|
+
})), _ReactPagify$Segment3 || (_ReactPagify$Segment3 = /*#__PURE__*/_jsx__default["default"](ReactPagify__default["default"].Segment, {
|
|
50
51
|
className: "selected",
|
|
51
52
|
field: "centerPage"
|
|
52
|
-
})),
|
|
53
|
+
})), _ReactPagify$Segment4 || (_ReactPagify$Segment4 = /*#__PURE__*/_jsx__default["default"](ReactPagify__default["default"].Segment, {
|
|
53
54
|
field: "nextPages"
|
|
54
|
-
})),
|
|
55
|
+
})), _ReactPagify$Ellipsis2 || (_ReactPagify$Ellipsis2 = /*#__PURE__*/_jsx__default["default"](ReactPagify__default["default"].Ellipsis, {
|
|
55
56
|
className: "ellipsis",
|
|
56
57
|
nextField: "endPages",
|
|
57
58
|
previousField: "nextPages"
|
|
58
|
-
})),
|
|
59
|
+
})), _ReactPagify$Segment5 || (_ReactPagify$Segment5 = /*#__PURE__*/_jsx__default["default"](ReactPagify__default["default"].Segment, {
|
|
59
60
|
field: "endPages"
|
|
60
|
-
})), /*#__PURE__*/_jsx__default[
|
|
61
|
+
})), /*#__PURE__*/_jsx__default["default"](ReactPagify__default["default"].Button, {
|
|
61
62
|
className: pagination.page >= pages ? 'button-disabled' : '',
|
|
62
63
|
page: nextPage
|
|
63
64
|
}, void 0, labelNext)));
|
|
@@ -3,10 +3,17 @@
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
5
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
13
|
require('react');
|
|
7
14
|
var memoizeOne = require('memoize-one');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
15
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
16
|
+
var dsForm = require('@elliemae/ds-form');
|
|
10
17
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
18
|
|
|
12
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -15,7 +22,6 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
15
22
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
23
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
17
24
|
var memoizeOne__default = /*#__PURE__*/_interopDefaultLegacy(memoizeOne);
|
|
18
|
-
var DSComboBox__default = /*#__PURE__*/_interopDefaultLegacy(DSComboBox);
|
|
19
25
|
|
|
20
26
|
var _span;
|
|
21
27
|
|
|
@@ -23,16 +29,16 @@ const _excluded = ["children"];
|
|
|
23
29
|
|
|
24
30
|
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; }
|
|
25
31
|
|
|
26
|
-
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[
|
|
32
|
+
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; }
|
|
27
33
|
|
|
28
34
|
const SingleValue = _ref => {
|
|
29
35
|
let {
|
|
30
36
|
children
|
|
31
37
|
} = _ref,
|
|
32
|
-
props = _objectWithoutProperties__default[
|
|
38
|
+
props = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
33
39
|
|
|
34
|
-
return /*#__PURE__*/jsxRuntime.jsxs(
|
|
35
|
-
children: [children, " ", _span || (_span = /*#__PURE__*/_jsx__default[
|
|
40
|
+
return /*#__PURE__*/jsxRuntime.jsxs(dsForm.components.SingleValue, _objectSpread(_objectSpread({}, props), {}, {
|
|
41
|
+
children: [children, " ", _span || (_span = /*#__PURE__*/_jsx__default["default"]("span", {}, void 0, "per page"))]
|
|
36
42
|
}));
|
|
37
43
|
};
|
|
38
44
|
|
|
@@ -41,20 +47,21 @@ const generateOption = value => ({
|
|
|
41
47
|
label: value
|
|
42
48
|
});
|
|
43
49
|
|
|
44
|
-
const getOptions = memoizeOne__default[
|
|
45
|
-
const options =
|
|
50
|
+
const getOptions = memoizeOne__default["default"]((step, min, max) => {
|
|
51
|
+
const options = dsUtilities.range(min, max + step, step).map(generateOption);
|
|
46
52
|
return min === 0 ? options.slice(1, options.length) : options;
|
|
47
53
|
});
|
|
48
54
|
|
|
49
|
-
function PerPageDropdown({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
function PerPageDropdown(_ref2) {
|
|
56
|
+
let {
|
|
57
|
+
min = 0,
|
|
58
|
+
max = 100,
|
|
59
|
+
step = 5,
|
|
60
|
+
value = 0,
|
|
61
|
+
onChange = () => null
|
|
62
|
+
} = _ref2;
|
|
56
63
|
const options = getOptions(step, min, max);
|
|
57
|
-
return /*#__PURE__*/_jsx__default[
|
|
64
|
+
return /*#__PURE__*/_jsx__default["default"](dsForm.DSComboBox, {
|
|
58
65
|
className: "per-page-dropdown",
|
|
59
66
|
components: {
|
|
60
67
|
SingleValue
|
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const parsePerPageNumber = (number, max
|
|
5
|
+
const parsePerPageNumber = function (number, max) {
|
|
6
|
+
let min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
6
7
|
if (number > max) return max;
|
|
7
8
|
if (number < min) return min;
|
|
8
9
|
return number;
|
|
9
10
|
};
|
|
10
|
-
function paginate(rows, {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
function paginate(rows, _ref) {
|
|
12
|
+
let {
|
|
13
|
+
page,
|
|
14
|
+
perPage = 1,
|
|
15
|
+
amountOfPages: amount,
|
|
16
|
+
totalRows
|
|
17
|
+
} = _ref;
|
|
18
|
+
|
|
16
19
|
// return if pagination state is controlled
|
|
17
20
|
if (amount && totalRows) {
|
|
18
21
|
return {
|
|
@@ -34,5 +37,5 @@ function paginate(rows, {
|
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
exports[
|
|
40
|
+
exports["default"] = paginate;
|
|
38
41
|
exports.parsePerPageNumber = parsePerPageNumber;
|
|
@@ -3,17 +3,22 @@
|
|
|
3
3
|
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
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
12
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
7
13
|
var helper = require('./helper.js');
|
|
8
14
|
|
|
9
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
16
|
|
|
11
17
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
12
|
-
var useDerivedStateFromProps__default = /*#__PURE__*/_interopDefaultLegacy(useDerivedStateFromProps);
|
|
13
18
|
|
|
14
19
|
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; }
|
|
15
20
|
|
|
16
|
-
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[
|
|
21
|
+
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; }
|
|
17
22
|
function usePaginationState(grid) {
|
|
18
23
|
const {
|
|
19
24
|
minPerPage = 0,
|
|
@@ -30,7 +35,7 @@ function usePaginationState(grid) {
|
|
|
30
35
|
composedRows,
|
|
31
36
|
rows
|
|
32
37
|
} = grid.getInstance();
|
|
33
|
-
const [pagination, setPagination] =
|
|
38
|
+
const [pagination, setPagination] = dsUtilities.useDerivedStateFromProps(paginationProp);
|
|
34
39
|
|
|
35
40
|
const onPerPage = perPageNumber => {
|
|
36
41
|
const parsedPerPageNumber = helper.parsePerPageNumber(perPageNumber, maxPerPage, minPerPage);
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
8
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
6
9
|
var createInstancePlugin = require('@elliemae/ds-shared/createDataInstance/createInstancePlugin');
|
|
7
10
|
var decorateResizable = require('./decorateResizable.js');
|
|
8
11
|
|
|
@@ -10,8 +13,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
13
|
|
|
11
14
|
var createInstancePlugin__default = /*#__PURE__*/_interopDefaultLegacy(createInstancePlugin);
|
|
12
15
|
|
|
13
|
-
/* eslint-disable no-param-reassign */
|
|
14
|
-
|
|
15
16
|
const noop = () => null;
|
|
16
17
|
|
|
17
18
|
const DELTA_LAST_COLUMN = 25; // eslint-disable-next-line no-unused-vars
|
|
@@ -97,7 +98,7 @@ const decorateColumn = (column, grid, index) => {
|
|
|
97
98
|
width,
|
|
98
99
|
extraData
|
|
99
100
|
});
|
|
100
|
-
|
|
101
|
+
dsUtilities.runAll(onResizeEnd)(width, extraData);
|
|
101
102
|
grid.updateRowWidth();
|
|
102
103
|
},
|
|
103
104
|
minWidth: (column.minWidth || minColumnWidth) - (isLast ? DELTA_LAST_COLUMN : 0),
|
|
@@ -105,7 +106,7 @@ const decorateColumn = (column, grid, index) => {
|
|
|
105
106
|
}));
|
|
106
107
|
};
|
|
107
108
|
|
|
108
|
-
const ResizablePlugin = createInstancePlugin__default[
|
|
109
|
+
const ResizablePlugin = createInstancePlugin__default["default"]('resizable', {
|
|
109
110
|
decorateColumn
|
|
110
111
|
});
|
|
111
112
|
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
12
|
var React = require('react');
|
|
@@ -17,18 +22,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
17
22
|
|
|
18
23
|
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; }
|
|
19
24
|
|
|
20
|
-
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[
|
|
25
|
+
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; }
|
|
21
26
|
|
|
22
27
|
const addResizableToColumn = (column, formatter) => initColumnDefinition.appendHeaderFormatter(formatter, column);
|
|
23
28
|
|
|
24
|
-
const ResizableWrapper = /*#__PURE__*/React__default[
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const ResizableWrapper = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
30
|
+
let {
|
|
31
|
+
value,
|
|
32
|
+
onDrag,
|
|
33
|
+
onDragEnd,
|
|
34
|
+
onDragStart,
|
|
35
|
+
minWidth,
|
|
36
|
+
handleClassName
|
|
37
|
+
} = _ref;
|
|
32
38
|
const {
|
|
33
39
|
containerRef,
|
|
34
40
|
Handle
|
|
@@ -42,7 +48,7 @@ const ResizableWrapper = /*#__PURE__*/React__default['default'].memo(({
|
|
|
42
48
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
43
49
|
ref: containerRef,
|
|
44
50
|
className: "resize-container",
|
|
45
|
-
children: [value, /*#__PURE__*/_jsx__default[
|
|
51
|
+
children: [value, /*#__PURE__*/_jsx__default["default"](Handle, {})]
|
|
46
52
|
});
|
|
47
53
|
}); // eslint-disable-next-line react/display-name
|
|
48
54
|
|
|
@@ -9,13 +9,14 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
11
11
|
|
|
12
|
-
const useResizeHandle =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const useResizeHandle = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
onDragStart,
|
|
15
|
+
onDrag,
|
|
16
|
+
onDragEnd,
|
|
17
|
+
minWidth = 10,
|
|
18
|
+
isLast = false
|
|
19
|
+
} = _ref;
|
|
19
20
|
const startX = React.useRef();
|
|
20
21
|
const startWidth = React.useRef();
|
|
21
22
|
const containerRef = React.useRef();
|
|
@@ -49,15 +50,19 @@ const useResizeHandle = ({
|
|
|
49
50
|
triggerMove(onDragStart, event);
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
const HandleComponent =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
const HandleComponent = _ref2 => {
|
|
54
|
+
let {
|
|
55
|
+
className = 'resize-handle'
|
|
56
|
+
} = _ref2;
|
|
57
|
+
return (
|
|
58
|
+
/*#__PURE__*/
|
|
59
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
60
|
+
_jsx__default["default"]("div", {
|
|
61
|
+
className: className,
|
|
62
|
+
onMouseDown: onMouseDown
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
};
|
|
61
66
|
|
|
62
67
|
return {
|
|
63
68
|
containerRef,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('core-js/modules/es.string.replace.js');
|
|
6
|
-
var
|
|
6
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
7
7
|
var memoizeOne = require('memoize-one');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -12,14 +12,17 @@ var memoizeOne__default = /*#__PURE__*/_interopDefaultLegacy(memoizeOne);
|
|
|
12
12
|
|
|
13
13
|
const isPercentNumber = stringNumber => typeof stringNumber === 'string' && stringNumber.indexOf('%') !== -1;
|
|
14
14
|
const isPxNumber = stringNumber => typeof stringNumber === 'string' && stringNumber.indexOf('px') !== -1;
|
|
15
|
-
const translatePercentageToPx = memoizeOne__default[
|
|
16
|
-
|
|
15
|
+
const translatePercentageToPx = memoizeOne__default["default"](function (totalWidth, percentage) {
|
|
16
|
+
let minWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
17
|
+
const parsedPercentatge = dsUtilities.parseInt(percentage.replace('%', ''));
|
|
17
18
|
const width = totalWidth * parsedPercentatge / 100;
|
|
18
19
|
return width > minWidth ? width : minWidth;
|
|
19
20
|
});
|
|
20
|
-
const translateStringPxToNumberPx = memoizeOne__default[
|
|
21
|
-
memoizeOne__default[
|
|
22
|
-
memoizeOne__default[
|
|
21
|
+
const translateStringPxToNumberPx = memoizeOne__default["default"](pxNumber => dsUtilities.parseInt(pxNumber.replace('%', '')));
|
|
22
|
+
memoizeOne__default["default"]((totalWidth, pxWidth) => "".concat(pxWidth / totalWidth * 100, "%"));
|
|
23
|
+
memoizeOne__default["default"](function (gridWidth) {
|
|
24
|
+
let width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
25
|
+
let minWidth = arguments.length > 2 ? arguments[2] : undefined;
|
|
23
26
|
if (isPercentNumber(width)) return translatePercentageToPx(gridWidth, width, minWidth);
|
|
24
27
|
if (isPxNumber(width)) return translateStringPxToNumberPx(width);
|
|
25
28
|
return width;
|
|
@@ -4,10 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
6
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
7
13
|
var React = require('react');
|
|
8
14
|
var reactSortableHoc = require('react-sortable-hoc');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
15
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
16
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
11
17
|
var initColumnDefinition = require('@elliemae/ds-shared/useDataGrid/initColumnDefinition');
|
|
12
18
|
var createInstancePlugin = require('@elliemae/ds-shared/createDataInstance/createInstancePlugin');
|
|
13
19
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -16,28 +22,30 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
22
|
|
|
17
23
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
18
24
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
19
|
-
var GripperVertical__default = /*#__PURE__*/_interopDefaultLegacy(GripperVertical);
|
|
20
25
|
var createInstancePlugin__default = /*#__PURE__*/_interopDefaultLegacy(createInstancePlugin);
|
|
21
26
|
|
|
22
27
|
var _GripperVertical, _DragHandle;
|
|
23
28
|
|
|
24
29
|
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; }
|
|
25
30
|
|
|
26
|
-
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[
|
|
31
|
+
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; }
|
|
27
32
|
const keysToOmit = ['axis', 'contentWindow', 'disableAutoscroll', 'distance', 'getContainer', 'getHelperDimensions', 'helperClass', 'helperContainer', 'hideSortableGhost', 'keyboardSortingTransitionDuration', 'lockAxis', 'lockOffset', 'lockToContainerEdges', 'onSortEnd', 'onSortMove', 'onSortOver', 'onSortStart', 'pressDelay', 'pressThreshold', 'shouldCancelStart', 'transitionDuration', 'updateBeforeSortStart', 'useDragHandle', 'useWindowAsScrollContainer'];
|
|
28
|
-
const DragHandle = reactSortableHoc.SortableHandle(() => _GripperVertical || (_GripperVertical = /*#__PURE__*/_jsx__default[
|
|
33
|
+
const DragHandle = reactSortableHoc.SortableHandle(() => _GripperVertical || (_GripperVertical = /*#__PURE__*/_jsx__default["default"](dsIcons.GripperVertical, {
|
|
29
34
|
className: "drag-handle"
|
|
30
35
|
})));
|
|
31
36
|
|
|
32
|
-
const translateDnDData =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const translateDnDData = _ref => {
|
|
38
|
+
let {
|
|
39
|
+
oldIndex,
|
|
40
|
+
newIndex,
|
|
41
|
+
index
|
|
42
|
+
} = _ref;
|
|
43
|
+
return {
|
|
44
|
+
sourceIndex: oldIndex,
|
|
45
|
+
targetIndex: newIndex,
|
|
46
|
+
fromIndex: index === undefined ? oldIndex : index
|
|
47
|
+
};
|
|
48
|
+
};
|
|
41
49
|
|
|
42
50
|
const decorateColumns = columns => {
|
|
43
51
|
const dragColumn = {
|
|
@@ -49,7 +57,7 @@ const decorateColumns = columns => {
|
|
|
49
57
|
special: true
|
|
50
58
|
};
|
|
51
59
|
return [initColumnDefinition.appendCellFormatter(() => /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
52
|
-
children: _DragHandle || (_DragHandle = /*#__PURE__*/_jsx__default[
|
|
60
|
+
children: _DragHandle || (_DragHandle = /*#__PURE__*/_jsx__default["default"](DragHandle, {}))
|
|
53
61
|
}), dragColumn), ...columns];
|
|
54
62
|
};
|
|
55
63
|
|
|
@@ -65,10 +73,10 @@ const getBodyProps = (props, grid) => {
|
|
|
65
73
|
grid.setIsRowDragging(false);
|
|
66
74
|
onMoveRowEnd(translateDnDData(data));
|
|
67
75
|
},
|
|
68
|
-
onSortStart: (
|
|
76
|
+
onSortStart: function () {
|
|
69
77
|
grid.disableEvents();
|
|
70
78
|
grid.setIsRowDragging(true);
|
|
71
|
-
onMoveRowStart(...
|
|
79
|
+
onMoveRowStart(...arguments);
|
|
72
80
|
},
|
|
73
81
|
onSortOver: data => {
|
|
74
82
|
onReorder(translateDnDData(data));
|
|
@@ -89,7 +97,7 @@ const decorateRenderers = renderers => {
|
|
|
89
97
|
const RowComponent = renderers.body.row;
|
|
90
98
|
const BodyWrapperComponent = renderers.body.wrapper;
|
|
91
99
|
const Row = React.useMemo(() => reactSortableHoc.SortableElement(RowComponent), []);
|
|
92
|
-
const BodyWrapper = React.useMemo(() => reactSortableHoc.SortableContainer(props => /*#__PURE__*/jsxRuntime.jsx(BodyWrapperComponent, _objectSpread({},
|
|
100
|
+
const BodyWrapper = React.useMemo(() => reactSortableHoc.SortableContainer(props => /*#__PURE__*/jsxRuntime.jsx(BodyWrapperComponent, _objectSpread({}, dsUtilities.omit(props, keysToOmit)))), []);
|
|
93
101
|
return _objectSpread(_objectSpread({}, renderers), {}, {
|
|
94
102
|
body: _objectSpread(_objectSpread({}, renderers.body), {}, {
|
|
95
103
|
wrapper: BodyWrapper,
|
|
@@ -98,7 +106,7 @@ const decorateRenderers = renderers => {
|
|
|
98
106
|
});
|
|
99
107
|
};
|
|
100
108
|
|
|
101
|
-
const DndRowsPlugin = createInstancePlugin__default[
|
|
109
|
+
const DndRowsPlugin = createInstancePlugin__default["default"]('dnd-rows', {
|
|
102
110
|
decorateColumns,
|
|
103
111
|
getBodyProps,
|
|
104
112
|
decorateRenderers
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var cx = require('obj-str');
|
|
7
|
-
var
|
|
8
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
8
9
|
var createInstancePlugin = require('@elliemae/ds-shared/createDataInstance/createInstancePlugin');
|
|
9
10
|
var addSelectableColumn = require('./addSelectableColumn.js');
|
|
10
11
|
var useSelectableState = require('./useSelectableState.js');
|
|
@@ -15,8 +16,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
16
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
16
17
|
var createInstancePlugin__default = /*#__PURE__*/_interopDefaultLegacy(createInstancePlugin);
|
|
17
18
|
|
|
18
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
19
|
-
|
|
20
19
|
const decorateColumns = (columns, grid) => {
|
|
21
20
|
const {
|
|
22
21
|
props: {
|
|
@@ -58,9 +57,10 @@ const decorateColumns = (columns, grid) => {
|
|
|
58
57
|
return columns;
|
|
59
58
|
};
|
|
60
59
|
|
|
61
|
-
const getRowProps = (rowProps, grid, {
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const getRowProps = (rowProps, grid, _ref) => {
|
|
61
|
+
let {
|
|
62
|
+
rowData
|
|
63
|
+
} = _ref;
|
|
64
64
|
const {
|
|
65
65
|
props: {
|
|
66
66
|
showSelectHighlight,
|
|
@@ -80,7 +80,7 @@ const getRowProps = (rowProps, grid, {
|
|
|
80
80
|
rowProps.onClick = () => selectRow(rowData[rowKey], _index);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
rowProps.className = cx__default[
|
|
83
|
+
rowProps.className = cx__default["default"]({
|
|
84
84
|
[rowProps.className]: true,
|
|
85
85
|
selected: isSelected,
|
|
86
86
|
'select-highlight': showSelectHighlight && isSelected
|
|
@@ -100,7 +100,7 @@ const composeRows = (rows, grid) => {
|
|
|
100
100
|
}
|
|
101
101
|
} = grid.getInstance();
|
|
102
102
|
|
|
103
|
-
const selectionPredicate = row =>
|
|
103
|
+
const selectionPredicate = row => dsUtilities.isFunction(isRowSelected) ? isRowSelected(row) : !!selection.selectedRows[row[rowKey]];
|
|
104
104
|
|
|
105
105
|
return multiple ? helper.selectMultipleRow(rows, selectionPredicate) : helper.selectSingleRow(rows, selectionPredicate);
|
|
106
106
|
};
|
|
@@ -150,7 +150,7 @@ const decorateGrid = grid => {
|
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
-
const SelectablePlugin = createInstancePlugin__default[
|
|
153
|
+
const SelectablePlugin = createInstancePlugin__default["default"]('selectable', {
|
|
154
154
|
decorateGrid,
|
|
155
155
|
registerStateHook: useSelectableState.useSelectableState,
|
|
156
156
|
decorateColumns,
|
|
@@ -160,9 +160,10 @@ const SelectablePlugin = createInstancePlugin__default['default']('selectable',
|
|
|
160
160
|
registerHotKeys(grid) {
|
|
161
161
|
return [{
|
|
162
162
|
key: 'space',
|
|
163
|
-
handler:
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
handler: _ref2 => {
|
|
164
|
+
let {
|
|
165
|
+
rowIndex
|
|
166
|
+
} = _ref2;
|
|
166
167
|
const {
|
|
167
168
|
composedRows,
|
|
168
169
|
props: {
|