popup.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. /**
  2. * DevExtreme (ui/popup.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. var $ = require("../core/renderer");
  11. var window = require("../core/utils/window").getWindow();
  12. var translator = require("../animation/translator");
  13. var camelize = require("../core/utils/inflector").camelize;
  14. var noop = require("../core/utils/common").noop;
  15. var getPublicElement = require("../core/utils/dom").getPublicElement;
  16. var each = require("../core/utils/iterator").each;
  17. var isDefined = require("../core/utils/type").isDefined;
  18. var inArray = require("../core/utils/array").inArray;
  19. var extend = require("../core/utils/extend").extend;
  20. var browser = require("../core/utils/browser");
  21. var compareVersions = require("../core/utils/version").compare;
  22. var messageLocalization = require("../localization/message");
  23. var devices = require("../core/devices");
  24. var registerComponent = require("../core/component_registrator");
  25. var Button = require("./button");
  26. var themes = require("./themes");
  27. var Overlay = require("./overlay");
  28. var EmptyTemplate = require("./widget/empty_template");
  29. var domUtils = require("../core/utils/dom");
  30. var sizeUtils = require("../core/utils/size");
  31. var windowUtils = require("../core/utils/window");
  32. require("./toolbar/ui.toolbar.base");
  33. var POPUP_CLASS = "dx-popup";
  34. var POPUP_WRAPPER_CLASS = "dx-popup-wrapper";
  35. var POPUP_FULL_SCREEN_CLASS = "dx-popup-fullscreen";
  36. var POPUP_FULL_SCREEN_WIDTH_CLASS = "dx-popup-fullscreen-width";
  37. var POPUP_NORMAL_CLASS = "dx-popup-normal";
  38. var POPUP_CONTENT_CLASS = "dx-popup-content";
  39. var POPUP_DRAGGABLE_CLASS = "dx-popup-draggable";
  40. var POPUP_TITLE_CLASS = "dx-popup-title";
  41. var POPUP_TITLE_CLOSEBUTTON_CLASS = "dx-closebutton";
  42. var POPUP_BOTTOM_CLASS = "dx-popup-bottom";
  43. var TEMPLATE_WRAPPER_CLASS = "dx-template-wrapper";
  44. var POPUP_CONTENT_FLEX_HEIGHT_CLASS = "dx-popup-flex-height";
  45. var POPUP_CONTENT_INHERIT_HEIGHT_CLASS = "dx-popup-inherit-height";
  46. var ALLOWED_TOOLBAR_ITEM_ALIASES = ["cancel", "clear", "done"];
  47. var BUTTON_DEFAULT_TYPE = "default";
  48. var BUTTON_NORMAL_TYPE = "normal";
  49. var BUTTON_TEXT_MODE = "text";
  50. var BUTTON_CONTAINED_MODE = "contained";
  51. var IS_IE11 = browser.msie && 11 === parseInt(browser.version);
  52. var IS_OLD_SAFARI = browser.safari && compareVersions(browser.version, [11]) < 0;
  53. var HEIGHT_STRATEGIES = {
  54. "static": "",
  55. inherit: POPUP_CONTENT_INHERIT_HEIGHT_CLASS,
  56. flex: POPUP_CONTENT_FLEX_HEIGHT_CLASS
  57. };
  58. var getButtonPlace = function(name) {
  59. var device = devices.current();
  60. var platform = device.platform;
  61. var toolbar = "bottom";
  62. var location = "before";
  63. if ("ios" === platform) {
  64. switch (name) {
  65. case "cancel":
  66. toolbar = "top";
  67. break;
  68. case "clear":
  69. toolbar = "top";
  70. location = "after";
  71. break;
  72. case "done":
  73. location = "after"
  74. }
  75. } else {
  76. if ("win" === platform) {
  77. location = "after"
  78. } else {
  79. if ("android" === platform && device.version && parseInt(device.version[0]) > 4) {
  80. switch (name) {
  81. case "cancel":
  82. location = "after";
  83. break;
  84. case "done":
  85. location = "after"
  86. }
  87. } else {
  88. if ("android" === platform) {
  89. location = "center"
  90. }
  91. }
  92. }
  93. }
  94. return {
  95. toolbar: toolbar,
  96. location: location
  97. }
  98. };
  99. var Popup = Overlay.inherit({
  100. _getDefaultOptions: function() {
  101. return extend(this.callBase(), {
  102. fullScreen: false,
  103. title: "",
  104. showTitle: true,
  105. titleTemplate: "title",
  106. onTitleRendered: null,
  107. dragEnabled: false,
  108. toolbarItems: [],
  109. showCloseButton: false,
  110. bottomTemplate: "bottom",
  111. useDefaultToolbarButtons: false,
  112. useFlatToolbarButtons: false,
  113. autoResizeEnabled: true
  114. })
  115. },
  116. _defaultOptionsRules: function() {
  117. var themeName = themes.current();
  118. return this.callBase().concat([{
  119. device: {
  120. platform: "ios"
  121. },
  122. options: {
  123. animation: this._iosAnimation
  124. }
  125. }, {
  126. device: {
  127. platform: "android"
  128. },
  129. options: {
  130. animation: this._androidAnimation
  131. }
  132. }, {
  133. device: {
  134. platform: "generic"
  135. },
  136. options: {
  137. showCloseButton: true
  138. }
  139. }, {
  140. device: function(_device) {
  141. return "generic" === devices.real().platform && "generic" === _device.platform
  142. },
  143. options: {
  144. dragEnabled: true
  145. }
  146. }, {
  147. device: function() {
  148. return "desktop" === devices.real().deviceType && !devices.isSimulator()
  149. },
  150. options: {
  151. focusStateEnabled: true
  152. }
  153. }, {
  154. device: function() {
  155. return themes.isMaterial(themeName)
  156. },
  157. options: {
  158. useDefaultToolbarButtons: true,
  159. useFlatToolbarButtons: true
  160. }
  161. }])
  162. },
  163. _iosAnimation: {
  164. show: {
  165. type: "slide",
  166. duration: 400,
  167. from: {
  168. position: {
  169. my: "top",
  170. at: "bottom"
  171. }
  172. },
  173. to: {
  174. position: {
  175. my: "center",
  176. at: "center"
  177. }
  178. }
  179. },
  180. hide: {
  181. type: "slide",
  182. duration: 400,
  183. from: {
  184. opacity: 1,
  185. position: {
  186. my: "center",
  187. at: "center"
  188. }
  189. },
  190. to: {
  191. opacity: 1,
  192. position: {
  193. my: "top",
  194. at: "bottom"
  195. }
  196. }
  197. }
  198. },
  199. _androidAnimation: function() {
  200. var fullScreenConfig = {
  201. show: {
  202. type: "slide",
  203. duration: 300,
  204. from: {
  205. top: "30%",
  206. opacity: 0
  207. },
  208. to: {
  209. top: 0,
  210. opacity: 1
  211. }
  212. },
  213. hide: {
  214. type: "slide",
  215. duration: 300,
  216. from: {
  217. top: 0,
  218. opacity: 1
  219. },
  220. to: {
  221. top: "30%",
  222. opacity: 0
  223. }
  224. }
  225. };
  226. var defaultConfig = {
  227. show: {
  228. type: "fade",
  229. duration: 400,
  230. from: 0,
  231. to: 1
  232. },
  233. hide: {
  234. type: "fade",
  235. duration: 400,
  236. from: 1,
  237. to: 0
  238. }
  239. };
  240. return this.option("fullScreen") ? fullScreenConfig : defaultConfig
  241. },
  242. _init: function() {
  243. this.callBase();
  244. this.$element().addClass(POPUP_CLASS);
  245. this._wrapper().addClass(POPUP_WRAPPER_CLASS);
  246. this._$popupContent = this._$content.wrapInner($("<div>").addClass(POPUP_CONTENT_CLASS)).children().eq(0)
  247. },
  248. _render: function() {
  249. var isFullscreen = this.option("fullScreen");
  250. this._toggleFullScreenClass(isFullscreen);
  251. this.callBase()
  252. },
  253. _toggleFullScreenClass: function(value) {
  254. this._$content.toggleClass(POPUP_FULL_SCREEN_CLASS, value).toggleClass(POPUP_NORMAL_CLASS, !value)
  255. },
  256. _initTemplates: function() {
  257. this.callBase();
  258. this._defaultTemplates.title = new EmptyTemplate(this);
  259. this._defaultTemplates.bottom = new EmptyTemplate(this)
  260. },
  261. _renderContentImpl: function() {
  262. this._renderTitle();
  263. this.callBase();
  264. this._renderBottom()
  265. },
  266. _renderTitle: function() {
  267. var items = this._getToolbarItems("top");
  268. var titleText = this.option("title");
  269. var showTitle = this.option("showTitle");
  270. if (showTitle && !!titleText) {
  271. items.unshift({
  272. location: devices.current().ios ? "center" : "before",
  273. text: titleText
  274. })
  275. }
  276. if (showTitle || items.length > 0) {
  277. this._$title && this._$title.remove();
  278. var $title = $("<div>").addClass(POPUP_TITLE_CLASS).insertBefore(this.$content());
  279. this._$title = this._renderTemplateByType("titleTemplate", items, $title).addClass(POPUP_TITLE_CLASS);
  280. this._renderDrag();
  281. this._executeTitleRenderAction(this._$title)
  282. } else {
  283. if (this._$title) {
  284. this._$title.detach()
  285. }
  286. }
  287. },
  288. _renderTemplateByType: function(optionName, data, $container, additionalToolbarOptions) {
  289. var template = this._getTemplateByOption(optionName);
  290. var toolbarTemplate = template instanceof EmptyTemplate;
  291. if (toolbarTemplate) {
  292. var integrationOptions = extend({}, this.option("integrationOptions"), {
  293. skipTemplates: ["content", "title"]
  294. });
  295. var toolbarOptions = extend(additionalToolbarOptions, {
  296. items: data,
  297. rtlEnabled: this.option("rtlEnabled"),
  298. useDefaultButtons: this.option("useDefaultToolbarButtons"),
  299. useFlatButtons: this.option("useFlatToolbarButtons"),
  300. integrationOptions: integrationOptions
  301. });
  302. this._getTemplate("dx-polymorph-widget").render({
  303. container: $container,
  304. model: {
  305. widget: "dxToolbarBase",
  306. options: toolbarOptions
  307. }
  308. });
  309. var $toolbar = $container.children("div");
  310. $container.replaceWith($toolbar);
  311. return $toolbar
  312. } else {
  313. var $result = $(template.render({
  314. container: getPublicElement($container)
  315. }));
  316. if ($result.hasClass(TEMPLATE_WRAPPER_CLASS)) {
  317. $container.replaceWith($result);
  318. $container = $result
  319. }
  320. return $container
  321. }
  322. },
  323. _executeTitleRenderAction: function($titleElement) {
  324. this._getTitleRenderAction()({
  325. titleElement: getPublicElement($titleElement)
  326. })
  327. },
  328. _getTitleRenderAction: function() {
  329. return this._titleRenderAction || this._createTitleRenderAction()
  330. },
  331. _createTitleRenderAction: function() {
  332. return this._titleRenderAction = this._createActionByOption("onTitleRendered", {
  333. element: this.element(),
  334. excludeValidators: ["disabled", "readOnly"]
  335. })
  336. },
  337. _getCloseButton: function() {
  338. return {
  339. toolbar: "top",
  340. location: "after",
  341. template: this._getCloseButtonRenderer()
  342. }
  343. },
  344. _getCloseButtonRenderer: function() {
  345. return function(_, __, container) {
  346. var $button = $("<div>").addClass(POPUP_TITLE_CLOSEBUTTON_CLASS);
  347. this._createComponent($button, Button, {
  348. icon: "close",
  349. onClick: this._createToolbarItemAction(void 0),
  350. integrationOptions: {}
  351. });
  352. $(container).append($button)
  353. }.bind(this)
  354. },
  355. _getToolbarItems: function(toolbar) {
  356. var toolbarItems = this.option("toolbarItems");
  357. var toolbarsItems = [];
  358. this._toolbarItemClasses = [];
  359. var currentPlatform = devices.current().platform;
  360. var index = 0;
  361. each(toolbarItems, function(_, data) {
  362. var isShortcut = isDefined(data.shortcut);
  363. var item = isShortcut ? getButtonPlace(data.shortcut) : data;
  364. if (isShortcut && "ios" === currentPlatform && index < 2) {
  365. item.toolbar = "top";
  366. index++
  367. }
  368. item.toolbar = data.toolbar || item.toolbar || "top";
  369. if (item && item.toolbar === toolbar) {
  370. if (isShortcut) {
  371. extend(item, {
  372. location: data.location
  373. }, this._getToolbarItemByAlias(data))
  374. }
  375. var isLTROrder = "win" === currentPlatform || "generic" === currentPlatform;
  376. if ("done" === data.shortcut && isLTROrder || "cancel" === data.shortcut && !isLTROrder) {
  377. toolbarsItems.unshift(item)
  378. } else {
  379. toolbarsItems.push(item)
  380. }
  381. }
  382. }.bind(this));
  383. if ("top" === toolbar && this.option("showCloseButton") && this.option("showTitle")) {
  384. toolbarsItems.push(this._getCloseButton())
  385. }
  386. return toolbarsItems
  387. },
  388. _getLocalizationKey: function(itemType) {
  389. return "done" === itemType.toLowerCase() ? "OK" : camelize(itemType, true)
  390. },
  391. _getToolbarItemByAlias: function(data) {
  392. var that = this;
  393. var itemType = data.shortcut;
  394. if (inArray(itemType, ALLOWED_TOOLBAR_ITEM_ALIASES) < 0) {
  395. return false
  396. }
  397. var itemConfig = extend({
  398. text: messageLocalization.format(this._getLocalizationKey(itemType)),
  399. onClick: this._createToolbarItemAction(data.onClick),
  400. integrationOptions: {},
  401. type: that.option("useDefaultToolbarButtons") ? BUTTON_DEFAULT_TYPE : BUTTON_NORMAL_TYPE,
  402. stylingMode: that.option("useFlatToolbarButtons") ? BUTTON_TEXT_MODE : BUTTON_CONTAINED_MODE
  403. }, data.options || {});
  404. var itemClass = POPUP_CLASS + "-" + itemType;
  405. this._toolbarItemClasses.push(itemClass);
  406. return {
  407. template: function(_, __, container) {
  408. var $toolbarItem = $("<div>").addClass(itemClass).appendTo(container);
  409. that._createComponent($toolbarItem, Button, itemConfig)
  410. }
  411. }
  412. },
  413. _createToolbarItemAction: function(clickAction) {
  414. return this._createAction(clickAction, {
  415. afterExecute: function(e) {
  416. e.component.hide()
  417. }
  418. })
  419. },
  420. _renderBottom: function() {
  421. var items = this._getToolbarItems("bottom");
  422. if (items.length) {
  423. this._$bottom && this._$bottom.remove();
  424. var $bottom = $("<div>").addClass(POPUP_BOTTOM_CLASS).insertAfter(this.$content());
  425. this._$bottom = this._renderTemplateByType("bottomTemplate", items, $bottom, {
  426. compactMode: true
  427. }).addClass(POPUP_BOTTOM_CLASS);
  428. this._toggleClasses()
  429. } else {
  430. this._$bottom && this._$bottom.detach()
  431. }
  432. },
  433. _toggleClasses: function() {
  434. var aliases = ALLOWED_TOOLBAR_ITEM_ALIASES;
  435. each(aliases, function(_, alias) {
  436. var className = POPUP_CLASS + "-" + alias;
  437. if (inArray(className, this._toolbarItemClasses) >= 0) {
  438. this._wrapper().addClass(className + "-visible");
  439. this._$bottom.addClass(className)
  440. } else {
  441. this._wrapper().removeClass(className + "-visible");
  442. this._$bottom.removeClass(className)
  443. }
  444. }.bind(this))
  445. },
  446. _getDragTarget: function() {
  447. return this.topToolbar()
  448. },
  449. _renderGeometryImpl: function(isDimensionChanged) {
  450. if (!isDimensionChanged) {
  451. this._resetContentHeight()
  452. }
  453. this.callBase.apply(this, arguments);
  454. this._setContentHeight()
  455. },
  456. _resetContentHeight: function() {
  457. this._$popupContent.css({
  458. height: "auto",
  459. maxHeight: "none"
  460. })
  461. },
  462. _renderDrag: function() {
  463. this.callBase();
  464. this._$content.toggleClass(POPUP_DRAGGABLE_CLASS, this.option("dragEnabled"))
  465. },
  466. _renderResize: function() {
  467. this.callBase();
  468. this._resizable.option("onResize", function() {
  469. this._setContentHeight();
  470. this._actions.onResize(arguments)
  471. }.bind(this))
  472. },
  473. _setContentHeight: function() {
  474. (this.option("forceApplyBindings") || noop)();
  475. var overlayContent = this.overlayContent().get(0);
  476. var currentHeightStrategyClass = this._chooseHeightStrategy(overlayContent);
  477. this.$content().css(this._getHeightCssStyles(currentHeightStrategyClass, overlayContent));
  478. this._setHeightClasses(this.overlayContent(), currentHeightStrategyClass)
  479. },
  480. _heightStrategyChangeOffset: function(currentHeightStrategyClass, popupVerticalPaddings) {
  481. return currentHeightStrategyClass === HEIGHT_STRATEGIES.flex ? -popupVerticalPaddings : 0
  482. },
  483. _chooseHeightStrategy: function(overlayContent) {
  484. var isAutoWidth = "auto" === overlayContent.style.width || "" === overlayContent.style.width;
  485. var currentHeightStrategyClass = HEIGHT_STRATEGIES.static;
  486. if (this._isAutoHeight() && this.option("autoResizeEnabled")) {
  487. if (isAutoWidth || IS_OLD_SAFARI) {
  488. if (!IS_IE11) {
  489. currentHeightStrategyClass = HEIGHT_STRATEGIES.inherit
  490. }
  491. } else {
  492. currentHeightStrategyClass = HEIGHT_STRATEGIES.flex
  493. }
  494. }
  495. return currentHeightStrategyClass
  496. },
  497. _getHeightCssStyles: function(currentHeightStrategyClass, overlayContent) {
  498. var cssStyles = {};
  499. var contentMaxHeight = this._getOptionValue("maxHeight", overlayContent);
  500. var contentMinHeight = this._getOptionValue("minHeight", overlayContent);
  501. var popupHeightParts = this._splitPopupHeight();
  502. var toolbarsAndVerticalOffsetsHeight = popupHeightParts.header + popupHeightParts.footer + popupHeightParts.contentVerticalOffsets + popupHeightParts.popupVerticalOffsets + this._heightStrategyChangeOffset(currentHeightStrategyClass, popupHeightParts.popupVerticalPaddings);
  503. if (currentHeightStrategyClass === HEIGHT_STRATEGIES.static) {
  504. if (!this._isAutoHeight() || contentMaxHeight || contentMinHeight) {
  505. var overlayHeight = this.option("fullScreen") ? Math.min(overlayContent.getBoundingClientRect().height, windowUtils.getWindow().innerHeight) : overlayContent.getBoundingClientRect().height;
  506. var contentHeight = overlayHeight - toolbarsAndVerticalOffsetsHeight;
  507. cssStyles = {
  508. height: Math.max(0, contentHeight),
  509. minHeight: "auto",
  510. maxHeight: "auto"
  511. }
  512. }
  513. } else {
  514. var container = $(this._getContainer()).get(0);
  515. var maxHeightValue = sizeUtils.addOffsetToMaxHeight(contentMaxHeight, -toolbarsAndVerticalOffsetsHeight, container);
  516. var minHeightValue = sizeUtils.addOffsetToMinHeight(contentMinHeight, -toolbarsAndVerticalOffsetsHeight, container);
  517. cssStyles = {
  518. height: "auto",
  519. minHeight: minHeightValue,
  520. maxHeight: maxHeightValue
  521. }
  522. }
  523. return cssStyles
  524. },
  525. _setHeightClasses: function($container, currentClass) {
  526. var excessClasses = "";
  527. for (var name in HEIGHT_STRATEGIES) {
  528. if (HEIGHT_STRATEGIES[name] !== currentClass) {
  529. excessClasses += " " + HEIGHT_STRATEGIES[name]
  530. }
  531. }
  532. $container.removeClass(excessClasses).addClass(currentClass)
  533. },
  534. _isAutoHeight: function() {
  535. return "auto" === this.overlayContent().get(0).style.height
  536. },
  537. _splitPopupHeight: function() {
  538. var topToolbar = this.topToolbar();
  539. var bottomToolbar = this.bottomToolbar();
  540. return {
  541. header: sizeUtils.getVisibleHeight(topToolbar && topToolbar.get(0)),
  542. footer: sizeUtils.getVisibleHeight(bottomToolbar && bottomToolbar.get(0)),
  543. contentVerticalOffsets: sizeUtils.getVerticalOffsets(this.overlayContent().get(0), true),
  544. popupVerticalOffsets: sizeUtils.getVerticalOffsets(this.$content().get(0), true),
  545. popupVerticalPaddings: sizeUtils.getVerticalOffsets(this.$content().get(0), false)
  546. }
  547. },
  548. _useFixedPosition: function() {
  549. return this.callBase() || this.option("fullScreen")
  550. },
  551. _toggleSafariFullScreen: function(value) {
  552. var toggleFullScreenBeforeShown = this._useFixedPosition() && value && !this._isShown;
  553. if (toggleFullScreenBeforeShown) {
  554. this._bodyScrollTop = value ? window.pageYOffset : void 0
  555. } else {
  556. this._toggleSafariScrolling(!value)
  557. }
  558. },
  559. _renderDimensions: function() {
  560. if (this.option("fullScreen")) {
  561. this._$content.css({
  562. width: "100%",
  563. height: "100%"
  564. })
  565. } else {
  566. this.callBase.apply(this, arguments)
  567. }
  568. if (windowUtils.hasWindow()) {
  569. this._renderFullscreenWidthClass()
  570. }
  571. },
  572. _renderFullscreenWidthClass: function() {
  573. this.overlayContent().toggleClass(POPUP_FULL_SCREEN_WIDTH_CLASS, this.overlayContent().outerWidth() === $(window).width())
  574. },
  575. _renderShadingDimensions: function() {
  576. if (this.option("fullScreen")) {
  577. this._wrapper().css({
  578. width: "100%",
  579. height: "100%"
  580. })
  581. } else {
  582. this.callBase.apply(this, arguments)
  583. }
  584. },
  585. refreshPosition: function() {
  586. this._renderPosition()
  587. },
  588. _renderPosition: function() {
  589. if (this.option("fullScreen")) {
  590. translator.move(this._$content, {
  591. top: 0,
  592. left: 0
  593. })
  594. } else {
  595. (this.option("forceApplyBindings") || noop)();
  596. return this.callBase.apply(this, arguments)
  597. }
  598. },
  599. _optionChanged: function(args) {
  600. switch (args.name) {
  601. case "showTitle":
  602. case "title":
  603. case "titleTemplate":
  604. this._renderTitle();
  605. this._renderGeometry();
  606. break;
  607. case "bottomTemplate":
  608. this._renderBottom();
  609. this._renderGeometry();
  610. break;
  611. case "onTitleRendered":
  612. this._createTitleRenderAction(args.value);
  613. break;
  614. case "toolbarItems":
  615. case "useDefaultToolbarButtons":
  616. case "useFlatToolbarButtons":
  617. var shouldRenderGeometry = !args.fullName.match(/^toolbarItems((\[\d+\])(\.(options|visible).*)?)?$/);
  618. this._renderTitle();
  619. this._renderBottom();
  620. if (shouldRenderGeometry) {
  621. this._renderGeometry()
  622. }
  623. break;
  624. case "dragEnabled":
  625. this._renderDrag();
  626. break;
  627. case "autoResizeEnabled":
  628. this._renderGeometry();
  629. domUtils.triggerResizeEvent(this._$content);
  630. break;
  631. case "fullScreen":
  632. this._toggleFullScreenClass(args.value);
  633. this._toggleSafariFullScreen(args.value);
  634. this._renderGeometry();
  635. domUtils.triggerResizeEvent(this._$content);
  636. break;
  637. case "showCloseButton":
  638. this._renderTitle();
  639. break;
  640. default:
  641. this.callBase(args)
  642. }
  643. },
  644. bottomToolbar: function() {
  645. return this._$bottom
  646. },
  647. topToolbar: function() {
  648. return this._$title
  649. },
  650. $content: function() {
  651. return this._$popupContent
  652. },
  653. content: function() {
  654. return getPublicElement(this._$popupContent)
  655. },
  656. overlayContent: function() {
  657. return this._$content
  658. }
  659. });
  660. registerComponent("dxPopup", Popup);
  661. module.exports = Popup;
  662. module.exports.default = module.exports;