"));
- }
-
- var detailViewTemplate = '';
-
- if (Utils.hasDetailViewIcon(this.options)) {
- detailViewTemplate = '
';
-
- if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
- detailViewTemplate += "\n \n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n \n ");
- }
-
- detailViewTemplate += ' | ';
- }
-
- if (detailViewTemplate && this.options.detailViewAlign !== 'right') {
- html.push(detailViewTemplate);
- }
-
- this.header.fields.forEach(function (field, j) {
- var text = '';
- var value_ = Utils.getItemField(item, field, _this7.options.escape);
- var value = '';
- var type = '';
- var cellStyle = {};
- var id_ = '';
- var class_ = _this7.header.classes[j];
- var style_ = '';
- var styleToAdd_ = '';
- var data_ = '';
- var rowspan_ = '';
- var colspan_ = '';
- var title_ = '';
- var column = _this7.columns[j];
-
- if ((_this7.fromHtml || _this7.autoMergeCells) && typeof value_ === 'undefined') {
- if (!column.checkbox && !column.radio) {
- return;
- }
- }
-
- if (!column.visible) {
- return;
- }
-
- if (_this7.options.cardView && !column.cardVisible) {
- return;
- }
-
- if (column.escape) {
- value_ = Utils.escapeHTML(value_);
- } // Style concat
-
-
- if (csses.concat([_this7.header.styles[j]]).length) {
- styleToAdd_ += "".concat(csses.concat([_this7.header.styles[j]]).join('; '));
- }
-
- if (item["_".concat(field, "_style")]) {
- styleToAdd_ += "".concat(item["_".concat(field, "_style")]);
- }
-
- if (styleToAdd_) {
- style_ = " style=\"".concat(styleToAdd_, "\"");
- } // Style concat
- // handle id and class of td
-
-
- if (item["_".concat(field, "_id")]) {
- id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
- }
-
- if (item["_".concat(field, "_class")]) {
- class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
- }
-
- if (item["_".concat(field, "_rowspan")]) {
- rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
- }
-
- if (item["_".concat(field, "_colspan")]) {
- colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
- }
-
- if (item["_".concat(field, "_title")]) {
- title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
- }
-
- cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
-
- if (cellStyle.classes) {
- class_ = " class=\"".concat(cellStyle.classes, "\"");
- }
-
- if (cellStyle.css) {
- var csses_ = [];
-
- for (var _i10 = 0, _Object$entries9 = Object.entries(cellStyle.css); _i10 < _Object$entries9.length; _i10++) {
- var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2),
- _key3 = _Object$entries9$_i[0],
- _value2 = _Object$entries9$_i[1];
-
- csses_.push("".concat(_key3, ": ").concat(_value2));
- }
-
- style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
- }
-
- value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
-
- if (!(column.checkbox || column.radio)) {
- value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
- }
-
- if (column.searchable && _this7.searchText && _this7.options.searchHighlight) {
- var defValue = '';
- var regExp = new RegExp("(".concat(_this7.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), ")"), 'gim');
- var marker = '
$1';
- var isHTML = value && /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(value);
-
- if (isHTML) {
- // value can contains a HTML tags
- var textContent = new DOMParser().parseFromString(value.toString(), 'text/html').documentElement.textContent;
- var textReplaced = textContent.replace(regExp, marker);
- defValue = value.replace(new RegExp("(>\\s*)(".concat(textContent, ")(\\s*)"), 'gm'), "$1".concat(textReplaced, "$3"));
- } else {
- // but usually not
- defValue = value.toString().replace(regExp, marker);
- }
-
- value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, _this7.searchText], defValue);
- }
-
- if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
- for (var _i11 = 0, _Object$entries10 = Object.entries(item["_".concat(field, "_data")]); _i11 < _Object$entries10.length; _i11++) {
- var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2),
- _k = _Object$entries10$_i[0],
- _v = _Object$entries10$_i[1];
-
- // ignore data-index
- if (_k === 'index') {
- return;
- }
-
- data_ += " data-".concat(_k, "=\"").concat(_v, "\"");
- }
- }
-
- if (column.checkbox || column.radio) {
- type = column.checkbox ? 'checkbox' : type;
- type = column.radio ? 'radio' : type;
- var c = column['class'] || '';
- var isChecked = Utils.isObject(value) && value.hasOwnProperty('checked') ? value.checked : (value === true || value_) && value !== false;
- var isDisabled = !column.checkboxEnabled || value && value.disabled;
- text = [_this7.options.cardView ? "
") : "
"), ""), _this7.header.formatters[j] && typeof value === 'string' ? value : '', _this7.options.cardView ? '' : ' | '].join('');
- item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
- } else if (_this7.options.cardView) {
- var cardTitle = _this7.options.showHeader ? "
").concat(Utils.getFieldTitle(_this7.columns, field), "") : '';
- text = "
".concat(cardTitle, "").concat(value, "
");
-
- if (_this7.options.smartDisplay && value === '') {
- text = '
';
- }
- } else {
- text = "
").concat(value, " | ");
- }
-
- html.push(text);
- });
-
- if (detailViewTemplate && this.options.detailViewAlign === 'right') {
- html.push(detailViewTemplate);
- }
-
- if (this.options.cardView) {
- html.push('