@geotab/zenith 1.25.2 → 1.25.3

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.
Files changed (52) hide show
  1. package/README.md +10 -1
  2. package/dist/columnsSelector/columnsSelector.js +1 -1
  3. package/dist/dataFeed/dataFeed.d.ts +3 -2
  4. package/dist/dataFeed/dataFeed.js +4 -4
  5. package/dist/dataFeed/dataFeedColumnsItems.d.ts +3 -2
  6. package/dist/dataFeed/dataFeedColumnsItems.js +6 -3
  7. package/dist/dataGrid/cell/cell.js +1 -1
  8. package/dist/dataGrid/columns/actionsColumn/actionsColumn.d.ts +5 -0
  9. package/dist/dataGrid/columns/actionsColumn/actionsColumn.js +19 -2
  10. package/dist/dataGrid/row/row.js +1 -1
  11. package/dist/dataGrid/withActions/withActions.js +3 -1
  12. package/dist/index.css +16 -0
  13. package/dist/table/actions/actionsMenu.d.ts +3 -2
  14. package/dist/table/actions/actionsMenu.js +49 -2
  15. package/dist/table/actions/useActions.d.ts +1 -0
  16. package/dist/table/actions/useActions.js +4 -2
  17. package/dist/table/table.js +2 -2
  18. package/dist/utils/localization/translations/cs-json.d.ts +2 -0
  19. package/dist/utils/localization/translations/cs-json.js +3 -1
  20. package/dist/utils/localization/translations/de-json.d.ts +2 -0
  21. package/dist/utils/localization/translations/de-json.js +3 -1
  22. package/dist/utils/localization/translations/en-json.d.ts +1 -0
  23. package/dist/utils/localization/translations/en-json.js +2 -1
  24. package/dist/utils/localization/translations/es-json.d.ts +2 -0
  25. package/dist/utils/localization/translations/es-json.js +3 -1
  26. package/dist/utils/localization/translations/fr-FR-json.d.ts +2 -0
  27. package/dist/utils/localization/translations/fr-FR-json.js +3 -1
  28. package/dist/utils/localization/translations/fr-json.d.ts +2 -0
  29. package/dist/utils/localization/translations/fr-json.js +3 -1
  30. package/dist/utils/localization/translations/id-json.d.ts +2 -0
  31. package/dist/utils/localization/translations/id-json.js +3 -1
  32. package/dist/utils/localization/translations/it-json.d.ts +2 -0
  33. package/dist/utils/localization/translations/it-json.js +3 -1
  34. package/dist/utils/localization/translations/ja-json.d.ts +2 -0
  35. package/dist/utils/localization/translations/ja-json.js +3 -1
  36. package/dist/utils/localization/translations/ms-json.d.ts +2 -0
  37. package/dist/utils/localization/translations/ms-json.js +3 -1
  38. package/dist/utils/localization/translations/nl-json.d.ts +2 -0
  39. package/dist/utils/localization/translations/nl-json.js +3 -1
  40. package/dist/utils/localization/translations/pl-json.d.ts +2 -0
  41. package/dist/utils/localization/translations/pl-json.js +3 -1
  42. package/dist/utils/localization/translations/pt-BR-json.d.ts +2 -0
  43. package/dist/utils/localization/translations/pt-BR-json.js +3 -1
  44. package/dist/utils/localization/translations/sv-json.d.ts +2 -0
  45. package/dist/utils/localization/translations/sv-json.js +3 -1
  46. package/dist/utils/localization/translations/th-json.d.ts +2 -0
  47. package/dist/utils/localization/translations/th-json.js +3 -1
  48. package/dist/utils/localization/translations/tr-json.d.ts +2 -0
  49. package/dist/utils/localization/translations/tr-json.js +3 -1
  50. package/dist/utils/localization/translations/zh-Hans-json.d.ts +2 -0
  51. package/dist/utils/localization/translations/zh-Hans-json.js +3 -1
  52. package/package.json +5 -5
package/README.md CHANGED
@@ -40,7 +40,16 @@ Zenith library provides components defined in Zenith Design System. It includes
40
40
 
41
41
  ## Change log
42
42
 
43
- ### 1.25.1
43
+ ### 1.25.3
44
+
45
+ ## 1.25.3
46
+
47
+ * Update translations in `Chart`
48
+ * ColumnsSelector is right-aligned by default
49
+ * Fix width of visible on hover actions in `Table`
50
+ * Promise-based actions in `Table`
51
+
52
+ ### 1.25.2
44
53
 
45
54
  * `FiltersBar.DropdownWithCheckbox` has been added
46
55
  * `FormStepper` has been added
