@servicetitan/table 22.4.3 → 22.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/demo/column-hiding/index.d.ts +2 -0
  3. package/dist/demo/column-hiding/index.d.ts.map +1 -0
  4. package/dist/demo/column-hiding/index.js +2 -0
  5. package/dist/demo/column-hiding/index.js.map +1 -0
  6. package/dist/demo/column-hiding/product.d.ts +27 -0
  7. package/dist/demo/column-hiding/product.d.ts.map +1 -0
  8. package/dist/demo/column-hiding/product.js +16 -0
  9. package/dist/demo/column-hiding/product.js.map +1 -0
  10. package/dist/demo/column-hiding/products.d.ts +3 -0
  11. package/dist/demo/column-hiding/products.d.ts.map +1 -0
  12. package/dist/demo/column-hiding/products.js +127 -0
  13. package/dist/demo/column-hiding/products.js.map +1 -0
  14. package/dist/demo/column-hiding/table.d.ts +3 -0
  15. package/dist/demo/column-hiding/table.d.ts.map +1 -0
  16. package/dist/demo/column-hiding/table.js +63 -0
  17. package/dist/demo/column-hiding/table.js.map +1 -0
  18. package/dist/demo/column-hiding/table.store.d.ts +9 -0
  19. package/dist/demo/column-hiding/table.store.d.ts.map +1 -0
  20. package/dist/demo/column-hiding/table.store.js +44 -0
  21. package/dist/demo/column-hiding/table.store.js.map +1 -0
  22. package/dist/demo/index.d.ts +1 -0
  23. package/dist/demo/index.d.ts.map +1 -1
  24. package/dist/demo/index.js +1 -0
  25. package/dist/demo/index.js.map +1 -1
  26. package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.d.ts +1 -1
  27. package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.d.ts.map +1 -1
  28. package/dist/table-state.d.ts +3 -1
  29. package/dist/table-state.d.ts.map +1 -1
  30. package/dist/table-state.js +8 -1
  31. package/dist/table-state.js.map +1 -1
  32. package/dist/table.d.ts +3 -1
  33. package/dist/table.d.ts.map +1 -1
  34. package/dist/table.js +28 -4
  35. package/dist/table.js.map +1 -1
  36. package/package.json +24 -24
  37. package/src/demo/column-hiding/index.ts +1 -0
  38. package/src/demo/column-hiding/product.ts +28 -0
  39. package/src/demo/column-hiding/products.ts +127 -0
  40. package/src/demo/column-hiding/table.store.ts +26 -0
  41. package/src/demo/column-hiding/table.tsx +118 -0
  42. package/src/demo/index.ts +1 -0
  43. package/src/filters/standard-filter-with-multiselect/filter-cell-ext.tsx +1 -1
  44. package/src/table-state.ts +18 -2
  45. package/src/table.stories.tsx +15 -0
  46. package/src/table.tsx +29 -6
package/dist/table.d.ts CHANGED
@@ -10,7 +10,7 @@ interface TableColumnProps<T = never, TId extends IdType = any, P = never, PId e
10
10
  cell?: ComponentType<TableCellProps<T, TId, P, PId>>;
11
11
  children?: ReactElement<TableColumnProps<T, TId, P, PId>>[];
12
12
  }
13
- declare type ExcludedTableProps = 'data' | 'editField' | 'filter' | 'onFilterChange' | 'group' | 'onGroupChange' | 'onExpandChange' | 'expandField' | 'sort' | 'onSortChange' | 'onHeaderSelectionChange' | 'onSelectionChange' | 'selectedField' | 'pageable' | 'pageSize' | 'skip' | 'onPageChange' | 'total' | 'selectable' | 'pager';
13
+ declare type ExcludedTableProps = 'data' | 'dataItemKey' | 'editField' | 'filter' | 'onFilterChange' | 'group' | 'onGroupChange' | 'onExpandChange' | 'expandField' | 'sort' | 'onSortChange' | 'onHeaderSelectionChange' | 'onSelectionChange' | 'selectedField' | 'pageable' | 'pageSize' | 'skip' | 'onPageChange' | 'total' | 'selectable' | 'pager';
14
14
  export interface TableProps<T, TId extends IdType = any, P = never, PId extends IdType = never> extends Omit<AnvilTableProps, ExcludedTableProps> {
15
15
  selectable?: boolean;
16
16
  exportable?: boolean;
@@ -25,6 +25,7 @@ export declare class Table<T, TId extends IdType = any, P = never, PId extends I
25
25
  private ref;
26
26
  private lastSelection?;
27
27
  private selectColumnCell;
28
+ private customCellMap;
28
29
  private selectHeaderCell;
29
30
  private withCellTableState;
30
31
  rowRender: (row: ReactElement, rowProps: TableRowProps) => ReactNode;
@@ -35,6 +36,7 @@ export declare class Table<T, TId extends IdType = any, P = never, PId extends I
35
36
  render(): JSX.Element;
36
37
  private getPageable;
37
38
  private table;
39
+ private getOrCreateCellComponentWithTableState;
38
40
  }
