@servicetitan/table 23.3.2 → 24.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/demo/filters/async-select-filter.d.ts +3 -0
- package/dist/demo/filters/async-select-filter.d.ts.map +1 -0
- package/dist/demo/filters/async-select-filter.js +23 -0
- package/dist/demo/filters/async-select-filter.js.map +1 -0
- package/dist/demo/filters/categories.d.ts +9 -0
- package/dist/demo/filters/categories.d.ts.map +1 -0
- package/dist/demo/filters/categories.js +33 -0
- package/dist/demo/filters/categories.js.map +1 -0
- package/dist/demo/filters/single-select-filter.d.ts +3 -0
- package/dist/demo/filters/single-select-filter.d.ts.map +1 -0
- package/dist/demo/filters/single-select-filter.js +20 -0
- package/dist/demo/filters/single-select-filter.js.map +1 -0
- package/dist/demo/filters/table.store.d.ts +9 -0
- package/dist/demo/filters/table.store.d.ts.map +1 -0
- package/dist/demo/filters/table.store.js +73 -0
- package/dist/demo/filters/table.store.js.map +1 -0
- package/dist/filters/async-select/async-select-filter.d.ts +19 -0
- package/dist/filters/async-select/async-select-filter.d.ts.map +1 -0
- package/dist/filters/async-select/async-select-filter.js +168 -0
- package/dist/filters/async-select/async-select-filter.js.map +1 -0
- package/dist/filters/async-select/async-select-filter.stories.d.ts +7 -0
- package/dist/filters/async-select/async-select-filter.stories.d.ts.map +1 -0
- package/dist/filters/async-select/async-select-filter.stories.js +7 -0
- package/dist/filters/async-select/async-select-filter.stories.js.map +1 -0
- package/dist/filters/index.d.ts +2 -0
- package/dist/filters/index.d.ts.map +1 -1
- package/dist/filters/index.js +2 -0
- package/dist/filters/index.js.map +1 -1
- package/dist/filters/single-select/single-select-filter.d.ts +9 -0
- package/dist/filters/single-select/single-select-filter.d.ts.map +1 -0
- package/dist/filters/single-select/single-select-filter.js +30 -0
- package/dist/filters/single-select/single-select-filter.js.map +1 -0
- package/dist/filters/single-select/single-select-filter.stories.d.ts +7 -0
- package/dist/filters/single-select/single-select-filter.stories.d.ts.map +1 -0
- package/dist/filters/single-select/single-select-filter.stories.js +7 -0
- package/dist/filters/single-select/single-select-filter.stories.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/table-state.d.ts +1 -1
- package/dist/table-state.d.ts.map +1 -1
- package/dist/use-observing-table-state/demo/components/use-observing-table-state-demo.d.ts +7 -0
- package/dist/use-observing-table-state/demo/components/use-observing-table-state-demo.d.ts.map +1 -0
- package/dist/use-observing-table-state/demo/components/use-observing-table-state-demo.js +15 -0
- package/dist/use-observing-table-state/demo/components/use-observing-table-state-demo.js.map +1 -0
- package/dist/use-observing-table-state/demo/stores/use-observing-table-state-demo.store.d.ts +15 -0
- package/dist/use-observing-table-state/demo/stores/use-observing-table-state-demo.store.d.ts.map +1 -0
- package/dist/use-observing-table-state/demo/stores/use-observing-table-state-demo.store.js +128 -0
- package/dist/use-observing-table-state/demo/stores/use-observing-table-state-demo.store.js.map +1 -0
- package/dist/use-observing-table-state/index.d.ts +2 -0
- package/dist/use-observing-table-state/index.d.ts.map +1 -0
- package/dist/use-observing-table-state/index.js +2 -0
- package/dist/use-observing-table-state/index.js.map +1 -0
- package/dist/use-observing-table-state/use-observing-table-state.d.ts +13 -0
- package/dist/use-observing-table-state/use-observing-table-state.d.ts.map +1 -0
- package/dist/use-observing-table-state/use-observing-table-state.js +44 -0
- package/dist/use-observing-table-state/use-observing-table-state.js.map +1 -0
- package/dist/use-observing-table-state/use-observing-table-state.stories.d.ts +10 -0
- package/dist/use-observing-table-state/use-observing-table-state.stories.d.ts.map +1 -0
- package/dist/use-observing-table-state/use-observing-table-state.stories.js +11 -0
- package/dist/use-observing-table-state/use-observing-table-state.stories.js.map +1 -0
- package/dist/utils/filters.d.ts +4 -0
- package/dist/utils/filters.d.ts.map +1 -0
- package/dist/utils/filters.js +22 -0
- package/dist/utils/filters.js.map +1 -0
- package/package.json +7 -6
- package/src/demo/filters/async-select-filter.tsx +53 -0
- package/src/demo/filters/categories.tsx +40 -0
- package/src/demo/filters/single-select-filter.tsx +51 -0
- package/src/demo/filters/table.store.ts +45 -0
- package/src/filters/async-select/async-select-filter.stories.tsx +7 -0
- package/src/filters/async-select/async-select-filter.tsx +249 -0
- package/src/filters/index.ts +2 -0
- package/src/filters/single-select/single-select-filter.stories.tsx +7 -0
- package/src/filters/single-select/single-select-filter.tsx +66 -0
- package/src/index.ts +2 -0
- package/src/table-state.ts +1 -1
- package/src/use-observing-table-state/demo/components/use-observing-table-state-demo.tsx +82 -0
- package/src/use-observing-table-state/demo/stores/use-observing-table-state-demo.store.ts +69 -0
- package/src/use-observing-table-state/index.ts +1 -0
- package/src/use-observing-table-state/use-observing-table-state.stories.tsx +20 -0
- package/src/use-observing-table-state/use-observing-table-state.ts +69 -0
- package/src/utils/__tests__/filters.test.ts +31 -0
- package/src/utils/filters.ts +33 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"async-select-filter.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/async-select-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAE,MAAM,OAAO,CAAC;AASpC,eAAO,MAAM,YAAY,EAAE,EA2C1B,CAAC"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useMemo } from 'react';
|
3
|
+
import { observer } from 'mobx-react';
|
4
|
+
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
5
|
+
import { Table, TableColumn, asyncSelectColumnMenuFilter } from '../..';
|
6
|
+
import { TableStore } from './table.store';
|
7
|
+
import { CategoryCell } from './categories';
|
8
|
+
export const TableExample = provide({
|
9
|
+
singletons: [TableStore],
|
10
|
+
})(observer(() => {
|
11
|
+
const [{ categoryFetcher, madeInFetcher, tableState }] = useDependencies(TableStore);
|
12
|
+
const madeInColumnMenu = useMemo(() => asyncSelectColumnMenuFilter({
|
13
|
+
dataFetcher: madeInFetcher,
|
14
|
+
placeholder: 'Search for made-ins',
|
15
|
+
}), [madeInFetcher]);
|
16
|
+
const categoryColumnMenu = useMemo(() => asyncSelectColumnMenuFilter({
|
17
|
+
dataFetcher: categoryFetcher,
|
18
|
+
placeholder: 'Search for Categories',
|
19
|
+
multiple: true,
|
20
|
+
}), [categoryFetcher]);
|
21
|
+
return (_jsxs(Table, Object.assign({ tableState: tableState, striped: false }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", width: "240px" }), _jsx(TableColumn, { field: "MadeIn", title: "Made In (async single-select filter)", columnMenu: madeInColumnMenu }), _jsx(TableColumn, { field: "CategoryID", title: "Category (async multi-select filter)", columnMenu: categoryColumnMenu, cell: CategoryCell })] })));
|
22
|
+
}));
|
23
|
+
//# sourceMappingURL=async-select-filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"async-select-filter.js","sourceRoot":"","sources":["../../../src/demo/filters/async-select-filter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAM,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,2BAA2B,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAO,OAAO,CAAC;IACpC,UAAU,EAAE,CAAC,UAAU,CAAC;CAC3B,CAAC,CACE,QAAQ,CAAC,GAAG,EAAE;IACV,MAAM,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAErF,MAAM,gBAAgB,GAAG,OAAO,CAC5B,GAAG,EAAE,CACD,2BAA2B,CAAC;QACxB,WAAW,EAAE,aAAa;QAC1B,WAAW,EAAE,qBAAqB;KACrC,CAAC,EACN,CAAC,aAAa,CAAC,CAClB,CAAC;IAEF,MAAM,kBAAkB,GAAG,OAAO,CAC9B,GAAG,EAAE,CACD,2BAA2B,CAAC;QACxB,WAAW,EAAE,eAAe;QAC5B,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,IAAI;KACjB,CAAC,EACN,CAAC,eAAe,CAAC,CACpB,CAAC;IAEF,OAAO,CACH,MAAC,KAAK,kBAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,iBACzC,KAAC,WAAW,IAAC,KAAK,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,OAAO,GAAG,EAC3E,KAAC,WAAW,IAAC,KAAK,EAAC,aAAa,EAAC,KAAK,EAAC,cAAc,EAAC,KAAK,EAAC,OAAO,GAAG,EACtE,KAAC,WAAW,IACR,KAAK,EAAC,QAAQ,EACd,KAAK,EAAC,sCAAsC,EAC5C,UAAU,EAAE,gBAAgB,GAC9B,EACF,KAAC,WAAW,IACR,KAAK,EAAC,YAAY,EAClB,KAAK,EAAC,sCAAsC,EAC5C,UAAU,EAAE,kBAAkB,EAC9B,IAAI,EAAE,YAAY,GACpB,KACE,CACX,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
import { TableCellProps } from '../../table';
|
3
|
+
export interface Category {
|
4
|
+
CategoryID: number;
|
5
|
+
CategoryName: string;
|
6
|
+
}
|
7
|
+
export declare const categories: Category[];
|
8
|
+
export declare const CategoryCell: FC<TableCellProps>;
|
9
|
+
//# sourceMappingURL=categories.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/categories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,QAAQ;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,UAAU,EAAE,QAAQ,EAyBhC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,cAAc,CAI3C,CAAC"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
export const categories = [
|
3
|
+
{
|
4
|
+
CategoryID: 1,
|
5
|
+
CategoryName: 'Wok',
|
6
|
+
},
|
7
|
+
{
|
8
|
+
CategoryID: 2,
|
9
|
+
CategoryName: 'Sushi',
|
10
|
+
},
|
11
|
+
{
|
12
|
+
CategoryID: 6,
|
13
|
+
CategoryName: 'Gunkan',
|
14
|
+
},
|
15
|
+
{
|
16
|
+
CategoryID: 7,
|
17
|
+
CategoryName: 'Miso',
|
18
|
+
},
|
19
|
+
{
|
20
|
+
CategoryID: 8,
|
21
|
+
CategoryName: 'Roll',
|
22
|
+
},
|
23
|
+
{
|
24
|
+
CategoryID: 10,
|
25
|
+
CategoryName: 'Sashimi',
|
26
|
+
},
|
27
|
+
];
|
28
|
+
export const CategoryCell = props => {
|
29
|
+
var _a;
|
30
|
+
const { field, dataItem } = props;
|
31
|
+
return _jsx("td", { children: (_a = categories.find(c => c.CategoryID === dataItem[field])) === null || _a === void 0 ? void 0 : _a.CategoryName });
|
32
|
+
};
|
33
|
+
//# sourceMappingURL=categories.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"categories.js","sourceRoot":"","sources":["../../../src/demo/filters/categories.tsx"],"names":[],"mappings":";AAQA,MAAM,CAAC,MAAM,UAAU,GAAe;IAClC;QACI,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,KAAK;KACtB;IACD;QACI,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,OAAO;KACxB;IACD;QACI,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,QAAQ;KACzB;IACD;QACI,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,MAAM;KACvB;IACD;QACI,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,MAAM;KACvB;IACD;QACI,UAAU,EAAE,EAAE;QACd,YAAY,EAAE,SAAS;KAC1B;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAuB,KAAK,CAAC,EAAE;;IACpD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAElC,OAAO,uBAAK,MAAA,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC,KAAM,CAAC,CAAC,0CAAE,YAAY,GAAM,CAAC;AAC5F,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"single-select-filter.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/single-select-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAE,MAAM,OAAO,CAAC;AAWpC,eAAO,MAAM,YAAY,EAAE,EAuC1B,CAAC"}
|
@@ -0,0 +1,20 @@
|
|
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 { Table, TableColumn, singleSelectColumnMenuFilter } from '../..';
|
6
|
+
import { TableStore } from './table.store';
|
7
|
+
import { categories, CategoryCell } from './categories';
|
8
|
+
export const TableExample = provide({
|
9
|
+
singletons: [TableStore],
|
10
|
+
})(observer(() => {
|
11
|
+
const [{ tableState, madeInOptions }] = useDependencies(TableStore);
|
12
|
+
const madeInColumnMenu = useMemo(() => singleSelectColumnMenuFilter({ options: madeInOptions }), [madeInOptions]);
|
13
|
+
const categoryColumnMenu = useMemo(() => singleSelectColumnMenuFilter({
|
14
|
+
options: categories,
|
15
|
+
renderItem: cat => cat.CategoryName,
|
16
|
+
valueSelector: cat => cat.CategoryID,
|
17
|
+
}), []);
|
18
|
+
return (_jsxs(Table, Object.assign({ tableState: tableState, striped: false }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", width: "240px" }), _jsx(TableColumn, { field: "MadeIn", title: "Made In (simple single-select filter)", columnMenu: madeInColumnMenu }), _jsx(TableColumn, { field: "CategoryID", title: "Category (simple single-select filter)", columnMenu: categoryColumnMenu, cell: CategoryCell })] })));
|
19
|
+
}));
|
20
|
+
//# sourceMappingURL=single-select-filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"single-select-filter.js","sourceRoot":"","sources":["../../../src/demo/filters/single-select-filter.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,KAAK,EAAE,WAAW,EAAE,4BAA4B,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,CAAC,MAAM,YAAY,GAAO,OAAO,CAAC;IACpC,UAAU,EAAE,CAAC,UAAU,CAAC;CAC3B,CAAC,CACE,QAAQ,CAAC,GAAG,EAAE;IACV,MAAM,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAEpE,MAAM,gBAAgB,GAAG,OAAO,CAC5B,GAAG,EAAE,CAAC,4BAA4B,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,EAC9D,CAAC,aAAa,CAAC,CAClB,CAAC;IAEF,MAAM,kBAAkB,GAAG,OAAO,CAC9B,GAAG,EAAE,CACD,4BAA4B,CAAC;QACzB,OAAO,EAAE,UAAU;QACnB,UAAU,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,YAAY;QACnC,aAAa,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU;KACvC,CAAC,EACN,EAAE,CACL,CAAC;IAEF,OAAO,CACH,MAAC,KAAK,kBAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,iBACzC,KAAC,WAAW,IAAC,KAAK,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,OAAO,GAAG,EAC3E,KAAC,WAAW,IAAC,KAAK,EAAC,aAAa,EAAC,KAAK,EAAC,cAAc,EAAC,KAAK,EAAC,OAAO,GAAG,EACtE,KAAC,WAAW,IACR,KAAK,EAAC,QAAQ,EACd,KAAK,EAAC,uCAAuC,EAC7C,UAAU,EAAE,gBAAgB,GAC9B,EACF,KAAC,WAAW,IACR,KAAK,EAAC,YAAY,EAClB,KAAK,EAAC,wCAAwC,EAC9C,UAAU,EAAE,kBAAkB,EAC9B,IAAI,EAAE,YAAY,GACpB,KACE,CACX,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { TableState, AsyncSelectFilterDataFetcher } from '../..';
|
2
|
+
export declare class TableStore {
|
3
|
+
tableState: TableState<import("../overview/product").Product, number, never, never>;
|
4
|
+
get madeInOptions(): string[];
|
5
|
+
categoryFetcher: AsyncSelectFilterDataFetcher<number>;
|
6
|
+
madeInFetcher: AsyncSelectFilterDataFetcher<string>;
|
7
|
+
private getDataSource;
|
8
|
+
}
|
9
|
+
//# sourceMappingURL=table.store.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"table.store.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/table.store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,UAAU,EAAE,4BAA4B,EAAE,MAAM,OAAO,CAAC;AAIrF,qBACa,UAAU;IACnB,UAAU,0EAGP;IAEH,IAAI,aAAa,aAEhB;IAED,eAAe,EAAE,4BAA4B,CAAC,MAAM,CAAC,CAUnD;IAEF,aAAa,EAAE,4BAA4B,CAAC,MAAM,CAAC,CAUjD;IAEF,OAAO,CAAC,aAAa;CAGxB"}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
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;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
14
|
+
});
|
15
|
+
};
|
16
|
+
import { injectable } from '@servicetitan/react-ioc';
|
17
|
+
import { InMemoryDataSource, TableState } from '../..';
|
18
|
+
import { products } from '../overview/products';
|
19
|
+
import { categories } from './categories';
|
20
|
+
let TableStore = class TableStore {
|
21
|
+
constructor() {
|
22
|
+
Object.defineProperty(this, "tableState", {
|
23
|
+
enumerable: true,
|
24
|
+
configurable: true,
|
25
|
+
writable: true,
|
26
|
+
value: new TableState({
|
27
|
+
dataSource: this.getDataSource(),
|
28
|
+
pageSize: 5,
|
29
|
+
})
|
30
|
+
});
|
31
|
+
Object.defineProperty(this, "categoryFetcher", {
|
32
|
+
enumerable: true,
|
33
|
+
configurable: true,
|
34
|
+
writable: true,
|
35
|
+
value: (opts) => __awaiter(this, void 0, void 0, function* () {
|
36
|
+
var _a;
|
37
|
+
yield new Promise(resolve => setTimeout(resolve, 1500));
|
38
|
+
const sv = (_a = opts.search) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase();
|
39
|
+
return {
|
40
|
+
data: categories
|
41
|
+
.filter(cat => (sv ? cat.CategoryName.toLowerCase().includes(sv) : true))
|
42
|
+
.map(cat => ({ value: cat.CategoryID, text: cat.CategoryName })),
|
43
|
+
};
|
44
|
+
})
|
45
|
+
});
|
46
|
+
Object.defineProperty(this, "madeInFetcher", {
|
47
|
+
enumerable: true,
|
48
|
+
configurable: true,
|
49
|
+
writable: true,
|
50
|
+
value: (opts) => __awaiter(this, void 0, void 0, function* () {
|
51
|
+
var _b;
|
52
|
+
yield new Promise(resolve => setTimeout(resolve, 1500));
|
53
|
+
const sv = (_b = opts.search) === null || _b === void 0 ? void 0 : _b.trim().toLowerCase();
|
54
|
+
return {
|
55
|
+
data: this.madeInOptions
|
56
|
+
.filter(opt => (sv ? opt.toLowerCase().includes(sv) : true))
|
57
|
+
.map(opt => ({ value: opt, text: opt })),
|
58
|
+
};
|
59
|
+
})
|
60
|
+
});
|
61
|
+
}
|
62
|
+
get madeInOptions() {
|
63
|
+
return Array.from(new Set(products.map(p => p.MadeIn)));
|
64
|
+
}
|
65
|
+
getDataSource() {
|
66
|
+
return new InMemoryDataSource(products, row => row.ProductID);
|
67
|
+
}
|
68
|
+
};
|
69
|
+
TableStore = __decorate([
|
70
|
+
injectable()
|
71
|
+
], TableStore);
|
72
|
+
export { TableStore };
|
73
|
+
//# sourceMappingURL=table.store.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"table.store.js","sourceRoot":"","sources":["../../../src/demo/filters/table.store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAgC,MAAM,OAAO,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,IAAa,UAAU,GAAvB,MAAa,UAAU;IAAvB;QACI;;;;mBAAa,IAAI,UAAU,CAAC;gBACxB,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;gBAChC,QAAQ,EAAE,CAAC;aACd,CAAC;WAAC;QAMH;;;;mBAAwD,CAAM,IAAI,EAAC,EAAE;;gBACjE,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;gBAExD,MAAM,EAAE,GAAG,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,GAAG,WAAW,EAAE,CAAC;gBAE7C,OAAO;oBACH,IAAI,EAAE,UAAU;yBACX,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;yBACxE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;iBACvE,CAAC;YACN,CAAC,CAAA;WAAC;QAEF;;;;mBAAsD,CAAM,IAAI,EAAC,EAAE;;gBAC/D,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;gBAExD,MAAM,EAAE,GAAG,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,GAAG,WAAW,EAAE,CAAC;gBAE7C,OAAO;oBACH,IAAI,EAAE,IAAI,CAAC,aAAa;yBACnB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;yBAC3D,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;iBAC/C,CAAC;YACN,CAAC,CAAA;WAAC;IAKN,CAAC;IA/BG,IAAI,aAAa;QACb,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC;IA0BO,aAAa;QACjB,OAAO,IAAI,kBAAkB,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;CACJ,CAAA;AArCY,UAAU;IADtB,UAAU,EAAE;GACA,UAAU,CAqCtB;SArCY,UAAU"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { IdType } from '@servicetitan/data-query';
|
3
|
+
export declare type AsyncSelectFilterDataFetcher<TV extends IdType = IdType, TO extends AsyncSelectItem<TV> = AsyncSelectItem<TV>> = (opts: {
|
4
|
+
search?: string;
|
5
|
+
}) => Promise<{
|
6
|
+
data: TO[];
|
7
|
+
}>;
|
8
|
+
export interface AsyncSelectItem<TV extends IdType = IdType> {
|
9
|
+
value: TV;
|
10
|
+
text: string;
|
11
|
+
}
|
12
|
+
export interface AsyncSelectFilterOptions<TID extends IdType, TO extends AsyncSelectItem<TID>> {
|
13
|
+
dataFetcher: AsyncSelectFilterDataFetcher<TID, TO>;
|
14
|
+
placeholder: string;
|
15
|
+
multiple?: boolean;
|
16
|
+
renderItem?: (item: TO) => ReactNode;
|
17
|
+
}
|
18
|
+
export declare function asyncSelectColumnMenuFilter<TID extends IdType, TO extends AsyncSelectItem<TID>>(options: AsyncSelectFilterOptions<TID, TO>): (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
19
|
+
//# sourceMappingURL=async-select-filter.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"async-select-filter.d.ts","sourceRoot":"","sources":["../../../src/filters/async-select/async-select-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAA+B,MAAM,OAAO,CAAC;AAU1F,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAMlD,oBAAY,4BAA4B,CACpC,EAAE,SAAS,MAAM,GAAG,MAAM,EAC1B,EAAE,SAAS,eAAe,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,EAAE,CAAC,IACpD,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC;IAAE,IAAI,EAAE,EAAE,EAAE,CAAA;CAAE,CAAC,CAAC;AAE3D,MAAM,WAAW,eAAe,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM;IACvD,KAAK,EAAE,EAAE,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CAChB;AAwJD,MAAM,WAAW,wBAAwB,CAAC,GAAG,SAAS,MAAM,EAAE,EAAE,SAAS,eAAe,CAAC,GAAG,CAAC;IACzF,WAAW,EAAE,4BAA4B,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,SAAS,CAAC;CACxC;AAMD,wBAAgB,2BAA2B,CAAC,GAAG,SAAS,MAAM,EAAE,EAAE,SAAS,eAAe,CAAC,GAAG,CAAC,EAC3F,OAAO,EAAE,wBAAwB,CAAC,GAAG,EAAE,EAAE,CAAC,sFA4D7C"}
|
@@ -0,0 +1,168 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
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;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
11
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
12
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
13
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
14
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
15
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
16
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
17
|
+
});
|
18
|
+
};
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
20
|
+
import { Component, Fragment } from 'react';
|
21
|
+
import { Checkbox, Radio, Input, Spinner, BodyText, } from '@servicetitan/design-system';
|
22
|
+
import { renderCustomColumnMenuFilter } from '../column-menu-filters';
|
23
|
+
import { makeObservable, observable, runInAction } from 'mobx';
|
24
|
+
import { observer } from 'mobx-react';
|
25
|
+
let SelectorAsync = class SelectorAsync extends Component {
|
26
|
+
constructor(props) {
|
27
|
+
super(props);
|
28
|
+
Object.defineProperty(this, "shownOptions", {
|
29
|
+
enumerable: true,
|
30
|
+
configurable: true,
|
31
|
+
writable: true,
|
32
|
+
value: []
|
33
|
+
});
|
34
|
+
Object.defineProperty(this, "search", {
|
35
|
+
enumerable: true,
|
36
|
+
configurable: true,
|
37
|
+
writable: true,
|
38
|
+
value: ''
|
39
|
+
});
|
40
|
+
Object.defineProperty(this, "error", {
|
41
|
+
enumerable: true,
|
42
|
+
configurable: true,
|
43
|
+
writable: true,
|
44
|
+
value: false
|
45
|
+
});
|
46
|
+
Object.defineProperty(this, "loading", {
|
47
|
+
enumerable: true,
|
48
|
+
configurable: true,
|
49
|
+
writable: true,
|
50
|
+
value: false
|
51
|
+
});
|
52
|
+
Object.defineProperty(this, "handleKeyDown", {
|
53
|
+
enumerable: true,
|
54
|
+
configurable: true,
|
55
|
+
writable: true,
|
56
|
+
value: (event) => {
|
57
|
+
if (event.key === 'Enter') {
|
58
|
+
event.stopPropagation();
|
59
|
+
}
|
60
|
+
}
|
61
|
+
});
|
62
|
+
Object.defineProperty(this, "handleSearch", {
|
63
|
+
enumerable: true,
|
64
|
+
configurable: true,
|
65
|
+
writable: true,
|
66
|
+
value: (_0, data) => {
|
67
|
+
runInAction(() => (this.search = data.value));
|
68
|
+
this.searchOptions().catch();
|
69
|
+
}
|
70
|
+
});
|
71
|
+
Object.defineProperty(this, "searchOptions", {
|
72
|
+
enumerable: true,
|
73
|
+
configurable: true,
|
74
|
+
writable: true,
|
75
|
+
value: () => __awaiter(this, void 0, void 0, function* () {
|
76
|
+
runInAction(() => {
|
77
|
+
this.loading = true;
|
78
|
+
});
|
79
|
+
try {
|
80
|
+
const { data } = yield this.props.dataFetcher({
|
81
|
+
search: this.search,
|
82
|
+
});
|
83
|
+
runInAction(() => {
|
84
|
+
this.shownOptions = data;
|
85
|
+
this.error = false;
|
86
|
+
this.loading = false;
|
87
|
+
});
|
88
|
+
}
|
89
|
+
catch (_a) {
|
90
|
+
runInAction(() => {
|
91
|
+
this.error = true;
|
92
|
+
this.loading = false;
|
93
|
+
});
|
94
|
+
}
|
95
|
+
})
|
96
|
+
});
|
97
|
+
makeObservable(this);
|
98
|
+
}
|
99
|
+
componentDidMount() {
|
100
|
+
this.searchOptions().catch();
|
101
|
+
}
|
102
|
+
render() {
|
103
|
+
const selectedOptions = this.props.selected;
|
104
|
+
const selected = new Set(selectedOptions.map(opt => opt.value));
|
105
|
+
const ItemComponent = this.props.itemComponent;
|
106
|
+
return (_jsxs(Fragment, { children: [_jsx(Input, { className: "m-x-half m-t-half m-b-2", placeholder: this.props.placeholder, onChange: this.handleSearch, onKeyDown: this.handleKeyDown, size: "xsmall", value: this.search }), _jsxs("div", Object.assign({ className: "p-x-half position-relative", onKeyDown: this.handleKeyDown }, { children: [!!selectedOptions.length && (_jsx("div", Object.assign({ className: "border-bottom m-y-half" }, { children: selectedOptions.map(option => (_jsx(ItemComponent, { option: option, checked: true, renderer: this.props.renderer, onChange: this.props.onChange }, option.value))) }))), this.error ? (_jsx(BodyText, Object.assign({ className: "c-red-500" }, { children: "Unable to load options" }))) : this.shownOptions.length ? (this.shownOptions
|
107
|
+
.filter(opt => !selected.has(opt.value))
|
108
|
+
.map(option => (_jsx(ItemComponent, { option: option, checked: false, renderer: this.props.renderer, onChange: this.props.onChange }, option.value)))) : this.loading ? (_jsx(BodyText, { children: "\u00A0" })) : (_jsx(BodyText, { children: "No options found" })), this.loading && (_jsx("div", Object.assign({ className: "position-absolute top-0 bottom-0 left-0 right-0 opacity-disabled bg-white d-f justify-content-center" }, { children: _jsx(Spinner, { size: "tiny" }) })))] }))] }));
|
109
|
+
}
|
110
|
+
};
|
111
|
+
__decorate([
|
112
|
+
observable,
|
113
|
+
__metadata("design:type", Array)
|
114
|
+
], SelectorAsync.prototype, "shownOptions", void 0);
|
115
|
+
__decorate([
|
116
|
+
observable,
|
117
|
+
__metadata("design:type", Object)
|
118
|
+
], SelectorAsync.prototype, "search", void 0);
|
119
|
+
__decorate([
|
120
|
+
observable,
|
121
|
+
__metadata("design:type", Object)
|
122
|
+
], SelectorAsync.prototype, "error", void 0);
|
123
|
+
__decorate([
|
124
|
+
observable,
|
125
|
+
__metadata("design:type", Object)
|
126
|
+
], SelectorAsync.prototype, "loading", void 0);
|
127
|
+
SelectorAsync = __decorate([
|
128
|
+
observer,
|
129
|
+
__metadata("design:paramtypes", [Object])
|
130
|
+
], SelectorAsync);
|
131
|
+
const SelectorItemSingle = ({ option, renderer, checked, onChange }) => {
|
132
|
+
var _a;
|
133
|
+
return (_jsx(Radio, { label: (_a = renderer === null || renderer === void 0 ? void 0 : renderer(option)) !== null && _a !== void 0 ? _a : option.text, checked: checked, onChange: (_, event) => onChange(option, true, event), className: "m-b-1" }));
|
134
|
+
};
|
135
|
+
const SelectorItemMultiple = ({ option, renderer, checked, onChange }) => {
|
136
|
+
var _a;
|
137
|
+
return (_jsx(Checkbox, { label: (_a = renderer === null || renderer === void 0 ? void 0 : renderer(option)) !== null && _a !== void 0 ? _a : option.text, checked: checked, onChange: (_, checked, event) => onChange(option, checked, event), className: "m-b-1" }));
|
138
|
+
};
|
139
|
+
export function asyncSelectColumnMenuFilter(options) {
|
140
|
+
const contains = (value, options) => options === null || options === void 0 ? void 0 : options.some(opt => opt.value === value);
|
141
|
+
const equals = (value, option) => (option === null || option === void 0 ? void 0 : option.value) === value;
|
142
|
+
const FilterCell = options.multiple
|
143
|
+
? ({ value, onChange }) => {
|
144
|
+
const handleChange = (option, checked, event) => {
|
145
|
+
const val = checked
|
146
|
+
? (value !== null && value !== void 0 ? value : []).concat(option)
|
147
|
+
: (value !== null && value !== void 0 ? value : []).filter(opt => opt.value !== option.value);
|
148
|
+
onChange({
|
149
|
+
value: val.length ? val : undefined,
|
150
|
+
operator: val.length ? contains : '',
|
151
|
+
syntheticEvent: event,
|
152
|
+
});
|
153
|
+
};
|
154
|
+
return (_jsx(SelectorAsync, { selected: value !== null && value !== void 0 ? value : [], itemComponent: SelectorItemMultiple, onChange: handleChange, placeholder: options.placeholder, renderer: options.renderItem, dataFetcher: options.dataFetcher }));
|
155
|
+
}
|
156
|
+
: ({ value, onChange }) => {
|
157
|
+
const handleChange = (option, checked, event) => {
|
158
|
+
onChange({
|
159
|
+
value: option,
|
160
|
+
operator: option ? equals : '',
|
161
|
+
syntheticEvent: event,
|
162
|
+
});
|
163
|
+
};
|
164
|
+
return (_jsx(SelectorAsync, { selected: value ? [value] : [], onChange: handleChange, itemComponent: SelectorItemSingle, placeholder: options.placeholder, renderer: options.renderItem, dataFetcher: options.dataFetcher }));
|
165
|
+
};
|
166
|
+
return renderCustomColumnMenuFilter(FilterCell);
|
167
|
+
}
|
168
|
+
//# sourceMappingURL=async-select-filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"async-select-filter.js","sourceRoot":"","sources":["../../../src/filters/async-select/async-select-filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAA6B,QAAQ,EAAqB,MAAM,OAAO,CAAC;AAE1F,OAAO,EACH,QAAQ,EAER,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,GACX,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAiCtC,IAAM,aAAa,GAAnB,MAAM,aAAmE,SA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QACN,CAAC,CAAC;IAER,OAAO,4BAA4B,CAAC,UAAU,CAAC,CAAC;AACpD,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"async-select-filter.stories.d.ts","sourceRoot":"","sources":["../../../src/filters/async-select/async-select-filter.stories.tsx"],"names":[],"mappings":";;;;AAEA,wBAEE;AAEF,eAAO,MAAM,WAAW,mBAAyB,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { TableExample } from '../../demo/filters/async-select-filter';
|
3
|
+
export default {
|
4
|
+
title: 'Table/Filters',
|
5
|
+
};
|
6
|
+
export const AsyncSelect = () => _jsx(TableExample, {});
|
7
|
+
//# sourceMappingURL=async-select-filter.stories.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"async-select-filter.stories.js","sourceRoot":"","sources":["../../../src/filters/async-select/async-select-filter.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,eAAe;IACX,KAAK,EAAE,eAAe;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,KAAC,YAAY,KAAG,CAAC"}
|
package/dist/filters/index.d.ts
CHANGED
@@ -6,4 +6,6 @@ export * from './column-menu-filters';
|
|
6
6
|
export * from './field-values-filter';
|
7
7
|
export * from './multiselect-filter';
|
8
8
|
export * from './numeric-filter-extended/numeric-filter-extended';
|
9
|
+
export * from './single-select/single-select-filter';
|
10
|
+
export * from './async-select/async-select-filter';
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qEAAqE,CAAC;AACpF,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mDAAmD,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qEAAqE,CAAC;AACpF,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mDAAmD,CAAC;AAClE,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC"}
|
package/dist/filters/index.js
CHANGED
@@ -6,4 +6,6 @@ export * from './column-menu-filters';
|
|
6
6
|
export * from './field-values-filter';
|
7
7
|
export * from './multiselect-filter';
|
8
8
|
export * from './numeric-filter-extended/numeric-filter-extended';
|
9
|
+
export * from './single-select/single-select-filter';
|
10
|
+
export * from './async-select/async-select-filter';
|
9
11
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qEAAqE,CAAC;AACpF,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mDAAmD,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qEAAqE,CAAC;AACpF,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mDAAmD,CAAC;AAClE,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
import { IdType } from '@servicetitan/data-query';
|
3
|
+
export interface SingleSelectColumnMenuOptions<TV, TO = TV> {
|
4
|
+
options: TO[];
|
5
|
+
valueSelector?: (item: TO) => TV;
|
6
|
+
renderItem?: (item: TO) => ReactNode | string;
|
7
|
+
}
|
8
|
+
export declare function singleSelectColumnMenuFilter<TV extends IdType, TO = TV>(props: SingleSelectColumnMenuOptions<TV, TO>): (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
9
|
+
//# sourceMappingURL=single-select-filter.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"single-select-filter.d.ts","sourceRoot":"","sources":["../../../src/filters/single-select/single-select-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAM,MAAM,OAAO,CAAC;AAKjE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AA8BlD,MAAM,WAAW,6BAA6B,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE;IACtD,OAAO,EAAE,EAAE,EAAE,CAAC;IACd,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,SAAS,GAAG,MAAM,CAAC;CACjD;AAED,wBAAgB,4BAA4B,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,EACnE,KAAK,EAAE,6BAA6B,CAAC,EAAE,EAAE,EAAE,CAAC,sFAuB/C"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { Component } from 'react';
|
3
|
+
import { Radio } from '@servicetitan/design-system';
|
4
|
+
import { renderCustomColumnMenuFilter } from '../column-menu-filters';
|
5
|
+
class SelectorRadio extends Component {
|
6
|
+
render() {
|
7
|
+
const { options, value, renderer } = this.props;
|
8
|
+
return options.map((option, index) => {
|
9
|
+
const optionValue = this.props.valueSelector(option);
|
10
|
+
return (
|
11
|
+
// eslint-disable-next-line react/no-array-index-key
|
12
|
+
_jsx("span", Object.assign({ className: "k-widget m-b-1-i d-b" }, { children: _jsx(Radio, { label: renderer ? renderer(option) : `${option}`, checked: value === optionValue, onChange: (_, event) => this.props.onChange(optionValue, event) }) }), index));
|
13
|
+
});
|
14
|
+
}
|
15
|
+
}
|
16
|
+
export function singleSelectColumnMenuFilter(props) {
|
17
|
+
const FilterCell = ({ value, onChange }) => {
|
18
|
+
var _a;
|
19
|
+
const handleChange = (value, event) => {
|
20
|
+
onChange({
|
21
|
+
value: value !== null && value !== void 0 ? value : '',
|
22
|
+
operator: value ? 'equals' : '',
|
23
|
+
syntheticEvent: event,
|
24
|
+
});
|
25
|
+
};
|
26
|
+
return (_jsx(SelectorRadio, { options: props.options, value: value === '' ? undefined : value, onChange: handleChange, renderer: props.renderItem, valueSelector: (_a = props.valueSelector) !== null && _a !== void 0 ? _a : (option => option) }));
|
27
|
+
};
|
28
|
+
return renderCustomColumnMenuFilter(FilterCell);
|
29
|
+
}
|
30
|
+
//# sourceMappingURL=single-select-filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"single-select-filter.js","sourceRoot":"","sources":["../../../src/filters/single-select/single-select-filter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAiC,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAwB,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAWtE,MAAM,aAAsB,SAAQ,SAAgC;IAChE,MAAM;QACF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CA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a,mCAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAC1D,CACL,CAAC;IACN,CAAC,CAAC;IAEF,OAAO,4BAA4B,CAAC,UAAU,CAAC,CAAC;AACpD,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"single-select-filter.stories.d.ts","sourceRoot":"","sources":["../../../src/filters/single-select/single-select-filter.stories.tsx"],"names":[],"mappings":";;;;AAEA,wBAEE;AAEF,eAAO,MAAM,YAAY,mBAAyB,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { TableExample } from '../../demo/filters/single-select-filter';
|
3
|
+
export default {
|
4
|
+
title: 'Table/Filters',
|
5
|
+
};
|
6
|
+
export const SingleSelect = () => _jsx(TableExample, {});
|
7
|
+
//# sourceMappingURL=single-select-filter.stories.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"single-select-filter.stories.js","sourceRoot":"","sources":["../../../src/filters/single-select/single-select-filter.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,eAAe;IACX,KAAK,EAAE,eAAe;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAC,YAAY,KAAG,CAAC"}
|
package/dist/index.d.ts
CHANGED
@@ -4,6 +4,8 @@ export * from './editable-cell';
|
|
4
4
|
export * from './filters';
|
5
5
|
export * from './export';
|
6
6
|
export * from './select-cell';
|
7
|
+
export * from './use-observing-table-state';
|
8
|
+
export * from './utils/filters';
|
7
9
|
export { TableColumn, TableColumnProps, TableColumnMenuProps, TableColumnMenuFilter, TableColumnReorderEvent, TableCell, TableHeaderCellProps, TableRowProps, TableRowClickEvent, TableDetailRow, TableDetailRowProps, TableExpandChangeEvent, TableToolbar, TableNoRecords, TableFilterCellProps, TableFilterChangeEvent, } from '@servicetitan/design-system';
|
8
10
|
export { GridColumnMenuFilterUIProps as TableColumnMenuFilterUIProps } from '@progress/kendo-react-grid/dist/npm/interfaces/GridColumnMenuFilterUIProps';
|
9
11
|
export { IdType, DataSource, InMemoryDataSource, AsyncDataSource } from '@servicetitan/data-query';
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,SAAS,EACT,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,sBAAsB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,2BAA2B,IAAI,4BAA4B,EAAE,MAAM,4EAA4E,CAAC;AAEzJ,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
@@ -4,6 +4,8 @@ export * from './editable-cell';
|
|
4
4
|
export * from './filters';
|
5
5
|
export * from './export';
|
6
6
|
export * from './select-cell';
|
7
|
+
export * from './use-observing-table-state';
|
8
|
+
export * from './utils/filters';
|
7
9
|
export { TableColumn, TableColumnMenuFilter, TableCell, TableDetailRow, TableToolbar, TableNoRecords, } from '@servicetitan/design-system';
|
8
10
|
export { InMemoryDataSource, AsyncDataSource } from '@servicetitan/data-query';
|
9
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EACH,WAAW,EAGX,qBAAqB,EAErB,SAAS,EAIT,cAAc,EAGd,YAAY,EACZ,cAAc,GAGjB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAsB,kBAAkB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/table-state.d.ts
CHANGED
@@ -32,7 +32,7 @@ export interface TableStateModel<TId extends IdType = never> {
|
|
32
32
|
aggregates: AggregateDescriptor[];
|
33
33
|
group: GroupDescriptor[];
|
34
34
|
}
|
35
|
-
interface TableStateConstructorParams<T, TId extends IdType = never, P = never, PId extends IdType = never> {
|
35
|
+
export interface TableStateConstructorParams<T, TId extends IdType = never, P = never, PId extends IdType = never> {
|
36
36
|
dataSource?: DataSource<T, TId> | null;
|
37
37
|
pageSize?: number;
|
38
38
|
/** For use with tables that enable selection only. Specifies if the item is selectable in the checkbox */
|