@trudb/tru-common-lib 0.2.162 → 0.2.164

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.
@@ -1177,6 +1177,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
1177
1177
  class TruUtil {
1178
1178
  keyboardMap = ["", "", "", "CANCEL", "", "", "HELP", "", "BACK_SPACE", "TAB", "", "", "CLEAR", "ENTER", "RETURN", "", "SHIFT", "CONTROL", "ALT", "PAUSE", "CAPS_LOCK", "KANA", "EISU", "JUNJA", "FINAL", "HANJA", "", "ESCAPE", "CONVERT", "NONCONVERT", "ACCEPT", "MODECHANGE", "SPACE", "PAGE_UP", "PAGE_DOWN", "END", "HOME", "LEFT", "UP", "RIGHT", "DOWN", "SELECT", "PRINT", "EXECUTE", "PRINTSCREEN", "INSERT", "DELETE", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "COLON", "SEMICOLON", "LESS_THAN", "EQUALS", "GREATER_THAN", "QUESTION_MARK", "AT", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "WIN", "", "CONTEXT_MENU", "", "SLEEP", "NUMPAD0", "NUMPAD1", "NUMPAD2", "NUMPAD3", "NUMPAD4", "NUMPAD5", "NUMPAD6", "NUMPAD7", "NUMPAD8", "NUMPAD9", "MULTIPLY", "ADD", "SEPARATOR", "SUBTRACT", "DECIMAL", "DIVIDE", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24", "", "", "", "", "", "", "", "", "NUM_LOCK", "SCROLL_LOCK", "WIN_OEM_FJ_JISHO", "WIN_OEM_FJ_MASSHOU", "WIN_OEM_FJ_TOUROKU", "WIN_OEM_FJ_LOYA", "WIN_OEM_FJ_ROYA", "", "", "", "", "", "", "", "", "", "CIRCUMFLEX", "EXCLAMATION", "DOUBLE_QUOTE", "HASH", "DOLLAR", "PERCENT", "AMPERSAND", "UNDERSCORE", "OPEN_PAREN", "CLOSE_PAREN", "ASTERISK", "PLUS", "PIPE", "HYPHEN_MINUS", "OPEN_CURLY_BRACKET", "CLOSE_CURLY_BRACKET", "TILDE", "", "", "", "", "VOLUME_MUTE", "VOLUME_DOWN", "VOLUME_UP", "", "", "", "", "COMMA", "", "PERIOD", "SLASH", "BACK_QUOTE", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "OPEN_BRACKET", "BACK_SLASH", "CLOSE_BRACKET", "QUOTE", "", "META", "ALTGR", "", "WIN_ICO_HELP", "WIN_ICO_00", "", "WIN_ICO_CLEAR", "", "", "WIN_OEM_RESET", "WIN_OEM_JUMP", "WIN_OEM_PA1", "WIN_OEM_PA2", "WIN_OEM_PA3", "WIN_OEM_WSCTRL", "WIN_OEM_CUSEL", "WIN_OEM_ATTN", "WIN_OEM_FINISH", "WIN_OEM_COPY", "WIN_OEM_AUTO", "WIN_OEM_ENLW", "WIN_OEM_BACKTAB", "ATTN", "CRSEL", "EXSEL", "EREOF", "PLAY", "ZOOM", "", "PA1", "WIN_OEM_CLEAR", ""];
1179
1179
  constructor() { }
1180
+ htmlToPlainText = (html) => {
1181
+ const tempDiv = document.createElement('div');
1182
+ tempDiv.innerHTML = html;
1183
+ return tempDiv.textContent || tempDiv.innerText || '';
1184
+ };
1180
1185
  numberToString = (value) => {
1181
1186
  return value === undefined ? '' : (value).toString();
1182
1187
  };
@@ -5962,6 +5967,13 @@ class TruDataGridClipboard {
5962
5967
  this.util = util;
5963
5968
  this.uiNotification = uiNotification;
5964
5969
  }
5970
+ formatCellValue = (value, propertyConfig) => {
5971
+ if (value === null || typeof value === 'undefined')
5972
+ return '';
5973
+ if (propertyConfig.typeName === 'rich-text-unbounded')
5974
+ return this.util.htmlToPlainText(value);
5975
+ return value;
5976
+ };
5965
5977
  copyCell = async (params, tableName, columnName, copiedCellData, copiedCellEntity) => {
5966
5978
  this.tableName = tableName;
5967
5979
  this.columnName = columnName;
@@ -5996,18 +6008,18 @@ class TruDataGridClipboard {
5996
6008
  copyRow = async (tableName, copiedRows) => {
5997
6009
  this.tableName = tableName;
5998
6010
  this.copiedRows = copiedRows;
5999
- if (this.copiedRows.length) {
6011
+ if (copiedRows.length) {
6000
6012
  let multiRowString = '';
6001
6013
  this.copiedRows.forEach((copiedRow, index) => {
6002
6014
  let rowPropertyValues = [];
6003
- let properties = copiedRow.entityType.getPropertyNames();
6015
+ let properties = copiedRow.$entiy.entityType.getPropertyNames();
6004
6016
  properties
6005
6017
  .forEach((propertyName) => {
6006
6018
  if (propertyName !== tableName + 'Ref' &&
6007
6019
  propertyName !== 'rowver' &&
6008
6020
  propertyName !== 'Merge_Data_Set' &&
6009
6021
  !propertyName.startsWith('o'))
6010
- rowPropertyValues.push(copiedRow.getProperty(propertyName));
6022
+ rowPropertyValues.push(this.formatCellValue(copiedRow[propertyName].property, copiedRow.$entity.getProperty(propertyName)));
6011
6023
  });
6012
6024
  multiRowString += rowPropertyValues.join('\t') + '\n';
6013
6025
  });
@@ -6031,7 +6043,7 @@ class TruDataGridClipboard {
6031
6043
  if (this.copiedRows.length) {
6032
6044
  this.copiedRows.forEach((copiedRow, index) => {
6033
6045
  let selectedRow = selectedRows[index];
6034
- let properties = copiedRow.entityType.getPropertyNames();
6046
+ let properties = copiedRow.$entity.entityType.getPropertyNames();
6035
6047
  properties
6036
6048
  .forEach((propertyName) => {
6037
6049
  if (typeof selectedRow.$entity.setProperty !== 'undefined' &&
@@ -6040,7 +6052,7 @@ class TruDataGridClipboard {
6040
6052
  propertyName !== 'rowver' &&
6041
6053
  propertyName !== 'Merge_Data_Set' &&
6042
6054
  !propertyName.startsWith('o'))
6043
- selectedRow.$entity.setProperty(propertyName, copiedRow.getProperty(propertyName));
6055
+ selectedRow.$entity.setProperty(propertyName, copiedRow.$entity.getProperty(propertyName));
6044
6056
  });
6045
6057
  });
6046
6058
  gridApi.refreshCells({ force: true });
@@ -7644,7 +7656,7 @@ class TruDataGrid {
7644
7656
  else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyC') {
7645
7657
  let selectedRows = this.api.getSelectedRows();
7646
7658
  if (selectedRows.length)
7647
- this.dataGridClipboard.copyRow(this.config.tableName, selectedRows.map((row) => row.$entity));
7659
+ this.dataGridClipboard.copyRow(this.config.tableName, selectedRows);
7648
7660
  }
7649
7661
  else if (params.column.isPinned() && event.ctrlKey && event.code === 'KeyV') {
7650
7662
  this.dataGridClipboard.pasteRow(this.api, this.config, this.api.getSelectedRows());