39
41
  export {};
40
42
  //# sourceMappingURL=table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../src/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEH,SAAS,EAKT,SAAS,EACT,YAAY,EACZ,aAAa,EAEhB,MAAM,OAAO,CAAC;AACf,OAAO,EAGH,UAAU,IAAI,eAAe,EAC7B,aAAa,EAEb,gBAAgB,IAAI,qBAAqB,EACzC,cAAc,IAAI,mBAAmB,EAErC,+BAA+B,EAC/B,yBAAyB,EACzB,kBAAkB,EACrB,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAmB,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAc,MAAM,eAAe,CAAC;AACvD,OAAO,EACH,oBAAoB,EAGvB,MAAM,2BAA2B,CAAC;AA0BnC,MAAM,WAAW,cAAc,CAC3B,CAAC,GAAG,KAAK,EACT,GAAG,SAAS,MAAM,GAAG,GAAG,EACxB,CAAC,GAAG,KAAK,EACT,GAAG,SAAS,MAAM,GAAG,KAAK,CAC5B,SAAQ,mBAAmB;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;CAC3C;AAED,UAAU,gBAAgB,CACtB,CAAC,GAAG,KAAK,EACT,GAAG,SAAS,MAAM,GAAG,GAAG,EACxB,CAAC,GAAG,KAAK,EACT,GAAG,SAAS,MAAM,GAAG,KAAK,CAC5B,SAAQ,qBAAqB;IAC3B,IAAI,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC,EA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AAC,GAAG,KAAK,EACT,GAAG,SAAS,MAAM,GAAG,KAAK,CAC5B,SAAQ,SAAS,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3C,OAAO,CAAC,UAAU,CAAyB;IAE3C,OAAO,CAAC,GAAG,CAA4B;IAEvC,OAAO,CAAC,aAAa,CAAC,CAAgB;IAEtC,OAAO,CAAC,gBAAgB,CAMrB;IAEH,OAAO,CAAC,aAAa,CAAyD;IAE9E,OAAO,CAAC,gBAAgB,CAgBrB;IAGH,OAAO,CAAC,kBAAkB,CAQxB;IAEF,SAAS,QAAS,YAAY,YAAY,aAAa,eAcrD;IAEF,cAAc,CACV,QAAQ,EAAE,SAAS,EACnB,WAAW,EAAE,CACT,MAAM,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,KACrD,YAAY,CAAC,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,GACpD,SAAS;IAiBZ,2BAA2B,OAAQ,+BAA+B,UAgBhE;IAEF,qBAAqB,OAAQ,yBAAyB,UAuCpD;IAEF,cAAc,aAQZ;IAEF,MAAM;IAuCN,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,KAAK,CAqDX;IAEF,OAAO,CAAC,sCAAsC,CAoB5C;CACL"}
package/dist/table.js CHANGED
@@ -65,6 +65,12 @@ let Table = class Table extends Component {
65
65
  writable: true,
66
66
  value: observer((props) => (_jsx(SelectColumnCell, Object.assign({}, props, { isRowSelectable: this.tableState.isRowSelectable(props.dataItem), control: this.props.selectionControl }))))
67
67
  });