@@ -20,7 +20,7 @@ const ColumnsSelector = ({ id, columns = [], onColumnToggle, additionalColumns =
20
20
  const resetButton = onColumnsReset
21
21
  ? (0, jsx_runtime_1.jsx)(textIconButton_1.TextIconButton, { className: "zen-button--separate zen-columns-filter__item zen-columns-filter__item--button zen-columns-filter__reset", iconPosition: textIconButton_1.ButtonIconPosition.Start, icon: iconRefresh_1.IconRefresh, iconSize: svgIconSize_1.SvgIconSize.Huge, onClick: onColumnsReset, children: translate("Reset to default") })
22
22
  : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
23
- return (0, jsx_runtime_1.jsxs)(popup_1.Popup, { className: "zen-columns-filter", trigger: triggerButton, children: [resetButton, (0, jsx_runtime_1.jsx)(columnsTab_1.ColumnsTab, { id: id, columns: columns, onColumnToggle: state => onColumnToggle && onColumnToggle(state) }), (0, jsx_runtime_1.jsx)(columnsTabGroup_1.ColumnsTabGroup, { columns: additionalColumns, onColumnToggle: state => onAdditionalColumnToggle && onAdditionalColumnToggle(state) })] });
23
+ return (0, jsx_runtime_1.jsxs)(popup_1.Popup, { className: "zen-columns-filter", trigger: triggerButton, alignment: "bottom-right", children: [resetButton, (0, jsx_runtime_1.jsx)(columnsTab_1.ColumnsTab, { id: id, columns: columns, onColumnToggle: state => onColumnToggle && onColumnToggle(state) }), (0, jsx_runtime_1.jsx)(columnsTabGroup_1.ColumnsTabGroup, { columns: additionalColumns, onColumnToggle: state => onAdditionalColumnToggle && onAdditionalColumnToggle(state) })] });
24
24
  };
25
25
  exports.ColumnsSelector = ColumnsSelector;
26
26
  exports.TRANSLATIONS = [
@@ -15,13 +15,14 @@ interface IDataFeedOptions {
15
15
  }
16
16
  export interface IDataFeed<T> extends IDataGrid<T> {
17
17
  expanded: boolean;
18
- actions?: IActionWithId<T> | ((e: T) => JSX.Element);
18
+ actions?: IActionWithId<T> | ((e: T) => JSX.Element) | undefined;
19
+ actionsAsync?: IActionWithId<T> | ((e: T) => PromiseLike<JSX.Element>);
19
20
  options: IDataFeedOptions;
20
21
  itemsPerPage?: number;
21
22
  }
22
23
  declare const EmptyList: FC<PropsWithChildren>;
23
24
  declare const Footer: FC<PropsWithChildren>;
24
- declare const DataFeedInner: <T extends IEntityWithId>({ entities, columns, className, expanded, options, description, children, actions, itemsPerPage, rowClassName }: IDataFeed<T>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
25
+ declare const DataFeedInner: <T extends IEntityWithId>({ entities, columns, className, expanded, options, description, children, actions, actionsAsync, itemsPerPage, rowClassName }: IDataFeed<T>, ref: ForwardedRef<HTMLElement>) => import("react/jsx-runtime").JSX.Element;
25
26
  export interface IDataFeedStaticProps {
26
27
  EmptyList: typeof EmptyList;
27
28
  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, className, expanded, options, description, children, actions, itemsPerPage = 1000, rowClassName }, ref) => {
25
+ const DataFeedInner = ({ entities, columns, className, expanded, options, description, children, actions, actionsAsync, itemsPerPage = 1000, rowClassName }, 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,11 +94,11 @@ const DataFeedInner = ({ entities, columns, className, expanded, options, descri
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
- if (!actions) {
97
+ if (!actions && !actionsAsync) {
98
98
  return (0, jsx_runtime_1.jsx)(dataFeedColumnsItems_1.FeedItem, { collapsedColumnsQty: collapsedColumnsQty, columnsList: columnsList, visibleColumns: visibleColumns, entity: entity, visibleRows: visibleRows, index: index, expanded: expanded, className: entityClassName }, entity.id);
99
99
  }
100
- return (0, jsx_runtime_1.jsx)(dataFeedColumnsItems_1.ActionFeedItem, { collapsedColumnsQty: collapsedColumnsQty, visibleColumns: visibleColumns, columnsList: columnsList, entity: entity, visibleRows: visibleRows, index: index, expanded: expanded, actions: actions, className: entityClassName }, entity.id);
101
- }), [data, rowClassName, actions, collapsedColumnsQty, visibleColumns, columnsList, visibleRows, expanded]);
100
+ return (0, jsx_runtime_1.jsx)(dataFeedColumnsItems_1.ActionFeedItem, { collapsedColumnsQty: collapsedColumnsQty, visibleColumns: visibleColumns, columnsList: columnsList, entity: entity, visibleRows: visibleRows, index: index, expanded: expanded, actions: actions, actionsAsync: actionsAsync, className: entityClassName }, entity.id);
101
+ }), [data, rowClassName, actions, actionsAsync, collapsedColumnsQty, visibleColumns, columnsList, visibleRows, expanded]);
102
102
  return (0, jsx_runtime_1.jsx)("div", { className: "zen-data-grid-wrapper", children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)([
103
103
  "zen-data-grid",
104
104
  className || ""
@@ -17,8 +17,9 @@ interface IFeedItem<T extends IEntityWithId> {
17
17
  className?: string;
18
18
  }
19
19
  interface IFeedActionItem<T extends IEntityWithId> extends IFeedItem<T> {
20
- actions: IActionWithId<T> | ((entity: T) => JSX.Element);
20
+ actions: IActionWithId<T> | ((entity: T) => JSX.Element) | undefined;
21
+ actionsAsync?: IActionWithId<T> | ((entity: T) => PromiseLike<JSX.Element>);
21
22
  }
22
23
  export declare const FeedItem: <T extends IEntityWithId>({ columnsList, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, className }: IFeedItem<T>) => import("react/jsx-runtime").JSX.Element;
23
- export declare const ActionFeedItem: <T extends IEntityWithId>({ columnsList, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, actions, className }: IFeedActionItem<T>) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const ActionFeedItem: <T extends IEntityWithId>({ columnsList, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, actions, actionsAsync, className }: IFeedActionItem<T>) => import("react/jsx-runtime").JSX.Element;
24
25
  export {};
@@ -19,7 +19,7 @@ const FeedItemInner = ({ columnsList, expanded, collapsedColumnsQty, visibleColu
19
19
  return (0, jsx_runtime_1.jsxs)(feedItem_1.DataFeedItem, { id: entity.id, isLast: false, index: index, isFullList: expanded, className: className, children: [(0, jsx_runtime_1.jsx)(feedItem_1.DataFeedItem.Main, { children: mainColumnsData }), secondaryColumnsMemoized.length ? (0, jsx_runtime_1.jsx)(feedItem_1.DataFeedItem.Secondary, { children: secondaryColumnsData }) : null] });
20
20
  };
21
21
  exports.FeedItem = (0, react_1.memo)(FeedItemInner);
22
- const ActionFeedItemInner = ({ columnsList, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, actions, className }) => {
22
+ const ActionFeedItemInner = ({ columnsList, expanded, collapsedColumnsQty, visibleColumns, visibleRows, entity, index, actions, actionsAsync, className }) => {
23
23
  const actionsComp = (0, react_1.useMemo)(() => {
24
24
  if (entity.isLoading) {
25
25
  return null;
@@ -27,8 +27,11 @@ const ActionFeedItemInner = ({ columnsList, expanded, collapsedColumnsQty, visib
27
27
  if (typeof actions === "function") {
28
28
  return (0, jsx_runtime_1.jsx)(actionsMenu_1.ActionsMenu, { entity: entity, render: actions });
29
29
  }
30
- return (0, jsx_runtime_1.jsx)(actionsButton_1.ActionsButton, { action: actions, entity: entity });
31
- }, [actions, entity]);
30
+ if (actionsAsync && typeof actionsAsync === "function") {
31
+ return (0, jsx_runtime_1.jsx)(actionsMenu_1.ActionsMenu, { entity: entity, renderAsync: actionsAsync });
32
+ }
33
+ return actions ? (0, jsx_runtime_1.jsx)(actionsButton_1.ActionsButton, { action: actions, entity: entity }) : null;
34
+ }, [actions, actionsAsync, entity]);
32
35
  return (0, jsx_runtime_1.jsxs)("div", { className: (0, classNames_1.classNames)(["zen-data-feed__item-container", className || ""]), children: [(0, jsx_runtime_1.jsx)(exports.FeedItem, { collapsedColumnsQty: collapsedColumnsQty, visibleColumns: visibleColumns, columnsList: columnsList, entity: entity, visibleRows: visibleRows, index: index, expanded: expanded, className: "zen-data-feed__item--no-shadow" }, entity.id), (0, jsx_runtime_1.jsx)("div", { className: "zen-data-feed__action-container", children: actionsComp })] }, entity.id);
33
36
  };
34
37
  exports.ActionFeedItem = (0, react_1.memo)(ActionFeedItemInner);
@@ -54,6 +54,6 @@ const Cell = ({ index, limited, visibleOnHover, isVisible, width, column, entity
54
54
  index === 0 ? "zen-data-grid__row-cell--first" : "",
55
55
  visibleOnHover ? "zen-data-grid__row-cell--visible-on-hover" : "",
56
56
  limited ? "zen-ellipsis" : ""
57
- ]), style: { minWidth: width, maxWidth: width }, children: content });
57
+ ]), style: { minWidth: width || "auto", maxWidth: width || "auto" }, children: content });
58
58
  };
