diff --git a/docs/dev-docs/api.md b/docs/dev-docs/api.md index 22e3fc3c..1e1870d2 100644 --- a/docs/dev-docs/api.md +++ b/docs/dev-docs/api.md @@ -367,6 +367,7 @@ to use for ERMrest JavaScript agents. * [.citation](#ERMrest.Reference+citation) : ERMrest.Citation * [.googleDatasetMetadata](#ERMrest.Reference+googleDatasetMetadata) : ERMrest.GoogleDatasetMetadata * [.cascadingDeletedItems](#ERMrest.Reference+cascadingDeletedItems) : Array.<Object> + * [.bulkCreateForeignKeyObject](#ERMrest.Reference+bulkCreateForeignKeyObject) : ERMrest.BulkCreateForeignKeyObject * [.generateFacetColumns()](#ERMrest.Reference+generateFacetColumns) * [.validateFacetsFilters(facetAndFilters, facetObjectWrappers, searchTerm, skipMappingEntityChoices, changeLocation)](#ERMrest.Reference+validateFacetsFilters) * [.removeAllFacetFilters(sameFilter, sameCustomFacet, sameFacet)](#ERMrest.Reference+removeAllFacetFilters) ⇒ ERMrest.reference @@ -386,6 +387,7 @@ to use for ERMrest JavaScript agents. * [.getColumnByName(name)](#ERMrest.Reference+getColumnByName) ⇒ [ReferenceColumn](#ERMrest.ReferenceColumn) * [.generateColumnsList(tuple, columnsList, dontChangeReference, skipLog)](#ERMrest.Reference+generateColumnsList) ⇒ [Array.<ReferenceColumn>](#ERMrest.ReferenceColumn) * [.generateActiveList([tuple])](#ERMrest.Reference+generateActiveList) ⇒ Object + * [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ BulkCreateForeignKeyObject * [._getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS)](#ERMrest.Reference+_getReadPath) : Object * [~processSortObject()](#ERMrest.Reference+_getReadPath..processSortObject) * [.Page](#ERMrest.Page) @@ -483,6 +485,7 @@ to use for ERMrest JavaScript agents. * [.defaultReference](#ERMrest.ForeignKeyPseudoColumn+defaultReference) : ERMrest.Refernece * [.RID](#ERMrest.ForeignKeyPseudoColumn+RID) : string * [.displayname](#ERMrest.ForeignKeyPseudoColumn+displayname) : Object + * [.generateUniqueId(linkedData)](#ERMrest.ForeignKeyPseudoColumn+generateUniqueId) * [.filteredRef(column, data)](#ERMrest.ForeignKeyPseudoColumn+filteredRef) ⇒ [Reference](#ERMrest.Reference) * [.KeyPseudoColumn](#ERMrest.KeyPseudoColumn) * [new KeyPseudoColumn(reference, key)](#new_ERMrest.KeyPseudoColumn_new) @@ -705,6 +708,7 @@ to use for ERMrest JavaScript agents. * [.citation](#ERMrest.Reference+citation) : ERMrest.Citation * [.googleDatasetMetadata](#ERMrest.Reference+googleDatasetMetadata) : ERMrest.GoogleDatasetMetadata * [.cascadingDeletedItems](#ERMrest.Reference+cascadingDeletedItems) : Array.<Object> + * [.bulkCreateForeignKeyObject](#ERMrest.Reference+bulkCreateForeignKeyObject) : ERMrest.BulkCreateForeignKeyObject * [.generateFacetColumns()](#ERMrest.Reference+generateFacetColumns) * [.validateFacetsFilters(facetAndFilters, facetObjectWrappers, searchTerm, skipMappingEntityChoices, changeLocation)](#ERMrest.Reference+validateFacetsFilters) * [.removeAllFacetFilters(sameFilter, sameCustomFacet, sameFacet)](#ERMrest.Reference+removeAllFacetFilters) ⇒ ERMrest.reference @@ -724,6 +728,7 @@ to use for ERMrest JavaScript agents. * [.getColumnByName(name)](#ERMrest.Reference+getColumnByName) ⇒ [ReferenceColumn](#ERMrest.ReferenceColumn) * [.generateColumnsList(tuple, columnsList, dontChangeReference, skipLog)](#ERMrest.Reference+generateColumnsList) ⇒ [Array.<ReferenceColumn>](#ERMrest.ReferenceColumn) * [.generateActiveList([tuple])](#ERMrest.Reference+generateActiveList) ⇒ Object + * [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ BulkCreateForeignKeyObject * [._getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS)](#ERMrest.Reference+_getReadPath) : Object * [~processSortObject()](#ERMrest.Reference+_getReadPath..processSortObject) * [.AttributeGroupReference](#ERMrest.AttributeGroupReference) : object @@ -3162,6 +3167,7 @@ Constructor for a ParsedFilter. * [.citation](#ERMrest.Reference+citation) : ERMrest.Citation * [.googleDatasetMetadata](#ERMrest.Reference+googleDatasetMetadata) : ERMrest.GoogleDatasetMetadata * [.cascadingDeletedItems](#ERMrest.Reference+cascadingDeletedItems) : Array.<Object> + * [.bulkCreateForeignKeyObject](#ERMrest.Reference+bulkCreateForeignKeyObject) : ERMrest.BulkCreateForeignKeyObject * [.generateFacetColumns()](#ERMrest.Reference+generateFacetColumns) * [.validateFacetsFilters(facetAndFilters, facetObjectWrappers, searchTerm, skipMappingEntityChoices, changeLocation)](#ERMrest.Reference+validateFacetsFilters) * [.removeAllFacetFilters(sameFilter, sameCustomFacet, sameFacet)](#ERMrest.Reference+removeAllFacetFilters) ⇒ ERMrest.reference @@ -3181,6 +3187,7 @@ Constructor for a ParsedFilter. * [.getColumnByName(name)](#ERMrest.Reference+getColumnByName) ⇒ [ReferenceColumn](#ERMrest.ReferenceColumn) * [.generateColumnsList(tuple, columnsList, dontChangeReference, skipLog)](#ERMrest.Reference+generateColumnsList) ⇒ [Array.<ReferenceColumn>](#ERMrest.ReferenceColumn) * [.generateActiveList([tuple])](#ERMrest.Reference+generateActiveList) ⇒ Object + * [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ BulkCreateForeignKeyObject * [._getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS)](#ERMrest.Reference+_getReadPath) : Object * [~processSortObject()](#ERMrest.Reference+_getReadPath..processSortObject) @@ -3405,11 +3412,14 @@ Returns true if #### reference.display : Object An object which contains row display properties for this reference. -It is determined based on the `table-display` annotation. It has the +It is determined based on the `table-display`, `display`, and 'chaise-config' annotations. It has the following properties: - `rowOrder`: `[{ column: '`_column object_`', descending:` {`true` | `false` } `}`...`]` or `undefined`, - `type`: {`'table'` | `'markdown'` | `'module'`} (default: `'table'`) + - `showFaceting`: A boolean indicating whether we should show the faceting feature or not. + - `maxFacetDepth`: A number indicating the facet depth. + - `facetPanelOpen`: Whether the facet panel should be opened by default or not. If type is `'markdown'`, the object will also these additional properties: @@ -3552,6 +3562,13 @@ a Metadata object #### reference.cascadingDeletedItems : Array.<Object> The related reference or tables that might be deleted as a result of deleting the current table. +**Kind**: instance property of [Reference](#ERMrest.Reference) + + +#### reference.bulkCreateForeignKeyObject : ERMrest.BulkCreateForeignKeyObject +If prefill object is defined and has the required attributes, will return +a BulkCreateForeignKeyObject object with the necessary objects used for a association modal picker + **Kind**: instance property of [Reference](#ERMrest.Reference) @@ -3984,6 +4001,20 @@ so if the fk definition is based on fkcolum and and not the RID, it would handle | --- | --- | | [tuple] | [Tuple](#ERMrest.Tuple) | + + +#### reference.computeBulkCreateForeignKeyObject(prefillObject) ⇒ BulkCreateForeignKeyObject +Will compute and return a BulkCreateForeignKeyObject if: + - the prefillObject is defined + - there are only 2 foreign key columns for this table that are not system columns + - using the prefill object, we can determine the main column for prefilling and leaf column for bulk selection + +**Kind**: instance method of [Reference](#ERMrest.Reference) + +| Param | Type | Description | +| --- | --- | --- | +| prefillObject | Object | computed prefill object from chaise | + #### reference.\_getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS) : Object @@ -4951,6 +4982,7 @@ In other cases, the returned data will only include the scalar value. * [.defaultReference](#ERMrest.ForeignKeyPseudoColumn+defaultReference) : ERMrest.Refernece * [.RID](#ERMrest.ForeignKeyPseudoColumn+RID) : string * [.displayname](#ERMrest.ForeignKeyPseudoColumn+displayname) : Object + * [.generateUniqueId(linkedData)](#ERMrest.ForeignKeyPseudoColumn+generateUniqueId) * [.filteredRef(column, data)](#ERMrest.ForeignKeyPseudoColumn+filteredRef) ⇒ [Reference](#ERMrest.Reference) @@ -5038,6 +5070,17 @@ returns the ermrest generated RID for the foreign key relationship this pseudo c use table's displayname disambiguated with columns' displayname, i.e. `table_1 (col_1, col_2)`. **Kind**: instance property of [ForeignKeyPseudoColumn](#ERMrest.ForeignKeyPseudoColumn) + + +#### foreignKeyPseudoColumn.generateUniqueId(linkedData) +Given the available tuple data, generate the uniqueId for the selected row from the table this pseudo column points to + +**Kind**: instance method of [ForeignKeyPseudoColumn](#ERMrest.ForeignKeyPseudoColumn) + +| Param | Type | Description | +| --- | --- | --- | +| linkedData | Object | key-value pairs of column values of the table this pseudocolumn points to | + #### foreignKeyPseudoColumn.filteredRef(column, data) ⇒ [Reference](#ERMrest.Reference) @@ -7053,6 +7096,7 @@ get PathColumn object by column name * [.citation](#ERMrest.Reference+citation) : ERMrest.Citation * [.googleDatasetMetadata](#ERMrest.Reference+googleDatasetMetadata) : ERMrest.GoogleDatasetMetadata * [.cascadingDeletedItems](#ERMrest.Reference+cascadingDeletedItems) : Array.<Object> + * [.bulkCreateForeignKeyObject](#ERMrest.Reference+bulkCreateForeignKeyObject) : ERMrest.BulkCreateForeignKeyObject * [.generateFacetColumns()](#ERMrest.Reference+generateFacetColumns) * [.validateFacetsFilters(facetAndFilters, facetObjectWrappers, searchTerm, skipMappingEntityChoices, changeLocation)](#ERMrest.Reference+validateFacetsFilters) * [.removeAllFacetFilters(sameFilter, sameCustomFacet, sameFacet)](#ERMrest.Reference+removeAllFacetFilters) ⇒ ERMrest.reference @@ -7072,6 +7116,7 @@ get PathColumn object by column name * [.getColumnByName(name)](#ERMrest.Reference+getColumnByName) ⇒ [ReferenceColumn](#ERMrest.ReferenceColumn) * [.generateColumnsList(tuple, columnsList, dontChangeReference, skipLog)](#ERMrest.Reference+generateColumnsList) ⇒ [Array.<ReferenceColumn>](#ERMrest.ReferenceColumn) * [.generateActiveList([tuple])](#ERMrest.Reference+generateActiveList) ⇒ Object + * [.computeBulkCreateForeignKeyObject(prefillObject)](#ERMrest.Reference+computeBulkCreateForeignKeyObject) ⇒ BulkCreateForeignKeyObject * [._getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS)](#ERMrest.Reference+_getReadPath) : Object * [~processSortObject()](#ERMrest.Reference+_getReadPath..processSortObject) @@ -7296,11 +7341,14 @@ Returns true if #### reference.display : Object An object which contains row display properties for this reference. -It is determined based on the `table-display` annotation. It has the +It is determined based on the `table-display`, `display`, and 'chaise-config' annotations. It has the following properties: - `rowOrder`: `[{ column: '`_column object_`', descending:` {`true` | `false` } `}`...`]` or `undefined`, - `type`: {`'table'` | `'markdown'` | `'module'`} (default: `'table'`) + - `showFaceting`: A boolean indicating whether we should show the faceting feature or not. + - `maxFacetDepth`: A number indicating the facet depth. + - `facetPanelOpen`: Whether the facet panel should be opened by default or not. If type is `'markdown'`, the object will also these additional properties: @@ -7443,6 +7491,13 @@ a Metadata object #### reference.cascadingDeletedItems : Array.<Object> The related reference or tables that might be deleted as a result of deleting the current table. +**Kind**: instance property of [Reference](#ERMrest.Reference) + + +#### reference.bulkCreateForeignKeyObject : ERMrest.BulkCreateForeignKeyObject +If prefill object is defined and has the required attributes, will return +a BulkCreateForeignKeyObject object with the necessary objects used for a association modal picker + **Kind**: instance property of [Reference](#ERMrest.Reference) @@ -7875,6 +7930,20 @@ so if the fk definition is based on fkcolum and and not the RID, it would handle | --- | --- | | [tuple] | [Tuple](#ERMrest.Tuple) | + + +#### reference.computeBulkCreateForeignKeyObject(prefillObject) ⇒ BulkCreateForeignKeyObject +Will compute and return a BulkCreateForeignKeyObject if: + - the prefillObject is defined + - there are only 2 foreign key columns for this table that are not system columns + - using the prefill object, we can determine the main column for prefilling and leaf column for bulk selection + +**Kind**: instance method of [Reference](#ERMrest.Reference) + +| Param | Type | Description | +| --- | --- | --- | +| prefillObject | Object | computed prefill object from chaise | + #### reference.\_getReadPath(useEntity, getTRS, getTCRS, getUnlinkTRS) : Object diff --git a/js/column.js b/js/column.js index bb5d0a4e..00c0c76d 100644 --- a/js/column.js +++ b/js/column.js @@ -1670,7 +1670,7 @@ module._extends(ForeignKeyPseudoColumn, ReferenceColumn); */ ForeignKeyPseudoColumn.prototype.generateUniqueId = function (linkedData) { return module._generateTupleUniqueId(this.reference.table.shortestKey, linkedData); -} +}; // properties to be overriden: /** diff --git a/js/reference.js b/js/reference.js index 7f5ff65f..ac565f17 100644 --- a/js/reference.js +++ b/js/reference.js @@ -2466,7 +2466,7 @@ } // validate the value if (!isInteger(maxFacetDepth) || maxFacetDepth < 0) { - maxFacetDepth = 1 + maxFacetDepth = 1; } else if (maxFacetDepth > 2) { maxFacetDepth = 2; } @@ -6808,4 +6808,4 @@ return this._andFilters; } - } + };