@servicetitan/table 19.1.0 → 20.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/demo/index.js +3 -15
- package/dist/demo/index.js.map +1 -1
- package/dist/demo/master-detail/detail-table.js +15 -18
- package/dist/demo/master-detail/detail-table.js.map +1 -1
- package/dist/demo/master-detail/detail-table.store.js +14 -17
- package/dist/demo/master-detail/detail-table.store.js.map +1 -1
- package/dist/demo/master-detail/index.js +1 -13
- package/dist/demo/master-detail/index.js.map +1 -1
- package/dist/demo/master-detail/master-table.store.js +14 -17
- package/dist/demo/master-detail/master-table.store.js.map +1 -1
- package/dist/demo/master-detail/product-detail.js +1 -2
- package/dist/demo/master-detail/product-details.js +1 -4
- package/dist/demo/master-detail/product-details.js.map +1 -1
- package/dist/demo/master-detail/product.js +4 -7
- package/dist/demo/master-detail/product.js.map +1 -1
- package/dist/demo/master-detail/products.js +15 -18
- package/dist/demo/master-detail/products.js.map +1 -1
- package/dist/demo/master-detail/table-master-detail.js +13 -16
- package/dist/demo/master-detail/table-master-detail.js.map +1 -1
- package/dist/demo/overview/actions-cell.js +8 -11
- package/dist/demo/overview/actions-cell.js.map +1 -1
- package/dist/demo/overview/index.js +1 -13
- package/dist/demo/overview/index.js.map +1 -1
- package/dist/demo/overview/product.js +4 -7
- package/dist/demo/overview/product.js.map +1 -1
- package/dist/demo/overview/products.js +15 -18
- package/dist/demo/overview/products.js.map +1 -1
- package/dist/demo/overview/table.js +24 -27
- package/dist/demo/overview/table.js.map +1 -1
- package/dist/demo/overview/table.store.js +27 -30
- package/dist/demo/overview/table.store.js.map +1 -1
- package/dist/demo/state-caching/beverages.js +1 -4
- package/dist/demo/state-caching/beverages.js.map +1 -1
- package/dist/demo/state-caching/index.js +1 -13
- package/dist/demo/state-caching/index.js.map +1 -1
- package/dist/demo/state-caching/product.js +1 -2
- package/dist/demo/state-caching/products.js +1 -4
- package/dist/demo/state-caching/products.js.map +1 -1
- package/dist/demo/state-caching/state-caching-table.js +12 -15
- package/dist/demo/state-caching/state-caching-table.js.map +1 -1
- package/dist/demo/state-caching/state-caching-table.store.js +9 -12
- package/dist/demo/state-caching/state-caching-table.store.js.map +1 -1
- package/dist/editable-cell/boolean-editable-cell.js +7 -10
- package/dist/editable-cell/boolean-editable-cell.js.map +1 -1
- package/dist/editable-cell/date-editable-cell.js +7 -10
- package/dist/editable-cell/date-editable-cell.js.map +1 -1
- package/dist/editable-cell/get-action-cell.js +6 -10
- package/dist/editable-cell/get-action-cell.js.map +1 -1
- package/dist/editable-cell/get-editable-cell.js +6 -10
- package/dist/editable-cell/get-editable-cell.js.map +1 -1
- package/dist/editable-cell/get-select-editable-cell.js +9 -16
- package/dist/editable-cell/get-select-editable-cell.js.map +1 -1
- package/dist/editable-cell/index.js +7 -19
- package/dist/editable-cell/index.js.map +1 -1
- package/dist/editable-cell/numeric-editable-cell.js +7 -10
- package/dist/editable-cell/numeric-editable-cell.js.map +1 -1
- package/dist/editable-cell/text-editable-cell.js +10 -14
- package/dist/editable-cell/text-editable-cell.js.map +1 -1
- package/dist/export/export.js +5 -28
- package/dist/export/export.js.map +1 -1
- package/dist/export/index.js +1 -13
- package/dist/export/index.js.map +1 -1
- package/dist/filters/column-menu-filters.js +7 -12
- package/dist/filters/column-menu-filters.js.map +1 -1
- package/dist/filters/datetime-filter/datetime-filter.js +17 -39
- package/dist/filters/datetime-filter/datetime-filter.js.map +1 -1
- package/dist/filters/field-values-filter.js +21 -26
- package/dist/filters/field-values-filter.js.map +1 -1
- package/dist/filters/index.js +8 -20
- package/dist/filters/index.js.map +1 -1
- package/dist/filters/multiselect-filter.js +17 -23
- package/dist/filters/multiselect-filter.js.map +1 -1
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.js +2 -6
- package/dist/filters/numeric-filter-extended/numeric-extended-operators.js.map +1 -1
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.js +13 -16
- package/dist/filters/numeric-filter-extended/numeric-filter-extended.js.map +1 -1
- package/dist/filters/range-filter/range-filter.js +20 -45
- package/dist/filters/range-filter/range-filter.js.map +1 -1
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.js +16 -38
- package/dist/filters/standard-filter-with-multiselect/filter-cell-ext.js.map +1 -1
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.js +2 -6
- package/dist/filters/standard-filter-with-multiselect/multiselect-operators.js.map +1 -1
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.js +12 -16
- package/dist/filters/standard-filter-with-multiselect/standard-filter-with-multiselect.js.map +1 -1
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.js +8 -12
- package/dist/filters/standard-filter-with-multiselect/table-column-menu-filter-ext.js.map +1 -1
- package/dist/filters/time-filter/time-filter.js +17 -39
- package/dist/filters/time-filter/time-filter.js.map +1 -1
- package/dist/index.js +8 -29
- package/dist/index.js.map +1 -1
- package/dist/select-cell/index.js +1 -13
- package/dist/select-cell/index.js.map +1 -1
- package/dist/select-cell/select-cell.js +10 -35
- package/dist/select-cell/select-cell.js.map +1 -1
- package/dist/table-state.d.ts +1 -1
- package/dist/table-state.d.ts.map +1 -1
- package/dist/table-state.js +64 -69
- package/dist/table-state.js.map +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +38 -60
- package/dist/table.js.map +1 -1
- package/package.json +16 -15
- package/src/table-state.ts +2 -2
- package/src/table.tsx +3 -0
@@ -1,22 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
5
|
-
const design_system_1 = require("@servicetitan/design-system");
|
6
|
-
function getActionCell({ view: ViewAction, edit: EditAction }) {
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { TableCell } from '@servicetitan/design-system';
|
3
|
+
export function getActionCell({ view: ViewAction, edit: EditAction }) {
|
7
4
|
return (props) => {
|
8
5
|
var _a;
|
9
6
|
const { tableState, dataItem, rowType } = props;
|
10
7
|
if (rowType !== 'data') {
|
11
|
-
return (
|
8
|
+
return _jsx(TableCell, Object.assign({}, props), void 0);
|
12
9
|
}
|
13
10
|
const editingForm = ((_a = tableState === null || tableState === void 0 ? void 0 : tableState.dataSource) === null || _a === void 0 ? void 0 : _a.idSelector) &&
|
14
11
|
tableState.inEdit.get(tableState.dataSource.idSelector(dataItem));
|
15
12
|
if (editingForm) {
|
16
|
-
return (
|
13
|
+
return _jsx(EditAction, Object.assign({}, props, { formState: editingForm.form }), void 0);
|
17
14
|
}
|
18
|
-
return (
|
15
|
+
return _jsx(ViewAction, Object.assign({}, props), void 0);
|
19
16
|
};
|
20
17
|
}
|
21
|
-
exports.getActionCell = getActionCell;
|
22
18
|
//# sourceMappingURL=get-action-cell.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"get-action-cell.js","sourceRoot":"","sources":["../../src/editable-cell/get-action-cell.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"get-action-cell.js","sourceRoot":"","sources":["../../src/editable-cell/get-action-cell.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAcxD,MAAM,UAAU,aAAa,CAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAA0B;IAC3F,OAAO,CAAC,KAAwB,EAAE,EAAE;;QAChC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;QAEhD,IAAI,OAAO,KAAK,MAAM,EAAE;YACpB,OAAO,KAAC,SAAS,oBAAK,KAAK,UAAI,CAAC;SACnC;QAED,MAAM,WAAW,GACb,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,0CAAE,UAAU;YAClC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEtE,IAAI,WAAW,EAAE;YACb,OAAO,KAAC,UAAU,oBAAK,KAAK,IAAE,SAAS,EAAE,WAAW,CAAC,IAAI,YAAI,CAAC;SACjE;QAED,OAAO,KAAC,UAAU,oBAAK,KAAK,UAAI,CAAC;IACrC,CAAC,CAAC;AACN,CAAC"}
|
@@ -1,22 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
5
|
-
const design_system_1 = require("@servicetitan/design-system");
|
6
|
-
function getEditableCell({ viewer: Viewer = design_system_1.TableCell, editor: Editor, }) {
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { TableCell } from '@servicetitan/design-system';
|
3
|
+
export function getEditableCell({ viewer: Viewer = TableCell, editor: Editor, }) {
|
7
4
|
return (props) => {
|
8
5
|
var _a;
|
9
6
|
const { tableState, field, dataItem, rowType } = props;
|
10
7
|
if (rowType !== 'data') {
|
11
|
-
return (
|
8
|
+
return _jsx(TableCell, Object.assign({}, props), void 0);
|
12
9
|
}
|
13
10
|
const editingForm = ((_a = tableState === null || tableState === void 0 ? void 0 : tableState.dataSource) === null || _a === void 0 ? void 0 : _a.idSelector) &&
|
14
11
|
tableState.inEdit.get(tableState.dataSource.idSelector(dataItem));
|
15
12
|
if (field && editingForm && (!editingForm.field || editingForm.field === field)) {
|
16
|
-
return (
|
13
|
+
return _jsx(Editor, Object.assign({}, props, { fieldState: editingForm.form.$[field] }), void 0);
|
17
14
|
}
|
18
|
-
return (
|
15
|
+
return _jsx(Viewer, Object.assign({}, props), void 0);
|
19
16
|
};
|
20
17
|
}
|
21
|
-
exports.getEditableCell = getEditableCell;
|
22
18
|
//# sourceMappingURL=get-editable-cell.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"get-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/get-editable-cell.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"get-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/get-editable-cell.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAYxD,MAAM,UAAU,eAAe,CAAI,EAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,MAAM,GACS;IACvB,OAAO,CAAC,KAA0B,EAAE,EAAE;;QAClC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;QAEvD,IAAI,OAAO,KAAK,MAAM,EAAE;YACpB,OAAO,KAAC,SAAS,oBAAK,KAAK,UAAI,CAAC;SACnC;QAED,MAAM,WAAW,GACb,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,0CAAE,UAAU;YAClC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEtE,IAAI,KAAK,IAAI,WAAW,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,KAAK,KAAK,CAAC,EAAE;YAC7E,OAAO,KAAC,MAAM,oBAAK,KAAK,IAAE,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,YAAI,CAAC;SACvE;QAED,OAAO,KAAC,MAAM,oBAAK,KAAK,UAAI,CAAC;IACjC,CAAC,CAAC;AACN,CAAC"}
|
@@ -1,26 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
};
|
5
|
-
|
6
|
-
|
7
|
-
const
|
8
|
-
const mobx_react_1 = require("mobx-react");
|
9
|
-
const kendo_react_dropdowns_1 = require("@progress/kendo-react-dropdowns");
|
10
|
-
const get_editable_cell_1 = require("./get-editable-cell");
|
11
|
-
const classnames_1 = __importDefault(require("classnames"));
|
12
|
-
function getSelectEditableCell({ options, viewer }) {
|
13
|
-
const Editor = (0, mobx_react_1.observer)(({ fieldState: { value, onChange, hasError, error }, className }) => {
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { observer } from 'mobx-react';
|
3
|
+
import { DropDownList } from '@progress/kendo-react-dropdowns';
|
4
|
+
import { getEditableCell } from './get-editable-cell';
|
5
|
+
import classNames from 'classnames';
|
6
|
+
export function getSelectEditableCell({ options, viewer }) {
|
7
|
+
const Editor = observer(({ fieldState: { value, onChange, hasError, error }, className }) => {
|
14
8
|
const selected = options.find(option => option.value === value);
|
15
9
|
const handleChange = (event) => {
|
16
10
|
onChange(event.target.value.value);
|
17
11
|
};
|
18
|
-
return ((
|
12
|
+
return (_jsx("td", Object.assign({ className: classNames('of-visible', className) }, { children: _jsx(DropDownList, { data: options, value: selected, onChange: handleChange, dataItemKey: "value", textField: "text", valid: !hasError, validationMessage: error, className: "w-100" }, void 0) }), void 0));
|
19
13
|
});
|
20
|
-
return
|
14
|
+
return getEditableCell({
|
21
15
|
viewer,
|
22
16
|
editor: Editor,
|
23
17
|
});
|
24
18
|
}
|
25
|
-
exports.getSelectEditableCell = getSelectEditableCell;
|
26
19
|
//# sourceMappingURL=get-select-editable-cell.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"get-select-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/get-select-editable-cell.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"get-select-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/get-select-editable-cell.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,YAAY,EAA2B,MAAM,iCAAiC,CAAC;AAGxF,OAAO,EAAE,eAAe,EAAe,MAAM,qBAAqB,CAAC;AAInE,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,MAAM,UAAU,qBAAqB,CAAI,EAAE,OAAO,EAAE,MAAM,EAAkC;IACxF,MAAM,MAAM,GAAG,QAAQ,CACnB,CAAC,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;QAChE,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QAEhE,MAAM,YAAY,GAAG,CAAC,KAA8B,EAAE,EAAE;YACpD,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC,CAAC;QAEF,OAAO,CACH,2BAAI,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,SAAS,CAAC,gBAC9C,KAAC,YAAY,IACT,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAC,OAAO,EACnB,SAAS,EAAC,MAAM,EAChB,KAAK,EAAE,CAAC,QAAQ,EAChB,iBAAiB,EAAE,KAAK,EACxB,SAAS,EAAC,OAAO,WACnB,YACD,CACR,CAAC;IACN,CAAC,CACJ,CAAC;IAEF,OAAO,eAAe,CAAC;QACnB,MAAM;QACN,MAAM,EAAE,MAAM;KACjB,CAAC,CAAC;AACP,CAAC"}
|
@@ -1,20 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
}));
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11
|
-
};
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
13
|
-
__exportStar(require("./get-action-cell"), exports);
|
14
|
-
__exportStar(require("./get-editable-cell"), exports);
|
15
|
-
__exportStar(require("./text-editable-cell"), exports);
|
16
|
-
__exportStar(require("./numeric-editable-cell"), exports);
|
17
|
-
__exportStar(require("./boolean-editable-cell"), exports);
|
18
|
-
__exportStar(require("./date-editable-cell"), exports);
|
19
|
-
__exportStar(require("./get-select-editable-cell"), exports);
|
1
|
+
export * from './get-action-cell';
|
2
|
+
export * from './get-editable-cell';
|
3
|
+
export * from './text-editable-cell';
|
4
|
+
export * from './numeric-editable-cell';
|
5
|
+
export * from './boolean-editable-cell';
|
6
|
+
export * from './date-editable-cell';
|
7
|
+
export * from './get-select-editable-cell';
|
20
8
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/editable-cell/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/editable-cell/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC"}
|
@@ -1,18 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const
|
6
|
-
const kendo_react_inputs_1 = require("@progress/kendo-react-inputs");
|
7
|
-
const get_editable_cell_1 = require("./get-editable-cell");
|
8
|
-
const Editor = (0, mobx_react_1.observer)(({ fieldState: { value, onChange, hasError, error }, className }) => {
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { observer } from 'mobx-react';
|
3
|
+
import { NumericTextBox } from '@progress/kendo-react-inputs';
|
4
|
+
import { getEditableCell } from './get-editable-cell';
|
5
|
+
const Editor = observer(({ fieldState: { value, onChange, hasError, error }, className }) => {
|
9
6
|
const handleChange = (event) => {
|
10
7
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
11
8
|
onChange(event.value || undefined);
|
12
9
|
};
|
13
|
-
return ((
|
10
|
+
return (_jsx("td", Object.assign({ className: className }, { children: _jsx(NumericTextBox, { value: value, onChange: handleChange, valid: !hasError, validationMessage: error }, void 0) }), void 0));
|
14
11
|
});
|
15
|
-
|
12
|
+
export const NumericEditableCell = getEditableCell({
|
16
13
|
editor: Editor,
|
17
14
|
});
|
18
15
|
//# sourceMappingURL=numeric-editable-cell.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"numeric-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/numeric-editable-cell.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"numeric-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/numeric-editable-cell.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,cAAc,EAA6B,MAAM,8BAA8B,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAe,MAAM,qBAAqB,CAAC;AAEnE,MAAM,MAAM,GAAG,QAAQ,CACnB,CAAC,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IAChE,MAAM,YAAY,GAAG,CAAC,KAAgC,EAAE,EAAE;QACtD,wEAAwE;QACxE,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC;IACvC,CAAC,CAAC;IAEF,OAAO,CACH,2BAAI,SAAS,EAAE,SAAS,gBACpB,KAAC,cAAc,IACX,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,CAAC,QAAQ,EAChB,iBAAiB,EAAE,KAAK,WAC1B,YACD,CACR,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;IAC/C,MAAM,EAAE,MAAM;CACjB,CAAC,CAAC"}
|
@@ -1,24 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const
|
8
|
-
const form_1 = require("@servicetitan/form");
|
9
|
-
function getTextEditableCell({ placeholder, isDisabled, } = {}) {
|
10
|
-
const Editor = (0, mobx_react_1.observer)(({ fieldState: { value, onChange, hasError, error }, dataItem, className }) => {
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { observer } from 'mobx-react';
|
3
|
+
import { Input } from '@progress/kendo-react-inputs';
|
4
|
+
import { getEditableCell } from './get-editable-cell';
|
5
|
+
import { Label } from '@servicetitan/form';
|
6
|
+
export function getTextEditableCell({ placeholder, isDisabled, } = {}) {
|
7
|
+
const Editor = observer(({ fieldState: { value, onChange, hasError, error }, dataItem, className }) => {
|
11
8
|
const handleChange = (event) => {
|
12
9
|
if (typeof event.target.value === 'string') {
|
13
10
|
onChange(event.target.value);
|
14
11
|
}
|
15
12
|
};
|
16
|
-
return ((
|
13
|
+
return (_jsxs("td", Object.assign({ className: className }, { children: [_jsx(Input, { value: value, onChange: handleChange, valid: !hasError, placeholder: placeholder, disabled: isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled(dataItem) }, void 0), hasError && _jsx(Label, { label: "", hasError: true, error: error }, void 0)] }), void 0));
|
17
14
|
});
|
18
|
-
return
|
15
|
+
return getEditableCell({
|
19
16
|
editor: Editor,
|
20
17
|
});
|
21
18
|
}
|
22
|
-
|
23
|
-
exports.TextEditableCell = getTextEditableCell();
|
19
|
+
export const TextEditableCell = getTextEditableCell();
|
24
20
|
//# sourceMappingURL=text-editable-cell.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"text-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/text-editable-cell.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"text-editable-cell.js","sourceRoot":"","sources":["../../src/editable-cell/text-editable-cell.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAoB,MAAM,8BAA8B,CAA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setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
-
}) : function(o, v) {
|
12
|
-
o["default"] = v;
|
13
|
-
});
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
15
|
-
if (mod && mod.__esModule) return mod;
|
16
|
-
var result = {};
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
18
|
-
__setModuleDefault(result, mod);
|
19
|
-
return result;
|
20
|
-
};
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
22
|
-
exports.Export = void 0;
|
23
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
24
|
-
const design_system_1 = require("@servicetitan/design-system");
|
25
|
-
const accounting_1 = require("accounting");
|
26
|
-
const Styles = __importStar(require("./export.module.css"));
|
27
|
-
const Export = ({ className, totalCount, exportPdf, exportExcel }) => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: className }, { children: (0, jsx_runtime_1.jsx)(design_system_1.Dropdown, Object.assign({ trigger: (0, jsx_runtime_1.jsxs)(design_system_1.Button, Object.assign({ className: "qa-export-dropdown", iconName: "expand_more", iconPosition: "right" }, { children: [(0, jsx_runtime_1.jsx)(design_system_1.Icon, { name: "file_download" }, void 0), (0, jsx_runtime_1.jsxs)("span", { children: ["Download", !!totalCount && ` (${(0, accounting_1.formatNumber)(totalCount, 0)})`] }, void 0)] }), void 0), icon: null }, { children: (0, jsx_runtime_1.jsxs)(design_system_1.Dropdown.Menu, Object.assign({ className: Styles.dropdown }, { children: [exportPdf && ((0, jsx_runtime_1.jsx)(design_system_1.Dropdown.Item, { className: "qa-export-pdf", text: ".PDF", onClick: exportPdf }, void 0)), exportExcel && ((0, jsx_runtime_1.jsx)(design_system_1.Dropdown.Item, { className: "qa-export-excel", text: ".XLSX", onClick: exportExcel }, void 0))] }), void 0) }), void 0) }), void 0));
|
28
|
-
exports.Export = Export;
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Button, Dropdown, Icon } from '@servicetitan/design-system';
|
3
|
+
import { formatNumber } from 'accounting';
|
4
|
+
import * as Styles from './export.module.css';
|
5
|
+
export const Export = ({ className, totalCount, exportPdf, exportExcel }) => (_jsx("div", Object.assign({ className: className }, { children: _jsx(Dropdown, Object.assign({ trigger: _jsxs(Button, Object.assign({ className: "qa-export-dropdown", iconName: "expand_more", iconPosition: "right" }, { children: [_jsx(Icon, { name: "file_download" }, void 0), _jsxs("span", { children: ["Download", !!totalCount && ` (${formatNumber(totalCount, 0)})`] }, void 0)] }), void 0), icon: null }, { children: _jsxs(Dropdown.Menu, Object.assign({ className: Styles.dropdown }, { children: [exportPdf && (_jsx(Dropdown.Item, { className: "qa-export-pdf", text: ".PDF", onClick: exportPdf }, void 0)), exportExcel && (_jsx(Dropdown.Item, { className: "qa-export-excel", text: ".XLSX", onClick: exportExcel }, void 0))] }), void 0) }), void 0) }), void 0));
|
29
6
|
//# sourceMappingURL=export.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/export/export.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/export/export.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAS9C,MAAM,CAAC,MAAM,MAAM,GAAoB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAC1F,4BAAK,SAAS,EAAE,SAAS,gBACrB,KAAC,QAAQ,kBACL,OAAO,EACH,MAAC,MAAM,kBAAC,SAAS,EAAC,oBAAoB,EAAC,QAAQ,EAAC,aAAa,EAAC,YAAY,EAAC,OAAO,iBAC9E,KAAC,IAAI,IAAC,IAAI,EAAC,eAAe,WAAG,EAC7B,uCAAe,CAAC,CAAC,UAAU,IAAI,KAAK,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,YAAQ,aACrE,EAEb,IAAI,EAAE,IAAI,gBAEV,MAAC,QAAQ,CAAC,IAAI,kBAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,iBACpC,SAAS,IAAI,CACV,KAAC,QAAQ,CAAC,IAAI,IAAC,SAAS,EAAC,eAAe,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAE,SAAS,WAAI,CAC9E,EACA,WAAW,IAAI,CACZ,KAAC,QAAQ,CAAC,IAAI,IAAC,SAAS,EAAC,iBAAiB,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAE,WAAW,WAAI,CACnF,aACW,YACT,YACT,CACT,CAAC"}
|
package/dist/export/index.js
CHANGED
@@ -1,14 +1,2 @@
|
|
1
|
-
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11
|
-
};
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
13
|
-
__exportStar(require("./export"), exports);
|
1
|
+
export * from './export';
|
14
2
|
//# sourceMappingURL=index.js.map
|
package/dist/export/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/export/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/export/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
@@ -1,14 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const
|
5
|
-
|
6
|
-
const
|
7
|
-
|
8
|
-
exports.StandardColumnMenuFilter = StandardColumnMenuFilter;
|
9
|
-
function renderCustomColumnMenuFilter(FilterCell, double) {
|
10
|
-
const filterUI = ({ firstFilterProps, secondFilterProps, logicData, logicValue, onLogicChange, }) => ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(FilterCell, Object.assign({}, firstFilterProps), void 0), double && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(kendo_react_dropdowns_1.DropDownList, { data: logicData, value: logicValue, onChange: onLogicChange, className: "k-filter-and", textField: "text" }, void 0), (0, jsx_runtime_1.jsx)(FilterCell, Object.assign({}, secondFilterProps), void 0)] }, void 0))] }, void 0));
|
11
|
-
return (props) => ((0, jsx_runtime_1.jsx)(design_system_1.TableColumnMenuFilter, Object.assign({}, props, { filterUI: filterUI, expanded: true }), void 0));
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { TableColumnMenuFilter, } from '@servicetitan/design-system';
|
3
|
+
import { DropDownList } from '@progress/kendo-react-dropdowns';
|
4
|
+
export const StandardColumnMenuFilter = (props) => (_jsx(TableColumnMenuFilter, Object.assign({}, props, { expanded: true }), void 0));
|
5
|
+
export function renderCustomColumnMenuFilter(FilterCell, double) {
|
6
|
+
const filterUI = ({ firstFilterProps, secondFilterProps, logicData, logicValue, onLogicChange, }) => (_jsxs("div", { children: [_jsx(FilterCell, Object.assign({}, firstFilterProps), void 0), double && (_jsxs("div", { children: [_jsx(DropDownList, { data: logicData, value: logicValue, onChange: onLogicChange, className: "k-filter-and", textField: "text" }, void 0), _jsx(FilterCell, Object.assign({}, secondFilterProps), void 0)] }, void 0))] }, void 0));
|
7
|
+
return (props) => (_jsx(TableColumnMenuFilter, Object.assign({}, props, { filterUI: filterUI, expanded: true }), void 0));
|
12
8
|
}
|
13
|
-
exports.renderCustomColumnMenuFilter = renderCustomColumnMenuFilter;
|
14
9
|
//# sourceMappingURL=column-menu-filters.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"column-menu-filters.js","sourceRoot":"","sources":["../../src/filters/column-menu-filters.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"column-menu-filters.js","sourceRoot":"","sources":["../../src/filters/column-menu-filters.tsx"],"names":[],"mappings":";AACA,OAAO,EACH,qBAAqB,GAGxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAA2B,EAAE,EAAE,CAAC,CACrE,KAAC,qBAAqB,oBAAK,KAAK,IAAE,QAAQ,kBAAG,CAChD,CAAC;AAEF,MAAM,UAAU,4BAA4B,CACxC,UAA+C,EAC/C,MAAgB;IAEhB,MAAM,QAAQ,GAAqC,CAAC,EAChD,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,aAAa,GAChB,EAAE,EAAE,CAAC,CACF,0BACI,KAAC,UAAU,oBAAK,gBAAgB,UAAI,EACnC,MAAM,IAAI,CACP,0BACI,KAAC,YAAY,IACT,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAC,cAAc,EACxB,SAAS,EAAC,MAAM,WAClB,EACF,KAAC,UAAU,oBAAK,iBAAiB,UAAI,YACnC,CACT,YACC,CACT,CAAC;IAEF,OAAO,CAAC,KAA2B,EAAE,EAAE,CAAC,CACpC,KAAC,qBAAqB,oBAAK,KAAK,IAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,kBAAG,CACpE,CAAC;AACN,CAAC"}
|
@@ -1,44 +1,22 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
-
}) : (function(o, m, k, k2) {
|
6
|
-
if (k2 === undefined) k2 = k;
|
7
|
-
o[k2] = m[k];
|
8
|
-
}));
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
11
|
-
}) : function(o, v) {
|
12
|
-
o["default"] = v;
|
13
|
-
});
|
14
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
15
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
16
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
17
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;
|
18
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
19
6
|
};
|
20
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
21
|
-
if (mod && mod.__esModule) return mod;
|
22
|
-
var result = {};
|
23
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
24
|
-
__setModuleDefault(result, mod);
|
25
|
-
return result;
|
26
|
-
};
|
27
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
28
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
29
9
|
};
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
const Styles = __importStar(require("./datetime-filter.module.css"));
|
41
|
-
let DateTimeFilterCell = class DateTimeFilterCell extends react_1.Component {
|
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 {
|
42
20
|
constructor(props) {
|
43
21
|
var _a;
|
44
22
|
super(props);
|
@@ -54,7 +32,7 @@ let DateTimeFilterCell = class DateTimeFilterCell extends react_1.Component {
|
|
54
32
|
writable: true,
|
55
33
|
value: (event) => {
|
56
34
|
this.operator = event.target.value;
|
57
|
-
|
35
|
+
cellOperatorChange(event, this.props.value, this.props.onChange);
|
58
36
|
}
|
59
37
|
});
|
60
38
|
Object.defineProperty(this, "handleChange", {
|
@@ -71,23 +49,23 @@ let DateTimeFilterCell = class DateTimeFilterCell extends react_1.Component {
|
|
71
49
|
});
|
72
50
|
}
|
73
51
|
});
|
74
|
-
|
52
|
+
makeObservable(this);
|
75
53
|
}
|
76
54
|
render() {
|
77
|
-
return ((
|
55
|
+
return (_jsxs(Fragment, { children: [_jsx(DropDownList, { value: this.operator, onChange: this.handleOperatorChange, data: this.props.operators, dataItemKey: "operator", textField: "text" }, void 0), !IsUnaryFilter(this.operator.operator) && (_jsxs(Fragment, { children: [_jsx(DatePicker, { value: this.props.value, onChange: this.handleChange, className: Styles.datePicker }, void 0), _jsx(TimePicker, { value: this.props.value, onChange: this.handleChange, className: Styles.timePicker }, void 0)] }, void 0))] }, void 0));
|
78
56
|
}
|
79
57
|
};
|
80
58
|
__decorate([
|
81
|
-
|
59
|
+
observable,
|
82
60
|
__metadata("design:type", Object)
|
83
61
|
], DateTimeFilterCell.prototype, "operator", void 0);
|
84
62
|
__decorate([
|
85
|
-
|
63
|
+
action,
|
86
64
|
__metadata("design:type", Object)
|
87
65
|
], DateTimeFilterCell.prototype, "handleOperatorChange", void 0);
|
88
66
|
DateTimeFilterCell = __decorate([
|
89
|
-
|
67
|
+
observer,
|
90
68
|
__metadata("design:paramtypes", [Object])
|
91
69
|
], DateTimeFilterCell);
|
92
|
-
|
70
|
+
export const DateTimeColumnMenuFilter = renderCustomColumnMenuFilter(DateTimeFilterCell, true);
|
93
71
|
//# sourceMappingURL=datetime-filter.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"datetime-filter.js","sourceRoot":"","sources":["../../../src/filters/datetime-filter/datetime-filter.tsx"],"names":[],"mappings":"
|
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+B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AC,KAAK,CAAC,KAAK,EACvB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,SAAS,EAAE,MAAM,CAAC,UAAU,WAC9B,EACF,KAAC,UAAU,IACP,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,QAAQ,EAAE,IAAI,CAAC,YAAY,EAC3B,SAAS,EAAE,MAAM,CAAC,UAAU,WAC9B,YACK,CACd,YACM,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"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
@@ -17,21 +16,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
17
16
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18
17
|
});
|
19
18
|
};
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
const column_menu_filters_1 = require("./column-menu-filters");
|
29
|
-
function operator(item, value) {
|
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) {
|
30
27
|
return value.includes(item);
|
31
28
|
}
|
32
|
-
|
33
|
-
|
34
|
-
let FieldValuesFilterCell = class FieldValuesFilterCell extends react_1.Component {
|
29
|
+
export function fieldValuesColumnMenuFilter(tableState, renderItem = defaultRenderItem) {
|
30
|
+
let FieldValuesFilterCell = class FieldValuesFilterCell extends Component {
|
35
31
|
constructor(props) {
|
36
32
|
super(props);
|
37
33
|
Object.defineProperty(this, "data", {
|
@@ -72,7 +68,7 @@ function fieldValuesColumnMenuFilter(tableState, renderItem = defaultRenderItem)
|
|
72
68
|
});
|
73
69
|
}
|
74
70
|
});
|
75
|
-
|
71
|
+
makeObservable(this);
|
76
72
|
}
|
77
73
|
get processedData() {
|
78
74
|
const searchQuery = this.searchQuery.toLowerCase();
|
@@ -100,7 +96,7 @@ function fieldValuesColumnMenuFilter(tableState, renderItem = defaultRenderItem)
|
|
100
96
|
this.fetchData(tableState.dataSource);
|
101
97
|
}
|
102
98
|
render() {
|
103
|
-
return ((
|
99
|
+
return (_jsxs(Fragment, { children: [_jsx(Input, { value: this.searchQuery, onChange: this.handleSearchQueryChange, placeholder: "Search" }, void 0), 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 }, void 0) }), JSON.stringify(item))))] }, void 0));
|
104
100
|
}
|
105
101
|
fetchData(dataSource) {
|
106
102
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -110,46 +106,45 @@ function fieldValuesColumnMenuFilter(tableState, renderItem = defaultRenderItem)
|
|
110
106
|
const items = (yield dataSource.getData({})).data;
|
111
107
|
const values = items.map(i => i[this.field]);
|
112
108
|
const distinctValues = values.filter((v, idx) => values.indexOf(v) === idx);
|
113
|
-
|
109
|
+
runInAction(() => {
|
114
110
|
this.data = distinctValues.map(value => ({ value, text: renderItem(value) }));
|
115
111
|
});
|
116
112
|
});
|
117
113
|
}
|
118
114
|
};
|
119
115
|
__decorate([
|
120
|
-
|
116
|
+
observable,
|
121
117
|
__metadata("design:type", Array)
|
122
118
|
], FieldValuesFilterCell.prototype, "data", void 0);
|
123
119
|
__decorate([
|
124
|
-
|
120
|
+
observable,
|
125
121
|
__metadata("design:type", Object)
|
126
122
|
], FieldValuesFilterCell.prototype, "searchQuery", void 0);
|
127
123
|
__decorate([
|
128
|
-
|
124
|
+
computed,
|
129
125
|
__metadata("design:type", Object),
|
130
126
|
__metadata("design:paramtypes", [])
|
131
127
|
], FieldValuesFilterCell.prototype, "processedData", null);
|
132
128
|
__decorate([
|
133
|
-
|
129
|
+
computed,
|
134
130
|
__metadata("design:type", Object),
|
135
131
|
__metadata("design:paramtypes", [])
|
136
132
|
], FieldValuesFilterCell.prototype, "field", null);
|
137
133
|
__decorate([
|
138
|
-
|
134
|
+
computed,
|
139
135
|
__metadata("design:type", Array),
|
140
136
|
__metadata("design:paramtypes", [])
|
141
137
|
], FieldValuesFilterCell.prototype, "value", null);
|
142
138
|
__decorate([
|
143
|
-
|
139
|
+
action,
|
144
140
|
__metadata("design:type", Object)
|
145
141
|
], FieldValuesFilterCell.prototype, "handleSearchQueryChange", void 0);
|
146
142
|
FieldValuesFilterCell = __decorate([
|
147
|
-
|
143
|
+
observer,
|
148
144
|
__metadata("design:paramtypes", [Object])
|
149
145
|
], FieldValuesFilterCell);
|
150
|
-
return
|
146
|
+
return renderCustomColumnMenuFilter(FieldValuesFilterCell);
|
151
147
|
}
|
152
|
-
exports.fieldValuesColumnMenuFilter = fieldValuesColumnMenuFilter;
|
153
148
|
function defaultRenderItem(v) {
|
154
149
|
if (v == null) {
|
155
150
|
return '';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"field-values-filter.js","sourceRoot":"","sources":["../../src/filters/field-values-filter.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"field-values-filter.js","sourceRoot":"","sources":["../../src/filters/field-values-filter.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