59
59
  exports.DataGridCell = (0, react_1.memo)(Cell);
@@ -26,13 +26,17 @@ interface IActionsColumnOptions<T> {
26
26
  title?: string;
27
27
  actions?: IAction<T>[];
28
28
  headerActions?: IAction<undefined>[];
29
+ primaryActions?: IAction<T>[];
29
30
  render?: (entity: T) => JSX.Element;
31
+ renderAsync?: (entity: T) => PromiseLike<JSX.Element>;
30
32
  }
31
33
  export declare class ActionsColumn<T extends IEntityWithId> extends BasicColumn<T, unknown> implements IListColumnBasic<T> {
32
34
  private actionsOptions;
33
35
  private actions;
34
36
  private headerActions;
37
+ private primaryActions;
35
38
  private renderFn;
39
+ private renderAsyncFn;
36
40
  private renderIconActions;
37
41
  private updateActions;
38
42
  protected renderCell(_: any, entity: T): import("react/jsx-runtime").JSX.Element;
@@ -41,5 +45,6 @@ export declare class ActionsColumn<T extends IEntityWithId> extends BasicColumn<
41
45
  get options(): IActionsColumnOptions<T>;
42
46
  set options(actionsOptions: IActionsColumnOptions<T>);
43
47
  get columnActions(): IActionWithId<T> | ((entity: T) => JSX.Element) | undefined;
48
+ get columnActionsAsync(): ((entity: T) => PromiseLike<JSX.Element>) | undefined;
44
49
  }
