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.
- package/assets/Loader.scss +1 -1
- package/package.json +1 -1
- package/ui/DataTable/DataTable.d.ts +7 -0
- package/ui/DataTable/DataTable.js +6 -0
- package/ui/DataTable/index.d.ts +2 -0
- package/ui/DataTable/index.js +2 -0
- package/ui/Popper/PopperBase.d.ts +4 -0
- package/ui/Popper/PopperBase.js +21 -6
- package/ui/Table/Table.d.ts +2 -1
- package/ui/Table/Table.js +6 -4
- package/ui/Table/TableRow.js +3 -1
package/assets/Loader.scss
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"armtek-uikit-react","version":"1.0.
|
|
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;
|
|
@@ -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;
|
package/ui/Popper/PopperBase.js
CHANGED
|
@@ -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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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();
|
package/ui/Table/Table.d.ts
CHANGED
|
@@ -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(
|
|
32
|
-
|
|
33
|
-
|
|
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) : '';
|
package/ui/Table/TableRow.js
CHANGED
|
@@ -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
|
});
|