@servicetitan/table 24.2.0 → 24.3.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 +1 -1
- package/dist/demo/filters/async-select-filter.d.ts.map +1 -1
- package/dist/demo/filters/async-select-filter.js +4 -3
- package/dist/demo/filters/async-select-filter.js.map +1 -1
- package/dist/demo/filters/multiselect-filter.d.ts +1 -1
- package/dist/demo/filters/multiselect-filter.d.ts.map +1 -1
- package/dist/demo/filters/multiselect-filter.js +1 -1
- package/dist/demo/filters/multiselect-filter.js.map +1 -1
- package/dist/demo/filters/range-filter.d.ts +3 -3
- package/dist/demo/filters/range-filter.d.ts.map +1 -1
- package/dist/demo/filters/range-filter.js +8 -6
- package/dist/demo/filters/range-filter.js.map +1 -1
- package/dist/demo/filters/single-select-filter.d.ts +1 -1
- package/dist/demo/filters/single-select-filter.d.ts.map +1 -1
- package/dist/demo/filters/single-select-filter.js +5 -4
- package/dist/demo/filters/single-select-filter.js.map +1 -1
- package/dist/filters/async-select/async-select-filter.stories.d.ts.map +1 -1
- package/dist/filters/async-select/async-select-filter.stories.js +3 -3
- package/dist/filters/async-select/async-select-filter.stories.js.map +1 -1
- package/dist/filters/multiselect-filter/multiselect-filter.stories.d.ts.map +1 -1
- package/dist/filters/multiselect-filter/multiselect-filter.stories.js +2 -2
- package/dist/filters/multiselect-filter/multiselect-filter.stories.js.map +1 -1
- package/dist/filters/range-filter/range-filter.stories.d.ts.map +1 -1
- package/dist/filters/range-filter/range-filter.stories.js +4 -4
- package/dist/filters/range-filter/range-filter.stories.js.map +1 -1
- package/dist/filters/single-select/single-select-filter.stories.d.ts.map +1 -1
- package/dist/filters/single-select/single-select-filter.stories.js +3 -3
- package/dist/filters/single-select/single-select-filter.stories.js.map +1 -1
- package/package.json +6 -6
- package/src/demo/filters/async-select-filter.tsx +27 -17
- package/src/demo/filters/multiselect-filter.tsx +1 -1
- package/src/demo/filters/range-filter.tsx +47 -31
- package/src/demo/filters/single-select-filter.tsx +31 -18
- package/src/filters/async-select/async-select-filter.stories.tsx +3 -3
- package/src/filters/multiselect-filter/multiselect-filter.stories.tsx +2 -2
- package/src/filters/range-filter/range-filter.stories.tsx +6 -6
- package/src/filters/single-select/single-select-filter.stories.tsx +3 -3
@@ -1 +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,
|
1
|
+
{"version":3,"file":"async-select-filter.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/async-select-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAY,MAAM,OAAO,CAAC;AAU9C,eAAO,MAAM,yBAAyB,EAAE,EAoDvC,CAAC"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { useMemo } from 'react';
|
2
|
+
import { useMemo, Fragment } from 'react';
|
3
3
|
import { observer } from 'mobx-react';
|
4
4
|
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
5
5
|
import { Table, TableColumn, asyncSelectColumnMenuFilter } from '../..';
|
6
6
|
import { TableStore } from './table.store';
|
7
7
|
import { CategoryCell } from './categories';
|
8
|
-
|
8
|
+
import { Banner } from '@servicetitan/design-system';
|
9
|
+
export const AsyncSelectDefaultExample = provide({
|
9
10
|
singletons: [TableStore],
|
10
11
|
})(observer(() => {
|
11
12
|
const [{ categoryFetcher, madeInFetcher, tableState }] = useDependencies(TableStore);
|
@@ -18,6 +19,6 @@ export const TableExample = provide({
|
|
18
19
|
placeholder: 'Search for Categories',
|
19
20
|
multiple: true,
|
20
21
|
}), [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
|
+
return (_jsxs(Fragment, { children: [_jsxs(Banner, Object.assign({ title: "Default filter with async select", className: "m-b-2" }, { children: ["Async select filter allows to choose one or several option from the list that will be fetched from BE. The list size is not limited, so you can also use search to find desired option.", _jsx("br", {}), "Use it when there can be greater than 20 possible options"] })), _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
|
}));
|
23
24
|
//# sourceMappingURL=async-select-filter.js.map
|
@@ -1 +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;
|
1
|
+
{"version":3,"file":"async-select-filter.js","sourceRoot":"","sources":["../../../src/demo/filters/async-select-filter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,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;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,MAAM,CAAC,MAAM,yBAAyB,GAAO,OAAO,CAAC;IACjD,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,QAAQ,eACL,MAAC,MAAM,kBAAC,KAAK,EAAC,kCAAkC,EAAC,SAAS,EAAC,OAAO,4MAI9D,cAAM,kEAED,EACT,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,IACD,CACd,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"multiselect-filter.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/multiselect-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAE,MAAM,OAAO,CAAC;AAUpC,eAAO,MAAM,
|
1
|
+
{"version":3,"file":"multiselect-filter.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/multiselect-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAE,MAAM,OAAO,CAAC;AAUpC,eAAO,MAAM,yBAAyB,EAAE,EAqBvC,CAAC"}
|
@@ -4,7 +4,7 @@ import { provide, useDependencies } from '@servicetitan/react-ioc';
|
|
4
4
|
import { observer } from 'mobx-react';
|
5
5
|
import { Table, TableColumn, multiSelectColumnMenuFilter } from '../..';
|
6
6
|
import { TableStore } from './table.store';
|
7
|
-
export const
|
7
|
+
export const MultiSelectDefaultExample = provide({
|
8
8
|
singletons: [TableStore],
|
9
9
|
})(observer(() => {
|
10
10
|
const [{ tableState, madeInOptions }] = useDependencies(TableStore);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"multiselect-filter.js","sourceRoot":"","sources":["../../../src/demo/filters/multiselect-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,2BAA2B,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,MAAM,
|
1
|
+
{"version":3,"file":"multiselect-filter.js","sourceRoot":"","sources":["../../../src/demo/filters/multiselect-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,2BAA2B,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,MAAM,yBAAyB,GAAO,OAAO,CAAC;IACjD,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,2BAA2B,CAAC,aAAa,CAAC,EAChD,CAAC,aAAa,CAAC,CAClB,CAAC;IAEF,OAAO,CACH,MAAC,KAAK,kBAAC,UAAU,EAAE,UAAU,iBACzB,KAAC,WAAW,IAAC,KAAK,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAC,OAAO,GAAG,EAE3E,KAAC,WAAW,IAAC,KAAK,EAAC,aAAa,EAAC,KAAK,EAAC,cAAc,EAAC,KAAK,EAAC,OAAO,GAAG,EAEtE,KAAC,WAAW,IAAC,KAAK,EAAC,QAAQ,EAAC,KAAK,EAAC,SAAS,EAAC,UAAU,EAAE,gBAAgB,GAAI,KACxE,CACX,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { FC } from 'react';
|
2
|
-
export declare const
|
3
|
-
export declare const
|
4
|
-
export declare const
|
2
|
+
export declare const RangeSelectDateExample: FC;
|
3
|
+
export declare const RangeSelectNumberExample: FC;
|
4
|
+
export declare const RangeSelectCurrencyExample: FC;
|
5
5
|
//# sourceMappingURL=range-filter.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"range-filter.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/range-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,
|
1
|
+
{"version":3,"file":"range-filter.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/range-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAcrC,eAAO,MAAM,sBAAsB,EAAE,EAuBpC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,EAuBtC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,EAuBxC,CAAC"}
|
@@ -1,24 +1,26 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Fragment } from 'react';
|
2
3
|
import { observer } from 'mobx-react';
|
3
4
|
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
4
5
|
import { Table, TableColumn, DateRangeColumnMenuFilter, NumericRangeColumnMenuFilter, CurrencyRangeColumnMenuFilter, } from '../..';
|
5
6
|
import { TableStore } from './table.store';
|
6
|
-
|
7
|
+
import { Banner } from '@servicetitan/design-system';
|
8
|
+
export const RangeSelectDateExample = provide({
|
7
9
|
singletons: [TableStore],
|
8
10
|
})(observer(() => {
|
9
11
|
const [{ tableState }] = useDependencies(TableStore);
|
10
|
-
return (_jsxs(Table, Object.assign({ tableState: tableState }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", width: "240px" }), _jsx(TableColumn, { field: "UnitsOnOrder", title: "Units On Order", columnMenu: DateRangeColumnMenuFilter })] })));
|
12
|
+
return (_jsxs(Fragment, { children: [_jsx(Banner, Object.assign({ title: "Date range filter", className: "m-b-2" }, { children: "Allows to choose date range" })), _jsxs(Table, Object.assign({ tableState: tableState }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", width: "240px" }), _jsx(TableColumn, { field: "UnitsOnOrder", title: "Units On Order", columnMenu: DateRangeColumnMenuFilter })] }))] }));
|
11
13
|
}));
|
12
|
-
export const
|
14
|
+
export const RangeSelectNumberExample = provide({
|
13
15
|
singletons: [TableStore],
|
14
16
|
})(observer(() => {
|
15
17
|
const [{ tableState }] = useDependencies(TableStore);
|
16
|
-
return (_jsxs(Table, Object.assign({ tableState: tableState }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", width: "240px" }), _jsx(TableColumn, { field: "UnitsInStock", title: "Units In Stock", columnMenu: NumericRangeColumnMenuFilter })] })));
|
18
|
+
return (_jsxs(Fragment, { children: [_jsx(Banner, Object.assign({ title: "Numeric range filter", className: "m-b-2" }, { children: "Allows to choose numeric range" })), _jsxs(Table, Object.assign({ tableState: tableState }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", width: "240px" }), _jsx(TableColumn, { field: "UnitsInStock", title: "Units In Stock", columnMenu: NumericRangeColumnMenuFilter })] }))] }));
|
17
19
|
}));
|
18
|
-
export const
|
20
|
+
export const RangeSelectCurrencyExample = provide({
|
19
21
|
singletons: [TableStore],
|
20
22
|
})(observer(() => {
|
21
23
|
const [{ tableState }] = useDependencies(TableStore);
|
22
|
-
return (_jsxs(Table, Object.assign({ tableState: tableState }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", width: "240px" }), _jsx(TableColumn, { field: "UnitPrice", title: "Unit Price", columnMenu: CurrencyRangeColumnMenuFilter })] })));
|
24
|
+
return (_jsxs(Fragment, { children: [_jsx(Banner, Object.assign({ title: "Currency range filter", className: "m-b-2" }, { children: "Allows to choose currency range" })), _jsxs(Table, Object.assign({ tableState: tableState }, { children: [_jsx(TableColumn, { field: "ProductID", title: "ID", editable: false, width: "100px" }), _jsx(TableColumn, { field: "ProductName", title: "Product Name", width: "240px" }), _jsx(TableColumn, { field: "UnitPrice", title: "Unit Price", columnMenu: CurrencyRangeColumnMenuFilter })] }))] }));
|
23
25
|
}));
|
24
26
|
//# sourceMappingURL=range-filter.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"range-filter.js","sourceRoot":"","sources":["../../../src/demo/filters/range-filter.tsx"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"range-filter.js","sourceRoot":"","sources":["../../../src/demo/filters/range-filter.tsx"],"names":[],"mappings":"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"}
|
@@ -1 +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,
|
1
|
+
{"version":3,"file":"single-select-filter.d.ts","sourceRoot":"","sources":["../../../src/demo/filters/single-select-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,EAAE,EAAY,MAAM,OAAO,CAAC;AAY9C,eAAO,MAAM,0BAA0B,EAAE,EAmDxC,CAAC"}
|
@@ -1,20 +1,21 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { useMemo } from 'react';
|
2
|
+
import { useMemo, Fragment } from 'react';
|
3
3
|
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
4
4
|
import { observer } from 'mobx-react';
|
5
5
|
import { Table, TableColumn, singleSelectColumnMenuFilter } from '../..';
|
6
6
|
import { TableStore } from './table.store';
|
7
7
|
import { categories, CategoryCell } from './categories';
|
8
|
-
|
8
|
+
import { Banner, BodyText } from '@servicetitan/design-system';
|
9
|
+
export const SingleSelectDefaultExample = provide({
|
9
10
|
singletons: [TableStore],
|
10
11
|
})(observer(() => {
|
11
12
|
const [{ tableState, madeInOptions }] = useDependencies(TableStore);
|
12
13
|
const madeInColumnMenu = useMemo(() => singleSelectColumnMenuFilter({ options: madeInOptions }), [madeInOptions]);
|
13
14
|
const categoryColumnMenu = useMemo(() => singleSelectColumnMenuFilter({
|
14
15
|
options: categories,
|
15
|
-
renderItem: cat => cat.CategoryName,
|
16
|
+
renderItem: cat => (_jsxs(BodyText, { children: [_jsx("span", Object.assign({ className: "fw-bold" }, { children: "cat.CategoryName" })), " (#", cat.CategoryID, ")"] })),
|
16
17
|
valueSelector: cat => cat.CategoryID,
|
17
18
|
}), []);
|
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
|
+
return (_jsxs(Fragment, { children: [_jsxs(Banner, Object.assign({ title: "Default filter with single select", className: "m-b-2" }, { children: ["Single select filter allows to choose one option from the provided list. You can pass simple options (string or number) or complex objects", _jsx("br", {}), "Use it when options list is fixed and less than 20 items"] })), _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
|
}));
|
20
21
|
//# sourceMappingURL=single-select-filter.js.map
|
@@ -1 +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;
|
1
|
+
{"version":3,"file":"single-select-filter.js","sourceRoot":"","sources":["../../../src/demo/filters/single-select-filter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,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;AACxD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,MAAM,0BAA0B,GAAO,OAAO,CAAC;IAClD,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,CACf,MAAC,QAAQ,eACL,6BAAM,SAAS,EAAC,SAAS,sCAAwB,SAAI,GAAG,CAAC,UAAU,SAC5D,CACd;QACD,aAAa,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU;KACvC,CAAC,EACN,EAAE,CACL,CAAC;IAEF,OAAO,CACH,MAAC,QAAQ,eACL,MAAC,MAAM,kBAAC,KAAK,EAAC,mCAAmC,EAAC,SAAS,EAAC,OAAO,+JAG/D,cAAM,iEAED,EACT,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,IACD,CACd,CAAC;AACN,CAAC,CAAC,CACL,CAAC"}
|
@@ -1 +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,
|
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,mBAAsC,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { AsyncSelectDefaultExample } from '../../demo/filters/async-select-filter';
|
3
3
|
export default {
|
4
|
-
title: 'Table/Filters',
|
4
|
+
title: 'Table/Filters/AsyncSelect',
|
5
5
|
};
|
6
|
-
export const AsyncSelect = () => _jsx(
|
6
|
+
export const AsyncSelect = () => _jsx(AsyncSelectDefaultExample, {});
|
7
7
|
//# sourceMappingURL=async-select-filter.stories.js.map
|
@@ -1 +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,
|
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,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,eAAe;IACX,KAAK,EAAE,2BAA2B;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,KAAC,yBAAyB,KAAG,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"multiselect-filter.stories.d.ts","sourceRoot":"","sources":["../../../src/filters/multiselect-filter/multiselect-filter.stories.tsx"],"names":[],"mappings":";;;;AAEA,wBAEE;AAEF,eAAO,MAAM,kBAAkB,
|
1
|
+
{"version":3,"file":"multiselect-filter.stories.d.ts","sourceRoot":"","sources":["../../../src/filters/multiselect-filter/multiselect-filter.stories.tsx"],"names":[],"mappings":";;;;AAEA,wBAEE;AAEF,eAAO,MAAM,kBAAkB,mBAAsC,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { MultiSelectDefaultExample } from '../../demo/filters/multiselect-filter';
|
3
3
|
export default {
|
4
4
|
title: 'Table/Filters/MultiSelect',
|
5
5
|
};
|
6
|
-
export const DefaultMultiSelect = () => _jsx(
|
6
|
+
export const DefaultMultiSelect = () => _jsx(MultiSelectDefaultExample, {});
|
7
7
|
//# sourceMappingURL=multiselect-filter.stories.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"multiselect-filter.stories.js","sourceRoot":"","sources":["../../../src/filters/multiselect-filter/multiselect-filter.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"multiselect-filter.stories.js","sourceRoot":"","sources":["../../../src/filters/multiselect-filter/multiselect-filter.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAElF,eAAe;IACX,KAAK,EAAE,2BAA2B;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,KAAC,yBAAyB,KAAG,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"range-filter.stories.d.ts","sourceRoot":"","sources":["../../../src/filters/range-filter/range-filter.stories.tsx"],"names":[],"mappings":";;;;AAMA,wBAEE;AAEF,eAAO,MAAM,SAAS,
|
1
|
+
{"version":3,"file":"range-filter.stories.d.ts","sourceRoot":"","sources":["../../../src/filters/range-filter/range-filter.stories.tsx"],"names":[],"mappings":";;;;AAMA,wBAEE;AAEF,eAAO,MAAM,SAAS,mBAAmC,CAAC;AAC1D,eAAO,MAAM,YAAY,mBAAqC,CAAC;AAC/D,eAAO,MAAM,aAAa,mBAAuC,CAAC"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { RangeSelectCurrencyExample, RangeSelectDateExample, RangeSelectNumberExample, } from '../../demo/filters/range-filter';
|
3
3
|
export default {
|
4
4
|
title: 'Table/Filters/Range',
|
5
5
|
};
|
6
|
-
export const DateRange = () => _jsx(
|
7
|
-
export const NumericRange = () => _jsx(
|
8
|
-
export const CurrencyRange = () => _jsx(
|
6
|
+
export const DateRange = () => _jsx(RangeSelectDateExample, {});
|
7
|
+
export const NumericRange = () => _jsx(RangeSelectNumberExample, {});
|
8
|
+
export const CurrencyRange = () => _jsx(RangeSelectCurrencyExample, {});
|
9
9
|
//# sourceMappingURL=range-filter.stories.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"range-filter.stories.js","sourceRoot":"","sources":["../../../src/filters/range-filter/range-filter.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EACH,
|
1
|
+
{"version":3,"file":"range-filter.stories.js","sourceRoot":"","sources":["../../../src/filters/range-filter/range-filter.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EACH,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,GAC3B,MAAM,iCAAiC,CAAC;AAEzC,eAAe;IACX,KAAK,EAAE,qBAAqB;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,KAAC,sBAAsB,KAAG,CAAC;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAC,wBAAwB,KAAG,CAAC;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,KAAC,0BAA0B,KAAG,CAAC"}
|
@@ -1 +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,
|
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,mBAAuC,CAAC"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { SingleSelectDefaultExample } from '../../demo/filters/single-select-filter';
|
3
3
|
export default {
|
4
|
-
title: 'Table/Filters',
|
4
|
+
title: 'Table/Filters/SingleSelect',
|
5
5
|
};
|
6
|
-
export const SingleSelect = () => _jsx(
|
6
|
+
export const SingleSelect = () => _jsx(SingleSelectDefaultExample, {});
|
7
7
|
//# sourceMappingURL=single-select-filter.stories.js.map
|
@@ -1 +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,
|
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,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,eAAe;IACX,KAAK,EAAE,4BAA4B;CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAC,0BAA0B,KAAG,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@servicetitan/table",
|
3
|
-
"version": "24.
|
3
|
+
"version": "24.3.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": "^24.
|
40
|
+
"@servicetitan/data-query": "^24.3.0",
|
41
41
|
"@servicetitan/design-system": ">=12.4.1",
|
42
|
-
"@servicetitan/form": "^24.
|
42
|
+
"@servicetitan/form": "^24.3.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": "^24.
|
56
|
+
"@servicetitan/data-query": "^24.3.0",
|
57
57
|
"@servicetitan/design-system": ">=12.4.1",
|
58
|
-
"@servicetitan/form": "^24.
|
58
|
+
"@servicetitan/form": "^24.3.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": "
|
75
|
+
"gitHead": "561a1b732af3c94e3ae57fb92e90e99396b30c15"
|
76
76
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useMemo, FC } from 'react';
|
1
|
+
import { useMemo, FC, Fragment } from 'react';
|
2
2
|
import { observer } from 'mobx-react';
|
3
3
|
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
4
4
|
|
@@ -6,8 +6,9 @@ import { Table, TableColumn, asyncSelectColumnMenuFilter } from '../..';
|
|
6
6
|
|
7
7
|
import { TableStore } from './table.store';
|
8
8
|
import { CategoryCell } from './categories';
|
9
|
+
import { Banner } from '@servicetitan/design-system';
|
9
10
|
|
10
|
-
export const
|
11
|
+
export const AsyncSelectDefaultExample: FC = provide({
|
11
12
|
singletons: [TableStore],
|
12
13
|
})(
|
13
14
|
observer(() => {
|
@@ -33,21 +34,30 @@ export const TableExample: FC = provide({
|
|
33
34
|
);
|
34
35
|
|
35
36
|
return (
|
36
|
-
<
|
37
|
-
<
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
<
|
45
|
-
field="
|
46
|
-
title="
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
37
|
+
<Fragment>
|
38
|
+
<Banner title="Default filter with async select" className="m-b-2">
|
39
|
+
Async select filter allows to choose one or several option from the list that
|
40
|
+
will be fetched from BE. The list size is not limited, so you can also use
|
41
|
+
search to find desired option.
|
42
|
+
<br />
|
43
|
+
Use it when there can be greater than 20 possible options
|
44
|
+
</Banner>
|
45
|
+
<Table tableState={tableState} striped={false}>
|
46
|
+
<TableColumn field="ProductID" title="ID" editable={false} width="100px" />
|
47
|
+
<TableColumn field="ProductName" title="Product Name" width="240px" />
|
48
|
+
<TableColumn
|
49
|
+
field="MadeIn"
|
50
|
+
title="Made In (async single-select filter)"
|
51
|
+
columnMenu={madeInColumnMenu}
|
52
|
+
/>
|
53
|
+
<TableColumn
|
54
|
+
field="CategoryID"
|
55
|
+
title="Category (async multi-select filter)"
|
56
|
+
columnMenu={categoryColumnMenu}
|
57
|
+
cell={CategoryCell}
|
58
|
+
/>
|
59
|
+
</Table>
|
60
|
+
</Fragment>
|
51
61
|
);
|
52
62
|
})
|
53
63
|
);
|
@@ -8,7 +8,7 @@ import { Table, TableColumn, multiSelectColumnMenuFilter } from '../..';
|
|
8
8
|
|
9
9
|
import { TableStore } from './table.store';
|
10
10
|
|
11
|
-
export const
|
11
|
+
export const MultiSelectDefaultExample: FC = provide({
|
12
12
|
singletons: [TableStore],
|
13
13
|
})(
|
14
14
|
observer(() => {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { FC } from 'react';
|
1
|
+
import { FC, Fragment } from 'react';
|
2
2
|
import { observer } from 'mobx-react';
|
3
3
|
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
4
4
|
|
@@ -10,63 +10,79 @@ import {
|
|
10
10
|
CurrencyRangeColumnMenuFilter,
|
11
11
|
} from '../..';
|
12
12
|
import { TableStore } from './table.store';
|
13
|
+
import { Banner } from '@servicetitan/design-system';
|
13
14
|
|
14
|
-
export const
|
15
|
+
export const RangeSelectDateExample: FC = provide({
|
15
16
|
singletons: [TableStore],
|
16
17
|
})(
|
17
18
|
observer(() => {
|
18
19
|
const [{ tableState }] = useDependencies(TableStore);
|
19
20
|
|
20
21
|
return (
|
21
|
-
<
|
22
|
-
<
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
title="
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
<Fragment>
|
23
|
+
<Banner title="Date range filter" className="m-b-2">
|
24
|
+
Allows to choose date range
|
25
|
+
</Banner>
|
26
|
+
<Table tableState={tableState}>
|
27
|
+
<TableColumn field="ProductID" title="ID" editable={false} width="100px" />
|
28
|
+
<TableColumn field="ProductName" title="Product Name" width="240px" />
|
29
|
+
<TableColumn
|
30
|
+
field="UnitsOnOrder"
|
31
|
+
title="Units On Order"
|
32
|
+
columnMenu={DateRangeColumnMenuFilter}
|
33
|
+
/>
|
34
|
+
</Table>
|
35
|
+
</Fragment>
|
30
36
|
);
|
31
37
|
})
|
32
38
|
);
|
33
39
|
|
34
|
-
export const
|
40
|
+
export const RangeSelectNumberExample: FC = provide({
|
35
41
|
singletons: [TableStore],
|
36
42
|
})(
|
37
43
|
observer(() => {
|
38
44
|
const [{ tableState }] = useDependencies(TableStore);
|
39
45
|
|
40
46
|
return (
|
41
|
-
<
|
42
|
-
<
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
title="
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
<Fragment>
|
48
|
+
<Banner title="Numeric range filter" className="m-b-2">
|
49
|
+
Allows to choose numeric range
|
50
|
+
</Banner>
|
51
|
+
<Table tableState={tableState}>
|
52
|
+
<TableColumn field="ProductID" title="ID" editable={false} width="100px" />
|
53
|
+
<TableColumn field="ProductName" title="Product Name" width="240px" />
|
54
|
+
<TableColumn
|
55
|
+
field="UnitsInStock"
|
56
|
+
title="Units In Stock"
|
57
|
+
columnMenu={NumericRangeColumnMenuFilter}
|
58
|
+
/>
|
59
|
+
</Table>
|
60
|
+
</Fragment>
|
50
61
|
);
|
51
62
|
})
|
52
63
|
);
|
53
64
|
|
54
|
-
export const
|
65
|
+
export const RangeSelectCurrencyExample: FC = provide({
|
55
66
|
singletons: [TableStore],
|
56
67
|
})(
|
57
68
|
observer(() => {
|
58
69
|
const [{ tableState }] = useDependencies(TableStore);
|
59
70
|
|
60
71
|
return (
|
61
|
-
<
|
62
|
-
<
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
title="
|
67
|
-
|
68
|
-
|
69
|
-
|
72
|
+
<Fragment>
|
73
|
+
<Banner title="Currency range filter" className="m-b-2">
|
74
|
+
Allows to choose currency range
|
75
|
+
</Banner>
|
76
|
+
<Table tableState={tableState}>
|
77
|
+
<TableColumn field="ProductID" title="ID" editable={false} width="100px" />
|
78
|
+
<TableColumn field="ProductName" title="Product Name" width="240px" />
|
79
|
+
<TableColumn
|
80
|
+
field="UnitPrice"
|
81
|
+
title="Unit Price"
|
82
|
+
columnMenu={CurrencyRangeColumnMenuFilter}
|
83
|
+
/>
|
84
|
+
</Table>
|
85
|
+
</Fragment>
|
70
86
|
);
|
71
87
|
})
|
72
88
|
);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useMemo, FC } from 'react';
|
1
|
+
import { useMemo, FC, Fragment } from 'react';
|
2
2
|
|
3
3
|
import { provide, useDependencies } from '@servicetitan/react-ioc';
|
4
4
|
|
@@ -8,8 +8,9 @@ import { Table, TableColumn, singleSelectColumnMenuFilter } from '../..';
|
|
8
8
|
|
9
9
|
import { TableStore } from './table.store';
|
10
10
|
import { categories, CategoryCell } from './categories';
|
11
|
+
import { Banner, BodyText } from '@servicetitan/design-system';
|
11
12
|
|
12
|
-
export const
|
13
|
+
export const SingleSelectDefaultExample: FC = provide({
|
13
14
|
singletons: [TableStore],
|
14
15
|
})(
|
15
16
|
observer(() => {
|
@@ -24,28 +25,40 @@ export const TableExample: FC = provide({
|
|
24
25
|
() =>
|
25
26
|
singleSelectColumnMenuFilter({
|
26
27
|
options: categories,
|
27
|
-
renderItem: cat =>
|
28
|
+
renderItem: cat => (
|
29
|
+
<BodyText>
|
30
|
+
<span className="fw-bold">cat.CategoryName</span> (#{cat.CategoryID})
|
31
|
+
</BodyText>
|
32
|
+
),
|
28
33
|
valueSelector: cat => cat.CategoryID,
|
29
34
|
}),
|
30
35
|
[]
|
31
36
|
);
|
32
37
|
|
33
38
|
return (
|
34
|
-
<
|
35
|
-
<
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
field="
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
39
|
+
<Fragment>
|
40
|
+
<Banner title="Default filter with single select" className="m-b-2">
|
41
|
+
Single select filter allows to choose one option from the provided list. You can
|
42
|
+
pass simple options (string or number) or complex objects
|
43
|
+
<br />
|
44
|
+
Use it when options list is fixed and less than 20 items
|
45
|
+
</Banner>
|
46
|
+
<Table tableState={tableState} striped={false}>
|
47
|
+
<TableColumn field="ProductID" title="ID" editable={false} width="100px" />
|
48
|
+
<TableColumn field="ProductName" title="Product Name" width="240px" />
|
49
|
+
<TableColumn
|
50
|
+
field="MadeIn"
|
51
|
+
title="Made In (simple single-select filter)"
|
52
|
+
columnMenu={madeInColumnMenu}
|
53
|
+
/>
|
54
|
+
<TableColumn
|
55
|
+
field="CategoryID"
|
56
|
+
title="Category (simple single-select filter)"
|
57
|
+
columnMenu={categoryColumnMenu}
|
58
|
+
cell={CategoryCell}
|
59
|
+
/>
|
60
|
+
</Table>
|
61
|
+
</Fragment>
|
49
62
|
);
|
50
63
|
})
|
51
64
|
);
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { AsyncSelectDefaultExample } from '../../demo/filters/async-select-filter';
|
2
2
|
|
3
3
|
export default {
|
4
|
-
title: 'Table/Filters',
|
4
|
+
title: 'Table/Filters/AsyncSelect',
|
5
5
|
};
|
6
6
|
|
7
|
-
export const AsyncSelect = () => <
|
7
|
+
export const AsyncSelect = () => <AsyncSelectDefaultExample />;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { MultiSelectDefaultExample } from '../../demo/filters/multiselect-filter';
|
2
2
|
|
3
3
|
export default {
|
4
4
|
title: 'Table/Filters/MultiSelect',
|
5
5
|
};
|
6
6
|
|
7
|
-
export const DefaultMultiSelect = () => <
|
7
|
+
export const DefaultMultiSelect = () => <MultiSelectDefaultExample />;
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
RangeSelectCurrencyExample,
|
3
|
+
RangeSelectDateExample,
|
4
|
+
RangeSelectNumberExample,
|
5
5
|
} from '../../demo/filters/range-filter';
|
6
6
|
|
7
7
|
export default {
|
8
8
|
title: 'Table/Filters/Range',
|
9
9
|
};
|
10
10
|
|
11
|
-
export const DateRange = () => <
|
12
|
-
export const NumericRange = () => <
|
13
|
-
export const CurrencyRange = () => <
|
11
|
+
export const DateRange = () => <RangeSelectDateExample />;
|
12
|
+
export const NumericRange = () => <RangeSelectNumberExample />;
|
13
|
+
export const CurrencyRange = () => <RangeSelectCurrencyExample />;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { SingleSelectDefaultExample } from '../../demo/filters/single-select-filter';
|
2
2
|
|
3
3
|
export default {
|
4
|
-
title: 'Table/Filters',
|
4
|
+
title: 'Table/Filters/SingleSelect',
|
5
5
|
};
|
6
6
|
|
7
|
-
export const SingleSelect = () => <
|
7
|
+
export const SingleSelect = () => <SingleSelectDefaultExample />;
|