Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

filter-tree

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-tree - npm Package Compare versions

Comparing version 0.3.35 to 0.3.36

44

js/Conditionals.js

@@ -30,3 +30,3 @@ /** @module conditionals */

* @param {sqlIdQtsObject} [options.sqlIdQts={beg:'"',end:'"'}]
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -44,3 +44,3 @@ initialize: function(options) {

* @returns {string}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -54,3 +54,3 @@ makeSqlIdentifier: function(id) {

* @returns {string}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -62,3 +62,3 @@ makeSqlString: function(string) {

/**
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -73,3 +73,3 @@ makeLIKE: function(beg, end, op, originalOp, c) {

/**
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -83,3 +83,3 @@ makeIN: function(op, c) {

/**
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -100,3 +100,3 @@ make: function(op, c) {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -108,3 +108,3 @@ '<': {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -117,3 +117,3 @@ '<=': {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -126,3 +126,3 @@ '=': {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -135,3 +135,3 @@ '>=': {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -144,3 +144,3 @@ '>': {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -153,3 +153,3 @@ '<>': {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -163,3 +163,3 @@ LIKE: {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -173,3 +173,3 @@ 'NOT LIKE': {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -184,3 +184,3 @@ IN: { // TODO: currently forcing string typing; rework calling code to respect column type

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -195,3 +195,3 @@ 'NOT IN': { // TODO: currently forcing string typing; rework calling code to respect column type

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -205,3 +205,3 @@ CONTAINS: {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -215,3 +215,3 @@ 'NOT CONTAINS': {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -225,3 +225,3 @@ BEGINS: {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -235,3 +235,3 @@ 'NOT BEGINS': {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -245,3 +245,3 @@ ENDS: {

/** @type {relationalOperator}
* @memberOf Conditionals.prototype
* @memberOf Conditionals#
*/

@@ -248,0 +248,0 @@ 'NOT ENDS': {

@@ -89,3 +89,3 @@ /* eslint-env browser */

* @desc This new "view" is a group of HTML `Element` controls that completely describe the conditional expression this object represents. This method creates the view, setting `this.el` to point to it, and the members of `this.view` to point to the individual controls therein.
* @memberOf FilterLeaf.prototype
* @memberOf FilterLeaf#
*/

@@ -143,3 +143,16 @@ createView: function(state) {

el.value = value;
if (FilterNode.setWarningClass(el) !== value) {
if (el.value === '' && key === 'operator') {
// Operator may be a synonym.
var ops = this.root.conditionals.ops,
thisOp = ops[value],
opMenu = getOpMenu.call(this, state.column || this.column);
// Check each menu item's op object for equivalency to possible synonym's op object.
popMenu.walk.call(opMenu, function(opMenuItem) {
var opName = opMenuItem.name || opMenuItem;
if (ops[opName] === thisOp) {
el.value = opName;
}
});
}
if (!FilterNode.setWarningClass(el)) {
notes.push({ key: key, value: value });

@@ -192,3 +205,3 @@ } else if (key === 'column') {

* @returns {undefined} This is the normal return when valid; otherwise throws error when invalid.
* @memberOf FilterLeaf.prototype
* @memberOf FilterLeaf#
*/

@@ -202,21 +215,8 @@ invalid: function(options) {

if (value === '' && elementName === 'operator') {
var ops = this.root.conditionals.ops,
op = ops[this.operator];
if (op) {
if (getProperty.call(this, this.column, 'opMustBeInMenu')) {
// Operator not found in menu because may be a synonym.
// Check each menu item's op object for equivalency to possible synonym's.
var opMenu = getOpMenu.call(this, this.column);
popMenu.walk.call(opMenu, function(opMenuItem) {
var opName = opMenuItem.name || opMenuItem;
if (ops[opName] === op) {
value = opName;
}
});
} else {
value = this.operator;
}
}
if (
value === '' && elementName === 'operator' && // not in operator menu
this.root.conditionals.ops[this.operator] && // but valid in operator hash
!getProperty.call(this, this.column, 'opMustBeInMenu') // and is doesn't have to be in menu to be valid
) {
value = this.operator; // use it as is then
}

@@ -312,3 +312,3 @@

*
* @memberOf FilterLeaf.prototype
* @memberOf FilterLeaf#
*/

@@ -351,3 +351,3 @@ getState: function getState(options) {

* @param [sort]
* @memberOf FilterLeaf.prototype
* @memberOf FilterLeaf#
*/

@@ -354,0 +354,0 @@ makeElement: function(menu, prompt, sort) {

@@ -106,22 +106,2 @@ /* eslint-env browser */

*
* @property {FilterNode} [parent] - Undefined means this is the root node.
*
* @property {FilterNode} root - Convenience reference to the root node.
*
* @property {menuItem[]} schema - Column schema used by descendant leaf nodes (including this node if it is a leaf node) to render a column choice drop-down.
*
* @property {string} [editor] - Name of filter editor used by descendant leaf nodes (including this node if it is a leaf node).
*
* @property {function} [eventHandler] - Event handler for UI events. See *Events* in the {@link http://joneit.github.io/filter-tree/index.html|readme} for more information.
*
* @property {menuItem[]} [treeOpMenu=Conditionals.defaultOpMenu] - Default operator menu for all descendant leaf nodes. Only used if the leaf node has no defined `opMenu` property _and_ there is no menu defined in `typeOpMenus` keyed to the column's `type`.
*
* @property {object} [typeOpMap] - A hash of type names. Each member thus defined contains a specific operator menu for all descendant leaf nodes that:
* 1. do not have their own operator menu (`opMenu` property) of their own; and
* 2. whose columns resolve to that type.
*
* The type is determined by (in priority order):
* 1. the `type` property of the {@link FilterLeaf}; or
* 2. the `type` property of the element in the nearest node (including the leaf node itself) that has a defined `ownSchema` or `schema` array property with an element having a matching column name.
*
* @property {sqlIdQtsObject} [sqlIdQts={beg:'"',end:'"'}] - Quote characters for SQL identifiers. Used for both parsing and generating SQL. Should be placed on the root node.

@@ -157,3 +137,3 @@ *

*
* * @memberOf FilterNode.prototype
* * @memberOf FilterNode#
*/

@@ -163,2 +143,7 @@ initialize: function(options) {

/** @summary Reference to this node's parent node.
* @desc When this property is undefined, this node is the root node.
* @type {FilterNode}
* @memberOf FilterNode#
*/
var parent = this.parent = this.parent || options.parent,

@@ -188,2 +173,7 @@ root = parent && parent.root;

/** @summary Convenience reference to the root node.
* @name root
* @type {FilterNode}
* @memberOf FilterNode#
*/
this.root = root;

@@ -197,4 +187,5 @@

/** Insert each subtree into its parent node along with a "delete" button.
* > The root tree (which has no parent) is inserted into the DOM by the instantiating code (without a delete button).
* @memberOf FilterNode.prototype
*
* NOTE: The root tree (which has no parent) must be inserted into the DOM by the instantiating code (without a delete button).
* @memberOf FilterNode#
*/

@@ -225,3 +216,3 @@ render: function() {

* @param {FilterTreeSetStateOptionsObject} [options]
* @memberOf FilterNode.prototype
* @memberOf FilterNode#
*/

@@ -264,3 +255,3 @@ setState: function(state, options) {

*
* @memberOf FilterNode
* @memberOf FilterNode#
* @inner

@@ -359,3 +350,3 @@ */

* * `this` filter node's `el`'s container (always a `<li>` element) from its parent element.
* @memberOf FilterNode.prototype
* @memberOf FilterNode#
*/

@@ -406,3 +397,3 @@ remove: function() {

* @desc The following properties bear the same names as the node options they define.
* @type {pbject}
* @type {object}
* @memberOf FilterNode

@@ -417,19 +408,18 @@ */

/** @summary Default column schema for column drop-downs of direct descendant leaf nodes only.
* @desc > This docs entry describes a property in the FilterNode prototype. It does not describe the optionsSchema property (despite it's position in the source code).
* @memberOf FilterNode#
* @type {string[]}
* @memberOf FilterNode.optionsSchema
*/
ownSchema: { own: true },
/** @summary Default column schema for column drop-downs of all descendant leaf nodes.
* @desc > This docs entry describes a property in the FilterNode prototype. It does not describe the optionsSchema property (despite it's position in the source code).
/** @summary Column schema for column drop-downs of all descendant nodes. Pertains to leaf nodes only.
* @memberOf FilterNode#
* @type {menuItem[]}
* @memberOf FilterNode.optionsSchema
*/
schema: {},
/** @summary Type of filter editor.
* @desc > This docs entry describes a property in the FilterNode prototype. It does not describe the optionsSchema property (despite it's position in the source code).
/** @summary Filter editor for user interface.
* @desc Name of filter editor used by this and all descendant nodes. Pertains to leaf nodes only.
* @default 'Default'
* @memberOf FilterNode#
* @type {string}
* @memberOf FilterNode.optionsSchema
*/

@@ -439,16 +429,26 @@ editor: {},

/** @summary Event handler for UI events.
* @desc > This docs entry describes a property in the FilterNode prototype. It does not describe the optionsSchema property (despite it's position in the source code).
* @type {string}
* @memberOf FilterNode.optionsSchema
* @desc See *Events* in the {@link http://joneit.github.io/filter-tree/index.html|readme} for more information.
* @memberOf FilterNode#
* @type {function}
*/
eventHandler: {},
/** @summary Fields data type.
* @memberOf FilterNode#
* @type {string}
*/
type: { own: true },
/** @summary Undeleteable node.
* @desc Truthy means don't render a delete button next to the filter editor for this node.
* @memberOf FilterNode#
* @type {boolean}
*/
keep: { own: true },
/** @summary Override operator list at any node.
* @desc > This docs entry describes a property in the FilterNode prototype. It does not describe the optionsSchema property (despite it's position in the source code).
* @type {string[]}
* @memberOf FilterNode.optionsSchema
* @desc The default is applied to the root node and any other node without an operator menu.
* @default {@link Conditionals.defaultOpMenu}.
* @memberOf FilterNode#
* @type {menuItem[]}
*/

@@ -458,14 +458,23 @@ opMenu: { default: Conditionals.defaultOpMenu },

/** @summary Truthy considers op valid only if in menu.
* @desc Otherwise, op is valid if in `this.root.conditionals.ops`.
* > This docs entry describes a property in the FilterNode prototype. It does not describe the optionsSchema property (despite it's position in the source code).
* @memberOf FilterNode# (despite it's position in the source code).
* @type {boolean}
* @memberOf FilterNode.optionsSchema
*/
opMustBeInMenu: {},
/** @summary Dictionary of operator menus for specific data types.
* @memberOf FilterNode#
* @type {object}
* @desc A hash of type names. Each member thus defined contains a specific operator menu for all descendant leaf nodes that:
* 1. do not have their own operator menu (`opMenu` property) of their own; and
* 2. whose columns resolve to that type.
*
* The type is determined by (in priority order):
* 1. the `type` property of the {@link FilterLeaf}; or
* 2. the `type` property of the element in the nearest node (including the leaf node itself) that has a defined `ownSchema` or `schema` array property with an element having a matching column name.
*/
typeOpMap: { rootBound: true },
/** @summary Truthy will sort the column menus.
* @memberOf FilterNode#
* @type {boolean}
* @memberOf FilterNode.optionsSchema
*/

@@ -472,0 +481,0 @@ sortColumnMenu: {}

@@ -95,3 +95,3 @@ /* eslint-env browser */

* @param {string} key - The name of the existing editor to remove.
* @memberOf FilterTree.prototype
* @memberOf FilterTree#
*/

@@ -107,3 +107,3 @@ removeEditor: function(key) {

*
* @memberOf FilterTree.prototype
* @memberOf FilterTree#
*/

@@ -147,3 +147,3 @@ createView: function() {

*
* @memberOf FilterTree.prototype
* @memberOf FilterTree#
*/

@@ -177,3 +177,3 @@ loadState: function(state) {

*
* @memberOf FilterTree.prototype
* @memberOf FilterTree#
*/

@@ -223,3 +223,3 @@ render: function() {

*
* @memberOf FilterTree.prototype
* @memberOf FilterTree#
*/

@@ -262,11 +262,14 @@ add: function(options) {

* @returns {undefined|FilterTreeError} `undefined` if valid; or the caught `FilterTreeError` if error.
* @memberOf FilterTree.prototype
* @memberOf FilterTree#
*/
invalid: function(options) {
var result;
options = options || {};
var result, throwWas;
throwWas = options.throw;
options.throw = true;
try {
result = invalid.call(this, options);
invalid.call(this, options);
} catch (err) {

@@ -281,2 +284,4 @@ result = err;

options.throw = throwWas;
// Alter and/or throw when requested

@@ -299,3 +304,3 @@ if (result) {

* @returns {boolean}
* @memberOf FilterTree.prototype
* @memberOf FilterTree#
*/

@@ -380,3 +385,3 @@ test: function test(dataRow) {

* @returns {object|string} Returns object when `options.syntax === 'object'`; otherwise returns string.
* @memberOf FilterTree.prototype
* @memberOf FilterTree#
*/

@@ -453,3 +458,3 @@ getState: function getState(options) {

* @param {boolean} isSensitive
* @memberOf Filtertree.prototype.prototype
* @memberOf Filtertree#.prototype
*/

@@ -456,0 +461,0 @@ setCaseSensitivity: function(isSensitive) {

{
"name": "filter-tree",
"version": "0.3.35",
"version": "0.3.36",
"description": "Complex table filter expressions with GUI editor.",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc