UNPKG

@onehat/data

Version:

JS data modeling package with adapters for many storage mediums.

5,425 lines (1,233 loc) 457 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>@onehat/data Module: Property</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.yeti.css"> </head> <body> <div class="navbar navbar-default navbar-fixed-top "> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="index.html">@onehat/data</a> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse" id="topNavigation"> <ul class="nav navbar-nav"> <li class="dropdown"> <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="module-Entity.html">Entity</a></li><li><a href="module-OneHatData.html">OneHatData</a></li><li><a href="module-Property.html">Property</a></li><li><a href="module-Reader.html">Reader</a></li><li><a href="module-Repository.html">Repository</a></li><li><a href="module-Schema.html">Schema</a></li><li><a href="module-Writer.html">Writer</a></li><li><a href="module-@onehat_data.html">@onehat/data</a></li> </ul> </li> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="module-Entity-Entity.html">Entity~Entity</a></li><li><a href="module-OneHatData.OneHatData.html">OneHatData.OneHatData</a></li><li><a href="module-Reader-JsonReader.html">Reader~JsonReader</a></li><li><a href="module-Reader-Reader.html">Reader~Reader</a></li><li><a href="module-Reader-XmlReader.html">Reader~XmlReader</a></li><li><a href="module-Repository-AjaxRepository.html">Repository~AjaxRepository</a></li><li><a href="module-Repository-CommandRepository.html">Repository~CommandRepository</a></li><li><a href="module-Repository-LocalFromRemoteRepository.html">Repository~LocalFromRemoteRepository</a></li><li><a href="module-Repository-MemoryRepository.html">Repository~MemoryRepository</a></li><li><a href="module-Repository-NullRepository.html">Repository~NullRepository</a></li><li><a href="module-Repository-OfflineRepository.html">Repository~OfflineRepository</a></li><li><a href="module-Repository-OneBuildRepository.html">Repository~OneBuildRepository</a></li><li><a href="module-Repository-RestRepository.html">Repository~RestRepository</a></li><li><a href="module-Writer-JsonWriter.html">Writer~JsonWriter</a></li><li><a href="module-Writer-Writer.html">Writer~Writer</a></li><li><a href="module-Writer-XmlWriter.html">Writer~XmlWriter</a></li> </ul> </li> </ul> <div class="col-sm-3 col-md-3"> <form class="navbar-form" role="search"> <div class="input-group"> <input type="text" class="form-control" placeholder="Search" name="q" id="search-input"> <div class="input-group-btn"> <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button> </div> </div> </form> </div> </div> </div> </div> <div class="container" id="toc-content"> <div class="row"> <div class="col-md-8"> <div id="main"> <h1 class="page-title">Module: Property</h1> <section> <header> <div class="class-description">Class represents a Property that stores Base64 data. This class contains helpful methods in dealing with Base64 data.</div> <div class="class-description">Class represents a Property that stores boolean data.</div> <div class="class-description">Class represents a Property that stores currency data.</div> <div class="class-description">Class represents a Property that stores a calendar date.</div> <div class="class-description">Class represents a Property that stores a calendar date and time.</div> <div class="class-description">Class represents a Property that stores file data.</div> <div class="class-description">Class represents a Property that stores a float value.</div> <div class="class-description">Class represents a Property that stores an integer value.</div> <div class="class-description">Class represents a Property that stores JSON data. JsonProperty may be a little unpredictable in what its various methods will give you. Say you set the value to: '{"test":true}'. The property parses this and converts it to an actual JS object internally. There will then be two possible representations of this value: - A string ('{"test":true}') and - An object ({ test: true }). This is what the various methods will give you: - getParsedValue: object - getDisplayValue: string - getRawValue: string - getSubmitValue (default): string - getSubmitValue when !submitAsString: object The submitValue is where things get weird. By default, this property will submit as a string.</div> <div class="class-description">Base class representing a Property This class should not be instantiated directly. Rather, instantiate a subclass, like StringProperty</div> <div class="class-description">Class represents a Property that stores string data.</div> <div class="class-description">Class represents a Property that stores a time of day.</div> <div class="class-description">Class represents a Property that stores a UUID. This class contains helpful methods in dealing with UUIDs.</div> </header> <article> <div class="container-overview"> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Base64.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Boolean.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Currency.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Date.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/DateTime.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/File.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Float.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Integer.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Json.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))(config)</h4> </dt> <dd> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last">Object with key/value pairs that define this Property</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> <h5>Fires:</h5> <ul> <li>.'change',event: 'destroy']</li> </ul> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/String.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Time.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Uuid.js </dd> </dl> </dd> </div> <h3 class="subsection-title">Members</h3> <dl> <hr> <dt class="name" id="decode"> <h4 id="decode"><span class="type-signature"></span>decode<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Decodes to UTF-8 string </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Base64.js </dd> </dl> </dd> <hr> <dt class="name" id="atob"> <h4 id="atob"><span class="type-signature"></span>atob<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Decodes to bytes, which is compatible with browser's built-in atob() (Which is absent in node) </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Base64.js </dd> </dl> </dd> <hr> <dt class="name" id="parse"> <h4 id="parse"><span class="type-signature"></span>parse<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Parses value to moment object </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Date.js </dd> </dl> </dd> <hr> <dt class="name" id="parse"> <h4 id="parse"><span class="type-signature"></span>parse<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Parses value to float </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Float.js </dd> </dl> </dd> <hr> <dt class="name" id="isValid"> <h4 id="isValid"><span class="type-signature"></span>isValid<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Validates a JSON string </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Json.js </dd> </dl> </dd> <hr> <dt class="name" id="getAsHtmlSafe"> <h4 id="getAsHtmlSafe"><span class="type-signature"></span>getAsHtmlSafe<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Utility function - gets the JSON string in a way that is safe to display in HTML. i.e. It enables us to show a JSON string in HTML *without its contents being interpreted as HTML* </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Json.js </dd> </dl> </dd> <hr> <dt class="name" id="~name"> <h4 id="~name"><span class="type-signature">&lt;inner> </span>name<span class="type-signature"> :string</span></h4> </dt> <dd> <div class="description"> Could be anything, but OneHat's convention is to use the model name pluralized and underscored, followed by two underscores, followed by the field name singular and underscored (e.g. 'groups_users__id') This convention allows us to have multiple models' data in a single Entity, all flattened </div> <h5>Type:</h5> <ul> <li> <span class="param-type">string</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="~allowNull"> <h4 id="~allowNull"><span class="type-signature">&lt;inner> </span>allowNull<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> Is the property required to have a value? Defaults to true. </div> <h5>Type:</h5> <ul> <li> <span class="param-type">boolean</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="~submitAsString"> <h4 id="~submitAsString"><span class="type-signature">&lt;inner> </span>submitAsString<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> Whether to submit value as a string, rather than a primitive or complex type </div> <h5>Type:</h5> <ul> <li> <span class="param-type">boolean</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="~isSortable"> <h4 id="~isSortable"><span class="type-signature">&lt;inner> </span>isSortable<span class="type-signature"> :boolean</span></h4> </dt> <dd> <div class="description"> Whether this property type is sortable </div> <h5>Type:</h5> <ul> <li> <span class="param-type">boolean</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="~rawValue"> <h4 id="~rawValue"><span class="type-signature">&lt;inner> </span>rawValue<span class="type-signature"> :any</span></h4> </dt> <dd> <div class="description"> The raw value supplied to this property, *before* any parsing was applied </div> <h5>Type:</h5> <ul> <li> <span class="param-type">any</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="~parsedValue"> <h4 id="~parsedValue"><span class="type-signature">&lt;inner> </span>parsedValue<span class="type-signature"> :any</span></h4> </dt> <dd> <div class="description"> The value for this property, *after* any parsing was applied </div> <h5>Type:</h5> <ul> <li> <span class="param-type">any</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="getRawValue"> <h4 id="getRawValue"><span class="type-signature"></span>getRawValue<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets "raw" value, prior to any parsing </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="getParsedValue"> <h4 id="getParsedValue"><span class="type-signature"></span>getParsedValue<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets "parsed" value, without any formatting applied </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="getSubmitValue"> <h4 id="getSubmitValue"><span class="type-signature"></span>getSubmitValue<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets parsed value, formatted for submission to server </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="submitValue"> <h4 id="submitValue"><span class="type-signature"></span>submitValue<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets parsed value, formatted for submission to server </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="getDisplayValue"> <h4 id="getDisplayValue"><span class="type-signature"></span>getDisplayValue<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets parsed value, formatted for displaying to user </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="displayValue"> <h4 id="displayValue"><span class="type-signature"></span>displayValue<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets parsed value, formatted for displaying to user </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="hasMapping"> <h4 id="hasMapping"><span class="type-signature"></span>hasMapping<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets whether or not the Property has a mapping. Used by Entity. </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="hasDepends"> <h4 id="hasDepends"><span class="type-signature"></span>hasDepends<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets whether or not the Property depends on any other properties for its local "parse" function. Used by Entity. </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="isIdProperty"> <h4 id="isIdProperty"><span class="type-signature"></span>isIdProperty<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets whether or not the Property is an "ID" property for the Entity it's assigned to </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="isDisplayProperty"> <h4 id="isDisplayProperty"><span class="type-signature"></span>isDisplayProperty<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets whether or not the Property is a "Display" property for the Entity it's assigned to </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="setValue"> <h4 id="setValue"><span class="type-signature"></span>setValue<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Sets the parsedValue for this Property. Any mapping for this property has already taken place. i.e. The rawValue to parse *is the mapped value.* </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="parse"> <h4 id="parse"><span class="type-signature"></span>parse<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Performs the actual parsing conversion, but *does not* set anything on the property. Default function. Meant to be overridden with subclass. </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="setSubmitAsString"> <h4 id="setSubmitAsString"><span class="type-signature"></span>setSubmitAsString<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Sets value of submitAsString </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="getEntity"> <h4 id="getEntity"><span class="type-signature"></span>getEntity<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets the Entity object </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="getClassName"> <h4 id="getClassName"><span class="type-signature"></span>getClassName<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Gets the className of this Property type. </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="destroy"> <h4 id="destroy"><span class="type-signature"></span>destroy<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Destroy this object. - Removes all circular references to parent objects - Removes child objects - Removes event listeners </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> </dd> <hr> <dt class="name" id="parse"> <h4 id="parse"><span class="type-signature"></span>parse<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Parses value to string. - Strings will pass through unaltered. - Numbers and Booleans will be converted to strings. - Other types will return null. </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/String.js </dd> </dl> </dd> <hr> <dt class="name" id="newId"> <h4 id="newId"><span class="type-signature"></span>newId<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Generates a new UUID </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Uuid.js </dd> </dl> </dd> <hr> <dt class="name" id="isValid"> <h4 id="isValid"><span class="type-signature"></span>isValid<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Validates a UUID </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Uuid.js </dd> </dl> </dd> <hr> <dt class="name" id="isEmpty"> <h4 id="isEmpty"><span class="type-signature"></span>isEmpty<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Determines whether a given UUID is empty (i.e. all zeros) </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Uuid.js </dd> </dl> </dd> </dl> <h3 class="subsection-title">Methods</h3> <dl> <hr> <dt> <h4 class="name" id="getDefaultValue"><span class="type-signature"></span>getDefaultValue()</h4> </dt> <dd> <div class="description"> Gets default value. In this case, if a property is set to have a defaultValue of 'now', it will default to the current Date. </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Date.js </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> defaultValue </div> <dl> <dt> Type </dt> <dd> <span class="param-type">any</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getDefaultValue"><span class="type-signature"></span>getDefaultValue()</h4> </dt> <dd> <div class="description"> Gets default value. Can be overridden to get dynamic default value. </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> defaultValue </div> <dl> <dt> Type </dt> <dd> <span class="param-type">any</span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="getDefaultValue"><span class="type-signature"></span>getDefaultValue()</h4> </dt> <dd> <div class="description"> Gets default value. In this case, if a property is set to have a defaultValue of 'generate', it will default to a newly generated UUID. </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Uuid.js </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> defaultValue </div> <dl> <dt> Type </dt> <dd> <span class="param-type">any</span> </dd> </dl> </dd> </dl> </article> </section> <h1 class="page-title">Module: Property</h1> <section> <header> <div class="class-description">Class represents a Property that stores Base64 data. This class contains helpful methods in dealing with Base64 data.</div> <div class="class-description">Class represents a Property that stores boolean data.</div> <div class="class-description">Class represents a Property that stores currency data.</div> <div class="class-description">Class represents a Property that stores a calendar date.</div> <div class="class-description">Class represents a Property that stores a calendar date and time.</div> <div class="class-description">Class represents a Property that stores file data.</div> <div class="class-description">Class represents a Property that stores a float value.</div> <div class="class-description">Class represents a Property that stores an integer value.</div> <div class="class-description">Class represents a Property that stores JSON data. JsonProperty may be a little unpredictable in what its various methods will give you. Say you set the value to: '{"test":true}'. The property parses this and converts it to an actual JS object internally. There will then be two possible representations of this value: - A string ('{"test":true}') and - An object ({ test: true }). This is what the various methods will give you: - getParsedValue: object - getDisplayValue: string - getRawValue: string - getSubmitValue (default): string - getSubmitValue when !submitAsString: object The submitValue is where things get weird. By default, this property will submit as a string.</div> <div class="class-description">Base class representing a Property This class should not be instantiated directly. Rather, instantiate a subclass, like StringProperty</div> <div class="class-description">Class represents a Property that stores string data.</div> <div class="class-description">Class represents a Property that stores a time of day.</div> <div class="class-description">Class represents a Property that stores a UUID. This class contains helpful methods in dealing with UUIDs.</div> </header> <article> <div class="container-overview"> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Base64.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Boolean.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Currency.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Date.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/DateTime.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/File.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Float.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Integer.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Json.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))(config)</h4> </dt> <dd> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>config</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last">Object with key/value pairs that define this Property</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl> <h5>Fires:</h5> <ul> <li>.'change',event: 'destroy']</li> </ul> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/String.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Time.js </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="module:Property"><span class="type-signature"></span>new (require("Property"))()</h4> </dt> <dd> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Uuid.js </dd> </dl> </dd> </div> <h3 class="subsection-title">Members</h3> <dl> <hr> <dt class="name" id="decode"> <h4 id="decode"><span class="type-signature"></span>decode<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Decodes to UTF-8 string </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Base64.js </dd> </dl> </dd> <hr> <dt class="name" id="atob"> <h4 id="atob"><span class="type-signature"></span>atob<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Decodes to bytes, which is compatible with browser's built-in atob() (Which is absent in node) </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Base64.js </dd> </dl> </dd> <hr> <dt class="name" id="parse"> <h4 id="parse"><span class="type-signature"></span>parse<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Parses value to moment object </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Date.js </dd> </dl> </dd> <hr> <dt class="name" id="parse"> <h4 id="parse"><span class="type-signature"></span>parse<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Parses value to float </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Float.js </dd> </dl> </dd> <hr> <dt class="name" id="isValid"> <h4 id="isValid"><span class="type-signature"></span>isValid<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Validates a JSON string </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Json.js </dd> </dl> </dd> <hr> <dt class="name" id="getAsHtmlSafe"> <h4 id="getAsHtmlSafe"><span class="type-signature"></span>getAsHtmlSafe<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Utility function - gets the JSON string in a way that is safe to display in HTML. i.e. It enables us to show a JSON string in HTML *without its contents being interpreted as HTML* </div> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Json.js </dd> </dl> </dd> <hr> <dt class="name" id="~name"> <h4 id="~name"><span class="type-signature">&lt;inner> </span>name<span class="type-signature"> :string</span></h4> </dt> <dd> <div class="description"> Could be anything, but OneHat's convention is to use the model name pluralized and underscored, followed by two underscores, followed by the field name singular and underscored (e.g. 'groups_users__id') This convention allows us to have multiple models' data in a single Entity, all flattened </div> <h5>Type:</h5> <ul> <li> <span class="param-type">string</span> </li> </ul> <dl class="details"> <dt class="tag-source method-doc-label method-doc-details-label">Source:</dt> <dd class="tag-source"> Property/Property.js </dd> </dl>