@servicetitan/table 25.0.1 → 25.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. package/dist/demo/filters/async-select-filter.js +1 -1
  2. package/dist/demo/filters/async-select-filter.js.map +1 -1
  3. package/dist/demo/filters/categories.d.ts.map +1 -1
  4. package/dist/demo/filters/categories.js +24 -0
  5. package/dist/demo/filters/categories.js.map +1 -1
  6. package/dist/demo/filters/multiselect-filter.d.ts.map +1 -1
  7. package/dist/demo/filters/multiselect-filter.js +2 -1
  8. package/dist/demo/filters/multiselect-filter.js.map +1 -1
  9. package/dist/demo/filters/select-filter.d.ts +6 -0
  10. package/dist/demo/filters/select-filter.d.ts.map +1 -0
  11. package/dist/demo/filters/select-filter.js +58 -0
  12. package/dist/demo/filters/select-filter.js.map +1 -0
  13. package/dist/demo/filters/single-select-filter.d.ts.map +1 -1
  14. package/dist/demo/filters/single-select-filter.js +2 -1
  15. package/dist/demo/filters/single-select-filter.js.map +1 -1
  16. package/dist/demo/filters/table.store.d.ts +8 -1
  17. package/dist/demo/filters/table.store.d.ts.map +1 -1
  18. package/dist/demo/filters/table.store.js +35 -1
  19. package/dist/demo/filters/table.store.js.map +1 -1
  20. package/dist/demo/footer-page-size/index.d.ts +2 -0
  21. package/dist/demo/footer-page-size/index.d.ts.map +1 -0
  22. package/dist/demo/footer-page-size/index.js +2 -0
  23. package/dist/demo/footer-page-size/index.js.map +1 -0
  24. package/dist/demo/footer-page-size/table.d.ts +3 -0
  25. package/dist/demo/footer-page-size/table.d.ts.map +1 -0
  26. package/dist/demo/footer-page-size/table.js +18 -0
  27. package/dist/demo/footer-page-size/table.js.map +1 -0
  28. package/dist/demo/index.d.ts +1 -0
  29. package/dist/demo/index.d.ts.map +1 -1
  30. package/dist/demo/index.js +1 -0
  31. package/dist/demo/index.js.map +1 -1
  32. package/dist/demo/overview/product.d.ts +5 -0
  33. package/dist/demo/overview/product.d.ts.map +1 -1
  34. package/dist/demo/overview/products.d.ts.map +1 -1
  35. package/dist/demo/overview/products.js +12 -0
  36. package/dist/demo/overview/products.js.map +1 -1
  37. package/dist/demo/overview/table.store.d.ts.map +1 -1
  38. package/dist/demo/overview/table.store.js +1 -0
  39. package/dist/demo/overview/table.store.js.map +1 -1
  40. package/dist/filters/async-select/async-select-filter.d.ts +7 -3
  41. package/dist/filters/async-select/async-select-filter.d.ts.map +1 -1
  42. package/dist/filters/async-select/async-select-filter.js +21 -6
  43. package/dist/filters/async-select/async-select-filter.js.map +1 -1
  44. package/dist/filters/column-menu-filters.d.ts +10 -1
  45. package/dist/filters/column-menu-filters.d.ts.map +1 -1
  46. package/dist/filters/column-menu-filters.js +11 -3
  47. package/dist/filters/column-menu-filters.js.map +1 -1
  48. package/dist/filters/index.d.ts +1 -0
  49. package/dist/filters/index.d.ts.map +1 -1
  50. package/dist/filters/index.js +1 -0
  51. package/dist/filters/index.js.map +1 -1
  52. package/dist/filters/multiselect-filter/multiselect-filter.d.ts +4 -3
  53. package/dist/filters/multiselect-filter/multiselect-filter.d.ts.map +1 -1
  54. package/dist/filters/multiselect-filter/multiselect-filter.js +7 -7
  55. package/dist/filters/multiselect-filter/multiselect-filter.js.map +1 -1
  56. package/dist/filters/select-filter/object-search.d.ts +2 -0
  57. package/dist/filters/select-filter/object-search.d.ts.map +1 -0
  58. package/dist/filters/select-filter/object-search.js +19 -0
  59. package/dist/filters/select-filter/object-search.js.map +1 -0
  60. package/dist/filters/select-filter/select-filter.d.ts +32 -0
  61. package/dist/filters/select-filter/select-filter.d.ts.map +1 -0
  62. package/dist/filters/select-filter/select-filter.js +214 -0
  63. package/dist/filters/select-filter/select-filter.js.map +1 -0
  64. package/dist/filters/select-filter/select-filter.stories.d.ts +8 -0
  65. package/dist/filters/select-filter/select-filter.stories.d.ts.map +1 -0
  66. package/dist/filters/select-filter/select-filter.stories.js +8 -0
  67. package/dist/filters/select-filter/select-filter.stories.js.map +1 -0
  68. package/dist/filters/select-filter/value-getter.d.ts +3 -0
  69. package/dist/filters/select-filter/value-getter.d.ts.map +1 -0
  70. package/dist/filters/select-filter/value-getter.js +10 -0
  71. package/dist/filters/select-filter/value-getter.js.map +1 -0
  72. package/dist/filters/single-select/single-select-filter.d.ts +3 -2
  73. package/dist/filters/single-select/single-select-filter.d.ts.map +1 -1
  74. package/dist/filters/single-select/single-select-filter.js +17 -7
  75. package/dist/filters/single-select/single-select-filter.js.map +1 -1
  76. package/dist/index.d.ts +1 -1
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/index.js.map +1 -1
  80. package/package.json +6 -6
  81. package/src/demo/filters/async-select-filter.tsx +1 -1
  82. package/src/demo/filters/categories.tsx +24 -0
  83. package/src/demo/filters/multiselect-filter.tsx +15 -0
  84. package/src/demo/filters/select-filter.tsx +147 -0
  85. package/src/demo/filters/single-select-filter.tsx +2 -1
  86. package/src/demo/filters/table.store.ts +45 -2
  87. package/src/demo/footer-page-size/index.ts +1 -0
  88. package/src/demo/footer-page-size/table.tsx +104 -0
  89. package/src/demo/index.ts +1 -0
  90. package/src/demo/overview/product.ts +6 -0
  91. package/src/demo/overview/products.ts +12 -0
  92. package/src/demo/overview/table.store.ts +1 -0
  93. package/src/filters/async-select/async-select-filter.tsx +26 -15
  94. package/src/filters/column-menu-filters.tsx +44 -21
  95. package/src/filters/index.ts +1 -0
  96. package/src/filters/multiselect-filter/multiselect-filter.tsx +16 -7
  97. package/src/filters/select-filter/__tests__/object-search.test.ts +32 -0
  98. package/src/filters/select-filter/object-search.ts +25 -0
  99. package/src/filters/select-filter/select-filter.stories.tsx +8 -0
  100. package/src/filters/select-filter/select-filter.tsx +320 -0
  101. package/src/filters/select-filter/value-getter.ts +13 -0
  102. package/src/filters/single-select/single-select-filter.tsx +18 -10
  103. package/src/index.ts +1 -0
  104. package/src/table.stories.tsx +4 -2
