devextreme-react
Version:
DevExtreme React UI and Visualization Components
168 lines (166 loc) • 6.33 kB
JavaScript
/*!
* devextreme-react
* Version: 24.2.6
* Build date: Mon Mar 17 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file in the root of the project for details.
*
* https://github.com/DevExpress/devextreme-react
*/
"use client";
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lookup = exports.GroupOperationDescriptions = exports.Format = exports.FilterOperationDescriptions = exports.Field = exports.CustomOperation = exports.FilterBuilder = void 0;
const React = __importStar(require("react"));
const react_1 = require("react");
const filter_builder_1 = __importDefault(require("devextreme/ui/filter_builder"));
const component_1 = require("./core/component");
const nested_option_1 = __importDefault(require("./core/nested-option"));
const FilterBuilder = (0, react_1.memo)((0, react_1.forwardRef)((props, ref) => {
const baseRef = (0, react_1.useRef)(null);
(0, react_1.useImperativeHandle)(ref, () => ({
instance() {
return baseRef.current?.getInstance();
}
}), [baseRef.current]);
const subscribableOptions = (0, react_1.useMemo)(() => (["value"]), []);
const independentEvents = (0, react_1.useMemo)(() => (["onContentReady", "onDisposing", "onEditorPrepared", "onEditorPreparing", "onInitialized", "onValueChanged"]), []);
const defaults = (0, react_1.useMemo)(() => ({
defaultValue: "value",
}), []);
const expectedChildren = (0, react_1.useMemo)(() => ({
customOperation: { optionName: "customOperations", isCollectionItem: true },
field: { optionName: "fields", isCollectionItem: true },
filterOperationDescriptions: { optionName: "filterOperationDescriptions", isCollectionItem: false },
groupOperationDescriptions: { optionName: "groupOperationDescriptions", isCollectionItem: false }
}), []);
return (React.createElement((component_1.Component), {
WidgetClass: filter_builder_1.default,
ref: baseRef,
useRequestAnimationFrameFlag: true,
subscribableOptions,
independentEvents,
defaults,
expectedChildren,
...props,
}));
}));
exports.FilterBuilder = FilterBuilder;
const _componentCustomOperation = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "customOperations",
IsCollectionItem: true,
TemplateProps: [{
tmplOption: "editorTemplate",
render: "editorRender",
component: "editorComponent"
}],
},
});
};
const CustomOperation = Object.assign(_componentCustomOperation, {
componentType: "option",
});
exports.CustomOperation = CustomOperation;
const _componentField = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "fields",
IsCollectionItem: true,
ExpectedChildren: {
format: { optionName: "format", isCollectionItem: false },
lookup: { optionName: "lookup", isCollectionItem: false }
},
TemplateProps: [{
tmplOption: "editorTemplate",
render: "editorRender",
component: "editorComponent"
}],
},
});
};
const Field = Object.assign(_componentField, {
componentType: "option",
});
exports.Field = Field;
const _componentFilterOperationDescriptions = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "filterOperationDescriptions",
},
});
};
const FilterOperationDescriptions = Object.assign(_componentFilterOperationDescriptions, {
componentType: "option",
});
exports.FilterOperationDescriptions = FilterOperationDescriptions;
const _componentFormat = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "format",
},
});
};
const Format = Object.assign(_componentFormat, {
componentType: "option",
});
exports.Format = Format;
const _componentGroupOperationDescriptions = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "groupOperationDescriptions",
},
});
};
const GroupOperationDescriptions = Object.assign(_componentGroupOperationDescriptions, {
componentType: "option",
});
exports.GroupOperationDescriptions = GroupOperationDescriptions;
const _componentLookup = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "lookup",
},
});
};
const Lookup = Object.assign(_componentLookup, {
componentType: "option",
});
exports.Lookup = Lookup;
exports.default = FilterBuilder;