45
50
  export {};
@@ -15,11 +15,13 @@ class ActionsColumn extends basicColumn_1.BasicColumn {
15
15
  updateActions(options) {
16
16
  this.actions = options.actions ? options.actions.map(action => { var _a; return (Object.assign(Object.assign({}, action), { id: action.id || (0, generateId_1.generateId)(), actions: (_a = action.actions) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { id: (0, generateId_1.generateId)() }))) })); }) : undefined;
17
17
  this.renderFn = options.render;
18
+ this.renderAsyncFn = options.renderAsync;
18
19
  this.headerActions = (options.headerActions || []).map(action => { var _a; return (Object.assign(Object.assign({}, action), { id: action.id || (0, generateId_1.generateId)(), actions: (_a = action.actions) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { id: (0, generateId_1.generateId)() }))) })); });
20
+ this.primaryActions = (options.primaryActions || []).map(action => { var _a; return (Object.assign(Object.assign({}, action), { id: action.id || (0, generateId_1.generateId)(), actions: (_a = action.actions) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { id: (0, generateId_1.generateId)() }))) })); });
19
21
  }
20
22
  renderCell(_, entity) {
21
- if (this.options.render) {
22
- return (0, jsx_runtime_1.jsx)("div", { className: "zen-actions-column", children: (0, jsx_runtime_1.jsx)(actionsMenu_1.ActionsMenu, { entity: entity, render: this.options.render }) });
23
+ if (this.options.render || this.options.renderAsync) {
24
+ return (0, jsx_runtime_1.jsxs)("div", { className: "zen-actions-column", children: [this.primaryActions && this.primaryActions.length > 0 && this.renderIconActions(entity, this.primaryActions), this.options.render && (0, jsx_runtime_1.jsx)(actionsMenu_1.ActionsMenu, { entity: entity, render: this.options.render }), this.options.renderAsync && (0, jsx_runtime_1.jsx)(actionsMenu_1.ActionsMenu, { entity: entity, renderAsync: this.options.renderAsync })] });
23
25
  }
24
26
  return this.renderIconActions(entity, this.actions || []);
25
27
  }
@@ -46,12 +48,24 @@ class ActionsColumn extends basicColumn_1.BasicColumn {
46
48
  writable: true,
47
49
  value: []
48
50
  });
51
+ Object.defineProperty(this, "primaryActions", {
52
+ enumerable: true,
53
+ configurable: true,
54
+ writable: true,
55
+ value: void 0
56
+ });
49
57
  Object.defineProperty(this, "renderFn", {
50
58
  enumerable: true,
51
59
  configurable: true,
52
60
  writable: true,
53
61
  value: void 0
54
62
  });
63
+ Object.defineProperty(this, "renderAsyncFn", {
64
+ enumerable: true,
65
+ configurable: true,
66
+ writable: true,
67
+ value: void 0
68
+ });
55
69
  this.updateActions(actionsOptions);
56
70
  }
