@centreon/ui 23.10.62 → 23.10.64
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/package.json +1 -1
- package/src/Button/Icon/index.tsx +10 -1
- package/src/Graph/Gauge/AnimatedPie.tsx +31 -20
- package/src/Graph/Gauge/Gauge.stories.tsx +97 -6
- package/src/Graph/Gauge/Gauge.tsx +4 -15
- package/src/Graph/Gauge/PieData.tsx +8 -24
- package/src/Graph/Gauge/ResponsiveGauge.tsx +11 -14
- package/src/Graph/Gauge/Thresholds.tsx +109 -56
- package/src/Graph/Gauge/models.ts +2 -3
- package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +64 -0
- package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +31 -73
- package/src/Graph/LineChart/LineChart.tsx +14 -13
- package/src/Graph/LineChart/index.stories.tsx +67 -3
- package/src/Graph/LineChart/index.tsx +3 -9
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +10 -8
- package/src/Graph/SingleBar/SingleBar.stories.tsx +119 -6
- package/src/Graph/SingleBar/ThresholdLine.tsx +74 -0
- package/src/Graph/SingleBar/Thresholds.tsx +28 -82
- package/src/Graph/SingleBar/models.ts +2 -4
- package/src/Graph/Text/Text.tsx +20 -16
- package/src/Graph/common/models.ts +12 -0
- package/src/Graph/common/utils.ts +59 -6
- package/src/Listing/ActionBar/index.tsx +14 -7
- package/src/Listing/Cell/DataCell.tsx +7 -7
- package/src/Listing/Cell/index.tsx +5 -5
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +3 -3
- package/src/Listing/Header/Cell/ListingHeaderCell.tsx +2 -2
- package/src/Listing/Header/ListingHeader.tsx +4 -4
- package/src/Listing/Listing.styles.ts +1 -1
- package/src/Listing/Row/Row.tsx +3 -3
- package/src/Listing/index.stories.tsx +5 -5
- package/src/Listing/index.tsx +15 -12
- package/src/Listing/tableAtoms.ts +14 -11
- package/src/Listing/useStyleTable.ts +8 -8
- package/src/SortableItems/SortableItem.tsx +2 -1
- package/src/utils/useThresholds.ts +0 -0
package/src/Listing/index.tsx
CHANGED
|
@@ -102,6 +102,7 @@ export interface Props<TRow> {
|
|
|
102
102
|
headerMemoProps?: Array<unknown>;
|
|
103
103
|
innerScrollDisabled?: boolean;
|
|
104
104
|
limit?: number;
|
|
105
|
+
listingVariant?: ListingVariant;
|
|
105
106
|
loading?: boolean;
|
|
106
107
|
moveTablePagination?: boolean;
|
|
107
108
|
onLimitChange?: (limit) => void;
|
|
@@ -126,8 +127,8 @@ export interface Props<TRow> {
|
|
|
126
127
|
rowProperty: string;
|
|
127
128
|
};
|
|
128
129
|
totalRows?: number;
|
|
129
|
-
viewMode?: ListingVariant;
|
|
130
130
|
viewerModeConfiguration?: ViewerModeConfiguration;
|
|
131
|
+
visualizationActions?: JSX.Element;
|
|
131
132
|
widthToMoveTablePagination?: number;
|
|
132
133
|
}
|
|
133
134
|
|
|
@@ -139,6 +140,7 @@ export const performanceRowsLimit = 60;
|
|
|
139
140
|
|
|
140
141
|
const Listing = <TRow extends { id: RowId }>({
|
|
141
142
|
limit = 10,
|
|
143
|
+
visualizationActions,
|
|
142
144
|
columns,
|
|
143
145
|
columnConfiguration = defaultColumnConfiguration,
|
|
144
146
|
customPaginationClassName,
|
|
@@ -168,7 +170,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
168
170
|
predefinedRowsSelection = [],
|
|
169
171
|
actionsBarMemoProps = [],
|
|
170
172
|
moveTablePagination,
|
|
171
|
-
|
|
173
|
+
listingVariant = ListingVariant.compact,
|
|
172
174
|
widthToMoveTablePagination,
|
|
173
175
|
getHighlightRowCondition,
|
|
174
176
|
viewerModeConfiguration,
|
|
@@ -187,7 +189,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
187
189
|
const { dataStyle, getGridTemplateColumn } = useStyleTable({
|
|
188
190
|
checkable,
|
|
189
191
|
currentVisibleColumns,
|
|
190
|
-
|
|
192
|
+
listingVariant
|
|
191
193
|
});
|
|
192
194
|
|
|
193
195
|
const { t } = useTranslation();
|
|
@@ -230,8 +232,8 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
230
232
|
dataStyle,
|
|
231
233
|
getGridTemplateColumn,
|
|
232
234
|
limit,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
listingVariant,
|
|
236
|
+
rows: rowsToDisplay
|
|
235
237
|
});
|
|
236
238
|
|
|
237
239
|
useResizeObserver({
|
|
@@ -501,11 +503,12 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
501
503
|
currentPage={currentPage}
|
|
502
504
|
customPaginationClassName={customPaginationClassName}
|
|
503
505
|
limit={limit}
|
|
506
|
+
listingVariant={listingVariant}
|
|
504
507
|
moveTablePagination={moveTablePagination}
|
|
505
508
|
paginated={paginated}
|
|
506
509
|
totalRows={totalRows}
|
|
507
|
-
viewMode={viewMode}
|
|
508
510
|
viewerModeConfiguration={viewerModeConfiguration}
|
|
511
|
+
visualizationActions={visualizationActions}
|
|
509
512
|
widthToMoveTablePagination={widthToMoveTablePagination}
|
|
510
513
|
onLimitChange={changeLimit}
|
|
511
514
|
onPaginate={onPaginate}
|
|
@@ -532,13 +535,13 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
532
535
|
checkable={checkable}
|
|
533
536
|
columnConfiguration={columnConfiguration}
|
|
534
537
|
columns={columns}
|
|
538
|
+
listingVariant={listingVariant}
|
|
535
539
|
memoProps={headerMemoProps}
|
|
536
540
|
predefinedRowsSelection={predefinedRowsSelection}
|
|
537
541
|
rowCount={limit - emptyRows}
|
|
538
542
|
selectedRowCount={selectedRows.length}
|
|
539
543
|
sortField={sortField}
|
|
540
544
|
sortOrder={sortOrder}
|
|
541
|
-
viewMode={viewMode}
|
|
542
545
|
onSelectAllClick={selectAllRows}
|
|
543
546
|
onSelectColumns={onSelectColumns}
|
|
544
547
|
onSelectRowsWithCondition={onSelectRowsWithCondition}
|
|
@@ -573,12 +576,12 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
573
576
|
}
|
|
574
577
|
lastSelectionIndex={lastSelectionIndex}
|
|
575
578
|
limit={limit}
|
|
579
|
+
listingVariant={listingVariant}
|
|
576
580
|
row={row}
|
|
577
581
|
rowColorConditions={rowColorConditions}
|
|
578
582
|
shiftKeyDownRowPivot={shiftKeyDownRowPivot}
|
|
579
583
|
subItemsPivots={subItemsPivots}
|
|
580
584
|
tabIndex={-1}
|
|
581
|
-
viewMode={viewMode}
|
|
582
585
|
visibleColumns={visibleColumns}
|
|
583
586
|
onClick={(): void => {
|
|
584
587
|
onRowClick(row);
|
|
@@ -628,10 +631,10 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
628
631
|
key={`${getId(row)}-${column.id}`}
|
|
629
632
|
labelCollapse={subItems.labelCollapse}
|
|
630
633
|
labelExpand={subItems.labelExpand}
|
|
634
|
+
listingVariant={listingVariant}
|
|
631
635
|
row={row}
|
|
632
636
|
rowColorConditions={rowColorConditions}
|
|
633
637
|
subItemsRowProperty={subItems?.rowProperty}
|
|
634
|
-
viewMode={viewMode}
|
|
635
638
|
/>
|
|
636
639
|
))}
|
|
637
640
|
</ListingRow>
|
|
@@ -674,7 +677,7 @@ export const MemoizedListing = <TRow extends { id: string | number }>({
|
|
|
674
677
|
columnConfiguration,
|
|
675
678
|
moveTablePagination,
|
|
676
679
|
widthToMoveTablePagination,
|
|
677
|
-
|
|
680
|
+
listingVariant,
|
|
678
681
|
...props
|
|
679
682
|
}: MemoizedListingProps<TRow>): JSX.Element =>
|
|
680
683
|
useMemoComponent({
|
|
@@ -686,6 +689,7 @@ export const MemoizedListing = <TRow extends { id: string | number }>({
|
|
|
686
689
|
currentPage={currentPage}
|
|
687
690
|
innerScrollDisabled={innerScrollDisabled}
|
|
688
691
|
limit={limit}
|
|
692
|
+
listingVariant={listingVariant}
|
|
689
693
|
loading={loading}
|
|
690
694
|
moveTablePagination={moveTablePagination}
|
|
691
695
|
paginated={paginated}
|
|
@@ -695,7 +699,6 @@ export const MemoizedListing = <TRow extends { id: string | number }>({
|
|
|
695
699
|
sortField={sortField}
|
|
696
700
|
sortOrder={sortOrder}
|
|
697
701
|
totalRows={totalRows}
|
|
698
|
-
viewMode={viewMode}
|
|
699
702
|
widthToMoveTablePagination={widthToMoveTablePagination}
|
|
700
703
|
{...props}
|
|
701
704
|
/>
|
|
@@ -719,7 +722,7 @@ export const MemoizedListing = <TRow extends { id: string | number }>({
|
|
|
719
722
|
sortOrder,
|
|
720
723
|
sortField,
|
|
721
724
|
innerScrollDisabled,
|
|
722
|
-
|
|
725
|
+
listingVariant
|
|
723
726
|
]
|
|
724
727
|
});
|
|
725
728
|
|
|
@@ -32,16 +32,19 @@ export const tableStyleAtom = atom<TableStyleAtom>({
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
export const tableStyleDerivedAtom = atom(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
export const tableStyleDerivedAtom = atom(
|
|
36
|
+
null,
|
|
37
|
+
(get, set, { listingVariant }) => {
|
|
38
|
+
const tableStyle = get(tableStyleAtom);
|
|
39
|
+
|
|
40
|
+
const isExtendedMode = equals(listingVariant, ListingVariant.extended);
|
|
41
|
+
|
|
42
|
+
set(tableStyleAtom, {
|
|
43
|
+
...tableStyle,
|
|
44
|
+
body: isExtendedMode ? extendedTableBody : compactTableBody,
|
|
45
|
+
header: isExtendedMode ? extendedTableHeader : compactTableHeader
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
);
|
|
46
49
|
|
|
47
50
|
export const subItemsPivotsAtom = atom<Array<number | string>>([]);
|
|
@@ -14,7 +14,7 @@ import { tableStyleAtom, tableStyleDerivedAtom } from './tableAtoms';
|
|
|
14
14
|
interface TableStyle {
|
|
15
15
|
checkable?: boolean;
|
|
16
16
|
currentVisibleColumns?: Array<Column>;
|
|
17
|
-
|
|
17
|
+
listingVariant?: ListingVariant;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
interface TableStyleState {
|
|
@@ -27,23 +27,23 @@ const isCompactMode = equals<ListingVariant | undefined>(
|
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
interface GetTextStyleProps {
|
|
30
|
+
listingVariant?: ListingVariant;
|
|
30
31
|
theme: Theme;
|
|
31
|
-
viewMode?: ListingVariant;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export const getTextStyleByViewMode = ({
|
|
35
|
-
|
|
35
|
+
listingVariant,
|
|
36
36
|
theme
|
|
37
37
|
}: GetTextStyleProps): CSSObject =>
|
|
38
38
|
pick(
|
|
39
39
|
['color', 'fontSize', 'lineHeight'],
|
|
40
|
-
theme.typography[isCompactMode(
|
|
40
|
+
theme.typography[isCompactMode(listingVariant) ? 'body2' : 'body1']
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
const useStyleTable = ({
|
|
44
44
|
checkable,
|
|
45
45
|
currentVisibleColumns,
|
|
46
|
-
|
|
46
|
+
listingVariant
|
|
47
47
|
}: TableStyle): TableStyleState => {
|
|
48
48
|
const dataStyle = useAtomValue(tableStyleAtom);
|
|
49
49
|
|
|
@@ -69,10 +69,10 @@ const useStyleTable = ({
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
useEffect(() => {
|
|
72
|
-
if (
|
|
73
|
-
updateStyleTable({
|
|
72
|
+
if (listingVariant) {
|
|
73
|
+
updateStyleTable({ listingVariant });
|
|
74
74
|
}
|
|
75
|
-
}, [
|
|
75
|
+
}, [listingVariant]);
|
|
76
76
|
|
|
77
77
|
return {
|
|
78
78
|
dataStyle,
|
|
File without changes
|