@datorama/core 22.12.6 → 22.12.7

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.
@@ -11554,6 +11554,9 @@
11554
11554
  }
11555
11555
  return value;
11556
11556
  }
11557
+ function isHtmlAllowedForCol(gridOptions, colDef) {
11558
+ return (!gridOptions.disabledHTMLRenderingFields || !gridOptions.disabledHTMLRenderingFields.includes(getColField(colDef)));
11559
+ }
11557
11560
 
11558
11561
  var GridQuery = /** @class */ (function (_super) {
11559
11562
  __extends(GridQuery, _super);
@@ -12110,18 +12113,25 @@
12110
12113
  var defaultEditableColumnRenderer = function (params) {
12111
12114
  return params && params.value ? "<div class=\"value-wrapper ellipsis\">" + params.value + "</div>" : null;
12112
12115
  };
12113
- var editableCellRendererWithSearchHighlight = function (params, searchTerm) {
12116
+ var editableCellRendererWithSearchHighlight = function (params, searchTerm, allowHTML) {
12114
12117
  if (!params || !params.value) {
12115
12118
  return null;
12116
12119
  }
12117
- return "<div class=\"value-wrapper ellipsis\">" + searchHighlightCellRenderer(params, searchTerm) + "</div>";
12120
+ return "<div class=\"value-wrapper ellipsis\">" + searchHighlightCellRenderer(params, searchTerm, allowHTML) + "</div>";
12118
12121
  };
12119
- var searchHighlightCellRenderer = function (params, searchTerm) {
12122
+ var searchHighlightCellRenderer = function (params, searchTerm, allowHTML) {
12123
+ if (allowHTML === void 0) { allowHTML = true; }
12124
+ var cellValue = (params.valueFormatted || params.value || '').toString();
12125
+ if (!allowHTML) {
12126
+ cellValue = escape(cellValue);
12127
+ }
12128
+ else {
12129
+ cellValue = DOMPurify.sanitize(cellValue);
12130
+ }
12120
12131
  searchTerm = (searchTerm || '').trim();
12121
- var value = (params.valueFormatted || params.value || '').toString();
12122
12132
  return searchTerm
12123
- ? value.replace(new RegExp(searchTerm, 'gi'), function (str) { return "<span class=\"search-highlight\">" + str + "</span>"; })
12124
- : value;
12133
+ ? cellValue.replace(new RegExp(searchTerm, 'gi'), function (str) { return "<span class=\"search-highlight\">" + str + "</span>"; })
12134
+ : cellValue;
12125
12135
  };
12126
12136
 
12127
12137
  (function (GridMinWidths) {
@@ -13792,7 +13802,7 @@
13792
13802
  type: exports.DatoGridColumnTypes.String,
13793
13803
  menuTabs: ['filterMenuTab'],
13794
13804
  headerComponentFramework: DatoGridColumnHeaderComponent
13795
- }, suppressCellSelection: true, suppressPropertyNamesCheck: true, rowHeight: 35, headerHeight: 30, rowSelection: exports.GridRowSelectionType.MULTIPLE, rowDeselection: true, unSortIcon: true, animateRows: true, rememberGroupStateWhenNewData: true, groupMultiAutoColumn: true, groupDefaultExpanded: -1, usePivotGridStyle: false }, (isTestEnv() ? { suppressColumnVirtualisation: true, rowBuffer: 99999 } : {}));
13805
+ }, suppressCellSelection: true, suppressPropertyNamesCheck: true, rowHeight: 35, headerHeight: 30, rowSelection: exports.GridRowSelectionType.MULTIPLE, rowDeselection: true, unSortIcon: true, animateRows: true, rememberGroupStateWhenNewData: true, groupMultiAutoColumn: true, groupDefaultExpanded: -1, usePivotGridStyle: false, disabledHTMLRenderingFields: [] }, (isTestEnv() ? { suppressColumnVirtualisation: true, rowBuffer: 99999 } : {}));
13796
13806
  var DEFAULT_GRID_SEARCH_DEBOUNCE_TIME = {
13797
13807
  CLIENT: 200,
13798
13808
  SERVER: 250
@@ -14480,11 +14490,12 @@
14480
14490
  !this.hasCellRenderer(normalized, gridOptions) &&
14481
14491
  gridOptions.enableSearchHighlight) {
14482
14492
  normalized.cellRenderer = function (params) {
14493
+ var allowHTML = isHtmlAllowedForCol(gridOptions, params.colDef);
14483
14494
  var isEditable = (isFunction(normalized.editable) && normalized.editable(params)) ||
14484
14495
  (!isFunction(normalized.editable) && normalized.editable);
14485
14496
  return isEditable
14486
- ? editableCellRendererWithSearchHighlight(params, _this.gridQuery.getSearchTerm())
14487
- : searchHighlightCellRenderer(params, _this.gridQuery.getSearchTerm());
14497
+ ? editableCellRendererWithSearchHighlight(params, _this.gridQuery.getSearchTerm(), allowHTML)
14498
+ : searchHighlightCellRenderer(params, _this.gridQuery.getSearchTerm(), allowHTML);
14488
14499
  };
14489
14500
  }
