@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
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
7
7
|
var createInstancePlugin = require('@elliemae/ds-shared/createDataInstance/createInstancePlugin');
|
|
8
8
|
var decorateEditable = require('./decorateEditable.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
12
|
-
var useDerivedStateFromProps__default = /*#__PURE__*/_interopDefaultLegacy(useDerivedStateFromProps);
|
|
13
12
|
var createInstancePlugin__default = /*#__PURE__*/_interopDefaultLegacy(createInstancePlugin);
|
|
14
13
|
|
|
15
14
|
const registerStateHook = grid => {
|
|
@@ -19,7 +18,7 @@ const registerStateHook = grid => {
|
|
|
19
18
|
onColumnRowEdited,
|
|
20
19
|
onColumnRowEdit
|
|
21
20
|
} = grid.props;
|
|
22
|
-
const [editingRows, setEditingRows] =
|
|
21
|
+
const [editingRows, setEditingRows] = dsUtilities.useDerivedStateFromProps(editingRowsProp || {});
|
|
23
22
|
|
|
24
23
|
const activateEdit = editParams => {
|
|
25
24
|
const {
|
|
@@ -35,16 +34,17 @@ const registerStateHook = grid => {
|
|
|
35
34
|
};
|
|
36
35
|
setEditingRows(prevEditingRows => {
|
|
37
36
|
onColumnRowEdit(editParams);
|
|
38
|
-
return
|
|
37
|
+
return dsUtilities.toggleInObject(prevEditingRows, rowData[rowKey], columnIndex);
|
|
39
38
|
});
|
|
40
39
|
};
|
|
41
40
|
|
|
42
|
-
const editValue =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
const editValue = _ref => {
|
|
42
|
+
let {
|
|
43
|
+
value,
|
|
44
|
+
rowData,
|
|
45
|
+
property,
|
|
46
|
+
rowIndex
|
|
47
|
+
} = _ref;
|
|
48
48
|
setEditingRows({});
|
|
49
49
|
onColumnRowEdited({
|
|
50
50
|
value,
|
|
@@ -80,17 +80,18 @@ const decorateColumn = (column, grid) => {
|
|
|
80
80
|
}, grid) : column;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
const EditablePlugin = createInstancePlugin__default[
|
|
83
|
+
const EditablePlugin = createInstancePlugin__default["default"]('editable', {
|
|
84
84
|
registerStateHook,
|
|
85
85
|
decorateColumn,
|
|
86
86
|
|
|
87
87
|
registerHotKeys(grid) {
|
|
88
88
|
return {
|
|
89
89
|
key: 'enter',
|
|
90
|
-
handler:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
handler: _ref2 => {
|
|
91
|
+
let {
|
|
92
|
+
rowIndex,
|
|
93
|
+
cellIndex
|
|
94
|
+
} = _ref2;
|
|
94
95
|
const {
|
|
95
96
|
composedRows,
|
|
96
97
|
decoratedColumns,
|
|
@@ -5,10 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
7
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
14
|
require('react');
|
|
9
15
|
var edit = require('react-edit');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
16
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
17
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
12
18
|
var initColumnDefinition = require('@elliemae/ds-shared/useDataGrid/initColumnDefinition');
|
|
13
19
|
var getEditorComponent = require('./getEditorComponent.js');
|
|
14
20
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -24,14 +30,12 @@ function _interopNamespace(e) {
|
|
|
24
30
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
31
|
Object.defineProperty(n, k, d.get ? d : {
|
|
26
32
|
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return e[k];
|
|
29
|
-
}
|
|
33
|
+
get: function () { return e[k]; }
|
|
30
34
|
});
|
|
31
35
|
}
|
|
32
36
|
});
|
|
33
37
|
}
|
|
34
|
-
n[
|
|
38
|
+
n["default"] = e;
|
|
35
39
|
return Object.freeze(n);
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -39,7 +43,6 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
39
43
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
40
44
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
41
45
|
var edit__namespace = /*#__PURE__*/_interopNamespace(edit);
|
|
42
|
-
var EditPencil__default = /*#__PURE__*/_interopDefaultLegacy(EditPencil);
|
|
43
46
|
|
|
44
47
|
var _EditPencil, _span;
|
|
45
48
|
|
|
@@ -47,7 +50,7 @@ const _excluded = ["columnIndex", "rowData", "column"];
|
|
|
47
50
|
|
|
48
51
|
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; }
|
|
49
52
|
|
|
50
|
-
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[
|
|
53
|
+
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; }
|
|
51
54
|
|
|
52
55
|
const makeEditableConfig = grid => edit__namespace.edit({
|
|
53
56
|
isEditing: _ref => {
|
|
@@ -56,7 +59,7 @@ const makeEditableConfig = grid => edit__namespace.edit({
|
|
|
56
59
|
rowData,
|
|
57
60
|
column = {}
|
|
58
61
|
} = _ref,
|
|
59
|
-
rest = _objectWithoutProperties__default[
|
|
62
|
+
rest = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
60
63
|
|
|
61
64
|
const {
|
|
62
65
|
state: {
|
|
@@ -79,18 +82,21 @@ const makeEditableConfig = grid => edit__namespace.edit({
|
|
|
79
82
|
return editingRows[rowData[rowKey]] === columnIndex || column.alwaysEditing || isCustomEditing;
|
|
80
83
|
},
|
|
81
84
|
onActivate: () => null,
|
|
82
|
-
onValue: (
|
|
85
|
+
onValue: function () {
|
|
86
|
+
return grid.getInstance().actions.editValue(...arguments);
|
|
87
|
+
}
|
|
83
88
|
});
|
|
84
89
|
|
|
85
|
-
const addEditableToCell = ({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
const addEditableToCell = (_ref2, grid) => {
|
|
91
|
+
let {
|
|
92
|
+
column,
|
|
93
|
+
config,
|
|
94
|
+
handlers
|
|
95
|
+
} = _ref2;
|
|
90
96
|
column.cell.transforms.push(config(getEditorComponent(column.customEditor, handlers)));
|
|
91
|
-
column.cell.props.className =
|
|
97
|
+
column.cell.props.className = dsUtilities.cx(column.cell.props.className, "editable".concat(column.customEditor ? ' customEditor' : ''));
|
|
92
98
|
return initColumnDefinition.appendCellFormatter([(value, extraParams) => /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
93
|
-
children: /*#__PURE__*/_jsx__default[
|
|
99
|
+
children: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
94
100
|
onClick: e => {
|
|
95
101
|
e.stopPropagation();
|
|
96
102
|
grid.getInstance().actions.activateEdit(extraParams);
|
|
@@ -104,9 +110,9 @@ const addEditableToCell = ({
|
|
|
104
110
|
},
|
|
105
111
|
role: "gridcell",
|
|
106
112
|
tabIndex: 0
|
|
107
|
-
}, void 0, value, _EditPencil || (_EditPencil = /*#__PURE__*/_jsx__default[
|
|
113
|
+
}, void 0, value, _EditPencil || (_EditPencil = /*#__PURE__*/_jsx__default["default"](dsIcons.EditPencil, {
|
|
108
114
|
className: "edit-pencil"
|
|
109
|
-
})), _span || (_span = /*#__PURE__*/_jsx__default[
|
|
115
|
+
})), _span || (_span = /*#__PURE__*/_jsx__default["default"]("span", {
|
|
110
116
|
className: "edit-separator"
|
|
111
117
|
}, void 0, " ")))
|
|
112
118
|
})], column);
|
|
@@ -1,5 +1,10 @@
|
|
|
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 _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
9
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
@@ -18,54 +23,60 @@ const _excluded = ["type"];
|
|
|
18
23
|
|
|
19
24
|
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
25
|
|
|
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[
|
|
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["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
27
|
const components = {
|
|
23
28
|
DSComboBox: ComboBox,
|
|
24
29
|
DSTextBox: TextBox
|
|
25
30
|
};
|
|
26
31
|
|
|
27
|
-
const getEditorComponent = (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (typeof editorComponent === 'function') {
|
|
33
|
-
return editorComponent(_objectSpread({
|
|
32
|
+
const getEditorComponent = function () {
|
|
33
|
+
let editorComponent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
34
|
+
let handlers = arguments.length > 1 ? arguments[1] : undefined;
|
|
35
|
+
return _ref => {
|
|
36
|
+
let {
|
|
34
37
|
value,
|
|
35
38
|
onValue,
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
+
extraParameters
|
|
40
|
+
} = _ref;
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
if (typeof editorComponent === 'function') {
|
|
43
|
+
return editorComponent(_objectSpread({
|
|
44
|
+
value,
|
|
45
|
+
onValue,
|
|
46
|
+
customHandlers: handlers
|
|
47
|
+
}, extraParameters));
|
|
48
|
+
}
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
const {
|
|
51
|
+
type = 'DSTextBox'
|
|
52
|
+
} = editorComponent,
|
|
53
|
+
restEditorProps = _objectWithoutProperties__default["default"](editorComponent, _excluded);
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
var _restEditorProps$opti;
|
|
55
|
+
const Component = components[type];
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
if (type === 'DSComboBox') {
|
|
58
|
+
var _restEditorProps$opti;
|
|
59
|
+
|
|
60
|
+
// TODO: remove this whole condition when combobox v3 is out and fully working without "maxOptions" parameter
|
|
61
|
+
const maxOptions = (restEditorProps === null || restEditorProps === void 0 ? void 0 : (_restEditorProps$opti = restEditorProps.options) === null || _restEditorProps$opti === void 0 ? void 0 : _restEditorProps$opti.length) || 100;
|
|
62
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
63
|
+
style: {
|
|
64
|
+
zIndex: 0
|
|
65
|
+
}
|
|
66
|
+
}, void 0, /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread({
|
|
67
|
+
autoFocus: true,
|
|
68
|
+
onValue: onValue,
|
|
69
|
+
value: value,
|
|
70
|
+
maxOptions: maxOptions
|
|
71
|
+
}, restEditorProps)));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread({
|
|
57
75
|
autoFocus: true,
|
|
58
76
|
onValue: onValue,
|
|
59
|
-
value: value
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread({
|
|
65
|
-
autoFocus: true,
|
|
66
|
-
onValue: onValue,
|
|
67
|
-
value: value
|
|
68
|
-
}, restEditorProps));
|
|
77
|
+
value: value
|
|
78
|
+
}, restEditorProps));
|
|
79
|
+
};
|
|
69
80
|
};
|
|
70
81
|
|
|
71
82
|
module.exports = getEditorComponent;
|
|
@@ -1,14 +1,18 @@
|
|
|
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 _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
10
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
11
|
var React = require('react');
|
|
7
|
-
var
|
|
8
|
-
var ArrowheadRight = require('@elliemae/ds-icons/ArrowheadRight');
|
|
12
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
9
13
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
10
|
-
var DSButton = require('@elliemae/ds-
|
|
11
|
-
var DSTruncatedTooltipText = require('@elliemae/ds-
|
|
14
|
+
var DSButton = require('@elliemae/ds-button');
|
|
15
|
+
var DSTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
12
16
|
var blockNames = require('../../blockNames.js');
|
|
13
17
|
var rowSizes = require('../../rowSizes.js');
|
|
14
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -18,8 +22,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
18
22
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
19
23
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
20
24
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
|
-
var ArrowheadDown__default = /*#__PURE__*/_interopDefaultLegacy(ArrowheadDown);
|
|
22
|
-
var ArrowheadRight__default = /*#__PURE__*/_interopDefaultLegacy(ArrowheadRight);
|
|
23
25
|
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
24
26
|
var DSTruncatedTooltipText__default = /*#__PURE__*/_interopDefaultLegacy(DSTruncatedTooltipText);
|
|
25
27
|
|
|
@@ -29,37 +31,38 @@ var _ArrowheadDown, _ArrowheadRight;
|
|
|
29
31
|
|
|
30
32
|
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; }
|
|
31
33
|
|
|
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[
|
|
33
|
-
const blockName =
|
|
34
|
+
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; }
|
|
35
|
+
const blockName = "".concat(blockNames.dataGridBlockName, "-expandable-column"); // todo: clean this when we move to css-js
|
|
34
36
|
|
|
35
37
|
const ExpandableColumnWrapper = dsClassnames.aggregatedClasses('div')(blockName);
|
|
36
38
|
const LabelDescriptionWrapper = dsClassnames.aggregatedClasses('div')(blockName, 'label-description-wrapper');
|
|
37
39
|
const Label = dsClassnames.aggregatedClasses('span')(blockName, 'label');
|
|
38
40
|
const Description = dsClassnames.aggregatedClasses('span')(blockName, 'description');
|
|
39
41
|
const ExtraColumnData = dsClassnames.aggregatedClasses('div')(blockName, 'extra-column-data');
|
|
40
|
-
const ExpandableMasterWrapper = dsClassnames.aggregatedClasses('div')(
|
|
41
|
-
const ExpandableDetailsWrapper = dsClassnames.aggregatedClasses('div')(
|
|
42
|
+
const ExpandableMasterWrapper = dsClassnames.aggregatedClasses('div')("".concat(blockName, "-master-wrapper"));
|
|
43
|
+
const ExpandableDetailsWrapper = dsClassnames.aggregatedClasses('div')("".concat(blockName, "-details-wrapper"));
|
|
42
44
|
|
|
43
|
-
function ExpandableColumnCell({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
function ExpandableColumnCell(_ref) {
|
|
46
|
+
let {
|
|
47
|
+
label,
|
|
48
|
+
description,
|
|
49
|
+
isExpanded,
|
|
50
|
+
expandableDetails,
|
|
51
|
+
extraData,
|
|
52
|
+
onToggleExpand
|
|
53
|
+
} = _ref;
|
|
51
54
|
const ref = React.useRef();
|
|
52
55
|
return /*#__PURE__*/jsxRuntime.jsxs(ExpandableColumnWrapper, {
|
|
53
56
|
ref: ref,
|
|
54
57
|
tabindex: 0,
|
|
55
|
-
children: [/*#__PURE__*/_jsx__default[
|
|
58
|
+
children: [/*#__PURE__*/_jsx__default["default"](ExpandableMasterWrapper, {
|
|
56
59
|
style: {
|
|
57
60
|
height: rowSizes.RowSizes.extend
|
|
58
61
|
}
|
|
59
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
62
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
60
63
|
buttonType: "text",
|
|
61
64
|
className: "expandable-arrow",
|
|
62
|
-
icon: isExpanded ? _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx__default[
|
|
65
|
+
icon: isExpanded ? _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadDown, {})) : _ArrowheadRight || (_ArrowheadRight = /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadRight, {})),
|
|
63
66
|
onClick: e => {
|
|
64
67
|
onToggleExpand(e);
|
|
65
68
|
|
|
@@ -68,52 +71,56 @@ function ExpandableColumnCell({
|
|
|
68
71
|
}
|
|
69
72
|
},
|
|
70
73
|
size: "s"
|
|
71
|
-
}), /*#__PURE__*/_jsx__default[
|
|
74
|
+
}), /*#__PURE__*/_jsx__default["default"](LabelDescriptionWrapper, {}, void 0, /*#__PURE__*/_jsx__default["default"](Label, {}, void 0, /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText__default["default"], {
|
|
72
75
|
value: label
|
|
73
|
-
})), /*#__PURE__*/_jsx__default[
|
|
76
|
+
})), /*#__PURE__*/_jsx__default["default"](Description, {}, void 0, /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText__default["default"], {
|
|
74
77
|
value: description
|
|
75
|
-
}))), /*#__PURE__*/_jsx__default[
|
|
78
|
+
}))), /*#__PURE__*/_jsx__default["default"](ExtraColumnData, {}, void 0, extraData)), isExpanded && /*#__PURE__*/_jsx__default["default"](ExpandableDetailsWrapper, {}, void 0, expandableDetails)]
|
|
76
79
|
});
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
const expandableColumnRenderer =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
description: renderRowDescription({
|
|
100
|
-
rowData
|
|
101
|
-
}),
|
|
102
|
-
expandableDetails: expandableDetails,
|
|
103
|
-
extraData: renderExtraData({
|
|
104
|
-
rowData
|
|
105
|
-
}),
|
|
106
|
-
isExpanded: isExpanded,
|
|
107
|
-
label: renderRowLabel({
|
|
82
|
+
const expandableColumnRenderer = _ref2 => {
|
|
83
|
+
let {
|
|
84
|
+
renderRowLabel,
|
|
85
|
+
renderRowDescription,
|
|
86
|
+
renderExtraData
|
|
87
|
+
} = _ref2;
|
|
88
|
+
return (value, _ref3, grid) => {
|
|
89
|
+
let {
|
|
90
|
+
rowData,
|
|
91
|
+
isExpanded
|
|
92
|
+
} = _ref3;
|
|
93
|
+
const {
|
|
94
|
+
props: {
|
|
95
|
+
renderExpandedDetails
|
|
96
|
+
},
|
|
97
|
+
actions: {
|
|
98
|
+
toggleExpand
|
|
99
|
+
}
|
|
100
|
+
} = grid.getInstance();
|
|
101
|
+
const expandableDetails = renderExpandedDetails({
|
|
108
102
|
rowData
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
|
|
103
|
+
});
|
|
104
|
+
return /*#__PURE__*/_jsx__default["default"](ExpandableColumnCell, {
|
|
105
|
+
description: renderRowDescription({
|
|
106
|
+
rowData
|
|
107
|
+
}),
|
|
108
|
+
expandableDetails: expandableDetails,
|
|
109
|
+
extraData: renderExtraData({
|
|
110
|
+
rowData
|
|
111
|
+
}),
|
|
112
|
+
isExpanded: isExpanded,
|
|
113
|
+
label: renderRowLabel({
|
|
114
|
+
rowData
|
|
115
|
+
}),
|
|
116
|
+
onToggleExpand: () => toggleExpand(rowData)
|
|
117
|
+
});
|
|
118
|
+
};
|
|
112
119
|
};
|
|
113
120
|
|
|
114
121
|
const noop = () => null;
|
|
115
122
|
|
|
116
|
-
function createExpandableColumn(
|
|
123
|
+
function createExpandableColumn(_ref4) {
|
|
117
124
|
let {
|
|
118
125
|
property,
|
|
119
126
|
label,
|
|
@@ -125,8 +132,8 @@ function createExpandableColumn(_ref) {
|
|
|
125
132
|
sortable,
|
|
126
133
|
searchable,
|
|
127
134
|
customRenderer
|
|
128
|
-
} =
|
|
129
|
-
rest = _objectWithoutProperties__default[
|
|
135
|
+
} = _ref4,
|
|
136
|
+
rest = _objectWithoutProperties__default["default"](_ref4, _excluded);
|
|
130
137
|
|
|
131
138
|
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
132
139
|
label,
|
|
@@ -5,12 +5,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
6
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
7
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.some.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.some.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
13
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
14
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
15
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
16
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
17
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
18
|
var React = require('react');
|
|
9
|
-
var
|
|
19
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
10
20
|
var reactWindow = require('react-window');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var DSButton = require('@elliemae/ds-basic/Button');
|
|
21
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
22
|
+
var DSButton = require('@elliemae/ds-button');
|
|
14
23
|
var createInstancePlugin = require('@elliemae/ds-shared/createDataInstance/createInstancePlugin');
|
|
15
24
|
var initColumnDefinition = require('@elliemae/ds-shared/useDataGrid/initColumnDefinition');
|
|
16
25
|
var ExpandedRow = require('./ExpandedRow.js');
|
|
@@ -24,8 +33,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
24
33
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
25
34
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
26
35
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
27
|
-
var ArrowheadDown__default = /*#__PURE__*/_interopDefaultLegacy(ArrowheadDown);
|
|
28
|
-
var ArrowheadRight__default = /*#__PURE__*/_interopDefaultLegacy(ArrowheadRight);
|
|
29
36
|
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
30
37
|
var createInstancePlugin__default = /*#__PURE__*/_interopDefaultLegacy(createInstancePlugin);
|
|
31
38
|
|
|
@@ -35,14 +42,17 @@ var _ArrowheadDown, _ArrowheadRight;
|
|
|
35
42
|
|
|
36
43
|
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; }
|
|
37
44
|
|
|
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[
|
|
45
|
+
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; }
|
|
39
46
|
|
|
40
|
-
const getExpandedRowSizeBySubrows =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
const getExpandedRowSizeBySubrows = _ref => {
|
|
48
|
+
let {
|
|
49
|
+
totalAmount,
|
|
50
|
+
amountVisible,
|
|
51
|
+
isShowingAll,
|
|
52
|
+
size = 36
|
|
53
|
+
} = _ref;
|
|
54
|
+
return isShowingAll ? size * (totalAmount + 1) - 6 : size * (amountVisible + 1) + 32;
|
|
55
|
+
};
|
|
46
56
|
|
|
47
57
|
const ExpandedRows = {
|
|
48
58
|
SingleColumn: ExpandedRow,
|
|
@@ -53,7 +63,7 @@ const createExpandedRow = type => ExpandedRows[type] || ExpandedRows.Master;
|
|
|
53
63
|
|
|
54
64
|
const isExpandableSingleColumn = columns => columns.some(column => column.expandableColumn);
|
|
55
65
|
|
|
56
|
-
const ExpandablePlugin = createInstancePlugin__default[
|
|
66
|
+
const ExpandablePlugin = createInstancePlugin__default["default"]('expandable', {
|
|
57
67
|
registerStateHook: useExpandGridState.useExpandGridState,
|
|
58
68
|
|
|
59
69
|
decorateGrid(grid) {
|
|
@@ -75,10 +85,11 @@ const ExpandablePlugin = createInstancePlugin__default['default']('expandable',
|
|
|
75
85
|
const firstColumnIndex = columns.findIndex(column => column.isUserColumn);
|
|
76
86
|
const firstColumn = columns[firstColumnIndex];
|
|
77
87
|
firstColumn.formatExpandable = true;
|
|
78
|
-
return [...columns.slice(0, firstColumnIndex), initColumnDefinition.appendCellFormatter((value, {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
88
|
+
return [...columns.slice(0, firstColumnIndex), initColumnDefinition.appendCellFormatter((value, _ref2) => {
|
|
89
|
+
let {
|
|
90
|
+
isExpanded,
|
|
91
|
+
rowData
|
|
92
|
+
} = _ref2;
|
|
82
93
|
const {
|
|
83
94
|
actions: {
|
|
84
95
|
toggleExpand
|
|
@@ -90,10 +101,10 @@ const ExpandablePlugin = createInstancePlugin__default['default']('expandable',
|
|
|
90
101
|
*/
|
|
91
102
|
|
|
92
103
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
93
|
-
children: [/*#__PURE__*/_jsx__default[
|
|
104
|
+
children: [/*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
94
105
|
buttonType: "text",
|
|
95
106
|
className: "expandable-arrow",
|
|
96
|
-
icon: isExpanded ? _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx__default[
|
|
107
|
+
icon: isExpanded ? _ArrowheadDown || (_ArrowheadDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadDown, {})) : _ArrowheadRight || (_ArrowheadRight = /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadRight, {})),
|
|
97
108
|
onClick: e => {
|
|
98
109
|
e.stopPropagation();
|
|
99
110
|
toggleExpand(rowData);
|
|
@@ -142,13 +153,13 @@ const ExpandablePlugin = createInstancePlugin__default['default']('expandable',
|
|
|
142
153
|
isShowingAll: children.length < expandableSubrowsVisible || expandedRows[key] && expandedRows[key].showAllRows,
|
|
143
154
|
size: subrowSizePx
|
|
144
155
|
});
|
|
145
|
-
const expandedMinSize =
|
|
156
|
+
const expandedMinSize = dsUtilities.isFunction(getExpandedRowMinSize) && getExpandedRowMinSize(index); // eslint-disable-next-line no-nested-ternary
|
|
146
157
|
|
|
147
158
|
return expandedRows[key] ? expandedMinSize > expandedSize ? expandedMinSize : expandedSize : rowSizePx;
|
|
148
159
|
};
|
|
149
160
|
|
|
150
161
|
return _objectSpread(_objectSpread({}, bodyProps), {}, {
|
|
151
|
-
className:
|
|
162
|
+
className: dsUtilities.cx(bodyProps.className, 'expandable'),
|
|
152
163
|
listComponent: reactWindow.VariableSizeList,
|
|
153
164
|
listProps: {
|
|
154
165
|
ref: listRef,
|
|
@@ -166,11 +177,11 @@ const ExpandablePlugin = createInstancePlugin__default['default']('expandable',
|
|
|
166
177
|
const expandedRowType = isExpandableSingleColumn(grid.decoratedColumns) ? 'SingleColumn' : 'Master';
|
|
167
178
|
const ExpandedRowComponent = createExpandedRow(expandedRowType); // eslint-disable-next-line react/display-name
|
|
168
179
|
|
|
169
|
-
return
|
|
180
|
+
return _ref3 => {
|
|
170
181
|
let {
|
|
171
182
|
isExpanded
|
|
172
|
-
} =
|
|
173
|
-
rowProps = _objectWithoutProperties__default[
|
|
183
|
+
} = _ref3,
|
|
184
|
+
rowProps = _objectWithoutProperties__default["default"](_ref3, _excluded);
|
|
174
185
|
|
|
175
186
|
if (isExpanded) {
|
|
176
187
|
const {
|
|
@@ -183,7 +194,7 @@ const ExpandablePlugin = createInstancePlugin__default['default']('expandable',
|
|
|
183
194
|
} = grid.getInstance(); // https://jira.elliemae.io/browse/PUI-1667
|
|
184
195
|
|
|
185
196
|
const rowData = composedRows[rowProps.index] ? composedRows[rowProps.index] : rowProps.rowData;
|
|
186
|
-
return /*#__PURE__*/_jsx__default[
|
|
197
|
+
return /*#__PURE__*/_jsx__default["default"](ExpandedRowComponent, {
|
|
187
198
|
cellComponent: Cell,
|
|
188
199
|
detailColumns: detailColumns,
|
|
189
200
|
parentGrid: grid,
|
|
@@ -206,9 +217,10 @@ const ExpandablePlugin = createInstancePlugin__default['default']('expandable',
|
|
|
206
217
|
return renderers;
|
|
207
218
|
},
|
|
208
219
|
|
|
209
|
-
getRowProps(rowProps, grid, {
|
|
210
|
-
|
|
211
|
-
|
|
220
|
+
getRowProps(rowProps, grid, _ref4) {
|
|
221
|
+
let {
|
|
222
|
+
rowData
|
|
223
|
+
} = _ref4;
|
|
212
224
|
const {
|
|
213
225
|
props: {
|
|
214
226
|
rowKey
|
|
@@ -220,7 +232,7 @@ const ExpandablePlugin = createInstancePlugin__default['default']('expandable',
|
|
|
220
232
|
const key = rowData[rowKey];
|
|
221
233
|
const isExpanded = !!expandedRows[key];
|
|
222
234
|
return _objectSpread(_objectSpread({}, rowProps), {}, {
|
|
223
|
-
className:
|
|
235
|
+
className: dsUtilities.cx(rowProps.className, Object.keys(expandedRows).length > 0 && 'expandable-row', isExpanded && 'expanded'),
|
|
224
236
|
isExpanded,
|
|
225
237
|
showAllRows: expandedRows[key] && expandedRows[key].showAllRows
|
|
226
238
|
});
|