@servicetitan/table 22.4.5 → 23.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +33 -0
- package/dist/demo/column-hiding/index.d.ts +2 -0
- package/dist/demo/column-hiding/index.d.ts.map +1 -0
- package/dist/demo/column-hiding/index.js +2 -0
- package/dist/demo/column-hiding/index.js.map +1 -0
- package/dist/demo/column-hiding/product.d.ts +27 -0
- package/dist/demo/column-hiding/product.d.ts.map +1 -0
- package/dist/demo/column-hiding/product.js +16 -0
- package/dist/demo/column-hiding/product.js.map +1 -0
- package/dist/demo/column-hiding/products.d.ts +3 -0
- package/dist/demo/column-hiding/products.d.ts.map +1 -0
- package/dist/demo/column-hiding/products.js +127 -0
- package/dist/demo/column-hiding/products.js.map +1 -0
- package/dist/demo/column-hiding/table.d.ts +3 -0
- package/dist/demo/column-hiding/table.d.ts.map +1 -0
- package/dist/demo/column-hiding/table.js +63 -0
- package/dist/demo/column-hiding/table.js.map +1 -0
- package/dist/demo/column-hiding/table.store.d.ts +9 -0
- package/dist/demo/column-hiding/table.store.d.ts.map +1 -0
- package/dist/demo/column-hiding/table.store.js +44 -0
- package/dist/demo/column-hiding/table.store.js.map +1 -0
- package/dist/demo/index.d.ts +1 -0
- package/dist/demo/index.d.ts.map +1 -1
- package/dist/demo/index.js +1 -0
- package/dist/demo/index.js.map +1 -1
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.d.ts +1 -1
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.d.ts.map +1 -1
- package/dist/table-state.d.ts +3 -1
- package/dist/table-state.d.ts.map +1 -1
- package/dist/table-state.js +8 -1
- package/dist/table-state.js.map +1 -1
- package/dist/table.d.ts +3 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +28 -4
- package/dist/table.js.map +1 -1
- package/package.json +24 -24
- package/src/demo/column-hiding/index.ts +1 -0
- package/src/demo/column-hiding/product.ts +28 -0
- package/src/demo/column-hiding/products.ts +127 -0
- package/src/demo/column-hiding/table.store.ts +26 -0
- package/src/demo/column-hiding/table.tsx +118 -0
- package/src/demo/index.ts +1 -0
- package/src/filters/standard-filter-with-multiselect/filter-cell-ext.tsx +1 -1
- package/src/table-state.ts +18 -2
- package/src/table.stories.tsx +15 -0
- package/src/table.tsx +29 -6
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
+
# v23.0.0 (Fri Sep 09 2022)
|
2
|
+
|
3
|
+
#### 💥 Breaking Change
|
4
|
+
|
5
|
+
- DS-1141: Updating dependencies for design-system, tokens, formstate, etc [#150](https://github.com/servicetitan/anvil-uikit-contrib/pull/150) ([@rgdelato](https://github.com/rgdelato))
|
6
|
+
|
7
|
+
#### Authors: 1
|
8
|
+
|
9
|
+
- Ryan De La Torre ([@rgdelato](https://github.com/rgdelato))
|
10
|
+
|
11
|
+
---
|
12
|
+
|
13
|
+
# v22.5.0 (Wed Aug 31 2022)
|
14
|
+
|
15
|
+
:tada: This release contains work from a new contributor! :tada:
|
16
|
+
|
17
|
+
Thank you, Ara Asryan ([@araasryan](https://github.com/araasryan)), for all your work!
|
18
|
+
|
19
|
+
#### 🚀 Enhancement
|
20
|
+
|
21
|
+
- PB-10657: fix remounting of cell components [#149](https://github.com/servicetitan/anvil-uikit-contrib/pull/149) ([@araasryan](https://github.com/araasryan))
|
22
|
+
|
23
|
+
#### 🏠 Internal
|
24
|
+
|
25
|
+
- FAR-981: Moving examples to contrib storybook [#133](https://github.com/servicetitan/anvil-uikit-contrib/pull/133) ([@rgdelato](https://github.com/rgdelato))
|
26
|
+
|
27
|
+
#### Authors: 2
|
28
|
+
|
29
|
+
- Ara Asryan ([@araasryan](https://github.com/araasryan))
|
30
|
+
- Ryan De La Torre ([@rgdelato](https://github.com/rgdelato))
|
31
|
+
|
32
|
+
---
|
33
|
+
|
1
34
|
# v22.4.1 (Wed Jul 13 2022)
|
2
35
|
|
3
36
|
#### 🐛 Bug Fix
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/demo/column-hiding/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/demo/column-hiding/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
export declare enum UserRole {
|
2
|
+
Unspecified = 0,
|
3
|
+
Technician = 1,
|
4
|
+
GeneralOffice = 2,
|
5
|
+
Admin = 3,
|
6
|
+
Owner = 4
|
7
|
+
}
|
8
|
+
export declare enum Supplier {
|
9
|
+
Dan = 1,
|
10
|
+
Adam = 2,
|
11
|
+
Charlie = 3,
|
12
|
+
Benjamin = 4
|
13
|
+
}
|
14
|
+
export interface Product {
|
15
|
+
ProductID: number;
|
16
|
+
ProductName: string;
|
17
|
+
Supplier: Supplier;
|
18
|
+
CategoryID: number;
|
19
|
+
MadeIn: string;
|
20
|
+
QuantityPerUnit: string;
|
21
|
+
UnitPrice: number;
|
22
|
+
UnitsInStock: number;
|
23
|
+
UnitsOnOrder: Date;
|
24
|
+
Discontinued: boolean;
|
25
|
+
AvailableFor?: UserRole;
|
26
|
+
}
|
27
|
+
//# sourceMappingURL=product.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../../src/demo/column-hiding/product.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAChB,WAAW,IAAA;IACX,UAAU,IAAA;IACV,aAAa,IAAA;IACb,KAAK,IAAA;IACL,KAAK,IAAA;CACR;AAED,oBAAY,QAAQ;IAChB,GAAG,IAAI;IACP,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,QAAQ,IAAA;CACX;AAED,MAAM,WAAW,OAAO;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,IAAI,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export var UserRole;
|
2
|
+
(function (UserRole) {
|
3
|
+
UserRole[UserRole["Unspecified"] = 0] = "Unspecified";
|
4
|
+
UserRole[UserRole["Technician"] = 1] = "Technician";
|
5
|
+
UserRole[UserRole["GeneralOffice"] = 2] = "GeneralOffice";
|
6
|
+
UserRole[UserRole["Admin"] = 3] = "Admin";
|
7
|
+
UserRole[UserRole["Owner"] = 4] = "Owner";
|
8
|
+
})(UserRole || (UserRole = {}));
|
9
|
+
export var Supplier;
|
10
|
+
(function (Supplier) {
|
11
|
+
Supplier[Supplier["Dan"] = 1] = "Dan";
|
12
|
+
Supplier[Supplier["Adam"] = 2] = "Adam";
|
13
|
+
Supplier[Supplier["Charlie"] = 3] = "Charlie";
|
14
|
+
Supplier[Supplier["Benjamin"] = 4] = "Benjamin";
|
15
|
+
})(Supplier || (Supplier = {}));
|
16
|
+
//# sourceMappingURL=product.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"product.js","sourceRoot":"","sources":["../../../src/demo/column-hiding/product.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IAChB,qDAAW,CAAA;IACX,mDAAU,CAAA;IACV,yDAAa,CAAA;IACb,yCAAK,CAAA;IACL,yCAAK,CAAA;AACT,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AAED,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAChB,qCAAO,CAAA;IACP,uCAAI,CAAA;IACJ,6CAAO,CAAA;IACP,+CAAQ,CAAA;AACZ,CAAC,EALW,QAAQ,KAAR,QAAQ,QAKnB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../../src/demo/column-hiding/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAsB,MAAM,WAAW,CAAC;AAExD,eAAO,MAAM,QAAQ,EAAE,OAAO,EA4H7B,CAAC"}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
import { UserRole, Supplier } from './product';
|
2
|
+
export const products = [
|
3
|
+
{
|
4
|
+
ProductID: 101,
|
5
|
+
ProductName: 'Chai',
|
6
|
+
Supplier: Supplier.Dan,
|
7
|
+
CategoryID: 1,
|
8
|
+
MadeIn: 'China',
|
9
|
+
QuantityPerUnit: '10 boxes x 20 bags',
|
10
|
+
UnitPrice: 18.0,
|
11
|
+
UnitsInStock: 39,
|
12
|
+
UnitsOnOrder: new Date('1/11/2019'),
|
13
|
+
Discontinued: false,
|
14
|
+
AvailableFor: UserRole.Admin,
|
15
|
+
},
|
16
|
+
{
|
17
|
+
ProductID: 102,
|
18
|
+
ProductName: 'Chang',
|
19
|
+
Supplier: Supplier.Dan,
|
20
|
+
CategoryID: 1,
|
21
|
+
MadeIn: 'Thailand',
|
22
|
+
QuantityPerUnit: '24 - 12 oz bottles',
|
23
|
+
UnitPrice: 19.0,
|
24
|
+
UnitsInStock: 17,
|
25
|
+
UnitsOnOrder: new Date('2/11/2019'),
|
26
|
+
Discontinued: false,
|
27
|
+
},
|
28
|
+
{
|
29
|
+
ProductID: 103,
|
30
|
+
ProductName: 'Aniseed Syrup',
|
31
|
+
Supplier: Supplier.Dan,
|
32
|
+
CategoryID: 2,
|
33
|
+
MadeIn: 'France',
|
34
|
+
QuantityPerUnit: '12 - 550 ml bottles',
|
35
|
+
UnitPrice: 10.0,
|
36
|
+
UnitsInStock: 13,
|
37
|
+
UnitsOnOrder: new Date('3/11/2019'),
|
38
|
+
Discontinued: false,
|
39
|
+
AvailableFor: UserRole.Owner,
|
40
|
+
},
|
41
|
+
{
|
42
|
+
ProductID: 104,
|
43
|
+
ProductName: "Chef Anton's Cajun Seasoning",
|
44
|
+
Supplier: Supplier.Adam,
|
45
|
+
CategoryID: 2,
|
46
|
+
MadeIn: 'USA',
|
47
|
+
QuantityPerUnit: '48 - 6 oz jars',
|
48
|
+
UnitPrice: 22.0,
|
49
|
+
UnitsInStock: 53,
|
50
|
+
UnitsOnOrder: new Date('4/11/2019'),
|
51
|
+
Discontinued: false,
|
52
|
+
},
|
53
|
+
{
|
54
|
+
ProductID: 105,
|
55
|
+
ProductName: "Chef Anton's Gumbo Mix",
|
56
|
+
Supplier: Supplier.Adam,
|
57
|
+
CategoryID: 2,
|
58
|
+
MadeIn: 'USA',
|
59
|
+
QuantityPerUnit: '36 boxes',
|
60
|
+
UnitPrice: 21.35,
|
61
|
+
UnitsInStock: 0,
|
62
|
+
UnitsOnOrder: new Date('5/11/2019'),
|
63
|
+
Discontinued: true,
|
64
|
+
AvailableFor: UserRole.GeneralOffice,
|
65
|
+
},
|
66
|
+
{
|
67
|
+
ProductID: 106,
|
68
|
+
ProductName: "Grandma's Boysenberry Spread",
|
69
|
+
Supplier: Supplier.Charlie,
|
70
|
+
CategoryID: 2,
|
71
|
+
MadeIn: 'Norway',
|
72
|
+
QuantityPerUnit: '12 - 8 oz jars',
|
73
|
+
UnitPrice: 25.0,
|
74
|
+
UnitsInStock: 120,
|
75
|
+
UnitsOnOrder: new Date('6/11/2019'),
|
76
|
+
Discontinued: false,
|
77
|
+
},
|
78
|
+
{
|
79
|
+
ProductID: 107,
|
80
|
+
ProductName: "Uncle Bob's Organic Dried Pears",
|
81
|
+
Supplier: Supplier.Charlie,
|
82
|
+
CategoryID: 7,
|
83
|
+
MadeIn: 'USA',
|
84
|
+
QuantityPerUnit: '12 - 1 lb pkgs.',
|
85
|
+
UnitPrice: 30.0,
|
86
|
+
UnitsInStock: 15,
|
87
|
+
UnitsOnOrder: new Date('7/11/2019'),
|
88
|
+
Discontinued: false,
|
89
|
+
},
|
90
|
+
{
|
91
|
+
ProductID: 108,
|
92
|
+
ProductName: 'Northwoods Cranberry Sauce',
|
93
|
+
Supplier: Supplier.Charlie,
|
94
|
+
CategoryID: 2,
|
95
|
+
MadeIn: 'Norway',
|
96
|
+
QuantityPerUnit: '12 - 12 oz jars',
|
97
|
+
UnitPrice: 40.0,
|
98
|
+
UnitsInStock: 6,
|
99
|
+
UnitsOnOrder: new Date('8/11/2019'),
|
100
|
+
Discontinued: false,
|
101
|
+
},
|
102
|
+
{
|
103
|
+
ProductID: 109,
|
104
|
+
ProductName: 'Mishi Kobe Niku',
|
105
|
+
Supplier: Supplier.Benjamin,
|
106
|
+
CategoryID: 6,
|
107
|
+
MadeIn: 'Japan',
|
108
|
+
QuantityPerUnit: '18 - 500 g pkgs.',
|
109
|
+
UnitPrice: 97.0,
|
110
|
+
UnitsInStock: 29,
|
111
|
+
UnitsOnOrder: new Date('9/11/2019'),
|
112
|
+
Discontinued: true,
|
113
|
+
},
|
114
|
+
{
|
115
|
+
ProductID: 110,
|
116
|
+
ProductName: 'Ikura',
|
117
|
+
Supplier: Supplier.Benjamin,
|
118
|
+
CategoryID: 8,
|
119
|
+
MadeIn: 'Japan',
|
120
|
+
QuantityPerUnit: '12 - 200 ml jars',
|
121
|
+
UnitPrice: 31.0,
|
122
|
+
UnitsInStock: 31,
|
123
|
+
UnitsOnOrder: new Date('10/11/2019'),
|
124
|
+
Discontinued: false,
|
125
|
+
},
|
126
|
+
];
|
127
|
+
//# sourceMappingURL=products.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../src/demo/column-hiding/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,CAAC,MAAM,QAAQ,GAAc;IAC/B;QACI,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,MAAM;QACnB,QAAQ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AC3B,UAAU,EAAE,CAAC;QACb,MAAM,EAAE,OAAO;QACf,eAAe,EAAE,kBAAkB;QACnC,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC;QACnC,YAAY,EAAE,IAAI;KACrB;IACD;QACI,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,OAAO;QACpB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,UAAU,EAAE,CAAC;QACb,MAAM,EAAE,OAAO;QACf,eAAe,EAAE,kBAAkB;QACnC,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC;QACpC,YAAY,EAAE,KAAK;KACtB;CACJ,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/demo/column-hiding/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,EAAE,EAA+B,MAAM,OAAO,CAAC;AAkFlE,eAAO,MAAM,wBAAwB,EAAE,EAmCtC,CAAC"}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Fragment, memo, useCallback, useState } from 'react';
|
3
|
+
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
4
|
+
import { observer } from 'mobx-react';
|
5
|
+
import { Table, TableColumn } from '../..';
|
6
|
+
import { TableStore } from './table.store';
|
7
|
+
import { Supplier } from './product';
|
8
|
+
import { TableCell } from '@servicetitan/design-system';
|
9
|
+
const SupplierCell = props => {
|
10
|
+
const { field, dataItem } = props;
|
11
|
+
return _jsx("td", { children: Supplier[dataItem[field]] });
|
12
|
+
};
|
13
|
+
const columns = [
|
14
|
+
{ field: 'ProductID', title: 'ID', minWidth: 50 },
|
15
|
+
{ field: 'ProductName', title: 'Name', minWidth: 200 },
|
16
|
+
{ field: 'Supplier', title: 'Supplier', minWidth: 200 },
|
17
|
+
{ field: 'MadeIn', title: 'Made In', minWidth: 200 },
|
18
|
+
{ field: 'QuantityPerUnit', title: 'Quantity Per Unit', minWidth: 200 },
|
19
|
+
{ field: 'UnitPrice', title: 'Price', minWidth: 100 },
|
20
|
+
{ field: 'UnitsInStock', title: 'In stock', minWidth: 100 },
|
21
|
+
{ field: 'UnitsOnOrder', title: 'On Order', minWidth: 100 },
|
22
|
+
{ field: 'Discontinued', title: 'Discontinued', minWidth: 100 },
|
23
|
+
];
|
24
|
+
const CheckboxRow = memo(({ field, label, checked, onChange }) => {
|
25
|
+
const handleChange = useCallback(event => {
|
26
|
+
onChange(field, event.target.checked);
|
27
|
+
}, [field, onChange]);
|
28
|
+
return (_jsx("div", { children: _jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: checked, onChange: handleChange }), " ", label] }) }));
|
29
|
+
});
|
30
|
+
const HiddenColumns = ({ onChange, checkedColumns }) => {
|
31
|
+
const handleChange = useCallback((field, checked) => {
|
32
|
+
const newState = new Set(Array.from(checkedColumns));
|
33
|
+
if (checked) {
|
34
|
+
newState.add(field);
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
newState.delete(field);
|
38
|
+
}
|
39
|
+
onChange(newState);
|
40
|
+
}, [checkedColumns, onChange]);
|
41
|
+
return (_jsxs("div", { children: [_jsx("span", { children: "Select columns to hide" }), _jsx("div", { children: columns.map(col => (_jsx(CheckboxRow, { field: col.field, label: col.title, onChange: handleChange, checked: checkedColumns.has(col.field) }, col.field))) })] }));
|
42
|
+
};
|
43
|
+
const CellProvider = (props) => {
|
44
|
+
if (props.field === 'Supplier') {
|
45
|
+
return _jsx(SupplierCell, Object.assign({}, props));
|
46
|
+
}
|
47
|
+
return _jsx(TableCell, Object.assign({}, props));
|
48
|
+
};
|
49
|
+
export const TableColumnHidingExample = provide({
|
50
|
+
singletons: [TableStore],
|
51
|
+
})(observer(() => {
|
52
|
+
const [{ tableState }] = useDependencies(TableStore);
|
53
|
+
const [hiddenColumns, setHiddenColumns] = useState(new Set());
|
54
|
+
const handleHiddenColumnsChange = useCallback(columns => {
|
55
|
+
setHiddenColumns(new Set([...columns]));
|
56
|
+
}, []);
|
57
|
+
return (_jsxs(Fragment, { children: [_jsx(HiddenColumns, { checkedColumns: hiddenColumns, onChange: handleHiddenColumnsChange }), _jsx(Table, Object.assign({ tableState: tableState, striped: false }, { children: columns
|
58
|
+
.filter(col => !hiddenColumns.has(col.field))
|
59
|
+
.map(column => {
|
60
|
+
return (_jsx(TableColumn, { field: column.field, title: column.title, id: column.field, cell: CellProvider }, column.field));
|
61
|
+
}) }))] }));
|
62
|
+
}));
|
63
|
+
//# sourceMappingURL=table.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/demo/column-hiding/table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAM,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAkB,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,MAAM,YAAY,GAAuB,KAAK,CAAC,EAAE;IAC7C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAElC,OAAO,uBAAK,QAAQ,CAAC,QAAQ,CAAC,KAAM,CAAC,CAAC,GAAM,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG;IACZ,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI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D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IAE9D,MAAM,yBAAyB,GAAG,WAAW,CAAC,OAAO,CAAC,EAAE;QACpD,gBAAgB,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACH,MAAC,QAAQ,eACL,KAAC,aAAa,IACV,cAAc,EAAE,aAAa,EAC7B,QAAQ,EAAE,yBAAyB,GACrC,EACF,KAAC,KAAK,kBAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,gBACxC,OAAO;qBACH,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;qBAC5C,GAAG,CAAC,MAAM,CAAC,EAAE;oBACV,OAAO,CACH,KAAC,WAAW,IACR,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,KAAK,EAAE,MAAM,CAAC,KAAK,EAEnB,EAAE,EAAE,MAAM,CAAC,KAAK,EAChB,IAAI,EAAE,YAAY,IAFb,MAAM,CAAC,KAAK,CAGnB,CACL,CAAC;gBACN,CAAC,CAAC,IACF,IACD,CACd,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { IdType, TableState } from '../..';
|
2
|
+
import { Product } from './product';
|
3
|
+
export declare class TableStore {
|
4
|
+
rowIdKey: keyof Product;
|
5
|
+
tableState: TableState<Product, IdType, never, never>;
|
6
|
+
private getDataSource;
|
7
|
+
private idSelector;
|
8
|
+
}
|
9
|
+
//# sourceMappingURL=table.store.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"table.store.d.ts","sourceRoot":"","sources":["../../../src/demo/column-hiding/table.store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAsB,UAAU,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAsB,MAAM,WAAW,CAAC;AAGxD,qBACa,UAAU;IACnB,QAAQ,EAAE,MAAM,OAAO,CAAe;IAEtC,UAAU,4CAIP;IAEH,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,UAAU;CAGrB"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
import { injectable } from '@servicetitan/react-ioc';
|
8
|
+
import { InMemoryDataSource, TableState } from '../..';
|
9
|
+
import { UserRole, Supplier } from './product';
|
10
|
+
import { products } from './products';
|
11
|
+
let TableStore = class TableStore {
|
12
|
+
constructor() {
|
13
|
+
Object.defineProperty(this, "rowIdKey", {
|
14
|
+
enumerable: true,
|
15
|
+
configurable: true,
|
16
|
+
writable: true,
|
17
|
+
value: 'ProductID'
|
18
|
+
});
|
19
|
+
Object.defineProperty(this, "tableState", {
|
20
|
+
enumerable: true,
|
21
|
+
configurable: true,
|
22
|
+
writable: true,
|
23
|
+
value: new TableState({
|
24
|
+
dataSource: this.getDataSource(),
|
25
|
+
pageSize: 5,
|
26
|
+
rowIdKey: this.rowIdKey,
|
27
|
+
})
|
28
|
+
});
|
29
|
+
}
|
30
|
+
getDataSource() {
|
31
|
+
return new InMemoryDataSource(products, this.idSelector, {
|
32
|
+
Supplier: (value) => Supplier[value],
|
33
|
+
AvailableFor: (value) => value && UserRole[value],
|
34
|
+
});
|
35
|
+
}
|
36
|
+
idSelector(row) {
|
37
|
+
return row[this.rowIdKey];
|
38
|
+
}
|
39
|
+
};
|
40
|
+
TableStore = __decorate([
|
41
|
+
injectable()
|
42
|
+
], TableStore);
|
43
|
+
export { TableStore };
|
44
|
+
//# sourceMappingURL=table.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"table.store.js","sourceRoot":"","sources":["../../../src/demo/column-hiding/table.store.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAU,kBAAkB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAW,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,IAAa,UAAU,GAAvB,MAAa,UAAU;IAAvB;QACI;;;;mBAA0B,WAAW;WAAC;QAEtC;;;;mBAAa,IAAI,UAAU,CAAC;gBACxB,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;gBAChC,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;aAC1B,CAAC;WAAC;IAYP,CAAC;IAVW,aAAa;QACjB,OAAO,IAAI,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE;YACrD,QAAQ,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC9C,YAAY,EAAE,CAAC,KAA2B,EAAE,EAAE,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;SAC1E,CAAC,CAAC;IACP,CAAC;IAEO,UAAU,CAAC,GAAY;QAC3B,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAW,CAAC;IACxC,CAAC;CACJ,CAAA;AAnBY,UAAU;IADtB,UAAU,EAAE;GACA,UAAU,CAmBtB;SAnBY,UAAU"}
|
package/dist/demo/index.d.ts
CHANGED
package/dist/demo/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/demo/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/demo/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
package/dist/demo/index.js
CHANGED
package/dist/demo/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/demo/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/demo/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
@@ -13,7 +13,7 @@ export interface FilterCellExtProps extends TableColumnMenuFilterCellProps {
|
|
13
13
|
onlyMultiselectAndEmptyOperators?: boolean;
|
14
14
|
handleCustomValuesAsNumber?: boolean;
|
15
15
|
multiselectItemRender?(li: ReactElement<HTMLLIElement>, itemProps: ListItemProps): ReactNode;
|
16
|
-
multiselectTagRender?(tagData: MultiSelectTagData, li: ReactElement<HTMLLIElement>): ReactElement<HTMLLIElement
|
16
|
+
multiselectTagRender?(tagData: MultiSelectTagData, li: ReactElement<HTMLLIElement>): ReactElement<HTMLLIElement>;
|
17
17
|
multiselectListNoDataRender?(element: ReactElement<HTMLDivElement>): ReactNode;
|
18
18
|
}
|
19
19
|
export declare const FilterCellExt: FC<FilterCellExtProps>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"filter-cell-ext.d.ts","sourceRoot":"","sources":["../../../src/filters/standard-filter-with-multiselect/filter-cell-ext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAe,MAAM,OAAO,CAAC;AAKjE,OAAO,EAMH,aAAa,EACb,kBAAkB,EACrB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,6BAA6B,IAAI,8BAA8B,EAAE,MAAM,yEAAyE,CAAC;AAS1J,UAAU,kBAAkB;IACxB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAmB,SAAQ,8BAA8B;IACtE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,qBAAqB,CAAC,CAAC,EAAE,EAAE,YAAY,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7F,oBAAoB,CAAC,CACjB,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,YAAY,CAAC,aAAa,CAAC,GAChC,YAAY,CAAC,aAAa,CAAC,
|
1
|
+
{"version":3,"file":"filter-cell-ext.d.ts","sourceRoot":"","sources":["../../../src/filters/standard-filter-with-multiselect/filter-cell-ext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAe,MAAM,OAAO,CAAC;AAKjE,OAAO,EAMH,aAAa,EACb,kBAAkB,EACrB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,6BAA6B,IAAI,8BAA8B,EAAE,MAAM,yEAAyE,CAAC;AAS1J,UAAU,kBAAkB;IACxB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAmB,SAAQ,8BAA8B;IACtE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,qBAAqB,CAAC,CAAC,EAAE,EAAE,YAAY,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7F,oBAAoB,CAAC,CACjB,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,YAAY,CAAC,aAAa,CAAC,GAChC,YAAY,CAAC,aAAa,CAAC,CAAC;IAC/B,2BAA2B,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;CAClF;AAGD,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAuI/C,CAAC"}
|
package/dist/table-state.d.ts
CHANGED
@@ -46,6 +46,7 @@ interface TableStateConstructorParams<T, TId extends IdType = never, P = never,
|
|
46
46
|
getDetailTableState?: (row: T) => TableState<any, any, any, any> | undefined;
|
47
47
|
initialState?: TableStateModel<TId>;
|
48
48
|
alwaysEditable?: boolean;
|
49
|
+
rowIdKey?: string;
|
49
50
|
}
|
50
51
|
interface FetchDataParams {
|
51
52
|
newSkip?: number;
|
@@ -115,8 +116,9 @@ export declare class TableState<T, TId extends IdType = never, P = never, PId ex
|
|
115
116
|
pageSize?: number;
|
116
117
|
private tablePdfExport;
|
117
118
|
private tableExcelExport;
|
119
|
+
rowIdKey?: string;
|
118
120
|
alwaysEditable: boolean;
|
119
|
-
constructor({ dataSource, pageSize, isRowUnselectable, selectionLimit, getFormState, parent, getDetailTableState, initialState, alwaysEditable, }?: TableStateConstructorParams<T, TId, P, PId>);
|
121
|
+
constructor({ dataSource, rowIdKey, pageSize, isRowUnselectable, selectionLimit, getFormState, parent, getDetailTableState, initialState, alwaysEditable, }?: TableStateConstructorParams<T, TId, P, PId>);
|
120
122
|
addToDataSource(row: T, select?: boolean, index?: number): Promise<void>;
|
121
123
|
removeFromDataSource(id: TId): Promise<T | undefined>;
|
122
124
|
setRowsSelection(rows: T[], value: boolean, { ignoreUnselectable, recursive }?: SelectionOptions): Promise<void>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"table-state.d.ts","sourceRoot":"","sources":["../src/table-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EACH,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACT,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,WAAW,EACX,eAAe,EACf,sBAAsB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGlD,oBAAY,UAAU,CAAC,CAAC,IAAI;IAAE,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,GAAG,CAAC,CAAC;AAC3E,oBAAY,QAAQ,CAAC,CAAC,IAAI;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE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GAAG,OAAO;IAyB5D,OAAO,CAAC,gBAAgB,CAqBtB;IAEF,OAAO,CAAC,mBAAmB;IAgE3B,kBAAkB,OAAQ,sBAAsB,UAI9C;IAGF,iBAAiB,OAAQ,qBAAqB,UAM5C;IAGF,kBAAkB,wBAAyB,sBAAsB,UA0B/D;IAGF,gBAAgB,OAAQ,oBAAoB,UAI1C;IAGF,gBAAgB,OAAQ,oBAAoB,UAW1C;IAEF,uCAAuC;IACvC,SAAS,+DAMN,eAAe,mBA2EhB;IAEF,eAAe,QAAS,WAAW,CAAC,CAAC,aAIa;IAG5C,kBAAkB,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAgB3D,IAAc,qBAAqB,YAKlC;IAED,IAAc,sBAAsB,YAEnC;IAED,IAAc,iBAAiB,YAM9B;IAED,IAAc,kBAAkB,YAM/B;IAED,oBAAoB,OAAQ,cAAc,GAAG,IAAI,2BAAgC;IACjF,sBAAsB,OAAQ,WAAW,GAAG,IAAI,wBAAkC;IAElF,SAAS,sBAKP;IAEF,WAAW,gOAUT;IAEF,6BAA6B,+BAS3B;IAEF,cAAc,UAAW,WAAW,CAAC,CAAC,OAAO,WAAW,CAAC,CAAC,qBA6BxD;IAEF,WAAW,IAAI,eAAe,CAAC,GAAG,CAAC;IAcnC,WAAW,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,CAAC;CAUzC"}
|
package/dist/table-state.js
CHANGED
@@ -27,7 +27,7 @@ function addAggregatesToGroups(groups, aggregates) {
|
|
27
27
|
return groups.map(group => (Object.assign(Object.assign({}, group), { aggregates })));
|
28
28
|
}
|
29
29
|
export class TableState {
|
30
|
-
constructor({ dataSource = null, pageSize, isRowUnselectable = () => false, selectionLimit = Infinity, getFormState, parent, getDetailTableState, initialState, alwaysEditable = false, } = {}) {
|
30
|
+
constructor({ dataSource = null, rowIdKey, pageSize, isRowUnselectable = () => false, selectionLimit = Infinity, getFormState, parent, getDetailTableState, initialState, alwaysEditable = false, } = {}) {
|
31
31
|
Object.defineProperty(this, "innerDataSource", {
|
32
32
|
enumerable: true,
|
33
33
|
configurable: true,
|
@@ -160,6 +160,12 @@ export class TableState {
|
|
160
160
|
writable: true,
|
161
161
|
value: null
|
162
162
|
});
|
163
|
+
Object.defineProperty(this, "rowIdKey", {
|
164
|
+
enumerable: true,
|
165
|
+
configurable: true,
|
166
|
+
writable: true,
|
167
|
+
value: void 0
|
168
|
+
});
|
163
169
|
Object.defineProperty(this, "alwaysEditable", {
|
164
170
|
enumerable: true,
|
165
171
|
configurable: true,
|
@@ -431,6 +437,7 @@ export class TableState {
|
|
431
437
|
this.pageSize = pageSize;
|
432
438
|
this.isRowUnselectable = isRowUnselectable;
|
433
439
|
this.selectionLimit = selectionLimit;
|
440
|
+
this.rowIdKey = rowIdKey;
|
434
441
|
this.getFormState = getFormState;
|
435
442
|
this.parent = parent;
|
436
443
|
this.getDetailTableState = getDetailTableState;
|