@syncfusion/ej2-schedule 21.1.39 → 21.2.3

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.
@@ -6260,7 +6260,7 @@ class EventBase {
6260
6260
  }
6261
6261
  else {
6262
6262
  const appointmentSubject = createElement('div', { className: SUBJECT_CLASS });
6263
- appointmentSubject.innerText = this.parent.sanitize(eventSubject);
6263
+ this.parent.sanitize(eventSubject, appointmentSubject);
6264
6264
  templateElement = [appointmentSubject];
6265
6265
  }
6266
6266
  append(templateElement, appointmentWrapper);
@@ -6786,7 +6786,7 @@ class VerticalEvent extends EventBase {
6786
6786
  }
6787
6787
  else {
6788
6788
  const appointmentSubject = createElement('div', { className: SUBJECT_CLASS });
6789
- appointmentSubject.innerText = this.parent.sanitize(recordSubject);
6789
+ this.parent.sanitize(recordSubject, appointmentSubject);
6790
6790
  if (isAllDay) {
6791
6791
  if (record[fieldMapping.isAllDay]) {
6792
6792
  templateElement = [appointmentSubject];
@@ -6819,7 +6819,7 @@ class VerticalEvent extends EventBase {
6819
6819
  innerHTML: timeStr
6820
6820
  });
6821
6821
  const appointmentLocation = createElement('div', { className: LOCATION_CLASS });
6822
- appointmentLocation.innerText = this.parent.sanitize((record[fieldMapping.location] || this.parent.eventSettings.fields.location.default || ''));
6822
+ this.parent.sanitize((record[fieldMapping.location] || this.parent.eventSettings.fields.location.default || ''), appointmentLocation);
6823
6823
  templateElement = [appointmentSubject, appointmentTime, appointmentLocation];
6824
6824
  }
6825
6825
  }
