@syncfusion/ej2-schedule 32.1.19 → 32.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,12 @@
1
+ /*!
2
+ * filename: index.d.ts
3
+ * version : 32.1.22
4
+ * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
+ * Use of this code is subject to the terms of our license.
6
+ * A copy of the current license can be obtained at any time by e-mailing
7
+ * licensing@syncfusion.com. Any infringement will be prosecuted under
8
+ * applicable laws.
9
+ */
1
10
  import * as _schedule from '@syncfusion/ej2-schedule';
2
11
 
3
12
  export declare namespace ej {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-schedule",
3
- "version": "32.1.19",
3
+ "version": "32.1.22",
4
4
  "author": "Syncfusion Inc.",
5
5
  "license": "SEE LICENSE IN license",
6
6
  "main": "./dist/ej2-schedule.umd.min.js",
@@ -8,12 +8,12 @@
8
8
  "es2015": "./dist/es6/ej2-schedule.es5.js",
9
9
  "dependencies": {
10
10
  "@syncfusion/ej2-base": "~32.1.19",
11
- "@syncfusion/ej2-buttons": "~32.1.19",
12
- "@syncfusion/ej2-calendars": "~32.1.19",
11
+ "@syncfusion/ej2-buttons": "~32.1.21",
12
+ "@syncfusion/ej2-calendars": "~32.1.22",
13
13
  "@syncfusion/ej2-data": "~32.1.19",
14
- "@syncfusion/ej2-dropdowns": "~32.1.19",
14
+ "@syncfusion/ej2-dropdowns": "~32.1.22",
15
15
  "@syncfusion/ej2-excel-export": "~32.1.19",
16
- "@syncfusion/ej2-inputs": "~32.1.19",
16
+ "@syncfusion/ej2-inputs": "~32.1.22",
17
17
  "@syncfusion/ej2-lists": "~32.1.19",
18
18
  "@syncfusion/ej2-navigations": "~32.1.19",
19
19
  "@syncfusion/ej2-popups": "~32.1.19"
@@ -91,7 +91,7 @@ var ActionBase = /** @class */ (function () {
91
91
  var startHour = this.parent.activeView.getStartHour();
92
92
  var intervalInMS = util.MS_PER_MINUTE * this.actionObj.interval;
93
93
  dateInMS += (startHour.getHours() * 60 + startHour.getMinutes()) * util.MS_PER_MINUTE + startHour.getSeconds() * 1000;
94
- dateInMS = dateInMS + Math.floor((date.getTime() - dateInMS) / intervalInMS) * intervalInMS;
94
+ dateInMS = dateInMS + ((date.getTime() - dateInMS) / intervalInMS) * intervalInMS;
95
95
  return new Date(dateInMS);
96
96
  };
97
97
  ActionBase.prototype.getContentAreaDimension = function () {
@@ -415,7 +415,7 @@ var Resize = /** @class */ (function (_super) {
415
415
  var offsetWidth = (Math.round(offset / this.actionObj.cellWidth) *
416
416
  this.actionObj.cellWidth) + (isLeft ? 0 : (this.parent.getElementWidth(this.actionObj.clone) -
417
417
  this.actionObj.cellWidth));
418
- cellIndex = Math.floor(offsetWidth / this.actionObj.cellWidth);
418
+ cellIndex = Math.ceil(offsetWidth / this.actionObj.cellWidth);
419
419
  }
420
420
  isLastCell = cellIndex === tdCollections.length;
421
421
  cellIndex = this.getIndex(cellIndex);
@@ -433,13 +433,29 @@ var Resize = /** @class */ (function (_super) {
433
433
  }
434
434
  else {
435
435
  if (!isLeft) {
436
- offset += this.parent.getElementWidth(this.actionObj.clone);
436
+ var cloneWidth = this.parent.getElementWidth(this.actionObj.clone);
437
+ var pixelsPerInterval = this.actionObj.cellWidth /
438
+ (this.actionObj.slotInterval / this.actionObj.interval);
439
+ var numIntervals = Math.round(cloneWidth / pixelsPerInterval);
440
+ cloneWidth = numIntervals * pixelsPerInterval;
441
+ offset = offset + cloneWidth;
437
442
  }
438
- var spanMinutes = Math.floor((this.actionObj.slotInterval / this.actionObj.cellWidth) *
443
+ var spanMinutes = Math.ceil((this.actionObj.slotInterval / this.actionObj.cellWidth) *
439
444
  (offset - Math.floor(offset / this.actionObj.cellWidth) * this.actionObj.cellWidth));
440
445
  spanMinutes = (isLastCell || (!isLeft && spanMinutes === 0)) ? this.actionObj.slotInterval : spanMinutes;
441
446
  resizeTime = new Date(resizeDate.getTime());
442
447
  resizeTime = new Date(resizeDate.getTime() + (spanMinutes * util.MS_PER_MINUTE));
448
+ var isCustomResizeInterval = this.actionObj.interval !== this.actionObj.slotInterval;
449
+ var initialCellTime = new Date(resizeTime.getTime());
450
+ var intervalInMS = this.actionObj.interval * 60000;
451
+ if (intervalInMS > 0 && isCustomResizeInterval) {
452
+ if (this.resizeEdges.right || this.resizeEdges.left) {
453
+ var eventTime = this.resizeEdges.right ? eventEnd : eventStart;
454
+ var timeDifferenceMs = initialCellTime.getTime() - eventTime.getTime();
455
+ var intervalCount = Math.round(timeDifferenceMs / intervalInMS);
456
+ resizeTime = new Date(eventTime.getTime() + intervalCount * intervalInMS);
457
+ }
458
+ }
443
459
  this.updateTimePosition(resizeTime);
444
460
  }
445
461
  }
@@ -372,6 +372,8 @@ export interface ResourceDetails {
372
372
  resourceData: Record<string, any>;
373
373
  /** Returns the respective resource fields data. */
374
374
  groupData?: Record<string, any>;
375
+ /** Returns the respective resource date. */
376
+ date?: Date;
375
377
  /** It returns the child level resources in compact mode. */
376
378
  resourceChild?: ResourceDetails[];
377
379
  /** It returns the Id of current resource in compact mode. */
@@ -379,14 +379,16 @@ var ResourceBase = /** @class */ (function () {
379
379
  resourceId: levelId,
380
380
  resourceName: treeLevel.resourceData[resource.textField],
381
381
  resource: treeLevel.resource,
382
- resourceData: treeLevel.resourceData
382
+ resourceData: treeLevel.resourceData,
383
+ date: _this.parent.selectedDate
383
384
  };
384
385
  }
385
386
  else {
386
387
  resObj = {
387
388
  type: 'resourceHeader', resource: treeLevel.resource,
388
389
  resourceData: treeLevel.resourceData, groupIndex: groupIndex,
389
- groupOrder: treeLevel.groupOrder
390
+ groupOrder: treeLevel.groupOrder,
391
+ date: _this.parent.selectedDate
390
392
  };
391
393
  resTreeColl.push(resObj);
392
394
  groupIndex++;
@@ -714,9 +716,15 @@ var ResourceBase = /** @class */ (function () {
714
716
  }
715
717
  this.lastResourceLevel = headerLevels.slice(-1)[0] || [];
716
718
  if (!this.parent.activeViewOptions.group.byDate) {
719
+ for (var levelIndex = 0; levelIndex < headerLevels.length; levelIndex++) {
720
+ for (var _d = 0, _e = headerLevels[parseInt(levelIndex.toString(), 10)]; _d < _e.length; _d++) {
721
+ var levelItem = _e[_d];
722
+ levelItem.date = this.parent.selectedDate;
723
+ }
724
+ }
717
725
  var index = 0;
718
- for (var _d = 0, _e = this.lastResourceLevel; _d < _e.length; _d++) {
719
- var lastLevelResource = _e[_d];
726
+ for (var _f = 0, _g = this.lastResourceLevel; _f < _g.length; _f++) {
727
+ var lastLevelResource = _g[_f];
720
728
  for (var i = 0; i < lastLevelResource.colSpan; i++) {
721
729
  lastColumnDates[parseInt(index.toString(), 10)].groupIndex = lastLevelResource.groupIndex;
722
730
  index++;
@@ -800,8 +808,8 @@ var ResourceBase = /** @class */ (function () {
800
808
  dateIndex++;
801
809
  };
802
810
  var this_3 = this;
803
- for (var _f = 0, headerDates_1 = headerDates; _f < headerDates_1.length; _f++) {
804
- var headerDate = headerDates_1[_f];
811
+ for (var _h = 0, headerDates_1 = headerDates; _h < headerDates_1.length; _h++) {
812
+ var headerDate = headerDates_1[_h];
805
813
  _loop_3(headerDate);
806
814
  }
807
815
  this.resourceDateTree = this.resourceDateTree.filter(function (data) { return data.length > 0; });
@@ -814,19 +822,23 @@ var ResourceBase = /** @class */ (function () {
814
822
  return dateHeaderLevels;
815
823
  }
816
824
  var dateColSpan = 0;
817
- for (var _g = 0, _h = levels[0]; _g < _h.length; _g++) {
818
- var firstRowTd = _h[_g];
825
+ for (var _j = 0, _k = levels[0]; _j < _k.length; _j++) {
826
+ var firstRowTd = _k[_j];
819
827
  dateColSpan += firstRowTd.colSpan;
820
828
  }
821
- for (var _j = 0, headerDates_2 = headerDates; _j < headerDates_2.length; _j++) {
822
- var headerDate = headerDates_2[_j];
829
+ for (var _l = 0, headerDates_2 = headerDates; _l < headerDates_2.length; _l++) {
830
+ var headerDate = headerDates_2[_l];
823
831
  headerDate.colSpan = dateColSpan;
824
832
  datesColumn.push(headerDate);
825
833
  var resGroup = extend([], levels, null, true);
826
834
  for (var k = 0, length_2 = resGroup.length; k < length_2; k++) {
835
+ for (var _m = 0, _o = resGroup[parseInt(k.toString(), 10)]; _m < _o.length; _m++) {
836
+ var resTd = _o[_m];
837
+ resTd.date = headerDate.date;
838
+ }
827
839
  if (k === resGroup.length - 1) {
828
- for (var _k = 0, _l = resGroup[parseInt(k.toString(), 10)]; _k < _l.length; _k++) {
829
- var resTd = _l[_k];
840
+ for (var _p = 0, _q = resGroup[parseInt(k.toString(), 10)]; _p < _q.length; _p++) {
841
+ var resTd = _q[_p];
830
842
  resTd.date = headerDate.date;
831
843
  resTd.workDays = headerDate.workDays;
832
844
  resTd.startHour = this.parent.getStartEndTime(resTd.resourceData[resTd.resource.startHourField]) ||
@@ -880,10 +892,13 @@ var ResourceBase = /** @class */ (function () {
880
892
  if (isNullOrUndefined(groupOrder) && this.parent.activeViewOptions.group.allowGroupEdit && resource.allowMultiple) {
881
893
  return undefined;
882
894
  }
883
- var id = isNullOrUndefined(groupOrder) ? eventObj[resource.field] : groupOrder[parseInt(colorFieldIndex.toString(), 10)];
884
- var data = this.filterData(resource.dataSource, resource.idField, id);
885
- if (data.length > 0) {
886
- return data[0][resource.colorField];
895
+ var isResourceEmpty = this.parent.isResourceCollectionEmpty();
896
+ if (!isResourceEmpty) {
897
+ var id = isNullOrUndefined(groupOrder) ? eventObj[resource.field] : groupOrder[parseInt(colorFieldIndex.toString(), 10)];
898
+ var data = this.filterData(resource.dataSource, resource.idField, id);
899
+ if (data.length > 0) {
900
+ return data[0][resource.colorField];
901
+ }
887
902
  }
888
903
  return undefined;
889
904
  };
@@ -450,6 +450,28 @@ export interface ScheduleModel extends ComponentModel{
450
450
  */
451
451
  showQuickInfo?: boolean;
452
452
 
453
+ /**
454
+ * Indicates whether the editor window and quick dialog popups are created and rendered in the DOM by default.
455
+ *
456
+ * When set to `true`, the popups are created during Scheduler initialization and reused throughout
457
+ * the component's lifetime. When set to `false`, the popups are created on demand when opened and
458
+ * destroyed when closed, reducing initial load but adding per-open creation cost.
459
+ *
460
+ * @remarks
461
+ * - Use `true` to minimize runtime allocations during interactions at the cost of higher initial setup.
462
+ * - Use `false` to reduce initial render cost and memory footprint when popups are infrequently used.
463
+ * - Toggling from `false` to `true` will keep subsequently created popups alive for reuse.
464
+ * *
465
+ * @example
466
+ * // Configure the editor to defer default popup creation.
467
+ * const options: ScheduleOptions= {
468
+ * prerenderDialogs: false
469
+ * };
470
+ *
471
+ * @default true
472
+ */
473
+ prerenderDialogs?: boolean;
474
+
453
475
  /**
454
476
  * This property helps user to add/edit the event in inline. By default, it is set to `false`.
455
477
  *
@@ -546,6 +546,27 @@ export declare class Schedule extends Component<HTMLElement> implements INotifyP
546
546
  * @default true
547
547
  */
548
548
  showQuickInfo: boolean;
549
+ /**
550
+ * Indicates whether the editor window and quick dialog popups are created and rendered in the DOM by default.
551
+ *
552
+ * When set to `true`, the popups are created during Scheduler initialization and reused throughout
553
+ * the component's lifetime. When set to `false`, the popups are created on demand when opened and
554
+ * destroyed when closed, reducing initial load but adding per-open creation cost.
555
+ *
556
+ * @remarks
557
+ * - Use `true` to minimize runtime allocations during interactions at the cost of higher initial setup.
558
+ * - Use `false` to reduce initial render cost and memory footprint when popups are infrequently used.
559
+ * - Toggling from `false` to `true` will keep subsequently created popups alive for reuse.
560
+ * *
561
+ * @example
562
+ * // Configure the editor to defer default popup creation.
563
+ * const options: ScheduleOptions= {
564
+ * prerenderDialogs: false
565
+ * };
566
+ *
567
+ * @default true
568
+ */
569
+ prerenderDialogs: boolean;
549
570
  /**
550
571
  * This property helps user to add/edit the event in inline. By default, it is set to `false`.
551
572
  *
@@ -1045,6 +1066,13 @@ export declare class Schedule extends Component<HTMLElement> implements INotifyP
1045
1066
  private validateDate;
1046
1067
  private getViewIndex;
1047
1068
  private setViewOptions;
1069
+ /**
1070
+ * Checks if resources have empty dataSource
1071
+ *
1072
+ * @returns {boolean} Returns true if resources have empty dataSource, otherwise false
1073
+ * @private
1074
+ */
1075
+ isResourceCollectionEmpty(): boolean;
1048
1076
  private getActiveViewOptions;
1049
1077
  private initializeDataModule;
1050
1078
  private setEditorTitles;
@@ -366,6 +366,19 @@ var Schedule = /** @class */ (function (_super) {
366
366
  (currentIndex === -1) ? 0 : currentIndex;
367
367
  }
368
368
  };
369
+ /**
370
+ * Checks if resources have empty dataSource
371
+ *
372
+ * @returns {boolean} Returns true if resources have empty dataSource, otherwise false
373
+ * @private
374
+ */
375
+ Schedule.prototype.isResourceCollectionEmpty = function () {
376
+ return this.resourceCollection.length > 0 &&
377
+ this.resourceCollection.some(function (res) {
378
+ var ds = res && res.dataSource;
379
+ return Array.isArray(ds) ? ds.length === 0 : !ds;
380
+ });
381
+ };
369
382
  Schedule.prototype.getActiveViewOptions = function () {
370
383
  var timeScale = {
371
384
  enable: this.timeScale.enable,
@@ -374,12 +387,20 @@ var Schedule = /** @class */ (function (_super) {
374
387
  majorSlotTemplate: this.timeScale.majorSlotTemplate,
375
388
  minorSlotTemplate: this.timeScale.minorSlotTemplate
376
389
  };
390
+ var isResourceEmpty = this.isResourceCollectionEmpty();
377
391
  var isYearView = this.viewCollections[this.viewIndex].option.indexOf('Year') > -1;
392
+ var groupResources = [];
393
+ if ((!isNullOrUndefined(this.group.resources) && this.group.resources.length > 0) && !isResourceEmpty) {
394
+ groupResources = this.group.resources;
395
+ }
396
+ else if (this.resources.length > 0 && !isResourceEmpty) {
397
+ groupResources = [];
398
+ }
378
399
  var group = {
379
- byDate: isYearView ? false : this.group.byDate,
400
+ byDate: (isYearView || isResourceEmpty) ? false : this.group.byDate,
380
401
  byGroupID: this.group.byGroupID,
381
402
  allowGroupEdit: this.group.allowGroupEdit,
382
- resources: isNullOrUndefined(this.group.resources) ? [] : this.group.resources,
403
+ resources: groupResources,
383
404
  headerTooltipTemplate: this.group.headerTooltipTemplate,
384
405
  enableCompactView: this.group.enableCompactView,
385
406
  hideNonWorkingDays: ['Day', 'Week', 'WorkWeek', 'Month'].indexOf(this.currentView) > -1 ? this.group.hideNonWorkingDays : false
@@ -894,7 +915,7 @@ var Schedule = /** @class */ (function (_super) {
894
915
  * @private
895
916
  */
896
917
  Schedule.prototype.removeSelectedClass = function () {
897
- var selectedCells = this.getSelectedCells();
918
+ var selectedCells = [].slice.call(this.element.querySelectorAll('.' + cls.SELECTED_CELL_CLASS));
898
919
  for (var _i = 0, selectedCells_1 = selectedCells; _i < selectedCells_1.length; _i++) {
899
920
  var cell = selectedCells_1[_i];
900
921
  cell.removeAttribute('tabindex');
@@ -1327,7 +1348,23 @@ var Schedule = /** @class */ (function (_super) {
1327
1348
  * @private
1328
1349
  */
1329
1350
  Schedule.prototype.getSelectedCells = function () {
1330
- return [].slice.call(this.element.querySelectorAll('.' + cls.SELECTED_CELL_CLASS));
1351
+ var selectedCells = [].slice.call(this.element.querySelectorAll('.' + cls.SELECTED_CELL_CLASS));
1352
+ if (!selectedCells || selectedCells.length === 0) {
1353
+ return [];
1354
+ }
1355
+ else if (selectedCells.length === 1) {
1356
+ return selectedCells;
1357
+ }
1358
+ if (selectedCells && selectedCells.length > 1) {
1359
+ var hasAnyWorkCells = selectedCells.some(function (cell) { return cell.classList.contains(cls.WORK_CELLS_CLASS); });
1360
+ var workCells = hasAnyWorkCells ?
1361
+ selectedCells.filter(function (cell) { return !cell.classList.contains(cls.ALLDAY_CELLS_CLASS); }) : selectedCells;
1362
+ if (!workCells || workCells.length === 0) {
1363
+ return [];
1364
+ }
1365
+ return workCells.slice().sort(function (a, b) { return (+a.dataset.date || 0) - (+b.dataset.date || 0); });
1366
+ }
1367
+ return selectedCells;
1331
1368
  };
1332
1369
  /**
1333
1370
  * Method to generate the announcement string
@@ -1526,6 +1563,17 @@ var Schedule = /** @class */ (function (_super) {
1526
1563
  state.isLayout = true;
1527
1564
  }
1528
1565
  break;
1566
+ case 'prerenderDialogs': {
1567
+ if (newProp.prerenderDialogs) {
1568
+ this.eventWindow.renderEventWindow();
1569
+ this.quickPopup.renderQuickDialog();
1570
+ }
1571
+ else {
1572
+ this.eventWindow.destroy(true);
1573
+ this.quickPopup.destroyQuickDialog();
1574
+ }
1575
+ break;
1576
+ }
1529
1577
  case 'showWeekend':
1530
1578
  case 'startHour':
1531
1579
  case 'endHour':
@@ -2835,6 +2883,9 @@ var Schedule = /** @class */ (function (_super) {
2835
2883
  */
2836
2884
  Schedule.prototype.openOverlapAlert = function (args) {
2837
2885
  var _this = this;
2886
+ if (!this.prerenderDialogs) {
2887
+ return;
2888
+ }
2838
2889
  if (this.quickPopup) {
2839
2890
  var eventProp = {
2840
2891
  type: 'OverlapAlert',
@@ -2858,6 +2909,9 @@ var Schedule = /** @class */ (function (_super) {
2858
2909
  */
2859
2910
  Schedule.prototype.closeOverlapAlert = function () {
2860
2911
  var _this = this;
2912
+ if (!this.prerenderDialogs) {
2913
+ return;
2914
+ }
2861
2915
  if (this.quickPopup) {
2862
2916
  var args = {
2863
2917
  type: 'OverlapAlert',
@@ -3169,6 +3223,9 @@ var Schedule = /** @class */ (function (_super) {
3169
3223
  __decorate([
3170
3224
  Property(true)
3171
3225
  ], Schedule.prototype, "showQuickInfo", void 0);
3226
+ __decorate([
3227
+ Property(true)
3228
+ ], Schedule.prototype, "prerenderDialogs", void 0);
3172
3229
  __decorate([
3173
3230
  Property(false)
3174
3231
  ], Schedule.prototype, "allowInline", void 0);
@@ -249,7 +249,7 @@ var AgendaBase = /** @class */ (function (_super) {
249
249
  groupOrder: resData[parseInt(res.toString(), 10)].groupOrder.slice(0, -1),
250
250
  resourceData: resData[parseInt(res.toString(), 10)].resourceData,
251
251
  groupIndex: (lastLevelInfo.length - data.length), className: [cls.RESOURCE_NAME],
252
- date: agendaDate
252
+ date: this.parent.activeViewOptions.group.byDate ? firstDate : agendaDate
253
253
  };
254
254
  lastLevelInfo[parseInt((lastLevelInfo.length - data.length).toString(), 10)].push(tempObj);
255
255
  tempLastLevelInfo.push(extend({}, tempObj, null, true));
@@ -277,7 +277,8 @@ var AgendaBase = /** @class */ (function (_super) {
277
277
  tempGroupedData[0].type = 'parentColumnLevel_' + (y + 1);
278
278
  tempGroupedData[0].resource = topResources[topResources.length - (y + 1)];
279
279
  tempGroupedData[0].resourceData = data[parseInt(x.toString(), 10)];
280
- tempGroupedData[0].date = agendaDate;
280
+ tempGroupedData[0].date = this.parent.activeViewOptions.group.byDate ?
281
+ tempLastLevelInfo[parseInt(u.toString(), 10)].date : agendaDate;
281
282
  lastLevelInfo[tempGroupedData[0].groupIndex].push(tempGroupedData[0]);
282
283
  tempGroupedData = [];
283
284
  totalRowSpan = 0;
@@ -28,7 +28,7 @@ export declare class EventWindow {
28
28
  private isEnterKey;
29
29
  private dialogEvent;
30
30
  constructor(parent: Schedule);
31
- private renderEventWindow;
31
+ renderEventWindow(): void;
32
32
  private renderDialogButtons;
33
33
  private addEventHandlers;
34
34
  refresh(): void;
@@ -27,7 +27,9 @@ var EventWindow = /** @class */ (function () {
27
27
  this.l10n = this.parent.localeObj;
28
28
  this.fields = this.parent.eventFields;
29
29
  this.eventWindowTime = { startTime: new Date(), endTime: new Date() };
30
- this.renderEventWindow();
30
+ if (this.parent.prerenderDialogs) {
31
+ this.renderEventWindow();
32
+ }
31
33
  }
32
34
  EventWindow.prototype.renderEventWindow = function () {
33
35
  this.element = createElement('div', { id: this.parent.element.id + '_dialog_wrapper' });
@@ -115,6 +117,9 @@ var EventWindow = /** @class */ (function () {
115
117
  }
116
118
  };
117
119
  EventWindow.prototype.openEditor = function (data, type, isEventData, repeatType) {
120
+ if (!this.parent.prerenderDialogs) {
121
+ this.renderEventWindow();
122
+ }
118
123
  this.parent.currentAction = type;
119
124
  this.parent.removeNewEventElement();
120
125
  if (this.parent.quickPopup) {
@@ -303,6 +308,9 @@ var EventWindow = /** @class */ (function () {
303
308
  }
304
309
  callBackPromise.resolve(args);
305
310
  });
311
+ if (!this.parent.prerenderDialogs && args.cancel) {
312
+ this.destroy(true);
313
+ }
306
314
  return callBackPromise;
307
315
  };
308
316
  EventWindow.prototype.onBeforeClose = function (args) {
@@ -330,6 +338,9 @@ var EventWindow = /** @class */ (function () {
330
338
  _this.resetForm();
331
339
  _this.parent.eventBase.focusElement(true);
332
340
  _this.eventCrudData = null;
341
+ if (!_this.parent.prerenderDialogs) {
342
+ _this.destroy(true);
343
+ }
333
344
  }
334
345
  }
335
346
  callBackPromise.resolve(args);
@@ -426,7 +437,8 @@ var EventWindow = /** @class */ (function () {
426
437
  else {
427
438
  this.createRecurrenceEditor(parentDiv);
428
439
  }
429
- if (this.parent.resourceCollection.length > 0) {
440
+ var isResourceEmpty = this.parent.isResourceCollectionEmpty();
441
+ if (this.parent.resourceCollection.length > 0 && !isResourceEmpty) {
430
442
  var resourceParentDiv = this.createDivElement(cls.EVENT_WINDOW_RESOURCES_DIV_CLASS);
431
443
  for (var _i = 0, _a = this.parent.resourceBase.resourceCollection; _i < _a.length; _i++) {
432
444
  var resource = _a[_i];
@@ -971,7 +983,8 @@ var EventWindow = /** @class */ (function () {
971
983
  if (cellsData.RecurrenceRule) {
972
984
  eventObj[this.fields.recurrenceRule] = cellsData.RecurrenceRule;
973
985
  }
974
- if (this.parent.resourceCollection.length > 0 || this.parent.activeViewOptions.group.resources.length > 0) {
986
+ var isResourceEmpty = this.parent.isResourceCollectionEmpty();
987
+ if ((this.parent.resourceCollection.length > 0 && !isResourceEmpty) || this.parent.activeViewOptions.group.resources.length > 0) {
975
988
  this.parent.resourceBase.setResourceValues(eventObj);
976
989
  }
977
990
  };
@@ -1580,7 +1593,7 @@ var EventWindow = /** @class */ (function () {
1580
1593
  if (endDate.getTime() >= new Date(+startDate).setMonth(startDate.getMonth() + interval)) {
1581
1594
  alertMessage = 'createError';
1582
1595
  }
1583
- if (isNullOrUndefined(alertMessage)) {
1596
+ if (isNullOrUndefined(alertMessage) && !isNullOrUndefined(this.parent.quickPopup.quickDialog)) {
1584
1597
  this.parent.quickPopup.quickDialog.hide();
1585
1598
  }
1586
1599
  }
@@ -19,7 +19,7 @@ export declare class QuickPopups {
19
19
  private render;
20
20
  private renderQuickPopup;
21
21
  private renderMorePopup;
22
- private renderQuickDialog;
22
+ renderQuickDialog(): void;
23
23
  private renderButton;
24
24
  private quickDialogClass;
25
25
  private applyFormValidation;
@@ -71,7 +71,7 @@ export declare class QuickPopups {
71
71
  refreshQuickDialog(): void;
72
72
  refreshQuickPopup(): void;
73
73
  refreshMorePopup(): void;
74
- private destroyQuickDialog;
74
+ destroyQuickDialog(): void;
75
75
  private destroyQuickPopup;
76
76
  private destroyMorePopup;
77
77
  destroy(): void;
@@ -25,7 +25,9 @@ var QuickPopups = /** @class */ (function () {
25
25
  QuickPopups.prototype.render = function () {
26
26
  this.renderQuickPopup();
27
27
  this.renderMorePopup();
28
- this.renderQuickDialog();
28
+ if (this.parent.prerenderDialogs) {
29
+ this.renderQuickDialog();
30
+ }
29
31
  };
30
32
  QuickPopups.prototype.renderQuickPopup = function () {
31
33
  var quickPopupWrapper = createElement('div', { className: cls.POPUP_WRAPPER_CLASS + ' e-popup-close', attrs: { role: 'dialog' } });
@@ -185,6 +187,9 @@ var QuickPopups = /** @class */ (function () {
185
187
  this.fieldValidator.renderFormValidator(form, rules, this.quickPopup.element, this.parent.locale);
186
188
  };
187
189
  QuickPopups.prototype.openRecurrenceAlert = function () {
190
+ if (!this.parent.prerenderDialogs) {
191
+ this.renderQuickDialog();
192
+ }
188
193
  var editDeleteOnly = this.quickDialog.element.querySelector('.' + cls.QUICK_DIALOG_ALERT_OK);
189
194
  if (editDeleteOnly) {
190
195
  editDeleteOnly.innerHTML = this.l10n.getConstant(this.parent.currentAction === 'Delete' ? 'deleteEvent' : 'editEvent');
@@ -206,6 +211,9 @@ var QuickPopups = /** @class */ (function () {
206
211
  this.showQuickDialog('RecurrenceAlert');
207
212
  };
208
213
  QuickPopups.prototype.openRecurrenceValidationAlert = function (type) {
214
+ if (!this.parent.prerenderDialogs) {
215
+ this.renderQuickDialog();
216
+ }
209
217
  this.quickDialogClass('Alert');
210
218
  var okButton = this.quickDialog.element.querySelector('.' + cls.QUICK_DIALOG_ALERT_OK);
211
219
  okButton.innerHTML = this.l10n.getConstant('ok');
@@ -249,6 +257,9 @@ var QuickPopups = /** @class */ (function () {
249
257
  if (this.parent.activeViewOptions.readonly) {
250
258
  return;
251
259
  }
260
+ if (!this.parent.prerenderDialogs) {
261
+ this.renderQuickDialog();
262
+ }
252
263
  var okButton = this.quickDialog.element.querySelector('.' + cls.QUICK_DIALOG_ALERT_OK);
253
264
  if (okButton) {
254
265
  okButton.innerHTML = this.l10n.getConstant('delete');
@@ -267,6 +278,9 @@ var QuickPopups = /** @class */ (function () {
267
278
  this.showQuickDialog('DeleteAlert');
268
279
  };
269
280
  QuickPopups.prototype.openValidationError = function (type, eventData) {
281
+ if (!this.parent.prerenderDialogs) {
282
+ this.renderQuickDialog();
283
+ }
270
284
  this.quickDialog.header = this.l10n.getConstant('alert');
271
285
  this.quickDialog.content = this.l10n.getConstant(type);
272
286
  var okButton = this.quickDialog.element.querySelector('.' + cls.QUICK_DIALOG_ALERT_OK);
@@ -296,6 +310,9 @@ var QuickPopups = /** @class */ (function () {
296
310
  if (!popupArgs.cancel) {
297
311
  _this.quickDialog.show();
298
312
  }
313
+ if (!_this.parent.prerenderDialogs && popupArgs.cancel) {
314
+ _this.destroyQuickDialog();
315
+ }
299
316
  });
300
317
  };
301
318
  QuickPopups.prototype.createMoreEventList = function (eventCollection, groupOrder, groupIndex) {
@@ -613,6 +630,7 @@ var QuickPopups = /** @class */ (function () {
613
630
  var cellDetails = void 0;
614
631
  var argsData = void 0;
615
632
  var resourceText = this.getResourceText(args, type.toLowerCase());
633
+ var isResourceEmpty = this.parent.isResourceCollectionEmpty();
616
634
  switch (type) {
617
635
  case 'Cell':
618
636
  cellDetails = this.getFormattedString(data);
@@ -647,7 +665,7 @@ var QuickPopups = /** @class */ (function () {
647
665
  content += '<div class="' + cls.DESCRIPTION_CLASS + '"><div class="' + cls.DESCRIPTION_ICON_CLASS + ' ' + cls.ICON +
648
666
  '"></div><div class="' + cls.DESCRIPTION_DETAILS_CLASS + ' ' + cls.TEXT_ELLIPSIS + '"></div></div>';
649
667
  }
650
- if (this.parent.resourceCollection.length > 0) {
668
+ if (this.parent.resourceCollection.length > 0 && !isResourceEmpty) {
651
669
  content += '<div class="' + cls.RESOURCE_CLASS + '"><div class="' + cls.RESOURCE_ICON_CLASS + ' ' + cls.ICON +
652
670
  '"></div><div class="' + cls.RESOURCE_DETAILS_CLASS + ' ' + cls.TEXT_ELLIPSIS + '"></div></div>';
653
671
  }
@@ -710,7 +728,8 @@ var QuickPopups = /** @class */ (function () {
710
728
  return footerTemplate;
711
729
  };
712
730
  QuickPopups.prototype.getResourceText = function (args, type) {
713
- if (this.parent.resourceCollection.length === 0) {
731
+ var isResourceEmpty = this.parent.isResourceCollectionEmpty();
732
+ if (this.parent.resourceCollection.length === 0 || isResourceEmpty) {
714
733
  return null;
715
734
  }
716
735
  var resourceValue = '';
@@ -950,7 +969,6 @@ var QuickPopups = /** @class */ (function () {
950
969
  };
951
970
  QuickPopups.prototype.dialogButtonClick = function (event) {
952
971
  this.dialogEvent = event;
953
- this.quickDialog.hide();
954
972
  var target = event.target;
955
973
  var cancelBtn = this.quickDialog.element.querySelector('.' + cls.QUICK_DIALOG_ALERT_CANCEL);
956
974
  var eventData = this.parent.activeEventData.event;
@@ -995,6 +1013,9 @@ var QuickPopups = /** @class */ (function () {
995
1013
  this.parent.uiStateValues.isIgnoreOccurrence = target.classList.contains(cls.QUICK_DIALOG_ALERT_CANCEL);
996
1014
  this.parent.eventWindow.eventSave(event, this.l10n.getConstant('ok'));
997
1015
  }
1016
+ if (!isNullOrUndefined(this.quickDialog)) {
1017
+ this.quickDialog.hide();
1018
+ }
998
1019
  };
999
1020
  QuickPopups.prototype.updateTapHoldEventPopup = function (target) {
1000
1021
  var selectedElements = this.parent.eventBase.getSelectedEventElements(target);
@@ -1062,6 +1083,9 @@ var QuickPopups = /** @class */ (function () {
1062
1083
  this.parent.trigger(event.popupClose, args, function (popupCloseArgs) {
1063
1084
  if (!popupCloseArgs.cancel) {
1064
1085
  _this.parent.eventBase.focusElement(true);
1086
+ if (!_this.parent.prerenderDialogs) {
1087
+ _this.destroyQuickDialog();
1088
+ }
1065
1089
  }
1066
1090
  });
1067
1091
  };
@@ -1388,7 +1412,9 @@ var QuickPopups = /** @class */ (function () {
1388
1412
  };
1389
1413
  QuickPopups.prototype.refreshQuickDialog = function () {
1390
1414
  this.destroyQuickDialog();
1391
- this.renderQuickDialog();
1415
+ if (this.parent.prerenderDialogs) {
1416
+ this.renderQuickDialog();
1417
+ }
1392
1418
  };
1393
1419
  QuickPopups.prototype.refreshQuickPopup = function () {
1394
1420
  this.destroyQuickPopup();
@@ -1399,7 +1425,7 @@ var QuickPopups = /** @class */ (function () {
1399
1425
  this.renderMorePopup();
1400
1426
  };
1401
1427
  QuickPopups.prototype.destroyQuickDialog = function () {
1402
- if (this.quickDialog.element) {
1428
+ if (this.quickDialog && this.quickDialog.element) {
1403
1429
  this.quickDialog.destroy();
1404
1430
  remove(this.quickDialog.element);
1405
1431
  this.quickDialog = null;