@isrd-isi-edu/ermrestjs 2.8.0 → 2.9.0

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.
package/js/core.js CHANGED
@@ -21,7 +21,7 @@ import HTTPService from '@isrd-isi-edu/ermrestjs/src/services/http';
21
21
  import $log from '@isrd-isi-edu/ermrestjs/src/services/logger';
22
22
 
23
23
  // utils
24
- import { isObjectAndNotNull, isEmptyArray, isStringAndNotEmpty, isValidColorRGBHex } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
24
+ import { isObjectAndNotNull, isEmptyArray, isStringAndNotEmpty, isValidColorRGBHex, isValidVisibleCellHeight } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
25
25
  import { fixedEncodeURIComponent, escapeHTML, updateObject } from '@isrd-isi-edu/ermrestjs/src/utils/value-utils';
26
26
  import {
27
27
  _annotations,
@@ -3570,6 +3570,8 @@ import {
3570
3570
  }
3571
3571
  }
3572
3572
 
3573
+ const visibleCellHeight = _getHierarchicalDisplayAnnotationValue(this, context, "visible_cell_height", false);
3574
+
3573
3575
  this._display[context] = {
3574
3576
  "hideColumnHeader": annotation.hide_column_header || false, // only hide if the annotation value is true
3575
3577
  "isPreformat": hasPreformat,
@@ -3582,7 +3584,8 @@ import {
3582
3584
  "columnOrder": columnOrder,
3583
3585
  "comment": _processModelComment(comment, commentRenderMarkdown, columnCommentDisplayMode),
3584
3586
  "commentRenderMarkdown": commentRenderMarkdown,
3585
- "commentDisplayMode": columnCommentDisplayMode
3587
+ "commentDisplayMode": columnCommentDisplayMode,
3588
+ "visibleCellHeight": isValidVisibleCellHeight(visibleCellHeight) ? visibleCellHeight : undefined
3586
3589
  };
3587
3590
  }
3588
3591
  return this._display[context];