14490
14501
  };
@@ -15825,7 +15836,7 @@
15825
15836
  rowActions: this.rowActions
15826
15837
  };
15827
15838
  var normalized = this.gridService.normalizeOptions(params);
15828
- var defaults = __assign(__assign(__assign({}, defaultGridOptions), (this.gridOptions.treeData ? defaultTreeOptions : {})), { icons: this.getGridIcons() });
15839
+ var defaults = __assign(__assign(__assign({}, defaultGridOptions), (this.gridOptions.treeData ? defaultTreeOptions : {})), { icons: this.getGridIcons(), disabledHTMLRenderingFields: normalized.disabledHTMLRenderingFields || defaultGridOptions.disabledHTMLRenderingFields });
15829
15840
  return deepmerge(defaults, normalized);
15830
15841
  };
15831
15842
  DatoGridControllerComponent.prototype.setGridRows = function (data) {
@@ -16037,18 +16048,19 @@
16037
16048
  var textOverflow = cell.offsetWidth < cell.scrollWidth;
16038
16049
  if (textOverflow) {
16039
16050
  clearTimeout(this.cellMouseOutTimer);
16040
- var params = { cell: cell, value: cell.innerText };
16051
+ var allowHTML = isHtmlAllowedForCol(this.gridOptions, event.colDef);
16052
+ var params = { cell: cell, value: cell.innerText, allowHTML: allowHTML };
16041
16053
  isNil(this.tooltip) ? this.createAndShowTooltip(params) : this.updateTooltip(params);
16042
16054
  }
16043
16055
  };
16044
16056
  DatoGridControllerComponent.prototype.createAndShowTooltip = function (_a) {
16045
- var cell = _a.cell, value = _a.value;
16057
+ var cell = _a.cell, value = _a.value, allowHTML = _a.allowHTML;
16046
16058
  this.tooltip = new Tooltip(cell, {
16047
16059
  placement: 'top',
16048
16060
  container: document.body,
16049
16061
  trigger: 'manual',
16050
- title: DOMPurify.sanitize(value),
16051
- html: true,
16062
+ title: allowHTML ? DOMPurify.sanitize(value) : value,
16063
+ html: allowHTML,
16052
16064
  popperOptions: {
16053
16065
  modifiers: {
16054
16066
  preventOverflow: { enabled: false }
@@ -25687,7 +25699,7 @@
25687
25699
  };
25688
25700
  }
25689
25701
 
25690
- window.coreVersion = '22.12.6';
25702
+ window.coreVersion = '22.12.7';
25691
25703
 
25692
25704
  exports.APP_TRANSLATE = APP_TRANSLATE;
25693
25705
  exports.AceService = AceService;