armtek-uikit-react 1.0.103 → 1.0.105

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.
@@ -45,6 +45,6 @@
45
45
  }
46
46
  .loader_theme_dark{
47
47
  &.loader_color_neutral{
48
- @include bg('#fff');
48
+ @include bg(#fff);
49
49
  }
50
50
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"armtek-uikit-react","version":"1.0.103","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*","react-transition-group":"^4.4.5"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
1
+ {"name":"armtek-uikit-react","version":"1.0.105","description":"Armtek UIKit for React","repository":{"type":"git","url":"ssh://git@gl.corp:10022/int/uikit/uikit_react.git"},"author":"","license":"ISC","dependencies":{"build":"^0.1.4","clsx":"^2.0.0","rc-slider":"^10.2.1","react":"*","react-datepicker":"^4.16.0","react-dom":"*","react-transition-group":"^4.4.5"},"peerDependencies":{"react":"*","react-dom":"*"},"scripts":{"pub":"npm version patch && npm publish"}}
@@ -0,0 +1,7 @@
1
+ import { TableProps } from '../../ui/Table';
2
+ type ItemType = Record<string, any>;
3
+ export type DataTableProps<T extends ItemType> = {
4
+ items: T[];
5
+ } & TableProps<T>;
6
+ export declare function DataTable<T extends ItemType>(props: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
7
+ export default DataTable;
@@ -0,0 +1,6 @@
1
+ import { Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export function DataTable(props) {
4
+ return /*#__PURE__*/_jsx(_Fragment, {});
5
+ }
6
+ export default DataTable;
@@ -0,0 +1,2 @@
1
+ export { default } from './DataTable';
2
+ export * from './DataTable';
@@ -0,0 +1,2 @@
1
+ export { default } from "./DataTable";
2
+ export * from "./DataTable";
@@ -3,6 +3,10 @@ export type PopperBaseProps = {
3
3
  children: ReactNode;
4
4
  anchorEl: Element;
5
5
  open?: boolean;
6
+ anchorPosition?: {
7
+ x: number;
8
+ y: number;
9
+ };
6
10
  placement?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
7
11
  };
8
12
  export declare const PopperBase: (props: PopperBaseProps) => import("react/jsx-runtime").JSX.Element;
@@ -9,18 +9,33 @@ export const PopperBase = props => {
9
9
  anchorEl,
10
10
  children,
11
11
  placement,
12
+ anchorPosition,
12
13
  open
13
14
  } = props;
14
15
  const tooltipRef = useRef(null);
15
16
  useEffect(() => {
16
- const popper = createPopper(anchorEl, tooltipRef.current, {
17
- placement: placement,
18
- modifiers: [{
19
- name: 'offset',
17
+ let modifiers = [{
18
+ name: 'offset',
19
+ options: {
20
+ offset: [0, 5]
21
+ }
22
+ }];
23
+ if (anchorPosition) {
24
+ modifiers.push({
25
+ name: 'computeStyles',
20
26
  options: {
21
- offset: [0, 5]
27
+ gpuAcceleration: false,
28
+ // true by default
29
+ roundOffsets: () => ({
30
+ x: anchorPosition.x,
31
+ y: anchorPosition.y
32
+ })
22
33
  }
23
- }]
34
+ });
35
+ }
36
+ const popper = createPopper(anchorEl, tooltipRef.current, {
37
+ placement: placement,
38
+ modifiers: modifiers
24
39
  });
25
40
  return () => {
26
41
  popper.destroy();
@@ -10,13 +10,14 @@ export type TableColType<T extends ItemType> = {
10
10
  text: string;
11
11
  getValue?: (item: T) => string | ReactNode | number;
12
12
  getTitle?: () => string | ReactNode | number;
13
- code: keyof T;
13
+ code: keyof T | string;
14
14
  };
15
15
  export type TableProps<T extends ItemType> = Omit<ComponentPropsWithoutRef<'table'>, 'onClick'> & {
16
16
  classes?: ClassesType<T>;
17
17
  structure: TableColType<T>[];
18
18
  items: T[];
19
19
  onClick?: (item: T, e: MouseEvent<HTMLTableRowElement>) => void;
20
+ getRow?: (item: T, index: number) => ReactNode;
20
21
  };
21
22
  export declare function Table<T extends ItemType>(props: TableProps<T>): import("react/jsx-runtime").JSX.Element;
22
23
  export {};
package/ui/Table/Table.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { Fragment } from 'react';
1
2
  import clsx from 'clsx';
2
3
  import { TableRow } from "./TableRow";
3
4
  import { TableCell } from "./TableCell";
@@ -12,6 +13,7 @@ export function Table(props) {
12
13
  items,
13
14
  onClick,
14
15
  classes,
16
+ getRow,
15
17
  ...tableProps
16
18
  } = props;
17
19
  return /*#__PURE__*/_jsx(_Fragment, {
@@ -28,10 +30,10 @@ export function Table(props) {
28
30
  }, index))
29
31
  }), items.map((row, index) => {
30
32
  let rowClass = !!(classes != null && classes.tableRow) ? typeof classes.tableRow === 'string' ? classes.tableRow : classes.tableRow(row) : '';
31
- return /*#__PURE__*/_jsx(TableRow, {
32
- className: clsx(rowClass, {
33
- [css.tableRowClickable]: !!onClick
34
- }),
33
+ return getRow ? /*#__PURE__*/_jsx(Fragment, {
34
+ children: getRow(row, index)
35
+ }, index) : /*#__PURE__*/_jsx(TableRow, {
36
+ className: rowClass,
35
37
  onClick: e => onClick ? onClick(row, e) : null,
36
38
  children: structure.map((item, itemIndex) => {
37
39
  let cellClass = !!(classes != null && classes.tableCell) ? typeof classes.tableCell === 'string' ? classes.tableCell : classes.tableCell(row, item.code) : '';
@@ -11,7 +11,9 @@ export const TableRow = props => {
11
11
  return /*#__PURE__*/_jsx(_Fragment, {
12
12
  children: /*#__PURE__*/_jsx("tr", {
13
13
  ...rowProps,
14
- className: clsx(className, css.tableRow),
14
+ className: clsx(className, css.tableRow, {
15
+ [css.tableRowClickable]: !!rowProps.onClick
16
+ }),
15
17
  children: children
16
18
  })
17
19
  });