@@ -4078,10 +4081,8 @@ import {
4078
4081
 
4079
4082
  columnOrder = _processColumnOrderList(annotation.column_order, this.table);
4080
4083
  showKeyLink = annotation.show_key_link;
4081
- if (typeof showFKLink !== "boolean") {
4082
- showKeyLink = _getHierarchicalDisplayAnnotationValue(
4083
- self, context, "show_key_link"
4084
- );
4084
+ if (typeof showKeyLink !== "boolean") {
4085
+ showKeyLink = _getHierarchicalDisplayAnnotationValue(self, context, "show_key_link", false);
4085
4086
 
4086
4087
  // default:
4087
4088
  // compact/select: false
@@ -4108,24 +4109,27 @@ import {
4108
4109
  comment = annotComment;
4109
4110
  }
4110
4111
 
4111
- var displayProps = _getHierarchicalDisplayAnnotationValue(this, context, "comment_display", false);
4112
- var commentDisplay = _commentDisplayModes.tooltip, commentRenderMarkdown;
4113
- if (isObjectAndNotNull(displayProps)) {
4114
- if (_isValidModelCommentDisplay(displayProps.column_comment_display)) {
4115
- commentDisplay = displayProps.column_comment_display;
4112
+ const commentProps = _getHierarchicalDisplayAnnotationValue(this, context, "comment_display", false);
4113
+ let commentDisplay = _commentDisplayModes.tooltip, commentRenderMarkdown;
4114
+ if (isObjectAndNotNull(commentProps)) {
4115
+ if (_isValidModelCommentDisplay(commentProps.column_comment_display)) {
4116
+ commentDisplay = commentProps.column_comment_display;
4116
4117
  }
4117
- if (typeof displayProps.comment_render_markdown === 'boolean') {
4118
- commentRenderMarkdown = displayProps.comment_render_markdown;
4118
+ if (typeof commentProps.comment_render_markdown === 'boolean') {
4119
+ commentRenderMarkdown = commentProps.comment_render_markdown;
4119
4120
  }
4120
4121
  }
4121
4122
 
4123
+ const visibleCellHeight = _getHierarchicalDisplayAnnotationValue(this, context, "visible_cell_height", false);
4124
+
4122
4125
  this._display[context] = {
4123
4126
  "columnOrder": columnOrder,
4124
4127
  "isMarkdownPattern": (typeof annotation.markdown_pattern === 'string'),
4125
4128
  "templateEngine": annotation.template_engine,
4126
4129
  "markdownPattern": annotation.markdown_pattern,
4127
4130
  "showKeyLink": showKeyLink,
4128
- "comment": _processModelComment(comment, commentRenderMarkdown, commentDisplay)
4131
+ "comment": _processModelComment(comment, commentRenderMarkdown, commentDisplay),
4132
+ "visibleCellHeight": isValidVisibleCellHeight(visibleCellHeight) ? visibleCellHeight : undefined
4129
4133
  };
4130
4134
  }
4131
4135
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@isrd-isi-edu/ermrestjs",
3
3
  "description": "ERMrest client library in JavaScript",
4
- "version": "2.8.0",
4
+ "version": "2.9.0",
5
5
  "license": "Apache-2.0",
6
6
  "engines": {
7
7
  "node": ">= 20.0.0",
@@ -10,7 +10,12 @@ import { Tuple } from '@isrd-isi-edu/ermrestjs/src/models/reference';
10
10
  import $log from '@isrd-isi-edu/ermrestjs/src/services/logger';
11
11
 
12
12
  // utils
13
- import { isObjectAndNotNull, isStringAndNotEmpty, isObjectAndKeyExists } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
13
+ import {
14
+ isObjectAndNotNull,
15
+ isStringAndNotEmpty,
16
+ isObjectAndKeyExists,
17
+ isValidVisibleCellHeight,
18
+ } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
14
19
  import { fixedEncodeURIComponent } from '@isrd-isi-edu/ermrestjs/src/utils/value-utils';
15
20
  import { renderMarkdown } from '@isrd-isi-edu/ermrestjs/src/utils/markdown-utils';
16
21
  import { _annotations, _foreignKeyInputModes } from '@isrd-isi-edu/ermrestjs/src/utils/constants';
@@ -580,6 +585,10 @@ export class ForeignKeyPseudoColumn extends ReferenceColumn {
580
585
  sourceDisplay.hideColumnHeader = this.sourceObject.hide_column_header;
581
586
  }
582
587
 
588
+ if (this.sourceObject && isValidVisibleCellHeight(this.sourceObject.visible_cell_height)) {
589
+ sourceDisplay.visibleCellHeight = this.sourceObject.visible_cell_height;
590
+ }
591
+
583
592
  Object.assign(res, fkDisplay, sourceDisplay);
584
593
  this._display_cached = res;
585
594
  }
@@ -7,7 +7,7 @@ import { Reference, Tuple } from '@isrd-isi-edu/ermrestjs/src/models/reference';
7
7
 
8
8
  // utils
9
9
  import { renderMarkdown } from '@isrd-isi-edu/ermrestjs/src/utils/markdown-utils';
10
- import { isStringAndNotEmpty } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
10
+ import { isValidVisibleCellHeight, isStringAndNotEmpty } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
11
11
  import { buildSelfTemplateVariables } from '@isrd-isi-edu/ermrestjs/src/utils/template-utils';
12
12
 
13
13
  // legacy
@@ -227,6 +227,10 @@ export class KeyPseudoColumn extends ReferenceColumn {
227
227
  sourceDisplay.hideColumnHeader = this.sourceObject.hide_column_header;
228
228
  }
229
229
 
230
+ if (this.sourceObject && isValidVisibleCellHeight(this.sourceObject.visible_cell_height)) {
231
+ sourceDisplay.visibleCellHeight = this.sourceObject.visible_cell_height;
232
+ }
233
+
230
234
  Object.assign(res, keyDisplay, sourceDisplay);
231
235
  this._display_cached = res;
232
236
  }
@@ -12,7 +12,12 @@ import $log from '@isrd-isi-edu/ermrestjs/src/services/logger';
12
12
 
13
13
  // utils
14
14
  import { renderMarkdown } from '@isrd-isi-edu/ermrestjs/src/utils/markdown-utils';
15
- import { isObjectAndKeyExists, isObjectAndNotNull, isStringAndNotEmpty } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
15
+ import {
16
+ isValidVisibleCellHeight,
17
+ isObjectAndKeyExists,
18
+ isObjectAndNotNull,
19
+ isStringAndNotEmpty,
20
+ } from '@isrd-isi-edu/ermrestjs/src/utils/type-utils';
16
21
  import { _annotations, _contexts } from '@isrd-isi-edu/ermrestjs/src/utils/constants';
17
22
  import { buildSelfTemplateVariables } from '@isrd-isi-edu/ermrestjs/src/utils/template-utils';
18
23
  import ActiveListCondition from '@isrd-isi-edu/ermrestjs/src/models/active-list-condition';
@@ -385,6 +390,10 @@ export class ReferenceColumn {
385
390
  sourceDisplay.hideColumnHeader = this.sourceObject.hide_column_header;
386
391
  }
387
392
 
393
+ if (this.sourceObject && isValidVisibleCellHeight(this.sourceObject.visible_cell_height)) {
394
+ sourceDisplay.visibleCellHeight = this.sourceObject.visible_cell_height;
395
+ }
396
+
388
397
  // Using assign to avoid changing the original colDisplay
389
398
  Object.assign(res, colDisplay, sourceDisplay);
390
399
  this._display_cached = res;
@@ -87,3 +87,10 @@ export function verify(test: any, message: string) {
87
87
  throw new InvalidInputError(message);
88
88
  }
89
89
  }
90
+
91
+ /**
92
+ * check if the value is a valid visible cell height (i.e. a positive number or false)
93
+ */
94
+ export function isValidVisibleCellHeight(value: unknown) {
95
+ return (typeof value === 'number' && value > 0) || value === false;
96
+ }