@servicetitan/table 22.1.2 → 22.1.3

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.1.3 (Wed Jun 29 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Revert "Table: allow user to select table row by clicking on any spot within cell with selection" [#120](https://github.com/servicetitan/anvil-uikit-contrib/pull/120) ([@kanoshin](https://github.com/kanoshin))
6
+
7
+ #### Authors: 1
8
+
9
+ - Kirill Anoshin ([@kanoshin](https://github.com/kanoshin))
10
+
11
+ ---
12
+
1
13
  # v22.1.2 (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;AACvE,OAAO,EACH,cAAc,EACd,oBAAoB,EAEpB,aAAa,EAChB,MAAM,6BAA6B,CAAC;AAIrC,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,EAAE,oBA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
@@ -10,33 +10,26 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import { useCallback } from 'react';
14
13
  import { Checkbox, } from '@servicetitan/design-system';
15
- import classNames from 'classnames';
16
14
  import * as Styles from './select-cell.module.css';
17
15
  export const SelectCell = (_a) => {
18
16
  var { selectionChange, control: Control = Checkbox } = _a, props = __rest(_a, ["selectionChange", "control"]);
19
- const onChange = useCallback((_0, _1, event) => {
17
+ const onChange = (_0, _1, event) => {
20
18
  if (!selectionChange) {
21
19
  return;
22
20
  }
23
21
  selectionChange({ syntheticEvent: event });
24
- }, [selectionChange]);
22
+ };
25
23
  return _jsx(Control, Object.assign({ className: Styles.checkbox, onChange: onChange }, props));
26
24
  };
27
- export const SelectColumnCell = ({ style, rowType, dataItem, control, isRowSelectable, selectionChange, className, }) => {
28
- const onSelectionChange = useCallback((event) => {
29
- if (isRowSelectable && selectionChange) {
30
- selectionChange({ syntheticEvent: event });
31
- }
32
- }, [selectionChange, isRowSelectable]);
33
- if (rowType === 'groupHeader') {
25
+ export const SelectColumnCell = (props) => {
26
+ if (props.rowType === 'groupHeader') {
34
27
  return null;
35
28
  }
36
- if (rowType === 'groupFooter') {
29
+ if (props.rowType === 'groupFooter') {
37
30
  return _jsx("td", {});
38
31
  }
39
- return (_jsx("td", Object.assign({ style: style, className: classNames(isRowSelectable && selectionChange && 'cursor-pointer', className), onClick: onSelectionChange }, { children: _jsx(SelectCell, { checked: dataItem.selected, disabled: !isRowSelectable, indeterminate: dataItem.indeterminate, control: control }) })));
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 }) })));
40
33
  };
41
34
  export const SelectHeaderCell = (props) => (_jsx(SelectCell, { checked: props.selectionValue, indeterminate: props.isSomeRowsSelected, selectionChange: props.selectionChange, control: props.control }));
42
35
  //# sourceMappingURL=select-cell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-cell.js","sourceRoot":"","sources":["../../src/select-cell/select-cell.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAqC,WAAW,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAGH,QAAQ,GAEX,MAAM,6BAA6B,CAAC;AACrC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AAsBnD,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,EAI9B,EAAE,EAAE;QAJ0B,EAC5C,eAAe,EACf,OAAO,EAAE,OAAO,GAAG,QAAQ,OAEb,EADX,KAAK,cAHoC,8BAI/C,CADW;IAER,MAAM,QAAQ,GAAG,WAAW,CACxB,CAAC,EAAS,EAAE,EAAW,EAAE,KAAuC,EAAE,EAAE;QAChE,IAAI,CAAC,eAAe,EAAE;YAClB,OAAO;SACV;QACD,eAAe,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC,EACD,CAAC,eAAe,CAAC,CACpB,CAAC;IAEF,OAAO,KAAC,OAAO,kBAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAM,KAAK,EAAI,CAAC;AAClF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA8B,CAAC,EACxD,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,eAAe,EACf,eAAe,EACf,SAAS,GACW,EAAE,EAAE;IACxB,MAAM,iBAAiB,GAAG,WAAW,CACjC,CAAC,KAA2C,EAAE,EAAE;QAC5C,IAAI,eAAe,IAAI,eAAe,EAAE;YACpC,eAAe,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;SAC9C;IACL,CAAC,EACD,CAAC,eAAe,EAAE,eAAe,CAAC,CACrC,CAAC;IAEF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CAAC,CAAC;IAC/C,CAAC,CAAC;IAEF,OAAO,KAAC,OAAO,kBAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAM,KAAK,EAAI,CAAC;AAClF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA8B,CAAC,KAA4B,EAAE,EAAE;IACxF,IAAI,KAAK,CAAC,OAAO,KAAK,aAAa,EAAE;QACjC,OAAO,IAAI,CAAC;KACf;IAED,IAAI,KAAK,CAAC,OAAO,KAAK,aAAa,EAAE;QACjC,OAAO,cAAM,CAAC;KACjB;IAED,OAAO,CACH,2BAAI,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,gBAC9C,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.2",
3
+ "version": "22.1.3",
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.2",
39
+ "@servicetitan/data-query": "^22.1.3",
40
40
  "@servicetitan/design-system": "~11.8.0",
41
- "@servicetitan/form": "^22.1.2",
41
+ "@servicetitan/form": "^22.1.3",
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.2",
55
+ "@servicetitan/data-query": "^22.1.3",
56
56
  "@servicetitan/design-system": "~11.8.0",
57
- "@servicetitan/form": "^22.1.2",
57
+ "@servicetitan/form": "^22.1.3",
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": "9f87b9bf91c403984f6f4d9bdc5c0cc20302bb57"
74
+ "gitHead": "fedb27aae8e53d7e6da888025b8b15981a63b23d"
75
75
  }