57
71
  get options() {
@@ -64,5 +78,8 @@ class ActionsColumn extends basicColumn_1.BasicColumn {
64
78
  get columnActions() {
65
79
  return (this.actions ? this.actions[0] : undefined) || this.renderFn;
66
80
  }
81
+ get columnActionsAsync() {
82
+ return this.renderAsyncFn || undefined;
83
+ }
67
84
  }
68
85
  exports.ActionsColumn = ActionsColumn;
@@ -47,7 +47,7 @@ const Row = ({ id, entity, columns, visibleRows, flexibleColumnWidth, isLastRow,
47
47
  if (colspan) {
48
48
  acc.colspan = colspan - 1;
49
49
  }
50
- acc.cells.push((0, jsx_runtime_1.jsx)(cell_1.DataGridCell, { column: column, entity: entity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: width, isVisible: isVisible, colspan: colspan }, `${entity.id}_${column.name}`));
50
+ acc.cells.push((0, jsx_runtime_1.jsx)(cell_1.DataGridCell, { column: column, entity: entity, index: index, limited: limited, visibleOnHover: column.meta.visibleOnHover, width: column.meta.visibleOnHover ? 0 : width, isVisible: isVisible, colspan: colspan }, `${entity.id}_${column.name}`));
51
51
  return acc;
52
52
  }, { cells: [], colspan: 0 }).cells;
53
53
  return (0, jsx_runtime_1.jsx)("tr", { "data-row-id": id, className: (0, classNames_1.classNames)([
@@ -13,13 +13,15 @@ const withActions = (DataGridComponent) => (0, react_1.forwardRef)(
13
13
  function InnerColumnsList(props, ref) {
14
14
  const { columns } = props;
15
15
  let actions = undefined;
16
+ let actionsAsync = undefined;
16
17
  const columnsWithActions = columns.find(el => el.columnComponent instanceof actionsColumn_1.ActionsColumn);
17
18
  if (columnsWithActions && columnsWithActions.columnComponent) {
18
19
  const colComp = columnsWithActions.columnComponent;
19
20
  const colActions = colComp.columnActions;
20
21
  actions = colActions ? colActions : undefined;
22
+ actionsAsync = colComp.columnActionsAsync;
21
23
  }
22
24
  const allColumns = (0, react_1.useMemo)(() => columns.filter(el => !(el.columnComponent instanceof actionsColumn_1.ActionsColumn)).map(column => (Object.assign({}, (0, toBasicColumn_1.toBasicColumn)(Object.assign({}, column))))), [columns]);
23
- return (0, jsx_runtime_1.jsx)(DataGridComponent, Object.assign({}, props, { columns: [...allColumns], actions: actions, ref: ref }), "grid");
25
+ return (0, jsx_runtime_1.jsx)(DataGridComponent, Object.assign({}, props, { columns: [...allColumns], actions: actions, actionsAsync: actionsAsync, ref: ref }), "grid");
24
26
  });
25
27
  exports.withActions = withActions;
package/dist/index.css CHANGED
@@ -7476,6 +7476,22 @@ button.zen-summary__clickable {
7476
7476
  width: 100%;
7477
7477
  gap: 1rem;
7478
7478
  }
7479
+ .zen-actions-column__menu-item-error .zen-menu-button__action-text {
7480
+ color: var(--text-primary);
7481
+ }
7482
+ .zen-actions-column__menu-item-error .zen-icon {
7483
+ fill: var(--text-error-message);
7484
+ }
7485
+ .zen-actions-column__action {
7486
+ flex-shrink: 0;
7487
+ }
7488
+ .zen-actions-column__action_error {
7489
+ background-color: var(--accents-error--main);
7490
+ fill: var(--text-error-message);
7491
+ }
7492
+ .zen-actions-column__waiting {
7493
+ padding: 16px 20px;
7494
+ }
7479
7495
  .zen-feed-item {
7480
7496
  display: grid;
7481
7497
  grid-template-columns: auto 1fr;
@@ -2,7 +2,8 @@
2
2
  import { IEntityWithId } from "../../commonHelpers/entity";
3
3
  interface IActionsMenuProps<T extends IEntityWithId> {
4
4
  entity: T;
5
- render: (entity: T) => JSX.Element;
5
+ render?: (entity: T) => JSX.Element;
6
+ renderAsync?: (entity: T) => PromiseLike<JSX.Element>;
6
7
  }
7
- export declare const ActionsMenu: <T extends IEntityWithId>({ entity, render }: IActionsMenuProps<T>) => import("react/jsx-runtime").JSX.Element | null;
8
+ export declare const ActionsMenu: <T extends IEntityWithId>({ entity, render, renderAsync }: IActionsMenuProps<T>) => import("react/jsx-runtime").JSX.Element | null;
8
9
  export {};
@@ -7,17 +7,64 @@ const button_1 = require("../../button/button");
7
7
  const iconDotVertical_1 = require("../../icons/iconDotVertical");
8
8
  const useLanguage_1 = require("../../utils/localization/useLanguage");
9
9
  const menu_1 = require("../../menu/menu");
10
+ const iconException_1 = require("../../icons/iconException");
11
+ const classNames_1 = require("../../commonHelpers/classNames/classNames");
12
+ const skeletonList_1 = require("../../skeletonList/skeletonList");
10
13
  const getMenuItems = (entity, render) => {
14
+ if (!render) {
15
+ return null;
16
+ }
11
17
  const result = render(entity);
12
18
  if (result.type === menu_1.Menu.Item) {
13
19
  return result;
14
20
  }
15
21
  return result.props.children;
16
22
  };
17
- const ActionsMenu = ({ entity, render }) => {
23
+ const ActionsMenu = ({ entity, render, renderAsync }) => {
18
24
  const { translate } = (0, useLanguage_1.useLanguage)();
19
- const trigger = (0, react_1.useMemo)(() => (0, jsx_runtime_1.jsx)(button_1.Button, { type: "tertiary-black", className: "zen-caption zen-actions-column__action", children: (0, jsx_runtime_1.jsx)(iconDotVertical_1.IconDotVertical, { size: "bigger" }) }), []);
25
+ const generatedId = (0, react_1.useId)();
26
+ const buttonId = `ariaLabelBy-${entity.id || generatedId} }`;
27
+ const ref = (0, react_1.useRef)(null);
20
28
  const menuItems = (0, react_1.useMemo)(() => getMenuItems(entity, render), [entity, render]);
29
+ const [menuItemsAsync, setMenuItemsAsync] = (0, react_1.useState)(null);
30
+ const [isLoading, setIsLoading] = (0, react_1.useState)(false);
31
+ const [isError, setIsError] = (0, react_1.useState)(false);
32
+ const handleClickTrigger = (0, react_1.useCallback)(async () => {
33
+ try {
34
+ if (renderAsync && !menuItemsAsync) {
35
+ setIsLoading(true);
36
+ setIsError(false);
37
+ const resolvedMenuItems = await renderAsync(entity);
38
+ setMenuItemsAsync(resolvedMenuItems);
39
+ if (!resolvedMenuItems.props.children) {
40
+ setIsError(true);
41
+ }
42
+ setIsLoading(false);
43
+ }
44
+ }
45
+ catch (err) {
46
+ setIsLoading(false);
47
+ setMenuItemsAsync(null);
48
+ setIsError(true);
49
+ }
50
+ }, [entity, menuItemsAsync, renderAsync]);
51
+ const trigger = (0, react_1.useMemo)(() => {
52
+ if (renderAsync) {
53
+ return (0, jsx_runtime_1.jsx)(button_1.Button, { disabled: isLoading, id: buttonId, ref: ref, onClick: handleClickTrigger, type: "tertiary-black", className: (0, classNames_1.classNames)([
54
+ "zen-caption",
55
+ "zen-actions-column__action",
56
+ isError ? "zen-actions-column__action_error" : ""
57
+ ]), children: (0, jsx_runtime_1.jsx)(iconDotVertical_1.IconDotVertical, { size: "bigger" }) });
58
+ }
59
+ return (0, jsx_runtime_1.jsx)(button_1.Button, { type: "tertiary-black", className: "zen-caption zen-actions-column__action", children: (0, jsx_runtime_1.jsx)(iconDotVertical_1.IconDotVertical, { size: "bigger" }) });
60
+ }, [buttonId, isLoading, isError, renderAsync, handleClickTrigger]);
61
+ if (renderAsync) {
62
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [trigger, (0, jsx_runtime_1.jsx)(menu_1.Menu, { ariaLabelledBy: buttonId, title: translate("Actions"), triggerRef: ref, alignment: "bottom-right", children: isLoading
63
+ ? (0, jsx_runtime_1.jsx)(skeletonList_1.SkeletonList, { className: "zen-actions-column__waiting" })
64
+ : ((menuItemsAsync && menuItemsAsync.props.children)
65
+ ? menuItemsAsync.props.children
66
+ : (0, jsx_runtime_1.jsx)(menu_1.Menu.Item, { className: "zen-actions-column__menu-item-error", id: "error", icon: iconException_1.IconException, name: translate("Error Loading Items"), disabled: true })) })] });
67
+ }
21
68
  if (!menuItems || menuItems.length === 0) {
22
69
  return null;
23
70
  }
@@ -5,4 +5,5 @@ import { IListColumn } from "../table";
5
5
  export declare const useActions: <T extends IEntityWithId>(columns: IListColumn<T>[], isFeed: boolean) => {
6
6
  columnsWithActions: IListColumn<T>[];
7
7
  actions: IActionWithId<T> | ((entity: T) => JSX.Element) | undefined;
8
+ actionsAsync: ((entity: T) => PromiseLike<JSX.Element>) | undefined;
8
9
  };
@@ -6,16 +6,18 @@ const actionsColumn_1 = require("../../dataGrid/columns/actionsColumn/actionsCol
6
6
  const useActions = (columns, isFeed) => {
7
7
  const result = (0, react_1.useMemo)(() => {
8
8
  if (!isFeed) {
9
- return { columnsWithActions: [...columns], actions: undefined };
9
+ return { columnsWithActions: [...columns], actions: undefined, actionsAsync: undefined };
10
10
  }
11
11
  const columnsWithActions = columns.find(el => el.columnComponent instanceof actionsColumn_1.ActionsColumn);
12
12
  let actions = undefined;
13
+ let actionsAsync = undefined;
13
14
  if (columnsWithActions && columnsWithActions.columnComponent) {
14
15
  const colComponent = columnsWithActions.columnComponent;
15
16
  actions = colComponent.columnActions;
17
+ actionsAsync = colComponent.columnActionsAsync;
16
18
  }
17
19
  const columnsWithoutActions = columns.filter(el => !(el.columnComponent instanceof actionsColumn_1.ActionsColumn));
18
- return { columnsWithActions: columnsWithoutActions, actions };
20
+ return { columnsWithActions: columnsWithoutActions, actions, actionsAsync };
19
21
  }, [columns, isFeed]);
20
22
  return result;
21
23
  };
@@ -59,7 +59,7 @@ const TableInner = ({ entities, columns, selectable, sortable, flexible, isLoadi
59
59
  const { selectableColumns } = (0, useSelectableRows_1.useSelectableRows)(columns, entities, isMobile, selectMode, setMobileSelectMode, isLoading ? undefined : selectable);
60
60
  const { sortableColumns, feedSortControl } = (0, useSortableColumns_1.useSortableColumns)(selectableColumns, sortable, isMobile);
61
61
  const { flexibleColumns, columnsPopup } = (0, useFlexibleColumns_1.useFlexibleColumns)(sortableColumns, flexible, gridRef, columnsPopupRef, isMobile);
62
- const { columnsWithActions, actions } = (0, useActions_1.useActions)(flexibleColumns, isMobile);
62
+ const { columnsWithActions, actions, actionsAsync } = (0, useActions_1.useActions)(flexibleColumns, isMobile);
63
63
  const { loadingColumns, loadingEntities } = (0, useLoading_1.useLoading)(columnsWithActions, entities, isLoading, loading);
64
64
  const { isFeedExpanded, handleExpanded, isFeedVisible, visibleColumns } = (0, useFeedExpandable_1.useFeedExpandable)(isMobile, feedExpandable);
65
65
  const selectionQty = (0, react_1.useMemo)(() => {
@@ -98,7 +98,7 @@ const TableInner = ({ entities, columns, selectable, sortable, flexible, isLoadi
98
98
  : null, isMobile ? (0, jsx_runtime_1.jsxs)(dataFeed_1.DataFeed, { columns: loadingColumns, entities: loadingEntities, expanded: isFeedExpanded, options: {
99
99
  onFeedEnd: onFeedEnd,
100
100
  visibleColumns
101
- }, actions: actions, ref: gridRef, rowClassName: rowClassName, children: [emptyList || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), footer || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] }) : (0, jsx_runtime_1.jsxs)(dataGrid_1.DataGrid, { columns: loadingColumns, entities: loadingEntities, ref: gridRef, rowClassName: rowClassName, children: [emptyList || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), footer || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] })] }) });
101
+ }, actions: actions, actionsAsync: actionsAsync, ref: gridRef, rowClassName: rowClassName, children: [emptyList || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), footer || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] }) : (0, jsx_runtime_1.jsxs)(dataGrid_1.DataGrid, { columns: loadingColumns, entities: loadingEntities, ref: gridRef, rowClassName: rowClassName, children: [emptyList || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}), footer || (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] })] }) });
102
102
  };
