@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.
@@ -11355,6 +11355,9 @@ function tryParsePivotValue(str) {
11355
11355
  }
11356
11356
  return value;
11357
11357
  }
11358
+ function isHtmlAllowedForCol(gridOptions, colDef) {
11359
+ return (!gridOptions.disabledHTMLRenderingFields || !gridOptions.disabledHTMLRenderingFields.includes(getColField(colDef)));
11360
+ }
11358
11361
 
11359
11362
  var GridQuery = /** @class */ (function (_super) {
11360
11363
  __extends(GridQuery, _super);
@@ -11911,18 +11914,25 @@ var DATO_GRID_STORAGE_API = new InjectionToken('DATO_GRID_STORAGE_API');
11911
11914
  var defaultEditableColumnRenderer = function (params) {
11912
11915
  return params && params.value ? "<div class=\"value-wrapper ellipsis\">" + params.value + "</div>" : null;
11913
11916
  };
11914
- var editableCellRendererWithSearchHighlight = function (params, searchTerm) {
11917
+ var editableCellRendererWithSearchHighlight = function (params, searchTerm, allowHTML) {
11915
11918
  if (!params || !params.value) {
11916
11919
  return null;
11917
11920
  }
11918
- return "<div class=\"value-wrapper ellipsis\">" + searchHighlightCellRenderer(params, searchTerm) + "</div>";
11921
+ return "<div class=\"value-wrapper ellipsis\">" + searchHighlightCellRenderer(params, searchTerm, allowHTML) + "</div>";
11919
11922
  };
11920
- var searchHighlightCellRenderer = function (params, searchTerm) {
11923
+ var searchHighlightCellRenderer = function (params, searchTerm, allowHTML) {
11924
+ if (allowHTML === void 0) { allowHTML = true; }
11925
+ var cellValue = (params.valueFormatted || params.value || '').toString();
11926
+ if (!allowHTML) {
11927
+ cellValue = escape(cellValue);
11928
+ }
11929
+ else {
11930
+ cellValue = DOMPurify.sanitize(cellValue);
11931
+ }
11921
11932
  searchTerm = (searchTerm || '').trim();
11922
- var value = (params.valueFormatted || params.value || '').toString();
11923
11933
  return searchTerm
11924
- ? value.replace(new RegExp(searchTerm, 'gi'), function (str) { return "<span class=\"search-highlight\">" + str + "</span>"; })
11925
- : value;
11934
+ ? cellValue.replace(new RegExp(searchTerm, 'gi'), function (str) { return "<span class=\"search-highlight\">" + str + "</span>"; })
11935
+ : cellValue;
11926
11936
  };
11927
11937
  var GridMinWidths;
11928
11938
  (function (GridMinWidths) {
@@ -13593,7 +13603,7 @@ var defaultGridOptions = __assign({
13593
13603
  type: DatoGridColumnTypes.String,
13594
13604
  menuTabs: ['filterMenuTab'],
13595
13605
  headerComponentFramework: DatoGridColumnHeaderComponent
13596
- }, suppressCellSelection: true, suppressPropertyNamesCheck: true, rowHeight: 35, headerHeight: 30, rowSelection: GridRowSelectionType.MULTIPLE, rowDeselection: true, unSortIcon: true, animateRows: true, rememberGroupStateWhenNewData: true, groupMultiAutoColumn: true, groupDefaultExpanded: -1, usePivotGridStyle: false }, (isTestEnv() ? { suppressColumnVirtualisation: true, rowBuffer: 99999 } : {}));
13606
+ }, suppressCellSelection: true, suppressPropertyNamesCheck: true, rowHeight: 35, headerHeight: 30, rowSelection: GridRowSelectionType.MULTIPLE, rowDeselection: true, unSortIcon: true, animateRows: true, rememberGroupStateWhenNewData: true, groupMultiAutoColumn: true, groupDefaultExpanded: -1, usePivotGridStyle: false, disabledHTMLRenderingFields: [] }, (isTestEnv() ? { suppressColumnVirtualisation: true, rowBuffer: 99999 } : {}));
13597
13607
  var DEFAULT_GRID_SEARCH_DEBOUNCE_TIME = {
13598
13608
  CLIENT: 200,
13599
13609
  SERVER: 250
@@ -14281,11 +14291,12 @@ var GridService = /** @class */ (function () {
14281
14291
  !this.hasCellRenderer(normalized, gridOptions) &&
14282
14292
  gridOptions.enableSearchHighlight) {
14283
14293
  normalized.cellRenderer = function (params) {
14294
+ var allowHTML = isHtmlAllowedForCol(gridOptions, params.colDef);
14284
14295
  var isEditable = (isFunction(normalized.editable) && normalized.editable(params)) ||
14285
14296
  (!isFunction(normalized.editable) && normalized.editable);
14286
14297
  return isEditable
14287
- ? editableCellRendererWithSearchHighlight(params, _this.gridQuery.getSearchTerm())
14288
- : searchHighlightCellRenderer(params, _this.gridQuery.getSearchTerm());
14298
+ ? editableCellRendererWithSearchHighlight(params, _this.gridQuery.getSearchTerm(), allowHTML)
14299
+ : searchHighlightCellRenderer(params, _this.gridQuery.getSearchTerm(), allowHTML);
14289
14300
  };
14290
14301
  }
14291
14302
  };
@@ -15626,7 +15637,7 @@ var DatoGridControllerComponent = /** @class */ (function () {
15626
15637
  rowActions: this.rowActions
15627
15638
  };
15628
15639
  var normalized = this.gridService.normalizeOptions(params);
15629
- var defaults = __assign(__assign(__assign({}, defaultGridOptions), (this.gridOptions.treeData ? defaultTreeOptions : {})), { icons: this.getGridIcons() });
15640
+ var defaults = __assign(__assign(__assign({}, defaultGridOptions), (this.gridOptions.treeData ? defaultTreeOptions : {})), { icons: this.getGridIcons(), disabledHTMLRenderingFields: normalized.disabledHTMLRenderingFields || defaultGridOptions.disabledHTMLRenderingFields });
15630
15641
  return deepmerge(defaults, normalized);
15631
15642
  };
15632
15643
  DatoGridControllerComponent.prototype.setGridRows = function (data) {
@@ -15838,18 +15849,19 @@ var DatoGridControllerComponent = /** @class */ (function () {
15838
15849
  var textOverflow = cell.offsetWidth < cell.scrollWidth;
15839
15850
  if (textOverflow) {
15840
15851
  clearTimeout(this.cellMouseOutTimer);
15841
- var params = { cell: cell, value: cell.innerText };
15852
+ var allowHTML = isHtmlAllowedForCol(this.gridOptions, event.colDef);
15853
+ var params = { cell: cell, value: cell.innerText, allowHTML: allowHTML };
15842
15854
  isNil(this.tooltip) ? this.createAndShowTooltip(params) : this.updateTooltip(params);
15843
15855
  }
15844
15856
  };
15845
15857
  DatoGridControllerComponent.prototype.createAndShowTooltip = function (_a) {
15846
- var cell = _a.cell, value = _a.value;
15858
+ var cell = _a.cell, value = _a.value, allowHTML = _a.allowHTML;
15847
15859
  this.tooltip = new Tooltip(cell, {
15848
15860
  placement: 'top',
15849
15861
  container: document.body,
15850
15862
  trigger: 'manual',
15851
- title: DOMPurify.sanitize(value),
15852
- html: true,
15863
+ title: allowHTML ? DOMPurify.sanitize(value) : value,
15864
+ html: allowHTML,
15853
15865
  popperOptions: {
15854
15866
  modifiers: {
15855
15867
  preventOverflow: { enabled: false }
@@ -25488,7 +25500,7 @@ function fixNgLeaks() {
25488
25500
  };
25489
25501
  }
25490
25502
 
25491
- window.coreVersion = '22.12.6';
25503
+ window.coreVersion = '22.12.7';
25492
25504
 
25493
25505
  /**
25494
25506
  * @license