68
+ Object.defineProperty(this, "customCellMap", {
69
+ enumerable: true,
70
+ configurable: true,
71
+ writable: true,
72
+ value: new Map()
73
+ });
68
74
  Object.defineProperty(this, "selectHeaderCell", {
69
75
  enumerable: true,
70
76
  configurable: true,
@@ -84,10 +90,9 @@ let Table = class Table extends Component {
84
90
  configurable: true,
85
91
  writable: true,
86
92
  value: memoizeOne((children) => this.applyToColumns(children, column => {
87
- const { cell: Cell } = column.props;
93
+ const { cell: Cell, field } = column.props;
88
94
  return cloneElement(column, {
89
- cell: Cell &&
90
- ((props) => (_jsx(Cell, Object.assign({}, props, { tableState: this.tableState })))),
95
+ cell: this.getOrCreateCellComponentWithTableState(Cell, field),
91
96
  });
92
97
  }))
93
98
  });
@@ -188,11 +193,30 @@ let Table = class Table extends Component {
188
193
  writable: true,
189
194
  value: () => {
190
195
  const _a = this.props, { className, filterOperators, selectable, pager } = _a, props = __rest(_a, ["className", "filterOperators", "selectable", "pager"]);
191
- return (_jsxs(AnvilTable, Object.assign({ ref: this.ref }, props, { data: [...this.tableState.data], rowRender: this.rowRender, editField: "inEdit", filter: this.tableState.filter, filterOperators: filterOperators !== null && filterOperators !== void 0 ? filterOperators : operators, onFilterChange: this.tableState.handleFilterChange, group: [...this.tableState.group], onGroupChange: this.tableState.handleGroupChange, onExpandChange: this.tableState.handleExpandChange, expandField: "expanded", sort: [...this.tableState.sort], onSortChange: this.tableState.handleSortChange, onHeaderSelectionChange: this.handleHeaderSelectionChange, onSelectionChange: this.handleSelectionChange, selectedField: "selected", pageable: this.getPageable(), pageSize: this.tableState.pageSize, skip: this.tableState.skip, onPageChange: this.tableState.handlePageChange, total: this.tableState.filteredCount, className: classNames(Styles.table, className), selectable: { enabled: selectable, mode: 'multiple' } }, { children: [selectable && (_jsx(TableColumn, { locked: true, field: "selected", width: "50px", filterable: false, resizable: false, headerSelectionValue: props.scrollable !== 'virtual'
196
+ return (_jsxs(AnvilTable, Object.assign({ ref: this.ref }, props, { dataItemKey: this.tableState.rowIdKey, data: [...this.tableState.data], rowRender: this.rowRender, editField: "inEdit", filter: this.tableState.filter, filterOperators: filterOperators !== null && filterOperators !== void 0 ? filterOperators : operators, onFilterChange: this.tableState.handleFilterChange, group: [...this.tableState.group], onGroupChange: this.tableState.handleGroupChange, onExpandChange: this.tableState.handleExpandChange, expandField: "expanded", sort: [...this.tableState.sort], onSortChange: this.tableState.handleSortChange, onHeaderSelectionChange: this.handleHeaderSelectionChange, onSelectionChange: this.handleSelectionChange, selectedField: "selected", pageable: this.getPageable(), pageSize: this.tableState.pageSize, skip: this.tableState.skip, onPageChange: this.tableState.handlePageChange, total: this.tableState.filteredCount, className: classNames(Styles.table, className), selectable: { enabled: selectable, mode: 'multiple' } }, { children: [selectable && (_jsx(TableColumn, { locked: true, field: "selected", id: "selected", width: "50px", filterable: false, resizable: false, headerSelectionValue: props.scrollable !== 'virtual'
192
197
  ? this.tableState.isAllPageRowsSelected
193
198
  : this.tableState.isAllRowsSelected, headerCell: this.selectHeaderCell, cell: this.selectColumnCell, headerClassName: "lh-1-i ta-center-i", className: classNames(Styles.unselectable, 'lh-1-i', 'ta-center-i') })), this.withCellTableState(props.children)] })));
194
199
  }
195
200
  });
201
+ Object.defineProperty(this, "getOrCreateCellComponentWithTableState", {
202
+ enumerable: true,
203
+ configurable: true,
204
+ writable: true,
205
+ value: (Cell, field) => {
206
+ if (!Cell) {
207
+ return undefined;
208
+ }
209
+ const CellWithTableState = (props) => _jsx(Cell, Object.assign({}, props, { tableState: this.tableState }));
210
+ CellWithTableState.displayName = 'CellWithTableState';
211
+ if (field) {
212
+ if (this.customCellMap.has(field)) {
213
+ return this.customCellMap.get(field);
214
+ }
215
+ this.customCellMap.set(field, CellWithTableState);
216
+ }
217
+ return CellWithTableState;
218
+ }
219
+ });
196
220
  }
197
221
  applyToColumns(children, transformer) {
198
222
  return Children.map(children, child => {
package/dist/table.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","sourceRoot":"","sources":["../src/table.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EACH,cAAc,EACd,SAAS,EACT,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,GAKX,MAAM,OAAO,CAAC;AACf,OAAO,EACH,YAAY,EACZ,KAAK,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AC,KAAK,CAAC,cAAc,CAAC,iBAE1D,IAAI,CAAC,KAAK,CAAC,QAAQ,EACnB,KAAK,KACO,EACjB,KAAC,WAAW,kBACR,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,sBAAsB,EAC3C,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,gBAE1D,IAAI,CAAC,KAAK,CAAC,QAAQ,IACV,IACP,CACd,IACM,CACd,CAAC;IACN,CAAC;IAEO,WAAW;;QACf,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;YAClE,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,mCAAI,IAAI,CAAC;IACpC,CAAC;CA8EJ,CAAA;AAzRY,KAAK;IADjB,QAAQ;GACI,KAAK,CAyRjB;SAzRY,KAAK;AA2RlB,MAAM,sBAAsB,GAAG,UAAU,CAAC,CAAC,QAA4B,EAAE,EAAE,CACvE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CACjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/table",
3
- "version": "22.4.3",
3
+ "version": "22.5.0",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/table",
6
6
  "repository": {
@@ -16,35 +16,35 @@
16
16
  "src"
17
17
  ],
18
18
  "dependencies": {
19
- "@progress/kendo-data-query": "~1.5.4",
20
- "@progress/kendo-drawing": "~1.11.0",
19
+ "@progress/kendo-data-query": "~1.6.0",
20
+ "@progress/kendo-drawing": "~1.17.1",
21
21
  "@progress/kendo-licensing": "~1.2.0",
22
22
  "@progress/kendo-ooxml": "~1.6.2",
23
- "@progress/kendo-react-animation": "~4.10.0",
24
- "@progress/kendo-react-buttons": "~4.10.0",
25
- "@progress/kendo-react-data-tools": "~4.10.0",
26
- "@progress/kendo-react-dateinputs": "~4.10.0",
27
- "@progress/kendo-react-dropdowns": "~4.10.0",
28
- "@progress/kendo-react-excel-export": "~4.10.0",
29
- "@progress/kendo-react-grid": "~4.10.0",
30
- "@progress/kendo-react-inputs": "~4.10.0",
31
- "@progress/kendo-react-intl": "~4.10.0",
32
- "@progress/kendo-react-pdf": "~4.10.0",
33
- "@progress/kendo-react-popup": "~4.10.0",
34
- "@progress/kendo-react-treeview": "~4.10.0",
23
+ "@progress/kendo-react-animation": "~5.5.0",
24
+ "@progress/kendo-react-buttons": "~5.5.0",
25
+ "@progress/kendo-react-data-tools": "~5.5.0",
26
+ "@progress/kendo-react-dateinputs": "~5.5.0",
27
+ "@progress/kendo-react-dropdowns": "~5.5.0",
28
+ "@progress/kendo-react-excel-export": "~5.5.0",
29
+ "@progress/kendo-react-grid": "~5.5.0",
30
+ "@progress/kendo-react-inputs": "~5.5.0",
31
+ "@progress/kendo-react-intl": "~5.5.0",
32
+ "@progress/kendo-react-pdf": "~5.5.0",
33
+ "@progress/kendo-react-popup": "~5.5.0",
34
+ "@progress/kendo-react-treeview": "~5.5.0",
35
35
  "classnames": "~2.3.1",
36
36
  "memoize-one": "~6.0.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@servicetitan/data-query": "^22.4.3",
40
- "@servicetitan/design-system": "~11.8.0",
41
- "@servicetitan/form": "^22.4.3",
39
+ "@servicetitan/data-query": "^22.5.0",
40
+ "@servicetitan/design-system": "~12.4.0",
41
+ "@servicetitan/form": "^22.5.0",
42
42
  "@servicetitan/react-ioc": "^21.6.0",
43
43
  "@servicetitan/suppress-warnings": "^21.6.0",
44
44
  "@types/accounting": "~0.4.2",
45
45
  "@types/react": "~17.0.38",
46
46
  "accounting": "~0.4.1",
47
- "formstate": "~2.0.0",
47
+ "formstate": "~2.1.0",
48
48
  "mobx": "~6.6.0",
49
49
  "mobx-react": "~7.5.0",
50
50
  "mobx-utils": "~6.0.5",
@@ -52,13 +52,13 @@
52
52
  "react": "~17.0.2"
53
53
  },
54
54
  "peerDependencies": {
55
- "@servicetitan/data-query": "^22.4.3",
56
- "@servicetitan/design-system": ">11.8.0",
57
- "@servicetitan/form": "^22.4.3",
55
+ "@servicetitan/data-query": "^22.5.0",
56
+ "@servicetitan/design-system": ">12.4.0",
57
+ "@servicetitan/form": "^22.5.0",
58
58
  "@servicetitan/react-ioc": ">21.0.0",
59
59
  "@servicetitan/suppress-warnings": ">21.0.0",
60
60
  "accounting": "~0.4.1",
61
- "formstate": "~2.0.0",
61
+ "formstate": "~2.1.0",
62
62
  "mobx": "~6.6.0",
63
63
  "mobx-react": "~7.5.0",
64
64
  "mobx-utils": "~6.0.5",
@@ -71,5 +71,5 @@
71
71
  "cli": {
72
72
  "webpack": false
73
73
  },
74
- "gitHead": "bf5e703e0fba9119846edcdc76413732d9ed5e7a"
74
+ "gitHead": "4aa6870f390e31bca1b4657f24ab621c96c6226a"
75
75
  }
@@ -0,0 +1 @@
1
+ export * from './table';
@@ -0,0 +1,28 @@
1
+ export enum UserRole {
2
+ Unspecified,
3
+ Technician,
4
+ GeneralOffice,
5
+ Admin,
6
+ Owner,
7
+ }
8
+
9
+ export enum Supplier {
10
+ Dan = 1,
11
+ Adam,
12
+ Charlie,
13
+ Benjamin,
14
+ }
15
+
16
+ export interface Product {
17
+ ProductID: number;
18
+ ProductName: string;
19
+ Supplier: Supplier;
20
+ CategoryID: number;
21
+ MadeIn: string;
22
+ QuantityPerUnit: string;
23
+ UnitPrice: number;
24
+ UnitsInStock: number;
25
+ UnitsOnOrder: Date;
26
+ Discontinued: boolean;
27
+ AvailableFor?: UserRole;
28
+ }
@@ -0,0 +1,127 @@
1
+ import { Product, UserRole, Supplier } from './product';
2
+
3
+ export const products: Product[] = [
4
+ {
5
+ ProductID: 101,
6
+ ProductName: 'Chai',
7
+ Supplier: Supplier.Dan,
8
+ CategoryID: 1,
9
+ MadeIn: 'China',
10
+ QuantityPerUnit: '10 boxes x 20 bags',
11
+ UnitPrice: 18.0,
12
+ UnitsInStock: 39,
13
+ UnitsOnOrder: new Date('1/11/2019'),
14
+ Discontinued: false,
15
+ AvailableFor: UserRole.Admin,
16
+ },
17
+ {
18
+ ProductID: 102,
19
+ ProductName: 'Chang',
20
+ Supplier: Supplier.Dan,
21
+ CategoryID: 1,
22
+ MadeIn: 'Thailand',
23
+ QuantityPerUnit: '24 - 12 oz bottles',
24
+ UnitPrice: 19.0,
25
+ UnitsInStock: 17,
26
+ UnitsOnOrder: new Date('2/11/2019'),
27
+ Discontinued: false,
28
+ },
29
+ {
30
+ ProductID: 103,
31
+ ProductName: 'Aniseed Syrup',
32
+ Supplier: Supplier.Dan,
33
+ CategoryID: 2,
34
+ MadeIn: 'France',
35
+ QuantityPerUnit: '12 - 550 ml bottles',
36
+ UnitPrice: 10.0,
37
+ UnitsInStock: 13,
38
+ UnitsOnOrder: new Date('3/11/2019'),
39
+ Discontinued: false,
40
+ AvailableFor: UserRole.Owner,
41
+ },
42
+ {
43
+ ProductID: 104,
44
+ ProductName: "Chef Anton's Cajun Seasoning",
45
+ Supplier: Supplier.Adam,
46
+ CategoryID: 2,
47
+ MadeIn: 'USA',
48
+ QuantityPerUnit: '48 - 6 oz jars',
49
+ UnitPrice: 22.0,
50
+ UnitsInStock: 53,
51
+ UnitsOnOrder: new Date('4/11/2019'),
52
+ Discontinued: false,
53
+ },
54
+ {
55
+ ProductID: 105,
56
+ ProductName: "Chef Anton's Gumbo Mix",
57
+ Supplier: Supplier.Adam,
58
+ CategoryID: 2,
59
+ MadeIn: 'USA',
60
+ QuantityPerUnit: '36 boxes',
61
+ UnitPrice: 21.35,
62
+ UnitsInStock: 0,
63
+ UnitsOnOrder: new Date('5/11/2019'),
64
+ Discontinued: true,
65
+ AvailableFor: UserRole.GeneralOffice,
66
+ },
67
+ {
68
+ ProductID: 106,
69
+ ProductName: "Grandma's Boysenberry Spread",
70
+ Supplier: Supplier.Charlie,
71
+ CategoryID: 2,
72
+ MadeIn: 'Norway',
73
+ QuantityPerUnit: '12 - 8 oz jars',
74
+ UnitPrice: 25.0,
75
+ UnitsInStock: 120,
76
+ UnitsOnOrder: new Date('6/11/2019'),
77
+ Discontinued: false,
78
+ },
79
+ {
80
+ ProductID: 107,
81
+ ProductName: "Uncle Bob's Organic Dried Pears",
82
+ Supplier: Supplier.Charlie,
83
+ CategoryID: 7,
84
+ MadeIn: 'USA',
85
+ QuantityPerUnit: '12 - 1 lb pkgs.',
86
+ UnitPrice: 30.0,
87
+ UnitsInStock: 15,
88
+ UnitsOnOrder: new Date('7/11/2019'),
89
+ Discontinued: false,
90
+ },
91
+ {
92
+ ProductID: 108,
93
+ ProductName: 'Northwoods Cranberry Sauce',
94
+ Supplier: Supplier.Charlie,
95
+ CategoryID: 2,
96
+ MadeIn: 'Norway',
97
+ QuantityPerUnit: '12 - 12 oz jars',
98
+ UnitPrice: 40.0,
99
+ UnitsInStock: 6,
100
+ UnitsOnOrder: new Date('8/11/2019'),
101
+ Discontinued: false,
102
+ },
103
+ {
104
+ ProductID: 109,
105
+ ProductName: 'Mishi Kobe Niku',
106
+ Supplier: Supplier.Benjamin,
107
+ CategoryID: 6,
108
+ MadeIn: 'Japan',
109
+ QuantityPerUnit: '18 - 500 g pkgs.',
110
+ UnitPrice: 97.0,
111
+ UnitsInStock: 29,
112
+ UnitsOnOrder: new Date('9/11/2019'),
113
+ Discontinued: true,
114
+ },
115
+ {
116
+ ProductID: 110,
117
+ ProductName: 'Ikura',
118
+ Supplier: Supplier.Benjamin,
119
+ CategoryID: 8,
120
+ MadeIn: 'Japan',
121
+ QuantityPerUnit: '12 - 200 ml jars',
122
+ UnitPrice: 31.0,
123
+ UnitsInStock: 31,
124
+ UnitsOnOrder: new Date('10/11/2019'),
125
+ Discontinued: false,
126
+ },
127
+ ];
@@ -0,0 +1,26 @@
1
+ import { injectable } from '@servicetitan/react-ioc';
2
+ import { IdType, InMemoryDataSource, TableState } from '../..';
3
+ import { Product, UserRole, Supplier } from './product';
4
+ import { products } from './products';
5
+
6
+ @injectable()
7
+ export class TableStore {
8
+ rowIdKey: keyof Product = 'ProductID';
9
+
10
+ tableState = new TableState({
11
+ dataSource: this.getDataSource(),
12
+ pageSize: 5,
13
+ rowIdKey: this.rowIdKey,
14
+ });
15
+
16
+ private getDataSource() {
17
+ return new InMemoryDataSource(products, this.idSelector, {
18
+ Supplier: (value: Supplier) => Supplier[value],
19
+ AvailableFor: (value: UserRole | undefined) => value && UserRole[value],
20
+ });
21
+ }
22
+
23
+ private idSelector(row: Product) {
24
+ return row[this.rowIdKey] as IdType;
25
+ }
26
+ }
@@ -0,0 +1,118 @@
1
+ import { Fragment, FC, memo, useCallback, useState } from 'react';
2
+ import { provide, useDependencies } from '@servicetitan/react-ioc';
3
+ import { observer } from 'mobx-react';
4
+
5
+ import { Table, TableColumn, TableCellProps } from '../..';
6
+ import { TableStore } from './table.store';
7
+ import { Supplier } from './product';
8
+ import { TableCell } from '@servicetitan/design-system';
9
+
10
+ const SupplierCell: FC<TableCellProps> = props => {
11
+ const { field, dataItem } = props;
12
+
13
+ return <td>{Supplier[dataItem[field!]]}</td>;
14
+ };
15
+
16
+ const columns = [
17
+ { field: 'ProductID', title: 'ID', minWidth: 50 },
18
+ { field: 'ProductName', title: 'Name', minWidth: 200 },
19
+ { field: 'Supplier', title: 'Supplier', minWidth: 200 },
20
+ { field: 'MadeIn', title: 'Made In', minWidth: 200 },
21
+ { field: 'QuantityPerUnit', title: 'Quantity Per Unit', minWidth: 200 },
22
+ { field: 'UnitPrice', title: 'Price', minWidth: 100 },
23
+ { field: 'UnitsInStock', title: 'In stock', minWidth: 100 },
24
+ { field: 'UnitsOnOrder', title: 'On Order', minWidth: 100 },
25
+ { field: 'Discontinued', title: 'Discontinued', minWidth: 100 },
26
+ ];
27
+
28
+ const CheckboxRow = memo(({ field, label, checked, onChange }: any) => {
29
+ const handleChange = useCallback(
30
+ event => {
31
+ onChange(field, event.target.checked);
32
+ },
33
+ [field, onChange]
34
+ );
35
+
36
+ return (
37
+ <div>
38
+ <label>
39
+ <input type="checkbox" checked={checked} onChange={handleChange} /> {label}
40
+ </label>
41
+ </div>
42
+ );
43
+ });
44
+
45
+ const HiddenColumns = ({ onChange, checkedColumns }: any) => {
46
+ const handleChange = useCallback(
47
+ (field: string, checked: boolean) => {
48
+ const newState = new Set(Array.from(checkedColumns));
49
+ if (checked) {
50
+ newState.add(field);
51
+ } else {
52
+ newState.delete(field);
53
+ }
54
+ onChange(newState);
55
+ },
56
+ [checkedColumns, onChange]
57
+ );
58
+ return (
59
+ <div>
60
+ <span>Select columns to hide</span>
61
+ <div>
62
+ {columns.map(col => (
63
+ <CheckboxRow
64
+ key={col.field}
65
+ field={col.field}
66
+ label={col.title}
67
+ onChange={handleChange}
68
+ checked={checkedColumns.has(col.field)}
69
+ />
70
+ ))}
71
+ </div>
72
+ </div>
73
+ );
74
+ };
75
+
76
+ const CellProvider = (props: TableCellProps) => {
77
+ if (props.field === 'Supplier') {
78
+ return <SupplierCell {...props} />;
79
+ }
80
+ return <TableCell {...props} />;
81
+ };
82
+
83
+ export const TableColumnHidingExample: FC = provide({
84
+ singletons: [TableStore],
85
+ })(
86
+ observer(() => {
87
+ const [{ tableState }] = useDependencies(TableStore);
88
+ const [hiddenColumns, setHiddenColumns] = useState(new Set());
89
+
90
+ const handleHiddenColumnsChange = useCallback(columns => {
91
+ setHiddenColumns(new Set([...columns]));
92
+ }, []);
93
+
94
+ return (
95
+ <Fragment>
96
+ <HiddenColumns
97
+ checkedColumns={hiddenColumns}
98
+ onChange={handleHiddenColumnsChange}
99
+ />
100
+ <Table tableState={tableState} striped={false}>
101
+ {columns
102
+ .filter(col => !hiddenColumns.has(col.field))
103
+ .map(column => {
104
+ return (
105
+ <TableColumn
106
+ field={column.field}
107
+ title={column.title}
108
+ key={column.field}
109
+ id={column.field}
110
+ cell={CellProvider}
111
+ />
112
+ );
113
+ })}
114
+ </Table>
115
+ </Fragment>
116
+ );
117
+ })
118
+ );
package/src/demo/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './overview';
2
2
  export * from './master-detail';
3
3
  export * from './state-caching';
4
+ export * from './column-hiding';
@@ -38,7 +38,7 @@ export interface FilterCellExtProps extends TableColumnMenuFilterCellProps {
38
38
  multiselectTagRender?(
39
39
  tagData: MultiSelectTagData,
40
40
  li: ReactElement<HTMLLIElement>
41
- ): ReactElement<HTMLLIElement> | null;
41
+ ): ReactElement<HTMLLIElement>;
42
42
  multiselectListNoDataRender?(element: ReactElement<HTMLDivElement>): ReactNode;
43
43
  }
44
44
 
@@ -86,6 +86,7 @@ interface TableStateConstructorParams<
86
86
  getDetailTableState?: (row: T) => TableState<any, any, any, any> | undefined;
87
87
  initialState?: TableStateModel<TId>;
88
88
  alwaysEditable?: boolean;
89
+ rowIdKey?: string;
89
90
  }
90
91
 
91
92
  interface FetchDataParams {
@@ -128,6 +129,7 @@ export interface ITableState<T, TId extends IdType = never> {
128
129
 
129
130
  export class TableState<T, TId extends IdType = never, P = never, PId extends IdType = never> {
130
131
  @observable private innerDataSource: DataSource<T, TId> | null;
132
+
131
133
  @computed get dataSource() {
132
134
  return this.innerDataSource;
133
135
  }
@@ -157,7 +159,8 @@ export class TableState<T, TId extends IdType = never, P = never, PId extends Id
157
159
  }
158
160
  }
159
161
 
160
- @computed private get originalData() {
162
+ @computed
163
+ private get originalData() {
161
164
  const result: Selectable<T>[] = [];
162
165
 
163
166
  this.traverse(this.data, item => {
@@ -188,19 +191,25 @@ export class TableState<T, TId extends IdType = never, P = never, PId extends Id
188
191
  @observable filteredCount = 0;
189
192
  @observable selectedCount = 0;
190
193
  @observable unselectableCount = 0;
194
+
191
195
  @computed get unselectedCount() {
192
196
  return this.totalCount - this.selectedCount;
193
197
  }
198
+
194
199
  @computed get selectableCount() {
195
200
  return this.totalCount - this.unselectableCount;
196
201
  }
202
+
197
203
  @computed get filteredUnselectableCount() {
198
204
  return this.originalData.filter(this.isRowUnselectable).length;
199
205
  }
206
+
200
207
  @computed get filteredSelectableCount() {
201
208
  return this.originalData.length - this.filteredUnselectableCount;
202
209
  }
203
- @computed private get totalFilteredSelectableCountPromise() {
210
+
211
+ @computed
212
+ private get totalFilteredSelectableCountPromise() {
204
213
  return fromPromise(
205
214
  new Promise<number>((resolve, reject) => {
206
215
  if (!this.dataSource) {
@@ -221,19 +230,23 @@ export class TableState<T, TId extends IdType = never, P = never, PId extends Id
221
230
  })
222
231
  );
223
232
  }
233
+
224
234
  @computed get totalFilteredSelectableCount(): number {
225
235
  return (this.totalFilteredSelectableCountPromise.value as number) || 0;
226
236
  }
237
+
227
238
  @observable sort: SortDescriptor[] = [];
228
239
  @observable filter: CompositeFilterDescriptor | undefined;
229
240
 
230
241
  @observable aggregates: AggregateDescriptor[] = [];
231
242
 
232
243
  @observable innerGroup: GroupDescriptor[] = [];
244
+
233
245
  @computed
234
246
  get group(): GroupDescriptor[] {
235
247
  return addAggregatesToGroups(this.innerGroup, this.aggregates);
236
248
  }
249
+
237
250
  set group(value: GroupDescriptor[]) {
238
251
  this.innerGroup = value;
239
252
  }
@@ -244,10 +257,12 @@ export class TableState<T, TId extends IdType = never, P = never, PId extends Id
244
257
  private tablePdfExport: TablePDFExport | null = null;
245
258
  private tableExcelExport: ExcelExport | null = null;
246
259
 
260
+ rowIdKey?: string;
247
261
  alwaysEditable: boolean;
248
262
 
249
263
  constructor({
250
264
  dataSource = null,
265
+ rowIdKey,
251
266
  pageSize,
252
267
  isRowUnselectable = () => false,
253
268
  selectionLimit = Infinity,
@@ -263,6 +278,7 @@ export class TableState<T, TId extends IdType = never, P = never, PId extends Id
263
278
  this.pageSize = pageSize;
264
279
  this.isRowUnselectable = isRowUnselectable;
265
280
  this.selectionLimit = selectionLimit;
281
+ this.rowIdKey = rowIdKey;
266
282
 
267
283
  this.getFormState = getFormState;
268
284
 
@@ -0,0 +1,15 @@
1
+ import {
2
+ TableExample,
3
+ TableMasterDetailExample,
4
+ TableStateCachingExample,
5
+ TableColumnHidingExample
6
+ } from '../dist/demo';
7
+
8
+ export default {
9
+ title: 'Table/Demos'
10
+ };
11
+
12
+ export const Table = () => <TableExample />;
13
+ export const TableMasterDetail = () => <TableMasterDetailExample />;
14
+ export const TableStateCaching = () => <TableStateCachingExample />;
15
+ export const TableColumnHiding = () => <TableColumnHidingExample />;