@servicetitan/table 25.0.0 → 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"}
@@ -1,8 +1,5 @@
1
1
  import { FC } from 'react';
2
2
  import { TableCellProps } from '../..';
3
3
  export declare const DateEditableCell: (props: TableCellProps<any, any, never, never>) => JSX.Element;
4
- export interface TableExampleProps {
5
- fixedWidthColumns?: boolean;
6
- }
7
- export declare const TableExample: FC<TableExampleProps>;
4
+ export declare const TableExample: FC;
8
5
  //# sourceMappingURL=table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/demo/overview/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmC,EAAE,EAAgB,MAAM,OAAO,CAAC;AAQ1E,OAAO,EAIH,cAAc,EAWjB,MAAM,OAAO,CAAC;AA6Cf,eAAO,MAAM,gBAAgB,gEAE3B,CAAC;AA0BH,MAAM,WAAW,iBAAiB;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA+H9C,CAAC"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/demo/overview/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmC,EAAE,EAAgB,MAAM,OAAO,CAAC;AAQ1E,OAAO,EAIH,cAAc,EAWjB,MAAM,OAAO,CAAC;AA6Cf,eAAO,MAAM,gBAAgB,gEAE3B,CAAC;AA0BH,eAAO,MAAM,YAAY,EAAE,EA2H1B,CAAC"}
@@ -38,7 +38,7 @@ const NumericEditableCell = getEditableCell({
38
38
  });
39
39
  export const TableExample = provide({
40
40
  singletons: [TableStore],
41
- })(observer((props) => {
41
+ })(observer(() => {
42
42
  const [{ tableState, inEdit, editAll, cancelAll, saveAll }] = useDependencies(TableStore);
43
43
  const madeInColumnMenu = useMemo(() => standardFilterWithMultiselect({ tableState }), [tableState]);
44
44
  const cellRender = (td, { dataItem, field }) => {
@@ -51,6 +51,6 @@ export const TableExample = provide({
51
51
  },
52
52
  });
53
53
  };
54
- 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 }), inEdit ? (_jsxs(ButtonGroup, { children: [_jsx(Button, Object.assign({ small: true, onClick: cancelAll, className: "m-r-2" }, { children: "Cancel All" })), _jsx(Button, Object.assign({ small: true, primary: true, onClick: saveAll }, { children: "Save All" }))] })) : (_jsx(Button, Object.assign({ small: true, primary: true, onClick: editAll }, { children: "Edit All" })))] })), _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" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", cell: TextEditableCell, columnMenu: StandardColumnMenuFilter, width: "240px" }), _jsx(TableColumn, { field: "Supplier", title: "Supplier", cell: SupplierCell, columnMenu: StandardColumnMenuFilter, width: "150px" }), _jsx(TableColumn, { field: "MadeIn", title: "Made In", cell: TextEditableCell, columnMenu: madeInColumnMenu, width: "175px" }), _jsx(TableColumn, { field: "UnitsOnOrder", title: "First Ordered On", cell: DateEditableCell, columnMenu: DateRangeColumnMenuFilter, format: "{0:MM/dd/yyyy}", width: "240px" }), _jsx(TableColumn, { field: "UnitPrice", title: "Unit Price", cell: NumericEditableCell, 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", cell: AvailableForEditableCell, columnMenu: UserRoleColumnMenuFilter, width: "240px" }), _jsx(TableColumn, Object.assign({ cell: ActionsCell, sortable: false }, (props.fixedWidthColumns ? { width: '125px' } : {})))] }))] }));
54
+ 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 }), inEdit ? (_jsxs(ButtonGroup, { children: [_jsx(Button, Object.assign({ small: true, onClick: cancelAll, className: "m-r-2" }, { children: "Cancel All" })), _jsx(Button, Object.assign({ small: true, primary: true, onClick: saveAll }, { children: "Save All" }))] })) : (_jsx(Button, Object.assign({ small: true, primary: true, onClick: editAll }, { children: "Edit All" })))] })), _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" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", cell: TextEditableCell, columnMenu: StandardColumnMenuFilter, width: "240px" }), _jsx(TableColumn, { field: "Supplier", title: "Supplier", cell: SupplierCell, columnMenu: StandardColumnMenuFilter, width: "150px" }), _jsx(TableColumn, { field: "MadeIn", title: "Made In", cell: TextEditableCell, columnMenu: madeInColumnMenu, width: "175px" }), _jsx(TableColumn, { field: "UnitsOnOrder", title: "First Ordered On", cell: DateEditableCell, columnMenu: DateRangeColumnMenuFilter, format: "{0:MM/dd/yyyy}", width: "240px" }), _jsx(TableColumn, { field: "UnitPrice", title: "Unit Price", cell: NumericEditableCell, 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", cell: AvailableForEditableCell, columnMenu: UserRoleColumnMenuFilter, width: "240px" }), _jsx(TableColumn, { cell: ActionsCell, sortable: false, width: "125px" })] }))] }));
55
55
  }));
56
56
  //# sourceMappingURL=table.js.map
@@ -1 +1 @@
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,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE1F,OAAO,EACH,KAAK,EACL,WAAW,EACX,SAAS,EAET,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,2BAA2B,EAC3B,6BAA6B,EAC7B,eAAe,GAElB,MAAM,OAAO,CAA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,EACxB,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,yBAAyB,EACrC,MAAM,EAAC,gBAAgB,EACvB,KAAK,EAAC,OAAO,GACf,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,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,IAAI,EAAE,wBAAwB,EAC9B,UAAU,EAAE,wBAAwB,EACpC,KAAK,EAAC,OAAO,GACf,EAEF,KAAC,WAAW,IAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,OAAO,GAAG,KAC7D,IACD,CACd,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/table",
3
- "version": "25.0.0",
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.0",
40
+ "@servicetitan/data-query": "^25.1.0",
41
41
  "@servicetitan/design-system": ">=12.4.1",
42
- "@servicetitan/form": "^25.0.0",
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.0",
56
+ "@servicetitan/data-query": "^25.1.0",
57
57
  "@servicetitan/design-system": ">=12.4.1",
58
- "@servicetitan/form": "^25.0.0",
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": "cdf8c0f396959190a404d1a601c46947a858a476"
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';
@@ -94,14 +94,10 @@ const NumericEditableCell = getEditableCell({
94
94
  editor: getEditableCell({ editor: NumberCellEditor }),
95
95
  });
96
96
 
97
- export interface TableExampleProps {
98
- fixedWidthColumns?: boolean;
99
- }
100
-
101
- export const TableExample: FC<TableExampleProps> = provide({
97
+ export const TableExample: FC = provide({
102
98
  singletons: [TableStore],
103
99
  })(
104
- observer((props: TableExampleProps) => {
100
+ observer(() => {
105
101
  const [{ tableState, inEdit, editAll, cancelAll, saveAll }] = useDependencies(TableStore);
106
102
 
107
103
  const madeInColumnMenu = useMemo(
@@ -216,11 +212,7 @@ export const TableExample: FC<TableExampleProps> = provide({
216
212
  width="240px"
217
213
  />
218
214
 
219
- <TableColumn
220
- cell={ActionsCell}
221
- sortable={false}
222
- {...(props.fixedWidthColumns ? { width: '125px' } : {})}
223
- />
215
+ <TableColumn cell={ActionsCell} sortable={false} width="125px" />
224
216
  </Table>
225
217
  </Fragment>
226
218
  );
@@ -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 />;