@@ -3,7 +3,10 @@ import { Component, SyntheticEvent, ReactNode, FC } from 'react';
3
3
  import { IdType } from '@servicetitan/data-query';
4
4
  import { TableFilterCellProps, Radio } from '@servicetitan/design-system';
5
5
 
6
- import { renderCustomColumnMenuFilter } from '../column-menu-filters';
6
+ import {
7
+ CustomColumnMenuFilterSingleOpts,
8
+ renderCustomColumnMenuFilter,
9
+ } from '../column-menu-filters';
7
10
 
8
11
  interface SelectorProps<TV, TO> {
9
12
  options: TO[];
@@ -33,16 +36,21 @@ class SelectorRadio<TV, TO> extends Component<SelectorProps<TV, TO>> {
33
36
  }
34
37
  }
35
38
 
36
- export interface SingleSelectColumnMenuOptions<TV, TO = TV> {
39
+ export interface SingleSelectColumnMenuOptions<TV, TO = TV>
40
+ extends CustomColumnMenuFilterSingleOpts {
37
41
  options: TO[];
38
42
  valueSelector?: (item: TO) => TV;
39
43
  renderItem?: (item: TO) => ReactNode | string;
40
44
  filterOperator?: (listItem: any, value: TV) => boolean;
41
45
  }
42
46
 
43
- export function singleSelectColumnMenuFilter<TV extends IdType, TO = TV>(
44
- props: SingleSelectColumnMenuOptions<TV, TO>
45
- ) {
47
+ export function singleSelectColumnMenuFilter<TV extends IdType, TO = TV>({
48
+ options,
49
+ valueSelector,
50
+ renderItem,
51
+ filterOperator,
52
+ ...opts
53
+ }: SingleSelectColumnMenuOptions<TV, TO>) {
46
54
  const FilterCell: FC<TableFilterCellProps> = ({ value, onChange }) => {
47
55
  const handleChange = (value: TV | undefined, event: SyntheticEvent<HTMLInputElement>) => {
48
56
  const filter =
@@ -50,7 +58,7 @@ export function singleSelectColumnMenuFilter<TV extends IdType, TO = TV>(
50
58
  ? { value: '', operator: '' }
51
59
  : {
52
60
  value,
53
- operator: props.filterOperator ?? 'equals',
61
+ operator: filterOperator ?? 'equals',
54
62
  };
55
63
 
56
64
  onChange({
@@ -61,14 +69,14 @@ export function singleSelectColumnMenuFilter<TV extends IdType, TO = TV>(
61
69
 
62
70
  return (
63
71
  <SelectorRadio
64
- options={props.options}
72
+ options={options}
65
73
  value={value === '' ? undefined : value}
66
74
  onChange={handleChange}
67
- renderer={props.renderItem}
68
- valueSelector={props.valueSelector ?? (option => option)}
75
+ renderer={renderItem}
76
+ valueSelector={valueSelector ?? (option => option)}
69
77
  />
70
78
  );
71
79
  };
72
80
 
73
- return renderCustomColumnMenuFilter(FilterCell);
81
+ return renderCustomColumnMenuFilter(FilterCell, opts);
74
82
  }
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export {
15
15
  TableColumnReorderEvent,
16
16
  TableCell,
17
17
  TableHeaderCellProps,
18
+ TableHeaderCell,
18
19
  TableRowProps,
19
20
  TableRowClickEvent,
20
21
  TableDetailRow,
@@ -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 />;