UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

107 lines (106 loc) 3.94 kB
/** * DevExtreme (esm/renovation/ui/scheduler/appointment_edit_form/layout.js) * Version: 22.1.9 * Build date: Tue Apr 18 2023 * * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import _extends from "@babel/runtime/helpers/esm/extends"; var _excluded = ["allowUpdating", "appointmentData", "formContentTemplate", "fullScreen", "maxWidth", "onVisibleChange", "visible"]; import { createComponentVNode, normalizeProps } from "inferno"; import { BaseInfernoComponent } from "@devextreme/runtime/inferno"; import { Popup } from "../../overlays/popup"; import { defaultAnimation, getPopupToolbarItems, isPopupFullScreenNeeded, getMaxWidth } from "./popup_config"; var APPOINTMENT_POPUP_CLASS = "dx-scheduler-appointment-popup"; var wrapperAttr = { class: APPOINTMENT_POPUP_CLASS }; export var viewFunction = _ref => { var { props: { formContentTemplate: formContentTemplate, fullScreen: fullScreen, maxWidth: maxWidth, onVisibleChange: onVisibleChange, visible: visible }, toolbarItems: toolbarItems } = _ref; return createComponentVNode(2, Popup, { className: APPOINTMENT_POPUP_CLASS, wrapperAttr: wrapperAttr, visible: visible, visibleChange: onVisibleChange, height: "auto", fullScreen: fullScreen, maxWidth: maxWidth, showCloseButton: false, showTitle: false, toolbarItems: toolbarItems, animation: defaultAnimation, contentTemplate: formContentTemplate }) }; export var AppointmentEditFormProps = {}; import { convertRulesToOptions } from "../../../../core/options/utils"; var getTemplate = TemplateProp => TemplateProp && (TemplateProp.defaultProps ? props => normalizeProps(createComponentVNode(2, TemplateProp, _extends({}, props))) : TemplateProp); export class AppointmentEditForm extends BaseInfernoComponent { constructor(props) { super(props); this.__getterCache = {}; this.state = { isFullScreen: isPopupFullScreenNeeded(), maxWidth: getMaxWidth(isPopupFullScreenNeeded()) } } get toolbarItems() { if (void 0 !== this.__getterCache.toolbarItems) { return this.__getterCache.toolbarItems } return this.__getterCache.toolbarItems = (() => getPopupToolbarItems(this.props.allowUpdating))() } get restAttributes() { var _this$props = this.props, restProps = _objectWithoutPropertiesLoose(_this$props, _excluded); return restProps } componentWillUpdate(nextProps, nextState, context) { if (this.props.allowUpdating !== nextProps.allowUpdating) { this.__getterCache.toolbarItems = void 0 } } render() { var props = this.props; return viewFunction({ props: _extends({}, props, { formContentTemplate: getTemplate(props.formContentTemplate) }), isFullScreen: this.state.isFullScreen, maxWidth: this.state.maxWidth, toolbarItems: this.toolbarItems, restAttributes: this.restAttributes }) } } AppointmentEditForm.defaultProps = AppointmentEditFormProps; var __defaultOptionRules = []; export function defaultOptions(rule) { __defaultOptionRules.push(rule); AppointmentEditForm.defaultProps = Object.create(Object.prototype, _extends(Object.getOwnPropertyDescriptors(AppointmentEditForm.defaultProps), Object.getOwnPropertyDescriptors(convertRulesToOptions(__defaultOptionRules)))) }