103
103
  const Table = (0, react_1.memo)(TableInner);
104
104
  exports.Table = Table;
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Pokračovat",
227
227
  "Submit": "Odeslat",
228
228
  "Optional": "Volitelné",
229
- "Step {0} of {1}": "Krok {0} z {1}"
229
+ "Step {0} of {1}": "Krok {0} z {1}",
230
+ "Y-axis": "Osa Y",
231
+ "X-axis": "Osa X"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Fortsetzen",
227
227
  "Submit": "Absenden",
228
228
  "Optional": "Optional",
229
- "Step {0} of {1}": "Schritt {0} von {1}"
229
+ "Step {0} of {1}": "Schritt {0} von {1}",
230
+ "Y-axis": "Y-Achse",
231
+ "X-axis": "X-Achse"
230
232
  };
@@ -243,4 +243,5 @@ export declare const translations: {
243
243
  Submit: string;
244
244
  Optional: string;
245
245
  "Step {0} of {1}": string;
246
+ "Error Loading Items": string;
246
247
  };
@@ -245,5 +245,6 @@ exports.translations = {
245
245
  "Continue": "Continue",
246
246
  "Submit": "Submit",
247
247
  "Optional": "Optional",
248
- "Step {0} of {1}": "Step {0} of {1}"
248
+ "Step {0} of {1}": "Step {0} of {1}",
249
+ "Error Loading Items": "Error Loading Items"
249
250
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Continuar",
227
227
  "Submit": "Enviar",
228
228
  "Optional": "Opcional",
229
- "Step {0} of {1}": "Paso {0} de {1}"
229
+ "Step {0} of {1}": "Paso {0} de {1}",
230
+ "Y-axis": "Eje Y",
231
+ "X-axis": "Eje X"
230
232
  };
