@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,
|
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,EAAE,oBAAoB,CAAC;CAClC;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAa1C,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAoBtD,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAOtD,CAAC"}
|
@@ -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 =
|
17
|
+
const onChange = (_0, _1, event) => {
|
20
18
|
if (!selectionChange) {
|
21
19
|
return;
|
22
20
|
}
|
23
21
|
selectionChange({ syntheticEvent: event });
|
24
|
-
}
|
22
|
+
};
|
25
23
|
return _jsx(Control, Object.assign({ className: Styles.checkbox, onChange: onChange }, props));
|
26
24
|
};
|
27
|
-
export const SelectColumnCell = (
|
28
|
-
|
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:
|
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":";;;;;;;;;;;;
|
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,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,CAAC,EAAS,EAAE,EAAW,EAAE,KAAuC,EAAE,EAAE;QACjF,IAAI,CAAC,eAAe,EAAE;YAClB,OAAO;SACV;QACD,eAAe,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,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.
|
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.
|
39
|
+
"@servicetitan/data-query": "^22.1.3",
|
40
40
|
"@servicetitan/design-system": "~11.8.0",
|
41
|
-
"@servicetitan/form": "^22.1.
|
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.
|
55
|
+
"@servicetitan/data-query": "^22.1.3",
|
56
56
|
"@servicetitan/design-system": "~11.8.0",
|
57
|
-
"@servicetitan/form": "^22.1.
|
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": "
|
74
|
+
"gitHead": "fedb27aae8e53d7e6da888025b8b15981a63b23d"
|
75
75
|
}
|
@@ -1,11 +1,10 @@
|
|
1
|
-
import { ComponentType, SyntheticEvent, FC
|
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 =
|
37
|
-
(
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
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
|
-
|
88
|
-
|
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
|
);
|