@@ -7664,7 +7664,7 @@ class MonthEvent extends EventBase {
7664
7664
  else {
7665
7665
  const eventLocation = (record[this.fields.location] || this.parent.eventSettings.fields.location.default || '');
7666
7666
  const appointmentSubject = createElement('div', { className: SUBJECT_CLASS });
7667
- appointmentSubject.innerText = this.parent.sanitize((eventSubject + (eventLocation ? '; ' + eventLocation : '')));
7667
+ this.parent.sanitize((eventSubject + (eventLocation ? '; ' + eventLocation : '')), appointmentSubject);
7668
7668
  const appointmentStartTime = createElement('div', {
7669
7669
  className: APPOINTMENT_TIME + (this.parent.isAdaptive ? ' ' + DISABLE_CLASS : ''),
7670
7670
  innerHTML: this.parent.getTimeString(eventData[this.fields.startTime])
@@ -7708,7 +7708,7 @@ class MonthEvent extends EventBase {
7708
7708
  className: APPOINTMENT_TIME + (this.parent.isAdaptive ? ' ' + DISABLE_CLASS : ''), innerHTML: timeString
7709
7709
  });
7710
7710
  const appLocation = createElement('div', { className: LOCATION_CLASS });
7711
- appLocation.innerText = this.parent.sanitize(eventLocation);
7711
+ this.parent.sanitize(eventLocation, appLocation);
7712
7712
  innerElement = [appointmentSubject, appTime, appLocation];
7713
7713
  }
7714
7714
  const wrap = createElement('div', { className: 'e-inner-wrap' });
@@ -9124,7 +9124,7 @@ class QuickPopups {
9124
9124
  }
9125
9125
  else {
9126
9126
  appointmentElement.appendChild(createElement('div', { className: SUBJECT_CLASS }));
9127
- appointmentElement.firstElementChild.innerText = this.parent.sanitize(eventText);
9127
+ this.parent.sanitize(eventText, appointmentElement.firstElementChild);
9128
9128
  }
9129
9129
  if (!isNullOrUndefined(groupIndex)) {
9130
9130
  appointmentElement.setAttribute('data-group-index', groupIndex);
@@ -9379,7 +9379,7 @@ class QuickPopups {
9379
9379
  const templateWrapper = createElement('div', { innerHTML: header });
9380
9380
  if (headerType === 'Event') {
9381
9381
  const subjectText = templateWrapper.querySelector('.' + SUBJECT_CLASS);
9382
- subjectText.innerText = this.parent.sanitize(args.eventSubject);
9382
+ this.parent.sanitize(args.eventSubject, subjectText);
9383
9383
  }
9384
9384
  append([].slice.call(templateWrapper.childNodes), headerTemplate);
9385
9385
  }
@@ -9443,19 +9443,19 @@ class QuickPopups {
9443
9443
  if (data[this.parent.eventFields.location]) {
9444
9444
  const locationDetails = templateWrapper.querySelector('.' + LOCATION_DETAILS_CLASS);
9445
9445
  if (!isNullOrUndefined(locationDetails)) {
9446
- locationDetails.innerText = this.parent.sanitize(data[this.parent.eventFields.location]);
9446
+ this.parent.sanitize(data[this.parent.eventFields.location], locationDetails);
9447
9447
  }
9448
9448
  }
9449
9449
  if (data[this.parent.eventFields.description]) {
9450
9450
  const descriptionDetails = templateWrapper.querySelector('.' + DESCRIPTION_DETAILS_CLASS);
9451
9451
  if (!isNullOrUndefined(descriptionDetails)) {
9452
- descriptionDetails.innerText = this.parent.sanitize(data[this.parent.eventFields.description]);
9452
+ this.parent.sanitize(data[this.parent.eventFields.description], descriptionDetails);
9453
9453
  }
9454
9454
  }
9455
9455
  if (resourceText) {
9456
9456
  const resourceDetails = templateWrapper.querySelector('.' + RESOURCE_DETAILS_CLASS);
9457
9457
  if (!isNullOrUndefined(resourceDetails)) {
9458
- resourceDetails.innerText = this.parent.sanitize(resourceText);
9458
+ this.parent.sanitize(resourceText, resourceDetails);
9459
9459
  }
9460
9460
  }
9461
9461
  append([].slice.call(templateWrapper.childNodes), contentTemplate);
@@ -11687,6 +11687,7 @@ class EventWindow {
11687
11687
  for (const element of formElements) {
11688
11688
  remove(element);
11689
11689
  }
11690
+ this.parent.resetTemplates(['editorTemplate']);
11690
11691
  }
11691
11692
  const templateId = this.parent.element.id + '_editorTemplate';
11692
11693
  const tempEle = [].slice.call(this.parent.getEditorTemplate()(args || {}, this.parent, 'editorTemplate', templateId, false));
@@ -12250,8 +12251,11 @@ class EventWindow {
12250
12251
  }
12251
12252
  }
12252
12253
  applyFormValidation() {
12253
- const getValidationRule = (rules) => (rules && Object.keys(rules).length > 0) ? rules : undefined;
12254
12254
  const form = this.element.querySelector('.' + FORM_CLASS);
12255
+ if (!form) {
12256
+ return;
12257
+ }
12258
+ const getValidationRule = (rules) => (rules && Object.keys(rules).length > 0) ? rules : undefined;
12255
12259
  const rules = {};
12256
12260
  const subjectRule = getValidationRule(this.parent.eventSettings.fields.subject.validation);
12257
12261
  if (!isNullOrUndefined(subjectRule)) {
@@ -13062,7 +13066,8 @@ class EventWindow {
13062
13066
  value = element.checked;
13063
13067
  }
13064
13068
  else {
13065
- value = this.parent.sanitize(element.value);
13069
+ value = this.parent.enableHtmlSanitizer ?
13070
+ SanitizeHtmlHelper.sanitize(element.value) : element.value;
13066
13071
  }
13067
13072
  }
13068
13073
  return value;
@@ -13206,6 +13211,9 @@ class EventWindow {
13206
13211
  else if (element.classList.contains('e-multiselect')) {
13207
13212
  instance = element.ej2_instances;
13208
13213
  }
13214
+ else if (element.classList.contains('e-numerictextbox')) {
13215
+ instance = element.ej2_instances;
13216
+ }
13209
13217
  if (instance && instance[0]) {
13210
13218
  instance[0].destroy();
13211
13219
  }
@@ -13748,7 +13756,7 @@ class Render {
13748
13756
  this.parent.virtualScrollModule.destroy();
13749
13757
  this.parent.virtualScrollModule = null;
13750
13758
  }
13751
- if ((['Agenda', 'Year'].indexOf(this.parent.currentView) === -1 ||
13759
+ if ((['Agenda', 'MonthAgenda', 'Year', 'TimelineYear'].indexOf(this.parent.currentView) === -1 ||
13752
13760
  (this.parent.currentView === 'TimelineYear' && this.parent.activeViewOptions.orientation === 'Vertical'))
13753
13761
  && this.parent.activeViewOptions.allowVirtualScrolling
13754
13762
  && this.parent.activeViewOptions.group.resources.length > 0 && !this.parent.uiStateValues.isGroupAdaptive) {
@@ -15348,7 +15356,7 @@ class ResourceBase {
15348
15356
  const resourceLevel = this.resourceCollection[parseInt(i.toString(), 10)];
15349
15357
  const resourceText = resourceLevel.dataSource.filter((resData) => resData[resourceLevel.idField] === resource.groupOrder[parseInt(i.toString(), 10)]);
15350
15358
  const resourceName = createElement('div', { className: RESOURCE_NAME });
15351
- resourceName.innerText = this.parent.sanitize(resourceText[0][resourceLevel.textField]);
15359
+ this.parent.sanitize(resourceText[0][resourceLevel.textField], resourceName);
15352
15360
  headerCollection.push(resourceName);
15353
15361
  const levelIcon = createElement('div', { className: 'e-icons e-icon-next' });
15354
15362
  headerCollection.push(levelIcon);
@@ -16079,17 +16087,20 @@ let Schedule = class Schedule extends Component {
16079
16087
  }
16080
16088
  }
16081
16089
  /**
16082
- * Method to sanitize any suspected untrusted strings and scripts before rendering them.
16090
+ * This method renders untrusted strings and scripts securely by sanitizing them first.
16083
16091
  *
16084
16092
  * @param {string} value - A string value representing the HTML string value to be sanitized.
16085
- * @returns {string} A sanitized Html string.
16093
+ * @param {HTMLElement} element - An HTML element to which the sanitized or unsanitized HTML string will be assigned.
16094
+ * @returns {void}
16086
16095
  * @private
16087
16096
  */
16088
- sanitize(value) {
16097
+ sanitize(value, element) {
16089
16098
  if (this.enableHtmlSanitizer) {
16090
- return SanitizeHtmlHelper.sanitize(value);
16099
+ element.innerText = SanitizeHtmlHelper.sanitize(value);
16100
+ }
16101
+ else {
16102
+ element.innerHTML = value;
16091
16103
  }
16092
- return value;
16093
16104
  }
16094
16105
  initializeResources(isSetModel = false) {
16095
16106
  if (this.resources.length > 0) {
@@ -19162,6 +19173,9 @@ class ActionBase {
19162
19173
  return event;
19163
19174
  }
19164
19175
  dynamicYearlyEventsRendering(event, isResize = false) {
19176
+ if (!isNullOrUndefined(this.parent.eventDragArea)) {
19177
+ return;
19178
+ }
19165
19179
  let appWidth = this.actionObj.cellWidth - 7;
19166
19180
  if (isResize && (this.resizeEdges.left || this.resizeEdges.right)) {
19167
19181
  appWidth = this.actionObj.cellWidth * event.count;
@@ -19231,6 +19245,9 @@ class ActionBase {
19231
19245
  return appointmentWrapper;
19232
19246
  }
19233
19247
  dynamicEventsRendering(event) {
19248
+ if (!isNullOrUndefined(this.parent.eventDragArea)) {
19249
+ return;
19250
+ }
19234
19251
  let dateRender = this.parent.activeView.renderDates;
19235
19252
  let workCells = [].slice.call(this.parent.element.querySelectorAll('.' + WORK_CELLS_CLASS));
19236
19253
  let workDays = this.parent.activeViewOptions.workDays;
@@ -19265,7 +19282,7 @@ class ActionBase {
19265
19282
  this.monthEvent.applyResourceColor(appointmentElement, event, 'backgroundColor', groupOrder);
19266
19283
  setStyleAttribute(appointmentElement, { 'width': appWidth + 'px', 'border': '0px', 'pointer-events': 'none' });
19267
19284
  const cellTd = workCells[parseInt(day.toString(), 10)];
19268
- if (cellTd && isNullOrUndefined(this.parent.eventDragArea)) {
19285
+ if (cellTd) {
19269
19286
  this.monthEvent.renderElement(cellTd, appointmentElement, true);
19270
19287
  this.actionObj.cloneElement.push(appointmentElement);
19271
19288
  }
@@ -21339,9 +21356,11 @@ class DragAndDrop extends ActionBase {
21339
21356
  }
21340
21357
  }
21341
21358
  const event = this.getUpdatedEvent(this.actionObj.start, this.actionObj.end, this.actionObj.event);
21342
- const eventWrappers = [].slice.call(this.parent.element.querySelectorAll('.' + CLONE_ELEMENT_CLASS));
21343
- for (const wrapper of eventWrappers) {
21344
- remove(wrapper);
21359
+ if (isNullOrUndefined(this.parent.eventDragArea)) {
21360
+ const eventWrappers = [].slice.call(this.parent.element.querySelectorAll('.' + CLONE_ELEMENT_CLASS));
21361
+ for (const wrapper of eventWrappers) {
21362
+ remove(wrapper);
21363
+ }
21345
21364
  }
21346
21365
  if (this.multiData && this.multiData.length > 0) {
21347
21366
  const startTime = resetTime(new Date(event[this.parent.eventFields.startTime]));
@@ -22117,7 +22136,7 @@ class ViewBase {
22117
22136
  }
22118
22137
  else {
22119
22138
  const resourceText = createElement('div', { className: className });
22120
- resourceText.innerText = this.parent.sanitize(tdData.resourceData[tdData.resource.textField]);
22139
+ this.parent.sanitize(tdData.resourceData[tdData.resource.textField], resourceText);
22121
22140
  tdElement.appendChild(resourceText);
22122
22141
  }
22123
22142
  }
@@ -24355,11 +24374,11 @@ class AgendaBase extends ViewBase {
24355
24374
  eventSubject += ',';
24356
24375
  }
24357
24376
  const appSubjectText = createElement('div', { className: SUBJECT_CLASS });
24358
- appSubjectText.innerText = this.parent.sanitize(eventSubject);
24377
+ this.parent.sanitize(eventSubject, appSubjectText);
24359
24378
  appSubjectWrap.appendChild(appSubjectText);
24360
24379
  if (!isNullOrUndefined(eventLocation) && eventLocation !== '') {
24361
24380
  const appLocation = createElement('div', { className: LOCATION_CLASS });
24362
- appLocation.innerText = this.parent.sanitize(eventLocation);
24381
+ this.parent.sanitize(eventLocation, appLocation);
24363
24382
  appSubjectWrap.appendChild(appLocation);
24364
24383
  }
24365
24384
  if (!isNullOrUndefined(event[fieldMapping.recurrenceRule])) {