@@ -223,4 +223,6 @@ export declare const translations: {
223
223
  Submit: string;
224
224
  Optional: string;
225
225
  "Step {0} of {1}": string;
226
+ "Y-axis": string;
227
+ "X-axis": string;
226
228
  };
@@ -225,5 +225,7 @@ exports.translations = {
225
225
  "Continue": "Continuer",
226
226
  "Submit": "Envoyer",
227
227
  "Optional": "Facultatif",
228
- "Step {0} of {1}": "Étape {0} sur {1}"
228
+ "Step {0} of {1}": "Étape {0} sur {1}",
229
+ "Y-axis": "Axe Y",
230
+ "X-axis": "Axe X"
229
231
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Continuer",
227
227
  "Submit": "Soumettre",
228
228
  "Optional": "Facultatif",
229
- "Step {0} of {1}": "Étape {0} de {1}"
229
+ "Step {0} of {1}": "Étape {0} de {1}",
230
+ "Y-axis": "Axe des Y",
231
+ "X-axis": "Axe X"
230
232
  };
@@ -225,4 +225,6 @@ export declare const translations: {
225
225
  Submit: string;
226
226
  Optional: string;
227
227
  "Step {0} of {1}": string;
228
+ "Y-axis": string;
229
+ "X-axis": string;
228
230
  };