@@ -1,11 +1,10 @@
1
- import { ComponentType, SyntheticEvent, FC, useCallback } from 'react';
1
+ import { ComponentType, SyntheticEvent, FC } 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';
9
8
  import * as Styles from './select-cell.module.css';
10
9
 
11
10
  export type SelectionControlType = ComponentType<CheckboxProps<never>>;
@@ -33,59 +32,33 @@ export const SelectCell: FC<SelectCellProps> = ({
33
32
  control: Control = Checkbox,
34
33
  ...props
35
34
  }: SelectCellProps) => {
36
- const onChange = useCallback(
37
- (_0: never, _1: boolean, event: SyntheticEvent<HTMLInputElement>) => {
38
- if (!selectionChange) {
39
- return;
40
- }
41
- selectionChange({ syntheticEvent: event });
42
- },
43
- [selectionChange]
44
- );
35
+ const onChange = (_0: never, _1: boolean, event: SyntheticEvent<HTMLInputElement>) => {
36
+ if (!selectionChange) {
37
+ return;
38
+ }
39
+ selectionChange({ syntheticEvent: event });
40
+ };
45
41
 
46
42
  return <Control className={Styles.checkbox} onChange={onChange} {...props} />;
47
43
  };
48
44
 
49
- export const SelectColumnCell: FC<SelectColumnCellProps> = ({
50
- style,
51
- rowType,
52
- dataItem,
53
- control,
54
- isRowSelectable,
55
- selectionChange,
56
- className,
57
- }: SelectColumnCellProps) => {
58
- const onSelectionChange = useCallback(
59
- (event: SyntheticEvent<HTMLTableCellElement>) => {
60
- if (isRowSelectable && selectionChange) {
61
- selectionChange({ syntheticEvent: event });
62
- }
63
- },
64
- [selectionChange, isRowSelectable]
65
- );
66
-
67
- if (rowType === 'groupHeader') {
45
+ export const SelectColumnCell: FC<SelectColumnCellProps> = (props: SelectColumnCellProps) => {
46
+ if (props.rowType === 'groupHeader') {
68
47
  return null;
69
48
  }
70
49
 
71
- if (rowType === 'groupFooter') {
50
+ if (props.rowType === 'groupFooter') {
72
51
  return <td />;
73
52
  }
74
53
 
75
54
  return (
76
- <td
77
- style={style}
78
- className={classNames(
79
- isRowSelectable && selectionChange && 'cursor-pointer',
80
- className
81
- )}
82
- onClick={onSelectionChange}
83
- >
55
+ <td style={props.style} className={props.className}>
84
56
  <SelectCell
85
- checked={dataItem.selected}
86
- disabled={!isRowSelectable}
87
- indeterminate={dataItem.indeterminate}
88
- control={control}
57
+ checked={props.dataItem.selected}
58
+ disabled={!props.isRowSelectable}
59
+ selectionChange={props.selectionChange}
60
+ indeterminate={props.dataItem.indeterminate}
61
+ control={props.control}
89
62
  />
90
63
  </td>
91
64
  );