@servicetitan/table 21.7.1 → 22.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +550 -0
- package/package.json +8 -8
- package/dist/demo/index.d.ts +0 -4
- package/dist/demo/index.d.ts.map +0 -1
- package/dist/demo/index.js +0 -4
- package/dist/demo/index.js.map +0 -1
- package/dist/demo/master-detail/detail-table.d.ts +0 -4
- package/dist/demo/master-detail/detail-table.d.ts.map +0 -1
- package/dist/demo/master-detail/detail-table.js +0 -28
- package/dist/demo/master-detail/detail-table.js.map +0 -1
- package/dist/demo/master-detail/detail-table.store.d.ts +0 -14
- package/dist/demo/master-detail/detail-table.store.d.ts.map +0 -1
- package/dist/demo/master-detail/detail-table.store.js +0 -104
- package/dist/demo/master-detail/detail-table.store.js.map +0 -1
- package/dist/demo/master-detail/index.d.ts +0 -2
- package/dist/demo/master-detail/index.d.ts.map +0 -1
- package/dist/demo/master-detail/index.js +0 -2
- package/dist/demo/master-detail/index.js.map +0 -1
- package/dist/demo/master-detail/master-table.store.d.ts +0 -14
- package/dist/demo/master-detail/master-table.store.d.ts.map +0 -1
- package/dist/demo/master-detail/master-table.store.js +0 -103
- package/dist/demo/master-detail/master-table.store.js.map +0 -1
- package/dist/demo/master-detail/product-detail.d.ts +0 -8
- package/dist/demo/master-detail/product-detail.d.ts.map +0 -1
- package/dist/demo/master-detail/product-detail.js +0 -2
- package/dist/demo/master-detail/product-detail.js.map +0 -1
- package/dist/demo/master-detail/product-details.d.ts +0 -3
- package/dist/demo/master-detail/product-details.d.ts.map +0 -1
- package/dist/demo/master-detail/product-details.js +0 -55
- package/dist/demo/master-detail/product-details.js.map +0 -1
- package/dist/demo/master-detail/product.d.ts +0 -26
- package/dist/demo/master-detail/product.d.ts.map +0 -1
- package/dist/demo/master-detail/product.js +0 -16
- package/dist/demo/master-detail/product.js.map +0 -1
- package/dist/demo/master-detail/products.d.ts +0 -3
- package/dist/demo/master-detail/products.d.ts.map +0 -1
- package/dist/demo/master-detail/products.js +0 -117
- package/dist/demo/master-detail/products.js.map +0 -1
- package/dist/demo/master-detail/table-master-detail.d.ts +0 -3
- package/dist/demo/master-detail/table-master-detail.d.ts.map +0 -1
- package/dist/demo/master-detail/table-master-detail.js +0 -24
- package/dist/demo/master-detail/table-master-detail.js.map +0 -1
- package/dist/demo/overview/actions-cell.d.ts +0 -5
- package/dist/demo/overview/actions-cell.d.ts.map +0 -1
- package/dist/demo/overview/actions-cell.js +0 -38
- package/dist/demo/overview/actions-cell.js.map +0 -1
- package/dist/demo/overview/index.d.ts +0 -2
- package/dist/demo/overview/index.d.ts.map +0 -1
- package/dist/demo/overview/index.js +0 -2
- package/dist/demo/overview/index.js.map +0 -1
- package/dist/demo/overview/product.d.ts +0 -27
- package/dist/demo/overview/product.d.ts.map +0 -1
- package/dist/demo/overview/product.js +0 -16
- package/dist/demo/overview/product.js.map +0 -1
- package/dist/demo/overview/products.d.ts +0 -3
- package/dist/demo/overview/products.d.ts.map +0 -1
- package/dist/demo/overview/products.js +0 -127
- package/dist/demo/overview/products.js.map +0 -1
- package/dist/demo/overview/table.d.ts +0 -6
- package/dist/demo/overview/table.d.ts.map +0 -1
- package/dist/demo/overview/table.js +0 -44
- package/dist/demo/overview/table.js.map +0 -1
- package/dist/demo/overview/table.store.d.ts +0 -15
- package/dist/demo/overview/table.store.d.ts.map +0 -1
- package/dist/demo/overview/table.store.js +0 -92
- package/dist/demo/overview/table.store.js.map +0 -1
- package/dist/demo/state-caching/beverages.d.ts +0 -3
- package/dist/demo/state-caching/beverages.d.ts.map +0 -1
- package/dist/demo/state-caching/beverages.js +0 -48
- package/dist/demo/state-caching/beverages.js.map +0 -1
- package/dist/demo/state-caching/index.d.ts +0 -2
- package/dist/demo/state-caching/index.d.ts.map +0 -1
- package/dist/demo/state-caching/index.js +0 -2
- package/dist/demo/state-caching/index.js.map +0 -1
- package/dist/demo/state-caching/product.d.ts +0 -6
- package/dist/demo/state-caching/product.d.ts.map +0 -1
- package/dist/demo/state-caching/product.js +0 -2
- package/dist/demo/state-caching/product.js.map +0 -1
- package/dist/demo/state-caching/products.d.ts +0 -3
- package/dist/demo/state-caching/products.d.ts.map +0 -1
- package/dist/demo/state-caching/products.js +0 -53
- package/dist/demo/state-caching/products.js.map +0 -1
- package/dist/demo/state-caching/state-caching-table.d.ts +0 -3
- package/dist/demo/state-caching/state-caching-table.d.ts.map +0 -1
- package/dist/demo/state-caching/state-caching-table.js +0 -14
- package/dist/demo/state-caching/state-caching-table.js.map +0 -1
- package/dist/demo/state-caching/state-caching-table.store.d.ts +0 -13
- package/dist/demo/state-caching/state-caching-table.store.d.ts.map +0 -1
- package/dist/demo/state-caching/state-caching-table.store.js +0 -70
- package/dist/demo/state-caching/state-caching-table.store.js.map +0 -1
- package/dist/editable-cell/boolean-editable-cell.d.ts +0 -3
- package/dist/editable-cell/boolean-editable-cell.d.ts.map +0 -1
- package/dist/editable-cell/boolean-editable-cell.js +0 -14
- package/dist/editable-cell/boolean-editable-cell.js.map +0 -1
- package/dist/editable-cell/date-editable-cell.d.ts +0 -3
- package/dist/editable-cell/date-editable-cell.d.ts.map +0 -1
- package/dist/editable-cell/date-editable-cell.js +0 -14
- package/dist/editable-cell/date-editable-cell.js.map +0 -1
- package/dist/editable-cell/get-action-cell.d.ts +0 -13
- package/dist/editable-cell/get-action-cell.d.ts.map +0 -1
- package/dist/editable-cell/get-action-cell.js +0 -18
- package/dist/editable-cell/get-action-cell.js.map +0 -1
- package/dist/editable-cell/get-editable-cell.d.ts +0 -13
- package/dist/editable-cell/get-editable-cell.d.ts.map +0 -1
- package/dist/editable-cell/get-editable-cell.js +0 -18
- package/dist/editable-cell/get-editable-cell.js.map +0 -1
- package/dist/editable-cell/get-select-editable-cell.d.ts +0 -10
- package/dist/editable-cell/get-select-editable-cell.d.ts.map +0 -1
- package/dist/editable-cell/get-select-editable-cell.js +0 -19
- package/dist/editable-cell/get-select-editable-cell.js.map +0 -1
- package/dist/editable-cell/index.d.ts +0 -8
- package/dist/editable-cell/index.d.ts.map +0 -1
- package/dist/editable-cell/index.js +0 -8
- package/dist/editable-cell/index.js.map +0 -1
- package/dist/editable-cell/numeric-editable-cell.d.ts +0 -3
- package/dist/editable-cell/numeric-editable-cell.d.ts.map +0 -1
- package/dist/editable-cell/numeric-editable-cell.js +0 -15
- package/dist/editable-cell/numeric-editable-cell.js.map +0 -1
- package/dist/editable-cell/text-editable-cell.d.ts +0 -9
- package/dist/editable-cell/text-editable-cell.d.ts.map +0 -1
- package/dist/editable-cell/text-editable-cell.js +0 -20
- package/dist/editable-cell/text-editable-cell.js.map +0 -1
- package/dist/export/export.d.ts +0 -10
- package/dist/export/export.d.ts.map +0 -1
- package/dist/export/export.js +0 -6
- package/dist/export/export.js.map +0 -1
- package/dist/export/index.d.ts +0 -2
- package/dist/export/index.d.ts.map +0 -1
- package/dist/export/index.js +0 -2
- package/dist/export/index.js.map +0 -1
- package/dist/filters/column-menu-filters.d.ts +0 -5
- package/dist/filters/column-menu-filters.d.ts.map +0 -1
- package/dist/filters/column-menu-filters.js +0 -9
- package/dist/filters/column-menu-filters.js.map +0 -1
- package/dist/filters/datetime-filter/datetime-filter.d.ts +0 -3
- package/dist/filters/datetime-filter/datetime-filter.d.ts.map +0 -1
- package/dist/filters/datetime-filter/datetime-filter.js +0 -71
- package/dist/filters/datetime-filter/datetime-filter.js.map +0 -1
- package/dist/filters/field-values-filter.d.ts +0 -6
- package/dist/filters/field-values-filter.d.ts.map +0 -1
- package/dist/filters/field-values-filter.js +0 -155
- package/dist/filters/field-values-filter.js.map +0 -1
- package/dist/filters/index.d.ts +0 -9
- package/dist/filters/index.d.ts.map +0 -1
- package/dist/filters/index.js +0 -9
- package/dist/filters/index.js.map +0 -1
- package/dist/filters/multiselect-filter.d.ts +0 -5
- package/dist/filters/multiselect-filter.d.ts.map +0 -1
- package/dist/filters/multiselect-filter.js +0 -107
- package/dist/filters/multiselect-filter.js.map +0 -1
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.d.ts +0 -6
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.d.ts.map +0 -1
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.js +0 -6
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.js.map +0 -1
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.d.ts +0 -3
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.d.ts.map +0 -1
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.js +0 -27
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.js.map +0 -1
- package/dist/filters/range-filter/range-filter.d.ts +0 -6
- package/dist/filters/range-filter/range-filter.d.ts.map +0 -1
- package/dist/filters/range-filter/range-filter.js +0 -117
- package/dist/filters/range-filter/range-filter.js.map +0 -1
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.d.ts +0 -21
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.d.ts.map +0 -1
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.js +0 -82
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.js.map +0 -1
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.d.ts +0 -6
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.d.ts.map +0 -1
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.js +0 -6
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.js.map +0 -1
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.d.ts +0 -26
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.d.ts.map +0 -1
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.js +0 -69
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.js.map +0 -1
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.d.ts +0 -6
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.d.ts.map +0 -1
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.js +0 -30
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.js.map +0 -1
- package/dist/filters/time-filter/time-filter.d.ts +0 -3
- package/dist/filters/time-filter/time-filter.d.ts.map +0 -1
- package/dist/filters/time-filter/time-filter.js +0 -71
- package/dist/filters/time-filter/time-filter.js.map +0 -1
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -9
- package/dist/index.js.map +0 -1
- package/dist/select-cell/index.d.ts +0 -2
- package/dist/select-cell/index.d.ts.map +0 -1
- package/dist/select-cell/index.js +0 -2
- package/dist/select-cell/index.js.map +0 -1
- package/dist/select-cell/select-cell.d.ts +0 -25
- package/dist/select-cell/select-cell.d.ts.map +0 -1
- package/dist/select-cell/select-cell.js +0 -35
- package/dist/select-cell/select-cell.js.map +0 -1
- package/dist/table-state.d.ts +0 -161
- package/dist/table-state.d.ts.map +0 -1
- package/dist/table-state.js +0 -1106
- package/dist/table-state.js.map +0 -1
- package/dist/table.d.ts +0 -40
- package/dist/table.d.ts.map +0 -1
- package/dist/table.js +0 -231
- package/dist/table.js.map +0 -1
@@ -1,155 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1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C,KAAK,GAAG,CAAC,CAAC;gBAE5E,WAAW,CAAC,GAAG,EAAE;oBACb,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;gBAClF,CAAC,CAAC,CAAC;YACP,CAAC;SAAA;KACJ,CAAA;IAtGe;QAAX,UAAU;;uDAAmB;IAElB;QAAX,UAAU;;8DAAkB;IAEnB;QAAT,QAAQ;;;8DAcR;IAES;QAAT,QAAQ;;;sDAQR;IAES;QAAT,QAAQ;;;sDAER;IAQD;QADC,MAAM;;0EAKL;IA7CA,qBAAqB;QAD1B,QAAQ;;OACH,qBAAqB,CAuG1B;IAED,OAAO,4BAA4B,CAAC,qBAAqB,CAAC,CAAC;AAC/D,CAAC;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"}
|
package/dist/filters/index.d.ts
DELETED
@@ -1,9 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
package/dist/filters/index.js
DELETED
@@ -1,9 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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,5 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,107 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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,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|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,6 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,27 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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,E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,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"}
|
@@ -1,6 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1,117 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"range-filter.js","sourceRoot":"","sources":["../../../src/filters/range-filter/range-filter.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAuB,MAAM,8BAA8B,CAAC;AACnF,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAoBpD,MAAM,KAAK,GAAkC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC1D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE;QACX,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,I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UAAU,EAAE,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,mBAAoB,SAAQ,mBAAyB;IACvD,YAAY,KAA2B;QACnC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,OAAa,EAAE,MAAmB;QACtC,OAAO,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,SAAS,CACpD,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,EAAE,OAAO,CAAC,EACrD,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,EAAE,OAAO,CAAC,EACrD,SAAS,EACT,IAAI,CACP,CAAC;IACN,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,4BAA4B,CAAC,sBAAsB,CAAC,CAAC;AACjG,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC,uBAAuB,CAAC,CAAC;AACnG,MAAM,CAAC,MAAM,yBAAyB,GAAG,4BAA4B,CAAC,mBAAmB,CAAC,CAAC;AAC3F,MAAM,CAAC,MAAM,yBAAyB,GAAG,4BAA4B,CAAC,mBAAmB,CAAC,CAAC"}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { ReactElement, ReactNode, FC } from 'react';
|
2
|
-
import { ListItemProps, MultiSelectTagData } from '@progress/kendo-react-dropdowns';
|
3
|
-
import { GridColumnMenuFilterCellProps as TableColumnMenuFilterCellProps } from '@progress/kendo-react-grid/dist/npm/columnMenu/GridColumnMenuFilterCell';
|
4
|
-
interface ValueWithLowerCase {
|
5
|
-
value: any;
|
6
|
-
text: string;
|
7
|
-
textLC: string;
|
8
|
-
}
|
9
|
-
export interface FilterCellExtProps extends TableColumnMenuFilterCellProps {
|
10
|
-
options: ValueWithLowerCase[];
|
11
|
-
maxFoundValues?: number;
|
12
|
-
allowCustomValues?: boolean;
|
13
|
-
onlyMultiselectAndEmptyOperators?: boolean;
|
14
|
-
handleCustomValuesAsNumber?: boolean;
|
15
|
-
multiselectItemRender?(li: ReactElement<HTMLLIElement>, itemProps: ListItemProps): ReactNode;
|
16
|
-
multiselectTagRender?(tagData: MultiSelectTagData, li: ReactElement<HTMLLIElement>): ReactElement<HTMLLIElement> | null;
|
17
|
-
multiselectListNoDataRender?(element: ReactElement<HTMLDivElement>): ReactNode;
|
18
|
-
}
|
19
|
-
export declare const FilterCellExt: FC<FilterCellExtProps>;
|
20
|
-
export {};
|
21
|
-
//# sourceMappingURL=filter-cell-ext.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"filter-cell-ext.d.ts","sourceRoot":"","sources":["../../../src/filters/standard-filter-with-multiselect/filter-cell-ext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,EAAE,EAAe,MAAM,OAAO,CAAC;AAKjE,OAAO,EAMH,aAAa,EACb,kBAAkB,EACrB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,6BAA6B,IAAI,8BAA8B,EAAE,MAAM,yEAAyE,CAAC;AAS1J,UAAU,kBAAkB;IACxB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAmB,SAAQ,8BAA8B;IACtE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,qBAAqB,CAAC,CAAC,EAAE,EAAE,YAAY,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7F,oBAAoB,CAAC,CACjB,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,YAAY,CAAC,aAAa,CAAC,GAChC,YAAY,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IACtC,2BAA2B,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;CAClF;AAGD,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAuI/C,CAAC"}
|
@@ -1,82 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { runInAction } from 'mobx';
|
3
|
-
import { observer, useLocalStore } from 'mobx-react';
|
4
|
-
import { multiselectOperators, isMultiselectOperator } from './multiselect-operators';
|
5
|
-
import { DropDownList, MultiSelect, } from '@progress/kendo-react-dropdowns';
|
6
|
-
import { IsUnaryFilter, cellOperatorChange, } from '@progress/kendo-react-grid/dist/npm/filterCommon';
|
7
|
-
import { Icon } from '@servicetitan/design-system';
|
8
|
-
import * as Styles from './filter-cell-ext.module.css';
|
9
|
-
// like standard filter cell (rendered for string type), but with support of multiselect operators
|
10
|
-
export const FilterCellExt = observer(props => {
|
11
|
-
const store = useLocalStore(oprops => ({
|
12
|
-
get operators() {
|
13
|
-
return multiselectOperators.concat(oprops.onlyMultiselectAndEmptyOperators
|
14
|
-
? oprops.operators.filter(o => o.operator === 'isempty' || o.operator === 'isnotempty')
|
15
|
-
: oprops.operators);
|
16
|
-
},
|
17
|
-
get operatorValue() {
|
18
|
-
return this.operators.find(item => item.operator === oprops.operator);
|
19
|
-
},
|
20
|
-
searchQuery: '',
|
21
|
-
filterChange(event) {
|
22
|
-
runInAction(() => (this.searchQuery = event.filter.value));
|
23
|
-
},
|
24
|
-
get filteredValuesSet() {
|
25
|
-
const queryLC = this.searchQuery.toLowerCase();
|
26
|
-
return oprops.options.filter(v => v.textLC.includes(queryLC));
|
27
|
-
},
|
28
|
-
get onlyFirstValues() {
|
29
|
-
return oprops.maxFoundValues &&
|
30
|
-
oprops.maxFoundValues < this.filteredValuesSet.length
|
31
|
-
? oprops.maxFoundValues
|
32
|
-
: false;
|
33
|
-
},
|
34
|
-
get filteredVisibleValues() {
|
35
|
-
return this.onlyFirstValues
|
36
|
-
? this.filteredValuesSet.slice(0, this.onlyFirstValues)
|
37
|
-
: this.filteredValuesSet;
|
38
|
-
},
|
39
|
-
get valueTextMap() {
|
40
|
-
return new Map(oprops.options.map(o => [o.value, o.text]));
|
41
|
-
},
|
42
|
-
get multiselectValue() {
|
43
|
-
return Array.isArray(oprops.value)
|
44
|
-
? oprops.value.map(v => {
|
45
|
-
var _a;
|
46
|
-
return ({
|
47
|
-
value: v,
|
48
|
-
text: (_a = this.valueTextMap.get(v)) !== null && _a !== void 0 ? _a : v.toString(),
|
49
|
-
});
|
50
|
-
})
|
51
|
-
: [];
|
52
|
-
},
|
53
|
-
}), props);
|
54
|
-
const { operator = '', onChange, allowCustomValues, multiselectItemRender, multiselectTagRender, multiselectListNoDataRender, } = props;
|
55
|
-
const handleInputChange = (e) => onChange({
|
56
|
-
operator,
|
57
|
-
value: e.target.value,
|
58
|
-
syntheticEvent: e,
|
59
|
-
});
|
60
|
-
const handleMultiselectChange = (e) => {
|
61
|
-
const newValue = e.value.map((v) => { var _a; return (_a = v.value) !== null && _a !== void 0 ? _a : (props.handleCustomValuesAsNumber ? +v.text : v.text); });
|
62
|
-
onChange({
|
63
|
-
operator,
|
64
|
-
value: newValue.length ? newValue : '',
|
65
|
-
syntheticEvent: e.syntheticEvent,
|
66
|
-
});
|
67
|
-
};
|
68
|
-
// conversions for better compatibility when switching plain/array operators
|
69
|
-
const handleOperatorChange = (event) => {
|
70
|
-
const newValue = isMultiselectOperator(operator) === isMultiselectOperator(event.target.value.operator)
|
71
|
-
? props.value
|
72
|
-
: '';
|
73
|
-
cellOperatorChange(event, newValue, onChange);
|
74
|
-
};
|
75
|
-
const allowCustomAdd = (allowCustomValues &&
|
76
|
-
store.searchQuery &&
|
77
|
-
(!props.handleCustomValuesAsNumber || !isNaN(+store.searchQuery))) ||
|
78
|
-
false;
|
79
|
-
return (_jsxs("div", { children: [_jsx(DropDownList, { value: store.operatorValue, onChange: handleOperatorChange, data: store.operators, textField: "text" }), (typeof operator !== 'string' || !IsUnaryFilter(operator)) &&
|
80
|
-
(isMultiselectOperator(operator) ? (_jsx(MultiSelect, { value: store.multiselectValue, onChange: handleMultiselectChange, filterable: true, onFilterChange: store.filterChange, allowCustom: allowCustomAdd, data: store.filteredVisibleValues, textField: "text", dataItemKey: "value", header: allowCustomAdd && _jsx("div", { className: Styles.customItemAddMarker }), footer: allowCustomAdd ? (_jsxs("div", Object.assign({ className: Styles.returnToUse }, { children: [_jsx(Icon, { name: "keyboard_return" }), "to create filter"] }))) : (store.onlyFirstValues && (_jsxs("div", Object.assign({ className: Styles.returnToUse }, { children: ["First ", store.onlyFirstValues, " values are shown. ", _jsx("br", {}), "Type to search for other values."] })))), itemRender: multiselectItemRender, tagRender: multiselectTagRender, listNoDataRender: multiselectListNoDataRender })) : (_jsx("input", { className: "k-textbox", value: props.value, onChange: handleInputChange })))] }));
|
81
|
-
});
|
82
|
-
//# sourceMappingURL=filter-cell-ext.js.map
|