@@ -227,5 +227,7 @@ exports.translations = {
227
227
  "Continue": "Lanjutkan",
228
228
  "Submit": "Kirimkan",
229
229
  "Optional": "Opsional",
230
- "Step {0} of {1}": "Langkah {0} dari {1}"
230
+ "Step {0} of {1}": "Langkah {0} dari {1}",
231
+ "Y-axis": "Poros y",
232
+ "X-axis": "Sumbu X"
231
233
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Continua",
227
227
  "Submit": "Inviare",
228
228
  "Optional": "Opzionale",
229
- "Step {0} of {1}": "Fase {0} di {1}"
229
+ "Step {0} of {1}": "Fase {0} di {1}",
230
+ "Y-axis": "Asse Y",
231
+ "X-axis": "Asse X"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "続ける",
227
227
  "Submit": "送信",
228
228
  "Optional": "オプション",
229
- "Step {0} of {1}": "手順 {0} / {1}"
229
+ "Step {0} of {1}": "手順 {0} / {1}",
230
+ "Y-axis": "Y 軸",
231
+ "X-axis": "X 軸"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Teruskan",
227
227
  "Submit": "Serah",
228
228
  "Optional": "Pilihan",
229
- "Step {0} of {1}": "Langkah {0} daripada {1}"
229
+ "Step {0} of {1}": "Langkah {0} daripada {1}",
230
+ "Y-axis": "Paksi-Y",
231
+ "X-axis": "Paksi X"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Doorgaan",
227
227
  "Submit": "Verzenden",
228
228
  "Optional": "Optioneel",
229
- "Step {0} of {1}": "Stap {0} van {1}"
229
+ "Step {0} of {1}": "Stap {0} van {1}",
230
+ "Y-axis": "Y-as",
231
+ "X-axis": "X-as"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Kontynuuj",
227
227
  "Submit": "Wyślij",
228
228
  "Optional": "Opcjonalne",
229
- "Step {0} of {1}": "Etap {0} z {1}"
229
+ "Step {0} of {1}": "Etap {0} z {1}",
230
+ "Y-axis": "Oś Y",
231
+ "X-axis": "Oś X"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Continuar",
227
227
  "Submit": "Enviar",
228
228
  "Optional": "Opcional",
229
- "Step {0} of {1}": "Etapa {0} de {1}"
229
+ "Step {0} of {1}": "Etapa {0} de {1}",
230
+ "Y-axis": "Eixo Y",
231
+ "X-axis": "Eixo X"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Fortsätt",
227
227
  "Submit": "Skicka",
228
228
  "Optional": "Frivilligt",
229
- "Step {0} of {1}": "Steg {0} av {1}"
229
+ "Step {0} of {1}": "Steg {0} av {1}",
230
+ "Y-axis": "Y-axel",
231
+ "X-axis": "X-axel"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "ดำเนินการต่อ",
227
227
  "Submit": "ส่ง",
228
228
  "Optional": "ไม่บังคับ",
229
- "Step {0} of {1}": "ขั้นตอนที่ {0} จาก {1}"
229
+ "Step {0} of {1}": "ขั้นตอนที่ {0} จาก {1}",
230
+ "Y-axis": "แกน Y",
231
+ "X-axis": "แกน X"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "Devam",
227
227
  "Submit": "Gönder",
228
228
  "Optional": "İsteğe bağlı",
229
- "Step {0} of {1}": "Adım {0} / {1}"
229
+ "Step {0} of {1}": "Adım {0} / {1}",
230
+ "Y-axis": "Y ekseni",
231
+ "X-axis": "X ekseni"
230
232
  };
@@ -224,4 +224,6 @@ export declare const translations: {
224
224
  Submit: string;
225
225
  Optional: string;
226
226
  "Step {0} of {1}": string;
227
+ "Y-axis": string;
228
+ "X-axis": string;
227
229
  };
@@ -226,5 +226,7 @@ exports.translations = {
226
226
  "Continue": "继续",
227
227
  "Submit": "提交",
228
228
  "Optional": "可选",
229
- "Step {0} of {1}": "步骤 {0} / {1} "
229
+ "Step {0} of {1}": "步骤 {0} / {1} ",
230
+ "Y-axis": "Y 轴",
231
+ "X-axis": "X 轴"
230
232
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geotab/zenith",
3
- "version": "1.25.2",
3
+ "version": "1.25.3",
4
4
  "description": "Zenith components library on React",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,9 +10,6 @@
10
10
  "**/react-chartjs/dateAdapter.ts"
11
11
  ],
12
12
  "module": "dist/index.js",
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
13
  "scripts": {
17
14
  "test": "npm run clean && npm run test-build && jest",
18
15
  "start": "npm run storybook --loglevel verbose",
@@ -50,8 +47,8 @@
50
47
  "@storybook/manager-api": "^8.5.8",
51
48
  "@storybook/react": "^8.5.8",
52
49
  "@storybook/react-webpack5": "^8.5.8",
53
- "@storybook/theming": "^8.5.8",
54
50
  "@storybook/test": "^8.5.8",
51
+ "@storybook/theming": "^8.5.8",
55
52
  "@testing-library/react": "^16.0.1",
56
53
  "@types/jest": "^29.5.12",
57
54
  "@types/react": "^18.2.73",
@@ -100,5 +97,8 @@
100
97
  "last 1 firefox version",
101
98
  "last 1 safari version"
102
99
  ]
100
+ },
101
+ "publishConfig": {
102
+ "access": "public"
103
103
  }
104
104
  }