@dxc-technology/halstack-react 15.0.1 → 15.1.1
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/dist/index.d.mts +15 -7
- package/dist/index.d.ts +15 -7
- package/dist/index.js +223 -188
- package/dist/index.mjs +223 -188
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -2279,6 +2279,7 @@ var AccordionLabel = import_styled_components4.default.span`
|
|
|
2279
2279
|
overflow: hidden;
|
|
2280
2280
|
text-overflow: ellipsis;
|
|
2281
2281
|
white-space: nowrap;
|
|
2282
|
+
text-align: left;
|
|
2282
2283
|
`;
|
|
2283
2284
|
var SubLabel = import_styled_components4.default.span`
|
|
2284
2285
|
height: 20px;
|
|
@@ -6190,13 +6191,15 @@ var renderExpandableTrigger = (row, rows, uniqueRowId, setRowsToRender) => /* @_
|
|
|
6190
6191
|
return newRows;
|
|
6191
6192
|
});
|
|
6192
6193
|
}
|
|
6193
|
-
}
|
|
6194
|
+
},
|
|
6195
|
+
disabled: !rows.some((row2) => uniqueRowId in row2)
|
|
6194
6196
|
}
|
|
6195
6197
|
);
|
|
6196
6198
|
var renderHierarchyTrigger = (rows, triggerRow, uniqueRowId, columnKey, setRowsToRender) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
6197
6199
|
"button",
|
|
6198
6200
|
{
|
|
6199
6201
|
type: "button",
|
|
6202
|
+
disabled: !rows.some((row) => uniqueRowId in row),
|
|
6200
6203
|
onClick: () => {
|
|
6201
6204
|
let newRowsToRender = [...rows];
|
|
6202
6205
|
if (!triggerRow.visibleChildren) {
|
|
@@ -6255,13 +6258,14 @@ var renderCheckbox = (rows, row, uniqueRowId, selectedRows, onSelectRows) => /*
|
|
|
6255
6258
|
getParentSelectedState(rows, row.parentKey, uniqueRowId, selected, checked);
|
|
6256
6259
|
}
|
|
6257
6260
|
onSelectRows(selected);
|
|
6258
|
-
}
|
|
6261
|
+
},
|
|
6262
|
+
disabled: !rows.some((row2) => uniqueRowId in row2)
|
|
6259
6263
|
}
|
|
6260
6264
|
);
|
|
6261
6265
|
var renderHeaderCheckbox = (rows, uniqueRowId, selectedRows, colorsTheme, onSelectRows) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(HalstackProvider, { advancedTheme: overwriteTheme(colorsTheme), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6262
6266
|
Checkbox_default,
|
|
6263
6267
|
{
|
|
6264
|
-
checked: !rows.some((row) => !selectedRows.has(rowKeyGetter(row, uniqueRowId))),
|
|
6268
|
+
checked: rows.length > 0 && !rows.some((row) => !selectedRows.has(rowKeyGetter(row, uniqueRowId))),
|
|
6265
6269
|
onChange: (checked) => {
|
|
6266
6270
|
const updatedSelection = new Set(selectedRows);
|
|
6267
6271
|
if (checked) {
|
|
@@ -6280,7 +6284,8 @@ var renderHeaderCheckbox = (rows, uniqueRowId, selectedRows, colorsTheme, onSele
|
|
|
6280
6284
|
});
|
|
6281
6285
|
}
|
|
6282
6286
|
onSelectRows(updatedSelection);
|
|
6283
|
-
}
|
|
6287
|
+
},
|
|
6288
|
+
disabled: rows.length === 0 || !rows.some((row) => uniqueRowId in row)
|
|
6284
6289
|
}
|
|
6285
6290
|
) });
|
|
6286
6291
|
var rowKeyGetter = (row, uniqueRowId) => {
|
|
@@ -6334,7 +6339,7 @@ var sortHierarchyRows = (rows, sortColumns, sortFunctions, uniqueRowId) => {
|
|
|
6334
6339
|
true
|
|
6335
6340
|
);
|
|
6336
6341
|
while (sortedChildren.length) {
|
|
6337
|
-
if (uniqueRowId) {
|
|
6342
|
+
if (uniqueRowId && sortedChildren.some((row) => uniqueRowId in row)) {
|
|
6338
6343
|
sortedChildren = sortedChildren.reduce(
|
|
6339
6344
|
(remainingChilds, child) => {
|
|
6340
6345
|
const parentIndex = parentsSorted.findIndex(
|
|
@@ -6387,6 +6392,9 @@ var getChildrenSelection = (rowList, uniqueRowId, selectedRows, checked) => {
|
|
|
6387
6392
|
});
|
|
6388
6393
|
};
|
|
6389
6394
|
var getParentSelectedState = (rowList, parentKeyValue, uniqueRowId, selectedRows, checkedStateToMatch) => {
|
|
6395
|
+
if (!rowList.some((row) => uniqueRowId in row)) {
|
|
6396
|
+
return;
|
|
6397
|
+
}
|
|
6390
6398
|
const parentRow = rowFinderBasedOnId(rowList, uniqueRowId, parentKeyValue);
|
|
6391
6399
|
if (!parentRow) {
|
|
6392
6400
|
return;
|
|
@@ -7711,6 +7719,142 @@ var Table_default = DxcTable;
|
|
|
7711
7719
|
|
|
7712
7720
|
// src/data-grid/DataGrid.tsx
|
|
7713
7721
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7722
|
+
var ActionContainer = import_styled_components37.default.div`
|
|
7723
|
+
display: flex;
|
|
7724
|
+
height: 100%;
|
|
7725
|
+
align-items: center;
|
|
7726
|
+
justify-content: center;
|
|
7727
|
+
font-size: 14px;
|
|
7728
|
+
width: 100%;
|
|
7729
|
+
`;
|
|
7730
|
+
var HierarchyContainer = import_styled_components37.default.div`
|
|
7731
|
+
padding-left: ${(props) => `calc(${props.theme.dataPaddingLeft} * ${props.level})`};
|
|
7732
|
+
button {
|
|
7733
|
+
display: grid;
|
|
7734
|
+
grid-template-columns: auto 1fr;
|
|
7735
|
+
align-items: center;
|
|
7736
|
+
gap: 0.5rem;
|
|
7737
|
+
padding: 0px;
|
|
7738
|
+
border: 0px;
|
|
7739
|
+
width: 100%;
|
|
7740
|
+
height: ${(props) => props.theme.dataRowHeight}px;
|
|
7741
|
+
background: transparent;
|
|
7742
|
+
text-align: left;
|
|
7743
|
+
font-size: ${(props) => props.theme.dataFontSize};
|
|
7744
|
+
font-family: inherit;
|
|
7745
|
+
color: inherit;
|
|
7746
|
+
cursor: pointer;
|
|
7747
|
+
}
|
|
7748
|
+
`;
|
|
7749
|
+
var DataGridContainer = import_styled_components37.default.div`
|
|
7750
|
+
width: 100%;
|
|
7751
|
+
height: ${(props) => props.paginatorRendered ? `calc(100% - 50px)` : `100%`};
|
|
7752
|
+
.rdg {
|
|
7753
|
+
border-radius: 4px;
|
|
7754
|
+
height: 100%;
|
|
7755
|
+
border: 0px;
|
|
7756
|
+
&::-webkit-scrollbar {
|
|
7757
|
+
width: 8px;
|
|
7758
|
+
height: 8px;
|
|
7759
|
+
}
|
|
7760
|
+
&::-webkit-scrollbar-thumb {
|
|
7761
|
+
background-color: ${(props) => props.theme.scrollBarThumbColor};
|
|
7762
|
+
border-radius: 6px;
|
|
7763
|
+
}
|
|
7764
|
+
&::-webkit-scrollbar-track {
|
|
7765
|
+
background-color: ${(props) => props.theme.scrollBarTrackColor};
|
|
7766
|
+
border-radius: 6px;
|
|
7767
|
+
}
|
|
7768
|
+
}
|
|
7769
|
+
.rdg-cell:has(> #action) {
|
|
7770
|
+
padding: 0px;
|
|
7771
|
+
}
|
|
7772
|
+
.rdg-cell {
|
|
7773
|
+
display: grid;
|
|
7774
|
+
align-items: center;
|
|
7775
|
+
width: 100%;
|
|
7776
|
+
padding: 0px ${(props) => props.theme.dataPaddingRight} 0 ${(props) => props.theme.dataPaddingLeft};
|
|
7777
|
+
font-family: ${(props) => props.theme.dataFontFamily};
|
|
7778
|
+
font-size: ${(props) => props.theme.dataFontSize};
|
|
7779
|
+
font-style: ${(props) => props.theme.dataFontStyle};
|
|
7780
|
+
font-weight: ${(props) => props.theme.dataFontWeight};
|
|
7781
|
+
color: ${(props) => props.theme.dataFontColor};
|
|
7782
|
+
text-transform: ${(props) => props.theme.dataFontTextTransform};
|
|
7783
|
+
line-height: ${(props) => props.theme.dataTextLineHeight};
|
|
7784
|
+
border-bottom: ${(props) => `${props.theme.rowSeparatorThickness} ${props.theme.rowSeparatorStyle} ${props.theme.rowSeparatorColor}`};
|
|
7785
|
+
border-right: ${(props) => `${props.theme.rowSeparatorThickness} ${props.theme.rowSeparatorStyle} ${props.theme.rowSeparatorColor}`};
|
|
7786
|
+
background-color: ${(props) => props.theme.dataBackgroundColor};
|
|
7787
|
+
outline-color: ${(props) => props.theme.focusColor} !important;
|
|
7788
|
+
.rdg-text-editor:focus {
|
|
7789
|
+
border-color: transparent;
|
|
7790
|
+
background-color: transparent;
|
|
7791
|
+
color: ${(props) => props.theme.dataFontColor};
|
|
7792
|
+
}
|
|
7793
|
+
}
|
|
7794
|
+
.rdg-header-row {
|
|
7795
|
+
border-top-left-radius: ${(props) => props.theme.headerBorderRadius};
|
|
7796
|
+
border-top-right-radius: ${(props) => props.theme.headerBorderRadius};
|
|
7797
|
+
.rdg-cell {
|
|
7798
|
+
font-family: ${(props) => props.theme.headerFontFamily};
|
|
7799
|
+
font-size: ${(props) => props.theme.headerFontSize};
|
|
7800
|
+
font-style: ${(props) => props.theme.headerFontStyle};
|
|
7801
|
+
font-weight: ${(props) => props.theme.headerFontWeight};
|
|
7802
|
+
color: ${(props) => props.theme.headerFontColor};
|
|
7803
|
+
text-transform: ${(props) => props.theme.headerFontTextTransform};
|
|
7804
|
+
padding: 0px ${(props) => props.theme.headerPaddingRight} 0 ${(props) => props.theme.headerPaddingLeft};
|
|
7805
|
+
line-height: ${(props) => props.theme.headerTextLineHeight};
|
|
7806
|
+
background-color: ${(props) => props.theme.headerBackgroundColor};
|
|
7807
|
+
.sortIconContainer {
|
|
7808
|
+
margin-left: 0.5rem;
|
|
7809
|
+
display: flex;
|
|
7810
|
+
height: 100%;
|
|
7811
|
+
align-items: center;
|
|
7812
|
+
}
|
|
7813
|
+
}
|
|
7814
|
+
}
|
|
7815
|
+
.rdg-row {
|
|
7816
|
+
.rdg-cell:last-child {
|
|
7817
|
+
border-right: 0px;
|
|
7818
|
+
}
|
|
7819
|
+
}
|
|
7820
|
+
.rdg-summary-row {
|
|
7821
|
+
background-color: #fafafa;
|
|
7822
|
+
.rdg-cell {
|
|
7823
|
+
border: 0px;
|
|
7824
|
+
font-weight: 600;
|
|
7825
|
+
}
|
|
7826
|
+
}
|
|
7827
|
+
.ellipsis-cell {
|
|
7828
|
+
text-overflow: ellipsis;
|
|
7829
|
+
overflow: hidden;
|
|
7830
|
+
white-space: nowrap;
|
|
7831
|
+
width: 100%;
|
|
7832
|
+
height: 100%;
|
|
7833
|
+
display: flex;
|
|
7834
|
+
align-items: center;
|
|
7835
|
+
}
|
|
7836
|
+
.align-left {
|
|
7837
|
+
text-align: left;
|
|
7838
|
+
justify-content: flex-start;
|
|
7839
|
+
}
|
|
7840
|
+
.align-center {
|
|
7841
|
+
text-align: center;
|
|
7842
|
+
justify-content: center;
|
|
7843
|
+
}
|
|
7844
|
+
.align-right {
|
|
7845
|
+
text-align: right;
|
|
7846
|
+
justify-content: flex-end;
|
|
7847
|
+
}
|
|
7848
|
+
.header-align-left {
|
|
7849
|
+
text-align: left;
|
|
7850
|
+
}
|
|
7851
|
+
.header-align-center {
|
|
7852
|
+
text-align: center;
|
|
7853
|
+
}
|
|
7854
|
+
.header-align-right {
|
|
7855
|
+
text-align: right;
|
|
7856
|
+
}
|
|
7857
|
+
`;
|
|
7714
7858
|
var DxcDataGrid = ({
|
|
7715
7859
|
columns,
|
|
7716
7860
|
rows,
|
|
@@ -7728,11 +7872,12 @@ var DxcDataGrid = ({
|
|
|
7728
7872
|
itemsPerPageFunction,
|
|
7729
7873
|
onSort,
|
|
7730
7874
|
onPageChange,
|
|
7731
|
-
totalItems
|
|
7875
|
+
totalItems,
|
|
7876
|
+
defaultPage = 1
|
|
7732
7877
|
}) => {
|
|
7733
7878
|
const [rowsToRender, setRowsToRender] = (0, import_react42.useState)(rows);
|
|
7734
7879
|
const colorsTheme = (0, import_react42.useContext)(HalstackContext);
|
|
7735
|
-
const [page, changePage] = (0, import_react42.useState)(
|
|
7880
|
+
const [page, changePage] = (0, import_react42.useState)(defaultPage);
|
|
7736
7881
|
const goToPage = (newPage) => {
|
|
7737
7882
|
if (onPageChange) {
|
|
7738
7883
|
onPageChange(newPage);
|
|
@@ -7814,7 +7959,21 @@ var DxcDataGrid = ({
|
|
|
7814
7959
|
setColumnsOrder(Array.from({ length: columnsToRender.length }, (_, index) => index));
|
|
7815
7960
|
}, [columnsToRender.length]);
|
|
7816
7961
|
(0, import_react42.useEffect)(() => {
|
|
7817
|
-
|
|
7962
|
+
const finalRows = [...rows];
|
|
7963
|
+
if (expandable) {
|
|
7964
|
+
rows.forEach((row, index) => {
|
|
7965
|
+
if (row.contentIsExpanded && !rows.some((row2) => row2[uniqueRowId] === `${rowKeyGetter(row2, uniqueRowId)}_expanded`)) {
|
|
7966
|
+
addRow(finalRows, index + 1, {
|
|
7967
|
+
isExpandedChildContent: row.contentIsExpanded,
|
|
7968
|
+
[uniqueRowId]: `${rowKeyGetter(row, uniqueRowId)}_expanded`,
|
|
7969
|
+
expandedChildContent: row.expandedContent,
|
|
7970
|
+
triggerRowKey: rowKeyGetter(row, uniqueRowId),
|
|
7971
|
+
expandedContentHeight: row.expandedContentHeight
|
|
7972
|
+
});
|
|
7973
|
+
}
|
|
7974
|
+
});
|
|
7975
|
+
}
|
|
7976
|
+
setRowsToRender(finalRows);
|
|
7818
7977
|
}, [rows]);
|
|
7819
7978
|
const reorderedColumns = (0, import_react42.useMemo)(
|
|
7820
7979
|
() => (
|
|
@@ -7851,23 +8010,28 @@ var DxcDataGrid = ({
|
|
|
7851
8010
|
const sortedRows = (0, import_react42.useMemo)(() => {
|
|
7852
8011
|
const sortFunctions = getCustomSortFn(columns);
|
|
7853
8012
|
if (!onSort) {
|
|
7854
|
-
if (
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
(
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
8013
|
+
if (sortColumns.length > 0 && uniqueRowId) {
|
|
8014
|
+
if (expandable) {
|
|
8015
|
+
const innerSortedRows = sortRows(
|
|
8016
|
+
rowsToRender.filter((row) => !row.isExpandedChildContent),
|
|
8017
|
+
sortColumns,
|
|
8018
|
+
sortFunctions
|
|
8019
|
+
);
|
|
8020
|
+
if (innerSortedRows.some((row) => uniqueRowId in row)) {
|
|
8021
|
+
rowsToRender.filter((row) => row.isExpandedChildContent).map(
|
|
8022
|
+
(expandedRow) => addRow(
|
|
8023
|
+
innerSortedRows,
|
|
8024
|
+
innerSortedRows.findIndex(
|
|
8025
|
+
(trigger) => rowKeyGetter(trigger, uniqueRowId) === expandedRow.triggerRowKey
|
|
8026
|
+
) + 1,
|
|
8027
|
+
expandedRow
|
|
8028
|
+
)
|
|
8029
|
+
);
|
|
8030
|
+
return innerSortedRows;
|
|
8031
|
+
}
|
|
8032
|
+
} else {
|
|
8033
|
+
return sortHierarchyRows(rowsToRender, sortColumns, sortFunctions, uniqueRowId);
|
|
8034
|
+
}
|
|
7871
8035
|
}
|
|
7872
8036
|
}
|
|
7873
8037
|
return rowsToRender;
|
|
@@ -7883,7 +8047,7 @@ var DxcDataGrid = ({
|
|
|
7883
8047
|
}
|
|
7884
8048
|
return !showPaginator || onPageChange ? sortedRows : getPaginatedNodes(sortedRows, uniqueRowId, minItemsPerPageIndex, maxItemsPerPageIndex + 1);
|
|
7885
8049
|
}, [sortedRows, minItemsPerPageIndex, maxItemsPerPageIndex]);
|
|
7886
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_styled_components37.ThemeProvider, { theme: colorsTheme.dataGrid, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DataGridContainer, { children: [
|
|
8050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_styled_components37.ThemeProvider, { theme: colorsTheme.dataGrid, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(DataGridContainer, { paginatorRendered: showPaginator && (totalItems ?? rows.length) > itemsPerPage, children: [
|
|
7887
8051
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7888
8052
|
import_react_data_grid2.default,
|
|
7889
8053
|
{
|
|
@@ -7903,7 +8067,7 @@ var DxcDataGrid = ({
|
|
|
7903
8067
|
className: "fill-grid"
|
|
7904
8068
|
}
|
|
7905
8069
|
),
|
|
7906
|
-
showPaginator && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8070
|
+
showPaginator && (totalItems ?? rows.length) > itemsPerPage && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7907
8071
|
Paginator_default,
|
|
7908
8072
|
{
|
|
7909
8073
|
totalItems: totalItems ?? rows.length,
|
|
@@ -7917,140 +8081,6 @@ var DxcDataGrid = ({
|
|
|
7917
8081
|
)
|
|
7918
8082
|
] }) });
|
|
7919
8083
|
};
|
|
7920
|
-
var ActionContainer = import_styled_components37.default.div`
|
|
7921
|
-
display: flex;
|
|
7922
|
-
height: 100%;
|
|
7923
|
-
align-items: center;
|
|
7924
|
-
justify-content: center;
|
|
7925
|
-
font-size: 14px;
|
|
7926
|
-
width: 100%;
|
|
7927
|
-
`;
|
|
7928
|
-
var HierarchyContainer = import_styled_components37.default.div`
|
|
7929
|
-
padding-left: ${(props) => `calc(${props.theme.dataPaddingLeft} * ${props.level})`};
|
|
7930
|
-
button {
|
|
7931
|
-
display: grid;
|
|
7932
|
-
grid-template-columns: auto 1fr;
|
|
7933
|
-
align-items: center;
|
|
7934
|
-
gap: 0.5rem;
|
|
7935
|
-
padding: 0px;
|
|
7936
|
-
border: 0px;
|
|
7937
|
-
width: 100%;
|
|
7938
|
-
height: ${(props) => props.theme.dataRowHeight}px;
|
|
7939
|
-
background: transparent;
|
|
7940
|
-
text-align: left;
|
|
7941
|
-
font-size: ${(props) => props.theme.dataFontSize};
|
|
7942
|
-
font-family: inherit;
|
|
7943
|
-
color: inherit;
|
|
7944
|
-
cursor: pointer;
|
|
7945
|
-
}
|
|
7946
|
-
`;
|
|
7947
|
-
var DataGridContainer = import_styled_components37.default.div`
|
|
7948
|
-
width: 100%;
|
|
7949
|
-
height: 100%;
|
|
7950
|
-
.rdg {
|
|
7951
|
-
border-radius: 4px;
|
|
7952
|
-
height: 100%;
|
|
7953
|
-
border: 0px;
|
|
7954
|
-
&::-webkit-scrollbar {
|
|
7955
|
-
width: 8px;
|
|
7956
|
-
height: 8px;
|
|
7957
|
-
}
|
|
7958
|
-
&::-webkit-scrollbar-thumb {
|
|
7959
|
-
background-color: ${(props) => props.theme.scrollBarThumbColor};
|
|
7960
|
-
border-radius: 6px;
|
|
7961
|
-
}
|
|
7962
|
-
&::-webkit-scrollbar-track {
|
|
7963
|
-
background-color: ${(props) => props.theme.scrollBarTrackColor};
|
|
7964
|
-
border-radius: 6px;
|
|
7965
|
-
}
|
|
7966
|
-
}
|
|
7967
|
-
.rdg-cell:has(> #action) {
|
|
7968
|
-
padding: 0px;
|
|
7969
|
-
}
|
|
7970
|
-
.rdg-cell {
|
|
7971
|
-
display: grid;
|
|
7972
|
-
align-items: center;
|
|
7973
|
-
width: 100%;
|
|
7974
|
-
padding: 0px ${(props) => props.theme.dataPaddingRight} 0 ${(props) => props.theme.dataPaddingLeft};
|
|
7975
|
-
font-family: ${(props) => props.theme.dataFontFamily};
|
|
7976
|
-
font-size: ${(props) => props.theme.dataFontSize};
|
|
7977
|
-
font-style: ${(props) => props.theme.dataFontStyle};
|
|
7978
|
-
font-weight: ${(props) => props.theme.dataFontWeight};
|
|
7979
|
-
color: ${(props) => props.theme.dataFontColor};
|
|
7980
|
-
text-transform: ${(props) => props.theme.dataFontTextTransform};
|
|
7981
|
-
line-height: ${(props) => props.theme.dataTextLineHeight};
|
|
7982
|
-
border-bottom: ${(props) => `${props.theme.rowSeparatorThickness} ${props.theme.rowSeparatorStyle} ${props.theme.rowSeparatorColor}`};
|
|
7983
|
-
border-right: ${(props) => `${props.theme.rowSeparatorThickness} ${props.theme.rowSeparatorStyle} ${props.theme.rowSeparatorColor}`};
|
|
7984
|
-
background-color: ${(props) => props.theme.dataBackgroundColor};
|
|
7985
|
-
outline-color: ${(props) => props.theme.focusColor} !important;
|
|
7986
|
-
.rdg-text-editor:focus {
|
|
7987
|
-
border-color: transparent;
|
|
7988
|
-
}
|
|
7989
|
-
}
|
|
7990
|
-
.rdg-header-row {
|
|
7991
|
-
border-top-left-radius: ${(props) => props.theme.headerBorderRadius};
|
|
7992
|
-
border-top-right-radius: ${(props) => props.theme.headerBorderRadius};
|
|
7993
|
-
.rdg-cell {
|
|
7994
|
-
font-family: ${(props) => props.theme.headerFontFamily};
|
|
7995
|
-
font-size: ${(props) => props.theme.headerFontSize};
|
|
7996
|
-
font-style: ${(props) => props.theme.headerFontStyle};
|
|
7997
|
-
font-weight: ${(props) => props.theme.headerFontWeight};
|
|
7998
|
-
color: ${(props) => props.theme.headerFontColor};
|
|
7999
|
-
text-transform: ${(props) => props.theme.headerFontTextTransform};
|
|
8000
|
-
padding: 0px ${(props) => props.theme.headerPaddingRight} 0 ${(props) => props.theme.headerPaddingLeft};
|
|
8001
|
-
line-height: ${(props) => props.theme.headerTextLineHeight};
|
|
8002
|
-
background-color: ${(props) => props.theme.headerBackgroundColor};
|
|
8003
|
-
.sortIconContainer {
|
|
8004
|
-
margin-left: 0.5rem;
|
|
8005
|
-
display: flex;
|
|
8006
|
-
height: 100%;
|
|
8007
|
-
align-items: center;
|
|
8008
|
-
}
|
|
8009
|
-
}
|
|
8010
|
-
}
|
|
8011
|
-
.rdg-row {
|
|
8012
|
-
.rdg-cell:last-child {
|
|
8013
|
-
border-right: 0px;
|
|
8014
|
-
}
|
|
8015
|
-
}
|
|
8016
|
-
.rdg-summary-row {
|
|
8017
|
-
background-color: #fafafa;
|
|
8018
|
-
.rdg-cell {
|
|
8019
|
-
border: 0px;
|
|
8020
|
-
font-weight: 600;
|
|
8021
|
-
}
|
|
8022
|
-
}
|
|
8023
|
-
.ellipsis-cell {
|
|
8024
|
-
text-overflow: ellipsis;
|
|
8025
|
-
overflow: hidden;
|
|
8026
|
-
white-space: nowrap;
|
|
8027
|
-
width: 100%;
|
|
8028
|
-
height: 100%;
|
|
8029
|
-
display: flex;
|
|
8030
|
-
align-items: center;
|
|
8031
|
-
}
|
|
8032
|
-
.align-left {
|
|
8033
|
-
text-align: left;
|
|
8034
|
-
justify-content: flex-start;
|
|
8035
|
-
}
|
|
8036
|
-
.align-center {
|
|
8037
|
-
text-align: center;
|
|
8038
|
-
justify-content: center;
|
|
8039
|
-
}
|
|
8040
|
-
.align-right {
|
|
8041
|
-
text-align: right;
|
|
8042
|
-
justify-content: flex-end;
|
|
8043
|
-
}
|
|
8044
|
-
.header-align-left {
|
|
8045
|
-
text-align: left;
|
|
8046
|
-
}
|
|
8047
|
-
.header-align-center {
|
|
8048
|
-
text-align: center;
|
|
8049
|
-
}
|
|
8050
|
-
.header-align-right {
|
|
8051
|
-
text-align: right;
|
|
8052
|
-
}
|
|
8053
|
-
`;
|
|
8054
8084
|
DxcDataGrid.ActionsCell = DxcActionsCell;
|
|
8055
8085
|
var DataGrid_default = DxcDataGrid;
|
|
8056
8086
|
|
|
@@ -12448,6 +12478,7 @@ var DxcTab2 = (0, import_react72.forwardRef)(
|
|
|
12448
12478
|
icon,
|
|
12449
12479
|
label,
|
|
12450
12480
|
title,
|
|
12481
|
+
tabId = label,
|
|
12451
12482
|
disabled = false,
|
|
12452
12483
|
active,
|
|
12453
12484
|
notificationNumber = false,
|
|
@@ -12460,30 +12491,30 @@ var DxcTab2 = (0, import_react72.forwardRef)(
|
|
|
12460
12491
|
const {
|
|
12461
12492
|
iconPosition = "top",
|
|
12462
12493
|
tabIndex = 0,
|
|
12463
|
-
|
|
12494
|
+
focusedTab,
|
|
12464
12495
|
isControlled,
|
|
12465
|
-
|
|
12496
|
+
activeTab,
|
|
12466
12497
|
hasLabelAndIcon = false,
|
|
12467
|
-
|
|
12498
|
+
setActiveTab,
|
|
12468
12499
|
setActiveIndicatorWidth,
|
|
12469
12500
|
setActiveIndicatorLeft
|
|
12470
12501
|
} = (0, import_react72.useContext)(TabsContext_default) ?? {};
|
|
12471
12502
|
(0, import_react72.useEffect)(() => {
|
|
12472
|
-
if (
|
|
12503
|
+
if (focusedTab === tabId) {
|
|
12473
12504
|
tabRef?.current?.focus();
|
|
12474
12505
|
}
|
|
12475
|
-
}, [
|
|
12506
|
+
}, [focusedTab, tabId]);
|
|
12476
12507
|
(0, import_react72.useEffect)(() => {
|
|
12477
|
-
if (
|
|
12508
|
+
if (activeTab === tabId) {
|
|
12478
12509
|
setActiveIndicatorWidth?.(tabRef.current?.offsetWidth ?? 0);
|
|
12479
12510
|
setActiveIndicatorLeft?.(tabRef.current?.offsetLeft ?? 0);
|
|
12480
12511
|
}
|
|
12481
|
-
}, [
|
|
12512
|
+
}, [activeTab, tabId, setActiveIndicatorWidth, setActiveIndicatorLeft]);
|
|
12482
12513
|
(0, import_react72.useEffect)(() => {
|
|
12483
12514
|
if (active) {
|
|
12484
|
-
|
|
12515
|
+
setActiveTab?.(tabId ?? label ?? "");
|
|
12485
12516
|
}
|
|
12486
|
-
}, [active, label,
|
|
12517
|
+
}, [active, label, setActiveTab]);
|
|
12487
12518
|
const handleOnKeyDown = (event) => {
|
|
12488
12519
|
switch (event.key) {
|
|
12489
12520
|
case " ":
|
|
@@ -12500,9 +12531,10 @@ var DxcTab2 = (0, import_react72.forwardRef)(
|
|
|
12500
12531
|
{
|
|
12501
12532
|
role: "tab",
|
|
12502
12533
|
type: "button",
|
|
12503
|
-
tabIndex:
|
|
12534
|
+
tabIndex: activeTab === tabId && !disabled ? tabIndex : -1,
|
|
12504
12535
|
disabled,
|
|
12505
|
-
"aria-
|
|
12536
|
+
"aria-label": label ?? tabId ?? "tab",
|
|
12537
|
+
"aria-selected": activeTab === tabId,
|
|
12506
12538
|
hasLabelAndIcon,
|
|
12507
12539
|
iconPosition,
|
|
12508
12540
|
ref: (anchorRef) => {
|
|
@@ -12518,7 +12550,8 @@ var DxcTab2 = (0, import_react72.forwardRef)(
|
|
|
12518
12550
|
},
|
|
12519
12551
|
onClick: () => {
|
|
12520
12552
|
if (!isControlled) {
|
|
12521
|
-
|
|
12553
|
+
setActiveTab?.(tabId ?? "");
|
|
12554
|
+
console.log(tabId);
|
|
12522
12555
|
}
|
|
12523
12556
|
onClick();
|
|
12524
12557
|
},
|
|
@@ -12534,7 +12567,7 @@ var DxcTab2 = (0, import_react72.forwardRef)(
|
|
|
12534
12567
|
disabled,
|
|
12535
12568
|
children: [
|
|
12536
12569
|
icon && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TabIconContainer2, { hasLabelAndIcon, iconPosition, children: typeof icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Icon_default, { icon }) : icon }),
|
|
12537
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Label11, { disabled,
|
|
12570
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Label11, { disabled, active: activeTab === tabId, label, children: label })
|
|
12538
12571
|
]
|
|
12539
12572
|
}
|
|
12540
12573
|
),
|
|
@@ -12626,7 +12659,7 @@ var MainLabelContainer = import_styled_components67.default.div`
|
|
|
12626
12659
|
`;
|
|
12627
12660
|
var Label11 = import_styled_components67.default.span`
|
|
12628
12661
|
display: inline;
|
|
12629
|
-
color: ${(props) => props.disabled ? props.theme.disabledFontColor : props.
|
|
12662
|
+
color: ${(props) => props.disabled ? props.theme.disabledFontColor : props.active ? props.theme.selectedFontColor : props.theme.unselectedFontColor};
|
|
12630
12663
|
font-family: ${(props) => props.theme.fontFamily};
|
|
12631
12664
|
font-size: ${(props) => props.theme.fontSize};
|
|
12632
12665
|
font-style: ${(props) => props.disabled ? props.theme.disabledFontStyle : props.theme.fontStyle};
|
|
@@ -13221,14 +13254,14 @@ var DxcTabs2 = ({
|
|
|
13221
13254
|
() => childrenArray.some((child) => (0, import_react75.isValidElement)(child) && child.props.icon && child.props.label),
|
|
13222
13255
|
[childrenArray]
|
|
13223
13256
|
);
|
|
13224
|
-
const [
|
|
13257
|
+
const [activeTab, setActiveTab] = (0, import_react75.useState)(() => {
|
|
13225
13258
|
const hasActiveChild = childrenArray.some(
|
|
13226
13259
|
(child) => (0, import_react75.isValidElement)(child) && (child.props.active || child.props.defaultActive) && !child.props.disabled
|
|
13227
13260
|
);
|
|
13228
13261
|
const initialActiveTab = hasActiveChild ? childrenArray.find(
|
|
13229
13262
|
(child) => (0, import_react75.isValidElement)(child) && (child.props.active || child.props.defaultActive) && !child.props.disabled
|
|
13230
13263
|
) : childrenArray.find((child) => (0, import_react75.isValidElement)(child) && !child.props.disabled);
|
|
13231
|
-
return (0, import_react75.isValidElement)(initialActiveTab) ? initialActiveTab.props.label : "";
|
|
13264
|
+
return (0, import_react75.isValidElement)(initialActiveTab) ? initialActiveTab.props.label ?? initialActiveTab.props.tabId : "";
|
|
13232
13265
|
});
|
|
13233
13266
|
const [innerFocusIndex, setInnerFocusIndex] = (0, import_react75.useState)(null);
|
|
13234
13267
|
const [activeIndicatorWidth, setActiveIndicatorWidth] = (0, import_react75.useState)(0);
|
|
@@ -13255,15 +13288,15 @@ var DxcTabs2 = ({
|
|
|
13255
13288
|
return {
|
|
13256
13289
|
iconPosition,
|
|
13257
13290
|
tabIndex,
|
|
13258
|
-
|
|
13291
|
+
focusedTab: (0, import_react75.isValidElement)(focusedChild) ? focusedChild.props.label ?? focusedChild.props.tabId : "",
|
|
13259
13292
|
isControlled: childrenArray.some((child) => (0, import_react75.isValidElement)(child) && typeof child.props.active !== "undefined"),
|
|
13260
|
-
|
|
13293
|
+
activeTab,
|
|
13261
13294
|
hasLabelAndIcon,
|
|
13262
|
-
|
|
13295
|
+
setActiveTab,
|
|
13263
13296
|
setActiveIndicatorWidth,
|
|
13264
13297
|
setActiveIndicatorLeft
|
|
13265
13298
|
};
|
|
13266
|
-
}, [iconPosition, tabIndex, innerFocusIndex,
|
|
13299
|
+
}, [iconPosition, tabIndex, innerFocusIndex, activeTab, childrenArray, hasLabelAndIcon]);
|
|
13267
13300
|
const scrollLeft = () => {
|
|
13268
13301
|
const scrollWidth = (refTabList?.current?.offsetHeight ?? 0) * 0.75;
|
|
13269
13302
|
let moveX = 0;
|
|
@@ -13296,21 +13329,23 @@ var DxcTabs2 = ({
|
|
|
13296
13329
|
setCountClick(moveX);
|
|
13297
13330
|
};
|
|
13298
13331
|
const handleOnKeyDown = (event) => {
|
|
13299
|
-
const
|
|
13332
|
+
const active = childrenArray.findIndex(
|
|
13333
|
+
(child) => child.props.label ?? child.props.tabId === activeTab
|
|
13334
|
+
);
|
|
13300
13335
|
switch (event.key) {
|
|
13301
13336
|
case "Left":
|
|
13302
13337
|
case "ArrowLeft":
|
|
13303
13338
|
event.preventDefault();
|
|
13304
|
-
setInnerFocusIndex(getPreviousTabIndex2(childrenArray, innerFocusIndex === null ?
|
|
13339
|
+
setInnerFocusIndex(getPreviousTabIndex2(childrenArray, innerFocusIndex === null ? active : innerFocusIndex));
|
|
13305
13340
|
break;
|
|
13306
13341
|
case "Right":
|
|
13307
13342
|
case "ArrowRight":
|
|
13308
13343
|
event.preventDefault();
|
|
13309
|
-
setInnerFocusIndex(getNextTabIndex2(childrenArray, innerFocusIndex === null ?
|
|
13344
|
+
setInnerFocusIndex(getNextTabIndex2(childrenArray, innerFocusIndex === null ? active : innerFocusIndex));
|
|
13310
13345
|
break;
|
|
13311
13346
|
case "Tab":
|
|
13312
|
-
if (
|
|
13313
|
-
setInnerFocusIndex(
|
|
13347
|
+
if (active !== innerFocusIndex) {
|
|
13348
|
+
setInnerFocusIndex(active);
|
|
13314
13349
|
}
|
|
13315
13350
|
break;
|
|
13316
13351
|
default:
|
|
@@ -13341,7 +13376,7 @@ var DxcTabs2 = ({
|
|
|
13341
13376
|
tabWidth: activeIndicatorWidth,
|
|
13342
13377
|
tabLeft: activeIndicatorLeft,
|
|
13343
13378
|
"aria-disabled": childrenArray.some(
|
|
13344
|
-
(child) => (0, import_react75.isValidElement)(child) &&
|
|
13379
|
+
(child) => (0, import_react75.isValidElement)(child) && activeTab === (child.props.label ?? child.props.tabId) && child.props.disabled
|
|
13345
13380
|
)
|
|
13346
13381
|
}
|
|
13347
13382
|
)
|
|
@@ -13361,7 +13396,7 @@ var DxcTabs2 = ({
|
|
|
13361
13396
|
] })
|
|
13362
13397
|
] }) }),
|
|
13363
13398
|
import_react75.Children.map(children, (child) => {
|
|
13364
|
-
if ((0, import_react75.isValidElement)(child) && child.props.label ===
|
|
13399
|
+
if ((0, import_react75.isValidElement)(child) && (child.props.label ?? child.props.tabId) === activeTab) {
|
|
13365
13400
|
return child.props.children;
|
|
13366
13401
|
}
|
|
13367
13402
|
return null;
|