pixel-react 1.21.32 → 1.21.33
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/README.md +75 -75
- package/lib/components/Charts/BarChart/BarChart.js +11 -11
- package/lib/components/Charts/BarChart/BarChart.js.map +1 -1
- package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.js +6 -6
- package/lib/components/Charts/IconRadialChart/IconRadialChart.js +4 -4
- package/lib/components/Charts/PieChart/PieChart.js +5 -5
- package/lib/components/Comments/Comments.js +14 -14
- package/lib/components/Comments/childComment/ChildComment.js +14 -14
- package/lib/components/EditTextField/EditTextField.js +2 -2
- package/lib/components/Icon/iconList.js +4 -0
- package/lib/components/Icon/iconList.js.map +1 -1
- package/lib/components/LabelEditTextField/LabelEditTextField.js +4 -4
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.js +2 -2
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.js.map +1 -1
- package/lib/components/StatusBadge/StatusBadge.js +1 -1
- package/lib/components/StatusIndicator/StatusIndicator.js +5 -5
- package/lib/components/Table/EditComponent.js +6 -6
- package/lib/components/Table/EditComponent.js.map +1 -1
- package/lib/components/Table/NoDataContent.js +1 -1
- package/lib/components/Table/NoDataContent.js.map +1 -1
- package/lib/components/Table/Table.js +78 -156
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Table/Types.d.ts +6 -11
- package/lib/components/Table/components/SortableRow.d.ts +1 -1
- package/lib/components/Table/components/SortableRow.js +69 -60
- package/lib/components/Table/components/SortableRow.js.map +1 -1
- package/lib/components/Table/components/TableHeader.js +15 -20
- package/lib/components/Table/components/TableHeader.js.map +1 -1
- package/lib/components/Table/components/VirtualizedRows.d.ts +1 -1
- package/lib/components/Table/components/VirtualizedRows.js +17 -32
- package/lib/components/Table/components/VirtualizedRows.js.map +1 -1
- package/lib/components/Table/utils/virtualization.d.ts +3 -10
- package/lib/components/Table/utils/virtualization.js +13 -40
- package/lib/components/Table/utils/virtualization.js.map +1 -1
- package/lib/components/TableWithAccordion/TableWithAccordion.js +13 -38
- package/lib/components/TableWithAccordion/TableWithAccordion.js.map +1 -1
- package/lib/components/TableWithAccordion/types.d.ts +2 -2
- package/lib/components/Weightagetable/Weightagetable.js +101 -14
- package/lib/components/Weightagetable/Weightagetable.js.map +1 -1
- package/lib/components/Weightagetable/types.d.ts +56 -7
- package/lib/index.d.ts +4 -6
- package/lib/index.js +8 -8
- package/lib/styles.css +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/TreeNavigateUtils/getNavigateToKey.d.ts +1 -1
- package/lib/utils/getTopVisibleNodeKey/getTopVisibleNodeKey.d.ts +1 -1
- package/lib/utils/getTreeDetails/getTreeDetails.d.ts +1 -1
- package/lib/utils/handleTreeExpandAllCollapseAll/handleTreeExpandAllCollapseAll.d.ts +1 -1
- package/lib/utils/handleTreeNodeExpandCollapse/handleTreeNodeExpandCollapse.d.ts +1 -1
- package/lib/utils/handleTreeNodeSelect/handleTreeNodeSelect.d.ts +1 -1
- package/lib/utils/toggleShowHideEntity/toggleShowHideEntity.d.ts +1 -1
- package/package.json +118 -118
- package/lib/components/Table/utils/TableCell.d.ts +0 -2
- package/lib/components/Table/utils/TableCell.js +0 -27
- package/lib/components/Table/utils/TableCell.js.map +0 -1
|
@@ -1,10 +1,52 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useId, useState } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
2
4
|
import './WeightageTable.scss';
|
|
3
5
|
import Icon from '../Icon';
|
|
4
6
|
import Input from '../Input';
|
|
5
7
|
import Typography from '../Typography';
|
|
6
8
|
import AutoTruncateText from '../AutoTruncateText';
|
|
7
|
-
|
|
9
|
+
import TooltipService from '../TooltipService';
|
|
10
|
+
const DEFAULT_COLUMN_LABELS = {
|
|
11
|
+
principle: 'Principle',
|
|
12
|
+
guidelines: 'Guidelines',
|
|
13
|
+
weightage: 'Weightage in %',
|
|
14
|
+
};
|
|
15
|
+
const MAX_WEIGHTAGE_VALUE = 100;
|
|
16
|
+
const getAccessibleText = (value) => {
|
|
17
|
+
if (value === null || value === undefined || typeof value === 'boolean') {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
21
|
+
return String(value);
|
|
22
|
+
}
|
|
23
|
+
if (Array.isArray(value)) {
|
|
24
|
+
return value.map(getAccessibleText).filter(Boolean).join(' ');
|
|
25
|
+
}
|
|
26
|
+
if (React.isValidElement(value)) {
|
|
27
|
+
return getAccessibleText(value.props.children);
|
|
28
|
+
}
|
|
29
|
+
return '';
|
|
30
|
+
};
|
|
31
|
+
const WeightageTable = ({ title = 'Success Criteria Weightage', totalWeightage, principleColumnLabel = DEFAULT_COLUMN_LABELS.principle, guidelinesColumnLabel = DEFAULT_COLUMN_LABELS.guidelines, weightageColumnLabel = DEFAULT_COLUMN_LABELS.weightage, columnLabels, groups = [], onWeightageChange = () => { }, renderWeightageCell, weightageInputWidth = '12%', onReset = () => { }, showResetIcon = true, disabled = false, minValue = 0, maxValue = 100, isAccordion = true, defaultExpanded = false, className = '', style, }) => {
|
|
32
|
+
const baseId = useId().replace(/:/g, '');
|
|
33
|
+
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
34
|
+
const titleId = `${baseId}-weightage-title`;
|
|
35
|
+
const contentId = `${baseId}-weightage-content`;
|
|
36
|
+
const totalGuidelineCount = groups.reduce((count, group) => count + group.guidelines.length, 0);
|
|
37
|
+
let nextBodyRowIndex = 2;
|
|
38
|
+
const groupStartRowIndexes = groups.map((group) => {
|
|
39
|
+
const startRowIndex = nextBodyRowIndex;
|
|
40
|
+
nextBodyRowIndex += group.guidelines.length;
|
|
41
|
+
return startRowIndex;
|
|
42
|
+
});
|
|
43
|
+
const resolvedColumnLabels = {
|
|
44
|
+
principle: columnLabels?.principle ?? principleColumnLabel,
|
|
45
|
+
guidelines: columnLabels?.guidelines ?? guidelinesColumnLabel,
|
|
46
|
+
weightage: columnLabels?.weightage ?? weightageColumnLabel,
|
|
47
|
+
};
|
|
48
|
+
const weightageColumnAccessibleLabel = getAccessibleText(resolvedColumnLabels.weightage) ||
|
|
49
|
+
DEFAULT_COLUMN_LABELS.weightage;
|
|
8
50
|
const computedTotal = totalWeightage ??
|
|
9
51
|
groups.reduce((sum, group) => sum +
|
|
10
52
|
group.guidelines.reduce((rowSum, row) => rowSum + (row.value || 0), 0), 0);
|
|
@@ -17,25 +59,70 @@ const WeightageTable = ({ title = 'Success Criteria Weightage', totalWeightage,
|
|
|
17
59
|
error = true;
|
|
18
60
|
helperText = `Value must be between ${rowMin} and ${rowMax}`;
|
|
19
61
|
}
|
|
20
|
-
|
|
62
|
+
updateWeightageRow(groupIndex, rowIndex, {
|
|
21
63
|
...row,
|
|
22
64
|
value: numericValue,
|
|
23
65
|
error,
|
|
24
66
|
helperText,
|
|
25
67
|
});
|
|
26
68
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
69
|
+
const updateWeightageRow = (groupIndex, rowIndex, updatedRow) => {
|
|
70
|
+
onWeightageChange(groupIndex, rowIndex, updatedRow);
|
|
71
|
+
};
|
|
72
|
+
const toggleAccordion = () => {
|
|
73
|
+
setIsExpanded((prev) => !prev);
|
|
74
|
+
};
|
|
75
|
+
const shouldShowContent = !isAccordion || isExpanded;
|
|
76
|
+
const renderDefaultWeightageCell = ({ groupIndex, rowIndex, row, minValue: rowMin, maxValue: rowMax, disabled: isCellDisabled, inputWidth, inputProps, }) => (_jsx("div", { className: "ff-weightage-input", style: { width: inputWidth }, children: _jsx(Input, { type: "number", noBorder // Experimental prop to remove border from input field
|
|
77
|
+
: true, value: row.value, minValue: rowMin, maxValue: rowMax, disabled: isCellDisabled, error: row.error, helperText: row.helperText, placeholder: "", variant: "primary", isLabelRequired: false, disableAfterMaxValueReached: true, size: "small", className: "ff-weightage-input-field", onChange: (event) => handleRowChange(groupIndex, rowIndex, row, rowMin, rowMax, event), setUpdatedNumberValue: (value) => updateWeightageRow(groupIndex, rowIndex, {
|
|
78
|
+
...row,
|
|
79
|
+
value,
|
|
80
|
+
}), ...inputProps }) }));
|
|
81
|
+
const getWeightageCellContent = (props) => renderWeightageCell
|
|
82
|
+
? renderWeightageCell(props)
|
|
83
|
+
: renderDefaultWeightageCell(props);
|
|
84
|
+
const renderHeaderCell = (cellClassName, label, columnIndex) => (_jsx("div", { className: cellClassName, role: "columnheader", "aria-colindex": columnIndex, children: _jsx(Typography, { fontWeight: "semi-bold", children: _jsx(AutoTruncateText, { children: label }) }) }));
|
|
85
|
+
const renderGuidelineRow = (group, groupIndex, groupKey, row, rowIndex, ariaRowIndex) => {
|
|
86
|
+
const rowKey = row.key ?? `${groupKey}-${row.label}`;
|
|
87
|
+
const rowConfiguredMax = row.maxValue ?? maxValue;
|
|
88
|
+
const rowMax = Math.min(rowConfiguredMax, MAX_WEIGHTAGE_VALUE);
|
|
89
|
+
const rowMin = Math.min(row.minValue ?? minValue, rowMax);
|
|
90
|
+
const isCellDisabled = disabled || !!row.disabled || !shouldShowContent;
|
|
91
|
+
const rowId = `${baseId}-weightage-row-${groupIndex}-${rowIndex}`;
|
|
92
|
+
const inputErrorId = row.error && row.helperText ? `${rowId}-error` : undefined;
|
|
93
|
+
const weightageCellProps = {
|
|
94
|
+
group,
|
|
95
|
+
row,
|
|
96
|
+
groupIndex,
|
|
97
|
+
rowIndex,
|
|
98
|
+
rowKey,
|
|
99
|
+
minValue: rowMin,
|
|
100
|
+
maxValue: rowMax,
|
|
101
|
+
disabled: isCellDisabled,
|
|
102
|
+
inputWidth: weightageInputWidth,
|
|
103
|
+
inputProps: {
|
|
104
|
+
id: `${rowId}-input`,
|
|
105
|
+
name: rowKey,
|
|
106
|
+
'aria-label': `${weightageColumnAccessibleLabel} for ${row.label} in ${group.principle}`,
|
|
107
|
+
'aria-describedby': inputErrorId,
|
|
108
|
+
'aria-errormessage': inputErrorId,
|
|
109
|
+
'aria-invalid': row.error || undefined,
|
|
110
|
+
},
|
|
111
|
+
onChange: (updatedRow) => updateWeightageRow(groupIndex, rowIndex, updatedRow),
|
|
112
|
+
};
|
|
113
|
+
return (_jsxs("div", { className: "ff-weightage-row", role: "row", "aria-rowindex": ariaRowIndex, children: [rowIndex === 0 && (_jsx("div", { className: "ff-weightage-principle", role: "rowheader", "aria-colindex": 1, "aria-rowspan": group.guidelines.length, style: {
|
|
114
|
+
gridRow: `span ${group.guidelines.length}`,
|
|
115
|
+
}, children: _jsx(Typography, { fontWeight: "medium", children: _jsx(AutoTruncateText, { children: group.principle }) }) })), _jsx("div", { className: "ff-weightage-guideline", role: "cell", "aria-colindex": 2, children: _jsx(Typography, { children: _jsx(AutoTruncateText, { className: "auto-truncate", children: row.label }) }) }), _jsx("div", { className: "ff-weightage-value", role: "cell", "aria-colindex": 3, children: getWeightageCellContent(weightageCellProps) })] }, rowKey));
|
|
116
|
+
};
|
|
117
|
+
const renderGroup = (group, groupIndex, startRowIndex) => {
|
|
118
|
+
const groupKey = group.key ?? group.principle;
|
|
119
|
+
return (_jsx("div", { className: "ff-weightage-group", role: "rowgroup", "aria-label": group.principle, children: group.guidelines.map((row, rowIndex) => renderGuidelineRow(group, groupIndex, groupKey, row, rowIndex, startRowIndex + rowIndex)) }, groupKey));
|
|
120
|
+
};
|
|
121
|
+
return (_jsxs("div", { className: classNames('ff-weightage-table', className), style: style, children: [_jsx(TooltipService, {}), _jsxs("div", { className: "ff-weightage-head", children: [_jsx("div", { className: "ff-weightage-title", id: titleId, children: _jsx(Typography, { fontWeight: "semi-bold", children: _jsx(AutoTruncateText, { children: title }) }) }), _jsxs("span", { className: "ff-weightage-total", children: [_jsx("span", { className: "ff-weightage-total-value", "aria-live": "polite", "aria-label": `Total weightage ${computedTotal}`, children: _jsx(Typography, { fontWeight: "semi-bold", children: _jsxs(AutoTruncateText, { children: ["Total Weightage : ", computedTotal] }) }) }), showResetIcon && (_jsx("button", { type: "button", className: "ff-weightage-icon-button", onClick: onReset, "aria-label": "Reset weightage values to default", "data-tooltip": "Reset to default value", children: _jsx(Icon, { name: "reset_default_value", withPadding: false }) })), isAccordion && (_jsx("button", { type: "button", className: "ff-weightage-icon-button", onClick: toggleAccordion, "aria-label": isExpanded
|
|
122
|
+
? 'Collapse weightage table'
|
|
123
|
+
: 'Expand weightage table', "aria-expanded": shouldShowContent, "aria-controls": contentId, "data-tooltip": isExpanded ? 'Collapse' : 'Expand', children: _jsx(Icon, { name: isExpanded ? 'arrow_up' : 'arrow_down', withPadding: false }) }))] })] }), _jsx("div", { className: classNames('ff-weightage-content', {
|
|
124
|
+
'ff-weightage-content--expanded': shouldShowContent,
|
|
125
|
+
}), id: contentId, "aria-hidden": !shouldShowContent, ...(!shouldShowContent ? { inert: '' } : {}), children: _jsx("div", { className: "ff-weightage-content-inner", children: _jsxs("div", { className: "ff-weightage-grid", role: "table", "aria-labelledby": titleId, "aria-colcount": 3, "aria-rowcount": totalGuidelineCount + 1, children: [_jsxs("div", { className: "ff-weightage-row ff-weightage-row-head", role: "row", "aria-rowindex": 1, children: [renderHeaderCell('ff-weightage-principle', resolvedColumnLabels.principle, 1), renderHeaderCell('ff-weightage-guideline', resolvedColumnLabels.guidelines, 2), renderHeaderCell('ff-weightage-value', resolvedColumnLabels.weightage, 3)] }), groups.map((group, groupIndex) => renderGroup(group, groupIndex, groupStartRowIndexes[groupIndex] ?? 2))] }) }) })] }));
|
|
39
126
|
};
|
|
40
127
|
export default WeightageTable;
|
|
41
128
|
//# sourceMappingURL=Weightagetable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Weightagetable.js","sourceRoot":"","sources":["../../../src/components/Weightagetable/Weightagetable.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file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AAE,UAAU,EAAE,EAAE,CAChC,WAAW,CACT,KAAK,EACL,UAAU,EACV,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,CACtC,CACF,IACG,GACF,GACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export type WeightageColumnLabels = {
|
|
3
|
+
principle: React.ReactNode;
|
|
4
|
+
guidelines: React.ReactNode;
|
|
5
|
+
weightage: React.ReactNode;
|
|
6
|
+
};
|
|
2
7
|
export interface WeightageRow {
|
|
3
8
|
/**
|
|
4
9
|
* Label for the guideline row, e.g. "1.1 - Text alternative"
|
|
@@ -21,7 +26,7 @@ export interface WeightageRow {
|
|
|
21
26
|
*/
|
|
22
27
|
minValue?: number;
|
|
23
28
|
/**
|
|
24
|
-
* Maximum allowed value for this row's input (
|
|
29
|
+
* Maximum allowed value for this row's input (capped at 100)
|
|
25
30
|
*/
|
|
26
31
|
maxValue?: number;
|
|
27
32
|
/**
|
|
@@ -47,32 +52,58 @@ export interface WeightageGroup {
|
|
|
47
52
|
*/
|
|
48
53
|
guidelines: WeightageRow[];
|
|
49
54
|
}
|
|
55
|
+
export interface WeightageCellRenderProps {
|
|
56
|
+
group: WeightageGroup;
|
|
57
|
+
row: WeightageRow;
|
|
58
|
+
groupIndex: number;
|
|
59
|
+
rowIndex: number;
|
|
60
|
+
rowKey: string;
|
|
61
|
+
minValue: number;
|
|
62
|
+
maxValue: number;
|
|
63
|
+
disabled: boolean;
|
|
64
|
+
inputWidth?: React.CSSProperties['width'];
|
|
65
|
+
inputProps: {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
'aria-label': string;
|
|
69
|
+
'aria-describedby'?: string;
|
|
70
|
+
'aria-errormessage'?: string;
|
|
71
|
+
'aria-invalid'?: boolean;
|
|
72
|
+
};
|
|
73
|
+
onChange: (updatedRow: WeightageRow) => void;
|
|
74
|
+
}
|
|
50
75
|
export interface WeightageTableProps {
|
|
51
76
|
/**
|
|
52
77
|
* Title shown on the left side of the header bar
|
|
53
78
|
*/
|
|
54
|
-
title?:
|
|
79
|
+
title?: React.ReactNode;
|
|
55
80
|
/**
|
|
56
81
|
* Total weightage value shown on the right side of the header bar, e.g. 100.
|
|
57
82
|
* If not passed, it is auto-computed as the sum of all row values.
|
|
58
83
|
*/
|
|
59
84
|
totalWeightage?: number;
|
|
60
85
|
/**
|
|
61
|
-
* Max possible weightage
|
|
86
|
+
* Max possible weightage retained for backward compatibility.
|
|
87
|
+
* Use minValue/maxValue for default input validation.
|
|
62
88
|
*/
|
|
63
89
|
maxWeightage?: number;
|
|
64
90
|
/**
|
|
65
91
|
* Column heading for the principle column
|
|
66
92
|
*/
|
|
67
|
-
principleColumnLabel?:
|
|
93
|
+
principleColumnLabel?: React.ReactNode;
|
|
68
94
|
/**
|
|
69
95
|
* Column heading for the guidelines column
|
|
70
96
|
*/
|
|
71
|
-
guidelinesColumnLabel?:
|
|
97
|
+
guidelinesColumnLabel?: React.ReactNode;
|
|
72
98
|
/**
|
|
73
99
|
* Column heading for the weightage column
|
|
74
100
|
*/
|
|
75
|
-
weightageColumnLabel?:
|
|
101
|
+
weightageColumnLabel?: React.ReactNode;
|
|
102
|
+
/**
|
|
103
|
+
* Preferred API for overriding column labels in one place.
|
|
104
|
+
* Individual label props are still supported for backward compatibility.
|
|
105
|
+
*/
|
|
106
|
+
columnLabels?: Partial<WeightageColumnLabels>;
|
|
76
107
|
/**
|
|
77
108
|
* Data for the table body, grouped by principle. This component is controlled —
|
|
78
109
|
* the parent owns this array and updates it inside onWeightageChange.
|
|
@@ -83,6 +114,15 @@ export interface WeightageTableProps {
|
|
|
83
114
|
* use groupIndex/rowIndex to update just that one row in your state.
|
|
84
115
|
*/
|
|
85
116
|
onWeightageChange?: (groupIndex: number, rowIndex: number, updatedRow: WeightageRow) => void;
|
|
117
|
+
/**
|
|
118
|
+
* Optional custom renderer for the weightage cell.
|
|
119
|
+
* If omitted, the component renders its default number Input.
|
|
120
|
+
*/
|
|
121
|
+
renderWeightageCell?: (props: WeightageCellRenderProps) => React.ReactNode;
|
|
122
|
+
/**
|
|
123
|
+
* Width of the default weightage Input, e.g. "70px", "12%", or 70.
|
|
124
|
+
*/
|
|
125
|
+
weightageInputWidth?: React.CSSProperties['width'];
|
|
86
126
|
/**
|
|
87
127
|
* Called when the refresh/reset icon in the header is clicked
|
|
88
128
|
*/
|
|
@@ -100,9 +140,18 @@ export interface WeightageTableProps {
|
|
|
100
140
|
*/
|
|
101
141
|
minValue?: number;
|
|
102
142
|
/**
|
|
103
|
-
* Default maxValue applied to every row's Input unless the row overrides it
|
|
143
|
+
* Default maxValue applied to every row's Input unless the row overrides it.
|
|
144
|
+
* Values above 100 are capped at 100.
|
|
104
145
|
*/
|
|
105
146
|
maxValue?: number;
|
|
147
|
+
/**
|
|
148
|
+
* Enables expand/collapse behavior for the table content.
|
|
149
|
+
*/
|
|
150
|
+
isAccordion?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Initial expanded state when accordion behavior is enabled.
|
|
153
|
+
*/
|
|
154
|
+
defaultExpanded?: boolean;
|
|
106
155
|
/**
|
|
107
156
|
* To add styles in WeightageTable
|
|
108
157
|
*/
|
package/lib/index.d.ts
CHANGED
|
@@ -1369,7 +1369,6 @@ interface SelectedItemProps$1 {
|
|
|
1369
1369
|
*/
|
|
1370
1370
|
[key: string]: string | number | boolean;
|
|
1371
1371
|
}
|
|
1372
|
-
type TableRef = LegacyRef<HTMLTableSectionElement> | React__default.RefObject<HTMLTableSectionElement> | LegacyRef<HTMLDivElement> | React__default.RefObject<HTMLDivElement> | null;
|
|
1373
1372
|
interface TableProps$2 {
|
|
1374
1373
|
/**
|
|
1375
1374
|
* Data for table
|
|
@@ -1479,7 +1478,7 @@ interface TableProps$2 {
|
|
|
1479
1478
|
/**
|
|
1480
1479
|
* enable editMode by setting state row id
|
|
1481
1480
|
*/
|
|
1482
|
-
editMode?: string |
|
|
1481
|
+
editMode?: string | null;
|
|
1483
1482
|
/**
|
|
1484
1483
|
* The content that to be displayed if editComponent
|
|
1485
1484
|
*/
|
|
@@ -1487,7 +1486,7 @@ interface TableProps$2 {
|
|
|
1487
1486
|
/**
|
|
1488
1487
|
* tableRef to get the scroll position & to pass control of table to parent component
|
|
1489
1488
|
*/
|
|
1490
|
-
tableRef?:
|
|
1489
|
+
tableRef?: LegacyRef<HTMLTableSectionElement> | React__default.RefObject<HTMLTableSectionElement> | null;
|
|
1491
1490
|
/**
|
|
1492
1491
|
* Explicitly handling the checkbox disability for the row.
|
|
1493
1492
|
*/
|
|
@@ -1504,10 +1503,9 @@ interface TableProps$2 {
|
|
|
1504
1503
|
displayCard?: boolean;
|
|
1505
1504
|
selectedNode?: {
|
|
1506
1505
|
key: string;
|
|
1507
|
-
selected: string
|
|
1506
|
+
selected: string;
|
|
1508
1507
|
};
|
|
1509
1508
|
uniqueRowIdForAccordion?: string | number;
|
|
1510
|
-
openAccordionId?: string | number | null;
|
|
1511
1509
|
}
|
|
1512
1510
|
|
|
1513
1511
|
declare const Table: React$1.ForwardRefExoticComponent<TableProps$2 & React$1.RefAttributes<any>>;
|
|
@@ -3848,7 +3846,7 @@ interface ColumnProps$1 {
|
|
|
3848
3846
|
/**
|
|
3849
3847
|
* width of a column
|
|
3850
3848
|
*/
|
|
3851
|
-
width?:
|
|
3849
|
+
width?: number;
|
|
3852
3850
|
/**
|
|
3853
3851
|
* data for the column
|
|
3854
3852
|
*/
|