@gpa-gemstone/react-table 1.2.35 → 1.2.37

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.
@@ -72,13 +72,13 @@ function AdjColumnHeaderWrapper(props) {
72
72
  props.setWidth(w, (_b = props.MinWidth) !== null && _b !== void 0 ? _b : 100);
73
73
  });
74
74
  var onClick = React.useCallback(function (e) {
75
- props.onSort(props.Key, e, props.Field);
75
+ var _a;
76
+ if ((_a = props.AllowSort) !== null && _a !== void 0 ? _a : true)
77
+ props.onSort(props.Key, e, props.Field);
76
78
  e.stopPropagation();
77
- console.log('onCLick th');
78
79
  }, [props.onSort]);
79
80
  var onClickBorder = React.useCallback(function (e) {
80
81
  props.startAdjustment(e);
81
- console.log('onCLick border div');
82
82
  }, [props.startAdjustment]);
83
83
  return React.createElement("th", { ref: thref, style: style, onClick: onClick, onDrag: function (e) { e.stopPropagation(); } },
84
84
  React.createElement("div", { style: {
@@ -87,7 +87,7 @@ interface TableProps<T> {
87
87
  * @param data the item to be turned into a key
88
88
  * @returns a unique Key
89
89
  */
90
- KeySelector: (data: T) => string | number;
90
+ KeySelector: (data: T, index?: number) => string | number;
91
91
  /**
92
92
  * Optional Element to display in the last row of the Table
93
93
  * use this for displaying warnings when the Table content gets cut off
@@ -177,7 +177,7 @@ function Rows(props) {
177
177
  style.cursor = 'pointer';
178
178
  if (props.Selected !== undefined && props.Selected(d))
179
179
  style.backgroundColor = 'yellow';
180
- var key = props.KeySelector(d);
180
+ var key = props.KeySelector(d, i);
181
181
  return React.createElement("tr", { key: key, style: __assign({ display: (props.FixedLayout ? 'block' : undefined) }, style) },
182
182
  React.Children.map(props.children, function (element) {
183
183
  if (!React.isValidElement(element))
@@ -30,6 +30,7 @@ export interface IColumnProps<T> {
30
30
  key: string;
31
31
  field: keyof T | undefined;
32
32
  index: number;
33
+ style?: React.CSSProperties;
33
34
  }) => React.ReactNode;
34
35
  }
35
36
  export default function Column<T>(props: React.PropsWithChildren<IColumnProps<T>>): JSX.Element;
@@ -71,11 +71,13 @@ function ColumnHeaderWrapper(props) {
71
71
  props.setWidth(w);
72
72
  });
73
73
  var onClick = React.useCallback(function (e) {
74
- props.onSort(props.Key, e, props.Field);
75
- }, [props.onSort]);
74
+ var _a;
75
+ if ((_a = props.AllowSort) !== null && _a !== void 0 ? _a : true)
76
+ props.onSort(props.Key, e, props.Field);
77
+ }, [props.onSort, props.AllowSort]);
76
78
  return React.createElement("th", { ref: thref, style: style, onClick: onClick, onDrag: function (e) { e.stopPropagation(); } },
77
- props.sorted && props.asc ? React.createElement("div", { style: { position: 'absolute', width: 25 } }, gpa_symbols_1.SVGIcons.ArrowDropDown) : null,
78
- props.sorted && !props.asc ? React.createElement("div", { style: { position: 'absolute', width: 25 } }, gpa_symbols_1.SVGIcons.ArrowDropUp) : null,
79
+ props.sorted && !props.asc ? React.createElement("div", { style: { position: 'absolute', width: 25 } }, gpa_symbols_1.SVGIcons.ArrowDropDown) : null,
80
+ props.sorted && props.asc ? React.createElement("div", { style: { position: 'absolute', width: 25 } }, gpa_symbols_1.SVGIcons.ArrowDropUp) : null,
79
81
  React.createElement("div", { style: {
80
82
  marginLeft: (props.sorted ? 25 : 0),
81
83
  } }, (_b = props.children) !== null && _b !== void 0 ? _b : props.Key));
@@ -97,6 +99,7 @@ function ColumnDataWrapper(props) {
97
99
  item: props.item,
98
100
  key: props.Key,
99
101
  field: props.Field,
102
+ style: css,
100
103
  index: props.index
101
104
  }) : getFieldValue(); };
102
105
  var onClick = React.useCallback(function (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpa-gemstone/react-table",
3
- "version": "1.2.35",
3
+ "version": "1.2.37",
4
4
  "description": "Table for GPA web applications",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -42,7 +42,7 @@
42
42
  "typescript": "4.4.4"
43
43
  },
44
44
  "dependencies": {
45
- "@gpa-gemstone/gpa-symbols": "0.0.28",
45
+ "@gpa-gemstone/gpa-symbols": "0.0.29",
46
46
  "@gpa-gemstone/helper-functions": "0.0.27",
47
47
  "@types/lodash": "^4.14.171",
48
48
  "@types/react": "^17.0.14",