@servicetitan/table 22.1.3 → 22.2.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v22.2.0 (Fri Jul 01 2022)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Table: prevent onRowClick when user misses row selection [#122](https://github.com/servicetitan/anvil-uikit-contrib/pull/122) ([@AntonMaksimenko](https://github.com/AntonMaksimenko))
6
+
7
+ #### Authors: 1
8
+
9
+ - Anton Maksimenko ([@AntonMaksimenko](https://github.com/AntonMaksimenko))
10
+
11
+ ---
12
+
1
13
  # v22.1.3 (Wed Jun 29 2022)
2
14
 
3
15
  #### 🐛 Bug Fix
@@ -1 +1 @@
1
- {"version":3,"file":"select-cell.d.ts","sourceRoot":"","sources":["../../src/select-cell/select-cell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EACH,cAAc,EACd,oBAAoB,EAEpB,aAAa,EAChB,MAAM,6BAA6B,CAAC;AAGrC,oBAAY,oBAAoB,GAAG,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AAEvE,UAAU,qBAAsB,SAAQ,cAAc;IAClD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAClC;AAED,UAAU,qBAAsB,SAAQ,oBAAoB;IACxD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAClC;AAED,UAAU,eAAe;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,cAAc,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3E,OAAO,CAAC,EAA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C"}
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { Checkbox, } from '@servicetitan/design-system';
14
+ import classNames from 'classnames';
14
15
  import * as Styles from './select-cell.module.css';
15
16
  export const SelectCell = (_a) => {
16
17
  var { selectionChange, control: Control = Checkbox } = _a, props = __rest(_a, ["selectionChange", "control"]);
@@ -22,6 +23,7 @@ export const SelectCell = (_a) => {
22
23
  };
23
24
  return _jsx(Control, Object.assign({ className: Styles.checkbox, onChange: onChange }, props));
24
25
  };
26
+ const stopPropagation = (e) => e.stopPropagation();
25
27
  export const SelectColumnCell = (props) => {
26
28
  if (props.rowType === 'groupHeader') {
27
29
  return null;
@@ -29,7 +31,9 @@ export const SelectColumnCell = (props) => {
29
31
  if (props.rowType === 'groupFooter') {
30
32
  return _jsx("td", {});
31
33
  }
32
- return (_jsx("td", Object.assign({ style: props.style, className: props.className }, { children: _jsx(SelectCell, { checked: props.dataItem.selected, disabled: !props.isRowSelectable, selectionChange: props.selectionChange, indeterminate: props.dataItem.indeterminate, control: props.control }) })));
34
+ return (_jsx("td", Object.assign({ style: props.style,
35
+ // prevent onRowClick when user misses row selection
36
+ onClick: stopPropagation, className: classNames(props.className, 'cursor-default-i') }, { children: _jsx(SelectCell, { checked: props.dataItem.selected, disabled: !props.isRowSelectable, selectionChange: props.selectionChange, indeterminate: props.dataItem.indeterminate, control: props.control }) })));
33
37
  };
34
38
  export const SelectHeaderCell = (props) => (_jsx(SelectCell, { checked: props.selectionValue, indeterminate: props.isSomeRowsSelected, selectionChange: props.selectionChange, control: props.control }));
35
39
  //# sourceMappingURL=select-cell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-cell.js","sourceRoot":"","sources":["../../src/select-cell/select-cell.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAGH,QAAQ,GAEX,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM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E,UAAU,CAAC,KAAK,CAAC,SAAS,EAAE,kBAAkB,CAAC,gBAE1D,KAAC,UAAU,IACP,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAChC,QAAQ,EAAE,CAAC,KAAK,CAAC,eAAe,EAChC,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,aAAa,EAC3C,OAAO,EAAE,KAAK,CAAC,OAAO,GACxB,IACD,CACR,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA8B,CAAC,KAA4B,EAAE,EAAE,CAAC,CACzF,KAAC,UAAU,IACP,OAAO,EAAE,KAAK,CAAC,cAAc,EAC7B,aAAa,EAAE,KAAK,CAAC,kBAAkB,EACvC,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,OAAO,EAAE,KAAK,CAAC,OAAO,GACxB,CACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/table",
3
- "version": "22.1.3",
3
+ "version": "22.2.0",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/table",
6
6
  "repository": {
@@ -36,9 +36,9 @@
36
36
  "memoize-one": "~6.0.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@servicetitan/data-query": "^22.1.3",
39
+ "@servicetitan/data-query": "^22.2.0",
40
40
  "@servicetitan/design-system": "~11.8.0",
41
- "@servicetitan/form": "^22.1.3",
41
+ "@servicetitan/form": "^22.2.0",
42
42
  "@servicetitan/react-ioc": "^21.6.0",
43
43
  "@servicetitan/suppress-warnings": "^21.6.0",
44
44
  "@types/accounting": "~0.4.2",
@@ -52,9 +52,9 @@
52
52
  "react": "~17.0.2"
53
53
  },
54
54
  "peerDependencies": {
55
- "@servicetitan/data-query": "^22.1.3",
55
+ "@servicetitan/data-query": "^22.2.0",
56
56
  "@servicetitan/design-system": "~11.8.0",
57
- "@servicetitan/form": "^22.1.3",
57
+ "@servicetitan/form": "^22.2.0",
58
58
  "@servicetitan/react-ioc": "^20.0.0",
59
59
  "@servicetitan/suppress-warnings": "^20.0.0",
60
60
  "accounting": "~0.4.1",
@@ -71,5 +71,5 @@
71
71
  "cli": {
72
72
  "webpack": false
73
73
  },
74
- "gitHead": "fedb27aae8e53d7e6da888025b8b15981a63b23d"
74
+ "gitHead": "0e79148bdca464cfe0cb141338ee1a8f7d0036bb"
75
75
  }
@@ -1,10 +1,11 @@
1
- import { ComponentType, SyntheticEvent, FC } from 'react';
1
+ import { ComponentType, SyntheticEvent, FC, MouseEvent } from 'react';
2
2
  import {
3
3
  TableCellProps,
4
4
  TableHeaderCellProps,
5
5
  Checkbox,
6
6
  CheckboxProps,
7
7
  } from '@servicetitan/design-system';
8
+ import classNames from 'classnames';
8
9
  import * as Styles from './select-cell.module.css';
9
10
 
10
11
  export type SelectionControlType = ComponentType<CheckboxProps<never>>;
@@ -42,6 +43,7 @@ export const SelectCell: FC<SelectCellProps> = ({
42
43
  return <Control className={Styles.checkbox} onChange={onChange} {...props} />;
43
44
  };
44
45
 
46
+ const stopPropagation = (e: MouseEvent<HTMLTableCellElement>) => e.stopPropagation();
45
47
  export const SelectColumnCell: FC<SelectColumnCellProps> = (props: SelectColumnCellProps) => {
46
48
  if (props.rowType === 'groupHeader') {
47
49
  return null;
@@ -52,7 +54,12 @@ export const SelectColumnCell: FC<SelectColumnCellProps> = (props: SelectColumnC
52
54
  }
53
55
 
54
56
  return (
55
- <td style={props.style} className={props.className}>
57
+ <td
58
+ style={props.style}
59
+ // prevent onRowClick when user misses row selection
60
+ onClick={stopPropagation}
61
+ className={classNames(props.className, 'cursor-default-i')}
62
+ >
56
63
  <SelectCell
57
64
  checked={props.dataItem.selected}
58
65
  disabled={!props.isRowSelectable}