@monolith-forensics/monolith-ui 1.1.85 → 1.1.86

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.
@@ -1,5 +1,5 @@
1
1
  import "overlayscrollbars/overlayscrollbars.css";
2
- interface ColumnProps {
2
+ export interface ColumnProps {
3
3
  className?: string;
4
4
  key?: string | number;
5
5
  dataField: string;
@@ -7,6 +7,7 @@ interface ColumnProps {
7
7
  columnId?: string | number;
8
8
  allowSorting?: boolean;
9
9
  allowReorder?: boolean;
10
+ allowResize?: boolean;
10
11
  resizeEnabled?: boolean;
11
12
  width?: number;
12
13
  sorting?: {
@@ -21,6 +22,7 @@ interface ColumnProps {
21
22
  }
22
23
  interface ColumnType extends React.FunctionComponent<ColumnProps> {
23
24
  displayName: string;
25
+ props?: ColumnProps;
24
26
  }
25
27
  export declare const Column: ColumnType;
26
28
  interface onResizeProps {
@@ -58,7 +60,7 @@ export declare const useTable: () => {
58
60
  };
59
61
  interface TableProps {
60
62
  className?: string;
61
- children: React.ReactNode | React.ReactNode[];
63
+ children: ColumnType | ColumnType[];
62
64
  data: {
63
65
  [key: string]: any;
64
66
  }[];
@@ -23,7 +23,7 @@ import moment from "moment";
23
23
  import { CheckBox } from "..";
24
24
  import { Themes } from "../theme";
25
25
  const MIN_COLUMN_WIDTH = 125;
26
- export const Column = ({ dataField, caption, columnId = shortUUID.generate(), sorting, format, }) => {
26
+ export const Column = () => {
27
27
  return null;
28
28
  };
29
29
  Column.displayName = "Column";
@@ -443,23 +443,21 @@ const Table = styled(({ className, children, data, rowHeight, headerHeight, tabl
443
443
  children = useMemo(() => {
444
444
  return Array.isArray(children) ? children : [children];
445
445
  }, [children]);
446
- let columns = useMemo(() => {
447
- var _a, _b;
448
- return (_b = (_a = children === null || children === void 0 ? void 0 : children.filter) === null || _a === void 0 ? void 0 : _a.call(children, (child) => { var _a; return ((_a = child.type) === null || _a === void 0 ? void 0 : _a.displayName) === "Column"; })) === null || _b === void 0 ? void 0 : _b.map((column) => {
449
- return cloneElement(column, {
450
- columnId: shortUUID.generate(),
451
- allowResize: allowColumnResize !== undefined
452
- ? allowColumnResize
453
- : column.props.allowResize,
454
- allowReorder: allowColumnReorder !== undefined
455
- ? allowColumnReorder
456
- : column.props.allowReorder,
457
- resizeEnabled: allowColumnResize !== undefined
458
- ? allowColumnResize
459
- : column.props.resizeEnabled,
460
- });
446
+ let columns = useMemo(() => children === null || children === void 0 ? void 0 : children.map((column) => {
447
+ var _a, _b, _c;
448
+ return cloneElement(column, {
449
+ columnId: shortUUID.generate(),
450
+ allowResize: allowColumnResize !== undefined
451
+ ? allowColumnResize
452
+ : (_a = column === null || column === void 0 ? void 0 : column.props) === null || _a === void 0 ? void 0 : _a.allowResize,
453
+ allowReorder: allowColumnReorder !== undefined
454
+ ? allowColumnReorder
455
+ : (_b = column === null || column === void 0 ? void 0 : column.props) === null || _b === void 0 ? void 0 : _b.allowReorder,
456
+ resizeEnabled: allowColumnResize !== undefined
457
+ ? allowColumnResize
458
+ : (_c = column === null || column === void 0 ? void 0 : column.props) === null || _c === void 0 ? void 0 : _c.resizeEnabled,
461
459
  });
462
- }, [children]);
460
+ }), [children]);
463
461
  const [columnOrder, setColumnOrder] = useState(columns.map((col, index) => {
464
462
  var _a, _b;
465
463
  return {
@@ -1,2 +1,3 @@
1
1
  export { default } from "./Table";
2
2
  export { Column } from "./Table";
3
+ export type { ColumnProps } from "./Table";
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export { default as Tooltip } from "./Tooltip";
25
25
  export { default as Pill } from "./Pill";
26
26
  export { default as Calendar } from "./Calendar";
27
27
  export { default as Table } from "./Table";
28
+ export type { ColumnProps } from "./Table";
28
29
  export { Column } from "./Table";
29
30
  export { default as MonolithUIProvider } from "./MonolithUIProvider";
30
31
  export { useMonolithUITheme } from "./MonolithUIProvider";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monolith-forensics/monolith-ui",
3
- "version": "1.1.85",
3
+ "version": "1.1.86",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Matt Danner (Monolith Forensics LLC)",