ui.scheduler.timeline_week.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * DevExtreme (ui/scheduler/workspaces/ui.scheduler.timeline_week.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 registerComponent = require("../../../core/component_registrator");
  11. var SchedulerTimeline = require("./ui.scheduler.timeline");
  12. var TIMELINE_CLASS = "dx-scheduler-timeline-week";
  13. var HEADER_ROW_CLASS = "dx-scheduler-header-row";
  14. var SchedulerTimelineWeek = SchedulerTimeline.inherit({
  15. _getElementClass: function() {
  16. return TIMELINE_CLASS
  17. },
  18. _getCellCount: function() {
  19. return this.callBase() * this._getWeekDuration()
  20. },
  21. _setTableSizes: function() {
  22. this.callBase();
  23. var cellWidth = this.getCellWidth();
  24. var minWidth = this.getWorkSpaceMinWidth();
  25. var $headerCells = this.$element().find("." + HEADER_ROW_CLASS).last().find("th");
  26. var width = cellWidth * $headerCells.length;
  27. if (width < minWidth) {
  28. width = minWidth
  29. }
  30. this._$headerPanel.width(width)
  31. },
  32. _getHeaderPanelCellWidth: function($headerRow) {
  33. return $headerRow.children().first().get(0).getBoundingClientRect().width
  34. },
  35. _getWeekDuration: function() {
  36. return 7
  37. },
  38. _needRenderWeekHeader: function() {
  39. return true
  40. },
  41. _incrementDate: function(date) {
  42. date.setDate(date.getDate() + 1)
  43. }
  44. });
  45. registerComponent("dxSchedulerTimelineWeek", SchedulerTimelineWeek);
  46. module.exports = SchedulerTimelineWeek;