@servicetitan/table 22.0.1 → 22.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +28 -0
- package/dist/demo/index.d.ts +4 -0
- package/dist/demo/index.d.ts.map +1 -0
- package/dist/demo/index.js +4 -0
- package/dist/demo/index.js.map +1 -0
- package/dist/demo/master-detail/detail-table.d.ts +4 -0
- package/dist/demo/master-detail/detail-table.d.ts.map +1 -0
- package/dist/demo/master-detail/detail-table.js +28 -0
- package/dist/demo/master-detail/detail-table.js.map +1 -0
- package/dist/demo/master-detail/detail-table.store.d.ts +14 -0
- package/dist/demo/master-detail/detail-table.store.d.ts.map +1 -0
- package/dist/demo/master-detail/detail-table.store.js +104 -0
- package/dist/demo/master-detail/detail-table.store.js.map +1 -0
- package/dist/demo/master-detail/index.d.ts +2 -0
- package/dist/demo/master-detail/index.d.ts.map +1 -0
- package/dist/demo/master-detail/index.js +2 -0
- package/dist/demo/master-detail/index.js.map +1 -0
- package/dist/demo/master-detail/master-table.store.d.ts +14 -0
- package/dist/demo/master-detail/master-table.store.d.ts.map +1 -0
- package/dist/demo/master-detail/master-table.store.js +103 -0
- package/dist/demo/master-detail/master-table.store.js.map +1 -0
- package/dist/demo/master-detail/product-detail.d.ts +8 -0
- package/dist/demo/master-detail/product-detail.d.ts.map +1 -0
- package/dist/demo/master-detail/product-detail.js +2 -0
- package/dist/demo/master-detail/product-detail.js.map +1 -0
- package/dist/demo/master-detail/product-details.d.ts +3 -0
- package/dist/demo/master-detail/product-details.d.ts.map +1 -0
- package/dist/demo/master-detail/product-details.js +55 -0
- package/dist/demo/master-detail/product-details.js.map +1 -0
- package/dist/demo/master-detail/product.d.ts +26 -0
- package/dist/demo/master-detail/product.d.ts.map +1 -0
- package/dist/demo/master-detail/product.js +16 -0
- package/dist/demo/master-detail/product.js.map +1 -0
- package/dist/demo/master-detail/products.d.ts +3 -0
- package/dist/demo/master-detail/products.d.ts.map +1 -0
- package/dist/demo/master-detail/products.js +117 -0
- package/dist/demo/master-detail/products.js.map +1 -0
- package/dist/demo/master-detail/table-master-detail.d.ts +3 -0
- package/dist/demo/master-detail/table-master-detail.d.ts.map +1 -0
- package/dist/demo/master-detail/table-master-detail.js +24 -0
- package/dist/demo/master-detail/table-master-detail.js.map +1 -0
- package/dist/demo/overview/actions-cell.d.ts +5 -0
- package/dist/demo/overview/actions-cell.d.ts.map +1 -0
- package/dist/demo/overview/actions-cell.js +38 -0
- package/dist/demo/overview/actions-cell.js.map +1 -0
- package/dist/demo/overview/index.d.ts +2 -0
- package/dist/demo/overview/index.d.ts.map +1 -0
- package/dist/demo/overview/index.js +2 -0
- package/dist/demo/overview/index.js.map +1 -0
- package/dist/demo/overview/product.d.ts +27 -0
- package/dist/demo/overview/product.d.ts.map +1 -0
- package/dist/demo/overview/product.js +16 -0
- package/dist/demo/overview/product.js.map +1 -0
- package/dist/demo/overview/products.d.ts +3 -0
- package/dist/demo/overview/products.d.ts.map +1 -0
- package/dist/demo/overview/products.js +127 -0
- package/dist/demo/overview/products.js.map +1 -0
- package/dist/demo/overview/table.d.ts +6 -0
- package/dist/demo/overview/table.d.ts.map +1 -0
- package/dist/demo/overview/table.js +44 -0
- package/dist/demo/overview/table.js.map +1 -0
- package/dist/demo/overview/table.store.d.ts +15 -0
- package/dist/demo/overview/table.store.d.ts.map +1 -0
- package/dist/demo/overview/table.store.js +92 -0
- package/dist/demo/overview/table.store.js.map +1 -0
- package/dist/demo/state-caching/beverages.d.ts +3 -0
- package/dist/demo/state-caching/beverages.d.ts.map +1 -0
- package/dist/demo/state-caching/beverages.js +48 -0
- package/dist/demo/state-caching/beverages.js.map +1 -0
- package/dist/demo/state-caching/index.d.ts +2 -0
- package/dist/demo/state-caching/index.d.ts.map +1 -0
- package/dist/demo/state-caching/index.js +2 -0
- package/dist/demo/state-caching/index.js.map +1 -0
- package/dist/demo/state-caching/product.d.ts +6 -0
- package/dist/demo/state-caching/product.d.ts.map +1 -0
- package/dist/demo/state-caching/product.js +2 -0
- package/dist/demo/state-caching/product.js.map +1 -0
- package/dist/demo/state-caching/products.d.ts +3 -0
- package/dist/demo/state-caching/products.d.ts.map +1 -0
- package/dist/demo/state-caching/products.js +53 -0
- package/dist/demo/state-caching/products.js.map +1 -0
- package/dist/demo/state-caching/state-caching-table.d.ts +3 -0
- package/dist/demo/state-caching/state-caching-table.d.ts.map +1 -0
- package/dist/demo/state-caching/state-caching-table.js +14 -0
- package/dist/demo/state-caching/state-caching-table.js.map +1 -0
- package/dist/demo/state-caching/state-caching-table.store.d.ts +13 -0
- package/dist/demo/state-caching/state-caching-table.store.d.ts.map +1 -0
- package/dist/demo/state-caching/state-caching-table.store.js +70 -0
- package/dist/demo/state-caching/state-caching-table.store.js.map +1 -0
- package/dist/editable-cell/boolean-editable-cell.d.ts +3 -0
- package/dist/editable-cell/boolean-editable-cell.d.ts.map +1 -0
- package/dist/editable-cell/boolean-editable-cell.js +14 -0
- package/dist/editable-cell/boolean-editable-cell.js.map +1 -0
- package/dist/editable-cell/date-editable-cell.d.ts +3 -0
- package/dist/editable-cell/date-editable-cell.d.ts.map +1 -0
- package/dist/editable-cell/date-editable-cell.js +14 -0
- package/dist/editable-cell/date-editable-cell.js.map +1 -0
- package/dist/editable-cell/get-action-cell.d.ts +13 -0
- package/dist/editable-cell/get-action-cell.d.ts.map +1 -0
- package/dist/editable-cell/get-action-cell.js +18 -0
- package/dist/editable-cell/get-action-cell.js.map +1 -0
- package/dist/editable-cell/get-editable-cell.d.ts +13 -0
- package/dist/editable-cell/get-editable-cell.d.ts.map +1 -0
- package/dist/editable-cell/get-editable-cell.js +18 -0
- package/dist/editable-cell/get-editable-cell.js.map +1 -0
- package/dist/editable-cell/get-select-editable-cell.d.ts +10 -0
- package/dist/editable-cell/get-select-editable-cell.d.ts.map +1 -0
- package/dist/editable-cell/get-select-editable-cell.js +19 -0
- package/dist/editable-cell/get-select-editable-cell.js.map +1 -0
- package/dist/editable-cell/index.d.ts +8 -0
- package/dist/editable-cell/index.d.ts.map +1 -0
- package/dist/editable-cell/index.js +8 -0
- package/dist/editable-cell/index.js.map +1 -0
- package/dist/editable-cell/numeric-editable-cell.d.ts +3 -0
- package/dist/editable-cell/numeric-editable-cell.d.ts.map +1 -0
- package/dist/editable-cell/numeric-editable-cell.js +15 -0
- package/dist/editable-cell/numeric-editable-cell.js.map +1 -0
- package/dist/editable-cell/text-editable-cell.d.ts +9 -0
- package/dist/editable-cell/text-editable-cell.d.ts.map +1 -0
- package/dist/editable-cell/text-editable-cell.js +20 -0
- package/dist/editable-cell/text-editable-cell.js.map +1 -0
- package/dist/export/export.d.ts +10 -0
- package/dist/export/export.d.ts.map +1 -0
- package/dist/export/export.js +6 -0
- package/dist/export/export.js.map +1 -0
- package/dist/export/index.d.ts +2 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +2 -0
- package/dist/export/index.js.map +1 -0
- package/dist/filters/column-menu-filters.d.ts +5 -0
- package/dist/filters/column-menu-filters.d.ts.map +1 -0
- package/dist/filters/column-menu-filters.js +9 -0
- package/dist/filters/column-menu-filters.js.map +1 -0
- package/dist/filters/datetime-filter/datetime-filter.d.ts +3 -0
- package/dist/filters/datetime-filter/datetime-filter.d.ts.map +1 -0
- package/dist/filters/datetime-filter/datetime-filter.js +71 -0
- package/dist/filters/datetime-filter/datetime-filter.js.map +1 -0
- package/dist/filters/field-values-filter.d.ts +6 -0
- package/dist/filters/field-values-filter.d.ts.map +1 -0
- package/dist/filters/field-values-filter.js +155 -0
- package/dist/filters/field-values-filter.js.map +1 -0
- package/dist/filters/index.d.ts +9 -0
- package/dist/filters/index.d.ts.map +1 -0
- package/dist/filters/index.js +9 -0
- package/dist/filters/index.js.map +1 -0
- package/dist/filters/multiselect-filter.d.ts +5 -0
- package/dist/filters/multiselect-filter.d.ts.map +1 -0
- package/dist/filters/multiselect-filter.js +107 -0
- package/dist/filters/multiselect-filter.js.map +1 -0
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.d.ts +6 -0
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.d.ts.map +1 -0
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.js +6 -0
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.js.map +1 -0
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.d.ts +3 -0
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.d.ts.map +1 -0
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.js +27 -0
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.js.map +1 -0
- package/dist/filters/range-filter/range-filter.d.ts +6 -0
- package/dist/filters/range-filter/range-filter.d.ts.map +1 -0
- package/dist/filters/range-filter/range-filter.js +117 -0
- package/dist/filters/range-filter/range-filter.js.map +1 -0
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.d.ts +21 -0
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.d.ts.map +1 -0
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.js +82 -0
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.js.map +1 -0
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.d.ts +6 -0
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.d.ts.map +1 -0
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.js +6 -0
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.js.map +1 -0
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.d.ts +26 -0
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.d.ts.map +1 -0
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.js +69 -0
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.js.map +1 -0
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.d.ts +6 -0
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.d.ts.map +1 -0
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.js +30 -0
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.js.map +1 -0
- package/dist/filters/time-filter/time-filter.d.ts +3 -0
- package/dist/filters/time-filter/time-filter.d.ts.map +1 -0
- package/dist/filters/time-filter/time-filter.js +71 -0
- package/dist/filters/time-filter/time-filter.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/select-cell/index.d.ts +2 -0
- package/dist/select-cell/index.d.ts.map +1 -0
- package/dist/select-cell/index.js +2 -0
- package/dist/select-cell/index.js.map +1 -0
- package/dist/select-cell/select-cell.d.ts +25 -0
- package/dist/select-cell/select-cell.d.ts.map +1 -0
- package/dist/select-cell/select-cell.js +42 -0
- package/dist/select-cell/select-cell.js.map +1 -0
- package/dist/table-state.d.ts +161 -0
- package/dist/table-state.d.ts.map +1 -0
- package/dist/table-state.js +1106 -0
- package/dist/table-state.js.map +1 -0
- package/dist/table.d.ts +40 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.js +231 -0
- package/dist/table.js.map +1 -0
- package/package.json +6 -6
- package/src/select-cell/select-cell.tsx +43 -16
@@ -0,0 +1,71 @@
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
11
|
+
import { Component, Fragment } from 'react';
|
12
|
+
import { observer } from 'mobx-react';
|
13
|
+
import { observable, action, makeObservable } from 'mobx';
|
14
|
+
import { DropDownList } from '@progress/kendo-react-dropdowns';
|
15
|
+
import { DatePicker, TimePicker, } from '@progress/kendo-react-dateinputs';
|
16
|
+
import { IsUnaryFilter, cellOperatorChange, } from '@progress/kendo-react-grid/dist/npm/filterCommon';
|
17
|
+
import { renderCustomColumnMenuFilter } from '../column-menu-filters';
|
18
|
+
import * as Styles from './datetime-filter.module.css';
|
19
|
+
let DateTimeFilterCell = class DateTimeFilterCell extends Component {
|
20
|
+
constructor(props) {
|
21
|
+
var _a;
|
22
|
+
super(props);
|
23
|
+
Object.defineProperty(this, "operator", {
|
24
|
+
enumerable: true,
|
25
|
+
configurable: true,
|
26
|
+
writable: true,
|
27
|
+
value: (_a = this.props.operators.find(o => o.operator === this.props.operator)) !== null && _a !== void 0 ? _a : this.props.operators[0]
|
28
|
+
});
|
29
|
+
Object.defineProperty(this, "handleOperatorChange", {
|
30
|
+
enumerable: true,
|
31
|
+
configurable: true,
|
32
|
+
writable: true,
|
33
|
+
value: (event) => {
|
34
|
+
this.operator = event.target.value;
|
35
|
+
cellOperatorChange(event, this.props.value, this.props.onChange);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
Object.defineProperty(this, "handleChange", {
|
39
|
+
enumerable: true,
|
40
|
+
configurable: true,
|
41
|
+
writable: true,
|
42
|
+
value: (event) => {
|
43
|
+
var _a;
|
44
|
+
const value = event.value;
|
45
|
+
this.props.onChange({
|
46
|
+
value,
|
47
|
+
operator: (_a = this.props.operator) !== null && _a !== void 0 ? _a : '',
|
48
|
+
syntheticEvent: event.syntheticEvent,
|
49
|
+
});
|
50
|
+
}
|
51
|
+
});
|
52
|
+
makeObservable(this);
|
53
|
+
}
|
54
|
+
render() {
|
55
|
+
return (_jsxs(Fragment, { children: [_jsx(DropDownList, { value: this.operator, onChange: this.handleOperatorChange, data: this.props.operators, dataItemKey: "operator", textField: "text" }), !IsUnaryFilter(this.operator.operator) && (_jsxs(Fragment, { children: [_jsx(DatePicker, { value: this.props.value, onChange: this.handleChange, className: Styles.datePicker }), _jsx(TimePicker, { value: this.props.value, onChange: this.handleChange, className: Styles.timePicker })] }))] }));
|
56
|
+
}
|
57
|
+
};
|
58
|
+
__decorate([
|
59
|
+
observable,
|
60
|
+
__metadata("design:type", Object)
|
61
|
+
], DateTimeFilterCell.prototype, "operator", void 0);
|
62
|
+
__decorate([
|
63
|
+
action,
|
64
|
+
__metadata("design:type", Object)
|
65
|
+
], DateTimeFilterCell.prototype, "handleOperatorChange", void 0);
|
66
|
+
DateTimeFilterCell = __decorate([
|
67
|
+
observer,
|
68
|
+
__metadata("design:paramtypes", [Object])
|
69
|
+
], DateTimeFilterCell);
|
70
|
+
export const DateTimeColumnMenuFilter = renderCustomColumnMenuFilter(DateTimeFilterCell, true);
|
71
|
+
//# sourceMappingURL=datetime-filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"datetime-filter.js","sourceRoot":"","sources":["../../../src/filters/datetime-filter/datetime-filter.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE1D,OAAO,EAAE,YAAY,EAA2B,MAAM,iCAAiC,CAAC;AACxF,OAAO,EACH,UAAU,EAEV,UAAU,GAEb,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACH,aAAa,EACb,kBAAkB,GACrB,MAAM,kDAAkD,CAAC;AAI1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,MAAM,MAAM,8BAA8B,CAAC;AAGvD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,SAA+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AAC,KAAK,CAAC,KAAK,EACvB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,SAAS,EAAE,MAAM,CAAC,UAAU,GAC9B,EACF,KAAC,UAAU,IACP,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,SAAS,EAAE,MAAM,CAAC,UAAU,GAC9B,IACK,CACd,IACM,CACd,CAAC;IACN,CAAC;CACJ,CAAA;AApDe;IAAX,UAAU;;oDAEiB;AAQ5B;IADC,MAAM;;gEAIL;AAdA,kBAAkB;IADvB,QAAQ;;GACH,kBAAkB,CAqDvB;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,4BAA4B,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { IdType } from '@servicetitan/data-query';
|
3
|
+
import { TableState } from '../table-state';
|
4
|
+
export declare function operator<T>(item: T, value: T[]): boolean;
|
5
|
+
export declare function fieldValuesColumnMenuFilter<T, TId extends IdType = never>(tableState: TableState<T, TId>, renderItem?: (value: T[keyof T]) => string): (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
6
|
+
//# sourceMappingURL=field-values-filter.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"field-values-filter.d.ts","sourceRoot":"","sources":["../../src/filters/field-values-filter.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAc,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,WAE9C;AAED,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,GAAG,SAAS,MAAM,GAAG,KAAK,EACrE,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,EAC9B,UAAU,GAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,MAA0B,sFAiHhE"}
|
@@ -0,0 +1,155 @@
|
|
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 { Checkbox } from '@servicetitan/design-system';
|
21
|
+
import { Component, Fragment } from 'react';
|
22
|
+
import { observer } from 'mobx-react';
|
23
|
+
import { observable, computed, runInAction, action, makeObservable } from 'mobx';
|
24
|
+
import { Input } from '@progress/kendo-react-inputs';
|
25
|
+
import { renderCustomColumnMenuFilter } from './column-menu-filters';
|
26
|
+
export function operator(item, value) {
|
27
|
+
return value.includes(item);
|
28
|
+
}
|
29
|
+
export function fieldValuesColumnMenuFilter(tableState, renderItem = defaultRenderItem) {
|
30
|
+
let FieldValuesFilterCell = class FieldValuesFilterCell extends Component {
|
31
|
+
constructor(props) {
|
32
|
+
super(props);
|
33
|
+
Object.defineProperty(this, "data", {
|
34
|
+
enumerable: true,
|
35
|
+
configurable: true,
|
36
|
+
writable: true,
|
37
|
+
value: []
|
38
|
+
});
|
39
|
+
Object.defineProperty(this, "searchQuery", {
|
40
|
+
enumerable: true,
|
41
|
+
configurable: true,
|
42
|
+
writable: true,
|
43
|
+
value: ''
|
44
|
+
});
|
45
|
+
Object.defineProperty(this, "handleSearchQueryChange", {
|
46
|
+
enumerable: true,
|
47
|
+
configurable: true,
|
48
|
+
writable: true,
|
49
|
+
value: (ev) => {
|
50
|
+
if (typeof ev.target.value === 'string') {
|
51
|
+
this.searchQuery = ev.target.value;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
});
|
55
|
+
Object.defineProperty(this, "handleChange", {
|
56
|
+
enumerable: true,
|
57
|
+
configurable: true,
|
58
|
+
writable: true,
|
59
|
+
value: (value, checked, ev) => {
|
60
|
+
const newFilterValue = checked
|
61
|
+
? this.value.concat(value.value)
|
62
|
+
: this.value.filter((v) => v !== value.value);
|
63
|
+
const hasValue = newFilterValue.length > 0;
|
64
|
+
this.props.onChange({
|
65
|
+
value: hasValue ? newFilterValue : '',
|
66
|
+
operator: hasValue ? operator : '',
|
67
|
+
syntheticEvent: ev,
|
68
|
+
});
|
69
|
+
}
|
70
|
+
});
|
71
|
+
makeObservable(this);
|
72
|
+
}
|
73
|
+
get processedData() {
|
74
|
+
const searchQuery = this.searchQuery.toLowerCase();
|
75
|
+
const filteredData = !searchQuery
|
76
|
+
? this.data
|
77
|
+
: this.data.filter(v => v.text.toLowerCase().includes(searchQuery));
|
78
|
+
return filteredData.slice().sort((a, b) => {
|
79
|
+
if (a.text === b.text) {
|
80
|
+
return 0;
|
81
|
+
}
|
82
|
+
return a.text < b.text ? -1 : 1;
|
83
|
+
});
|
84
|
+
}
|
85
|
+
get field() {
|
86
|
+
const field = this.props.field;
|
87
|
+
if (field === undefined) {
|
88
|
+
throw 'missing field';
|
89
|
+
}
|
90
|
+
return field;
|
91
|
+
}
|
92
|
+
get value() {
|
93
|
+
return this.props.value || [];
|
94
|
+
}
|
95
|
+
componentDidMount() {
|
96
|
+
this.fetchData(tableState.dataSource);
|
97
|
+
}
|
98
|
+
render() {
|
99
|
+
return (_jsxs(Fragment, { children: [_jsx(Input, { value: this.searchQuery, onChange: this.handleSearchQueryChange, placeholder: "Search" }), this.processedData.map(item => (_jsx("span", Object.assign({ className: "k-widget" }, { children: _jsx(Checkbox, { label: item.text, checked: this.value.includes(item.value), onChange: this.handleChange, value: item }) }), JSON.stringify(item))))] }));
|
100
|
+
}
|
101
|
+
fetchData(dataSource) {
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
103
|
+
if (!dataSource) {
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
const items = (yield dataSource.getData({})).data;
|
107
|
+
const values = items.map(i => i[this.field]);
|
108
|
+
const distinctValues = values.filter((v, idx) => values.indexOf(v) === idx);
|
109
|
+
runInAction(() => {
|
110
|
+
this.data = distinctValues.map(value => ({ value, text: renderItem(value) }));
|
111
|
+
});
|
112
|
+
});
|
113
|
+
}
|
114
|
+
};
|
115
|
+
__decorate([
|
116
|
+
observable,
|
117
|
+
__metadata("design:type", Array)
|
118
|
+
], FieldValuesFilterCell.prototype, "data", void 0);
|
119
|
+
__decorate([
|
120
|
+
observable,
|
121
|
+
__metadata("design:type", Object)
|
122
|
+
], FieldValuesFilterCell.prototype, "searchQuery", void 0);
|
123
|
+
__decorate([
|
124
|
+
computed,
|
125
|
+
__metadata("design:type", Object),
|
126
|
+
__metadata("design:paramtypes", [])
|
127
|
+
], FieldValuesFilterCell.prototype, "processedData", null);
|
128
|
+
__decorate([
|
129
|
+
computed,
|
130
|
+
__metadata("design:type", Object),
|
131
|
+
__metadata("design:paramtypes", [])
|
132
|
+
], FieldValuesFilterCell.prototype, "field", null);
|
133
|
+
__decorate([
|
134
|
+
computed,
|
135
|
+
__metadata("design:type", Array),
|
136
|
+
__metadata("design:paramtypes", [])
|
137
|
+
], FieldValuesFilterCell.prototype, "value", null);
|
138
|
+
__decorate([
|
139
|
+
action,
|
140
|
+
__metadata("design:type", Object)
|
141
|
+
], FieldValuesFilterCell.prototype, "handleSearchQueryChange", void 0);
|
142
|
+
FieldValuesFilterCell = __decorate([
|
143
|
+
observer,
|
144
|
+
__metadata("design:paramtypes", [Object])
|
145
|
+
], FieldValuesFilterCell);
|
146
|
+
return renderCustomColumnMenuFilter(FieldValuesFilterCell);
|
147
|
+
}
|
148
|
+
function defaultRenderItem(v) {
|
149
|
+
if (v == null) {
|
150
|
+
return '';
|
151
|
+
}
|
152
|
+
// suppose v has toString();
|
153
|
+
return v.toString();
|
154
|
+
}
|
155
|
+
//# sourceMappingURL=field-values-filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"field-values-filter.js","sourceRoot":"","sources":["../../src/filters/field-values-filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAwB,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAa,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEjF,OAAO,EAAE,KAAK,EAAoB,MAAM,8BAA8B,CAAC;AAIvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE,MAAM,UAAU,QAAQ,CAAI,IAAO,EAAE,KAAU;IAC3C,OAAO,KAAK,CAAC,QA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AC;AAED,SAAS,iBAAiB,CAAC,CAAM;IAC7B,IAAI,CAAC,IAAI,IAAI,EAAE;QACX,OAAO,EAAE,CAAC;KACb;IAED,4BAA4B;IAC5B,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export * from './datetime-filter/datetime-filter';
|
2
|
+
export * from './range-filter/range-filter';
|
3
|
+
export * from './standard-filter-with-multiselect/standard-filter-with-multiselect';
|
4
|
+
export * from './time-filter/time-filter';
|
5
|
+
export * from './column-menu-filters';
|
6
|
+
export * from './field-values-filter';
|
7
|
+
export * from './multiselect-filter';
|
8
|
+
export * from './numeric-filter-extended/numeric-filter-extended';
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +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"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export * from './datetime-filter/datetime-filter';
|
2
|
+
export * from './range-filter/range-filter';
|
3
|
+
export * from './standard-filter-with-multiselect/standard-filter-with-multiselect';
|
4
|
+
export * from './time-filter/time-filter';
|
5
|
+
export * from './column-menu-filters';
|
6
|
+
export * from './field-values-filter';
|
7
|
+
export * from './multiselect-filter';
|
8
|
+
export * from './numeric-filter-extended/numeric-filter-extended';
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +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"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
export declare function multiSelectColumnMenuFilter<T>(data: T[], renderItem?: (item: T) => ReactNode): (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
3
|
+
export declare function complexItemMultiSelectColumnMenuFilter<T>(data: T[], renderItem?: (item: T) => ReactNode): (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
4
|
+
export declare function multiItemMultiSelectColumnMenuFilter<T>(data: T[], renderItem?: (item: T) => ReactNode): (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
5
|
+
//# sourceMappingURL=multiselect-filter.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"multiselect-filter.d.ts","sourceRoot":"","sources":["../../src/filters/multiselect-filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAM,MAAM,OAAO,CAAC;AAuCjE,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,sFAqB5F;AAED,wBAAgB,sCAAsC,CAAC,CAAC,EACpD,IAAI,EAAE,CAAC,EAAE,EACT,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,sFAgCtC;AAED,wBAAgB,oCAAoC,CAAC,CAAC,EAClD,IAAI,EAAE,CAAC,EAAE,EACT,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,sFAgCtC"}
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { Component } from 'react';
|
3
|
+
import { Checkbox } from '@servicetitan/design-system';
|
4
|
+
import { renderCustomColumnMenuFilter } from './column-menu-filters';
|
5
|
+
class Selector extends Component {
|
6
|
+
constructor() {
|
7
|
+
super(...arguments);
|
8
|
+
Object.defineProperty(this, "handleChange", {
|
9
|
+
enumerable: true,
|
10
|
+
configurable: true,
|
11
|
+
writable: true,
|
12
|
+
value: (option, checked, event) => {
|
13
|
+
var _a, _b;
|
14
|
+
const newValue = checked
|
15
|
+
? ((_a = this.props.value) !== null && _a !== void 0 ? _a : []).concat(option)
|
16
|
+
: ((_b = this.props.value) !== null && _b !== void 0 ? _b : []).filter(v => v !== option);
|
17
|
+
this.props.onChange(newValue.length ? newValue : undefined, event);
|
18
|
+
}
|
19
|
+
});
|
20
|
+
}
|
21
|
+
render() {
|
22
|
+
const { options, value, renderer } = this.props;
|
23
|
+
return options.map((option, index) => (
|
24
|
+
// eslint-disable-next-line react/no-array-index-key
|
25
|
+
_jsx("span", Object.assign({ className: "k-widget" }, { children: _jsx(Checkbox, { value: option, label: renderer ? renderer(option) : option, checked: (value !== null && value !== void 0 ? value : []).includes(option), onChange: this.handleChange }) }), index)));
|
26
|
+
}
|
27
|
+
}
|
28
|
+
export function multiSelectColumnMenuFilter(data, renderItem) {
|
29
|
+
const FilterCell = ({ value, onChange }) => {
|
30
|
+
const handleChange = (value, event) => {
|
31
|
+
onChange({
|
32
|
+
value: value !== null && value !== void 0 ? value : '',
|
33
|
+
operator: value ? 'in' : '',
|
34
|
+
syntheticEvent: event,
|
35
|
+
});
|
36
|
+
};
|
37
|
+
return (_jsx(Selector, { options: data, value: value === '' ? undefined : value, onChange: handleChange, renderer: renderItem }));
|
38
|
+
};
|
39
|
+
return renderCustomColumnMenuFilter(FilterCell);
|
40
|
+
}
|
41
|
+
export function complexItemMultiSelectColumnMenuFilter(data, renderItem) {
|
42
|
+
class FilterCell extends Component {
|
43
|
+
constructor() {
|
44
|
+
super(...arguments);
|
45
|
+
Object.defineProperty(this, "contains", {
|
46
|
+
enumerable: true,
|
47
|
+
configurable: true,
|
48
|
+
writable: true,
|
49
|
+
value: (item) => {
|
50
|
+
const value = this.props.value || [];
|
51
|
+
return value.some((v) => item[v] === true);
|
52
|
+
}
|
53
|
+
});
|
54
|
+
Object.defineProperty(this, "handleChange", {
|
55
|
+
enumerable: true,
|
56
|
+
configurable: true,
|
57
|
+
writable: true,
|
58
|
+
value: (value, event) => {
|
59
|
+
this.props.onChange({
|
60
|
+
value: value !== null && value !== void 0 ? value : '',
|
61
|
+
operator: value ? this.contains : '',
|
62
|
+
syntheticEvent: event,
|
63
|
+
});
|
64
|
+
}
|
65
|
+
});
|
66
|
+
}
|
67
|
+
render() {
|
68
|
+
const { value } = this.props;
|
69
|
+
return (_jsx(Selector, { options: data, value: value === '' ? undefined : value, onChange: this.handleChange, renderer: renderItem }));
|
70
|
+
}
|
71
|
+
}
|
72
|
+
return renderCustomColumnMenuFilter(FilterCell);
|
73
|
+
}
|
74
|
+
export function multiItemMultiSelectColumnMenuFilter(data, renderItem) {
|
75
|
+
class FilterCell extends Component {
|
76
|
+
constructor() {
|
77
|
+
super(...arguments);
|
78
|
+
Object.defineProperty(this, "contains", {
|
79
|
+
enumerable: true,
|
80
|
+
configurable: true,
|
81
|
+
writable: true,
|
82
|
+
value: (item) => {
|
83
|
+
const value = this.props.value || [];
|
84
|
+
return value.some((v) => Array.isArray(item) && item.includes(v));
|
85
|
+
}
|
86
|
+
});
|
87
|
+
Object.defineProperty(this, "handleChange", {
|
88
|
+
enumerable: true,
|
89
|
+
configurable: true,
|
90
|
+
writable: true,
|
91
|
+
value: (value, event) => {
|
92
|
+
this.props.onChange({
|
93
|
+
value: value !== null && value !== void 0 ? value : '',
|
94
|
+
operator: value ? this.contains : '',
|
95
|
+
syntheticEvent: event,
|
96
|
+
});
|
97
|
+
}
|
98
|
+
});
|
99
|
+
}
|
100
|
+
render() {
|
101
|
+
const { value } = this.props;
|
102
|
+
return (_jsx(Selector, { options: data, value: value === '' ? undefined : value, onChange: this.handleChange, renderer: renderItem }));
|
103
|
+
}
|
104
|
+
}
|
105
|
+
return renderCustomColumnMenuFilter(FilterCell);
|
106
|
+
}
|
107
|
+
//# sourceMappingURL=multiselect-filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"multiselect-filter.js","sourceRoot":"","sources":["../../src/filters/multiselect-filter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAiC,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAwB,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AASrE,MAAM,QAAY,SAAQ,SAA2B;IAArD;;QACI;;;;mBAAe,CAAC,MAAS,EAAE,OAAgB,EAAE,KAAuC,EAAE,EAAE;;gBACpF,MAAM,QAAQ,GAAG,OAAO;oBACpB,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;oBACzC,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;gBAEzD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACvE,CAAC;WAAC;IAiBN,CAAC;IAfG,MAAM;QACF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAEhD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClC,oDAAoD;QACpD,6BAAkB,SAAS,EAAC,UAAU,gBAClC,KAAC,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AAE;oBAC/E,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;wBAChB,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE;wBAClB,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;wBACpC,cAAc,EAAE,KAAK;qBACxB,CAAC,CAAC;gBACP,CAAC;eAAC;QAcN,CAAC;QAZG,MAAM;YACF,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YAE7B,OAAO,CACH,KAAC,QAAQ,IACL,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EACvC,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,QAAQ,EAAE,UAAU,GACtB,CACL,CAAC;QACN,CAAC;KACJ;IAED,OAAO,4BAA4B,CAAC,UAAU,CAAC,CAAC;AACpD,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"numeric-extended-operators.d.ts","sourceRoot":"","sources":["../../../src/filters/numeric-filter-extended/numeric-extended-operators.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB;;;GAGpC,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,MAAM,GAAG,QAAQ,YACN,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export const numericExtendedOperators = [
|
2
|
+
{ text: 'Is integer', operator: 'isinteger' },
|
3
|
+
{ text: 'Is fractional', operator: 'isfractional' },
|
4
|
+
];
|
5
|
+
export const isNumericExtendedOperator = (operator) => numericExtendedOperators.some(o => o.operator === operator);
|
6
|
+
//# sourceMappingURL=numeric-extended-operators.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"numeric-extended-operators.js","sourceRoot":"","sources":["../../../src/filters/numeric-filter-extended/numeric-extended-operators.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACpC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE;IAC7C,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE;CACtD,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,QAA2B,EAAE,EAAE,CACrE,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"numeric-filter-extended.d.ts","sourceRoot":"","sources":["../../../src/filters/numeric-filter-extended/numeric-filter-extended.tsx"],"names":[],"mappings":";AAwDA,eAAO,MAAM,qBAAqB,kFAA2D,CAAC"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { NumericTextBox } from '@progress/kendo-react-inputs';
|
3
|
+
import { DropDownList } from '@progress/kendo-react-dropdowns';
|
4
|
+
import { IsUnaryFilter, cellOperatorChange, } from '@progress/kendo-react-grid/dist/npm/filterCommon';
|
5
|
+
import { numericExtendedOperators, isNumericExtendedOperator } from './numeric-extended-operators';
|
6
|
+
import { renderCustomColumnMenuFilter } from '../column-menu-filters';
|
7
|
+
//
|
8
|
+
// like standard filter cell (rendered for numeric type), but with support of some special numeric operators
|
9
|
+
const NumericExtFilterCell = ({ operators, operator = '', value, onChange, }) => {
|
10
|
+
const operatorsExt = operators.concat(numericExtendedOperators);
|
11
|
+
const operatorValue = operatorsExt.find(item => item.operator === operator);
|
12
|
+
const handleInputChange = (e) => onChange({
|
13
|
+
operator,
|
14
|
+
value: e.value,
|
15
|
+
syntheticEvent: e.syntheticEvent,
|
16
|
+
});
|
17
|
+
const handleOperatorChange = (event) => {
|
18
|
+
// set value to null when switching to unary operator
|
19
|
+
const newValue = isNumericExtendedOperator(event.target.value.operator) ? null : value;
|
20
|
+
cellOperatorChange(event, newValue, onChange);
|
21
|
+
};
|
22
|
+
const isUnary = (typeof operator === 'string' && IsUnaryFilter(operator)) ||
|
23
|
+
isNumericExtendedOperator(operator);
|
24
|
+
return (_jsxs("div", { children: [_jsx(DropDownList, { value: operatorValue, onChange: handleOperatorChange, data: operatorsExt, textField: "text" }), _jsx(NumericTextBox, { value: value, onChange: handleInputChange, disabled: isUnary })] }));
|
25
|
+
};
|
26
|
+
export const NumericFilterExtended = renderCustomColumnMenuFilter(NumericExtFilterCell, true);
|
27
|
+
//# sourceMappingURL=numeric-filter-extended.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"numeric-filter-extended.js","sourceRoot":"","sources":["../../../src/filters/numeric-filter-extended/numeric-filter-extended.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAA6B,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,YAAY,EAA2B,MAAM,iCAAiC,CAAC;AAGxF,OAAO,EACH,aAAa,EACb,kBAAkB,GACrB,MAAM,kDAAkD,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEnG,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,EAAE;AAEF,4GAA4G;AAC5G,MAAM,oBAAoB,GAAuC,CAAC,EAC9D,SAAS,EACT,QAAQ,GAAG,EAAE,EACb,KAAK,EACL,QAAQ,GACX,EAAE,EAAE;IACD,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAChE,MAAM,aAAa,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IAE5E,MAAM,iBAAiB,GAAG,CAAC,CAA4B,EAAE,EAAE,CACvD,QAAQ,CAAC;QACL,QAAQ;QACR,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,cAAc,EAAE,CAAC,CAAC,cAAc;KACnC,CAAC,CAAC;IAEP,MAAM,oBAAoB,GAAG,CAAC,KAA8B,EAAE,EAAE;QAC5D,qDAAqD;QACrD,MAAM,QAAQ,GAAG,yBAAyB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QACvF,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF,MAAM,OAAO,GACT,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;QACzD,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IAExC,OAAO,CACH,0BACI,KAAC,YAAY,IACT,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,oBAAoB,EAC9B,IAAI,EAAE,YAAY,EAClB,SAAS,EAAC,MAAM,GAClB,EACF,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,OAAO,GAAI,IAC9E,CACT,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare const NumericRangeColumnMenuFilter: (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
3
|
+
export declare const CurrencyRangeColumnMenuFilter: (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
4
|
+
export declare const DateRangeColumnMenuFilter: (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
5
|
+
export declare const TimeRangeColumnMenuFilter: (props: import("@servicetitan/design-system").TableColumnMenuProps) => JSX.Element;
|
6
|
+
//# sourceMappingURL=range-filter.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"range-filter.d.ts","sourceRoot":"","sources":["../../../src/filters/range-filter/range-filter.tsx"],"names":[],"mappings":";AAsJA,eAAO,MAAM,4BAA4B,oFAAuD,CAAC;AACjG,eAAO,MAAM,6BAA6B,oFAAwD,CAAC;AACnG,eAAO,MAAM,yBAAyB,oFAAoD,CAAC;AAC3F,eAAO,MAAM,yBAAyB,oFAAoD,CAAC"}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useState, useEffect, Component, Fragment } from 'react';
|
3
|
+
import { DatePicker, TimePicker } from '@progress/kendo-react-dateinputs';
|
4
|
+
import { NumericTextBox } from '@progress/kendo-react-inputs';
|
5
|
+
import moment from 'moment';
|
6
|
+
import { renderCustomColumnMenuFilter } from '../column-menu-filters';
|
7
|
+
import * as Styles from './range-filter.module.css';
|
8
|
+
const NoSSR = ({ children }) => {
|
9
|
+
const [isMounted, setIsMounted] = useState(false);
|
10
|
+
useEffect(() => {
|
11
|
+
setIsMounted(true);
|
12
|
+
}, []);
|
13
|
+
return isMounted ? children : null;
|
14
|
+
};
|
15
|
+
class RangeFilterCellBase extends Component {
|
16
|
+
constructor(props, controlClass, controlProps = {}) {
|
17
|
+
super(props);
|
18
|
+
Object.defineProperty(this, "controlClass", {
|
19
|
+
enumerable: true,
|
20
|
+
configurable: true,
|
21
|
+
writable: true,
|
22
|
+
value: controlClass
|
23
|
+
});
|
24
|
+
Object.defineProperty(this, "controlProps", {
|
25
|
+
enumerable: true,
|
26
|
+
configurable: true,
|
27
|
+
writable: true,
|
28
|
+
value: controlProps
|
29
|
+
});
|
30
|
+
Object.defineProperty(this, "minValueBox", {
|
31
|
+
enumerable: true,
|
32
|
+
configurable: true,
|
33
|
+
writable: true,
|
34
|
+
value: null
|
35
|
+
});
|
36
|
+
Object.defineProperty(this, "maxValueBox", {
|
37
|
+
enumerable: true,
|
38
|
+
configurable: true,
|
39
|
+
writable: true,
|
40
|
+
value: null
|
41
|
+
});
|
42
|
+
Object.defineProperty(this, "onChange", {
|
43
|
+
enumerable: true,
|
44
|
+
configurable: true,
|
45
|
+
writable: true,
|
46
|
+
value: (ev) => {
|
47
|
+
if (!this.minValueBox || !this.maxValueBox) {
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
this.props.onChange({
|
51
|
+
value: { min: this.minValueBox.value, max: this.maxValueBox.value },
|
52
|
+
operator: this.inRange,
|
53
|
+
syntheticEvent: ev.syntheticEvent,
|
54
|
+
});
|
55
|
+
}
|
56
|
+
});
|
57
|
+
Object.defineProperty(this, "setMinValueRef", {
|
58
|
+
enumerable: true,
|
59
|
+
configurable: true,
|
60
|
+
writable: true,
|
61
|
+
value: (el) => {
|
62
|
+
this.minValueBox = el;
|
63
|
+
}
|
64
|
+
});
|
65
|
+
Object.defineProperty(this, "setMaxValueRef", {
|
66
|
+
enumerable: true,
|
67
|
+
configurable: true,
|
68
|
+
writable: true,
|
69
|
+
value: (el) => {
|
70
|
+
this.maxValueBox = el;
|
71
|
+
}
|
72
|
+
});
|
73
|
+
}
|
74
|
+
/** override this if additional type support needed */
|
75
|
+
inRange(current, values) {
|
76
|
+
return ((values.min === null || values.min === undefined || current >= values.min) &&
|
77
|
+
(values.max === null || values.max === undefined || current <= values.max));
|
78
|
+
}
|
79
|
+
render() {
|
80
|
+
const filterValue = this.props.value;
|
81
|
+
const Control = this.controlClass;
|
82
|
+
return (_jsxs(Fragment, { children: [_jsx("span", Object.assign({ className: "k-widget" }, { children: "From:" })), _jsx("span", Object.assign({ className: Styles.from }, { children: _jsx(NoSSR, { children: _jsx(Control, Object.assign({}, this.controlProps, { value: filterValue === null || filterValue === void 0 ? void 0 : filterValue.min, ref: this.setMinValueRef, onChange: this.onChange })) }) })), _jsx("span", Object.assign({ className: "k-widget" }, { children: "To:" })), _jsx("span", Object.assign({ className: Styles.to }, { children: _jsx(NoSSR, { children: _jsx(Control, Object.assign({}, this.controlProps, { value: filterValue === null || filterValue === void 0 ? void 0 : filterValue.max, ref: this.setMaxValueRef, onChange: this.onChange })) }) }))] }));
|
83
|
+
}
|
84
|
+
}
|
85
|
+
class NumericRangeFilterCell extends RangeFilterCellBase {
|
86
|
+
constructor(props) {
|
87
|
+
super(props, NumericTextBox);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
class CurrencyRangeFilterCell extends RangeFilterCellBase {
|
91
|
+
constructor(props) {
|
92
|
+
super(props, NumericTextBox, {
|
93
|
+
format: 'c',
|
94
|
+
});
|
95
|
+
}
|
96
|
+
}
|
97
|
+
class DateRangeFilterCell extends RangeFilterCellBase {
|
98
|
+
constructor(props) {
|
99
|
+
super(props, DatePicker);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
function getTimeString(date) {
|
103
|
+
return `${date.getHours()}:${date.getMinutes()}`;
|
104
|
+
}
|
105
|
+
class TimeRangeFilterCell extends RangeFilterCellBase {
|
106
|
+
constructor(props) {
|
107
|
+
super(props, TimePicker);
|
108
|
+
}
|
109
|
+
inRange(current, values) {
|
110
|
+
return moment(getTimeString(current), 'h:mma').isBetween(moment(getTimeString(values.min || current), 'h:mma'), moment(getTimeString(values.max || current), 'h:mma'), 'minutes', '[]');
|
111
|
+
}
|
112
|
+
}
|
113
|
+
export const NumericRangeColumnMenuFilter = renderCustomColumnMenuFilter(NumericRangeFilterCell);
|
114
|
+
export const CurrencyRangeColumnMenuFilter = renderCustomColumnMenuFilter(CurrencyRangeFilterCell);
|
115
|
+
export const DateRangeColumnMenuFilter = renderCustomColumnMenuFilter(DateRangeFilterCell);
|
116
|
+
export const TimeRangeColumnMenuFilter = renderCustomColumnMenuFilter(TimeRangeFilterCell);
|
117
|
+
//# sourceMappingURL=range-filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"range-filter.js","sourceRoot":"","sources":["../../../src/filters/range-filter/range-filter.tsx"],"names":[],"mappings":";AAAA,OAAO,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