devextreme-react
Version:
DevExtreme React UI and Visualization Components
787 lines (785 loc) • 29.1 kB
JavaScript
/*!
* devextreme-react
* Version: 25.2.3
* Build date: Fri Dec 12 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";
"use strict";
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.View = exports.ValidationRule = exports.ToolbarItem = exports.Toolbar = exports.TabPanelOptionsItem = exports.TabPanelOptions = exports.TabbedItem = exports.Tab = exports.StringLengthRule = exports.SimpleItem = exports.Scrolling = exports.Resource = exports.RequiredRule = exports.RangeRule = exports.PatternRule = exports.OptionsItem = exports.Options = exports.NumericRule = exports.Label = exports.Item = exports.GroupItem = exports.Form = exports.EmptyItem = exports.EmailRule = exports.Editing = exports.CustomRule = exports.CompareRule = exports.ColCountByScreen = exports.ButtonOptions = exports.ButtonItem = exports.AsyncRule = exports.AppointmentDragging = exports.AIOptions = exports.Scheduler = void 0;
const React = __importStar(require("react"));
const react_1 = require("react");
const scheduler_1 = __importDefault(require("devextreme/ui/scheduler"));
const component_1 = require("./core/component");
const nested_option_1 = __importDefault(require("./core/nested-option"));
const Scheduler = (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();
}
}), []);
const subscribableOptions = (0, react_1.useMemo)(() => (["currentDate", "currentView", "editing.form.formData"]), []);
const independentEvents = (0, react_1.useMemo)(() => (["onAppointmentAdded", "onAppointmentAdding", "onAppointmentClick", "onAppointmentContextMenu", "onAppointmentDblClick", "onAppointmentDeleted", "onAppointmentDeleting", "onAppointmentFormOpening", "onAppointmentRendered", "onAppointmentTooltipShowing", "onAppointmentUpdated", "onAppointmentUpdating", "onCellClick", "onCellContextMenu", "onContentReady", "onDisposing", "onInitialized"]), []);
const defaults = (0, react_1.useMemo)(() => ({
defaultCurrentDate: "currentDate",
defaultCurrentView: "currentView",
}), []);
const expectedChildren = (0, react_1.useMemo)(() => ({
appointmentDragging: { optionName: "appointmentDragging", isCollectionItem: false },
editing: { optionName: "editing", isCollectionItem: false },
resource: { optionName: "resources", isCollectionItem: true },
scrolling: { optionName: "scrolling", isCollectionItem: false },
toolbar: { optionName: "toolbar", isCollectionItem: false },
view: { optionName: "views", isCollectionItem: true }
}), []);
const templateProps = (0, react_1.useMemo)(() => ([
{
tmplOption: "appointmentCollectorTemplate",
render: "appointmentCollectorRender",
component: "appointmentCollectorComponent"
},
{
tmplOption: "appointmentTemplate",
render: "appointmentRender",
component: "appointmentComponent"
},
{
tmplOption: "appointmentTooltipTemplate",
render: "appointmentTooltipRender",
component: "appointmentTooltipComponent"
},
{
tmplOption: "dataCellTemplate",
render: "dataCellRender",
component: "dataCellComponent"
},
{
tmplOption: "dateCellTemplate",
render: "dateCellRender",
component: "dateCellComponent"
},
{
tmplOption: "resourceCellTemplate",
render: "resourceCellRender",
component: "resourceCellComponent"
},
{
tmplOption: "timeCellTemplate",
render: "timeCellRender",
component: "timeCellComponent"
},
]), []);
return (React.createElement((component_1.Component), {
WidgetClass: scheduler_1.default,
ref: baseRef,
subscribableOptions,
independentEvents,
defaults,
expectedChildren,
templateProps,
...props,
}));
}));
exports.Scheduler = Scheduler;
const _componentAIOptions = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "aiOptions",
},
});
};
const AIOptions = Object.assign(_componentAIOptions, {
componentType: "option",
});
exports.AIOptions = AIOptions;
const _componentAppointmentDragging = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "appointmentDragging",
},
});
};
const AppointmentDragging = Object.assign(_componentAppointmentDragging, {
componentType: "option",
});
exports.AppointmentDragging = AppointmentDragging;
const _componentAsyncRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "async"
},
},
});
};
const AsyncRule = Object.assign(_componentAsyncRule, {
componentType: "option",
});
exports.AsyncRule = AsyncRule;
const _componentButtonItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
ExpectedChildren: {
buttonOptions: { optionName: "buttonOptions", isCollectionItem: false }
},
PredefinedProps: {
itemType: "button"
},
},
});
};
const ButtonItem = Object.assign(_componentButtonItem, {
componentType: "option",
});
exports.ButtonItem = ButtonItem;
const _componentButtonOptions = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "buttonOptions",
TemplateProps: [{
tmplOption: "template",
render: "render",
component: "component"
}],
},
});
};
const ButtonOptions = Object.assign(_componentButtonOptions, {
componentType: "option",
});
exports.ButtonOptions = ButtonOptions;
const _componentColCountByScreen = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "colCountByScreen",
},
});
};
const ColCountByScreen = Object.assign(_componentColCountByScreen, {
componentType: "option",
});
exports.ColCountByScreen = ColCountByScreen;
const _componentCompareRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "compare"
},
},
});
};
const CompareRule = Object.assign(_componentCompareRule, {
componentType: "option",
});
exports.CompareRule = CompareRule;
const _componentCustomRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "custom"
},
},
});
};
const CustomRule = Object.assign(_componentCustomRule, {
componentType: "option",
});
exports.CustomRule = CustomRule;
const _componentEditing = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "editing",
ExpectedChildren: {
form: { optionName: "form", isCollectionItem: false }
},
},
});
};
const Editing = Object.assign(_componentEditing, {
componentType: "option",
});
exports.Editing = Editing;
const _componentEmailRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "email"
},
},
});
};
const EmailRule = Object.assign(_componentEmailRule, {
componentType: "option",
});
exports.EmailRule = EmailRule;
const _componentEmptyItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
PredefinedProps: {
itemType: "empty"
},
},
});
};
const EmptyItem = Object.assign(_componentEmptyItem, {
componentType: "option",
});
exports.EmptyItem = EmptyItem;
const _componentForm = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "form",
DefaultsProps: {
defaultFormData: "formData"
},
ExpectedChildren: {
ButtonItem: { optionName: "items", isCollectionItem: true },
colCountByScreen: { optionName: "colCountByScreen", isCollectionItem: false },
EmptyItem: { optionName: "items", isCollectionItem: true },
GroupItem: { optionName: "items", isCollectionItem: true },
item: { optionName: "items", isCollectionItem: true },
SimpleItem: { optionName: "items", isCollectionItem: true },
TabbedItem: { optionName: "items", isCollectionItem: true }
},
},
});
};
const Form = Object.assign(_componentForm, {
componentType: "option",
});
exports.Form = Form;
const _componentGroupItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
ExpectedChildren: {
colCountByScreen: { optionName: "colCountByScreen", isCollectionItem: false }
},
TemplateProps: [{
tmplOption: "captionTemplate",
render: "captionRender",
component: "captionComponent"
}, {
tmplOption: "template",
render: "render",
component: "component"
}],
PredefinedProps: {
itemType: "group"
},
},
});
};
const GroupItem = Object.assign(_componentGroupItem, {
componentType: "option",
});
exports.GroupItem = GroupItem;
const _componentItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
ExpectedChildren: {
aiOptions: { optionName: "aiOptions", isCollectionItem: false },
AsyncRule: { optionName: "validationRules", isCollectionItem: true },
buttonOptions: { optionName: "buttonOptions", isCollectionItem: false },
colCountByScreen: { optionName: "colCountByScreen", isCollectionItem: false },
CompareRule: { optionName: "validationRules", isCollectionItem: true },
CustomRule: { optionName: "validationRules", isCollectionItem: true },
EmailRule: { optionName: "validationRules", isCollectionItem: true },
label: { optionName: "label", isCollectionItem: false },
NumericRule: { optionName: "validationRules", isCollectionItem: true },
options: { optionName: "options", isCollectionItem: false },
PatternRule: { optionName: "validationRules", isCollectionItem: true },
RangeRule: { optionName: "validationRules", isCollectionItem: true },
RequiredRule: { optionName: "validationRules", isCollectionItem: true },
StringLengthRule: { optionName: "validationRules", isCollectionItem: true },
tab: { optionName: "tabs", isCollectionItem: true },
tabPanelOptions: { optionName: "tabPanelOptions", isCollectionItem: false },
validationRule: { optionName: "validationRules", isCollectionItem: true }
},
TemplateProps: [{
tmplOption: "tabTemplate",
render: "tabRender",
component: "tabComponent"
}, {
tmplOption: "template",
render: "render",
component: "component"
}, {
tmplOption: "captionTemplate",
render: "captionRender",
component: "captionComponent"
}, {
tmplOption: "menuItemTemplate",
render: "menuItemRender",
component: "menuItemComponent"
}],
},
});
};
const Item = Object.assign(_componentItem, {
componentType: "option",
});
exports.Item = Item;
const _componentLabel = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "label",
TemplateProps: [{
tmplOption: "template",
render: "render",
component: "component"
}],
},
});
};
const Label = Object.assign(_componentLabel, {
componentType: "option",
});
exports.Label = Label;
const _componentNumericRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "numeric"
},
},
});
};
const NumericRule = Object.assign(_componentNumericRule, {
componentType: "option",
});
exports.NumericRule = NumericRule;
const _componentOptions = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "options",
DefaultsProps: {
defaultSelectedItemKeys: "selectedItemKeys",
defaultSelectedItems: "selectedItems"
},
ExpectedChildren: {
item: { optionName: "items", isCollectionItem: true },
optionsItem: { optionName: "items", isCollectionItem: true }
},
TemplateProps: [{
tmplOption: "buttonTemplate",
render: "buttonRender",
component: "buttonComponent"
}],
},
});
};
const Options = Object.assign(_componentOptions, {
componentType: "option",
});
exports.Options = Options;
const _componentOptionsItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
TemplateProps: [{
tmplOption: "template",
render: "render",
component: "component"
}],
},
});
};
const OptionsItem = Object.assign(_componentOptionsItem, {
componentType: "option",
});
exports.OptionsItem = OptionsItem;
const _componentPatternRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "pattern"
},
},
});
};
const PatternRule = Object.assign(_componentPatternRule, {
componentType: "option",
});
exports.PatternRule = PatternRule;
const _componentRangeRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "range"
},
},
});
};
const RangeRule = Object.assign(_componentRangeRule, {
componentType: "option",
});
exports.RangeRule = RangeRule;
const _componentRequiredRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "required"
},
},
});
};
const RequiredRule = Object.assign(_componentRequiredRule, {
componentType: "option",
});
exports.RequiredRule = RequiredRule;
const _componentResource = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "resources",
IsCollectionItem: true,
},
});
};
const Resource = Object.assign(_componentResource, {
componentType: "option",
});
exports.Resource = Resource;
const _componentScrolling = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "scrolling",
},
});
};
const Scrolling = Object.assign(_componentScrolling, {
componentType: "option",
});
exports.Scrolling = Scrolling;
const _componentSimpleItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
ExpectedChildren: {
aiOptions: { optionName: "aiOptions", isCollectionItem: false },
AsyncRule: { optionName: "validationRules", isCollectionItem: true },
CompareRule: { optionName: "validationRules", isCollectionItem: true },
CustomRule: { optionName: "validationRules", isCollectionItem: true },
EmailRule: { optionName: "validationRules", isCollectionItem: true },
label: { optionName: "label", isCollectionItem: false },
NumericRule: { optionName: "validationRules", isCollectionItem: true },
PatternRule: { optionName: "validationRules", isCollectionItem: true },
RangeRule: { optionName: "validationRules", isCollectionItem: true },
RequiredRule: { optionName: "validationRules", isCollectionItem: true },
StringLengthRule: { optionName: "validationRules", isCollectionItem: true },
validationRule: { optionName: "validationRules", isCollectionItem: true }
},
TemplateProps: [{
tmplOption: "template",
render: "render",
component: "component"
}],
PredefinedProps: {
itemType: "simple"
},
},
});
};
const SimpleItem = Object.assign(_componentSimpleItem, {
componentType: "option",
});
exports.SimpleItem = SimpleItem;
const _componentStringLengthRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "stringLength"
},
},
});
};
const StringLengthRule = Object.assign(_componentStringLengthRule, {
componentType: "option",
});
exports.StringLengthRule = StringLengthRule;
const _componentTab = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "tabs",
IsCollectionItem: true,
ExpectedChildren: {
colCountByScreen: { optionName: "colCountByScreen", isCollectionItem: false }
},
TemplateProps: [{
tmplOption: "tabTemplate",
render: "tabRender",
component: "tabComponent"
}, {
tmplOption: "template",
render: "render",
component: "component"
}],
},
});
};
const Tab = Object.assign(_componentTab, {
componentType: "option",
});
exports.Tab = Tab;
const _componentTabbedItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
ExpectedChildren: {
tab: { optionName: "tabs", isCollectionItem: true },
tabPanelOptions: { optionName: "tabPanelOptions", isCollectionItem: false }
},
PredefinedProps: {
itemType: "tabbed"
},
},
});
};
const TabbedItem = Object.assign(_componentTabbedItem, {
componentType: "option",
});
exports.TabbedItem = TabbedItem;
const _componentTabPanelOptions = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "tabPanelOptions",
DefaultsProps: {
defaultItems: "items",
defaultSelectedIndex: "selectedIndex",
defaultSelectedItem: "selectedItem"
},
ExpectedChildren: {
item: { optionName: "items", isCollectionItem: true },
tabPanelOptionsItem: { optionName: "items", isCollectionItem: true }
},
TemplateProps: [{
tmplOption: "itemTemplate",
render: "itemRender",
component: "itemComponent"
}, {
tmplOption: "itemTitleTemplate",
render: "itemTitleRender",
component: "itemTitleComponent"
}],
},
});
};
const TabPanelOptions = Object.assign(_componentTabPanelOptions, {
componentType: "option",
});
exports.TabPanelOptions = TabPanelOptions;
const _componentTabPanelOptionsItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
TemplateProps: [{
tmplOption: "tabTemplate",
render: "tabRender",
component: "tabComponent"
}, {
tmplOption: "template",
render: "render",
component: "component"
}],
},
});
};
const TabPanelOptionsItem = Object.assign(_componentTabPanelOptionsItem, {
componentType: "option",
});
exports.TabPanelOptionsItem = TabPanelOptionsItem;
const _componentToolbar = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "toolbar",
ExpectedChildren: {
item: { optionName: "items", isCollectionItem: true },
toolbarItem: { optionName: "items", isCollectionItem: true }
},
},
});
};
const Toolbar = Object.assign(_componentToolbar, {
componentType: "option",
});
exports.Toolbar = Toolbar;
const _componentToolbarItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
ExpectedChildren: {
options: { optionName: "options", isCollectionItem: false }
},
TemplateProps: [{
tmplOption: "menuItemTemplate",
render: "menuItemRender",
component: "menuItemComponent"
}, {
tmplOption: "template",
render: "render",
component: "component"
}],
},
});
};
const ToolbarItem = Object.assign(_componentToolbarItem, {
componentType: "option",
});
exports.ToolbarItem = ToolbarItem;
const _componentValidationRule = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "validationRules",
IsCollectionItem: true,
PredefinedProps: {
type: "required"
},
},
});
};
const ValidationRule = Object.assign(_componentValidationRule, {
componentType: "option",
});
exports.ValidationRule = ValidationRule;
const _componentView = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "views",
IsCollectionItem: true,
ExpectedChildren: {
scrolling: { optionName: "scrolling", isCollectionItem: false }
},
TemplateProps: [{
tmplOption: "appointmentCollectorTemplate",
render: "appointmentCollectorRender",
component: "appointmentCollectorComponent"
}, {
tmplOption: "appointmentTemplate",
render: "appointmentRender",
component: "appointmentComponent"
}, {
tmplOption: "appointmentTooltipTemplate",
render: "appointmentTooltipRender",
component: "appointmentTooltipComponent"
}, {
tmplOption: "dataCellTemplate",
render: "dataCellRender",
component: "dataCellComponent"
}, {
tmplOption: "dateCellTemplate",
render: "dateCellRender",
component: "dateCellComponent"
}, {
tmplOption: "resourceCellTemplate",
render: "resourceCellRender",
component: "resourceCellComponent"
}, {
tmplOption: "timeCellTemplate",
render: "timeCellRender",
component: "timeCellComponent"
}],
},
});
};
const View = Object.assign(_componentView, {
componentType: "option",
});
exports.View = View;
exports.default = Scheduler;