@servicetitan/table 25.0.1 → 25.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ export * from './table';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/demo/footer-page-size/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './table';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/demo/footer-page-size/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ export declare const TableFooterPageSizeExample: FC;
3
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/demo/footer-page-size/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAE,MAAM,OAAO,CAAC;AA6BpC,eAAO,MAAM,0BAA0B,EAAE,EA0ExC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { provide, useDependencies } from '@servicetitan/react-ioc';
4
+ import { observer } from 'mobx-react';
5
+ import { Tag } from '@servicetitan/design-system';
6
+ import { getEnumKeys } from '@servicetitan/form';
7
+ import { Table, TableColumn, BooleanEditableCell, DateRangeColumnMenuFilter, StandardColumnMenuFilter, standardFilterWithMultiselect, multiSelectColumnMenuFilter, CurrencyRangeColumnMenuFilter, } from '../..';
8
+ import { TableStore } from '../overview/table.store';
9
+ import { UserRole } from '../overview/product';
10
+ const UserRoleColumnMenuFilter = multiSelectColumnMenuFilter(getEnumKeys(UserRole), userRole => (_jsx(Tag, Object.assign({ compact: true, color: UserRole[userRole] === UserRole.Owner ? 'success' : 'default' }, { children: userRole }))));
11
+ export const TableFooterPageSizeExample = provide({
12
+ singletons: [TableStore],
13
+ })(observer(() => {
14
+ const [{ tableState }] = useDependencies(TableStore);
15
+ const madeInColumnMenu = useMemo(() => standardFilterWithMultiselect({ tableState }), [tableState]);
16
+ return (_jsxs(Table, Object.assign({ tableState: tableState, striped: false, sortable: true, pager: { pageSizes: [3, 5, 7, 10] } }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", columnMenu: StandardColumnMenuFilter, width: "240px" }), _jsx(TableColumn, { field: "Supplier", title: "Supplier", columnMenu: StandardColumnMenuFilter, width: "150px" }), _jsx(TableColumn, { field: "MadeIn", title: "Made In", columnMenu: madeInColumnMenu, width: "175px" }), _jsx(TableColumn, { field: "UnitsOnOrder", title: "First Ordered On", columnMenu: DateRangeColumnMenuFilter, format: "{0:MM/dd/yyyy}", width: "240px" }), _jsx(TableColumn, { field: "UnitPrice", title: "Unit Price", columnMenu: CurrencyRangeColumnMenuFilter, format: "{0:c}", width: "125px" }), _jsx(TableColumn, { field: "Discontinued", title: "Discontinued", cell: BooleanEditableCell, sortable: false, width: "125px" }), _jsx(TableColumn, { field: "AvailableFor", title: "Available For", columnMenu: UserRoleColumnMenuFilter, width: "240px" })] })));
17
+ }));
18
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/demo/footer-page-size/table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAM,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EACH,KAAK,EACL,WAA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,wBAAwB,EACpC,KAAK,EAAC,OAAO,GACf,EAEF,KAAC,WAAW,IACR,KAAK,EAAC,UAAU,EAChB,KAAK,EAAC,UAAU,EAChB,UAAU,EAAE,wBAAwB,EACpC,KAAK,EAAC,OAAO,GACf,EAEF,KAAC,WAAW,IACR,KAAK,EAAC,QAAQ,EACd,KAAK,EAAC,SAAS,EACf,UAAU,EAAE,gBAAgB,EAC5B,KAAK,EAAC,OAAO,GACf,EAEF,KAAC,WAAW,IACR,KAAK,EAAC,cAAc,EACpB,KAAK,EAAC,kBAAkB,EACxB,UAAU,EAAE,yBAAyB,EACrC,MAAM,EAAC,gBAAgB,EACvB,KAAK,EAAC,OAAO,GACf,EAEF,KAAC,WAAW,IACR,KAAK,EAAC,WAAW,EACjB,KAAK,EAAC,YAAY,EAClB,UAAU,EAAE,6BAA6B,EACzC,MAAM,EAAC,OAAO,EACd,KAAK,EAAC,OAAO,GACf,EAEF,KAAC,WAAW,IACR,KAAK,EAAC,cAAc,EACpB,KAAK,EAAC,cAAc,EACpB,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,KAAK,EACf,KAAK,EAAC,OAAO,GACf,EAEF,KAAC,WAAW,IACR,KAAK,EAAC,cAAc,EACpB,KAAK,EAAC,eAAe,EACrB,UAAU,EAAE,wBAAwB,EACpC,KAAK,EAAC,OAAO,GACf,KACE,CACX,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
@@ -2,4 +2,5 @@ export * from './overview';
2
2
  export * from './master-detail';
3
3
  export * from './state-caching';
4
4
  export * from './column-hiding';
5
+ export * from './footer-page-size';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -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;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;AAChC,cAAc,oBAAoB,CAAC"}
@@ -2,4 +2,5 @@ export * from './overview';
2
2
  export * from './master-detail';
3
3
  export * from './state-caching';
4
4
  export * from './column-hiding';
5
+ export * from './footer-page-size';
5
6
  //# sourceMappingURL=index.js.map
@@ -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;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;AAChC,cAAc,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/table",
3
- "version": "25.0.1",
3
+ "version": "25.1.0",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/table",
6
6
  "repository": {
@@ -37,9 +37,9 @@
37
37
  "memoize-one": "~6.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@servicetitan/data-query": "^25.0.1",
40
+ "@servicetitan/data-query": "^25.1.0",
41
41
  "@servicetitan/design-system": ">=12.4.1",
42
- "@servicetitan/form": "^25.0.1",
42
+ "@servicetitan/form": "^25.1.0",
43
43
  "@servicetitan/react-ioc": "^21.6.0",
44
44
  "@servicetitan/suppress-warnings": "^21.6.0",
45
45
  "@types/accounting": "~0.4.2",
@@ -53,9 +53,9 @@
53
53
  "react": "~17.0.2"
54
54
  },
55
55
  "peerDependencies": {
56
- "@servicetitan/data-query": "^25.0.1",
56
+ "@servicetitan/data-query": "^25.1.0",
57
57
  "@servicetitan/design-system": ">=12.4.1",
58
- "@servicetitan/form": "^25.0.1",
58
+ "@servicetitan/form": "^25.1.0",
59
59
  "@servicetitan/react-ioc": ">21.0.0",
60
60
  "@servicetitan/suppress-warnings": ">21.0.0",
61
61
  "accounting": "~0.4.1",
@@ -72,5 +72,5 @@
72
72
  "cli": {
73
73
  "webpack": false
74
74
  },
75
- "gitHead": "81ba2d8ecce891162d8d4de743c6b3fff9cf1982"
75
+ "gitHead": "bb6fc7bc0d532fce0512a7cc6e008cf0a5bfc91f"
76
76
  }
@@ -0,0 +1 @@
1
+ export * from './table';
@@ -0,0 +1,104 @@
1
+ import { useMemo, FC } from 'react';
2
+
3
+ import { provide, useDependencies } from '@servicetitan/react-ioc';
4
+
5
+ import { observer } from 'mobx-react';
6
+
7
+ import { Tag } from '@servicetitan/design-system';
8
+ import { getEnumKeys } from '@servicetitan/form';
9
+
10
+ import {
11
+ Table,
12
+ TableColumn,
13
+ BooleanEditableCell,
14
+ DateRangeColumnMenuFilter,
15
+ StandardColumnMenuFilter,
16
+ standardFilterWithMultiselect,
17
+ multiSelectColumnMenuFilter,
18
+ CurrencyRangeColumnMenuFilter,
19
+ } from '../..';
20
+
21
+ import { TableStore } from '../overview/table.store';
22
+ import { UserRole } from '../overview/product';
23
+
24
+ const UserRoleColumnMenuFilter = multiSelectColumnMenuFilter(getEnumKeys(UserRole), userRole => (
25
+ <Tag compact color={UserRole[userRole] === UserRole.Owner ? 'success' : 'default'}>
26
+ {userRole}
27
+ </Tag>
28
+ ));
29
+
30
+ export const TableFooterPageSizeExample: FC = provide({
31
+ singletons: [TableStore],
32
+ })(
33
+ observer(() => {
34
+ const [{ tableState }] = useDependencies(TableStore);
35
+
36
+ const madeInColumnMenu = useMemo(
37
+ () => standardFilterWithMultiselect({ tableState }),
38
+ [tableState]
39
+ );
40
+
41
+ return (
42
+ <Table
43
+ tableState={tableState}
44
+ striped={false}
45
+ sortable
46
+ pager={{ pageSizes: [3, 5, 7, 10] }}
47
+ >
48
+ <TableColumn field="ProductID" title="ID" editable={false} width="100px" />
49
+
50
+ <TableColumn
51
+ field="ProductName"
52
+ title="Product Name"
53
+ columnMenu={StandardColumnMenuFilter}
54
+ width="240px"
55
+ />
56
+
57
+ <TableColumn
58
+ field="Supplier"
59
+ title="Supplier"
60
+ columnMenu={StandardColumnMenuFilter}
61
+ width="150px"
62
+ />
63
+
64
+ <TableColumn
65
+ field="MadeIn"
66
+ title="Made In"
67
+ columnMenu={madeInColumnMenu}
68
+ width="175px"
69
+ />
70
+
71
+ <TableColumn
72
+ field="UnitsOnOrder"
73
+ title="First Ordered On"
74
+ columnMenu={DateRangeColumnMenuFilter}
75
+ format="{0:MM/dd/yyyy}"
76
+ width="240px"
77
+ />
78
+
79
+ <TableColumn
80
+ field="UnitPrice"
81
+ title="Unit Price"
82
+ columnMenu={CurrencyRangeColumnMenuFilter}
83
+ format="{0:c}"
84
+ width="125px"
85
+ />
86
+
87
+ <TableColumn
88
+ field="Discontinued"
89
+ title="Discontinued"
90
+ cell={BooleanEditableCell}
91
+ sortable={false}
92
+ width="125px"
93
+ />
94
+
95
+ <TableColumn
96
+ field="AvailableFor"
97
+ title="Available For"
98
+ columnMenu={UserRoleColumnMenuFilter}
99
+ width="240px"
100
+ />
101
+ </Table>
102
+ );
103
+ })
104
+ );
package/src/demo/index.ts CHANGED
@@ -2,3 +2,4 @@ export * from './overview';
2
2
  export * from './master-detail';
3
3
  export * from './state-caching';
4
4
  export * from './column-hiding';
5
+ export * from './footer-page-size';
@@ -2,14 +2,16 @@ import {
2
2
  TableExample,
3
3
  TableMasterDetailExample,
4
4
  TableStateCachingExample,
5
- TableColumnHidingExample
5
+ TableColumnHidingExample,
6
+ TableFooterPageSizeExample,
6
7
  } from './demo';
7
8
 
8
9
  export default {
9
- title: 'Table/Demos'
10
+ title: 'Table/Demos',
10
11
  };
11
12
 
12
13
  export const Table = () => <TableExample />;
13
14
  export const TableMasterDetail = () => <TableMasterDetailExample />;
14
15
  export const TableStateCaching = () => <TableStateCachingExample />;
15
16
  export const TableColumnHiding = () => <TableColumnHidingExample />;
17
+ export const TableFooterPageSize = () => <TableFooterPageSizeExample />;