Должен ли resourceEditable = false для события запрещать переключение этого события между ресурсами? - PullRequest
1 голос
/ 26 февраля 2020

Я работаю с fullcalendar v4 и только начинаю с планировщика resourceTimeGrid. Имея дело с ресурсами, я просто сталкиваюсь с ситуацией, которую опишу здесь, и хочу задать свой вопрос (я пишу эту строку, потому что SO считает, что в моем вопросе недостаточно текста. Lorem ipsum dolore sit amet consectetur):

Является ли следующее поведение нормальным? Даже с resourceEditable = false вы можете переключить событие на другой ресурс

<html>
<head>
<link href='https://unpkg.com/@fullcalendar/core@4.4.0/main.min.css' rel='stylesheet' />
<link href='https://unpkg.com/@fullcalendar/daygrid@4.4.0/main.min.css' rel='stylesheet' />
<link href='https://unpkg.com/@fullcalendar/timegrid@4.4.0/main.min.css' rel='stylesheet' />


  <script src='https://unpkg.com/@fullcalendar/core@4.4.0/main.min.js'></script>
  <script src='https://unpkg.com/@fullcalendar/interaction@4.4.0/main.js'></script>
  <script src='https://unpkg.com/@fullcalendar/daygrid@4.4.0/main.js'></script>
  <script src='https://unpkg.com/@fullcalendar/timegrid@4.4.0/main.js'></script>
  <script src='https://unpkg.com/@fullcalendar/resource-common@4.4.0/main.min.js'></script>
  <script src='https://unpkg.com/@fullcalendar/resource-daygrid@4.4.0/main.js'></script>
  <script src='https://unpkg.com/@fullcalendar/resource-timegrid@4.4.0/main.js'></script>
</head>
<body>

<a>Drop the event one time to disable editable and resourceEditable for that event</a><br/>
<a>Test to put that event in the other resource : even with resourceEditable=false you can switch event to another resource</a>
<div id="calendarArea"></div>

<script>

var calendarEl = document.getElementById('calendarArea');

var today = new Date();
var month = (today.getMonth()+1) > 10 ? today.getMonth()+1 : '0'+(today.getMonth()+1);
var day = today.getDate() > 10 ? today.getDate() : '0'+today.getDate();
var todayStringStart = today.getFullYear()+'-'+ month+'-'+today.getDate()+'T08:00';
var todayStringEnd = today.getFullYear()+'-'+ month+'-'+today.getDate()+'T09:00';

var calendar = new FullCalendar.Calendar(calendarEl, {
  plugins: [ 'interaction', 'resourceTimeGrid' ],
  defaultView: 'resourceTimeGridWeek',
  editable: true,
  weekends: false,
  eventResourceEditable: true,
  scrollTime : '07:00:00',
  schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
  resources: [
    {
      id: 'a',
      title: 'Room A',
    },
    {
      id: 'b',
      title: 'Room B',
    },
  ],
  events: [
    {
      id: 'a',
      title: 'my event',
      start: todayStringStart,
      end: todayStringEnd,
      resourceId: 'a',
      editable: true,
      resourceEditable: true,
    },
  ],
  views: {
    resourceTimeGridWeek: {
      type: 'resourceTimeGrid',
      duration: { week:1 },
    },
    resourceTimeGridMonth: {
      type: 'resourceTimeGrid',
      duration: { month:1 },
    },
  },
  eventDrop: (info) => {					
    info.event.setProp('editable', false);
    info.event.setProp('resourceEditable', false);
  },
});
calendar.render();

</script>
</body>
</html>

1 Ответ

0 голосов
/ 10 марта 2020

Да, это должно (и, вероятно, будет), но в настоящее время в библиотеке есть усовершенствование.

Кажется, это проблема: https://github.com/fullcalendar/fullcalendar/issues/5166, связанная с более крупными проблемами в полный календарь: https://github.com/fullcalendar/fullcalendar/issues/4625

...