@trudb/tru-common-lib 0.2.161 → 0.2.163

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;
@@ -5993,9 +6005,31 @@ class TruDataGridClipboard {
5993
6005
  params.api.refreshCells({ force: true });
5994
6006
  }
5995
6007
  };
5996
- copyRow = (tableName, copiedRows) => {
6008
+ copyRow = async (tableName, copiedRows) => {
5997
6009
  this.tableName = tableName;
5998
6010
  this.copiedRows = copiedRows;
6011
+ if (this.copiedRows.length) {
6012
+ let multiRowString = '';
6013
+ this.copiedRows.forEach((copiedRow, index) => {
6014
+ let rowPropertyValues = [];
6015
+ let properties = copiedRow.entityType.getPropertyNames();
6016
+ properties
6017
+ .forEach((propertyName) => {
6018
+ if (propertyName !== tableName + 'Ref' &&
6019
+ propertyName !== 'rowver' &&
6020
+ propertyName !== 'Merge_Data_Set' &&
6021
+ !propertyName.startsWith('o'))
6022
+ rowPropertyValues.push(this.formatCellValue(copiedRow[propertyName].property, copiedRow.getProperty(propertyName)));
6023
+ });
6024
+ multiRowString += rowPropertyValues.join('\t') + '\n';
6025
+ });
6026
+ try {
6027
+ await navigator.clipboard.writeText(multiRowString);
6028
+ }
6029
+ catch (err) {
6030
+ console.error('Failed to copy text: ', err);
6031
+ }
6032
+ }
5999
6033
  };
6000
6034
  pasteRow = (gridApi, config, selectedRows) => {
6001
6035
  if (this.tableName !== config.tableName) {