devextreme-react
Version:
DevExtreme React UI and Visualization Components
297 lines (295 loc) • 10.5 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.Variables = exports.ToolbarItem = exports.Toolbar = exports.TableResizing = exports.TableContextMenuItem = exports.TableContextMenu = exports.Tab = exports.Mention = exports.MediaResizing = exports.Item = exports.ImageUpload = exports.FileUploaderOptions = exports.Converter = exports.HtmlEditor = void 0;
const React = __importStar(require("react"));
const react_1 = require("react");
const html_editor_1 = __importDefault(require("devextreme/ui/html_editor"));
const component_1 = require("./core/component");
const nested_option_1 = __importDefault(require("./core/nested-option"));
const HtmlEditor = (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", "onFocusIn", "onFocusOut", "onInitialized", "onValueChanged"]), []);
const defaults = (0, react_1.useMemo)(() => ({
defaultValue: "value",
}), []);
const expectedChildren = (0, react_1.useMemo)(() => ({
converter: { optionName: "converter", isCollectionItem: false },
imageUpload: { optionName: "imageUpload", isCollectionItem: false },
mediaResizing: { optionName: "mediaResizing", isCollectionItem: false },
mention: { optionName: "mentions", isCollectionItem: true },
tableContextMenu: { optionName: "tableContextMenu", isCollectionItem: false },
tableResizing: { optionName: "tableResizing", isCollectionItem: false },
toolbar: { optionName: "toolbar", isCollectionItem: false },
variables: { optionName: "variables", isCollectionItem: false }
}), []);
return (React.createElement((component_1.Component), {
WidgetClass: html_editor_1.default,
ref: baseRef,
subscribableOptions,
independentEvents,
defaults,
expectedChildren,
...props,
}));
}));
exports.HtmlEditor = HtmlEditor;
const _componentConverter = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "converter",
},
});
};
const Converter = Object.assign(_componentConverter, {
componentType: "option",
});
exports.Converter = Converter;
const _componentFileUploaderOptions = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "fileUploaderOptions",
DefaultsProps: {
defaultValue: "value"
},
},
});
};
const FileUploaderOptions = Object.assign(_componentFileUploaderOptions, {
componentType: "option",
});
exports.FileUploaderOptions = FileUploaderOptions;
const _componentImageUpload = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "imageUpload",
ExpectedChildren: {
fileUploaderOptions: { optionName: "fileUploaderOptions", isCollectionItem: false },
tab: { optionName: "tabs", isCollectionItem: true }
},
},
});
};
const ImageUpload = Object.assign(_componentImageUpload, {
componentType: "option",
});
exports.ImageUpload = ImageUpload;
const _componentItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
ExpectedChildren: {
item: { optionName: "items", isCollectionItem: true }
},
TemplateProps: [{
tmplOption: "template",
render: "render",
component: "component"
}, {
tmplOption: "menuItemTemplate",
render: "menuItemRender",
component: "menuItemComponent"
}],
},
});
};
const Item = Object.assign(_componentItem, {
componentType: "option",
});
exports.Item = Item;
const _componentMediaResizing = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "mediaResizing",
},
});
};
const MediaResizing = Object.assign(_componentMediaResizing, {
componentType: "option",
});
exports.MediaResizing = MediaResizing;
const _componentMention = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "mentions",
IsCollectionItem: true,
TemplateProps: [{
tmplOption: "itemTemplate",
render: "itemRender",
component: "itemComponent"
}, {
tmplOption: "template",
render: "render",
component: "component"
}],
},
});
};
const Mention = Object.assign(_componentMention, {
componentType: "option",
});
exports.Mention = Mention;
const _componentTab = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "tabs",
IsCollectionItem: true,
},
});
};
const Tab = Object.assign(_componentTab, {
componentType: "option",
});
exports.Tab = Tab;
const _componentTableContextMenu = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "tableContextMenu",
ExpectedChildren: {
item: { optionName: "items", isCollectionItem: true },
tableContextMenuItem: { optionName: "items", isCollectionItem: true }
},
},
});
};
const TableContextMenu = Object.assign(_componentTableContextMenu, {
componentType: "option",
});
exports.TableContextMenu = TableContextMenu;
const _componentTableContextMenuItem = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
ExpectedChildren: {
item: { optionName: "items", isCollectionItem: true }
},
TemplateProps: [{
tmplOption: "template",
render: "render",
component: "component"
}],
},
});
};
const TableContextMenuItem = Object.assign(_componentTableContextMenuItem, {
componentType: "option",
});
exports.TableContextMenuItem = TableContextMenuItem;
const _componentTableResizing = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "tableResizing",
},
});
};
const TableResizing = Object.assign(_componentTableResizing, {
componentType: "option",
});
exports.TableResizing = TableResizing;
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,
TemplateProps: [{
tmplOption: "menuItemTemplate",
render: "menuItemRender",
component: "menuItemComponent"
}, {
tmplOption: "template",
render: "render",
component: "component"
}],
},
});
};
const ToolbarItem = Object.assign(_componentToolbarItem, {
componentType: "option",
});
exports.ToolbarItem = ToolbarItem;
const _componentVariables = (props) => {
return React.createElement((nested_option_1.default), {
...props,
elementDescriptor: {
OptionName: "variables",
},
});
};
const Variables = Object.assign(_componentVariables, {
componentType: "option",
});
exports.Variables = Variables;
exports.default = HtmlEditor;