@servicetitan/table 19.4.0 → 20.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/demo/index.js +3 -15
- package/dist/demo/index.js.map +1 -1
- package/dist/demo/master-detail/detail-table.js +15 -18
- package/dist/demo/master-detail/detail-table.js.map +1 -1
- package/dist/demo/master-detail/detail-table.store.js +14 -17
- package/dist/demo/master-detail/detail-table.store.js.map +1 -1
- package/dist/demo/master-detail/index.js +1 -13
- package/dist/demo/master-detail/index.js.map +1 -1
- package/dist/demo/master-detail/master-table.store.js +14 -17
- package/dist/demo/master-detail/master-table.store.js.map +1 -1
- package/dist/demo/master-detail/product-detail.js +1 -2
- package/dist/demo/master-detail/product-details.js +1 -4
- package/dist/demo/master-detail/product-details.js.map +1 -1
- package/dist/demo/master-detail/product.js +4 -7
- package/dist/demo/master-detail/product.js.map +1 -1
- package/dist/demo/master-detail/products.js +15 -18
- package/dist/demo/master-detail/products.js.map +1 -1
- package/dist/demo/master-detail/table-master-detail.js +13 -16
- package/dist/demo/master-detail/table-master-detail.js.map +1 -1
- package/dist/demo/overview/actions-cell.js +8 -11
- package/dist/demo/overview/actions-cell.js.map +1 -1
- package/dist/demo/overview/index.js +1 -13
- package/dist/demo/overview/index.js.map +1 -1
- package/dist/demo/overview/product.js +4 -7
- package/dist/demo/overview/product.js.map +1 -1
- package/dist/demo/overview/products.js +15 -18
- package/dist/demo/overview/products.js.map +1 -1
- package/dist/demo/overview/table.js +24 -27
- package/dist/demo/overview/table.js.map +1 -1
- package/dist/demo/overview/table.store.js +27 -30
- package/dist/demo/overview/table.store.js.map +1 -1
- package/dist/demo/state-caching/beverages.js +1 -4
- package/dist/demo/state-caching/beverages.js.map +1 -1
- package/dist/demo/state-caching/index.js +1 -13
- package/dist/demo/state-caching/index.js.map +1 -1
- package/dist/demo/state-caching/product.js +1 -2
- package/dist/demo/state-caching/products.js +1 -4
- package/dist/demo/state-caching/products.js.map +1 -1
- package/dist/demo/state-caching/state-caching-table.js +12 -15
- package/dist/demo/state-caching/state-caching-table.js.map +1 -1
- package/dist/demo/state-caching/state-caching-table.store.js +9 -12
- package/dist/demo/state-caching/state-caching-table.store.js.map +1 -1
- package/dist/editable-cell/boolean-editable-cell.js +7 -10
- package/dist/editable-cell/boolean-editable-cell.js.map +1 -1
- package/dist/editable-cell/date-editable-cell.js +7 -10
- package/dist/editable-cell/date-editable-cell.js.map +1 -1
- package/dist/editable-cell/get-action-cell.js +6 -10
- package/dist/editable-cell/get-action-cell.js.map +1 -1
- package/dist/editable-cell/get-editable-cell.js +6 -10
- package/dist/editable-cell/get-editable-cell.js.map +1 -1
- package/dist/editable-cell/get-select-editable-cell.js +9 -16
- package/dist/editable-cell/get-select-editable-cell.js.map +1 -1
- package/dist/editable-cell/index.js +7 -19
- package/dist/editable-cell/index.js.map +1 -1
- package/dist/editable-cell/numeric-editable-cell.js +7 -10
- package/dist/editable-cell/numeric-editable-cell.js.map +1 -1
- package/dist/editable-cell/text-editable-cell.js +10 -14
- package/dist/editable-cell/text-editable-cell.js.map +1 -1
- package/dist/export/export.js +5 -28
- package/dist/export/export.js.map +1 -1
- package/dist/export/index.js +1 -13
- package/dist/export/index.js.map +1 -1
- package/dist/filters/column-menu-filters.js +7 -12
- package/dist/filters/column-menu-filters.js.map +1 -1
- package/dist/filters/datetime-filter/datetime-filter.js +17 -39
- package/dist/filters/datetime-filter/datetime-filter.js.map +1 -1
- package/dist/filters/field-values-filter.js +21 -26
- package/dist/filters/field-values-filter.js.map +1 -1
- package/dist/filters/index.js +8 -20
- package/dist/filters/index.js.map +1 -1
- package/dist/filters/multiselect-filter.js +17 -23
- package/dist/filters/multiselect-filter.js.map +1 -1
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.js +2 -6
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.js.map +1 -1
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.js +13 -16
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.js.map +1 -1
- package/dist/filters/range-filter/range-filter.js +20 -45
- package/dist/filters/range-filter/range-filter.js.map +1 -1
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.js +16 -38
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.js.map +1 -1
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.js +2 -6
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.js.map +1 -1
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.js +12 -16
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.js.map +1 -1
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.js +8 -12
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.js.map +1 -1
- package/dist/filters/time-filter/time-filter.js +17 -39
- package/dist/filters/time-filter/time-filter.js.map +1 -1
- package/dist/index.js +8 -29
- package/dist/index.js.map +1 -1
- package/dist/select-cell/index.js +1 -13
- package/dist/select-cell/index.js.map +1 -1
- package/dist/select-cell/select-cell.js +10 -35
- package/dist/select-cell/select-cell.js.map +1 -1
- package/dist/table-state.js +63 -68
- package/dist/table-state.js.map +1 -1
- package/dist/table.js +35 -60
- package/dist/table.js.map +1 -1
- package/package.json +15 -14
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"product.js","sourceRoot":"","sources":["../../../src/demo/overview/product.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"product.js","sourceRoot":"","sources":["../../../src/demo/overview/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"}
|
@@ -1,12 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
exports.products = void 0;
|
4
|
-
const product_1 = require("./product");
|
5
|
-
exports.products = [
|
1
|
+
import { UserRole, Supplier } from './product';
|
2
|
+
export const products = [
|
6
3
|
{
|
7
4
|
ProductID: 1,
|
8
5
|
ProductName: 'Chai',
|
9
|
-
Supplier:
|
6
|
+
Supplier: Supplier.Dan,
|
10
7
|
CategoryID: 1,
|
11
8
|
MadeIn: 'China',
|
12
9
|
QuantityPerUnit: '10 boxes x 20 bags',
|
@@ -14,12 +11,12 @@ exports.products = [
|
|
14
11
|
UnitsInStock: 39,
|
15
12
|
UnitsOnOrder: new Date('1/11/2019'),
|
16
13
|
Discontinued: false,
|
17
|
-
AvailableFor:
|
14
|
+
AvailableFor: UserRole.Admin,
|
18
15
|
},
|
19
16
|
{
|
20
17
|
ProductID: 2,
|
21
18
|
ProductName: 'Chang',
|
22
|
-
Supplier:
|
19
|
+
Supplier: Supplier.Dan,
|
23
20
|
CategoryID: 1,
|
24
21
|
MadeIn: 'Thailand',
|
25
22
|
QuantityPerUnit: '24 - 12 oz bottles',
|
@@ -31,7 +28,7 @@ exports.products = [
|
|
31
28
|
{
|
32
29
|
ProductID: 3,
|
33
30
|
ProductName: 'Aniseed Syrup',
|
34
|
-
Supplier:
|
31
|
+
Supplier: Supplier.Dan,
|
35
32
|
CategoryID: 2,
|
36
33
|
MadeIn: 'France',
|
37
34
|
QuantityPerUnit: '12 - 550 ml bottles',
|
@@ -39,12 +36,12 @@ exports.products = [
|
|
39
36
|
UnitsInStock: 13,
|
40
37
|
UnitsOnOrder: new Date('3/11/2019'),
|
41
38
|
Discontinued: false,
|
42
|
-
AvailableFor:
|
39
|
+
AvailableFor: UserRole.Owner,
|
43
40
|
},
|
44
41
|
{
|
45
42
|
ProductID: 4,
|
46
43
|
ProductName: "Chef Anton's Cajun Seasoning",
|
47
|
-
Supplier:
|
44
|
+
Supplier: Supplier.Adam,
|
48
45
|
CategoryID: 2,
|
49
46
|
MadeIn: 'USA',
|
50
47
|
QuantityPerUnit: '48 - 6 oz jars',
|
@@ -56,7 +53,7 @@ exports.products = [
|
|
56
53
|
{
|
57
54
|
ProductID: 5,
|
58
55
|
ProductName: "Chef Anton's Gumbo Mix",
|
59
|
-
Supplier:
|
56
|
+
Supplier: Supplier.Adam,
|
60
57
|
CategoryID: 2,
|
61
58
|
MadeIn: 'USA',
|
62
59
|
QuantityPerUnit: '36 boxes',
|
@@ -64,12 +61,12 @@ exports.products = [
|
|
64
61
|
UnitsInStock: 0,
|
65
62
|
UnitsOnOrder: new Date('5/11/2019'),
|
66
63
|
Discontinued: true,
|
67
|
-
AvailableFor:
|
64
|
+
AvailableFor: UserRole.GeneralOffice,
|
68
65
|
},
|
69
66
|
{
|
70
67
|
ProductID: 6,
|
71
68
|
ProductName: "Grandma's Boysenberry Spread",
|
72
|
-
Supplier:
|
69
|
+
Supplier: Supplier.Charlie,
|
73
70
|
CategoryID: 2,
|
74
71
|
MadeIn: 'Norway',
|
75
72
|
QuantityPerUnit: '12 - 8 oz jars',
|
@@ -81,7 +78,7 @@ exports.products = [
|
|
81
78
|
{
|
82
79
|
ProductID: 7,
|
83
80
|
ProductName: "Uncle Bob's Organic Dried Pears",
|
84
|
-
Supplier:
|
81
|
+
Supplier: Supplier.Charlie,
|
85
82
|
CategoryID: 7,
|
86
83
|
MadeIn: 'USA',
|
87
84
|
QuantityPerUnit: '12 - 1 lb pkgs.',
|
@@ -93,7 +90,7 @@ exports.products = [
|
|
93
90
|
{
|
94
91
|
ProductID: 8,
|
95
92
|
ProductName: 'Northwoods Cranberry Sauce',
|
96
|
-
Supplier:
|
93
|
+
Supplier: Supplier.Charlie,
|
97
94
|
CategoryID: 2,
|
98
95
|
MadeIn: 'Norway',
|
99
96
|
QuantityPerUnit: '12 - 12 oz jars',
|
@@ -105,7 +102,7 @@ exports.products = [
|
|
105
102
|
{
|
106
103
|
ProductID: 9,
|
107
104
|
ProductName: 'Mishi Kobe Niku',
|
108
|
-
Supplier:
|
105
|
+
Supplier: Supplier.Benjamin,
|
109
106
|
CategoryID: 6,
|
110
107
|
MadeIn: 'Japan',
|
111
108
|
QuantityPerUnit: '18 - 500 g pkgs.',
|
@@ -117,7 +114,7 @@ exports.products = [
|
|
117
114
|
{
|
118
115
|
ProductID: 10,
|
119
116
|
ProductName: 'Ikura',
|
120
|
-
Supplier:
|
117
|
+
Supplier: Supplier.Benjamin,
|
121
118
|
CategoryID: 8,
|
122
119
|
MadeIn: 'Japan',
|
123
120
|
QuantityPerUnit: '12 - 200 ml jars',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../src/demo/overview/products.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../src/demo/overview/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,CAAC;QACZ,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,UAAU,EAAE,CAAC;QACb,MAAM,EAAE,OAAO;QACf,eAAe,EAAE,oBAAoB;QACrC,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC;QACnC,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,QAAQ,CAAC,KAAK;KAC/B;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,OAAO;QACpB,QAAQ,EAAE,QAAQ,CAAC,GAAG;QACtB,UAAU,EAAE,CAAC;QACb,MAAM,EAAE,UAAU;QAClB,eAAe,EAAE,oBAAoB;QACrC,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC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47 +1,44 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
const
|
13
|
-
const
|
14
|
-
|
15
|
-
const UserRoleColumnMenuFilter = (0, __1.multiSelectColumnMenuFilter)((0, form_1.getEnumKeys)(product_1.UserRole), userRole => ((0, jsx_runtime_1.jsx)(design_system_1.Tag, Object.assign({ compact: true, color: product_1.UserRole[userRole] === product_1.UserRole.Owner ? 'success' : 'default' }, { children: userRole }), void 0)));
|
16
|
-
const AvailableForEditableCell = (0, __1.getSelectEditableCell)({
|
17
|
-
options: (0, form_1.enumToOptions)(product_1.UserRole),
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useMemo, cloneElement, Fragment } from 'react';
|
3
|
+
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
4
|
+
import { observer } from 'mobx-react';
|
5
|
+
import { Stack, ButtonGroup, Button, Tag } from '@servicetitan/design-system';
|
6
|
+
import { Table, TableColumn, TableCell, TextEditableCell, NumericEditableCell, BooleanEditableCell, DateEditableCell, getSelectEditableCell, CurrencyRangeColumnMenuFilter, DateRangeColumnMenuFilter, StandardColumnMenuFilter, standardFilterWithMultiselect, multiSelectColumnMenuFilter, } from '../..';
|
7
|
+
import { Export } from '../../export';
|
8
|
+
import { TableStore } from './table.store';
|
9
|
+
import { ActionsCell } from './actions-cell';
|
10
|
+
import { enumToOptions, getEnumKeys } from '@servicetitan/form';
|
11
|
+
import { UserRole, Supplier } from './product';
|
12
|
+
const UserRoleColumnMenuFilter = multiSelectColumnMenuFilter(getEnumKeys(UserRole), userRole => (_jsx(Tag, Object.assign({ compact: true, color: UserRole[userRole] === UserRole.Owner ? 'success' : 'default' }, { children: userRole }), void 0)));
|
13
|
+
const AvailableForEditableCell = getSelectEditableCell({
|
14
|
+
options: enumToOptions(UserRole),
|
18
15
|
viewer: ({ dataItem, field }) => {
|
19
16
|
const value = dataItem[field];
|
20
|
-
return (
|
17
|
+
return _jsx("td", { children: value && UserRole[value] }, void 0);
|
21
18
|
},
|
22
19
|
});
|
23
20
|
const SupplierCell = props => {
|
24
21
|
const { field, dataItem, rowType } = props;
|
25
22
|
if (rowType !== 'data') {
|
26
|
-
return (
|
23
|
+
return _jsx(TableCell, Object.assign({}, props), void 0);
|
27
24
|
}
|
28
|
-
return (
|
25
|
+
return _jsx("td", { children: Supplier[dataItem[field]] }, void 0);
|
29
26
|
};
|
30
|
-
|
31
|
-
singletons: [
|
32
|
-
})(
|
33
|
-
const [{ tableState, inEdit, editAll, cancelAll, saveAll }] =
|
34
|
-
const madeInColumnMenu =
|
27
|
+
export const TableExample = provide({
|
28
|
+
singletons: [TableStore],
|
29
|
+
})(observer((props) => {
|
30
|
+
const [{ tableState, inEdit, editAll, cancelAll, saveAll }] = useDependencies(TableStore);
|
31
|
+
const madeInColumnMenu = useMemo(() => standardFilterWithMultiselect({ tableState }), [tableState]);
|
35
32
|
const cellRender = (td, { dataItem, field }) => {
|
36
33
|
if (!td) {
|
37
34
|
return null;
|
38
35
|
}
|
39
|
-
return
|
36
|
+
return cloneElement(td, {
|
40
37
|
onClick: () => {
|
41
38
|
tableState.edit(dataItem, field);
|
42
39
|
},
|
43
40
|
});
|
44
41
|
};
|
45
|
-
return ((
|
42
|
+
return (_jsxs(Fragment, { children: [_jsxs(Stack, Object.assign({ justifyContent: "space-between", alignContent: "center", className: "m-b-2" }, { children: [_jsx(Export, { totalCount: tableState.totalCount, exportPdf: tableState.exportPdf, exportExcel: tableState.exportExcel }, void 0), inEdit ? (_jsxs(ButtonGroup, { children: [_jsx(Button, Object.assign({ small: true, onClick: cancelAll, className: "m-r-2" }, { children: "Cancel All" }), void 0), _jsx(Button, Object.assign({ small: true, primary: true, onClick: saveAll }, { children: "Save All" }), void 0)] }, void 0)) : (_jsx(Button, Object.assign({ small: true, primary: true, onClick: editAll }, { children: "Edit All" }), void 0))] }), void 0), _jsxs(Table, Object.assign({ tableState: tableState, striped: false, selectable: true, groupable: true, sortable: true, exportable: true, exportFileName: "Table.Export.Test...File.Name.01.01.2020..~!@#$%^(*_+';", cellRender: cellRender }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }, void 0), _jsx(TableColumn, { field: "ProductName", title: "Product Name", cell: TextEditableCell, columnMenu: StandardColumnMenuFilter, width: "240px" }, void 0), _jsx(TableColumn, { field: "Supplier", title: "Supplier", cell: SupplierCell, columnMenu: StandardColumnMenuFilter, width: "150px" }, void 0), _jsx(TableColumn, { field: "MadeIn", title: "Made In", cell: TextEditableCell, columnMenu: madeInColumnMenu, width: "175px" }, void 0), _jsx(TableColumn, { field: "UnitsOnOrder", title: "First Ordered On", cell: DateEditableCell, columnMenu: DateRangeColumnMenuFilter, format: "{0:d}", width: "240px" }, void 0), _jsx(TableColumn, { field: "UnitPrice", title: "Unit Price", cell: NumericEditableCell, columnMenu: CurrencyRangeColumnMenuFilter, format: "{0:c}", width: "125px" }, void 0), _jsx(TableColumn, { field: "Discontinued", title: "Discontinued", cell: BooleanEditableCell, sortable: false, width: "125px" }, void 0), _jsx(TableColumn, { field: "AvailableFor", title: "Available For", cell: AvailableForEditableCell, columnMenu: UserRoleColumnMenuFilter, width: "240px" }, void 0), _jsx(TableColumn, Object.assign({ cell: ActionsCell, sortable: false }, (props.fixedWidthColumns ? { width: '125px' } : {})), void 0)] }), void 0)] }, void 0));
|
46
43
|
}));
|
47
44
|
//# sourceMappingURL=table.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/demo/overview/table.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/demo/overview/table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAoB,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,OAAO,EAA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AyB,EACrC,MAAM,EAAC,OAAO,EACd,KAAK,EAAC,OAAO,WACf,EAEF,KAAC,WAAW,IACR,KAAK,EAAC,WAAW,EACjB,KAAK,EAAC,YAAY,EAClB,IAAI,EAAE,mBAAmB,EACzB,UAAU,EAAE,6BAA6B,EACzC,MAAM,EAAC,OAAO,EACd,KAAK,EAAC,OAAO,WACf,EAEF,KAAC,WAAW,IACR,KAAK,EAAC,cAAc,EACpB,KAAK,EAAC,cAAc,EACpB,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,KAAK,EACf,KAAK,EAAC,OAAO,WACf,EAEF,KAAC,WAAW,IACR,KAAK,EAAC,cAAc,EACpB,KAAK,EAAC,eAAe,EACrB,IAAI,EAAE,wBAAwB,EAC9B,UAAU,EAAE,wBAAwB,EACpC,KAAK,EAAC,OAAO,WACf,EAEF,KAAC,WAAW,kBACR,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,KAAK,IACX,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,UACzD,aACE,YACD,CACd,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
@@ -8,22 +7,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
9
|
};
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
const product_1 = require("./product");
|
19
|
-
const products_1 = require("./products");
|
10
|
+
import { injectable } from '@servicetitan/react-ioc';
|
11
|
+
import { computed, makeObservable } from 'mobx';
|
12
|
+
import { InMemoryDataSource, TableState } from '../..';
|
13
|
+
import { setFormStateValues, FormValidators } from '@servicetitan/form';
|
14
|
+
import { FormState, FieldState } from 'formstate';
|
15
|
+
import { UserRole, Supplier } from './product';
|
16
|
+
import { products } from './products';
|
20
17
|
let TableStore = class TableStore {
|
21
18
|
constructor() {
|
22
19
|
Object.defineProperty(this, "tableState", {
|
23
20
|
enumerable: true,
|
24
21
|
configurable: true,
|
25
22
|
writable: true,
|
26
|
-
value: new
|
23
|
+
value: new TableState({
|
27
24
|
dataSource: this.getDataSource(),
|
28
25
|
isRowUnselectable: this.isRowUnselectable,
|
29
26
|
selectionLimit: 3,
|
@@ -49,15 +46,15 @@ let TableStore = class TableStore {
|
|
49
46
|
writable: true,
|
50
47
|
value: () => this.tableState.cancelEditAll()
|
51
48
|
});
|
52
|
-
|
49
|
+
makeObservable(this);
|
53
50
|
}
|
54
51
|
get inEdit() {
|
55
52
|
return this.tableState.inEdit.size > 0;
|
56
53
|
}
|
57
54
|
getDataSource() {
|
58
|
-
return new
|
59
|
-
Supplier: (value) =>
|
60
|
-
AvailableFor: (value) => value &&
|
55
|
+
return new InMemoryDataSource(products, this.idSelector, {
|
56
|
+
Supplier: (value) => Supplier[value],
|
57
|
+
AvailableFor: (value) => value && UserRole[value],
|
61
58
|
});
|
62
59
|
}
|
63
60
|
idSelector(row) {
|
@@ -67,29 +64,29 @@ let TableStore = class TableStore {
|
|
67
64
|
return row.Discontinued;
|
68
65
|
}
|
69
66
|
getFormState(row) {
|
70
|
-
return
|
71
|
-
ProductID: new
|
72
|
-
ProductName: new
|
73
|
-
Supplier: new
|
74
|
-
CategoryID: new
|
75
|
-
MadeIn: new
|
76
|
-
QuantityPerUnit: new
|
77
|
-
UnitPrice: new
|
78
|
-
UnitsInStock: new
|
79
|
-
UnitsOnOrder: new
|
80
|
-
Discontinued: new
|
81
|
-
AvailableFor: new
|
67
|
+
return setFormStateValues(new FormState({
|
68
|
+
ProductID: new FieldState(0),
|
69
|
+
ProductName: new FieldState('').validators(FormValidators.required),
|
70
|
+
Supplier: new FieldState(Supplier.Adam),
|
71
|
+
CategoryID: new FieldState(0),
|
72
|
+
MadeIn: new FieldState(''),
|
73
|
+
QuantityPerUnit: new FieldState(''),
|
74
|
+
UnitPrice: new FieldState(0).validators(value => value <= 0 && 'Price must be positive'),
|
75
|
+
UnitsInStock: new FieldState(0),
|
76
|
+
UnitsOnOrder: new FieldState(new Date()).validators(value => value > new Date() && 'Invalid date'),
|
77
|
+
Discontinued: new FieldState(false),
|
78
|
+
AvailableFor: new FieldState(undefined),
|
82
79
|
}), row);
|
83
80
|
}
|
84
81
|
};
|
85
82
|
__decorate([
|
86
|
-
|
83
|
+
computed,
|
87
84
|
__metadata("design:type", Object),
|
88
85
|
__metadata("design:paramtypes", [])
|
89
86
|
], TableStore.prototype, "inEdit", null);
|
90
87
|
TableStore = __decorate([
|
91
|
-
|
88
|
+
injectable(),
|
92
89
|
__metadata("design:paramtypes", [])
|
93
90
|
], TableStore);
|
94
|
-
|
91
|
+
export { TableStore };
|
95
92
|
//# sourceMappingURL=table.store.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"table.store.js","sourceRoot":"","sources":["../../../src/demo/overview/table.store.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"table.store.js","sourceRoot":"","sources":["../../../src/demo/overview/table.store.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CA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AY,CAAC;IAC5B,CAAC;IAEO,YAAY,CAAC,GAAY;QAC7B,OAAO,kBAAkB,CACrB,IAAI,SAAS,CAAC;YACV,SAAS,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;YAC5B,WAAW,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC;YACnE,QAAQ,EAAE,IAAI,UAAU,CAAW,QAAQ,CAAC,IAAI,CAAC;YACjD,UAAU,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;YAC7B,MAAM,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC;YAC1B,eAAe,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC;YACnC,SAAS,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CACnC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,IAAI,wBAAwB,CAClD;YACD,YAAY,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;YAC/B,YAAY,EAAE,IAAI,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,UAAU,CAC/C,KAAK,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI,IAAI,EAAE,IAAI,cAAc,CAChD;YACD,YAAY,EAAE,IAAI,UAAU,CAAC,KAAK,CAAC;YACnC,YAAY,EAAE,IAAI,UAAU,CAAuB,SAAS,CAAC;SAChE,CAAC,EACF,GAAG,CACN,CAAC;IACN,CAAC;CACJ,CAAA;AA7Ca;IAAT,QAAQ;;;wCAER;AAfQ,UAAU;IADtB,UAAU,EAAE;;GACA,UAAU,CA0DtB;SA1DY,UAAU"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"beverages.js","sourceRoot":"","sources":["../../../src/demo/state-caching/beverages.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"beverages.js","sourceRoot":"","sources":["../../../src/demo/state-caching/beverages.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAc;IAChC;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,gCAAgC;KAChD;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,QAAQ;QACrB,WAAW,EAAE,gEAAgE;KAChF;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,QAAQ;QACrB,WAAW,EAAE,iCAAiC;KACjD;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,2EAA2E;KAC3F;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,2DAA2D;KAC3E;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,8CAA8C;KAC9D;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,eAAe;QAC5B,WAAW,EAAE,6EAA6E;KAC7F;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,oEAAoE;KACpF;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,sEAAsE;KACtF;CACJ,CAAC"}
|
@@ -1,14 +1,2 @@
|
|
1
|
-
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11
|
-
};
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
13
|
-
__exportStar(require("./state-caching-table"), exports);
|
1
|
+
export * from './state-caching-table';
|
14
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/demo/state-caching/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/demo/state-caching/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../src/demo/state-caching/products.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../src/demo/state-caching/products.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAc;IAC/B;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,oBAAoB;KACpC;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,oBAAoB;KACpC;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,eAAe;QAC5B,WAAW,EAAE,qBAAqB;KACrC;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,8BAA8B;QAC3C,WAAW,EAAE,gBAAgB;KAChC;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,wBAAwB;QACrC,WAAW,EAAE,UAAU;KAC1B;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,8BAA8B;QAC3C,WAAW,EAAE,gBAAgB;KAChC;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,iCAAiC;QAC9C,WAAW,EAAE,iBAAiB;KACjC;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,4BAA4B;QACzC,WAAW,EAAE,iBAAiB;KACjC;IACD;QACI,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,kBAAkB;KAClC;IACD;QACI,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,kBAAkB;KAClC;CACJ,CAAC"}
|
@@ -1,17 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
})((0, mobx_react_1.observer)(() => {
|
14
|
-
const [{ tableState, showProducts, showBeverages }] = (0, react_ioc_1.useDependencies)(state_caching_table_store_1.TableStore);
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(design_system_1.ButtonGroup, Object.assign({ className: "m-b-2" }, { children: [(0, jsx_runtime_1.jsx)(design_system_1.Button, Object.assign({ small: true, onClick: showProducts }, { children: "Show Products" }), void 0), (0, jsx_runtime_1.jsx)(design_system_1.Button, Object.assign({ small: true, onClick: showBeverages }, { children: "Show Beverages" }), void 0)] }), void 0), (0, jsx_runtime_1.jsxs)(__1.Table, Object.assign({ tableState: tableState, striped: true, sortable: true }, { children: [(0, jsx_runtime_1.jsx)(__1.TableColumn, { field: "ProductID", title: "ID", width: "100px" }, void 0), (0, jsx_runtime_1.jsx)(__1.TableColumn, { field: "ProductName", title: "Product Name" }, void 0), (0, jsx_runtime_1.jsx)(__1.TableColumn, { field: "Description", title: "Product Description" }, void 0)] }), void 0)] }, void 0));
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Fragment } from 'react';
|
3
|
+
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
4
|
+
import { observer } from 'mobx-react';
|
5
|
+
import { ButtonGroup, Button } from '@servicetitan/design-system';
|
6
|
+
import { Table, TableColumn } from '../..';
|
7
|
+
import { TableStore } from './state-caching-table.store';
|
8
|
+
export const TableStateCachingExample = provide({
|
9
|
+
singletons: [TableStore],
|
10
|
+
})(observer(() => {
|
11
|
+
const [{ tableState, showProducts, showBeverages }] = useDependencies(TableStore);
|
12
|
+
return (_jsxs(Fragment, { children: [_jsxs(ButtonGroup, Object.assign({ className: "m-b-2" }, { children: [_jsx(Button, Object.assign({ small: true, onClick: showProducts }, { children: "Show Products" }), void 0), _jsx(Button, Object.assign({ small: true, onClick: showBeverages }, { children: "Show Beverages" }), void 0)] }), void 0), _jsxs(Table, Object.assign({ tableState: tableState, striped: true, sortable: true }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", width: "100px" }, void 0), _jsx(TableColumn, { field: "ProductName", title: "Product Name" }, void 0), _jsx(TableColumn, { field: "Description", title: "Product Description" }, void 0)] }), void 0)] }, void 0));
|
16
13
|
}));
|
17
14
|
//# sourceMappingURL=state-caching-table.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"state-caching-table.js","sourceRoot":"","sources":["../../../src/demo/state-caching/state-caching-table.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"state-caching-table.js","sourceRoot":"","sources":["../../../src/demo/state-caching/state-caching-table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAM,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,MAAM,CAAC,MAAM,wBAAwB,GAAO,OAAO,CAAC;IAChD,UAAU,EAAE,CAAC,UAAU,CAAC;CAC3B,CAAC,CACE,QAAQ,CAAC,GAAG,EAAE;IACV,MAAM,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAElF,OAAO,CACH,MAAC,QAAQ,eACL,MAAC,WAAW,kBAAC,SAAS,EAAC,OAAO,iBAC1B,KAAC,MAAM,kBAAC,KAAK,QAAC,OAAO,EAAE,YAAY,2CAE1B,EACT,KAAC,MAAM,kBAAC,KAAK,QAAC,OAAO,EAAE,aAAa,4CAE3B,aACC,EAEd,MAAC,KAAK,kBAAC,UAAU,EAAE,UAAU,EAAE,OAAO,QAAC,QAAQ,uBAC3C,KAAC,WAAW,IAAC,KAAK,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO,WAAG,EAE1D,KAAC,WAAW,IAAC,KAAK,EAAC,aAAa,EAAC,KAAK,EAAC,cAAc,WAAG,EAExD,KAAC,WAAW,IAAC,KAAK,EAAC,aAAa,EAAC,KAAK,EAAC,qBAAqB,WAAG,aAC3D,YACD,CACd,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
|
@@ -1,16 +1,13 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
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;
|
6
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
6
|
};
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
const products_1 = require("./products");
|
13
|
-
const beverages_1 = require("./beverages");
|
7
|
+
import { injectable } from '@servicetitan/react-ioc';
|
8
|
+
import { InMemoryDataSource, TableState } from '../..';
|
9
|
+
import { products } from './products';
|
10
|
+
import { beverages } from './beverages';
|
14
11
|
let TableStore = class TableStore {
|
15
12
|
constructor() {
|
16
13
|
Object.defineProperty(this, "productsTableState", {
|
@@ -29,7 +26,7 @@ let TableStore = class TableStore {
|
|
29
26
|
enumerable: true,
|
30
27
|
configurable: true,
|
31
28
|
writable: true,
|
32
|
-
value: new
|
29
|
+
value: new TableState({
|
33
30
|
dataSource: this.getProductsDataSource(),
|
34
31
|
pageSize: 5,
|
35
32
|
})
|
@@ -60,14 +57,14 @@ let TableStore = class TableStore {
|
|
60
57
|
});
|
61
58
|
}
|
62
59
|
getProductsDataSource() {
|
63
|
-
return new
|
60
|
+
return new InMemoryDataSource(products);
|
64
61
|
}
|
65
62
|
getBeveragesDataSource() {
|
66
|
-
return new
|
63
|
+
return new InMemoryDataSource(beverages);
|
67
64
|
}
|
68
65
|
};
|
69
66
|
TableStore = __decorate([
|
70
|
-
|
67
|
+
injectable()
|
71
68
|
], TableStore);
|
72
|
-
|
69
|
+
export { TableStore };
|
73
70
|
//# sourceMappingURL=state-caching-table.store.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"state-caching-table.store.js","sourceRoot":"","sources":["../../../src/demo/state-caching/state-caching-table.store.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"state-caching-table.store.js","sourceRoot":"","sources":["../../../src/demo/state-caching/state-caching-table.store.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC,IAAa,UAAU,GAAvB,MAAa,UAAU;IAAvB;QACI;;;;;WAA6C;QAC7C;;;;;WAA8C;QAE9C;;;;mBAAa,IAAI,UAAU,CAAkB;gBACzC,UAAU,EAAE,IAAI,CAAC,qBAAqB,EAAE;gBACxC,QAAQ,EAAE,CAAC;aACd,CAAC;WAAC;QAEH;;;;mBAAe,GAAG,EAAE;gBAChB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;gBACzD,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE;oBACxD,KAAK,EAAE,IAAI;oBACX,YAAY,EAAE,IAAI,CAAC,kBAAkB;iBACxC,CAAC,CAAC;YACP,CAAC;WAAC;QAEF;;;;mBAAgB,GAAG,EAAE;gBACjB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;gBACxD,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE;oBACzD,KAAK,EAAE,IAAI;oBACX,YAAY,EAAE,IAAI,CAAC,mBAAmB;iBACzC,CAAC,CAAC;YACP,CAAC;WAAC;IASN,CAAC;IAPW,qBAAqB;QACzB,OAAO,IAAI,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAEO,sBAAsB;QAC1B,OAAO,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACJ,CAAA;AAhCY,UAAU;IADtB,UAAU,EAAE;GACA,UAAU,CAgCtB;SAhCY,UAAU"}
|
@@ -1,17 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const
|
6
|
-
const design_system_1 = require("@servicetitan/design-system");
|
7
|
-
const get_editable_cell_1 = require("./get-editable-cell");
|
8
|
-
const Editor = (0, mobx_react_1.observer)(({ fieldState: { value, onChange }, className }) => {
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { observer } from 'mobx-react';
|
3
|
+
import { Checkbox } from '@servicetitan/design-system';
|
4
|
+
import { getEditableCell } from './get-editable-cell';
|
5
|
+
const Editor = observer(({ fieldState: { value, onChange }, className }) => {
|
9
6
|
const handleChange = (_0, checked) => {
|
10
7
|
onChange(checked);
|
11
8
|
};
|
12
|
-
return ((
|
9
|
+
return (_jsx("td", Object.assign({ className: className }, { children: _jsx(Checkbox, { checked: value, onChange: handleChange, style: { marginRight: 0 } }, void 0) }), void 0));
|
13
10
|
});
|
14
|
-
|
11
|
+
export const BooleanEditableCell = getEditableCell({
|
15
12
|
editor: Editor,
|
16
13
|
});
|
17
14
|
//# sourceMappingURL=boolean-editable-cell.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"boolean-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/boolean-editable-cell.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"boolean-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/boolean-editable-cell.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAe,MAAM,qBAAqB,CAAC;AAEnE,MAAM,MAAM,GAAG,QAAQ,CACnB,CAAC,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAC/C,MAAM,YAAY,GAAG,CAAC,EAAS,EAAE,OAAgB,EAAE,EAAE;QACjD,QAAQ,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,CACH,2BAAI,SAAS,EAAE,SAAS,gBACpB,KAAC,QAAQ,IAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,WAAI,YAC9E,CACR,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;IAC/C,MAAM,EAAE,MAAM;CACjB,CAAC,CAAC"}
|
@@ -1,17 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const
|
6
|
-
const kendo_react_dateinputs_1 = require("@progress/kendo-react-dateinputs");
|
7
|
-
const get_editable_cell_1 = require("./get-editable-cell");
|
8
|
-
const Editor = (0, mobx_react_1.observer)(({ fieldState: { value, onChange, hasError, error }, className }) => {
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { observer } from 'mobx-react';
|
3
|
+
import { DatePicker } from '@progress/kendo-react-dateinputs';
|
4
|
+
import { getEditableCell } from './get-editable-cell';
|
5
|
+
const Editor = observer(({ fieldState: { value, onChange, hasError, error }, className }) => {
|
9
6
|
const handleChange = (event) => {
|
10
7
|
onChange(event.value);
|
11
8
|
};
|
12
|
-
return ((
|
9
|
+
return (_jsx("td", Object.assign({ className: className }, { children: _jsx(DatePicker, { value: value, onChange: handleChange, valid: !hasError, validationMessage: error }, void 0) }), void 0));
|
13
10
|
});
|
14
|
-
|
11
|
+
export const DateEditableCell = getEditableCell({
|
15
12
|
editor: Editor,
|
16
13
|
});
|
17
14
|
//# sourceMappingURL=date-editable-cell.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"date-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/date-editable-cell.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"date-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/date-editable-cell.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAyB,MAAM,kCAAkC,CAAC;AAErF,OAAO,EAAE,eAAe,EAAe,MAAM,qBAAqB,CAAC;AAEnE,MAAM,MAAM,GAAG,QAAQ,CACnB,CAAC,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAChE,MAAM,YAAY,GAAG,CAAC,KAA4B,EAAE,EAAE;QAClD,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,CACH,2BAAI,SAAS,EAAE,SAAS,gBACpB,KAAC,UAAU,IACP,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,CAAC,QAAQ,EAChB,iBAAiB,EAAE,KAAK,WAC1B,YACD,CACR,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;IAC5C,MAAM,EAAE,MAAM;CACjB,CAAC,CAAC"}
|