@reltio/components 1.4.1571 → 1.4.1573
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/components/BasicTableView/BasicTable/BasicTable.js +14 -3
- package/cjs/components/BasicTableView/BasicTable/CellRenderer/CellRenderer.d.ts +3 -3
- package/cjs/components/BasicTableView/BasicTable/CellRenderer/CellRenderer.js +4 -3
- package/cjs/components/BasicTableView/BasicTable/helpers/dataHelpers.d.ts +1 -1
- package/cjs/components/BasicTableView/BasicTable/helpers/dataHelpers.js +6 -4
- package/cjs/components/BasicTableView/BasicTable/hooks/useBasicTableCellRenderer.d.ts +12 -16
- package/cjs/components/BasicTableView/BasicTable/hooks/useBasicTableCellRenderer.js +9 -8
- package/cjs/components/BasicTableView/BasicTable/hooks/useCollapsibleTableRows.d.ts +3 -2
- package/cjs/components/BasicTableView/BasicTable/hooks/useCollapsibleTableRows.js +2 -2
- package/cjs/components/BasicTableView/BasicTable/hooks/useDynamicRowCellHeight.d.ts +9 -2
- package/cjs/components/BasicTableView/BasicTable/hooks/useDynamicRowCellHeight.js +3 -2
- package/cjs/components/BasicTableView/RowCellAutoSizer/RowCellAutoSizer.d.ts +2 -1
- package/cjs/components/BasicTableView/RowCellAutoSizer/RowCellAutoSizer.js +1 -1
- package/cjs/components/BasicTableView/types/index.d.ts +10 -7
- package/cjs/components/crosswalks/AttributesTable/AttributesTable.js +12 -5
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/AttributeValuesRenderer.d.ts +3 -7
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/CommonRowCellRenderer.d.ts +12 -0
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/CommonRowCellRenderer.js +41 -0
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/OvValuesRenderer.d.ts +6 -7
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/OvValuesRenderer.js +6 -3
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/RowCellRenderer.d.ts +7 -10
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/RowCellRenderer.js +3 -2
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/RuleTypeRenderer.d.ts +2 -7
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/WinnerSourcesRenderer.d.ts +2 -4
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/styles.d.ts +1 -1
- package/cjs/components/crosswalks/AttributesTable/cell-renderers/styles.js +17 -1
- package/cjs/components/crosswalks/AttributesTable/helpers.d.ts +5 -10
- package/cjs/components/crosswalks/types/AttributesTableData.d.ts +50 -0
- package/cjs/components/crosswalks/types/AttributesTableData.js +2 -0
- package/cjs/components/crosswalks/types/index.d.ts +1 -0
- package/esm/components/BasicTableView/BasicTable/BasicTable.js +15 -4
- package/esm/components/BasicTableView/BasicTable/CellRenderer/CellRenderer.d.ts +3 -3
- package/esm/components/BasicTableView/BasicTable/CellRenderer/CellRenderer.js +4 -3
- package/esm/components/BasicTableView/BasicTable/helpers/dataHelpers.d.ts +1 -1
- package/esm/components/BasicTableView/BasicTable/helpers/dataHelpers.js +7 -5
- package/esm/components/BasicTableView/BasicTable/hooks/useBasicTableCellRenderer.d.ts +12 -16
- package/esm/components/BasicTableView/BasicTable/hooks/useBasicTableCellRenderer.js +9 -8
- package/esm/components/BasicTableView/BasicTable/hooks/useCollapsibleTableRows.d.ts +3 -2
- package/esm/components/BasicTableView/BasicTable/hooks/useCollapsibleTableRows.js +2 -2
- package/esm/components/BasicTableView/BasicTable/hooks/useDynamicRowCellHeight.d.ts +9 -2
- package/esm/components/BasicTableView/BasicTable/hooks/useDynamicRowCellHeight.js +3 -2
- package/esm/components/BasicTableView/RowCellAutoSizer/RowCellAutoSizer.d.ts +2 -1
- package/esm/components/BasicTableView/RowCellAutoSizer/RowCellAutoSizer.js +1 -1
- package/esm/components/BasicTableView/types/index.d.ts +10 -7
- package/esm/components/crosswalks/AttributesTable/AttributesTable.js +14 -7
- package/esm/components/crosswalks/AttributesTable/cell-renderers/AttributeValuesRenderer.d.ts +3 -7
- package/esm/components/crosswalks/AttributesTable/cell-renderers/CommonRowCellRenderer.d.ts +12 -0
- package/esm/components/crosswalks/AttributesTable/cell-renderers/CommonRowCellRenderer.js +34 -0
- package/esm/components/crosswalks/AttributesTable/cell-renderers/OvValuesRenderer.d.ts +6 -7
- package/esm/components/crosswalks/AttributesTable/cell-renderers/OvValuesRenderer.js +6 -3
- package/esm/components/crosswalks/AttributesTable/cell-renderers/RowCellRenderer.d.ts +7 -10
- package/esm/components/crosswalks/AttributesTable/cell-renderers/RowCellRenderer.js +3 -2
- package/esm/components/crosswalks/AttributesTable/cell-renderers/RuleTypeRenderer.d.ts +2 -7
- package/esm/components/crosswalks/AttributesTable/cell-renderers/WinnerSourcesRenderer.d.ts +2 -4
- package/esm/components/crosswalks/AttributesTable/cell-renderers/styles.d.ts +1 -1
- package/esm/components/crosswalks/AttributesTable/cell-renderers/styles.js +17 -1
- package/esm/components/crosswalks/AttributesTable/helpers.d.ts +5 -10
- package/esm/components/crosswalks/types/AttributesTableData.d.ts +50 -0
- package/esm/components/crosswalks/types/AttributesTableData.js +1 -0
- package/esm/components/crosswalks/types/index.d.ts +1 -0
- package/package.json +4 -4
|
@@ -62,21 +62,32 @@ var RowCollapseContext_1 = require("./contexts/RowCollapseContext");
|
|
|
62
62
|
var ramda_1 = require("ramda");
|
|
63
63
|
var useCollapsibleTableRows_1 = __importDefault(require("./hooks/useCollapsibleTableRows"));
|
|
64
64
|
var BasicTable = (0, react_1.forwardRef)(function (_a, ref) {
|
|
65
|
-
var columnsData = _a.columnsData, rowsData = _a.rowsData, context = _a.context, sorting = _a.sorting, onSort = _a.onSort, _b = _a.renderRowCell, renderRowCell = _b === void 0 ? defaultRenderRowCell_1.default : _b, _c = _a.getRowCellHeight, getRowCellHeight = _c === void 0 ? defaultGetRowCellHeight_1.default : _c, filters = _a.filters, onFilter = _a.onFilter, headRowHeight = _a.headRowHeight, _d = _a.maxRowValuesCount, maxRowValuesCount = _d === void 0 ? Infinity : _d, autosizing = _a.autosizing, maxHeight = _a.maxHeight, otherProps = __rest(_a, ["columnsData", "rowsData", "context", "sorting", "onSort", "renderRowCell", "getRowCellHeight", "filters", "onFilter", "headRowHeight", "maxRowValuesCount", "autosizing", "maxHeight"]);
|
|
65
|
+
var columnsData = _a.columnsData, rowsData = _a.rowsData, context = _a.context, sorting = _a.sorting, onSort = _a.onSort, _b = _a.renderRowCell, renderRowCell = _b === void 0 ? defaultRenderRowCell_1.default : _b, _c = _a.getRowCellHeight, getRowCellHeight = _c === void 0 ? defaultGetRowCellHeight_1.default : _c, filters = _a.filters, onFilter = _a.onFilter, headRowHeight = _a.headRowHeight, _d = _a.maxRowValuesCount, maxRowValuesCount = _d === void 0 ? Infinity : _d, autosizing = _a.autosizing, maxHeight = _a.maxHeight, getIdFromRowValue = _a.getIdFromRowValue, otherProps = __rest(_a, ["columnsData", "rowsData", "context", "sorting", "onSort", "renderRowCell", "getRowCellHeight", "filters", "onFilter", "headRowHeight", "maxRowValuesCount", "autosizing", "maxHeight", "getIdFromRowValue"]);
|
|
66
66
|
var tableHeadData = (0, react_1.useMemo)(function () { return (0, dataHelpers_1.getTableHeadData)(columnsData, filters, onFilter); }, [columnsData, filters, onFilter]);
|
|
67
67
|
var _e = (0, useCollapsibleTableRows_1.default)({
|
|
68
68
|
rowsData: rowsData,
|
|
69
69
|
columnsData: columnsData,
|
|
70
70
|
renderRowCell: renderRowCell,
|
|
71
71
|
getRowCellHeight: getRowCellHeight,
|
|
72
|
-
maxRowValuesCount: maxRowValuesCount
|
|
72
|
+
maxRowValuesCount: maxRowValuesCount,
|
|
73
|
+
getIdFromRowValue: getIdFromRowValue
|
|
73
74
|
}), tableRowsData = _e.tableRowsData, collapseContextValue = _e.collapseContextValue;
|
|
75
|
+
var toggleRowCollapse = collapseContextValue.toggleRowCollapse, getIsRowCollapsed = collapseContextValue.getIsRowCollapsed;
|
|
76
|
+
var onStartDragRow = (0, react_1.useCallback)(function () {
|
|
77
|
+
setTimeout(function () {
|
|
78
|
+
tableRowsData.forEach(function (_, index) {
|
|
79
|
+
if (!getIsRowCollapsed(index)) {
|
|
80
|
+
toggleRowCollapse(index);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}, 0);
|
|
84
|
+
}, [getIsRowCollapsed, toggleRowCollapse, tableRowsData]);
|
|
74
85
|
if (!tableHeadData.length) {
|
|
75
86
|
return null;
|
|
76
87
|
}
|
|
77
88
|
return (react_1.default.createElement(RowCollapseContext_1.RowCollapseContext.Provider, { value: collapseContextValue },
|
|
78
89
|
react_1.default.createElement(TableContext_1.TableContext.Provider, { value: context },
|
|
79
|
-
react_1.default.createElement(Table_1.default, __assign({ autosizing: autosizing, maxHeight: maxHeight, defaultRowHeight: 48 }, otherProps, { fixHead: tableRowsData.length > 0, headData: tableHeadData, rowsData: tableRowsData, sortField: (0, ramda_1.prop)('field', sorting), sortOrder: (0, ramda_1.prop)('order', sorting), onSort: onSort, headRowHeight: filters ? headRowHeight + styles_1.COLUMN_FILTER_HEIGHT : headRowHeight, ref: ref })))));
|
|
90
|
+
react_1.default.createElement(Table_1.default, __assign({ autosizing: autosizing, maxHeight: maxHeight, defaultRowHeight: 48, onStartDragRow: onStartDragRow }, otherProps, { fixHead: tableRowsData.length > 0, headData: tableHeadData, rowsData: tableRowsData, sortField: (0, ramda_1.prop)('field', sorting), sortOrder: (0, ramda_1.prop)('order', sorting), onSort: onSort, headRowHeight: filters ? headRowHeight + styles_1.COLUMN_FILTER_HEIGHT : headRowHeight, ref: ref })))));
|
|
80
91
|
});
|
|
81
92
|
exports.BasicTableType = {
|
|
82
93
|
columnsData: prop_types_1.default.arrayOf(prop_types_2.ColumnDataType).isRequired,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CollapseContext, ColumnData, TableRowsData } from '../../types';
|
|
2
|
+
import { CollapseContext, ColumnData, RowId, TableRowsData } from '../../types';
|
|
3
3
|
type Props = {
|
|
4
4
|
columnId: string;
|
|
5
5
|
rowIndex: number;
|
|
6
6
|
collapseContextValue: CollapseContext;
|
|
7
|
-
getRowHeight: (
|
|
8
|
-
getHeightForSubRow: (
|
|
7
|
+
getRowHeight: (rowId: RowId) => number;
|
|
8
|
+
getHeightForSubRow: (rowId: RowId, columnIndex: number, subRowIndex: number) => number;
|
|
9
9
|
tableRowsData: TableRowsData;
|
|
10
10
|
columnsData: ColumnData[];
|
|
11
11
|
};
|
|
@@ -32,13 +32,14 @@ var RowCollapseContext_1 = require("../contexts/RowCollapseContext");
|
|
|
32
32
|
var tableUtils_1 = require("react-components/dist/Table/tableUtils");
|
|
33
33
|
var CellRenderer = function (_a) {
|
|
34
34
|
var columnId = _a.columnId, rowIndex = _a.rowIndex, collapseContextValue = _a.collapseContextValue, getRowHeight = _a.getRowHeight, tableRowsData = _a.tableRowsData, columnsData = _a.columnsData, getHeightForSubRow = _a.getHeightForSubRow, otherProps = __rest(_a, ["columnId", "rowIndex", "collapseContextValue", "getRowHeight", "tableRowsData", "columnsData", "getHeightForSubRow"]);
|
|
35
|
+
var rowData = tableRowsData[rowIndex];
|
|
35
36
|
return (react_1.default.createElement(RowCollapseContext_1.RowCollapseContext.Provider, { value: collapseContextValue },
|
|
36
|
-
react_1.default.createElement("div", __assign({}, otherProps, { style: { height: getRowHeight(
|
|
37
|
+
react_1.default.createElement("div", __assign({}, otherProps, { style: { height: getRowHeight(rowData === null || rowData === void 0 ? void 0 : rowData.id) } }), tableRowsData.length > 0 &&
|
|
37
38
|
(0, tableUtils_1.getCellContentFromRowsData)({
|
|
38
39
|
columnIndex: columnsData.findIndex((0, ramda_1.propEq)('id', columnId)),
|
|
39
40
|
headData: columnsData,
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
rowData: rowData,
|
|
42
|
+
id: rowData.id,
|
|
42
43
|
getHeightForSubRow: getHeightForSubRow
|
|
43
44
|
}))));
|
|
44
45
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function getTableRowsData(rowValues: any, columnsData: any, renderRowCell: any, getRowCellHeight: any, getRowMaxValuesCount?: any): any;
|
|
1
|
+
export function getTableRowsData(rowValues: any, columnsData: any, renderRowCell: any, getRowCellHeight: any, getRowMaxValuesCount?: any, getIdFromRowValue?: (_: any, rowIndex: any) => any): any;
|
|
2
2
|
export function getTableHeadData(columnsData: any, filters: any, onFilter: any): any;
|
|
3
3
|
export function getMaxRowValuesCount(columnsData: any, rowValue: any): any;
|
|
@@ -81,11 +81,13 @@ var applyValuesCountConstraint = function (maxValuesCount) {
|
|
|
81
81
|
values: (0, ramda_1.slice)(0, maxValuesCount)
|
|
82
82
|
})))));
|
|
83
83
|
};
|
|
84
|
-
var
|
|
84
|
+
var defaultGetIdFromRowValue = function (_, rowIndex) { return rowIndex; };
|
|
85
|
+
var getTableRowsData = function (rowValues, columnsData, renderRowCell, getRowCellHeight, getRowMaxValuesCount, getIdFromRowValue) {
|
|
85
86
|
if (getRowMaxValuesCount === void 0) { getRowMaxValuesCount = (0, ramda_1.always)(Infinity); }
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
if (getIdFromRowValue === void 0) { getIdFromRowValue = defaultGetIdFromRowValue; }
|
|
88
|
+
return rowValues.map(function (rowValue, rowIndex) {
|
|
89
|
+
return (0, ramda_1.pipe)(buildRowValues(rowValue), applyValuesCountConstraint(getRowMaxValuesCount(rowIndex)), calcRowSpans, calcHeights(columnsData, getRowCellHeight, rowIndex, rowValue), applyCellRenderer(columnsData, renderRowCell, rowIndex, rowValue), function (val) { return ({ data: val, id: getIdFromRowValue(rowValue, rowIndex) }); })(columnsData);
|
|
90
|
+
});
|
|
89
91
|
};
|
|
90
92
|
exports.getTableRowsData = getTableRowsData;
|
|
91
93
|
var getTableHeadData = function (columnsData, filters, onFilter) {
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}) => any;
|
|
9
|
-
getRowCellHeight?: ({ columnData, cell }: {
|
|
10
|
-
columnData: any;
|
|
11
|
-
cell: any;
|
|
12
|
-
}) => number;
|
|
1
|
+
import { ElementsRowsData, ColumnData, RowValue, RenderRowCell, GetRowCellHeight, RowId } from '../../types';
|
|
2
|
+
type Props = {
|
|
3
|
+
rowsData: ElementsRowsData;
|
|
4
|
+
columnsData: ColumnData[];
|
|
5
|
+
getIdFromRowValue?: (rowValue: RowValue, index?: number) => RowId;
|
|
6
|
+
renderRowCell?: RenderRowCell;
|
|
7
|
+
getRowCellHeight?: GetRowCellHeight;
|
|
13
8
|
defaultRowHeight?: number;
|
|
14
9
|
maxRowValuesCount?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
10
|
+
};
|
|
11
|
+
declare const useBasicTableCellRenderer: ({ rowsData, columnsData, getIdFromRowValue, renderRowCell, getRowCellHeight, defaultRowHeight, maxRowValuesCount }: Props) => {
|
|
12
|
+
getRowHeight: (rowId: RowId) => number;
|
|
17
13
|
collapseContextValue: {
|
|
18
14
|
maxRowValuesCount: number;
|
|
19
15
|
toggleRowCollapse: (rowIndex: number) => void;
|
|
20
16
|
getIsRowCollapsible: (rowValue: Record<string, unknown>) => boolean;
|
|
21
17
|
getIsRowCollapsed: (rowIndex: number) => boolean;
|
|
22
18
|
};
|
|
23
|
-
getHeightForSubRow: (
|
|
24
|
-
tableRowsData: import("
|
|
19
|
+
getHeightForSubRow: (rowId: RowId, columnIndex: number, subRowIndex: number) => any;
|
|
20
|
+
tableRowsData: import("../../types").TableRowsData;
|
|
25
21
|
};
|
|
26
22
|
export default useBasicTableCellRenderer;
|
|
@@ -10,25 +10,26 @@ var defaultGetRowCellHeight_1 = __importDefault(require("../helpers/defaultGetRo
|
|
|
10
10
|
var ramda_1 = require("ramda");
|
|
11
11
|
var useCollapsibleTableRows_1 = __importDefault(require("./useCollapsibleTableRows"));
|
|
12
12
|
var useBasicTableCellRenderer = function (_a) {
|
|
13
|
-
var rowsData = _a.rowsData, columnsData = _a.columnsData, _b = _a.renderRowCell, renderRowCell = _b === void 0 ? defaultRenderRowCell_1.default : _b, _c = _a.getRowCellHeight, getRowCellHeight = _c === void 0 ? defaultGetRowCellHeight_1.default : _c, _d = _a.defaultRowHeight, defaultRowHeight = _d === void 0 ? 48 : _d, _e = _a.maxRowValuesCount, maxRowValuesCount = _e === void 0 ? Infinity : _e;
|
|
13
|
+
var rowsData = _a.rowsData, columnsData = _a.columnsData, getIdFromRowValue = _a.getIdFromRowValue, _b = _a.renderRowCell, renderRowCell = _b === void 0 ? defaultRenderRowCell_1.default : _b, _c = _a.getRowCellHeight, getRowCellHeight = _c === void 0 ? defaultGetRowCellHeight_1.default : _c, _d = _a.defaultRowHeight, defaultRowHeight = _d === void 0 ? 48 : _d, _e = _a.maxRowValuesCount, maxRowValuesCount = _e === void 0 ? Infinity : _e;
|
|
14
14
|
var _f = (0, useCollapsibleTableRows_1.default)({
|
|
15
15
|
rowsData: rowsData,
|
|
16
16
|
columnsData: columnsData,
|
|
17
17
|
renderRowCell: renderRowCell,
|
|
18
18
|
getRowCellHeight: getRowCellHeight,
|
|
19
|
-
maxRowValuesCount: maxRowValuesCount
|
|
19
|
+
maxRowValuesCount: maxRowValuesCount,
|
|
20
|
+
getIdFromRowValue: getIdFromRowValue
|
|
20
21
|
}), tableRowsData = _f.tableRowsData, collapseContextValue = _f.collapseContextValue;
|
|
21
22
|
return (0, react_1.useMemo)(function () {
|
|
22
|
-
var rowHeightCache = tableRowsData.reduce(function (cache, rowData
|
|
23
|
-
var data = rowData.data;
|
|
24
|
-
cache[
|
|
23
|
+
var rowHeightCache = tableRowsData.reduce(function (cache, rowData) {
|
|
24
|
+
var data = rowData.data, id = rowData.id;
|
|
25
|
+
cache[id] = (0, tableUtils_1.calculateRowHeight)(data, defaultRowHeight);
|
|
25
26
|
return cache;
|
|
26
27
|
}, {});
|
|
27
|
-
var getHeightForSubRow = function (
|
|
28
|
-
var heightPath = [
|
|
28
|
+
var getHeightForSubRow = function (rowId, columnIndex, subRowIndex) {
|
|
29
|
+
var heightPath = [rowId, 'subRowHeight', columnIndex, subRowIndex, 'height'];
|
|
29
30
|
return (0, ramda_1.pathOr)(0, heightPath, rowHeightCache);
|
|
30
31
|
};
|
|
31
|
-
var getRowHeight = function (
|
|
32
|
+
var getRowHeight = function (rowId) { return (0, ramda_1.pathOr)(0, [rowId, 'height'], rowHeightCache); };
|
|
32
33
|
return { getRowHeight: getRowHeight, collapseContextValue: collapseContextValue, getHeightForSubRow: getHeightForSubRow, tableRowsData: tableRowsData };
|
|
33
34
|
}, [tableRowsData, defaultRowHeight, collapseContextValue]);
|
|
34
35
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { ColumnData, ElementsRowsData, GetRowCellHeight, RenderRowCell, TableRowsData } from '../../types';
|
|
1
|
+
import { ColumnData, ElementsRowsData, GetRowCellHeight, RenderRowCell, RowValue, TableRowsData, RowId } from '../../types';
|
|
2
2
|
type Props = {
|
|
3
3
|
rowsData: ElementsRowsData;
|
|
4
4
|
columnsData: ColumnData[];
|
|
5
5
|
renderRowCell: RenderRowCell;
|
|
6
6
|
getRowCellHeight: GetRowCellHeight;
|
|
7
7
|
maxRowValuesCount: number;
|
|
8
|
+
getIdFromRowValue?: (rowValue: RowValue, rowIndex: number) => RowId;
|
|
8
9
|
};
|
|
9
|
-
declare const useCollapsibleTableRows: ({ rowsData, columnsData, renderRowCell, getRowCellHeight, maxRowValuesCount }: Props) => {
|
|
10
|
+
declare const useCollapsibleTableRows: ({ rowsData, columnsData, renderRowCell, getRowCellHeight, maxRowValuesCount, getIdFromRowValue }: Props) => {
|
|
10
11
|
tableRowsData: TableRowsData;
|
|
11
12
|
collapseContextValue: {
|
|
12
13
|
maxRowValuesCount: number;
|
|
@@ -5,12 +5,12 @@ var ramda_1 = require("ramda");
|
|
|
5
5
|
var dataHelpers_1 = require("../helpers/dataHelpers");
|
|
6
6
|
var hooks_1 = require("../../../../hooks");
|
|
7
7
|
var useCollapsibleTableRows = function (_a) {
|
|
8
|
-
var rowsData = _a.rowsData, columnsData = _a.columnsData, renderRowCell = _a.renderRowCell, getRowCellHeight = _a.getRowCellHeight, maxRowValuesCount = _a.maxRowValuesCount;
|
|
8
|
+
var rowsData = _a.rowsData, columnsData = _a.columnsData, renderRowCell = _a.renderRowCell, getRowCellHeight = _a.getRowCellHeight, maxRowValuesCount = _a.maxRowValuesCount, getIdFromRowValue = _a.getIdFromRowValue;
|
|
9
9
|
var _b = (0, react_1.useState)([]), expandedIndexes = _b[0], setExpandedIndexes = _b[1];
|
|
10
10
|
var getRowMaxValuesCount = (0, react_1.useCallback)(function (rowIndex) {
|
|
11
11
|
return expandedIndexes.includes(rowIndex) ? Infinity : maxRowValuesCount;
|
|
12
12
|
}, [expandedIndexes, maxRowValuesCount]);
|
|
13
|
-
var tableRowsData = (0, react_1.useMemo)(function () { return (0, dataHelpers_1.getTableRowsData)(rowsData, columnsData, renderRowCell, getRowCellHeight, getRowMaxValuesCount); }, [rowsData, columnsData, renderRowCell, getRowCellHeight, getRowMaxValuesCount]);
|
|
13
|
+
var tableRowsData = (0, react_1.useMemo)(function () { return (0, dataHelpers_1.getTableRowsData)(rowsData, columnsData, renderRowCell, getRowCellHeight, getRowMaxValuesCount, getIdFromRowValue); }, [rowsData, columnsData, renderRowCell, getRowCellHeight, getRowMaxValuesCount, getIdFromRowValue]);
|
|
14
14
|
var toggleRowCollapse = (0, react_1.useCallback)(function (rowIndex) {
|
|
15
15
|
setExpandedIndexes(function (expandedIndexes) {
|
|
16
16
|
var index = expandedIndexes.findIndex((0, ramda_1.equals)(rowIndex));
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ColumnData, RowValue } from '../../types';
|
|
2
|
+
type GetRowCellKeyProps = {
|
|
3
|
+
rowIndex: number;
|
|
4
|
+
cellIndex: number;
|
|
5
|
+
columnData: ColumnData;
|
|
6
|
+
rowValue: RowValue;
|
|
7
|
+
};
|
|
8
|
+
declare const useDynamicRowCellHeight: (getRowCellKey?: ({ rowIndex, columnData: { id }, cellIndex }: GetRowCellKeyProps) => string) => {
|
|
3
9
|
getDynamicRowCellHeight: any;
|
|
4
10
|
changeRowCellHeight: any;
|
|
5
11
|
clearHeightsCache: () => void;
|
|
6
12
|
};
|
|
13
|
+
export default useDynamicRowCellHeight;
|
|
@@ -14,11 +14,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
var react_1 = require("react");
|
|
15
15
|
var ramda_1 = require("ramda");
|
|
16
16
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
17
|
-
var
|
|
17
|
+
var defaultGetRowCellKey = function (_a) {
|
|
18
18
|
var rowIndex = _a.rowIndex, id = _a.columnData.id, cellIndex = _a.cellIndex;
|
|
19
19
|
return "".concat(id, "[").concat(rowIndex, "][").concat(cellIndex, "]");
|
|
20
20
|
};
|
|
21
|
-
var useDynamicRowCellHeight = function () {
|
|
21
|
+
var useDynamicRowCellHeight = function (getRowCellKey) {
|
|
22
|
+
if (getRowCellKey === void 0) { getRowCellKey = defaultGetRowCellKey; }
|
|
22
23
|
var _a = (0, react_1.useState)({}), rowCellHeightsMap = _a[0], setRowCellHeightsMap = _a[1];
|
|
23
24
|
var rowCellHeightsMapCache = (0, react_1.useRef)({});
|
|
24
25
|
var batchHeightUpdate = function (key, value) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ColumnData, RenderRowCellProps } from '../types';
|
|
2
|
+
import { ColumnData, RenderRowCellProps, RowValue } from '../types';
|
|
3
3
|
type OnChangeHeightProps = {
|
|
4
4
|
rowIndex: number;
|
|
5
5
|
cellIndex: number;
|
|
6
6
|
columnData: ColumnData;
|
|
7
|
+
rowValue: RowValue;
|
|
7
8
|
};
|
|
8
9
|
type Props = {
|
|
9
10
|
onChangeHeight: (props: OnChangeHeightProps) => (size: number) => void;
|
|
@@ -44,7 +44,7 @@ var RowCellAutoSizer = function (_a) {
|
|
|
44
44
|
var onChangeHeight = _a.onChangeHeight, cell = _a.children, cellProps = __rest(_a, ["onChangeHeight", "children"]);
|
|
45
45
|
var cellRef = (0, react_1.useRef)();
|
|
46
46
|
var rowValue = cellProps.rowValue, rowIndex = cellProps.rowIndex, columnData = cellProps.columnData, cellIndex = cellProps.cellIndex;
|
|
47
|
-
var changeCellHeight = onChangeHeight({ rowIndex: rowIndex, cellIndex: cellIndex, columnData: columnData });
|
|
47
|
+
var changeCellHeight = onChangeHeight({ rowIndex: rowIndex, cellIndex: cellIndex, columnData: columnData, rowValue: rowValue });
|
|
48
48
|
var adjustCellHeight = function () { return cellRef.current && changeCellHeight(cellRef.current.clientHeight); };
|
|
49
49
|
(0, hooks_1.useDidUpdateEffect)(adjustCellHeight, [rowValue.rawValue]);
|
|
50
50
|
return (react_1.default.createElement("div", { ref: cellRef },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { DataTypeDefinition } from '@reltio/mdm-sdk';
|
|
3
3
|
import useCollapsibleTableRows from '../BasicTable/hooks/useCollapsibleTableRows';
|
|
4
4
|
export type Sorting = {
|
|
@@ -33,6 +33,7 @@ export type ColumnData = {
|
|
|
33
33
|
[key: string]: unknown;
|
|
34
34
|
};
|
|
35
35
|
export type CollapseContext = ReturnType<typeof useCollapsibleTableRows>['collapseContextValue'];
|
|
36
|
+
export type RowId = string | number;
|
|
36
37
|
export type RowValue = {
|
|
37
38
|
rawValue: unknown;
|
|
38
39
|
[key: string]: unknown;
|
|
@@ -46,18 +47,20 @@ export type TableRowsData = Array<{
|
|
|
46
47
|
rowSpan?: number;
|
|
47
48
|
values: React.ReactNode;
|
|
48
49
|
}[]>;
|
|
50
|
+
id?: RowId;
|
|
49
51
|
}>;
|
|
52
|
+
type RowCell = {
|
|
53
|
+
values: unknown[];
|
|
54
|
+
rowSpan: number;
|
|
55
|
+
height: number;
|
|
56
|
+
};
|
|
50
57
|
type GetRowCellHeightArg = {
|
|
51
58
|
columnIndex: number;
|
|
52
59
|
columnData: ColumnData;
|
|
53
60
|
rowIndex: number;
|
|
54
61
|
rowValue: RowValue;
|
|
55
62
|
cellIndex: number;
|
|
56
|
-
cell:
|
|
57
|
-
values: unknown[];
|
|
58
|
-
rowSpan: number;
|
|
59
|
-
height: number;
|
|
60
|
-
};
|
|
63
|
+
cell: RowCell;
|
|
61
64
|
};
|
|
62
65
|
export type GetRowCellHeight = ({ columnIndex, columnData, rowIndex, rowValue, cellIndex, cell }: GetRowCellHeightArg) => number;
|
|
63
66
|
export type RenderRowCellProps = {
|
|
@@ -66,7 +69,7 @@ export type RenderRowCellProps = {
|
|
|
66
69
|
rowIndex: number;
|
|
67
70
|
rowValue: RowValue;
|
|
68
71
|
cellIndex: number;
|
|
69
|
-
cell:
|
|
72
|
+
cell: RowCell;
|
|
70
73
|
CellValueRenderer: (props: unknown) => JSX.Element;
|
|
71
74
|
};
|
|
72
75
|
export type RenderRowCell = ({ columnIndex, columnData, rowIndex, rowValue, cellIndex, cell, CellValueRenderer }: RenderRowCellProps) => JSX.Element;
|
|
@@ -45,15 +45,20 @@ var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
|
|
|
45
45
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
46
46
|
var BasicTableView_1 = require("../../BasicTableView");
|
|
47
47
|
var BasicViewHeader_1 = __importDefault(require("../../BasicViewHeader/BasicViewHeader"));
|
|
48
|
+
var CommonRowCellRenderer_1 = require("./cell-renderers/CommonRowCellRenderer");
|
|
48
49
|
var helpers_1 = require("./helpers");
|
|
49
50
|
var ramda_1 = require("ramda");
|
|
50
|
-
var RowCellRenderer_1 = __importDefault(require("./cell-renderers/RowCellRenderer"));
|
|
51
51
|
var LinearLoadIndicator_1 = __importDefault(require("../../LinearLoadIndicator/LinearLoadIndicator"));
|
|
52
52
|
var ConfirmDeleteDialog_1 = __importDefault(require("../../ConfirmDeleteDialog/ConfirmDeleteDialog"));
|
|
53
53
|
var ConfirmEditIgnoredDialog_1 = __importDefault(require("./ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog"));
|
|
54
54
|
var core_1 = require("../../../core");
|
|
55
55
|
var styles_1 = require("./styles");
|
|
56
56
|
var DEFAULT_ROW_HEIGHT = 68;
|
|
57
|
+
var getIdFromRowValue = function (rowValue) { return rowValue.ovValues.attributeType.uri; };
|
|
58
|
+
var getRowCellKey = function (_a) {
|
|
59
|
+
var id = _a.columnData.id, cellIndex = _a.cellIndex, rowValue = _a.rowValue;
|
|
60
|
+
return "".concat(id, "[").concat(getIdFromRowValue(rowValue), "][").concat(cellIndex, "]");
|
|
61
|
+
};
|
|
57
62
|
var AttributesTable = function (_a) {
|
|
58
63
|
var entity = _a.entity, isLoading = _a.isLoading, crosswalksMap = _a.crosswalksMap, _b = _a.visibleColumns, visibleColumns = _b === void 0 ? helpers_1.DEFAULT_VISIBLE_COLUMNS : _b, onChangeVisibleColumns = _a.onChangeVisibleColumns, readOnly = _a.readOnly, _c = _a.onDelete, onDelete = _c === void 0 ? core_1.noop : _c, _d = _a.onPin, onPin = _d === void 0 ? core_1.noop : _d, _e = _a.onIgnore, onIgnore = _e === void 0 ? core_1.noop : _e, _f = _a.onEdit, onEdit = _f === void 0 ? core_1.noop : _f, _g = _a.onAdd, onAdd = _g === void 0 ? core_1.noop : _g, selectedAttributeTypes = _a.selectedAttributeTypes, _h = _a.onSelectAttributeTypes, onSelectAttributeTypes = _h === void 0 ? core_1.noop : _h, additionalHeaderItems = _a.additionalHeaderItems, className = _a.className, activeSurvivorshipGroupUri = _a.activeSurvivorshipGroupUri;
|
|
59
64
|
var styles = (0, styles_1.useStyles)();
|
|
@@ -84,9 +89,8 @@ var AttributesTable = function (_a) {
|
|
|
84
89
|
crosswalksMap,
|
|
85
90
|
activeSurvivorshipGroupUri
|
|
86
91
|
]);
|
|
87
|
-
var _l = (0, BasicTableView_1.useDynamicRowCellHeight)(), getDynamicRowCellHeight = _l.getDynamicRowCellHeight, changeRowCellHeight = _l.changeRowCellHeight;
|
|
88
|
-
var renderRowCell = (0, react_1.useCallback)(function (props) { return
|
|
89
|
-
react_1.default.createElement(RowCellRenderer_1.default, __assign({}, props)))); }, [changeRowCellHeight]);
|
|
92
|
+
var _l = (0, BasicTableView_1.useDynamicRowCellHeight)(getRowCellKey), getDynamicRowCellHeight = _l.getDynamicRowCellHeight, changeRowCellHeight = _l.changeRowCellHeight;
|
|
93
|
+
var renderRowCell = (0, react_1.useCallback)(function (props) { return react_1.default.createElement(CommonRowCellRenderer_1.CommonRowCellRenderer, __assign({ changeRowCellHeight: changeRowCellHeight }, props)); }, [changeRowCellHeight]);
|
|
90
94
|
var getRowCellHeight = (0, react_1.useCallback)((0, ramda_1.either)(getDynamicRowCellHeight, (0, ramda_1.always)(DEFAULT_ROW_HEIGHT)), [
|
|
91
95
|
getDynamicRowCellHeight
|
|
92
96
|
]);
|
|
@@ -95,6 +99,9 @@ var AttributesTable = function (_a) {
|
|
|
95
99
|
var handleEdit = (0, react_1.useCallback)(function (event) {
|
|
96
100
|
event.attributeValue.ignored ? setPendingIgnoredEditing(event) : onEdit(event);
|
|
97
101
|
}, [onEdit, setPendingIgnoredEditing]);
|
|
102
|
+
var handleReorderAttributeTypes = (0, react_1.useCallback)(function (oldPosition, newPosition) {
|
|
103
|
+
onSelectAttributeTypes((0, ramda_1.move)(oldPosition, newPosition, selectedAttributeTypes));
|
|
104
|
+
}, [onSelectAttributeTypes, selectedAttributeTypes]);
|
|
98
105
|
var tableContext = (0, react_1.useMemo)(function () { return ({
|
|
99
106
|
onDelete: setPendingDeletion,
|
|
100
107
|
onPin: onPin,
|
|
@@ -124,7 +131,7 @@ var AttributesTable = function (_a) {
|
|
|
124
131
|
react_1.default.createElement(BasicTableView_1.ColumnsSettings, { columnsData: helpers_1.COLUMNS_DATA, selectedColumns: visibleColumns, onChangeColumns: onChangeVisibleColumns })),
|
|
125
132
|
react_1.default.createElement("div", { className: styles.tableContent },
|
|
126
133
|
isLoading && react_1.default.createElement(LinearLoadIndicator_1.default, null),
|
|
127
|
-
react_1.default.createElement(BasicTableView_1.BasicTable, { fixFirstColumn: true, headRowHeight: 48, defaultColumnWidth: 250, defaultColumnMinWidth: 200, columnsData: visibleColumnsData, rowsData: rowsData, renderRowCell: renderRowCell, getRowCellHeight: getRowCellHeight, context: tableContext })),
|
|
134
|
+
react_1.default.createElement(BasicTableView_1.BasicTable, { fixFirstColumn: true, headRowHeight: 48, defaultColumnWidth: 250, defaultColumnMinWidth: 200, columnsData: visibleColumnsData, dndRowReorderingEnabled: true, dndRowReorderingHandler: handleReorderAttributeTypes, getIdFromRowValue: getIdFromRowValue, rowsData: rowsData, renderRowCell: renderRowCell, getRowCellHeight: getRowCellHeight, context: tableContext })),
|
|
128
135
|
react_1.default.createElement(ConfirmDeleteDialog_1.default, { open: !!pendingDeletion, onClose: function () { return setPendingDeletion(null); }, onConfirm: function () { return onDelete(pendingDeletion); } }),
|
|
129
136
|
react_1.default.createElement(ConfirmEditIgnoredDialog_1.default, { open: !!pendingIgnoredEditing, onClose: function () { return setPendingIgnoredEditing(null); }, onConfirmEditWithIgnore: function () { return onEdit(pendingIgnoredEditing); }, onConfirmEditWithoutIgnore: function () {
|
|
130
137
|
onIgnore({ attributeValue: pendingIgnoredEditing.attributeValue });
|
package/cjs/components/crosswalks/AttributesTable/cell-renderers/AttributeValuesRenderer.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { AddInlineAttributeEvent, DeleteInlineAttributeEvent, EditInlineAttributeEvent, IgnoreInlineAttributeEvent, PinInlineAttributeEvent } from '../../../attributes/inline';
|
|
3
|
+
import { AttributeValues } from '../../types';
|
|
4
4
|
type Props = {
|
|
5
|
-
value:
|
|
6
|
-
attributeValues?: AttributeValue[];
|
|
7
|
-
attributeType: AttributeType;
|
|
8
|
-
crosswalksMap: CrosswalksMap;
|
|
9
|
-
};
|
|
5
|
+
value: AttributeValues;
|
|
10
6
|
onDelete: (event: DeleteInlineAttributeEvent) => void;
|
|
11
7
|
onEdit: (event: EditInlineAttributeEvent) => void;
|
|
12
8
|
onPin: (event: PinInlineAttributeEvent) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RowCellAutoSizer } from '../../../BasicTableView';
|
|
3
|
+
import { RowCellRendererProps } from '../../types';
|
|
4
|
+
type RowCellAutoSizerProps = React.ComponentProps<typeof RowCellAutoSizer>;
|
|
5
|
+
type Props = {
|
|
6
|
+
changeRowCellHeight: RowCellAutoSizerProps['onChangeHeight'];
|
|
7
|
+
someRowIsDragging?: boolean;
|
|
8
|
+
dragRef?: boolean;
|
|
9
|
+
isDragLayer?: boolean;
|
|
10
|
+
} & RowCellRendererProps;
|
|
11
|
+
export declare const CommonRowCellRenderer: ({ changeRowCellHeight, ...otherProps }: Props) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.CommonRowCellRenderer = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var RowCellRenderer_1 = __importDefault(require("./RowCellRenderer"));
|
|
31
|
+
// eslint-disable-next-line import/named
|
|
32
|
+
var BasicTableView_1 = require("../../../BasicTableView");
|
|
33
|
+
var CommonRowCellRenderer = function (_a) {
|
|
34
|
+
var changeRowCellHeight = _a.changeRowCellHeight, otherProps = __rest(_a, ["changeRowCellHeight"]);
|
|
35
|
+
if (otherProps.isDragLayer) {
|
|
36
|
+
return react_1.default.createElement(RowCellRenderer_1.default, __assign({}, otherProps, { someRowIsDragging: false }));
|
|
37
|
+
}
|
|
38
|
+
return (react_1.default.createElement(BasicTableView_1.RowCellAutoSizer, __assign({ onChangeHeight: changeRowCellHeight }, otherProps),
|
|
39
|
+
react_1.default.createElement(RowCellRenderer_1.default, __assign({}, otherProps))));
|
|
40
|
+
};
|
|
41
|
+
exports.CommonRowCellRenderer = CommonRowCellRenderer;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OvValues } from '../../types';
|
|
3
3
|
type Props = {
|
|
4
|
-
value:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
4
|
+
value: OvValues;
|
|
5
|
+
someRowIsDragging?: boolean;
|
|
6
|
+
dragRef?: React.Ref<HTMLDivElement>;
|
|
8
7
|
};
|
|
9
|
-
declare const OvValuesRenderer: ({ value: { values, attributeType } }: Props) => JSX.Element;
|
|
8
|
+
declare const OvValuesRenderer: ({ value: { values, attributeType }, someRowIsDragging, dragRef }: Props) => JSX.Element;
|
|
10
9
|
export default OvValuesRenderer;
|
|
@@ -4,14 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var react_1 = __importDefault(require("react"));
|
|
7
|
-
var
|
|
7
|
+
var DragIndicator_1 = __importDefault(require("@material-ui/icons/DragIndicator"));
|
|
8
8
|
var AttributeValuesBlock_1 = __importDefault(require("../../../attributes/readMode/AttributeValuesBlock/AttributeValuesBlock"));
|
|
9
|
+
var Title_1 = __importDefault(require("../../../Title/Title"));
|
|
9
10
|
var styles_1 = require("./styles");
|
|
10
11
|
var OvValuesRenderer = function (_a) {
|
|
11
|
-
var _b = _a.value, values = _b.values, attributeType = _b.attributeType;
|
|
12
|
+
var _b = _a.value, values = _b.values, attributeType = _b.attributeType, someRowIsDragging = _a.someRowIsDragging, dragRef = _a.dragRef;
|
|
12
13
|
var styles = (0, styles_1.useStyles)();
|
|
13
14
|
return (react_1.default.createElement("div", { className: styles.cellValueWrapper },
|
|
15
|
+
react_1.default.createElement("div", { ref: dragRef, className: styles.dragIndicator },
|
|
16
|
+
react_1.default.createElement(DragIndicator_1.default, { className: styles.dragIndicatorIcon })),
|
|
14
17
|
react_1.default.createElement(Title_1.default, { className: styles.attributeTitle, label: attributeType.label }),
|
|
15
|
-
react_1.default.createElement(AttributeValuesBlock_1.default, { values: values, attributeType: attributeType, valueContainerClassName: styles.ovValue })));
|
|
18
|
+
!someRowIsDragging && (react_1.default.createElement(AttributeValuesBlock_1.default, { values: values, attributeType: attributeType, valueContainerClassName: styles.ovValue }))));
|
|
16
19
|
};
|
|
17
20
|
exports.default = OvValuesRenderer;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { RowCellRendererProps } from '../../types';
|
|
3
3
|
type Props = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
columnIndex: number;
|
|
10
|
-
};
|
|
11
|
-
declare const RowCellRenderer: ({ cell, CellValueRenderer, columnIndex, columnData, ...otherProps }: Props) => JSX.Element;
|
|
4
|
+
someRowIsDragging?: boolean;
|
|
5
|
+
dragRef?: boolean;
|
|
6
|
+
isDragLayer?: boolean;
|
|
7
|
+
} & RowCellRendererProps;
|
|
8
|
+
declare const RowCellRenderer: ({ cell, CellValueRenderer, columnIndex, columnData, someRowIsDragging, ...otherProps }: Props) => JSX.Element;
|
|
12
9
|
export default RowCellRenderer;
|
|
@@ -29,9 +29,10 @@ var react_1 = __importDefault(require("react"));
|
|
|
29
29
|
var classnames_1 = __importDefault(require("classnames"));
|
|
30
30
|
var styles_1 = require("./styles");
|
|
31
31
|
var RowCellRenderer = function (_a) {
|
|
32
|
-
var cell = _a.cell, CellValueRenderer = _a.CellValueRenderer, columnIndex = _a.columnIndex, columnData = _a.columnData, otherProps = __rest(_a, ["cell", "CellValueRenderer", "columnIndex", "columnData"]);
|
|
32
|
+
var cell = _a.cell, CellValueRenderer = _a.CellValueRenderer, columnIndex = _a.columnIndex, columnData = _a.columnData, someRowIsDragging = _a.someRowIsDragging, otherProps = __rest(_a, ["cell", "CellValueRenderer", "columnIndex", "columnData", "someRowIsDragging"]);
|
|
33
33
|
var styles = (0, styles_1.useStyles)();
|
|
34
34
|
var isFirstColumn = columnIndex === 0;
|
|
35
|
-
|
|
35
|
+
var shouldRenderCell = !someRowIsDragging || isFirstColumn;
|
|
36
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.rowCell, isFirstColumn && styles.coloredCell), "data-reltio-id": "column-name-".concat(columnData.id) }, shouldRenderCell && (react_1.default.createElement(react_1.default.Fragment, null, cell.values.map(function (value, index) { return (react_1.default.createElement(CellValueRenderer, __assign({ key: index, value: value, someRowIsDragging: someRowIsDragging }, otherProps))); })))));
|
|
36
37
|
};
|
|
37
38
|
exports.default = RowCellRenderer;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { RuleTypeValues } from '../../types';
|
|
3
3
|
type Props = {
|
|
4
|
-
value:
|
|
5
|
-
ruleType: SurvivorStrategy;
|
|
6
|
-
sourcesUriOrder?: string[];
|
|
7
|
-
primaryAttributeUri?: string;
|
|
8
|
-
comparisonAttributeUri?: string;
|
|
9
|
-
};
|
|
4
|
+
value: RuleTypeValues;
|
|
10
5
|
};
|
|
11
6
|
declare const RuleTypeRenderer: ({ value: { ruleType, sourcesUriOrder, primaryAttributeUri, comparisonAttributeUri } }: Props) => JSX.Element;
|
|
12
7
|
export default RuleTypeRenderer;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { WinnerSources } from '../../types';
|
|
3
3
|
type Props = {
|
|
4
|
-
value:
|
|
5
|
-
crosswalks: CrosswalkBase[];
|
|
6
|
-
};
|
|
4
|
+
value: WinnerSources;
|
|
7
5
|
};
|
|
8
6
|
declare const WinnerSourcesRenderer: ({ value: { crosswalks } }: Props) => JSX.Element;
|
|
9
7
|
export default WinnerSourcesRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"count" | "popupTitle" | "closeButton" | "headCell" | "sourceIcon" | "coloredCell" | "rowCell" | "cellValueWrapper" | "attributeTitle" | "ovValue" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"count" | "popupTitle" | "closeButton" | "headCell" | "dragIndicator" | "dragIndicatorIcon" | "sourceIcon" | "ruleType" | "coloredCell" | "rowCell" | "cellValueWrapper" | "attributeTitle" | "ovValue" | "ruleTypeLabel" | "rulePopup" | "popupItem" | "popupTitleWrapper" | "popupItemsWrapper" | "winnerSourceItemWrapper" | "winnerSourceItem" | "winnerSourceItemLabel">;
|
|
@@ -27,10 +27,26 @@ exports.useStyles = (0, styles_1.makeStyles)(function (theme) { return ({
|
|
|
27
27
|
overflow: 'hidden'
|
|
28
28
|
},
|
|
29
29
|
cellValueWrapper: {
|
|
30
|
+
position: 'relative',
|
|
30
31
|
padding: '15px 15px 0 15px',
|
|
31
32
|
'&:last-child': {
|
|
32
33
|
paddingBottom: '15px'
|
|
33
|
-
}
|
|
34
|
+
},
|
|
35
|
+
'&:hover $dragIndicator': {
|
|
36
|
+
display: 'block'
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
dragIndicator: {
|
|
40
|
+
display: 'none',
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
top: '15px',
|
|
43
|
+
left: 0,
|
|
44
|
+
cursor: 'grab'
|
|
45
|
+
},
|
|
46
|
+
dragIndicatorIcon: {
|
|
47
|
+
fill: theme.palette.text.secondary,
|
|
48
|
+
width: '14px',
|
|
49
|
+
height: '14px'
|
|
34
50
|
},
|
|
35
51
|
attributeTitle: {
|
|
36
52
|
display: 'block',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AttributeType, AttributeValue, Metadata, RecordAttributesType
|
|
1
|
+
import { AttributeType, AttributeValue, Crosswalk, Metadata, RecordAttributesType } from '@reltio/mdm-sdk';
|
|
2
2
|
import { CrosswalksMap } from '../../attributes/inline';
|
|
3
|
-
import { CrosswalksByOwnerTypeMap } from '../types';
|
|
3
|
+
import { CrosswalksByOwnerTypeMap, AttributesTableRowValue, RuleTypeValues } from '../types';
|
|
4
4
|
export declare const COLUMNS_DATA: ({
|
|
5
5
|
id: string;
|
|
6
6
|
readonly label: string;
|
|
@@ -28,12 +28,7 @@ export declare const COLUMNS_DATA: ({
|
|
|
28
28
|
})[];
|
|
29
29
|
export declare const DEFAULT_VISIBLE_COLUMNS: string[];
|
|
30
30
|
export declare const countAttributeValues: (type: string, values: AttributeValue[], crosswalksMap: CrosswalksMap) => number;
|
|
31
|
-
export declare const getRuleTypeValues: (metadata: Metadata, attributeType: AttributeType, parentTypeUri: string, activeSurvivorshipGroupUri?: string) =>
|
|
32
|
-
|
|
33
|
-
sourcesUriOrder: any;
|
|
34
|
-
primaryAttributeUri: any;
|
|
35
|
-
comparisonAttributeUri: any;
|
|
36
|
-
};
|
|
37
|
-
export declare const getWinnerCrosswalks: (attributeValues: AttributeValue[], crosswalksMap: CrosswalksMap) => any;
|
|
31
|
+
export declare const getRuleTypeValues: (metadata: Metadata, attributeType: AttributeType, parentTypeUri: string, activeSurvivorshipGroupUri?: string) => RuleTypeValues;
|
|
32
|
+
export declare const getWinnerCrosswalks: (attributeValues: AttributeValue[], crosswalksMap: CrosswalksMap) => Crosswalk[];
|
|
38
33
|
export declare const getBasicTableColumnsData: any;
|
|
39
|
-
export declare const getBasicTableRowsData: (metadata: Metadata, parentTypeUri: string, attrTypes: AttributeType[], columns: string[], crosswalksMap: CrosswalksByOwnerTypeMap, attributes: RecordAttributesType, activeSurvivorshipGroupUri?: string) =>
|
|
34
|
+
export declare const getBasicTableRowsData: (metadata: Metadata, parentTypeUri: string, attrTypes: AttributeType[], columns: string[], crosswalksMap: CrosswalksByOwnerTypeMap, attributes: RecordAttributesType, activeSurvivorshipGroupUri?: string) => AttributesTableRowValue[];
|