@geotab/zenith 3.2.1 → 3.3.0
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 +25 -1
- package/dist/card/card.d.ts +3 -0
- package/dist/card/card.js +15 -5
- package/dist/card/components/cardToggle/cardToggle.d.ts +5 -0
- package/dist/card/components/cardToggle/cardToggle.js +7 -0
- package/dist/card/components/title.js +3 -3
- package/dist/cardContainer/cardContainer.d.ts +2 -1
- package/dist/cardContainer/cardContainer.js +4 -3
- package/dist/chart/barChart/getDefaultDatasetStyle.js +8 -6
- package/dist/chart/lineChart/getDatasetColor.js +8 -6
- package/dist/chart/lineChart/useSummary.js +1 -1
- package/dist/chart/pieChart/getDefaultDatasetStyle.js +8 -6
- package/dist/chart/plugins/linePlugin/getInterpolatedValue.js +1 -1
- package/dist/chart/plugins/linePlugin/linePlugin.js +16 -4
- package/dist/commonHelpers/hooks/useEscape.js +4 -0
- package/dist/commonHelpers/hooks/usePillSize.d.ts +2 -1
- package/dist/commonHelpers/hooks/usePillSize.js +6 -3
- package/dist/commonStyles/colors/colors.less +9 -0
- package/dist/dataFeed/dataFeed.d.ts +2 -1
- package/dist/dataFeed/dataFeed.js +18 -3
- package/dist/dataFeed/dataFeedColumnsItems.d.ts +2 -1
- package/dist/dataFeed/dataFeedColumnsItems.js +6 -4
- package/dist/dataGrid/cell/cell.d.ts +2 -1
- package/dist/dataGrid/cell/cell.js +2 -1
- package/dist/dataGrid/dataGrid.d.ts +3 -1
- package/dist/dataGrid/dataGrid.js +7 -2
- package/dist/dataGrid/row/row.d.ts +3 -1
- package/dist/dataGrid/row/row.js +3 -3
- package/dist/dataGrid/withFlexibleColumns/components/columnSettingsSidePanel.js +8 -4
- package/dist/divider/divider.d.ts +5 -5
- package/dist/divider/divider.js +6 -2
- package/dist/filtersBar/components/filtersBarPeriodPicker/filtersBarPeriodPicker.js +2 -2
- package/dist/footerButtons/footerButtons.d.ts +4 -0
- package/dist/footerButtons/footerButtons.js +4 -6
- package/dist/groupsFilterRaw/groupsFilterRaw.js +1 -0
- package/dist/index.css +475 -255
- package/dist/index.d.ts +3 -1
- package/dist/index.js +20 -18
- package/dist/lineChart/utils.js +2 -9
- package/dist/list/listItem/listItem.js +26 -0
- package/dist/mobileSheet/components/mobileSheetFooter.d.ts +1 -0
- package/dist/mobileSheet/components/mobileSheetFooter.js +1 -1
- package/dist/mobileSheet/mobileSheet.js +1 -1
- package/dist/pill/components/pillActionable/pillActionable.js +5 -4
- package/dist/pill/components/pillNonActionable/pillNonActionable.js +11 -5
- package/dist/pill/interfaces/pillActionable.interface.d.ts +1 -0
- package/dist/pill/interfaces/pillNonActionable.interface.d.ts +1 -0
- package/dist/pillExpandable/pillExpandable.js +6 -6
- package/dist/rangeRaw/rangeRaw.js +1 -0
- package/dist/selectRaw/selectRaw.js +6 -3
- package/dist/sidePanel/sidePanel.d.ts +1 -1
- package/dist/sidePanel/sidePanel.js +7 -3
- package/dist/table/children/tableDetailPanel.d.ts +9 -0
- package/dist/table/children/tableDetailPanel.js +6 -0
- package/dist/table/children/useTableChildren.d.ts +2 -1
- package/dist/table/children/useTableChildren.js +17 -2
- package/dist/table/detailPanel/detailPanel.d.ts +4 -0
- package/dist/table/detailPanel/detailPanel.js +140 -0
- package/dist/table/detailPanel/detailPanelHeader.d.ts +4 -0
- package/dist/table/detailPanel/detailPanelHeader.js +105 -0
- package/dist/table/detailPanel/interfaces.d.ts +8 -0
- package/dist/table/detailPanel/interfaces.js +2 -0
- package/dist/table/table.d.ts +6 -1
- package/dist/table/table.js +248 -68
- package/dist/utils/localization/translations/cs.json +3 -1
- package/dist/utils/localization/translations/da-DK.json +3 -1
- package/dist/utils/localization/translations/de.json +3 -1
- package/dist/utils/localization/translations/en-json.d.ts +315 -0
- package/dist/utils/localization/translations/en-json.js +318 -0
- package/dist/utils/localization/translations/en.json +5 -1
- package/dist/utils/localization/translations/es.json +3 -1
- package/dist/utils/localization/translations/fi-FI.json +3 -1
- package/dist/utils/localization/translations/fr-FR.json +3 -1
- package/dist/utils/localization/translations/fr.json +3 -1
- package/dist/utils/localization/translations/hu-HU.json +3 -1
- package/dist/utils/localization/translations/id.json +3 -1
- package/dist/utils/localization/translations/it.json +3 -1
- package/dist/utils/localization/translations/ja.json +3 -1
- package/dist/utils/localization/translations/ko-KR.json +3 -1
- package/dist/utils/localization/translations/ms.json +3 -1
- package/dist/utils/localization/translations/nb-NO.json +3 -1
- package/dist/utils/localization/translations/nl.json +3 -1
- package/dist/utils/localization/translations/pl.json +3 -1
- package/dist/utils/localization/translations/pt-BR.json +3 -1
- package/dist/utils/localization/translations/sk-SK.json +3 -1
- package/dist/utils/localization/translations/sv.json +3 -1
- package/dist/utils/localization/translations/th.json +3 -1
- package/dist/utils/localization/translations/tr.json +3 -1
- package/dist/utils/localization/translations/zh-Hans.json +3 -1
- package/dist/utils/localization/translations/zh-TW.json +3 -1
- package/esm/card/card.d.ts +3 -0
- package/esm/card/card.js +15 -5
- package/esm/card/components/cardToggle/cardToggle.d.ts +5 -0
- package/esm/card/components/cardToggle/cardToggle.js +3 -0
- package/esm/card/components/title.js +3 -3
- package/esm/cardContainer/cardContainer.d.ts +2 -1
- package/esm/cardContainer/cardContainer.js +4 -3
- package/esm/chart/barChart/getDefaultDatasetStyle.js +8 -6
- package/esm/chart/lineChart/getDatasetColor.js +8 -6
- package/esm/chart/lineChart/useSummary.js +1 -1
- package/esm/chart/pieChart/getDefaultDatasetStyle.js +8 -6
- package/esm/chart/plugins/linePlugin/getInterpolatedValue.js +1 -1
- package/esm/chart/plugins/linePlugin/linePlugin.js +16 -4
- package/esm/commonHelpers/hooks/useEscape.js +4 -0
- package/esm/commonHelpers/hooks/usePillSize.d.ts +2 -1
- package/esm/commonHelpers/hooks/usePillSize.js +6 -3
- package/esm/commonStyles/colors/colorsConstant.d.ts +6 -0
- package/esm/commonStyles/colors/colorsConstant.js +50 -0
- package/esm/dataFeed/dataFeed.d.ts +2 -1
- package/esm/dataFeed/dataFeed.js +18 -3
- package/esm/dataFeed/dataFeedColumnsItems.d.ts +2 -1
- package/esm/dataFeed/dataFeedColumnsItems.js +6 -4
- package/esm/dataGrid/cell/cell.d.ts +2 -1
- package/esm/dataGrid/cell/cell.js +2 -1
- package/esm/dataGrid/dataGrid.d.ts +3 -1
- package/esm/dataGrid/dataGrid.js +7 -2
- package/esm/dataGrid/row/row.d.ts +3 -1
- package/esm/dataGrid/row/row.js +3 -3
- package/esm/dataGrid/withFlexibleColumns/components/columnSettingsSidePanel.js +8 -4
- package/esm/divider/divider.d.ts +5 -5
- package/esm/divider/divider.js +6 -2
- package/esm/filtersBar/components/filtersBarPeriodPicker/filtersBarPeriodPicker.js +2 -2
- package/esm/footerButtons/footerButtons.d.ts +4 -0
- package/esm/footerButtons/footerButtons.js +4 -6
- package/esm/groupsFilterRaw/groupsFilterRaw.js +1 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.js +1 -0
- package/esm/lineChart/utils.js +2 -9
- package/esm/list/listItem/listItem.js +26 -0
- package/esm/mobileSheet/components/mobileSheetFooter.d.ts +1 -0
- package/esm/mobileSheet/components/mobileSheetFooter.js +1 -1
- package/esm/mobileSheet/mobileSheet.js +1 -1
- package/esm/pill/components/pillActionable/pillActionable.js +5 -4
- package/esm/pill/components/pillNonActionable/pillNonActionable.js +11 -5
- package/esm/pill/interfaces/pillActionable.interface.d.ts +1 -0
- package/esm/pill/interfaces/pillNonActionable.interface.d.ts +1 -0
- package/esm/pillExpandable/pillExpandable.js +6 -6
- package/esm/rangeRaw/rangeRaw.js +1 -0
- package/esm/selectRaw/selectRaw.js +6 -3
- package/esm/sidePanel/sidePanel.d.ts +1 -1
- package/esm/sidePanel/sidePanel.js +7 -3
- package/esm/table/children/tableDetailPanel.d.ts +9 -0
- package/esm/table/children/tableDetailPanel.js +2 -0
- package/esm/table/children/useTableChildren.d.ts +2 -1
- package/esm/table/children/useTableChildren.js +17 -2
- package/esm/table/detailPanel/detailPanel.d.ts +4 -0
- package/esm/table/detailPanel/detailPanel.js +131 -0
- package/esm/table/detailPanel/detailPanelHeader.d.ts +4 -0
- package/esm/table/detailPanel/detailPanelHeader.js +96 -0
- package/esm/table/detailPanel/interfaces.d.ts +8 -0
- package/esm/table/table.d.ts +6 -1
- package/esm/table/table.js +201 -61
- package/esm/utils/localization/translations/cs.json +3 -1
- package/esm/utils/localization/translations/da-DK.json +3 -1
- package/esm/utils/localization/translations/de.json +3 -1
- package/esm/utils/localization/translations/en-json.d.ts +315 -0
- package/esm/utils/localization/translations/en-json.js +315 -0
- package/esm/utils/localization/translations/en.json +5 -1
- package/esm/utils/localization/translations/es.json +3 -1
- package/esm/utils/localization/translations/fi-FI.json +3 -1
- package/esm/utils/localization/translations/fr-FR.json +3 -1
- package/esm/utils/localization/translations/fr.json +3 -1
- package/esm/utils/localization/translations/hu-HU.json +3 -1
- package/esm/utils/localization/translations/id.json +3 -1
- package/esm/utils/localization/translations/it.json +3 -1
- package/esm/utils/localization/translations/ja.json +3 -1
- package/esm/utils/localization/translations/ko-KR.json +3 -1
- package/esm/utils/localization/translations/ms.json +3 -1
- package/esm/utils/localization/translations/nb-NO.json +3 -1
- package/esm/utils/localization/translations/nl.json +3 -1
- package/esm/utils/localization/translations/pl.json +3 -1
- package/esm/utils/localization/translations/pt-BR.json +3 -1
- package/esm/utils/localization/translations/sk-SK.json +3 -1
- package/esm/utils/localization/translations/sv.json +3 -1
- package/esm/utils/localization/translations/th.json +3 -1
- package/esm/utils/localization/translations/tr.json +3 -1
- package/esm/utils/localization/translations/zh-Hans.json +3 -1
- package/esm/utils/localization/translations/zh-TW.json +3 -1
- package/package.json +10 -10
- package/dist/nav/storyHelpers/storyDecorator.d.ts +0 -35
- package/dist/nav/storyHelpers/storyDecorator.js +0 -79
- package/esm/nav/storyHelpers/storyDecorator.d.ts +0 -35
- package/esm/nav/storyHelpers/storyDecorator.js +0 -74
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/api/fetchEntities.d.ts +0 -3
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/api/fetchEntities.js +0 -32
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/api/gridModel.d.ts +0 -81
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/api/gridModel.js +0 -113
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/ColumnWaiting.d.ts +0 -4
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/ColumnWaiting.js +0 -4
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/EntitiesListAction.d.ts +0 -18
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/components/EntitiesListAction.js +0 -193
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/constants/index.d.ts +0 -1
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/constants/index.js +0 -1
- package/esm/storybookHelpers/dataGridWithDifferentCellOptions/interfaces/entity.d.ts +0 -7
- package/esm/storybookHelpers/fieldDelayRenderer.d.ts +0 -5
- package/esm/storybookHelpers/fieldDelayRenderer.js +0 -20
- package/esm/storybookHelpers/storyFeedbackProviderDecorator.d.ts +0 -2
- package/esm/storybookHelpers/storyFeedbackProviderDecorator.js +0 -16
- package/esm/storybookHelpers/storyGlobalWrapper.d.ts +0 -2
- package/esm/storybookHelpers/storyGlobalWrapper.js +0 -3
- package/esm/storybookHelpers/storyItem.d.ts +0 -8
- package/esm/storybookHelpers/storyItem.js +0 -17
- package/esm/storybookHelpers/storyLanguageDecorator.d.ts +0 -2
- package/esm/storybookHelpers/storyLanguageDecorator.js +0 -4
- package/esm/storybookHelpers/storyQueryClientProvider.d.ts +0 -2
- package/esm/storybookHelpers/storyQueryClientProvider.js +0 -15
- package/esm/storybookHelpers/storyThemeDecorator.d.ts +0 -2
- package/esm/storybookHelpers/storyThemeDecorator.js +0 -15
- package/esm/storybookHelpers/storyTopWindowDecorator.d.ts +0 -2
- package/esm/storybookHelpers/storyTopWindowDecorator.js +0 -4
- /package/esm/{storybookHelpers/dataGridWithDifferentCellOptions/interfaces/entity.js → table/detailPanel/interfaces.js} +0 -0
package/README.md
CHANGED
|
@@ -40,7 +40,31 @@ Zenith library provides components defined in Zenith Design System. It includes
|
|
|
40
40
|
|
|
41
41
|
## Change log
|
|
42
42
|
|
|
43
|
-
### 3.
|
|
43
|
+
### 3.3.0
|
|
44
|
+
|
|
45
|
+
**🎉 Introducing Detail Panel in Table**
|
|
46
|
+
|
|
47
|
+
Table just got more powerful with the new `DetailPanel` feature. When a row is clicked, a side panel appears with detailed information about that row. This keeps your table clean and focused while providing easy access to comprehensive details, metadata, or related content.
|
|
48
|
+
|
|
49
|
+
**Enhanced accessibility and polish**
|
|
50
|
+
|
|
51
|
+
This release includes numerous accessibility improvements and visual refinements to ensure a better experience for all users.
|
|
52
|
+
|
|
53
|
+
Change log:
|
|
54
|
+
|
|
55
|
+
* New `DetailPanel` feature in `Table` for expandable row details
|
|
56
|
+
* Fixed `Select` not closing on Escape key when inside `Modal`
|
|
57
|
+
* Fixed accessibility issues in `Table`, `Header`, and `Checkbox` components
|
|
58
|
+
* Improved button styles in `MobileSheet`
|
|
59
|
+
* Fixed `Chart` tooltip not displaying when value is 0
|
|
60
|
+
* Fixed shadow styling in `SummaryTile`
|
|
61
|
+
* Upgraded Storybook to version 10
|
|
62
|
+
* Updated default color palette in `Chart`
|
|
63
|
+
* Fixed rendering issue in `PillExpandable`
|
|
64
|
+
* Added support for two-line header text and toggle button in `Card`
|
|
65
|
+
* Added user title property to actionable `Pill`
|
|
66
|
+
|
|
67
|
+
### 3.2.1
|
|
44
68
|
|
|
45
69
|
**🎉 Form experience is here!**
|
|
46
70
|
|
package/dist/card/card.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { TooltipSize } from "../tooltip/tooltip";
|
|
|
10
10
|
import { IZenComponentProps, IZenFormLayoutItem, IZenGridItem } from "../commonHelpers/zenComponent";
|
|
11
11
|
import { ICardButton } from "./components/cardButton/cardButton";
|
|
12
12
|
import { IIcon } from "../icons/icon";
|
|
13
|
+
import { IToggleButton } from "../toggleButton/toggleButton";
|
|
13
14
|
export declare const DEFAULT_CARD_SIZE: TContainerSize;
|
|
14
15
|
export interface ICard extends IZenComponentProps, IZenGridItem, IZenFormLayoutItem {
|
|
15
16
|
size?: TContainerSize | IAbsoluteSize;
|
|
@@ -48,5 +49,7 @@ export declare const Card: FC<ICard> & {
|
|
|
48
49
|
Content: FC<IContent>;
|
|
49
50
|
} & {
|
|
50
51
|
Button: FC<ICardButton>;
|
|
52
|
+
} & {
|
|
53
|
+
Toggle: FC<IToggleButton>;
|
|
51
54
|
};
|
|
52
55
|
export declare const TRANSLATIONS: string[];
|
package/dist/card/card.js
CHANGED
|
@@ -92,13 +92,15 @@ const favoriteButton_1 = require("../favoriteButton/favoriteButton");
|
|
|
92
92
|
const getIconFromStatus_1 = require("./helpers/getIconFromStatus");
|
|
93
93
|
const getIconTypeFromStatus_1 = require("./helpers/getIconTypeFromStatus");
|
|
94
94
|
const isFormSection_1 = require("../formSection/utils/isFormSection");
|
|
95
|
-
|
|
95
|
+
const cardToggle_1 = require("./components/cardToggle/cardToggle");
|
|
96
|
+
const toggleButton_1 = require("../toggleButton/toggleButton");
|
|
96
97
|
exports.DEFAULT_CARD_SIZE = "S";
|
|
97
98
|
// eslint-disable-next-line @typescript-eslint/naming-convention, react/prop-types
|
|
98
99
|
const Card =
|
|
99
100
|
// eslint-disable-next-line complexity
|
|
100
101
|
props => {
|
|
101
102
|
const {
|
|
103
|
+
id,
|
|
102
104
|
size,
|
|
103
105
|
children,
|
|
104
106
|
title,
|
|
@@ -143,7 +145,8 @@ props => {
|
|
|
143
145
|
(0, useCardSize_1.useCardSize)(setCardSize, containerRef, (0, isAbsoluteSize_1.isAbsoluteSize)(size) ? (0, getContainerSize_1.getContainerSize)(size.width) : size || "S");
|
|
144
146
|
const {
|
|
145
147
|
actions,
|
|
146
|
-
content
|
|
148
|
+
content,
|
|
149
|
+
toggle
|
|
147
150
|
} = (0, react_1.useMemo)(() => {
|
|
148
151
|
if (!children) {
|
|
149
152
|
return {
|
|
@@ -154,6 +157,7 @@ props => {
|
|
|
154
157
|
if (Array.isArray(children)) {
|
|
155
158
|
const acts = [];
|
|
156
159
|
const cnt = [];
|
|
160
|
+
let tgl;
|
|
157
161
|
react_1.default.Children.forEach(children, el => {
|
|
158
162
|
if (!el) {
|
|
159
163
|
return;
|
|
@@ -174,10 +178,14 @@ props => {
|
|
|
174
178
|
if (el.type === exports.Card.Content || (0, isFormSection_1.isFormSection)(el)) {
|
|
175
179
|
cnt.push(el);
|
|
176
180
|
}
|
|
181
|
+
if (el.type === exports.Card.Toggle) {
|
|
182
|
+
tgl = el;
|
|
183
|
+
}
|
|
177
184
|
});
|
|
178
185
|
return {
|
|
179
186
|
actions: acts,
|
|
180
|
-
content: cnt
|
|
187
|
+
content: cnt,
|
|
188
|
+
toggle: tgl
|
|
181
189
|
};
|
|
182
190
|
}
|
|
183
191
|
return {
|
|
@@ -249,6 +257,7 @@ props => {
|
|
|
249
257
|
const isHeaderPrimaryVisible = title || icon || link || onClick || !!headerActions.length || date || !!favoriteButton || !!tooltip || !!menuActions.length;
|
|
250
258
|
const isHeaderVisible = isHeaderPrimaryVisible || secondary;
|
|
251
259
|
return (0, jsx_runtime_1.jsxs)(cardContainer_1.CardContainer, {
|
|
260
|
+
id: id,
|
|
252
261
|
isMobile: isMobile,
|
|
253
262
|
fullWidth: isFullWidth,
|
|
254
263
|
fullHeight: isFullHeight,
|
|
@@ -283,7 +292,7 @@ props => {
|
|
|
283
292
|
tooltip: tooltip,
|
|
284
293
|
tooltipAlignment: tooltipAlignment,
|
|
285
294
|
tooltipSize: tooltipSize
|
|
286
|
-
}), !!menuActions.length && (0, jsx_runtime_1.jsx)(menu_1.Menu, {
|
|
295
|
+
}), toggle ? (0, jsx_runtime_1.jsx)(toggleButton_1.ToggleButton, Object.assign({}, toggle.props)) : null, !!menuActions.length && (0, jsx_runtime_1.jsx)(menu_1.Menu, {
|
|
287
296
|
trigger: menuTrigger,
|
|
288
297
|
title: title || translate("Actions"),
|
|
289
298
|
children: menuActions.map((action, index) => {
|
|
@@ -310,4 +319,5 @@ exports.Card = Card;
|
|
|
310
319
|
exports.TRANSLATIONS = ["Actions"];
|
|
311
320
|
exports.Card.Actions = actions_1.Actions;
|
|
312
321
|
exports.Card.Content = content_1.Content;
|
|
313
|
-
exports.Card.Button = cardButton_1.CardButton;
|
|
322
|
+
exports.Card.Button = cardButton_1.CardButton;
|
|
323
|
+
exports.Card.Toggle = cardToggle_1.CardToggle;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CardToggle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const toggleButtonRaw_1 = require("../../../toggleButtonRaw/toggleButtonRaw");
|
|
6
|
+
const CardToggle = (props) => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(toggleButtonRaw_1.ToggleButtonRaw, Object.assign({}, props)) });
|
|
7
|
+
exports.CardToggle = CardToggle;
|
|
@@ -15,12 +15,12 @@ const Title = ({ isMobile, link, target, title, id, icon, iconType, className =
|
|
|
15
15
|
const iconElement = (0, react_1.useMemo)(() => icon
|
|
16
16
|
? (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-card-title__icon", iconClassName]), children: (0, react_1.createElement)(icon, { size: iconSize }) })
|
|
17
17
|
: null, [icon, iconSize, iconClassName]);
|
|
18
|
-
const chevron = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)("
|
|
18
|
+
const chevron = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)("span", { className: "zen-card-title__link-chevron", children: (0, jsx_runtime_1.jsx)(iconChevronRightSmall_1.IconChevronRightSmall, { size: iconSize, className: "zen-card-title__chevron-icon" }) }), [iconSize]);
|
|
19
19
|
const roleProp = onClick ? "button" : undefined;
|
|
20
20
|
const tabIndexProp = onClick ? 0 : undefined;
|
|
21
21
|
const titleClasses = (0, classNames_1.classNames)(["zen-card-title", driveClassNames || "", onClick ? "zen-card-title__clickable" : ""]);
|
|
22
22
|
return (0, jsx_runtime_1.jsxs)("div", { className: titleClasses, role: roleProp, onClick: onClick, tabIndex: tabIndexProp, children: [iconElement, link && !onClick
|
|
23
|
-
? (0, jsx_runtime_1.
|
|
24
|
-
: (0, jsx_runtime_1.
|
|
23
|
+
? (0, jsx_runtime_1.jsx)("a", { id: id, className: (0, classNames_1.classNames)(["zen-card-title__link"]), href: link, target: target, children: (0, jsx_runtime_1.jsxs)("span", { title: title, className: (0, classNames_1.classNames)(["zen-card-title__link-text"]), children: [title, chevron] }) })
|
|
24
|
+
: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("span", { title: title, id: id, className: (0, classNames_1.classNames)(["zen-card-title__text", (isMobile && !isDrive) ? "zen-card-title__text--mobile" : "", className]), children: [title, onClick ? chevron : null] }) })] });
|
|
25
25
|
};
|
|
26
26
|
exports.Title = Title;
|
|
@@ -13,6 +13,7 @@ export interface ICardContainer extends IZenComponentProps, IZenGridItem {
|
|
|
13
13
|
autoHeight?: boolean;
|
|
14
14
|
scrollable?: boolean;
|
|
15
15
|
isMobile?: boolean;
|
|
16
|
+
noWidthConstraint?: boolean;
|
|
16
17
|
ref?: RefObject<HTMLDivElement | null>;
|
|
17
18
|
}
|
|
18
|
-
export declare const CardContainer: ({ size, children, fullWidth, className, isMobile, fullHeight, autoHeight, scrollable, ref }: ICardContainer) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const CardContainer: ({ id, size, children, fullWidth, className, isMobile, fullHeight, autoHeight, scrollable, noWidthConstraint, ref }: ICardContainer) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,7 +7,7 @@ const isAbsoluteSize_1 = require("./helpers/isAbsoluteSize");
|
|
|
7
7
|
const classNames_1 = require("../commonHelpers/classNames/classNames");
|
|
8
8
|
const getSizeClass_1 = require("./helpers/getSizeClass");
|
|
9
9
|
const useAbsoluteSize_1 = require("./hooks/useAbsoluteSize");
|
|
10
|
-
const CardContainer = ({ size, children, fullWidth = false, className = "", isMobile = false, fullHeight = false, autoHeight = false, scrollable = true, ref }) => {
|
|
10
|
+
const CardContainer = ({ id, size, children, fullWidth = false, className = "", isMobile = false, fullHeight = false, autoHeight = false, scrollable = true, noWidthConstraint = false, ref }) => {
|
|
11
11
|
const isDesktop = !isMobile;
|
|
12
12
|
const isAbsolute = (0, isAbsoluteSize_1.isAbsoluteSize)(size);
|
|
13
13
|
const containerClassNames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)([
|
|
@@ -18,9 +18,10 @@ const CardContainer = ({ size, children, fullWidth = false, className = "", isMo
|
|
|
18
18
|
fullHeight ? "zen-card-container--full-height" : "",
|
|
19
19
|
autoHeight ? "zen-card-container--auto-height" : "",
|
|
20
20
|
scrollable ? "zen-card-container--scrollable" : "",
|
|
21
|
+
noWidthConstraint ? "zen-card-container--no-width-constraint" : "",
|
|
21
22
|
className
|
|
22
|
-
]), [size, fullWidth, className, isMobile, isDesktop, isAbsolute, fullHeight, autoHeight, scrollable]);
|
|
23
|
+
]), [size, fullWidth, className, isMobile, isDesktop, isAbsolute, fullHeight, autoHeight, scrollable, noWidthConstraint]);
|
|
23
24
|
const style = (0, useAbsoluteSize_1.useAbsoluteSize)(size, isMobile, autoHeight, fullWidth);
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, style: style, className: containerClassNames, children: children }));
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)("div", { id: id, ref: ref, style: style, className: containerClassNames, children: children }));
|
|
25
26
|
};
|
|
26
27
|
exports.CardContainer = CardContainer;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDefaultDatasetStyle = void 0;
|
|
4
4
|
const baseColors = [
|
|
5
|
-
"#
|
|
6
|
-
"#
|
|
7
|
-
"#
|
|
8
|
-
"#
|
|
9
|
-
"#
|
|
10
|
-
"#
|
|
5
|
+
"#3CCDE5",
|
|
6
|
+
"#428AFF",
|
|
7
|
+
"#8256E5",
|
|
8
|
+
"#06C989",
|
|
9
|
+
"#F98C41",
|
|
10
|
+
"#F5BD60",
|
|
11
|
+
"#E56A6A",
|
|
12
|
+
"#8A94A2"
|
|
11
13
|
];
|
|
12
14
|
const getDefaultDatasetStyle = (dataSet, dsIndex) => {
|
|
13
15
|
var _a, _b;
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDatasetColor = void 0;
|
|
4
4
|
const baseColors = [
|
|
5
|
-
"#
|
|
6
|
-
"#
|
|
7
|
-
"#
|
|
8
|
-
"#
|
|
9
|
-
"#
|
|
10
|
-
"#
|
|
5
|
+
"#3CCDE5",
|
|
6
|
+
"#428AFF",
|
|
7
|
+
"#8256E5",
|
|
8
|
+
"#06C989",
|
|
9
|
+
"#F98C41",
|
|
10
|
+
"#F5BD60",
|
|
11
|
+
"#E56A6A",
|
|
12
|
+
"#8A94A2"
|
|
11
13
|
];
|
|
12
14
|
const getDatasetColor = (index) => baseColors[index % baseColors.length];
|
|
13
15
|
exports.getDatasetColor = getDatasetColor;
|
|
@@ -51,7 +51,7 @@ const useSummary = (chartSummary, data) => {
|
|
|
51
51
|
}
|
|
52
52
|
return data.datasets[0] && typeof data.datasets[0].borderColor === "string"
|
|
53
53
|
? data.datasets[0].borderColor
|
|
54
|
-
: (summary && summary.title) ? "#
|
|
54
|
+
: (summary && summary.title) ? "#3CCDE5" : undefined;
|
|
55
55
|
}, [data.datasets, summary]);
|
|
56
56
|
const title = (0, react_1.useMemo)(() => {
|
|
57
57
|
if (summary && summary.title) {
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDefaultDatasetStyle = void 0;
|
|
4
4
|
const baseColors = [
|
|
5
|
-
"#
|
|
6
|
-
"#
|
|
7
|
-
"#
|
|
8
|
-
"#
|
|
9
|
-
"#
|
|
10
|
-
"#
|
|
5
|
+
"#3CCDE5",
|
|
6
|
+
"#428AFF",
|
|
7
|
+
"#8256E5",
|
|
8
|
+
"#06C989",
|
|
9
|
+
"#F98C41",
|
|
10
|
+
"#F5BD60",
|
|
11
|
+
"#E56A6A",
|
|
12
|
+
"#8A94A2"
|
|
11
13
|
];
|
|
12
14
|
const getDefaultDatasetStyle = (dataSet) => {
|
|
13
15
|
const newDataSet = Object.assign({}, dataSet);
|
|
@@ -28,7 +28,7 @@ function getInterpolatedValue(xScale, data, datasetIndex, xPixel) {
|
|
|
28
28
|
upperXPixel = pointXPixel;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
if (
|
|
31
|
+
if (lowerPoint === undefined || upperPoint === undefined) {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
// Perform linear interpolation
|
|
@@ -68,13 +68,13 @@ const LinePlugin = (containerId, options, isDark) => ({
|
|
|
68
68
|
const yAxisID = dataset.yAxisID || "y";
|
|
69
69
|
const yScale = chart.scales[yAxisID];
|
|
70
70
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
71
|
-
if (value && yScale) {
|
|
71
|
+
if (value !== null && yScale) {
|
|
72
72
|
const lowestDsY = yScale.getPixelForValue(value);
|
|
73
73
|
if (lowestDsY < lowestValueY) {
|
|
74
74
|
lowestValueY = lowestDsY;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
if (value && dataset.label) {
|
|
77
|
+
if (value !== null && dataset.label) {
|
|
78
78
|
const label = dataset.label;
|
|
79
79
|
const color = dataset.borderColor;
|
|
80
80
|
const item = {
|
|
@@ -96,8 +96,20 @@ const LinePlugin = (containerId, options, isDark) => ({
|
|
|
96
96
|
const scrollableParent = (0, getScrollableParent_1.getScrollableParent)(chart.canvas);
|
|
97
97
|
const scrollTop = scrollableParent ? scrollableParent.scrollTop : 0;
|
|
98
98
|
const scrollLeft = scrollableParent ? scrollableParent.scrollLeft : 0;
|
|
99
|
-
|
|
100
|
-
const
|
|
99
|
+
let elementIdx = undefined;
|
|
100
|
+
const elementIds = new Set(chart.getActiveElements().map(el => el.index));
|
|
101
|
+
if (elementIds.size === 1) {
|
|
102
|
+
elementIdx = [...elementIds][0];
|
|
103
|
+
}
|
|
104
|
+
let xLabel;
|
|
105
|
+
const scaleLabels = chart.scales.x.getLabels();
|
|
106
|
+
if (elementIdx !== undefined && elementIdx < scaleLabels.length) {
|
|
107
|
+
xLabel = scaleLabels[elementIdx];
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
const xValue = chart.scales.x.getValueForPixel(x);
|
|
111
|
+
xLabel = xValue ? chart.scales.x.getLabelForValue(xValue) : undefined;
|
|
112
|
+
}
|
|
101
113
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
102
114
|
(0, renderTooltip_1.renderTooltip)(containerId, left + scrollLeft, top + scrollTop, "top", items, options === null || options === void 0 ? void 0 : options.title, options && options.subtitle !== undefined ? options.subtitle : xLabel, (options === null || options === void 0 ? void 0 : options.note) || undefined, isDark);
|
|
103
115
|
}
|
|
@@ -8,6 +8,9 @@ const useKeydown_1 = require("./useKeydown");
|
|
|
8
8
|
const useEscape = (containerRef, callback, subscriptionTrigger, condition) => {
|
|
9
9
|
const handleKeyDown = (0, react_1.useCallback)((e) => {
|
|
10
10
|
if (e.key === "Escape") {
|
|
11
|
+
if (e.defaultPrevented) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
11
14
|
const target = e.target;
|
|
12
15
|
if (!target || !containerRef.current) {
|
|
13
16
|
return;
|
|
@@ -16,6 +19,7 @@ const useEscape = (containerRef, callback, subscriptionTrigger, condition) => {
|
|
|
16
19
|
const focusable = containerRef.current.querySelectorAll(focusableSelector_1.FOCUSABLE_SELECTOR);
|
|
17
20
|
if (isPopupFocused || !focusable.length) {
|
|
18
21
|
callback(e);
|
|
22
|
+
e.preventDefault();
|
|
19
23
|
return;
|
|
20
24
|
}
|
|
21
25
|
}
|
|
@@ -4,8 +4,9 @@ import { IPillNonActionable } from "../../pill/interfaces/pillNonActionable.inte
|
|
|
4
4
|
interface IPillSize extends Pick<IPill, "size">, Pick<IPillNonActionable, "onClose"> {
|
|
5
5
|
iconPosition?: "left" | "right";
|
|
6
6
|
hasContent?: boolean;
|
|
7
|
+
initialTitle?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare const usePillSize: ({ size, iconPosition, onClose, hasContent }: IPillSize) => {
|
|
9
|
+
export declare const usePillSize: ({ size, iconPosition, onClose, hasContent, initialTitle }: IPillSize) => {
|
|
9
10
|
contentClasses: string;
|
|
10
11
|
ref: import("react").RefObject<HTMLElement | null>;
|
|
11
12
|
title: string;
|
|
@@ -6,13 +6,13 @@ const classNames_1 = require("../classNames/classNames");
|
|
|
6
6
|
const useResize_1 = require("./useResize");
|
|
7
7
|
const useDriveClassName_1 = require("../../utils/theme/useDriveClassName");
|
|
8
8
|
const PILL_WIDTH_WITHOUT_CONTENT = 64;
|
|
9
|
-
const usePillSize = ({ size, iconPosition, onClose, hasContent }) => {
|
|
9
|
+
const usePillSize = ({ size, iconPosition, onClose, hasContent, initialTitle }) => {
|
|
10
10
|
const isFixedSize = size && size !== "default" && size !== "fullWidth";
|
|
11
11
|
const hasIcon = !!iconPosition;
|
|
12
12
|
const isClosable = !!onClose;
|
|
13
13
|
const [isContentHidden, setIsContentHidden] = (0, react_1.useState)(false);
|
|
14
14
|
const ref = (0, react_1.useRef)(null);
|
|
15
|
-
const [title, setTitle] = (0, react_1.useState)("");
|
|
15
|
+
const [title, setTitle] = (0, react_1.useState)(initialTitle || "");
|
|
16
16
|
const driveClass = (0, useDriveClassName_1.useDriveClassName)("zen-pill-new-content");
|
|
17
17
|
const contentClasses = (0, classNames_1.classNames)([
|
|
18
18
|
"zen-pill-new-content",
|
|
@@ -41,6 +41,9 @@ const usePillSize = ({ size, iconPosition, onClose, hasContent }) => {
|
|
|
41
41
|
hidePillContent();
|
|
42
42
|
}, true);
|
|
43
43
|
(0, react_1.useLayoutEffect)(() => {
|
|
44
|
+
if (initialTitle) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
44
47
|
if (ref.current) {
|
|
45
48
|
setTitle(ref.current.textContent || "");
|
|
46
49
|
}
|
|
@@ -48,7 +51,7 @@ const usePillSize = ({ size, iconPosition, onClose, hasContent }) => {
|
|
|
48
51
|
return;
|
|
49
52
|
}
|
|
50
53
|
hidePillContent();
|
|
51
|
-
}, [hidePillContent, isFixedSize, isClosable, hasIcon]);
|
|
54
|
+
}, [hidePillContent, isFixedSize, isClosable, hasIcon, initialTitle]);
|
|
52
55
|
return { contentClasses, ref, title, isFixedSize, isTextContentHidden: isContentHidden && isClosable && hasIcon };
|
|
53
56
|
};
|
|
54
57
|
exports.usePillSize = usePillSize;
|
|
@@ -71,6 +71,15 @@
|
|
|
71
71
|
--duty-status-rest: #FE6867;
|
|
72
72
|
--duty-status-drive: #49C649;
|
|
73
73
|
--duty-status-exemption: #4E677E;
|
|
74
|
+
|
|
75
|
+
--data--categorical-light-blue: #3CCDE5;
|
|
76
|
+
--data--categorical-blue: #428AFF;
|
|
77
|
+
--data--categorical-purple: #8256E5;
|
|
78
|
+
--data--categorical-green: #06C989;
|
|
79
|
+
--data--categorical-orange: #F98C41;
|
|
80
|
+
--data--categorical-yellow: #F5BD60;
|
|
81
|
+
--data--categorical-red: #E56A6A;
|
|
82
|
+
--data--categorical-grey: #8A94A2;
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
.zen-dark {
|
|
@@ -26,10 +26,11 @@ export interface IDataFeed<T, N = T> extends IDataGrid<T, N> {
|
|
|
26
26
|
expandedRows?: string[];
|
|
27
27
|
onExpandedChange?: (id: string, isExpanded: boolean) => void;
|
|
28
28
|
activePage?: number;
|
|
29
|
+
onClick?: (id: string) => void;
|
|
29
30
|
}
|
|
30
31
|
declare const EmptyList: FC<PropsWithChildren>;
|
|
31
32
|
declare const Footer: FC<PropsWithChildren>;
|
|
32
|
-
declare const DataFeedInner: <T extends IRowEntity<N>, N extends IEntityWithId>({ entities, columns, feedWrappers, className, expanded, options, description, children, actions, actionsAsync, primaryActions, itemsPerPage, rowClassName, expandedRows, onExpandedChange, activePage }: IDataFeed<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
declare const DataFeedInner: <T extends IRowEntity<N>, N extends IEntityWithId>({ entities, columns, feedWrappers, className, expanded, options, description, children, actions, actionsAsync, primaryActions, itemsPerPage, rowClassName, expandedRows, onExpandedChange, activePage, onClick }: IDataFeed<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
|
|
33
34
|
export interface IDataFeedStaticProps {
|
|
34
35
|
EmptyList: typeof EmptyList;
|
|
35
36
|
Footer: typeof Footer;
|
|
@@ -22,7 +22,7 @@ const checkCloseToTheEnd = (feedContainerElt) => {
|
|
|
22
22
|
return distanceToTheBottom < endOfFeedThreshold;
|
|
23
23
|
};
|
|
24
24
|
const FIRST_RENDERED_ROWS = 50;
|
|
25
|
-
const DataFeedInner = ({ entities, columns, feedWrappers, className, expanded, options, description, children, actions, actionsAsync, primaryActions, itemsPerPage = 1000, rowClassName, expandedRows, onExpandedChange, activePage }, ref) => {
|
|
25
|
+
const DataFeedInner = ({ entities, columns, feedWrappers, className, expanded, options, description, children, actions, actionsAsync, primaryActions, itemsPerPage = 1000, rowClassName, expandedRows, onExpandedChange, activePage, onClick }, ref) => {
|
|
26
26
|
const [pages, setPages] = (0, react_1.useState)(1);
|
|
27
27
|
const data = (0, react_1.useMemo)(() => entities.slice(0, itemsPerPage * pages), [entities, itemsPerPage, pages]);
|
|
28
28
|
const initialVisibleRows = (0, react_1.useMemo)(() => data.slice(0, FIRST_RENDERED_ROWS).map(r => r.id), [data]);
|
|
@@ -94,8 +94,23 @@ const DataFeedInner = ({ entities, columns, feedWrappers, className, expanded, o
|
|
|
94
94
|
}, true);
|
|
95
95
|
const feedItems = (0, react_1.useMemo)(() => data.map((entity, index) => {
|
|
96
96
|
const entityClassName = (0, getRowClassName_1.getRowClassName)(rowClassName, entity);
|
|
97
|
-
return (0, jsx_runtime_1.jsx)(dataFeedColumnsItems_1.FeedItem, { collapsedColumnsQty: collapsedColumnsQty, columnsList: columnsList, feedWrappers: feedWrappers || [], visibleColumns: visibleColumns, entity: entity, visibleRows: visibleRows, index: index, expanded: expanded, className: entityClassName, actions: actions, actionsAsync: actionsAsync, primaryActions: primaryActions, isRowExpanded: expandedRows && expandedRows.indexOf(entity.id) > -1, onExpandedChange: (isExpanded) => onExpandedChange && onExpandedChange(entity.id, isExpanded) }, entity.id);
|
|
98
|
-
}), [
|
|
97
|
+
return (0, jsx_runtime_1.jsx)(dataFeedColumnsItems_1.FeedItem, { collapsedColumnsQty: collapsedColumnsQty, columnsList: columnsList, feedWrappers: feedWrappers || [], visibleColumns: visibleColumns, entity: entity, visibleRows: visibleRows, index: index, expanded: expanded, className: entityClassName, actions: actions, actionsAsync: actionsAsync, primaryActions: primaryActions, isRowExpanded: expandedRows && expandedRows.indexOf(entity.id) > -1, onExpandedChange: (isExpanded) => onExpandedChange && onExpandedChange(entity.id, isExpanded), onClick: onClick }, entity.id);
|
|
98
|
+
}), [
|
|
99
|
+
data,
|
|
100
|
+
rowClassName,
|
|
101
|
+
collapsedColumnsQty,
|
|
102
|
+
columnsList,
|
|
103
|
+
feedWrappers,
|
|
104
|
+
visibleColumns,
|
|
105
|
+
visibleRows,
|
|
106
|
+
expanded,
|
|
107
|
+
actions,
|
|
108
|
+
actionsAsync,
|
|
109
|
+
primaryActions,
|
|
110
|
+
expandedRows,
|
|
111
|
+
onExpandedChange,
|
|
112
|
+
onClick
|
|
113
|
+
]);
|
|
99
114
|
return (0, jsx_runtime_1.jsx)("div", { className: "zen-data-grid-wrapper", children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)([
|
|
100
115
|
"zen-data-grid",
|
|
101
116
|
className || ""
|
|
@@ -23,6 +23,7 @@ interface IFeedItem<T extends IRowEntity<N>, N extends IEntityWithId> {
|
|
|
23
23
|
actions?: IActionWithId<T> | ((entity: T, isNested: boolean) => React.JSX.Element);
|
|
24
24
|
actionsAsync?: IActionWithId<T> | ((entity: T, isNested: boolean) => PromiseLike<React.JSX.Element>);
|
|
25
25
|
primaryActions?: IActionWithId<T>[] | ((e: T, isNested: boolean) => IActionWithId<T>[]);
|
|
26
|
+
onClick?: (id: string) => void;
|
|
26
27
|
}
|
|
27
|
-
export declare const FeedItem: <T extends IRowEntity<N>, N extends IEntityWithId>({ columnsList, feedWrappers, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, className, isRowExpanded, onExpandedChange, actions, actionsAsync, primaryActions }: IFeedItem<T, N>) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const FeedItem: <T extends IRowEntity<N>, N extends IEntityWithId>({ columnsList, feedWrappers, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, className, isRowExpanded, onExpandedChange, actions, actionsAsync, primaryActions, onClick }: IFeedItem<T, N>) => import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export {};
|
|
@@ -16,7 +16,7 @@ const getIconFromColumnComponent = (column, entity, isNested) => {
|
|
|
16
16
|
}
|
|
17
17
|
return null;
|
|
18
18
|
};
|
|
19
|
-
const FeedItemInner = ({ columnsList, feedWrappers, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, className = "", isRowExpanded, onExpandedChange, actions, actionsAsync, primaryActions }) => {
|
|
19
|
+
const FeedItemInner = ({ columnsList, feedWrappers, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, className = "", isRowExpanded, onExpandedChange, actions, actionsAsync, primaryActions, onClick }) => {
|
|
20
20
|
const { mainColumns, secondaryColumns } = (0, useVisibleColumns_1.useVisibleColumns)(columnsList, expanded, { visibleColumns, collapsedColumnsQty });
|
|
21
21
|
const mainColumnsMemoized = (0, react_1.useMemo)(() => mainColumns, [mainColumns]);
|
|
22
22
|
const secondaryColumnsMemoized = (0, react_1.useMemo)(() => secondaryColumns, [secondaryColumns]);
|
|
@@ -100,15 +100,17 @@ const FeedItemInner = ({ columnsList, feedWrappers, expanded, collapsedColumnsQt
|
|
|
100
100
|
const feedPlaceholder = getFeedPlaceholder(column);
|
|
101
101
|
return (0, jsx_runtime_1.jsx)(dataFeedCell_1.DataFeedCell, { limited: false, visibleOnHover: false, isVisible: isVisible, title: column.title, render: renderFeed, renderWrappers: renderWrappers, renderPlaceholder: feedPlaceholder, defaultValue: column.meta.defaultValue, entity: rowEntity, isNested: !nested }, `${entity.id}-${column.id}`);
|
|
102
102
|
});
|
|
103
|
-
const onItemClick = nested && onExpandedChange
|
|
103
|
+
const onItemClick = nested && nested.length > 0 && onExpandedChange
|
|
104
104
|
? () => onExpandedChange(!isRowExpanded)
|
|
105
|
-
:
|
|
105
|
+
: onClick
|
|
106
|
+
? () => onClick(entity.id)
|
|
107
|
+
: undefined;
|
|
106
108
|
const icon = getIconFromColumnComponent(mainColumnsMemoized[0], rowEntity, !nested);
|
|
107
109
|
const actionsNode = getActions();
|
|
108
110
|
const renderFeedWrappers = getRenderFeedWrappers(feedWrappers, rowEntity, !nested);
|
|
109
111
|
const key = !nested ? `nested_${rowEntity.id}` : rowEntity.id;
|
|
110
112
|
return (0, jsx_runtime_1.jsx)(feedItem_1.DataFeedItem, { id: entity.id, index: index, onClick: onItemClick, className: className, icon: icon, identifier: mainColumnsData[0], primaryData: mainColumnsData.slice(1), secondaryData: secondaryColumnsData, actions: actionsNode, nestedData: nested && nested.length ? nested : undefined, renderFeedWrappers: renderFeedWrappers }, key);
|
|
111
|
-
}, [className, feedWrappers, index, isRowExpanded, isVisible, mainColumnsMemoized, onExpandedChange, secondaryColumnsMemoized, actions, actionsAsync, primaryActions, entity]);
|
|
113
|
+
}, [className, feedWrappers, index, isRowExpanded, isVisible, mainColumnsMemoized, onExpandedChange, secondaryColumnsMemoized, actions, actionsAsync, primaryActions, entity, onClick]);
|
|
112
114
|
const nestedCells = (0, react_1.useMemo)(() => (entity.children && isRowExpanded ? entity.children : []).map(nestedEntity => renderCells(nestedEntity)), [entity.children, isRowExpanded, renderCells]);
|
|
113
115
|
const cells = (0, react_1.useMemo)(() => renderCells(entity, nestedCells), [entity, nestedCells, renderCells]);
|
|
114
116
|
return cells;
|
|
@@ -15,5 +15,6 @@ export interface IDataGridCell<T extends IEntityWithId> extends IZenComponentPro
|
|
|
15
15
|
width?: number;
|
|
16
16
|
colspan?: number;
|
|
17
17
|
onClick?: () => void;
|
|
18
|
+
isActive?: boolean;
|
|
18
19
|
}
|
|
19
|
-
export declare const DataGridCell: <T extends IEntityWithId>({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick }: IDataGridCell<T>) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const DataGridCell: <T extends IEntityWithId>({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }: IDataGridCell<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
7
7
|
const basicColumn_1 = require("../columns/basicColumn");
|
|
8
8
|
const isActiveElement_1 = require("../../list/utils/isActiveElement");
|
|
9
|
-
const Cell = ({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick }) => {
|
|
9
|
+
const Cell = ({ index, limited, visibleOnHover, isVisible, width, render, renderWrappers, renderPlaceholder, defaultValue, entity, colspan, className, onClick, isActive }) => {
|
|
10
10
|
const [content, setContent] = (0, react_1.useState)("");
|
|
11
11
|
const placeholderRenderer = (0, react_1.useCallback)(() => {
|
|
12
12
|
const renderFn = renderPlaceholder || (() => "...");
|
|
@@ -59,6 +59,7 @@ const Cell = ({ index, limited, visibleOnHover, isVisible, width, render, render
|
|
|
59
59
|
}, [onClick]);
|
|
60
60
|
return (0, jsx_runtime_1.jsx)("td", { colSpan: colspan, onClick: onCellClick, className: (0, classNames_1.classNames)([
|
|
61
61
|
"zen-data-grid__row-cell",
|
|
62
|
+
isActive ? "zen-data-grid__row-cell--active" : "",
|
|
62
63
|
className || "",
|
|
63
64
|
index === 0 ? "zen-data-grid__row-cell--first" : "",
|
|
64
65
|
visibleOnHover ? "zen-data-grid__row-cell--visible-on-hover" : "",
|
|
@@ -15,6 +15,8 @@ export interface IDataGrid<T, N = T> extends Omit<IZenComponentProps, "children"
|
|
|
15
15
|
rowClassName?: TRowClassName<T>;
|
|
16
16
|
expandedRows?: string[];
|
|
17
17
|
onExpandedChange?: (id: string, isExpanded: boolean) => void;
|
|
18
|
+
active?: string | undefined;
|
|
19
|
+
onClick?: (id: string) => void;
|
|
18
20
|
}
|
|
19
21
|
export declare const NOT_INTERACTIVE_MODIFIER = "zen-data-grid--not-interactive";
|
|
20
22
|
export declare const DRAGGING_MODIFIER = "zen-data-grid--dragging";
|
|
@@ -23,7 +25,7 @@ export declare const VERTICAL_SCROLL_MODIFIER = "zen-data-grid--vertical-scroll"
|
|
|
23
25
|
export declare const MIN_CELL_WIDTH = 100;
|
|
24
26
|
export declare const EmptyList: FC<PropsWithChildren>;
|
|
25
27
|
export declare const Footer: FC<PropsWithChildren>;
|
|
26
|
-
declare const DataGridInner: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ entities, columns, className, description, emptyCellTitle, children, rowClassName, expandedRows, onExpandedChange }: IDataGrid<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare const DataGridInner: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ entities, columns, className, description, emptyCellTitle, children, rowClassName, expandedRows, onExpandedChange, active, onClick }: IDataGrid<T, N>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
export interface IDataGridStaticProps {
|
|
28
30
|
EmptyList: typeof EmptyList;
|
|
29
31
|
Footer: typeof Footer;
|
|
@@ -73,7 +73,9 @@ const DataGridInner = ({
|
|
|
73
73
|
children,
|
|
74
74
|
rowClassName,
|
|
75
75
|
expandedRows,
|
|
76
|
-
onExpandedChange
|
|
76
|
+
onExpandedChange,
|
|
77
|
+
active,
|
|
78
|
+
onClick
|
|
77
79
|
}, ref) => {
|
|
78
80
|
const {
|
|
79
81
|
translate
|
|
@@ -214,10 +216,12 @@ const DataGridInner = ({
|
|
|
214
216
|
className: (0, getRowClassName_1.getRowClassName)(rowClassName, entity),
|
|
215
217
|
expanded: expandedRows && expandedRows.indexOf(entity.id) > -1,
|
|
216
218
|
onExpandedChange: entity.children && entity.children.length > 0 ? isExpanded => onExpandedChange && onExpandedChange(entity.id, isExpanded) : undefined,
|
|
219
|
+
isActive: active === entity.id,
|
|
220
|
+
onClick: onClick,
|
|
217
221
|
isTreeGrid: isTreeGrid,
|
|
218
222
|
ariaPosinset: entityIndex + 1,
|
|
219
223
|
ariaSetsize: total
|
|
220
|
-
}, entity.id), [columnsList, expandedRows, flexibleColumnWidth, onExpandedChange, rowClassName, visibleRows, isTreeGrid]);
|
|
224
|
+
}, entity.id), [columnsList, expandedRows, flexibleColumnWidth, onExpandedChange, rowClassName, visibleRows, isTreeGrid, active, onClick]);
|
|
221
225
|
const body = (0, react_1.useMemo)(() => entities.map((entity, entityIndex) => renderRow(entity, entityIndex, entities.length)), [entities, renderRow]);
|
|
222
226
|
const headerContent = (0, react_1.useMemo)(() => columnsList.map((column, index) => renderHeaderCell(column, index)), [columnsList, renderHeaderCell]);
|
|
223
227
|
(0, useResize_1.useResize)(() => {
|
|
@@ -230,6 +234,7 @@ const DataGridInner = ({
|
|
|
230
234
|
className: gridClasses,
|
|
231
235
|
ref: gridRef,
|
|
232
236
|
onScroll: handleScroll,
|
|
237
|
+
tabIndex: 0,
|
|
233
238
|
children: [(0, jsx_runtime_1.jsxs)("table", {
|
|
234
239
|
className: "zen-data-grid__table",
|
|
235
240
|
"aria-label": description,
|
|
@@ -15,6 +15,8 @@ export interface IDataGridRow<T extends IRowEntity<N>, N extends IEntityWithId>
|
|
|
15
15
|
isTreeGrid: boolean;
|
|
16
16
|
ariaPosinset: number;
|
|
17
17
|
ariaSetsize: number;
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
onClick?: (id: string) => void;
|
|
18
20
|
}
|
|
19
21
|
export declare const MIN_CELL_WIDTH = 100;
|
|
20
|
-
export declare const DataGridRow: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize }: IDataGridRow<T, N>) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const DataGridRow: <T extends IRowEntity<N>, N extends IEntityWithId = T>({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize, onClick, isActive }: IDataGridRow<T, N>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/dataGrid/row/row.js
CHANGED
|
@@ -7,7 +7,7 @@ const classNames_1 = require("../../commonHelpers/classNames/classNames");
|
|
|
7
7
|
const cell_1 = require("../cell/cell");
|
|
8
8
|
exports.MIN_CELL_WIDTH = 100;
|
|
9
9
|
const getColumnWidth = (defaultWidth) => Math.floor(Math.max(defaultWidth, exports.MIN_CELL_WIDTH));
|
|
10
|
-
const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize }) => {
|
|
10
|
+
const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow, className, expanded, onExpandedChange, isTreeGrid, ariaPosinset, ariaSetsize, onClick, isActive }) => {
|
|
11
11
|
const isVisible = visibleRows.has(entity.id);
|
|
12
12
|
const listOfDefaultWidthColumns = (0, react_1.useMemo)(() => columns.map(column => column.meta.defaultWidth), [columns]);
|
|
13
13
|
const getColWidth = (0, react_1.useCallback)((columnIndex, colspan) => {
|
|
@@ -56,9 +56,9 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
|
|
|
56
56
|
? column.columnComponent.renderNested.bind(column.columnComponent)
|
|
57
57
|
: column.columnComponent.render.bind(column.columnComponent))
|
|
58
58
|
: column.columnComponent.render.bind(column.columnComponent);
|
|
59
|
-
acc.cells.push((0, jsx_runtime_1.jsx)(cell_1.DataGridCell, { render: (e) => renderFn(e, isNested), renderPlaceholder: column.meta.renderPlaceholder, renderWrappers: renderWrappers, defaultValue: column.meta.defaultValue, entity: rowEntity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: column.meta.visibleOnHover ? 0 : width, isVisible: isVisible, colspan: colspan, onClick: !isNested && onExpandedChange ? () => onExpandedChange(!expanded) : undefined, className: isNested ? "zen-data-grid__row-cell--nested" : "" }, `${rowEntity.id}_${column.name}`));
|
|
59
|
+
acc.cells.push((0, jsx_runtime_1.jsx)(cell_1.DataGridCell, { render: (e) => renderFn(e, isNested), renderPlaceholder: column.meta.renderPlaceholder, renderWrappers: renderWrappers, defaultValue: column.meta.defaultValue, entity: rowEntity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: column.meta.visibleOnHover ? 0 : width, isVisible: isVisible, colspan: colspan, onClick: !isNested && onExpandedChange ? () => onExpandedChange(!expanded) : (onClick ? () => onClick(rowEntity.id) : undefined), isActive: isActive, className: isNested ? "zen-data-grid__row-cell--nested" : "" }, `${rowEntity.id}_${column.name}`));
|
|
60
60
|
return acc;
|
|
61
|
-
}, { cells: [], colspan: 0 }).cells, [columns, expanded, getCellParams, isVisible, onExpandedChange]);
|
|
61
|
+
}, { cells: [], colspan: 0 }).cells, [columns, expanded, getCellParams, isVisible, onExpandedChange, isActive, onClick]);
|
|
62
62
|
const cells = (0, react_1.useMemo)(() => renderCells(entity, false), [entity, renderCells]);
|
|
63
63
|
const nestedCells = (0, react_1.useMemo)(() => (expanded && entity.children ? entity.children : []).map((nestedEntity) => renderCells(nestedEntity, true)), [entity.children, expanded, renderCells]);
|
|
64
64
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("tr", { "data-row-id": id, id: mainRowId, role: "row", "aria-level": isTreeGrid ? 1 : undefined, "aria-posinset": isTreeGrid ? ariaPosinset : undefined, "aria-setsize": isTreeGrid ? ariaSetsize : undefined, "aria-expanded": isTreeGrid ? expanded : undefined, className: (0, classNames_1.classNames)([
|